]> git.mxchange.org Git - flightgear.git/commitdiff
Removed debug print statements.
authordavid <david>
Sun, 3 Nov 2002 15:48:08 +0000 (15:48 +0000)
committerdavid <david>
Sun, 3 Nov 2002 15:48:08 +0000 (15:48 +0000)
Added ability to set a name for an animation and refer to it in
subsequent animations.

src/Model/model.cxx

index 88490eec30b082a9c2f0d618e603960233cec80f..026438332c3391a52c58f607f5b73abc517551fa 100644 (file)
@@ -174,6 +174,7 @@ read_interpolation_table (SGPropertyNode_ptr props)
 
 static void
 make_animation (ssgBranch * model,
+                const char * name,
                 vector<SGPropertyNode_ptr> &name_nodes,
                 SGPropertyNode_ptr node)
 {
@@ -198,6 +199,9 @@ make_animation (ssgBranch * model,
     SG_LOG(SG_INPUT, SG_WARN, "Unknown animation type " << type);
   }
 
+  if (name != 0)
+      animation->setName((char *)name);
+
   ssgEntity * object;
   if (name_nodes.size() > 0) {
     object = find_named_node(model, name_nodes[0]->getStringValue());
@@ -223,11 +227,8 @@ make_animation (ssgBranch * model,
           animation = 0;
       }
       ssgBranch * oldParent = object->getParent(0);
-      std::cerr << "Moving " << name << " to new parent\n";
       branch->addKid(object);
       oldParent->removeKid(object);
-      std::cerr << "  leaf has " << object->getNumParents() << " parents\n";
-      std::cerr << "  branch has " << branch->getNumKids() << " kids\n";
   }
 
   branch->setUserData(animation);
@@ -295,9 +296,10 @@ fgLoad3DModel (const string &path)
   vector<SGPropertyNode_ptr> animation_nodes = props.getChildren("animation");
   unsigned int i;
   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");
-    make_animation(model, name_nodes, animation_nodes[i]);
+    make_animation(model, name, name_nodes, animation_nodes[i]);
   }
 
                                 // Load panels