]> git.mxchange.org Git - simgear.git/commitdiff
Load submodels before animations, so that we can animate submodels.
authordavid <david>
Fri, 27 Feb 2004 03:30:01 +0000 (03:30 +0000)
committerdavid <david>
Fri, 27 Feb 2004 03:30:01 +0000 (03:30 +0000)
Allow submodels to be named when they are loaded.

simgear/scene/model/model.cxx

index c2fdbb1cf18d7003f7b770d1dc3528bb3ede7985..39eb41c5c4fac25301b89d38928ec0f87eeca0b7 100644 (file)
@@ -236,16 +236,6 @@ sgLoad3DModel( const string &fg_root, const string &path,
 
   unsigned int i;
 
-                                // Load animations
-  vector<SGPropertyNode_ptr> animation_nodes = props.getChildren("animation");
-  for (i = 0; i < animation_nodes.size(); i++) {
-    const char * name = animation_nodes[i]->getStringValue("name", 0);
-    vector<SGPropertyNode_ptr> name_nodes =
-      animation_nodes[i]->getChildren("object-name");
-    sgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i],
-                     sim_time_sec);
-  }
-
                                 // Load sub-models
   vector<SGPropertyNode_ptr> model_nodes = props.getChildren("model");
   for (i = 0; i < model_nodes.size(); i++) {
@@ -264,9 +254,20 @@ sgLoad3DModel( const string &fg_root, const string &path,
     ssgBranch * kid = sgLoad3DModel( fg_root, node->getStringValue("path"),
                                      prop_root, sim_time_sec );
     align->addKid(kid);
+    align->setName(node->getStringValue("name", ""));
     model->addKid(align);
   }
 
+                                // Load animations
+  vector<SGPropertyNode_ptr> animation_nodes = props.getChildren("animation");
+  for (i = 0; i < animation_nodes.size(); i++) {
+    const char * name = animation_nodes[i]->getStringValue("name", 0);
+    vector<SGPropertyNode_ptr> name_nodes =
+      animation_nodes[i]->getChildren("object-name");
+    sgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i],
+                     sim_time_sec);
+  }
+
   return alignmainmodel;
 }