Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:rtv/Stage

  • Loading branch information...
commit 3e6adc822e58a3ce3114ad459df1cf8caf6f1796 2 parents bff8beb + 5ff0147
@rtv authored
Showing with 11 additions and 5 deletions.
  1. +11 −5 libstage/model_getset.cc
View
16 libstage/model_getset.cc
@@ -115,15 +115,21 @@ int Model::SetParent( Model* newparent)
{
// remove the model from its old parent (if it has one)
if( parent )
- EraseAll( this, parent->children );
+ parent->RemoveChild( this );
+ else
+ world->RemoveChild( this );
+ // link from the model to its new parent
+ this->parent = newparent;
if( newparent )
- newparent->children.push_back( this );
+ newparent->AddChild( this );
+ else
+ world->AddModel( this );
- // link from the model to its new parent
- this->parent = newparent;
+ CallCallbacks( CB_PARENT );
- CallCallbacks( CB_PARENT );
+ SetGlobalPose( oldPose ); // Needs to recalculate position due to change in parent
+
return 0; //ok
}
Please sign in to comment.
Something went wrong with that request. Please try again.