Node::Node()
: mParentOrigin( ParentOrigin::DEFAULT ),
mAnchorPoint( AnchorPoint::DEFAULT ),
- mSize( Vector3::ZERO ),
- mPosition( Vector3::ZERO ),
- mRotation( Quaternion::IDENTITY ),
+ mSize(), // zero initialized by default
+ mPosition(), // zero initialized by default
+ mOrientation(), // initialized to identity by default
mScale( Vector3::ONE ),
mVisible( true ),
mColor( Color::WHITE ),
- mWorldPosition( Vector3::ZERO ),
- mWorldRotation( Quaternion::IDENTITY ),
+ mWorldPosition(), // zero initialized by default
+ mWorldOrientation(), // initialized to identity by default
mWorldScale( Vector3::ONE ),
- mWorldMatrix( Matrix::IDENTITY ),
+ mWorldMatrix(),
mWorldColor( Color::WHITE ),
mParent( NULL ),
mExclusiveRenderTask( NULL ),
mAttachment( NULL ),
mChildren(),
- mGeometryScale( Vector3::ONE ),
- mInitialVolume( Vector3::ONE ),
+ mDepth(0u),
mDirtyFlags(AllFlags),
mIsRoot( false ),
- mInheritRotation( true ),
+ mInheritOrientation( true ),
mInheritScale( true ),
- mTransmitGeometryScaling( false ),
mInhibitLocalTransform( false ),
mIsActive( true ),
mDrawMode( DrawMode::NORMAL ),
}
// Animators, Constraints etc. should be disconnected from the child's properties.
- PropertyOwner::DisconnectFromSceneGraph();
+ PropertyOwner::Destroy();
}
void Node::Attach( NodeAttachment& object )
mAttachment = &object;
SetAllDirtyFlags();
+
+ if( mIsActive )
+ {
+ mAttachment->ConnectedToSceneGraph();
+ }
}
void Node::SetRoot(bool isRoot)
{
mChildren.Insert(mChildren.Begin()+index, childNode);
}
+
+ // Inform property observers of new connection
+ childNode->ConnectToSceneGraph();
+
+ // Inform child node attachment that the node has been added to the stage
+ if( childNode->mAttachment )
+ {
+ childNode->mAttachment->ConnectedToSceneGraph();
+ }
}
void Node::DisconnectChild( BufferIndex updateBufferIndex, Node& childNode, std::set<Node*>& connectedNodes, std::set<Node*>& disconnectedNodes )
// Check whether the transform related properties have changed
if( !sizeFlag ||
!mPosition.IsClean() ||
- !mRotation.IsClean() ||
+ !mOrientation.IsClean() ||
!mScale.IsClean() ||
mParentOrigin.InputChanged() || // parent origin and anchor point rarely change
mAnchorPoint.InputChanged() )
// Reset default properties
mSize.ResetToBaseValue( updateBufferIndex );
mPosition.ResetToBaseValue( updateBufferIndex );
- mRotation.ResetToBaseValue( updateBufferIndex );
+ mOrientation.ResetToBaseValue( updateBufferIndex );
mScale.ResetToBaseValue( updateBufferIndex );
mVisible.ResetToBaseValue( updateBufferIndex );
mColor.ResetToBaseValue( updateBufferIndex );
DALI_ASSERT_ALWAYS(mParent == NULL);
mParent = &parentNode;
+ mDepth = mParent->GetDepth() + 1u;
}
void Node::RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex, std::set<Node*>& connectedNodes, std::set<Node*>& disconnectedNodes )
}
// Animators, Constraints etc. should be disconnected from the child's properties.
- PropertyOwner::DisconnectFromSceneGraph();
+ PropertyOwner::DisconnectFromSceneGraph( updateBufferIndex );
// Remove back-pointer to parent
mParent = NULL;
+ mDepth = 0u;
// Remove all child pointers
mChildren.Clear();
+ // Inform child node attachment that the node has been removed from the stage
+ if( mAttachment )
+ {
+ mAttachment->DisconnectedFromSceneGraph();
+ }
+
// Move into disconnectedNodes
std::set<Node*>::size_type removed = connectedNodes.erase( this );
DALI_ASSERT_ALWAYS( removed );