1
0
Fork 0

Change code to use copyProperties

This commit is contained in:
James Turner 2021-02-10 12:49:07 +00:00
parent 0bca9e75b0
commit ab95c8149a
3 changed files with 8 additions and 6 deletions

View file

@ -468,7 +468,7 @@ NewGUI::setStyle (void)
// n->copy() doesn't delete existing nodes, so need to clear them all
// first.
selected_style->removeAllChildren();
n->copy(selected_style);
copyProperties(n, selected_style);
//if (selected_style && n)
// n->alias(selected_style);

View file

@ -1524,11 +1524,11 @@ static SGPropertyNode_ptr SviewConfigForCurrentView()
SGPropertyNode* config_view = config->getNode("view", true /*create*/);
if (callsign == "") {
/* User aircraft. */
globals->get_props()->getNode("/sim/view", view_number_raw)->copy(config_view);
copyProperties(globals->get_props()->getNode("/sim/view", view_number_raw), config_view);
}
else {
/* Multiplayer aircraft. */
root->getNode("set/sim/view", view_number_raw)->copy(config_view);
copyProperties(root->getNode("set/sim/view", view_number_raw), config_view);
}
config->setDoubleValue(
@ -1652,6 +1652,7 @@ std::shared_ptr<SviewView> SviewCreate(SGPropertyNode* config)
return nullptr;
}
osgViewer::View* main_view = renderer->getView();
osg::Node* scene_data = main_view->getSceneData();
@ -1672,7 +1673,7 @@ std::shared_ptr<SviewView> SviewCreate(SGPropertyNode* config)
}
else if (!strcmp(type, "current")) {
SGPropertyNode_ptr config2 = SviewConfigForCurrentView();
config->copy(config2);
copyProperties(config, config2);
config2->setStringValue("type", "legacy"); /* restore it after copy() sets to "current". */
sview_view.reset(new SviewViewEyeTarget(view, config2));
}

View file

@ -30,6 +30,7 @@
#include <simgear/compiler.h>
#include <simgear/scene/util/OsgMath.hxx>
#include <simgear/props/props_io.hxx>
#include <Main/fg_props.hxx>
#include "view.hxx"
@ -251,8 +252,8 @@ void FGViewMgr::view_push()
void s_clone_internal(const SGPropertyNode* config, const std::string& type)
{
SGPropertyNode_ptr config2 = new SGPropertyNode;
const_cast<SGPropertyNode*>(config)->copy(config2);
SGPropertyNode_ptr config2 = new SGPropertyNode;
copyProperties(config, config2);
config2->setStringValue("type", type);
SviewCreate(config2);
}