// CLASS HEADER
#include <dali/internal/update/manager/update-proxy-impl.h>
+// INTERNAL INCLUDES
+#include <dali/internal/update/manager/update-proxy-property-modifier.h>
+
namespace Dali
{
namespace
{
-SceneGraph::Node* FindNodeInSceneGraph( unsigned int id, SceneGraph::Node& node )
+SceneGraph::Node* FindNodeInSceneGraph( uint32_t id, SceneGraph::Node& node )
{
SceneGraph::Node* matchingNode = NULL;
} // unnamed namespace
-UpdateProxy::UpdateProxy( SceneGraph::TransformManager& transformManager, SceneGraph::Node& rootNode )
+UpdateProxy::UpdateProxy( SceneGraph::UpdateManager& updateManager, SceneGraph::TransformManager& transformManager, SceneGraph::Node& rootNode )
: mNodeContainer(),
mLastCachedIdNodePair( { 0u, NULL } ),
mCurrentBufferIndex( 0u ),
+ mUpdateManager( updateManager ),
mTransformManager( transformManager ),
- mRootNode( rootNode )
+ mRootNode( rootNode ),
+ mPropertyModifier( nullptr )
{
}
{
}
-Vector3 UpdateProxy::GetPosition( unsigned int id ) const
+bool UpdateProxy::GetPosition( uint32_t id, Vector3& position ) const
{
- const Dali::Matrix& matrix = GetWorldMatrix( id );
- return matrix.GetTranslation3();
+ bool success = false;
+ const SceneGraph::Node* node = GetNodeWithId( id );
+ if( node )
+ {
+ position = mTransformManager.GetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_POSITION );
+ success = true;
+ }
+ return success;
}
-void UpdateProxy::SetPosition( unsigned int id, const Vector3& position )
+bool UpdateProxy::SetPosition( uint32_t id, const Vector3& position )
{
- const SceneGraph::Node* node = GetNodeWithId( id );
+ bool success = false;
+ SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
- Matrix& matrix = mTransformManager.GetWorldMatrix( node->mTransformId );
- matrix.SetTranslation( position );
+ mTransformManager.SetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_POSITION, position );
+ success = true;
}
+ return success;
}
-const Vector3& UpdateProxy::GetSize( unsigned int id ) const
+bool UpdateProxy::BakePosition( uint32_t id, const Vector3& position )
{
- const SceneGraph::Node* node = GetNodeWithId( id );
+ bool success = false;
+ SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
- return mTransformManager.GetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SIZE );
+ mTransformManager.BakeVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_POSITION, position );
+ success = true;
}
+ return success;
+}
- return Vector3::ZERO;
+bool UpdateProxy::GetSize( uint32_t id, Vector3& size ) const
+{
+ bool success = false;
+ const SceneGraph::Node* node = GetNodeWithId( id );
+ if( node )
+ {
+ size = mTransformManager.GetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SIZE );
+ success = true;
+ }
+ return success;
}
-void UpdateProxy::SetSize( unsigned int id, const Vector3& size )
+bool UpdateProxy::SetSize( uint32_t id, const Vector3& size )
{
+ bool success = false;
SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
mTransformManager.SetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SIZE, size );
+ success = true;
}
+ return success;
}
-void UpdateProxy::GetPositionAndSize( unsigned int id, Vector3& position, Vector3& size ) const
+bool UpdateProxy::BakeSize( uint32_t id, const Vector3& size )
{
- Matrix worldMatrix( false );
- GetWorldMatrixAndSize( id, worldMatrix, size );
- position = worldMatrix.GetTranslation3();
+ bool success = false;
+ SceneGraph::Node* node = GetNodeWithId( id );
+ if( node )
+ {
+ mTransformManager.BakeVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SIZE, size );
+ success = true;
+ }
+ return success;
}
-Vector4 UpdateProxy::GetWorldColor( unsigned int id ) const
+bool UpdateProxy::GetPositionAndSize( uint32_t id, Vector3& position, Vector3& size ) const
{
- SceneGraph::Node* node = GetNodeWithId( id );
+ bool success = false;
+ const SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
- return node->mWorldColor.Get( mCurrentBufferIndex );
+ position = mTransformManager.GetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_POSITION );
+ size = mTransformManager.GetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SIZE );
+ success = true;
}
+ return success;
+}
- return Vector4::ZERO;
+bool UpdateProxy::GetScale( uint32_t id, Vector3& scale ) const
+{
+ bool success = false;
+ const SceneGraph::Node* node = GetNodeWithId( id );
+ if( node )
+ {
+ scale = mTransformManager.GetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SCALE );
+ success = true;
+ }
+
+ return success;
}
-void UpdateProxy::SetWorldColor( unsigned int id, const Vector4& color ) const
+bool UpdateProxy::SetScale( uint32_t id, const Vector3& scale )
{
+ bool success = false;
SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
- Vector4& currentColor = node->mWorldColor.Get( mCurrentBufferIndex );
- currentColor = color;
+ mTransformManager.SetVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SCALE, scale );
+ success = true;
}
+ return success;
}
-void UpdateProxy::GetWorldMatrixAndSize( unsigned int id, Matrix& worldMatrix, Vector3& size ) const
+bool UpdateProxy::BakeScale( uint32_t id, const Vector3& scale )
{
- const SceneGraph::Node* node = GetNodeWithId( id );
+ bool success = false;
+ SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
- mTransformManager.GetWorldMatrixAndSize( node->mTransformId, worldMatrix, size );
+ mTransformManager.BakeVector3PropertyValue( node->mTransformId, SceneGraph::TRANSFORM_PROPERTY_SCALE, scale );
+ success = true;
}
+ return success;
}
-const Matrix& UpdateProxy::GetWorldMatrix( unsigned int id ) const
+bool UpdateProxy::GetColor( uint32_t id, Vector4& color ) const
{
- const SceneGraph::Node* node = GetNodeWithId( id );
+ bool success = false;
+ SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
- return mTransformManager.GetWorldMatrix( node->mTransformId );
+ color = node->mColor.Get( mCurrentBufferIndex );
+ success = true;
}
- return Matrix::IDENTITY;
+ return success;
}
-void UpdateProxy::SetWorldMatrix( unsigned int id, const Matrix& worldMatrix )
+bool UpdateProxy::SetColor( uint32_t id, const Vector4& color )
{
+ bool success = false;
SceneGraph::Node* node = GetNodeWithId( id );
if( node )
{
- Matrix& currentMatrix = mTransformManager.GetWorldMatrix( node->mTransformId );
- currentMatrix = worldMatrix;
+ node->mColor.Set( mCurrentBufferIndex, color );
+ node->SetDirtyFlag( SceneGraph::NodePropertyFlags::COLOR );
+ AddResetter( *node, node->mColor );
+ success = true;
}
+ return success;
}
-SceneGraph::Node* UpdateProxy::GetNodeWithId( unsigned int id ) const
+bool UpdateProxy::BakeColor( uint32_t id, const Vector4& color )
+{
+ bool success = false;
+ SceneGraph::Node* node = GetNodeWithId( id );
+ if( node )
+ {
+ node->mColor.Bake( mCurrentBufferIndex, color );
+ success = true;
+ }
+ return success;
+}
+
+void UpdateProxy::NodeHierarchyChanged()
+{
+ mLastCachedIdNodePair = { 0u, NULL };
+ mNodeContainer.clear();
+ mPropertyModifier.reset();
+}
+
+SceneGraph::Node* UpdateProxy::GetNodeWithId( uint32_t id ) const
{
SceneGraph::Node* node = NULL;
return node;
}
+void UpdateProxy::AddResetter( SceneGraph::Node& node, SceneGraph::PropertyBase& propertyBase )
+{
+ if( ! mPropertyModifier )
+ {
+ mPropertyModifier = PropertyModifierPtr( new PropertyModifier( mUpdateManager ) );
+ }
+ mPropertyModifier->AddResetter( node, propertyBase );
+}
+
} // namespace Internal
} // namespace Dali