]> git.mxchange.org Git - simgear.git/commitdiff
allow to modify the XML animation config of a loaded submodel by
authormfranz <mfranz>
Tue, 14 Oct 2008 13:01:01 +0000 (13:01 +0000)
committermfranz <mfranz>
Tue, 14 Oct 2008 13:01:01 +0000 (13:01 +0000)
defining an <overlay> branch, which is copied over the submodel's
properties before the animations are evaluated

simgear/scene/model/SGReaderWriterXML.cxx

index 58b104ebaa36724e230db75c790443b2a0546c92..7b56bc6f910f05575179c3ce276cb511fe858147 100644 (file)
@@ -50,8 +50,9 @@ using namespace simgear;
 osg::Node *
 sgLoad3DModel_internal(const string &path,
                        SGPropertyNode *prop_root,
-                       SGModelData *data=0,
-                       osg::Node *(*load_panel)(SGPropertyNode *) = 0);
+                       SGModelData *data = 0,
+                       osg::Node *(*load_panel)(SGPropertyNode *) = 0,
+                       SGPropertyNode *overlay = 0);
 
 const char* SGReaderWriterXML::className() const
 {
@@ -131,7 +132,8 @@ osg::Node *
 sgLoad3DModel_internal(const string &path,
                        SGPropertyNode *prop_root,
                        SGModelData *data,
-                       osg::Node *(*load_panel)(SGPropertyNode *))
+                       osg::Node *(*load_panel)(SGPropertyNode *),
+                       SGPropertyNode *overlay)
 {
     if ( !prop_root ) {
         SG_LOG(SG_GENERAL, SG_ALERT, "prop_root NULL: " << path);
@@ -158,6 +160,9 @@ sgLoad3DModel_internal(const string &path,
             SG_LOG(SG_INPUT, SG_ALERT, "Failed to load xml: " << t.getFormattedMessage());
             throw;
         }
+        if (overlay)
+            copyProperties(overlay, props);
+
         if (props->hasValue("/path")) {
             modelpath = modelpath.dir();
             modelpath.append(props->getStringValue("/path"));
@@ -234,7 +239,8 @@ sgLoad3DModel_internal(const string &path,
             submodelpath = submodelFileName;
         }
         try {
-            submodel = sgLoad3DModel_internal(submodelpath.str(), prop_root, 0, load_panel);
+            submodel = sgLoad3DModel_internal(submodelpath.str(), prop_root, 0, load_panel,
+                                              sub_props->getNode("overlay"));
         } catch (const sg_throwable &t) {
             SG_LOG(SG_INPUT, SG_ALERT, "Failed to load submodel: " << t.getFormattedMessage());
             throw;