Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Applied patch #2926679: Fix for Model::SetParent

  • Loading branch information...
commit 250d5bea6964720a530cdea837530c084d835c75 1 parent 3849dc5
authored September 14, 2010

Showing 1 changed file with 11 additions and 5 deletions. Show diff stats Hide diff stats

  1. 16  libstage/model_getset.cc
16  libstage/model_getset.cc
@@ -120,15 +120,21 @@ int Model::SetParent( Model* newparent)
120 120
 {  
121 121
   // remove the model from its old parent (if it has one)
122 122
   if( parent )
123  
-	 EraseAll( this, parent->children );
  123
+	parent->RemoveChild( this );
  124
+  else
  125
+    world->RemoveChild( this );
  126
+  // link from the model to its new parent
  127
+  this->parent = newparent;
124 128
   
125 129
   if( newparent )
126  
-	 newparent->children.push_back( this );
  130
+    newparent->AddChild( this );
  131
+  else
  132
+    world->AddModel( this );
127 133
 
128  
-  // link from the model to its new parent
129  
-  this->parent = newparent;
  134
+  CallCallbacks( CB_PARENT );
130 135
 
131  
-	CallCallbacks( CB_PARENT );
  136
+  SetGlobalPose( oldPose ); // Needs to recalculate position due to change in parent
  137
+  
132 138
   return 0; //ok
133 139
 }
134 140
 

0 notes on commit 250d5be

Please sign in to comment.
Something went wrong with that request. Please try again.