Browse Source

fix more flatten bugs

David Rose 24 years ago
parent
commit
feebd57503

+ 4 - 1
panda/src/collide/collisionNode.cxx

@@ -153,9 +153,12 @@ combine_with(Node *other) {
       mark_bound_stale();
       mark_bound_stale();
       return this;
       return this;
     }
     }
+
+    // Two CollisionNodes with different names can't combine.
+    return (Node *)NULL;
   }
   }
 
 
-  return (Node *)NULL;
+  return NamedNode::combine_with(other);
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 5 - 1
panda/src/graph/namedNode.cxx

@@ -75,10 +75,14 @@ combine_with(Node *other) {
     }
     }
     // The other node is also a NamedNode, or better, so it wins.
     // The other node is also a NamedNode, or better, so it wins.
     return other;
     return other;
+
+  } else if (other->is_exact_type(get_class_type())) {
+    // We're not an ordinary NamedNode, but the other one is.
+    return this;
   }
   }
 
 
   // We're something other than an ordinary NamedNode.  Don't combine.
   // We're something other than an ordinary NamedNode.  Don't combine.
-  return (Node *)NULL;
+  return Node::combine_with(other);
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 4 - 0
panda/src/graph/node.cxx

@@ -208,6 +208,10 @@ combine_with(Node *other) {
   if (is_exact_type(get_class_type())) {
   if (is_exact_type(get_class_type())) {
     // No, we're an ordinary Node.
     // No, we're an ordinary Node.
     return other;
     return other;
+
+  } else if (other->is_exact_type(get_class_type())) {
+    // We're not an ordinary Node, but the other one is.
+    return this;
   }
   }
 
 
   // We're something other than an ordinary Node.  Don't combine.
   // We're something other than an ordinary Node.  Don't combine.

+ 1 - 1
panda/src/sgraph/geomNode.cxx

@@ -136,7 +136,7 @@ combine_with(Node *other) {
     return this;
     return this;
   }
   }
 
 
-  return (Node *)NULL;
+  return NamedNode::combine_with(other);
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////