Refactor SceneGraphProperty handling code in event side to make RegisterProperty... 75/192675/22
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Wed, 7 Nov 2018 16:25:45 +0000 (16:25 +0000)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Tue, 4 Dec 2018 11:15:47 +0000 (11:15 +0000)
- Merge CustomObject into Object
- Remove unnecessary virtuals returning nullptr
- Change GetSceneObject to always return Node for Actors
- Remove GetScenePropertyOwner as obsolete
- Fix incorrect baking behaviour in SceneGraphAnimator
- Remove ObjectImplHelper as redundant code
- Chain Scene Animatable and Input -Property getters correctly to base classes
- Remove Node& from Actor and use GetSceneObject instead, added a GetNode() helper
- Remove duplicate SceneObject pointers from Shader, Renderer, RenderTask and PanGesture
- Fix RenderTask to create its own SceneObject and not return public Handles in its construction
- Fix SceneGraph::RenderTask to observe Source and Camera nodes and remove observation from RenderTask to fix timing related bugs
- Fix RenderTaskList to keep intrusive pointers to RenderTasks rather than public Handles
- Fixed event handling to not use public handles for RenderTasks
- Fixed bug in shader where Scene objects were being leaked if SetProperty was called multiple times (added a test case)
- Fixed PanGestureDetector to acquire Scene object at construction (added a test case)
- Fix a bug in integer animation where target value was incorrect due to wrong rounding (added a test case)
- Added RegisterProperty test cases for Constrainer, Path and GestureDetector classes

Change-Id: Id5107598df77e8b5929581f42cace05332738938

71 files changed:
automated-tests/src/dali/utc-Dali-Animation.cpp
automated-tests/src/dali/utc-Dali-Constrainer.cpp
automated-tests/src/dali/utc-Dali-GestureDetector.cpp
automated-tests/src/dali/utc-Dali-PanGesture.cpp
automated-tests/src/dali/utc-Dali-Path.cpp
automated-tests/src/dali/utc-Dali-Shader.cpp
dali/integration-api/render-task-list-integ.cpp
dali/internal/CMakeLists.txt
dali/internal/event/actors/actor-impl.cpp
dali/internal/event/actors/actor-impl.h
dali/internal/event/actors/camera-actor-impl.cpp
dali/internal/event/actors/camera-actor-impl.h
dali/internal/event/actors/custom-actor-internal.h
dali/internal/event/actors/layer-impl.cpp
dali/internal/event/animation/animator-connector.h
dali/internal/event/animation/constrainer.cpp
dali/internal/event/animation/constrainer.h
dali/internal/event/animation/constraint-base.cpp
dali/internal/event/animation/constraint-impl.h
dali/internal/event/animation/path-impl.cpp
dali/internal/event/animation/path-impl.h
dali/internal/event/common/object-impl-helper.h [deleted file]
dali/internal/event/common/object-impl.cpp
dali/internal/event/common/object-impl.h
dali/internal/event/common/property-metadata.cpp
dali/internal/event/common/property-metadata.h
dali/internal/event/common/property-notification-impl.cpp
dali/internal/event/common/stage-impl.cpp
dali/internal/event/common/type-info-impl.cpp
dali/internal/event/events/gesture-detector-impl.cpp
dali/internal/event/events/gesture-detector-impl.h
dali/internal/event/events/gesture-event-processor.cpp
dali/internal/event/events/gesture-event-processor.h
dali/internal/event/events/hit-test-algorithm-impl.cpp
dali/internal/event/events/hit-test-algorithm-impl.h
dali/internal/event/events/hover-event-processor.cpp
dali/internal/event/events/hover-event-processor.h
dali/internal/event/events/long-press-gesture-processor.cpp
dali/internal/event/events/long-press-gesture-processor.h
dali/internal/event/events/pan-gesture-detector-impl.cpp
dali/internal/event/events/pan-gesture-detector-impl.h
dali/internal/event/events/pan-gesture-processor.cpp
dali/internal/event/events/pan-gesture-processor.h
dali/internal/event/events/pinch-gesture-processor.cpp
dali/internal/event/events/pinch-gesture-processor.h
dali/internal/event/events/touch-event-processor.cpp
dali/internal/event/events/touch-event-processor.h
dali/internal/event/object/custom-object-internal.cpp [deleted file]
dali/internal/event/object/custom-object-internal.h [deleted file]
dali/internal/event/render-tasks/render-task-impl.cpp
dali/internal/event/render-tasks/render-task-impl.h
dali/internal/event/render-tasks/render-task-list-impl.cpp
dali/internal/event/render-tasks/render-task-list-impl.h
dali/internal/event/rendering/renderer-impl.cpp
dali/internal/event/rendering/renderer-impl.h
dali/internal/event/rendering/shader-impl.cpp
dali/internal/event/rendering/shader-impl.h
dali/internal/file.list
dali/internal/update/animation/scene-graph-animator.h
dali/internal/update/manager/update-manager.cpp
dali/internal/update/manager/update-manager.h
dali/internal/update/nodes/node.cpp
dali/internal/update/nodes/node.h
dali/internal/update/render-tasks/scene-graph-render-task.cpp
dali/internal/update/render-tasks/scene-graph-render-task.h
dali/internal/update/rendering/scene-graph-renderer.h
dali/public-api/animation/path.cpp
dali/public-api/object/handle.cpp
dali/public-api/render-tasks/render-task-list.cpp
dali/public-api/render-tasks/render-task.cpp
dali/public-api/rendering/renderer.cpp

index 83f3bad..254c862 100644 (file)
@@ -2073,7 +2073,7 @@ int UtcDaliAnimationPlayP(void)
   END_TEST;
 }
 
-int UtcDaliAnimationPlayOffStageP(void)
+int UtcDaliAnimationPlayOffStageDiscardP(void)
 {
   // Test that an animation can be played, when the actor is off-stage.
   // When the actor is added to the stage, it should appear at the current position
@@ -2084,7 +2084,7 @@ int UtcDaliAnimationPlayOffStageP(void)
   Actor actor = Actor::New();
   Vector3 basePosition(Vector3::ZERO);
   DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
-  // Not added to the stage!
+  // Not added to the stage yet!
 
   // Build the animation
   float durationSeconds(1.0f);
@@ -2106,7 +2106,99 @@ int UtcDaliAnimationPlayOffStageP(void)
   // We didn't expect the animation to finish yet
   application.SendNotification();
   finishCheck.CheckSignalNotReceived();
-  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*off-stage*/, TEST_LOCATION );
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(20,20,20), TEST_LOCATION );
+
+  // Add to the stage
+  Stage::GetCurrent().Add(actor);
+
+  application.SendNotification();
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
+
+  // Remove from the stage
+  Stage::GetCurrent().Remove(actor);
+
+  application.SendNotification();
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position as disconnect behaviour is discard*/, TEST_LOCATION );
+  // Check that nothing has changed after a couple of buffer swaps
+  application.Render(0);
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
+  application.Render(0);
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
+  application.Render(0);
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO, TEST_LOCATION );
+
+  // Add to the stage
+  Stage::GetCurrent().Add(actor);
+
+  application.SendNotification();
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(80,80,80), TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+
+  // We did expect the animation to finish
+  application.SendNotification();
+  finishCheck.CheckSignalReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
+
+  // Check that nothing has changed after a couple of buffer swaps
+  application.Render(0);
+  DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
+
+
+  application.Render(0);
+  DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliAnimationPlayOffStageBakeFinalP(void)
+{
+  // Test that an animation can be played, when the actor is off-stage.
+  // When the actor is added to the stage, it should appear at the current position
+  // i.e. where it would have been anyway, if on-stage from the beginning.
+
+  TestApplication application;
+
+  Actor actor = Actor::New();
+  Vector3 basePosition(Vector3::ZERO);
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
+  // Not added to the stage!
+
+  // Build the animation
+  float durationSeconds(1.0f);
+  Animation animation = Animation::New(durationSeconds);
+  Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+  animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
+
+  // Start the animation
+  animation.Play();
+
+  bool signalReceived(false);
+  AnimationFinishCheck finishCheck(signalReceived);
+  animation.FinishedSignal().Connect(&application, finishCheck);
+
+  application.SendNotification();
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(20,20,20), TEST_LOCATION );
 
   // Add to the stage
   Stage::GetCurrent().Add(actor);
@@ -2117,8 +2209,7 @@ int UtcDaliAnimationPlayOffStageP(void)
   // We didn't expect the animation to finish yet
   application.SendNotification();
   finishCheck.CheckSignalNotReceived();
-  Vector3 expectedPosition(basePosition + (targetPosition - basePosition)*0.4f);
-  DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition/*on-stage*/, TEST_LOCATION );
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
 
   // Remove from the stage
   Stage::GetCurrent().Remove(actor);
@@ -2129,19 +2220,123 @@ int UtcDaliAnimationPlayOffStageP(void)
   // We didn't expect the animation to finish yet
   application.SendNotification();
   finishCheck.CheckSignalNotReceived();
-  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3::ZERO/*back to start position*/, TEST_LOCATION );
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition /*bake final*/, TEST_LOCATION );
+
+  // Add to the stage
+  Stage::GetCurrent().Add(actor);
+
+  application.SendNotification();
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition /*bake final removed the */, TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+
+  // We did expect the animation to finish
+  application.SendNotification();
+  finishCheck.CheckSignalReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
+
+  // Check that nothing has changed after a couple of buffer swaps
+  application.Render(0);
+  DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
+
+  application.Render(0);
+  DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliAnimationPlayOffStageBakeP(void)
+{
+  // Test that an animation can be played, when the actor is off-stage.
+  // When the actor is added to the stage, it should appear at the current position
+  // i.e. where it would have been anyway, if on-stage from the beginning.
+
+  TestApplication application;
+
+  Actor actor = Actor::New();
+  Vector3 basePosition(Vector3::ZERO);
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), basePosition, TEST_LOCATION );
+  // Not added to the stage!
+
+  // Build the animation
+  float durationSeconds(1.0f);
+  Animation animation = Animation::New(durationSeconds);
+  animation.SetDisconnectAction( Animation::Bake );
+  Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+  animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
+
+  // Start the animation
+  animation.Play();
+
+  bool signalReceived(false);
+  AnimationFinishCheck finishCheck(signalReceived);
+  animation.FinishedSignal().Connect(&application, finishCheck);
+
+  application.SendNotification();
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(20,20,20), TEST_LOCATION );
 
   // Add to the stage
   Stage::GetCurrent().Add(actor);
 
   application.SendNotification();
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
+
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
+
+  // Remove from the stage
+  Stage::GetCurrent().Remove(actor); // baked here
+
+  application.SendNotification();
+  // this render is a no-op in this case as animator is disabled while off stage
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
+  // We didn't expect the animation to finish yet
+  application.SendNotification();
+  finishCheck.CheckSignalNotReceived();
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(40,40,40) /*baked value*/, TEST_LOCATION );
+
+  // Add back to the stage
+  Stage::GetCurrent().Add(actor);
+
+  application.SendNotification();
   application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION );
+  application.Render(static_cast<unsigned int>(0.0f) );
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
+  application.Render(static_cast<unsigned int>(0.0f) );
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
+
+  // Remove from the stage
+  Stage::GetCurrent().Remove(actor); // baked here
+
+  application.SendNotification();
+  // this render is a no-op in this case as animator is disabled while off stage
+  application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
+  application.Render(static_cast<unsigned int>(0.0f) );
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
+  application.Render(static_cast<unsigned int>(0.0f) );
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
+
+  // Add back to the stage
+  Stage::GetCurrent().Add(actor);
 
   // We didn't expect the animation to finish yet
   application.SendNotification();
   finishCheck.CheckSignalNotReceived();
-  expectedPosition = Vector3(basePosition + (targetPosition - basePosition)*0.8f);
-  DALI_TEST_EQUALS( actor.GetCurrentPosition(), expectedPosition, TEST_LOCATION );
+  DALI_TEST_EQUALS( actor.GetCurrentPosition(), Vector3(88,88,88) , TEST_LOCATION );
 
   application.SendNotification();
   application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
@@ -2154,6 +2349,7 @@ int UtcDaliAnimationPlayOffStageP(void)
   // Check that nothing has changed after a couple of buffer swaps
   application.Render(0);
   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
+
   application.Render(0);
   DALI_TEST_EQUALS( targetPosition, actor.GetCurrentPosition(), TEST_LOCATION );
   END_TEST;
@@ -6699,7 +6895,7 @@ int UtcDaliAnimationAnimateToActorParentOriginP(void)
   DALI_TEST_ASSERTION(
   {
     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
-  }, "IsPropertyAnimatable( index )" );
+  }, "Property is not animatable" );
 
   END_TEST;
 }
@@ -6722,7 +6918,7 @@ int UtcDaliAnimationAnimateToActorParentOriginXN(void)
   DALI_TEST_ASSERTION(
   {
     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
-  }, "IsPropertyAnimatable( index )" );
+  }, "Property is not animatable" );
 
   END_TEST;
 }
@@ -6745,7 +6941,7 @@ int UtcDaliAnimationAnimateToActorParentOriginYN(void)
   DALI_TEST_ASSERTION(
   {
     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
-  }, "IsPropertyAnimatable( index )" );
+  }, "Property is not animatable" );
 
   END_TEST;
 }
@@ -6768,7 +6964,7 @@ int UtcDaliAnimationAnimateToActorParentOriginZN(void)
   DALI_TEST_ASSERTION(
   {
     animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
-  }, "IsPropertyAnimatable( index )" );
+  }, "Property is not animatable" );
 
   END_TEST;
 }
@@ -6789,7 +6985,7 @@ int UtcDaliAnimationAnimateToActorAnchorPointN(void)
   DALI_TEST_ASSERTION(
   {
     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
-  }, "IsPropertyAnimatable( index )" );
+  }, "Property is not animatable" );
 
   END_TEST;
 }
@@ -6812,7 +7008,7 @@ int UtcDaliAnimationAnimateToActorAnchorPointXN(void)
   DALI_TEST_ASSERTION(
   {
     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
-  }, "IsPropertyAnimatable( index )" );
+  }, "Property is not animatable" );
 
   END_TEST;
 }
@@ -6835,7 +7031,7 @@ int UtcDaliAnimationAnimateToActorAnchorPointYN(void)
   DALI_TEST_ASSERTION(
   {
     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
-  }, "IsPropertyAnimatable( index )" );
+  }, "Property is not animatable" );
 
   END_TEST;
 }
@@ -6858,7 +7054,7 @@ int UtcDaliAnimationAnimateToActorAnchorPointZN(void)
   DALI_TEST_ASSERTION(
   {
     animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
-  }, "IsPropertyAnimatable( index )" );
+  }, "Property is not animatable" );
 
   END_TEST;
 }
index 9bea015..30a006a 100644 (file)
@@ -693,3 +693,59 @@ int UtcLinearConstrainerProperties(void)
 
   END_TEST;
 }
+
+int UtcDaliLinearConstrainerDetectorRegisterProperty(void)
+{
+  TestApplication application;
+
+  Dali::LinearConstrainer constrainer = Dali::LinearConstrainer::New();
+
+  Property::Index index = constrainer.RegisterProperty( "sceneProperty", 0 );
+  DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION );
+  DALI_TEST_EQUALS( constrainer.GetProperty< int32_t >( index ), 0, TEST_LOCATION );
+
+  constrainer.SetProperty( index, -123 );
+  DALI_TEST_EQUALS( constrainer.GetProperty< int32_t >( index ), -123, TEST_LOCATION );
+
+  using Dali::Animation;
+  Animation animation = Animation::New( 1.0f );
+  animation.AnimateTo( Property( constrainer, index ), 99 );
+
+  DALI_TEST_EQUALS( constrainer.GetProperty< int32_t >( index ), -123, TEST_LOCATION );
+  // Start the animation
+  animation.Play();
+
+  application.SendNotification();
+  application.Render( 1000 /* 100% progress */);
+  DALI_TEST_EQUALS( constrainer.GetProperty< int32_t >( index ), 99, TEST_LOCATION );
+
+  END_TEST;
+}
+
+int UtcDaliPathConstrainerDetectorRegisterProperty(void)
+{
+  TestApplication application;
+
+  Dali::PathConstrainer constrainer = Dali::PathConstrainer::New();
+
+  Property::Index index = constrainer.RegisterProperty( "pathProperty", Vector2() );
+  DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION );
+  DALI_TEST_EQUALS( constrainer.GetProperty< Vector2 >( index ), Vector2(), TEST_LOCATION );
+
+  constrainer.SetProperty( index, Vector2(1,2) );
+  DALI_TEST_EQUALS( constrainer.GetProperty< Vector2 >( index ), Vector2(1,2), TEST_LOCATION );
+
+  using Dali::Animation;
+  Animation animation = Animation::New( 1.0f );
+  animation.AnimateTo( Property( constrainer, index ), Vector2(3,4) );
+
+  DALI_TEST_EQUALS( constrainer.GetProperty< Vector2 >( index ), Vector2(1,2), TEST_LOCATION );
+  // Start the animation
+  animation.Play();
+
+  application.SendNotification();
+  application.Render( 1000 /* 100% progress */);
+  DALI_TEST_EQUALS( constrainer.GetProperty< Vector2 >( index ), Vector2(3,4), TEST_LOCATION );
+
+  END_TEST;
+}
index 2cbbcf1..1c81dc0 100644 (file)
@@ -467,3 +467,31 @@ int UtcDaliGestureDetectorProperties(void)
 
   END_TEST;
 }
+
+int UtcDaliGestureDetectorRegisterProperty(void)
+{
+  TestApplication application;
+
+  GestureDetector detector = PinchGestureDetector::New();
+
+  Property::Index index = detector.RegisterProperty( "sceneProperty", 0 );
+  DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION );
+  DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 0, TEST_LOCATION );
+
+  detector.SetProperty( index, -123 );
+  DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), -123, TEST_LOCATION );
+
+  using Dali::Animation;
+  Animation animation = Animation::New( 1.0f );
+  animation.AnimateTo( Property( detector, index ), 99 );
+
+  DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), -123, TEST_LOCATION );
+  // Start the animation
+  animation.Play();
+
+  application.SendNotification();
+  application.Render( 1000 /* 100% progress */);
+  DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 99, TEST_LOCATION );
+
+  END_TEST;
+}
index b830f9d..b35ec97 100644 (file)
@@ -145,3 +145,55 @@ int UtcDaliPanGestureDynamicAllocation(void)
 
   END_TEST;
 }
+
+int UtcDaliPanGestureDetectorRegisterProperty(void)
+{
+  TestApplication application;
+
+  GestureDetector detector = PanGestureDetector::New();
+
+  Property::Index index = detector.RegisterProperty( "sceneProperty", 0 );
+  DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION );
+  DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 0, TEST_LOCATION );
+  detector.SetProperty( index, -99 );
+
+  using Dali::Animation;
+  Animation animation = Animation::New( 1.0f );
+  animation.AnimateTo( Property( detector, index ), 99 );
+  DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), -99, TEST_LOCATION );
+
+  // create another pan gesture
+  GestureDetector detector2 = PanGestureDetector::New();
+  DALI_TEST_EQUALS( detector2.GetProperty< int32_t >( index ), 0, TEST_LOCATION );
+
+  // Start the animation
+  animation.Play();
+  application.SendNotification();
+  application.Render( 500 /* 50% progress */);
+  DALI_TEST_EQUALS( detector.GetCurrentProperty< int32_t >( index ), 0 /*half way*/, TEST_LOCATION );
+
+  // register another pan gesture value
+  Property::Index index2 = detector2.RegisterProperty( "sceneProperty2", 12 );
+  DALI_TEST_EQUALS( index2, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION );
+  DALI_TEST_EQUALS( detector2.GetProperty< int32_t >( index2 ), 12, TEST_LOCATION );
+  DALI_TEST_EQUALS( detector2.GetCurrentProperty< int32_t >( index2 ), 12, TEST_LOCATION );
+
+  DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 99 /*target*/, TEST_LOCATION );
+  DALI_TEST_EQUALS( detector.GetCurrentProperty< int32_t >( index ), 0, TEST_LOCATION );
+
+  Animation animation2 = Animation::New( 1.0f );
+  animation2.AnimateTo( Property( detector2, index2 ), -99 );
+  // Start the animation
+  animation2.Play();
+  application.SendNotification();
+  application.Render( 1000 /* 100% more progress */);
+
+  DALI_TEST_EQUALS( detector2.GetProperty< int32_t >( index2 ), -99, TEST_LOCATION );
+  DALI_TEST_EQUALS( detector2.GetCurrentProperty< int32_t >( index2 ), -99, TEST_LOCATION );
+
+  DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 99, TEST_LOCATION );
+  DALI_TEST_EQUALS( detector.GetCurrentProperty< int32_t >( index ), 99, TEST_LOCATION );
+
+  END_TEST;
+}
+
index c3be5fb..be13ee8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -472,3 +472,32 @@ int UtcDaliPathPropertyControlPoints(void)
 
   END_TEST;
 }
+
+int UtcDaliPathRegisterProperty(void)
+{
+  TestApplication application;
+
+  Dali::Path path = Dali::Path::New();
+
+  Property::Index index = path.RegisterProperty( "sceneProperty", 0.f );
+  DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION );
+  DALI_TEST_EQUALS( path.GetProperty< float >( index ), 0.f, TEST_LOCATION );
+
+  path.SetProperty( index, -1 );
+  DALI_TEST_EQUALS( path.GetProperty< float >( index ), -1.f, TEST_LOCATION );
+
+  using Dali::Animation;
+  Animation animation = Animation::New( 1.0f );
+  animation.AnimateTo( Property( path, index ), 100.f );
+
+  DALI_TEST_EQUALS( path.GetProperty< float >( index ), -1.f, TEST_LOCATION );
+  // Start the animation
+  animation.Play();
+
+  application.SendNotification();
+  application.Render( 1000 /* 100% progress */);
+  DALI_TEST_EQUALS( path.GetProperty< float >( index ), 100.0f, TEST_LOCATION );
+
+  END_TEST;
+}
+
index af8a65f..5923a46 100644 (file)
@@ -318,6 +318,28 @@ int UtcDaliShaderAnimatedProperty02(void)
   DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
   DALI_TEST_EQUALS( actualValue, Color::TRANSPARENT, TEST_LOCATION );
 
+  // change shader program
+  Property::Map map;
+  map["vertex"] = VertexSource;
+  map["fragment"] = FragmentSource;
+  map["hints"] = "MODIFIES_GEOMETRY";
+  shader.SetProperty( Shader::Property::PROGRAM, Property::Value(map) );
+  application.SendNotification();
+  application.Render(100);
+
+  // register another custom property as well
+  Property::Index customIndex = shader.RegisterProperty( "uCustom", Vector3(1,2,3) );
+  DALI_TEST_EQUALS( shader.GetProperty<Vector3>( customIndex ), Vector3(1,2,3), TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render(100);
+
+  DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
+  DALI_TEST_EQUALS( actualValue, Color::TRANSPARENT, TEST_LOCATION );
+
+  Vector3 customValue;
+  DALI_TEST_CHECK( gl.GetUniformValue<Vector3>( "uCustom", customValue ) );
+  DALI_TEST_EQUALS( customValue, Vector3(1,2,3), TEST_LOCATION );
   END_TEST;
 }
 
@@ -336,6 +358,9 @@ int UtcDaliShaderProgramProperty(void)
   map["hints"] = hintSet;
 
   shader.SetProperty( Shader::Property::PROGRAM, Property::Value(map) );
+  // register a custom property as well
+  Property::Index customIndex = shader.RegisterProperty( "custom", Vector3(1,2,3) );
+  DALI_TEST_EQUALS( shader.GetProperty<Vector3>( customIndex ), Vector3(1,2,3), TEST_LOCATION );
 
   Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
   DALI_TEST_CHECK( value.GetType() == Property::MAP);
@@ -352,6 +377,15 @@ int UtcDaliShaderProgramProperty(void)
   value = shader.GetCurrentProperty( Shader::Property::PROGRAM );
   DALI_TEST_CHECK( value.GetType() == Property::MAP);
   outMap = value.GetMap();
+  // check that changing the shader did not cause us to loose custom property
+  DALI_TEST_EQUALS( shader.GetProperty<Vector3>( customIndex ), Vector3(1,2,3), TEST_LOCATION );
+  using Dali::Animation;
+  Animation animation = Animation::New( 0.1f );
+  animation.AnimateTo( Property( shader, customIndex ), Vector3(4,5,6) );
+  animation.Play();
+  application.SendNotification();
+  application.Render(100);
+  DALI_TEST_EQUALS( shader.GetProperty<Vector3>( customIndex ), Vector3(4,5,6), TEST_LOCATION );
 
   v = (*outMap)["vertex"].Get<std::string>();
   f = (*outMap)["fragment"].Get<std::string>();
index b37cdac..d23b749 100755 (executable)
@@ -40,7 +40,7 @@ Dali::RenderTaskList New()
 
 Dali::RenderTask CreateTask( Dali::RenderTaskList& taskList, Dali::Actor& sourceActor, Dali::CameraActor& cameraActor)
 {
-  return GetImplementation(taskList).CreateTask( &GetImplementation( sourceActor), &GetImplementation(cameraActor) );
+  return RenderTask( GetImplementation(taskList).CreateTask( &GetImplementation( sourceActor), &GetImplementation(cameraActor) ).Get() );
 }
 
 } // namespace RenderTaskList
index 2abb3a1..6152ffa 100644 (file)
@@ -74,7 +74,6 @@ SET(SOURCES ${SOURCES}
   ${CMAKE_CURRENT_SOURCE_DIR}/event/images/resource-image-impl.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/event/images/native-image-impl.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/event/images/pixel-data-impl.cpp
-  ${CMAKE_CURRENT_SOURCE_DIR}/event/object/custom-object-internal.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/event/render-tasks/render-task-impl.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/event/render-tasks/render-task-list-impl.cpp
   ${CMAKE_CURRENT_SOURCE_DIR}/event/rendering/frame-buffer-impl.cpp
index 37baa3b..7b0394a 100644 (file)
@@ -435,12 +435,12 @@ void Actor::SetName( const std::string& name )
   mName = name;
 
   // ATTENTION: string for debug purposes is not thread safe.
-  DALI_LOG_SET_OBJECT_STRING( const_cast< SceneGraph::Node* >( &mNode ), name );
+  DALI_LOG_SET_OBJECT_STRING( const_cast< SceneGraph::Node* >( &GetNode() ), name );
 }
 
 uint32_t Actor::GetId() const
 {
-  return mNode.GetId();
+  return GetNode().GetId();
 }
 
 bool Actor::OnStage() const
@@ -637,8 +637,8 @@ ActorPtr Actor::FindChildById( const uint32_t id )
 
 void Actor::SetParentOrigin( const Vector3& origin )
 {
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SetParentOriginMessage( GetEventThreadServices(), mNode, origin );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SetParentOriginMessage( GetEventThreadServices(), GetNode(), origin );
 
   // Cache for event-thread access
   if( !mParentOrigin )
@@ -685,8 +685,8 @@ const Vector3& Actor::GetCurrentParentOrigin() const
 
 void Actor::SetAnchorPoint( const Vector3& anchor )
 {
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SetAnchorPointMessage( GetEventThreadServices(), mNode, anchor );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SetAnchorPointMessage( GetEventThreadServices(), GetNode(), anchor );
 
   // Cache for event-thread access
   if( !mAnchorPoint )
@@ -745,46 +745,46 @@ void Actor::SetPosition( const Vector3& position )
 {
   mTargetPosition = position;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &mNode, &mNode.mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, position );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, position );
 }
 
 void Actor::SetX( float x )
 {
   mTargetPosition.x = x;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &mNode, &mNode.mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, x );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, x );
 }
 
 void Actor::SetY( float y )
 {
   mTargetPosition.y = y;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &mNode, &mNode.mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, y );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, y );
 }
 
 void Actor::SetZ( float z )
 {
   mTargetPosition.z = z;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &mNode, &mNode.mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, z );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, z );
 }
 
 void Actor::TranslateBy( const Vector3& distance )
 {
   mTargetPosition += distance;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &mNode, &mNode.mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeRelative, distance );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeRelative, distance );
 }
 
 const Vector3& Actor::GetCurrentPosition() const
 {
-  // mNode is being used in a separate thread; copy the value from the previous update
-  return mNode.GetPosition(GetEventThreadServices().GetEventBufferIndex());
+  // node is being used in a separate thread; copy the value from the previous update
+  return GetNode().GetPosition(GetEventThreadServices().GetEventBufferIndex());
 }
 
 const Vector3& Actor::GetTargetPosition() const
@@ -794,8 +794,8 @@ const Vector3& Actor::GetTargetPosition() const
 
 const Vector3& Actor::GetCurrentWorldPosition() const
 {
-  // mNode is being used in a separate thread; copy the value from the previous update
-  return mNode.GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() );
+  // node is being used in a separate thread; copy the value from the previous update
+  return GetNode().GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() );
 }
 
 const Vector2 Actor::GetCurrentScreenPosition() const
@@ -803,8 +803,8 @@ const Vector2 Actor::GetCurrentScreenPosition() const
   StagePtr stage = Stage::GetCurrent();
   if( stage && OnStage() )
   {
-    Vector3 worldPosition =  mNode.GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() );
-    Vector3 cameraPosition = stage->GetDefaultCameraActor().mNode.GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() );
+    Vector3 worldPosition =  GetNode().GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() );
+    Vector3 cameraPosition = stage->GetDefaultCameraActor().GetNode().GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() );
     worldPosition -= cameraPosition;
 
     Vector3 actorSize = GetCurrentSize() * GetCurrentWorldScale();
@@ -823,8 +823,8 @@ void Actor::SetPositionInheritanceMode( PositionInheritanceMode mode )
 {
   // this flag is not animatable so keep the value
   mPositionInheritanceMode = mode;
-  // mNode is being used in a separate thread; queue a message to set the value
-  SetInheritPositionMessage( GetEventThreadServices(), mNode, mode == INHERIT_PARENT_POSITION );
+  // node is being used in a separate thread; queue a message to set the value
+  SetInheritPositionMessage( GetEventThreadServices(), GetNode(), mode == INHERIT_PARENT_POSITION );
 }
 
 PositionInheritanceMode Actor::GetPositionInheritanceMode() const
@@ -837,9 +837,9 @@ void Actor::SetInheritPosition( bool inherit )
 {
   if( mInheritPosition != inherit )
   {
-    // non animateable so keep local copy
+    // non animatable so keep local copy
     mInheritPosition = inherit;
-    SetInheritPositionMessage( GetEventThreadServices(), mNode, inherit );
+    SetInheritPositionMessage( GetEventThreadServices(), GetNode(), inherit );
   }
 }
 
@@ -862,8 +862,8 @@ void Actor::SetOrientation( const Quaternion& orientation )
 {
   mTargetOrientation = orientation;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodeTransformPropertyMessage<Quaternion>::Send( GetEventThreadServices(), &mNode, &mNode.mOrientation, &SceneGraph::TransformManagerPropertyHandler<Quaternion>::Bake, orientation );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodeTransformPropertyMessage<Quaternion>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler<Quaternion>::Bake, orientation );
 }
 
 void Actor::RotateBy( const Radian& angle, const Vector3& axis )
@@ -875,20 +875,20 @@ void Actor::RotateBy( const Quaternion& relativeRotation )
 {
   mTargetOrientation *= Quaternion( relativeRotation );
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodeTransformPropertyMessage<Quaternion>::Send( GetEventThreadServices(), &mNode, &mNode.mOrientation, &SceneGraph::TransformManagerPropertyHandler<Quaternion>::BakeRelative, relativeRotation );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodeTransformPropertyMessage<Quaternion>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler<Quaternion>::BakeRelative, relativeRotation );
 }
 
 const Quaternion& Actor::GetCurrentOrientation() const
 {
-  // mNode is being used in a separate thread; copy the value from the previous update
-  return mNode.GetOrientation(GetEventThreadServices().GetEventBufferIndex());
+  // node is being used in a separate thread; copy the value from the previous update
+  return GetNode().GetOrientation(GetEventThreadServices().GetEventBufferIndex());
 }
 
 const Quaternion& Actor::GetCurrentWorldOrientation() const
 {
-  // mNode is being used in a separate thread; copy the value from the previous update
-  return mNode.GetWorldOrientation( GetEventThreadServices().GetEventBufferIndex() );
+  // node is being used in a separate thread; copy the value from the previous update
+  return GetNode().GetWorldOrientation( GetEventThreadServices().GetEventBufferIndex() );
 }
 
 void Actor::SetScale( float scale )
@@ -905,62 +905,62 @@ void Actor::SetScale( const Vector3& scale )
 {
   mTargetScale = scale;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &mNode, &mNode.mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, scale );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, scale );
 }
 
 void Actor::SetScaleX( float x )
 {
   mTargetScale.x = x;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &mNode, &mNode.mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, x );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, x );
 }
 
 void Actor::SetScaleY( float y )
 {
   mTargetScale.y = y;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &mNode, &mNode.mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, y );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, y );
 }
 
 void Actor::SetScaleZ( float z )
 {
   mTargetScale.z = z;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &mNode, &mNode.mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, z );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, z );
 }
 
 void Actor::ScaleBy(const Vector3& relativeScale)
 {
   mTargetScale *= relativeScale;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &mNode, &mNode.mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeRelativeMultiply, relativeScale );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeRelativeMultiply, relativeScale );
 }
 
 const Vector3& Actor::GetCurrentScale() const
 {
-  // mNode is being used in a separate thread; copy the value from the previous update
-  return mNode.GetScale(GetEventThreadServices().GetEventBufferIndex());
+  // node is being used in a separate thread; copy the value from the previous update
+  return GetNode().GetScale(GetEventThreadServices().GetEventBufferIndex());
 }
 
 const Vector3& Actor::GetCurrentWorldScale() const
 {
-  // mNode is being used in a separate thread; copy the value from the previous update
-  return mNode.GetWorldScale( GetEventThreadServices().GetEventBufferIndex() );
+  // node is being used in a separate thread; copy the value from the previous update
+  return GetNode().GetWorldScale( GetEventThreadServices().GetEventBufferIndex() );
 }
 
 void Actor::SetInheritScale( bool inherit )
 {
   if( mInheritScale != inherit )
   {
-    // non animateable so keep local copy
+    // non animatable so keep local copy
     mInheritScale = inherit;
-    // mNode is being used in a separate thread; queue a message to set the value
-    SetInheritScaleMessage( GetEventThreadServices(), mNode, inherit );
+    // node is being used in a separate thread; queue a message to set the value
+    SetInheritScaleMessage( GetEventThreadServices(), GetNode(), inherit );
   }
 }
 
@@ -971,7 +971,7 @@ bool Actor::IsScaleInherited() const
 
 Matrix Actor::GetCurrentWorldMatrix() const
 {
-  return mNode.GetWorldMatrix(0);
+  return GetNode().GetWorldMatrix(0);
 }
 
 void Actor::SetVisible( bool visible )
@@ -981,22 +981,22 @@ void Actor::SetVisible( bool visible )
 
 bool Actor::IsVisible() const
 {
-  // mNode is being used in a separate thread; copy the value from the previous update
-  return mNode.IsVisible( GetEventThreadServices().GetEventBufferIndex() );
+  // node is being used in a separate thread; copy the value from the previous update
+  return GetNode().IsVisible( GetEventThreadServices().GetEventBufferIndex() );
 }
 
 void Actor::SetOpacity( float opacity )
 {
   mTargetColor.a = opacity;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &mNode, &mNode.mColor, &AnimatableProperty<Vector4>::BakeW, opacity );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeW, opacity );
 }
 
 float Actor::GetCurrentOpacity() const
 {
-  // mNode is being used in a separate thread; copy the value from the previous update
-  return mNode.GetOpacity(GetEventThreadServices().GetEventBufferIndex());
+  // node is being used in a separate thread; copy the value from the previous update
+  return GetNode().GetOpacity(GetEventThreadServices().GetEventBufferIndex());
 }
 
 ClippingMode::Type Actor::GetClippingMode() const
@@ -1011,55 +1011,55 @@ uint32_t Actor::GetSortingDepth()
 
 const Vector4& Actor::GetCurrentWorldColor() const
 {
-  return mNode.GetWorldColor( GetEventThreadServices().GetEventBufferIndex() );
+  return GetNode().GetWorldColor( GetEventThreadServices().GetEventBufferIndex() );
 }
 
 void Actor::SetColor( const Vector4& color )
 {
   mTargetColor = color;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodePropertyMessage<Vector4>::Send( GetEventThreadServices(), &mNode, &mNode.mColor, &AnimatableProperty<Vector4>::Bake, color );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodePropertyMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::Bake, color );
 }
 
 void Actor::SetColorRed( float red )
 {
   mTargetColor.r = red;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &mNode, &mNode.mColor, &AnimatableProperty<Vector4>::BakeX, red );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeX, red );
 }
 
 void Actor::SetColorGreen( float green )
 {
   mTargetColor.g = green;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &mNode, &mNode.mColor, &AnimatableProperty<Vector4>::BakeY, green );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeY, green );
 }
 
 void Actor::SetColorBlue( float blue )
 {
   mTargetColor.b = blue;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &mNode, &mNode.mColor, &AnimatableProperty<Vector4>::BakeZ, blue );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeZ, blue );
 }
 
 const Vector4& Actor::GetCurrentColor() const
 {
-  // mNode is being used in a separate thread; copy the value from the previous update
-  return mNode.GetColor(GetEventThreadServices().GetEventBufferIndex());
+  // node is being used in a separate thread; copy the value from the previous update
+  return GetNode().GetColor(GetEventThreadServices().GetEventBufferIndex());
 }
 
 void Actor::SetInheritOrientation( bool inherit )
 {
   if( mInheritOrientation != inherit )
   {
-    // non animateable so keep local copy
+    // non animatable so keep local copy
     mInheritOrientation = inherit;
-    // mNode is being used in a separate thread; queue a message to set the value
-    SetInheritOrientationMessage( GetEventThreadServices(), mNode, inherit );
+    // node is being used in a separate thread; queue a message to set the value
+    SetInheritOrientationMessage( GetEventThreadServices(), GetNode(), inherit );
   }
 }
 
@@ -1087,10 +1087,10 @@ const Vector3& Actor::GetSizeModeFactor() const
 
 void Actor::SetColorMode( ColorMode colorMode )
 {
-  // non animateable so keep local copy
+  // non animatable so keep local copy
   mColorMode = colorMode;
-  // mNode is being used in a separate thread; queue a message to set the value
-  SetColorModeMessage( GetEventThreadServices(), mNode, colorMode );
+  // node is being used in a separate thread; queue a message to set the value
+  SetColorModeMessage( GetEventThreadServices(), GetNode(), colorMode );
 }
 
 ColorMode Actor::GetColorMode() const
@@ -1143,8 +1143,8 @@ void Actor::SetSizeInternal( const Vector3& size )
   {
     mTargetSize = size;
 
-    // mNode is being used in a separate thread; queue a message to set the value & base value
-    SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &mNode, &mNode.mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, mTargetSize );
+    // node is being used in a separate thread; queue a message to set the value & base value
+    SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, mTargetSize );
 
     // Notification for derived classes
     mInsideOnSizeSet = true;
@@ -1170,8 +1170,8 @@ void Actor::SetWidth( float width )
   {
     mTargetSize.width = width;
 
-    // mNode is being used in a separate thread; queue a message to set the value & base value
-    SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &mNode, &mNode.mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, width );
+    // node is being used in a separate thread; queue a message to set the value & base value
+    SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, width );
   }
 
   RelayoutRequest();
@@ -1188,8 +1188,8 @@ void Actor::SetHeight( float height )
   {
     mTargetSize.height = height;
 
-    // mNode is being used in a separate thread; queue a message to set the value & base value
-    SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &mNode, &mNode.mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, height );
+    // node is being used in a separate thread; queue a message to set the value & base value
+    SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, height );
   }
 
   RelayoutRequest();
@@ -1199,8 +1199,8 @@ void Actor::SetDepth( float depth )
 {
   mTargetSize.depth = depth;
 
-  // mNode is being used in a separate thread; queue a message to set the value & base value
-  SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &mNode, &mNode.mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, depth );
+  // node is being used in a separate thread; queue a message to set the value & base value
+  SceneGraph::NodeTransformComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, depth );
 }
 
 Vector3 Actor::GetTargetSize() const
@@ -1222,8 +1222,8 @@ Vector3 Actor::GetTargetSize() const
 
 const Vector3& Actor::GetCurrentSize() const
 {
-  // mNode is being used in a separate thread; copy the value from the previous update
-  return mNode.GetSize( GetEventThreadServices().GetEventBufferIndex() );
+  // node is being used in a separate thread; copy the value from the previous update
+  return GetNode().GetSize( GetEventThreadServices().GetEventBufferIndex() );
 }
 
 Vector3 Actor::GetNaturalSize() const
@@ -1446,7 +1446,7 @@ uint32_t Actor::AddRenderer( Renderer& renderer )
   uint32_t index = static_cast<uint32_t>( mRenderers->size() ); //  4,294,967,295 renderers per actor
   RendererPtr rendererPtr = RendererPtr( &renderer );
   mRenderers->push_back( rendererPtr );
-  AddRendererMessage( GetEventThreadServices(), mNode, renderer.GetRendererSceneObject() );
+  AttachRendererMessage( GetEventThreadServices(), GetNode(), renderer.GetRendererSceneObject() );
   return index;
 }
 
@@ -1482,7 +1482,7 @@ void Actor::RemoveRenderer( Renderer& renderer )
       if( (*iter).Get() == &renderer )
       {
         mRenderers->erase( iter );
-        RemoveRendererMessage( GetEventThreadServices(), mNode, renderer.GetRendererSceneObject() );
+        DetachRendererMessage( GetEventThreadServices(), GetNode(), renderer.GetRendererSceneObject() );
         break;
       }
     }
@@ -1494,7 +1494,7 @@ void Actor::RemoveRenderer( uint32_t index )
   if( index < GetRendererCount() )
   {
     RendererPtr renderer = ( *mRenderers )[ index ];
-    RemoveRendererMessage( GetEventThreadServices(), mNode, renderer.Get()->GetRendererSceneObject() );
+    DetachRendererMessage( GetEventThreadServices(), GetNode(), renderer.Get()->GetRendererSceneObject() );
     mRenderers->erase( mRenderers->begin()+index );
   }
 }
@@ -1510,8 +1510,8 @@ void Actor::SetDrawMode( DrawMode::Type drawMode )
   mDrawMode = drawMode;
   if( drawMode != DrawMode::STENCIL )
   {
-    // mNode is being used in a separate thread; queue a message to set the value
-    SetDrawModeMessage( GetEventThreadServices(), mNode, drawMode );
+    // node is being used in a separate thread; queue a message to set the value
+    SetDrawModeMessage( GetEventThreadServices(), GetNode(), drawMode );
   }
 }
 
@@ -1534,8 +1534,8 @@ bool Actor::ScreenToLocal( float& localX, float& localY, float screenX, float sc
     uint32_t taskCount = taskList.GetTaskCount();
     for( uint32_t i = taskCount; i > 0; --i )
     {
-      Dali::RenderTask task = taskList.GetTask( i - 1 );
-      if( ScreenToLocal( Dali::GetImplementation( task ), localX, localY, screenX, screenY ) )
+      RenderTaskPtr task = taskList.GetTask( i - 1 );
+      if( ScreenToLocal( *task, localX, localY, screenX, screenY ) )
       {
         // found a task where this conversion was ok so return
         return true;
@@ -1578,7 +1578,7 @@ bool Actor::ScreenToLocal( const Matrix& viewMatrix, const Matrix& projectionMat
 
   // Get the ModelView matrix
   Matrix modelView;
-  Matrix::Multiply( modelView, mNode.GetWorldMatrix(0), viewMatrix );
+  Matrix::Multiply( modelView, GetNode().GetWorldMatrix(0), viewMatrix );
 
   // Calculate the inverted ModelViewProjection matrix; this will be used for 2 unprojects
   Matrix invertedMvp( false/*don't init*/);
@@ -1690,14 +1690,14 @@ bool Actor::RaySphereTest( const Vector4& rayOrigin, const Vector4& rayDir ) con
   BufferIndex bufferIndex( GetEventThreadServices().GetEventBufferIndex() );
 
   // Transforms the ray to the local reference system. As the test is against a sphere, only the translation and scale are needed.
-  const Vector3& translation( mNode.GetWorldPosition( bufferIndex ) );
+  const Vector3& translation( GetNode().GetWorldPosition( bufferIndex ) );
   Vector3 rayOriginLocal( rayOrigin.x - translation.x, rayOrigin.y - translation.y, rayOrigin.z - translation.z );
 
   // Compute the radius is not needed, square radius it's enough.
-  const Vector3& size( mNode.GetSize( bufferIndex ) );
+  const Vector3& size( GetNode().GetSize( bufferIndex ) );
 
   // Scale the sphere.
-  const Vector3& scale( mNode.GetWorldScale( bufferIndex ) );
+  const Vector3& scale( GetNode().GetWorldScale( bufferIndex ) );
 
   const float width = size.width * scale.width;
   const float height = size.height * scale.height;
@@ -1722,7 +1722,7 @@ bool Actor::RayActorTest( const Vector4& rayOrigin, const Vector4& rayDir, Vecto
     Matrix invModelMatrix( false/*don't init*/);
 
     BufferIndex bufferIndex( GetEventThreadServices().GetEventBufferIndex() );
-    invModelMatrix = mNode.GetWorldMatrix(0);
+    invModelMatrix = GetNode().GetWorldMatrix(0);
     invModelMatrix.Invert();
 
     Vector4 rayOriginLocal( invModelMatrix * rayOrigin );
@@ -1738,7 +1738,7 @@ bool Actor::RayActorTest( const Vector4& rayOrigin, const Vector4& rayDir, Vecto
       // Ray travels distance * rayDirLocal to intersect with plane.
       distance = a / b;
 
-      const Vector3& size = mNode.GetSize( bufferIndex );
+      const Vector3& size = GetNode().GetSize( bufferIndex );
 
       hitPointLocal.x = rayOriginLocal.x + rayDirLocal.x * distance + size.x * 0.5f;
       hitPointLocal.y = rayOriginLocal.y + rayDirLocal.y * distance + size.y * 0.5f;
@@ -2025,10 +2025,10 @@ bool Actor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tra
 }
 
 Actor::Actor( DerivedType derivedType, const SceneGraph::Node& node )
-: mParent( NULL ),
+: Object( &node ),
+  mParent( NULL ),
   mChildren( NULL ),
   mRenderers( NULL ),
-  mNode( node ),
   mParentOrigin( NULL ),
   mAnchorPoint( NULL ),
   mRelayoutData( NULL ),
@@ -2103,7 +2103,7 @@ Actor::~Actor()
   // Guard to allow handle destruction after Core has been destroyed
   if( EventThreadServices::IsCoreRunning() )
   {
-    DestroyNodeMessage( GetEventThreadServices().GetUpdateManager(), mNode );
+    DestroyNodeMessage( GetEventThreadServices().GetUpdateManager(), GetNode() );
 
     GetEventThreadServices().UnregisterObject( this );
   }
@@ -2181,7 +2181,7 @@ void Actor::ConnectToSceneGraph()
   DALI_ASSERT_DEBUG( mParent != NULL);
 
   // Reparent Node in next Update
-  ConnectNodeMessage( GetEventThreadServices().GetUpdateManager(), mParent->mNode, mNode );
+  ConnectNodeMessage( GetEventThreadServices().GetUpdateManager(), mParent->GetNode(), GetNode() );
 
   // Request relayout on all actors that are added to the scenegraph
   RelayoutRequest();
@@ -2238,7 +2238,8 @@ void Actor::DisconnectFromStage()
 
 void Actor::RecursiveDisconnectFromStage( ActorContainer& disconnectionList )
 {
-  DALI_ASSERT_ALWAYS( OnStage() );
+  // need to change state first so that internals relying on IsOnStage() inside OnStageDisconnectionInternal() get the correct value
+  mIsOnStage = false;
 
   // Recursively disconnect children
   if( mChildren )
@@ -2257,8 +2258,6 @@ void Actor::RecursiveDisconnectFromStage( ActorContainer& disconnectionList )
   OnStageDisconnectionInternal();
 
   DisconnectFromSceneGraph();
-
-  mIsOnStage = false;
 }
 
 /**
@@ -2301,7 +2300,7 @@ bool Actor::IsNodeConnected() const
 
   if( OnStage() )
   {
-    if( IsRoot() || mNode.GetParent() )
+    if( IsRoot() || GetNode().GetParent() )
     {
       connected = true;
     }
@@ -2334,7 +2333,7 @@ void Actor::RebuildDepthTree()
 void Actor::DepthTraverseActorTree( OwnerPointer<SceneGraph::NodeDepths>& sceneGraphNodeDepths, int32_t& depthIndex )
 {
   mSortedDepth = depthIndex * DevelLayer::SIBLING_ORDER_MULTIPLIER;
-  sceneGraphNodeDepths->Add( const_cast<SceneGraph::Node*>( &mNode ), mSortedDepth );
+  sceneGraphNodeDepths->Add( const_cast<SceneGraph::Node*>( &GetNode() ), mSortedDepth );
 
   // Create/add to children of this node
   if( mChildren )
@@ -2708,7 +2707,7 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr
       if( Scripting::GetEnumerationProperty< ClippingMode::Type >( property, CLIPPING_MODE_TABLE, CLIPPING_MODE_TABLE_COUNT, convertedValue ) )
       {
         mClippingMode = convertedValue;
-        SetClippingModeMessage( GetEventThreadServices(), mNode, mClippingMode );
+        SetClippingModeMessage( GetEventThreadServices(), GetNode(), mClippingMode );
       }
       break;
     }
@@ -2719,7 +2718,7 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr
       if( property.Get( value ) && value != mPositionUsesAnchorPoint )
       {
         mPositionUsesAnchorPoint = value;
-        SetPositionUsesAnchorPointMessage( GetEventThreadServices(), mNode, mPositionUsesAnchorPoint );
+        SetPositionUsesAnchorPointMessage( GetEventThreadServices(), GetNode(), mPositionUsesAnchorPoint );
       }
       break;
     }
@@ -2765,7 +2764,7 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG( NULL != property );
 
       // property is being used in a separate thread; queue a message to set the property
-      SceneGraph::NodePropertyMessage<bool>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<bool>::Bake, value.Get<bool>() );
+      SceneGraph::NodePropertyMessage<bool>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<bool>::Bake, value.Get<bool>() );
 
       break;
     }
@@ -2776,7 +2775,7 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG( NULL != property );
 
       // property is being used in a separate thread; queue a message to set the property
-      SceneGraph::NodePropertyMessage<int>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<int>::Bake, value.Get<int>() );
+      SceneGraph::NodePropertyMessage<int>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<int>::Bake, value.Get<int>() );
 
       break;
     }
@@ -2787,7 +2786,7 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG( NULL != property );
 
       // property is being used in a separate thread; queue a message to set the property
-      SceneGraph::NodePropertyMessage<float>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<float>::Bake, value.Get<float>() );
+      SceneGraph::NodePropertyMessage<float>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<float>::Bake, value.Get<float>() );
 
       break;
     }
@@ -2800,15 +2799,15 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata
       // property is being used in a separate thread; queue a message to set the property
       if(entry.componentIndex == 0)
       {
-        SceneGraph::NodePropertyComponentMessage<Vector2>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<Vector2>::BakeX, value.Get<float>() );
+        SceneGraph::NodePropertyComponentMessage<Vector2>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector2>::BakeX, value.Get<float>() );
       }
       else if(entry.componentIndex == 1)
       {
-        SceneGraph::NodePropertyComponentMessage<Vector2>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<Vector2>::BakeY, value.Get<float>() );
+        SceneGraph::NodePropertyComponentMessage<Vector2>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector2>::BakeY, value.Get<float>() );
       }
       else
       {
-        SceneGraph::NodePropertyMessage<Vector2>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<Vector2>::Bake, value.Get<Vector2>() );
+        SceneGraph::NodePropertyMessage<Vector2>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector2>::Bake, value.Get<Vector2>() );
       }
 
       break;
@@ -2822,19 +2821,19 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata
       // property is being used in a separate thread; queue a message to set the property
       if(entry.componentIndex == 0)
       {
-        SceneGraph::NodePropertyComponentMessage<Vector3>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<Vector3>::BakeX, value.Get<float>() );
+        SceneGraph::NodePropertyComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector3>::BakeX, value.Get<float>() );
       }
       else if(entry.componentIndex == 1)
       {
-        SceneGraph::NodePropertyComponentMessage<Vector3>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<Vector3>::BakeY, value.Get<float>() );
+        SceneGraph::NodePropertyComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector3>::BakeY, value.Get<float>() );
       }
       else if(entry.componentIndex == 2)
       {
-        SceneGraph::NodePropertyComponentMessage<Vector3>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<Vector3>::BakeZ, value.Get<float>() );
+        SceneGraph::NodePropertyComponentMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector3>::BakeZ, value.Get<float>() );
       }
       else
       {
-        SceneGraph::NodePropertyMessage<Vector3>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<Vector3>::Bake, value.Get<Vector3>() );
+        SceneGraph::NodePropertyMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector3>::Bake, value.Get<Vector3>() );
       }
 
       break;
@@ -2848,23 +2847,23 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata
       // property is being used in a separate thread; queue a message to set the property
       if(entry.componentIndex == 0)
       {
-        SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<Vector4>::BakeX, value.Get<float>() );
+        SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector4>::BakeX, value.Get<float>() );
       }
       else if(entry.componentIndex == 1)
       {
-        SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<Vector4>::BakeY, value.Get<float>() );
+        SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector4>::BakeY, value.Get<float>() );
       }
       else if(entry.componentIndex == 2)
       {
-        SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<Vector4>::BakeZ, value.Get<float>() );
+        SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector4>::BakeZ, value.Get<float>() );
       }
       else if(entry.componentIndex == 3)
       {
-        SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<Vector4>::BakeW, value.Get<float>() );
+        SceneGraph::NodePropertyComponentMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector4>::BakeW, value.Get<float>() );
       }
       else
       {
-        SceneGraph::NodePropertyMessage<Vector4>::Send( GetEventThreadServices(), &mNode, property, &AnimatableProperty<Vector4>::Bake, value.Get<Vector4>() );
+        SceneGraph::NodePropertyMessage<Vector4>::Send( GetEventThreadServices(), &GetNode(), property, &AnimatableProperty<Vector4>::Bake, value.Get<Vector4>() );
       }
 
       break;
@@ -2876,7 +2875,7 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG( NULL != property );
 
       // property is being used in a separate thread; queue a message to set the property
-      SceneGraph::NodePropertyMessage<Quaternion>::Send( GetEventThreadServices(), &mNode, property,&AnimatableProperty<Quaternion>::Bake,  value.Get<Quaternion>() );
+      SceneGraph::NodePropertyMessage<Quaternion>::Send( GetEventThreadServices(), &GetNode(), property,&AnimatableProperty<Quaternion>::Bake,  value.Get<Quaternion>() );
 
       break;
     }
@@ -2887,7 +2886,7 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG( NULL != property );
 
       // property is being used in a separate thread; queue a message to set the property
-      SceneGraph::NodePropertyMessage<Matrix>::Send( GetEventThreadServices(), &mNode, property,&AnimatableProperty<Matrix>::Bake,  value.Get<Matrix>() );
+      SceneGraph::NodePropertyMessage<Matrix>::Send( GetEventThreadServices(), &GetNode(), property,&AnimatableProperty<Matrix>::Bake,  value.Get<Matrix>() );
 
       break;
     }
@@ -2898,7 +2897,7 @@ void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata
       DALI_ASSERT_DEBUG( NULL != property );
 
       // property is being used in a separate thread; queue a message to set the property
-      SceneGraph::NodePropertyMessage<Matrix3>::Send( GetEventThreadServices(), &mNode, property,&AnimatableProperty<Matrix3>::Bake,  value.Get<Matrix3>() );
+      SceneGraph::NodePropertyMessage<Matrix3>::Send( GetEventThreadServices(), &GetNode(), property,&AnimatableProperty<Matrix3>::Bake,  value.Get<Matrix3>() );
 
       break;
     }
@@ -3240,98 +3239,66 @@ void Actor::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::In
   }
 }
 
-const SceneGraph::PropertyOwner* Actor::GetPropertyOwner() const
-{
-  return &mNode;
-}
-
-const SceneGraph::PropertyOwner* Actor::GetSceneObject() const
-{
-  // This method should only return an object connected to the scene-graph
-  return OnStage() ? &mNode : NULL;
-}
-
 const PropertyBase* Actor::GetSceneObjectAnimatableProperty( Property::Index index ) const
 {
-  DALI_ASSERT_ALWAYS( IsPropertyAnimatable( index ) && "Property is not animatable" );
-
   const PropertyBase* property( NULL );
 
-  // This method should only return a property of an object connected to the scene-graph
-  if( !OnStage() )
-  {
-    return property;
-  }
-
-  if ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX && index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )
-  {
-    AnimatablePropertyMetadata* animatable = GetSceneAnimatableProperty( index, nullptr );
-    DALI_ASSERT_ALWAYS( animatable && "Property index is invalid" );
-
-    property = animatable->GetSceneGraphProperty();
-  }
-  else if ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties
-            ( index <= PROPERTY_CUSTOM_MAX_INDEX ) )
-  {
-    CustomPropertyMetadata* custom = FindCustomProperty( index );
-    DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
-
-    property = custom->GetSceneGraphProperty();
-  }
-  else
+  switch( index )
   {
-    switch( index )
+    case Dali::Actor::Property::SIZE:        // FALLTHROUGH
+    case Dali::Actor::Property::SIZE_WIDTH:  // FALLTHROUGH
+    case Dali::Actor::Property::SIZE_HEIGHT: // FALLTHROUGH
+    case Dali::Actor::Property::SIZE_DEPTH:
     {
-      case Dali::Actor::Property::SIZE:        // FALLTHROUGH
-      case Dali::Actor::Property::SIZE_WIDTH:  // FALLTHROUGH
-      case Dali::Actor::Property::SIZE_HEIGHT: // FALLTHROUGH
-      case Dali::Actor::Property::SIZE_DEPTH:
-      {
-        property = &mNode.mSize;
-        break;
-      }
-      case Dali::Actor::Property::POSITION:   // FALLTHROUGH
-      case Dali::Actor::Property::POSITION_X: // FALLTHROUGH
-      case Dali::Actor::Property::POSITION_Y: // FALLTHROUGH
-      case Dali::Actor::Property::POSITION_Z:
-      {
-        property = &mNode.mPosition;
-        break;
-      }
-      case Dali::Actor::Property::ORIENTATION:
-      {
-        property = &mNode.mOrientation;
-        break;
-      }
-      case Dali::Actor::Property::SCALE:   // FALLTHROUGH
-      case Dali::Actor::Property::SCALE_X: // FALLTHROUGH
-      case Dali::Actor::Property::SCALE_Y: // FALLTHROUGH
-      case Dali::Actor::Property::SCALE_Z:
-      {
-        property = &mNode.mScale;
-        break;
-      }
-      case Dali::Actor::Property::VISIBLE:
-      {
-        property = &mNode.mVisible;
-        break;
-      }
-      case Dali::Actor::Property::COLOR:       // FALLTHROUGH
-      case Dali::Actor::Property::COLOR_RED:   // FALLTHROUGH
-      case Dali::Actor::Property::COLOR_GREEN: // FALLTHROUGH
-      case Dali::Actor::Property::COLOR_BLUE:  // FALLTHROUGH
-      case Dali::Actor::Property::COLOR_ALPHA: // FALLTHROUGH
-      case Dali::DevelActor::Property::OPACITY:
-      {
-        property = &mNode.mColor;
-        break;
-      }
-      default:
-      {
-        break;
-      }
+      property = &GetNode().mSize;
+      break;
+    }
+    case Dali::Actor::Property::POSITION:   // FALLTHROUGH
+    case Dali::Actor::Property::POSITION_X: // FALLTHROUGH
+    case Dali::Actor::Property::POSITION_Y: // FALLTHROUGH
+    case Dali::Actor::Property::POSITION_Z:
+    {
+      property = &GetNode().mPosition;
+      break;
+    }
+    case Dali::Actor::Property::ORIENTATION:
+    {
+      property = &GetNode().mOrientation;
+      break;
+    }
+    case Dali::Actor::Property::SCALE:   // FALLTHROUGH
+    case Dali::Actor::Property::SCALE_X: // FALLTHROUGH
+    case Dali::Actor::Property::SCALE_Y: // FALLTHROUGH
+    case Dali::Actor::Property::SCALE_Z:
+    {
+      property = &GetNode().mScale;
+      break;
+    }
+    case Dali::Actor::Property::VISIBLE:
+    {
+      property = &GetNode().mVisible;
+      break;
+    }
+    case Dali::Actor::Property::COLOR:       // FALLTHROUGH
+    case Dali::Actor::Property::COLOR_RED:   // FALLTHROUGH
+    case Dali::Actor::Property::COLOR_GREEN: // FALLTHROUGH
+    case Dali::Actor::Property::COLOR_BLUE:  // FALLTHROUGH
+    case Dali::Actor::Property::COLOR_ALPHA: // FALLTHROUGH
+    case Dali::DevelActor::Property::OPACITY:
+    {
+      property = &GetNode().mColor;
+      break;
+    }
+    default:
+    {
+      break;
     }
   }
+  if( !property )
+  {
+    // not our property, ask base
+    property = Object::GetSceneObjectAnimatableProperty( index );
+  }
 
   return property;
 }
@@ -3340,200 +3307,132 @@ const PropertyInputImpl* Actor::GetSceneObjectInputProperty( Property::Index ind
 {
   const PropertyInputImpl* property( NULL );
 
-  // This method should only return a property of an object connected to the scene-graph
-  if( !OnStage() )
-  {
-    return property;
-  }
-
-  if ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX && index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )
-  {
-    AnimatablePropertyMetadata* animatable = GetSceneAnimatableProperty( index, nullptr );
-    DALI_ASSERT_ALWAYS( animatable && "Property index is invalid" );
-
-    property = animatable->GetSceneGraphProperty();
-  }
-  else if ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties
-            ( index <= PROPERTY_CUSTOM_MAX_INDEX ) )
-  {
-    CustomPropertyMetadata* custom = FindCustomProperty( index );
-    DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
-    property = custom->GetSceneGraphProperty();
-  }
-  else
+  switch( index )
   {
-    switch( index )
+    case Dali::Actor::Property::PARENT_ORIGIN:   // FALLTHROUGH
+    case Dali::Actor::Property::PARENT_ORIGIN_X: // FALLTHROUGH
+    case Dali::Actor::Property::PARENT_ORIGIN_Y: // FALLTHROUGH
+    case Dali::Actor::Property::PARENT_ORIGIN_Z:
     {
-      case Dali::Actor::Property::PARENT_ORIGIN:   // FALLTHROUGH
-      case Dali::Actor::Property::PARENT_ORIGIN_X: // FALLTHROUGH
-      case Dali::Actor::Property::PARENT_ORIGIN_Y: // FALLTHROUGH
-      case Dali::Actor::Property::PARENT_ORIGIN_Z:
-      {
-        property = &mNode.mParentOrigin;
-        break;
-      }
-      case Dali::Actor::Property::ANCHOR_POINT:   // FALLTHROUGH
-      case Dali::Actor::Property::ANCHOR_POINT_X: // FALLTHROUGH
-      case Dali::Actor::Property::ANCHOR_POINT_Y: // FALLTHROUGH
-      case Dali::Actor::Property::ANCHOR_POINT_Z:
-      {
-        property = &mNode.mAnchorPoint;
-        break;
-      }
-      case Dali::Actor::Property::SIZE:        // FALLTHROUGH
-      case Dali::Actor::Property::SIZE_WIDTH:  // FALLTHROUGH
-      case Dali::Actor::Property::SIZE_HEIGHT: // FALLTHROUGH
-      case Dali::Actor::Property::SIZE_DEPTH:
-      {
-        property = &mNode.mSize;
-        break;
-      }
-      case Dali::Actor::Property::POSITION:   // FALLTHROUGH
-      case Dali::Actor::Property::POSITION_X: // FALLTHROUGH
-      case Dali::Actor::Property::POSITION_Y: // FALLTHROUGH
-      case Dali::Actor::Property::POSITION_Z:
-      {
-        property = &mNode.mPosition;
-        break;
-      }
-      case Dali::Actor::Property::WORLD_POSITION:   // FALLTHROUGH
-      case Dali::Actor::Property::WORLD_POSITION_X: // FALLTHROUGH
-      case Dali::Actor::Property::WORLD_POSITION_Y: // FALLTHROUGH
-      case Dali::Actor::Property::WORLD_POSITION_Z:
-      {
-        property = &mNode.mWorldPosition;
-        break;
-      }
-      case Dali::Actor::Property::ORIENTATION:
-      {
-        property = &mNode.mOrientation;
-        break;
-      }
-      case Dali::Actor::Property::WORLD_ORIENTATION:
-      {
-        property = &mNode.mWorldOrientation;
-        break;
-      }
-      case Dali::Actor::Property::SCALE:   // FALLTHROUGH
-      case Dali::Actor::Property::SCALE_X: // FALLTHROUGH
-      case Dali::Actor::Property::SCALE_Y: // FALLTHROUGH
-      case Dali::Actor::Property::SCALE_Z:
-      {
-        property = &mNode.mScale;
-        break;
-      }
-      case Dali::Actor::Property::WORLD_SCALE:
-      {
-        property = &mNode.mWorldScale;
-        break;
-      }
-      case Dali::Actor::Property::VISIBLE:
-      {
-        property = &mNode.mVisible;
-        break;
-      }
-      case Dali::Actor::Property::COLOR:       // FALLTHROUGH
-      case Dali::Actor::Property::COLOR_RED:   // FALLTHROUGH
-      case Dali::Actor::Property::COLOR_GREEN: // FALLTHROUGH
-      case Dali::Actor::Property::COLOR_BLUE:  // FALLTHROUGH
-      case Dali::Actor::Property::COLOR_ALPHA: // FALLTHROUGH
-      case Dali::DevelActor::Property::OPACITY:
-      {
-        property = &mNode.mColor;
-        break;
-      }
-      case Dali::Actor::Property::WORLD_COLOR:
-      {
-        property = &mNode.mWorldColor;
-        break;
-      }
-      case Dali::Actor::Property::WORLD_MATRIX:
-      {
-        property = &mNode.mWorldMatrix;
-        break;
-      }
-      case Dali::DevelActor::Property::CULLED:
-      {
-        property = &mNode.mCulled;
-        break;
-      }
-      default:
-      {
-        break;
-      }
+      property = &GetNode().mParentOrigin;
+      break;
+    }
+    case Dali::Actor::Property::ANCHOR_POINT:   // FALLTHROUGH
+    case Dali::Actor::Property::ANCHOR_POINT_X: // FALLTHROUGH
+    case Dali::Actor::Property::ANCHOR_POINT_Y: // FALLTHROUGH
+    case Dali::Actor::Property::ANCHOR_POINT_Z:
+    {
+      property = &GetNode().mAnchorPoint;
+      break;
     }
+    case Dali::Actor::Property::WORLD_POSITION:   // FALLTHROUGH
+    case Dali::Actor::Property::WORLD_POSITION_X: // FALLTHROUGH
+    case Dali::Actor::Property::WORLD_POSITION_Y: // FALLTHROUGH
+    case Dali::Actor::Property::WORLD_POSITION_Z:
+    {
+      property = &GetNode().mWorldPosition;
+      break;
+    }
+    case Dali::Actor::Property::WORLD_ORIENTATION:
+    {
+      property = &GetNode().mWorldOrientation;
+      break;
+    }
+    case Dali::Actor::Property::WORLD_SCALE:
+    {
+      property = &GetNode().mWorldScale;
+      break;
+    }
+    case Dali::Actor::Property::WORLD_COLOR:
+    {
+      property = &GetNode().mWorldColor;
+      break;
+    }
+    case Dali::Actor::Property::WORLD_MATRIX:
+    {
+      property = &GetNode().mWorldMatrix;
+      break;
+    }
+    case Dali::DevelActor::Property::CULLED:
+    {
+      property = &GetNode().mCulled;
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+  if( !property )
+  {
+    // reuse animatable property getter as animatable properties are inputs as well
+    // animatable property chains back to Object::GetSceneObjectInputProperty() so all properties get covered
+    property = GetSceneObjectAnimatableProperty( index );
   }
 
   return property;
 }
 
-int Actor::GetPropertyComponentIndex( Property::Index index ) const
+int32_t Actor::GetPropertyComponentIndex( Property::Index index ) const
 {
-  int componentIndex( Property::INVALID_COMPONENT_INDEX );
+  int32_t componentIndex = Property::INVALID_COMPONENT_INDEX;
 
-  if ( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) )
+  switch( index )
   {
-    // check whether the animatable property is registered already, if not then register one.
-    AnimatablePropertyMetadata* animatableProperty = GetSceneAnimatableProperty( index, nullptr );
-    if( animatableProperty )
+    case Dali::Actor::Property::PARENT_ORIGIN_X:
+    case Dali::Actor::Property::ANCHOR_POINT_X:
+    case Dali::Actor::Property::SIZE_WIDTH:
+    case Dali::Actor::Property::POSITION_X:
+    case Dali::Actor::Property::WORLD_POSITION_X:
+    case Dali::Actor::Property::SCALE_X:
+    case Dali::Actor::Property::COLOR_RED:
     {
-      componentIndex = animatableProperty->componentIndex;
+      componentIndex = 0;
+      break;
     }
-  }
-  else
-  {
-    switch( index )
-    {
-      case Dali::Actor::Property::PARENT_ORIGIN_X:
-      case Dali::Actor::Property::ANCHOR_POINT_X:
-      case Dali::Actor::Property::SIZE_WIDTH:
-      case Dali::Actor::Property::POSITION_X:
-      case Dali::Actor::Property::WORLD_POSITION_X:
-      case Dali::Actor::Property::SCALE_X:
-      case Dali::Actor::Property::COLOR_RED:
-      {
-        componentIndex = 0;
-        break;
-      }
 
-      case Dali::Actor::Property::PARENT_ORIGIN_Y:
-      case Dali::Actor::Property::ANCHOR_POINT_Y:
-      case Dali::Actor::Property::SIZE_HEIGHT:
-      case Dali::Actor::Property::POSITION_Y:
-      case Dali::Actor::Property::WORLD_POSITION_Y:
-      case Dali::Actor::Property::SCALE_Y:
-      case Dali::Actor::Property::COLOR_GREEN:
-      {
-        componentIndex = 1;
-        break;
-      }
+    case Dali::Actor::Property::PARENT_ORIGIN_Y:
+    case Dali::Actor::Property::ANCHOR_POINT_Y:
+    case Dali::Actor::Property::SIZE_HEIGHT:
+    case Dali::Actor::Property::POSITION_Y:
+    case Dali::Actor::Property::WORLD_POSITION_Y:
+    case Dali::Actor::Property::SCALE_Y:
+    case Dali::Actor::Property::COLOR_GREEN:
+    {
+      componentIndex = 1;
+      break;
+    }
 
-      case Dali::Actor::Property::PARENT_ORIGIN_Z:
-      case Dali::Actor::Property::ANCHOR_POINT_Z:
-      case Dali::Actor::Property::SIZE_DEPTH:
-      case Dali::Actor::Property::POSITION_Z:
-      case Dali::Actor::Property::WORLD_POSITION_Z:
-      case Dali::Actor::Property::SCALE_Z:
-      case Dali::Actor::Property::COLOR_BLUE:
-      {
-        componentIndex = 2;
-        break;
-      }
+    case Dali::Actor::Property::PARENT_ORIGIN_Z:
+    case Dali::Actor::Property::ANCHOR_POINT_Z:
+    case Dali::Actor::Property::SIZE_DEPTH:
+    case Dali::Actor::Property::POSITION_Z:
+    case Dali::Actor::Property::WORLD_POSITION_Z:
+    case Dali::Actor::Property::SCALE_Z:
+    case Dali::Actor::Property::COLOR_BLUE:
+    {
+      componentIndex = 2;
+      break;
+    }
 
-      case Dali::Actor::Property::COLOR_ALPHA:
-      case Dali::DevelActor::Property::OPACITY:
-      {
-        componentIndex = 3;
-        break;
-      }
+    case Dali::Actor::Property::COLOR_ALPHA:
+    case Dali::DevelActor::Property::OPACITY:
+    {
+      componentIndex = 3;
+      break;
+    }
 
-      default:
-      {
-        // Do nothing
-        break;
-      }
+    default:
+    {
+      // Do nothing
+      break;
     }
   }
+  if( Property::INVALID_COMPONENT_INDEX == componentIndex )
+  {
+    // ask base
+    componentIndex = Object::GetPropertyComponentIndex( index );
+  }
 
   return componentIndex;
 }
@@ -3566,7 +3465,7 @@ void Actor::SetParent( Actor* parent )
          OnStage() )
     {
       // Disconnect the Node & its children from the scene-graph.
-      DisconnectNodeMessage( GetEventThreadServices().GetUpdateManager(), mNode );
+      DisconnectNodeMessage( GetEventThreadServices().GetUpdateManager(), GetNode() );
 
       // Instruct each actor to discard pointers to the scene-graph
       DisconnectFromStage();
@@ -4093,7 +3992,7 @@ bool Actor::GetCurrentPropertyValue( Property::Index index, Property::Value& val
 
     case DevelActor::Property::CULLED:
     {
-      value = mNode.IsCulled( GetEventThreadServices().GetEventBufferIndex() );
+      value = GetNode().IsCulled( GetEventThreadServices().GetEventBufferIndex() );
       break;
     }
 
@@ -4857,8 +4756,8 @@ void Actor::SetVisibleInternal( bool visible, SendMessage::Type sendMessage )
   {
     if( sendMessage == SendMessage::TRUE )
     {
-      // mNode is being used in a separate thread; queue a message to set the value & base value
-      SceneGraph::NodePropertyMessage<bool>::Send( GetEventThreadServices(), &mNode, &mNode.mVisible, &AnimatableProperty<bool>::Bake, visible );
+      // node is being used in a separate thread; queue a message to set the value & base value
+      SceneGraph::NodePropertyMessage<bool>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mVisible, &AnimatableProperty<bool>::Bake, visible );
     }
 
     mVisible = visible;
index 0a78f08..8533e0a 100755 (executable)
@@ -1662,16 +1662,6 @@ public:
   virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType );
 
   /**
-   * @copydoc Dali::Internal::Object::GetPropertyOwner()
-   */
-  virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObject()
-   */
-  virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
-
-  /**
    * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
    */
   virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
@@ -1684,7 +1674,7 @@ public:
   /**
    * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
    */
-  virtual int GetPropertyComponentIndex( Property::Index index ) const;
+  virtual int32_t GetPropertyComponentIndex( Property::Index index ) const;
 
   /**
    * Retrieve the actor's node.
@@ -1692,7 +1682,7 @@ public:
    */
   const SceneGraph::Node& GetNode() const
   {
-    return mNode;
+    return *static_cast<const SceneGraph::Node*>( mUpdateObject );
   }
 
   /**
@@ -1937,7 +1927,6 @@ protected:
   ActorContainer* mChildren;      ///< Container of referenced actors, lazily initialized
   RendererContainer* mRenderers;   ///< Renderer container
 
-  const SceneGraph::Node& mNode;  ///< Not owned
   Vector3* mParentOrigin;         ///< NULL means ParentOrigin::DEFAULT. ParentOrigin is non-animatable
   Vector3* mAnchorPoint;          ///< NULL means AnchorPoint::DEFAULT. AnchorPoint is non-animatable
 
index e1273d3..3d21383 100644 (file)
@@ -188,7 +188,7 @@ void CameraActor::OnInitialize()
   SceneGraph::Camera* sceneGraphCamera = SceneGraph::Camera::New();
 
   // Store a pointer to this camera node inside the scene-graph camera.
-  sceneGraphCamera->SetNode( &mNode );
+  sceneGraphCamera->SetNode( &GetNode() );
 
   mSceneObject = sceneGraphCamera;
   OwnerPointer< SceneGraph::Camera > sceneGraphCameraOwner( sceneGraphCamera );
@@ -452,7 +452,7 @@ bool CameraActor::BuildPickingRay( const Vector2& screenCoordinates,
   {
     // Build a picking ray in the world reference system.
     // ray starts from the camera world position
-    rayOrigin = mNode.GetWorldMatrix(0).GetTranslation();
+    rayOrigin = GetNode().GetWorldMatrix(0).GetTranslation();
     rayOrigin.w = 1.0f;
 
     // Transform the touch point from the screen coordinate system to the world coordinates system.
@@ -734,61 +734,28 @@ Property::Value CameraActor::GetDefaultPropertyCurrentValue( Property::Index ind
   return ret;
 }
 
-const SceneGraph::PropertyBase* CameraActor::GetSceneObjectAnimatableProperty( Property::Index index ) const
-{
-  DALI_ASSERT_ALWAYS( IsPropertyAnimatable(index) && "Property is not animatable" );
-
-  const SceneGraph::PropertyBase* property( NULL );
-
-  // This method should only return a property of an object connected to the scene-graph
-  if ( !OnStage() )
-  {
-    return property;
-  }
-
-  // let actor handle animatable properties, we have no animatable properties
-  if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT )
-  {
-    property = Actor::GetSceneObjectAnimatableProperty(index);
-  }
-
-  return property;
-}
-
 const PropertyInputImpl* CameraActor::GetSceneObjectInputProperty( Property::Index index ) const
 {
   const PropertyInputImpl* property( NULL );
 
-  // This method should only return a property of an object connected to the scene-graph
-  if ( !OnStage() )
+  switch( index )
   {
-    return property;
+    case Dali::CameraActor::Property::PROJECTION_MATRIX:
+    {
+      property = mSceneObject->GetProjectionMatrix();
+      break;
+    }
+    case Dali::CameraActor::Property::VIEW_MATRIX:
+    {
+      property = mSceneObject->GetViewMatrix();
+      break;
+    }
+    // no default on purpose as we chain method up to actor
   }
-
-  // if its an actor default property or a custom property (actor already handles custom properties)
-  if( ( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT ) || ( index >= DEFAULT_PROPERTY_MAX_COUNT ) )
+  if( !property )
   {
     property = Actor::GetSceneObjectInputProperty( index );
   }
-  else
-  {
-    switch( index )
-    {
-      case Dali::CameraActor::Property::PROJECTION_MATRIX:
-      {
-        property = mSceneObject->GetProjectionMatrix();
-        break;
-      }
-      case Dali::CameraActor::Property::VIEW_MATRIX:
-      {
-        property = mSceneObject->GetViewMatrix();
-        break;
-      }
-      default:
-        DALI_LOG_WARNING("Not an input property (%d)\n", index);
-        break;
-    }
-  }
 
   return property;
 }
index fe26f13..dc017f8 100644 (file)
@@ -214,11 +214,6 @@ public: // properties
   virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
 
   /**
-   * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
-   */
-  virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
-
-  /**
    * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
    */
   virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
index eaa9636..34b1a1b 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_CUSTOM_ACTOR_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -77,7 +77,7 @@ private:
   /**
    * @copydoc Internal::Actor::OnStageConnectionExternal
    */
-  virtual void OnStageConnectionExternal( int depth )
+  virtual void OnStageConnectionExternal( int32_t depth )
   {
     mImpl->OnStageConnection( depth );
   }
index a6bcc71..fb7675f 100644 (file)
@@ -348,7 +348,7 @@ void Layer::OnStageDisconnectionInternal()
 
 const SceneGraph::Layer& Layer::GetSceneLayerOnStage() const
 {
-  return dynamic_cast< const SceneGraph::Layer& >( mNode );
+  return static_cast< const SceneGraph::Layer& >( GetNode() ); // we know our node is a layer node
 }
 
 void Layer::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
index 8119063..b3ae1e5 100644 (file)
@@ -101,7 +101,7 @@ public:
     DALI_ASSERT_ALWAYS( mParent == NULL && "AnimationConnector already has a parent" );
     mParent = &parent;
 
-    if( mObject && mObject->GetSceneObject() )
+    if( mObject )
     {
       CreateAnimator();
     }
@@ -156,15 +156,16 @@ private:
     DALI_ASSERT_DEBUG( mParent != NULL );
 
     //Get the PropertyOwner the animator is going to animate
-    const SceneGraph::PropertyOwner* propertyOwner = mObject->GetSceneObject();
+    const SceneGraph::PropertyOwner& propertyOwner = mObject->GetSceneObject();
 
     // Get SceneGraph::BaseProperty
     const SceneGraph::PropertyBase* baseProperty = mObject->GetSceneObjectAnimatableProperty( mPropertyIndex );
+    DALI_ASSERT_ALWAYS( baseProperty && "Property is not animatable" );
 
     OwnerPointer<SceneGraph::PropertyResetterBase> resetter;
 
     // Check if property is a component of another property
-    const int componentIndex = mObject->GetPropertyComponentIndex( mPropertyIndex );
+    const int32_t componentIndex = mObject->GetPropertyComponentIndex( mPropertyIndex );
     if( componentIndex != Property::INVALID_COMPONENT_INDEX )
     {
       mComponentIndex = componentIndex;
@@ -181,7 +182,7 @@ private:
       {
         if( baseProperty->IsTransformManagerProperty() )
         {
-          mAnimator = SceneGraph::AnimatorTransformProperty< PropertyType,TransformManagerPropertyAccessor<PropertyType> >::New( *propertyOwner, *baseProperty, mAnimatorFunction, mAlphaFunction, mTimePeriod );
+          mAnimator = SceneGraph::AnimatorTransformProperty< PropertyType,TransformManagerPropertyAccessor<PropertyType> >::New( propertyOwner, *baseProperty, mAnimatorFunction, mAlphaFunction, mTimePeriod );
           // Don't reset transform manager properties - TransformManager will do it more efficiently
         }
         else
@@ -193,9 +194,9 @@ private:
       else
       {
         // Create the animator and resetter
-        mAnimator = AnimatorType::New( *propertyOwner, *animatableProperty, mAnimatorFunction,
+        mAnimator = AnimatorType::New( propertyOwner, *animatableProperty, mAnimatorFunction,
                                        mAlphaFunction, mTimePeriod );
-        resetter = SceneGraph::AnimatorResetter::New( *propertyOwner, *baseProperty, *mAnimator );
+        resetter = SceneGraph::AnimatorResetter::New( propertyOwner, *baseProperty, *mAnimator );
       }
     }
     else
@@ -214,7 +215,7 @@ private:
           {
             case 0:
             {
-              mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorX<Vector2> >::New( *propertyOwner,
+              mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorX<Vector2> >::New( propertyOwner,
                                                                                                    *animatableProperty,
                                                                                                    mAnimatorFunction,
                                                                                                    mAlphaFunction,
@@ -223,7 +224,7 @@ private:
             }
             case 1:
             {
-              mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorY<Vector2> >::New( *propertyOwner,
+              mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorY<Vector2> >::New( propertyOwner,
                                                                                                    *animatableProperty,
                                                                                                    mAnimatorFunction,
                                                                                                    mAlphaFunction,
@@ -238,7 +239,7 @@ private:
 
           if( mAnimator != nullptr )
           {
-            resetter = SceneGraph::AnimatorResetter::New( *propertyOwner, *baseProperty, *mAnimator );
+            resetter = SceneGraph::AnimatorResetter::New( propertyOwner, *baseProperty, *mAnimator );
           }
         }
 
@@ -254,15 +255,15 @@ private:
             {
               if( mComponentIndex == 0 )
               {
-                mAnimator = SceneGraph::AnimatorTransformProperty< float,TransformManagerPropertyComponentAccessor<Vector3,0> >::New( *propertyOwner, *baseProperty, mAnimatorFunction, mAlphaFunction, mTimePeriod );
+                mAnimator = SceneGraph::AnimatorTransformProperty< float,TransformManagerPropertyComponentAccessor<Vector3,0> >::New( propertyOwner, *baseProperty, mAnimatorFunction, mAlphaFunction, mTimePeriod );
               }
               else if( mComponentIndex == 1 )
               {
-                mAnimator = SceneGraph::AnimatorTransformProperty< float,TransformManagerPropertyComponentAccessor<Vector3,1> >::New( *propertyOwner, *baseProperty, mAnimatorFunction, mAlphaFunction, mTimePeriod );
+                mAnimator = SceneGraph::AnimatorTransformProperty< float,TransformManagerPropertyComponentAccessor<Vector3,1> >::New( propertyOwner, *baseProperty, mAnimatorFunction, mAlphaFunction, mTimePeriod );
               }
               else if( mComponentIndex == 2 )
               {
-                mAnimator = SceneGraph::AnimatorTransformProperty< float,TransformManagerPropertyComponentAccessor<Vector3,2> >::New( *propertyOwner, *baseProperty, mAnimatorFunction, mAlphaFunction, mTimePeriod );
+                mAnimator = SceneGraph::AnimatorTransformProperty< float,TransformManagerPropertyComponentAccessor<Vector3,2> >::New( propertyOwner, *baseProperty, mAnimatorFunction, mAlphaFunction, mTimePeriod );
               }
             }
             else
@@ -280,7 +281,7 @@ private:
             {
               case 0:
               {
-                mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorX<Vector3> >::New( *propertyOwner,
+                mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorX<Vector3> >::New( propertyOwner,
                                                                                                      *animatableProperty,
                                                                                                      mAnimatorFunction,
                                                                                                      mAlphaFunction,
@@ -289,7 +290,7 @@ private:
               }
               case 1:
               {
-                mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorY<Vector3> >::New( *propertyOwner,
+                mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorY<Vector3> >::New( propertyOwner,
                                                                                                      *animatableProperty,
                                                                                                      mAnimatorFunction,
                                                                                                      mAlphaFunction,
@@ -298,7 +299,7 @@ private:
               }
               case 2:
               {
-                mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorZ<Vector3> >::New( *propertyOwner,
+                mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorZ<Vector3> >::New( propertyOwner,
                                                                                                      *animatableProperty,
                                                                                                      mAnimatorFunction,
                                                                                                      mAlphaFunction,
@@ -313,7 +314,7 @@ private:
 
             if( mAnimator != nullptr )
             {
-              resetter = SceneGraph::AnimatorResetter::New( *propertyOwner, *baseProperty, *mAnimator );
+              resetter = SceneGraph::AnimatorResetter::New( propertyOwner, *baseProperty, *mAnimator );
             }
           }
         }
@@ -331,7 +332,7 @@ private:
           {
             case 0:
             {
-              mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorX<Vector4> >::New( *propertyOwner,
+              mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorX<Vector4> >::New( propertyOwner,
                                                                                                    *animatableProperty,
                                                                                                    mAnimatorFunction,
                                                                                                    mAlphaFunction,
@@ -340,7 +341,7 @@ private:
             }
             case 1:
             {
-              mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorY<Vector4> >::New( *propertyOwner,
+              mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorY<Vector4> >::New( propertyOwner,
                                                                                                    *animatableProperty,
                                                                                                    mAnimatorFunction,
                                                                                                    mAlphaFunction,
@@ -349,7 +350,7 @@ private:
             }
             case 2:
             {
-              mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorZ<Vector4> >::New( *propertyOwner,
+              mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorZ<Vector4> >::New( propertyOwner,
                                                                                                    *animatableProperty,
                                                                                                    mAnimatorFunction,
                                                                                                    mAlphaFunction,
@@ -358,7 +359,7 @@ private:
             }
             case 3:
             {
-              mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorW<Vector4> >::New( *propertyOwner,
+              mAnimator = SceneGraph::Animator< float, PropertyComponentAccessorW<Vector4> >::New( propertyOwner,
                                                                                                    *animatableProperty,
                                                                                                    mAnimatorFunction,
                                                                                                    mAlphaFunction,
@@ -373,7 +374,7 @@ private:
           }
           if( mAnimator != nullptr )
           {
-            resetter = SceneGraph::AnimatorResetter::New( *propertyOwner, *baseProperty, *mAnimator );
+            resetter = SceneGraph::AnimatorResetter::New( propertyOwner, *baseProperty, *mAnimator );
           }
         }
       }
index ee9a341..1abd371 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ namespace Internal
 {
 
 Constrainer::Constrainer()
-:Object()
+:Object( nullptr ) // we don't have our own scene object
 {
 }
 
index 0e13a8f..e7042b8 100644 (file)
@@ -50,38 +50,6 @@ public:
    */
   virtual ~Constrainer();
 
-public: // Object methods
-
-  /**
-   * @copydoc Dali::Internal::Object::SetDefaultProperty()
-   */
-  virtual void SetDefaultProperty( Property::Index index, const Property::Value& propertyValue ){}
-
-  /**
-   * @copydoc Dali::Internal::Object::GetDefaultProperty()
-   */
-  virtual Property::Value GetDefaultProperty( Property::Index index ) const{return Property::Value();}
-
-  /**
-   * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
-   */
-  virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const{return Property::Value();}
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObject()
-   */
-  virtual const SceneGraph::PropertyOwner* GetSceneObject() const{return 0;}
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
-   */
-  virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const{return 0;}
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
-   */
-  virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const{return 0;}
-
 public: // Object::Observer methods
 
   /**
index 5eee38d..c9f04eb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -106,14 +106,11 @@ void ConstraintBase::RemoveInternal()
     // Guard against constraint sending messages during core destruction
     if( Stage::IsInstalled() )
     {
-      const SceneGraph::PropertyOwner* propertyOwner = mTargetObject ? mTargetObject->GetSceneObject() : NULL;
-
-      if ( propertyOwner &&
-           mSceneGraphConstraint )
+      if( mTargetObject && mSceneGraphConstraint )
       {
+        const SceneGraph::PropertyOwner& propertyOwner =  mTargetObject->GetSceneObject();
         // Remove from scene-graph
-        RemoveConstraintMessage( GetEventThreadServices(), *propertyOwner, *(mSceneGraphConstraint) );
-
+        RemoveConstraintMessage( GetEventThreadServices(), propertyOwner, *(mSceneGraphConstraint) );
         // mSceneGraphConstraint will be deleted in update-thread, remove dangling pointer
         mSceneGraphConstraint = NULL;
       }
@@ -173,12 +170,11 @@ void ConstraintBase::SceneObjectRemoved( Object& object )
     // An input property owning source has been deleted, need to tell the scene-graph-constraint owner to remove it
     if ( &object != mTargetObject )
     {
-      const SceneGraph::PropertyOwner* propertyOwner = mTargetObject ? mTargetObject->GetSceneObject() : NULL;
-
-      if( propertyOwner )
+      if( mTargetObject )
       {
+        const SceneGraph::PropertyOwner& propertyOwner = mTargetObject->GetSceneObject();
         // Remove from scene-graph
-        RemoveConstraintMessage( GetEventThreadServices(), *propertyOwner, *(mSceneGraphConstraint) );
+        RemoveConstraintMessage( GetEventThreadServices(), propertyOwner, *(mSceneGraphConstraint) );
       }
     }
 
index 0fc820d..f765bb2 100644 (file)
@@ -149,16 +149,11 @@ private:
     // Guard against double connections
     DALI_ASSERT_DEBUG( NULL == mSceneGraphConstraint );
 
-    // Short-circuit until the target scene-object exists
-    SceneGraph::PropertyOwner* targetObject = const_cast< SceneGraph::PropertyOwner* >( mTargetObject->GetSceneObject() );
-    if ( NULL == targetObject )
-    {
-      return;
-    }
+    SceneGraph::PropertyOwner& targetObject = const_cast< SceneGraph::PropertyOwner& >( mTargetObject->GetSceneObject() );
 
     // Build a container of property-owners, providing the scene-graph properties
     SceneGraph::PropertyOwnerContainer propertyOwners;
-    propertyOwners.PushBack( targetObject );
+    propertyOwners.PushBack( &targetObject );
 
     // Build the constraint function; this requires a scene-graph property from each source
     ConstraintFunctionPtr func( ConnectConstraintFunction( propertyOwners ) );
@@ -191,11 +186,11 @@ private:
                                                            func,
                                                            mRemoveAction );
         // Connect the resetter
-        resetter = SceneGraph::ConstraintResetter::New( *targetObject, *targetProperty, *mSceneGraphConstraint );
+        resetter = SceneGraph::ConstraintResetter::New( targetObject, *targetProperty, *mSceneGraphConstraint );
 
       }
       OwnerPointer< SceneGraph::ConstraintBase > transferOwnership( const_cast< SceneGraph::ConstraintBase* >( mSceneGraphConstraint ) );
-      ApplyConstraintMessage( GetEventThreadServices(), *targetObject, transferOwnership );
+      ApplyConstraintMessage( GetEventThreadServices(), targetObject, transferOwnership );
 
       if( resetter != nullptr )
       {
@@ -225,18 +220,14 @@ private:
       {
         DALI_ASSERT_ALWAYS( source.object->IsPropertyAConstraintInput( source.propertyIndex ) );
 
-        SceneGraph::PropertyOwner* owner = const_cast< SceneGraph::PropertyOwner* >( source.object->GetSceneObject() );
+        SceneGraph::PropertyOwner& owner = const_cast< SceneGraph::PropertyOwner& >( source.object->GetSceneObject() );
 
-        // The property owner will not exist, if the target object is off-stage
-        if( NULL != owner )
-        {
-          AddUnique( propertyOwners, owner );
-          inputProperty = const_cast< PropertyInputImpl* >( source.object->GetSceneObjectInputProperty( source.propertyIndex ) );
-          componentIndex = source.object->GetPropertyComponentIndex( source.propertyIndex );
+        AddUnique( propertyOwners, &owner );
+        inputProperty = const_cast< PropertyInputImpl* >( source.object->GetSceneObjectInputProperty( source.propertyIndex ) );
+        componentIndex = source.object->GetPropertyComponentIndex( source.propertyIndex );
 
-          // The scene-object property should exist, when the property owner exists
-          DALI_ASSERT_ALWAYS( NULL != inputProperty && "Constraint source property does not exist" );
-        }
+        // The scene-object property should exist, when the property owner exists
+        DALI_ASSERT_ALWAYS( NULL != inputProperty && "Constraint source property does not exist" );
       }
       else if ( LOCAL_PROPERTY == source.sourceType )
       {
@@ -259,18 +250,14 @@ private:
         {
           DALI_ASSERT_ALWAYS( objectParent->IsPropertyAConstraintInput( source.propertyIndex ) );
 
-          SceneGraph::PropertyOwner* owner = const_cast< SceneGraph::PropertyOwner* >( objectParent->GetSceneObject() );
+          SceneGraph::PropertyOwner& owner = const_cast< SceneGraph::PropertyOwner& >( objectParent->GetSceneObject() );
 
-          // The property owner will not exist, if the parent object is off-stage
-          if ( NULL != owner )
-          {
-            AddUnique( propertyOwners, owner );
-            inputProperty = const_cast< PropertyInputImpl* >( objectParent->GetSceneObjectInputProperty( source.propertyIndex ) );
-            componentIndex = objectParent->GetPropertyComponentIndex( source.propertyIndex );
+          AddUnique( propertyOwners, &owner );
+          inputProperty = const_cast< PropertyInputImpl* >( objectParent->GetSceneObjectInputProperty( source.propertyIndex ) );
+          componentIndex = objectParent->GetPropertyComponentIndex( source.propertyIndex );
 
-            // The scene-object property should exist, when the property owner exists
-            DALI_ASSERT_ALWAYS( NULL != inputProperty && "Constraint source property does not exist" );
-          }
+          // The scene-object property should exist, when the property owner exists
+          DALI_ASSERT_ALWAYS( NULL != inputProperty && "Constraint source property does not exist" );
         }
       }
 
@@ -385,15 +372,11 @@ private:
     DALI_ASSERT_DEBUG( NULL == mSceneGraphConstraint );
 
     // Short-circuit until the target scene-object exists
-    SceneGraph::PropertyOwner* targetObject = const_cast< SceneGraph::PropertyOwner* >( mTargetObject->GetSceneObject() );
-    if ( NULL == targetObject )
-    {
-      return;
-    }
+    SceneGraph::PropertyOwner& targetObject = const_cast< SceneGraph::PropertyOwner& >( mTargetObject->GetSceneObject() );
 
     // Build a container of property-owners, providing the scene-graph properties
     SceneGraph::PropertyOwnerContainer propertyOwners;
-    propertyOwners.PushBack( targetObject );
+    propertyOwners.PushBack( &targetObject );
 
     // Build the constraint function; this requires a scene-graph property from each source
     ConstraintFunctionPtr func( ConnectConstraintFunction( propertyOwners ) );
@@ -418,7 +401,7 @@ private:
         typedef SceneGraph::Constraint< float, PropertyAccessor<float> > SceneGraphConstraint;
 
         mSceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mRemoveAction );
-        resetter = SceneGraph::ConstraintResetter::New( *targetObject, *targetProperty, *mSceneGraphConstraint );
+        resetter = SceneGraph::ConstraintResetter::New( targetObject, *targetProperty, *mSceneGraphConstraint );
       }
       else
       {
@@ -440,7 +423,7 @@ private:
           }
           if( mSceneGraphConstraint )
           {
-            resetter = SceneGraph::ConstraintResetter::New( *targetObject, *targetProperty, *mSceneGraphConstraint );
+            resetter = SceneGraph::ConstraintResetter::New( targetObject, *targetProperty, *mSceneGraphConstraint );
           }
         }
         else if ( PropertyTypes::Get< Vector3 >() == targetProperty->GetType() )
@@ -484,7 +467,7 @@ private:
             }
             if( mSceneGraphConstraint )
             {
-              resetter = SceneGraph::ConstraintResetter::New( *targetObject, *targetProperty, *mSceneGraphConstraint );
+              resetter = SceneGraph::ConstraintResetter::New( targetObject, *targetProperty, *mSceneGraphConstraint );
             }
           }
         }
@@ -515,7 +498,7 @@ private:
 
           if( mSceneGraphConstraint )
           {
-            resetter = SceneGraph::ConstraintResetter::New( *targetObject, *targetProperty, *mSceneGraphConstraint );
+            resetter = SceneGraph::ConstraintResetter::New( targetObject, *targetProperty, *mSceneGraphConstraint );
           }
         }
       }
@@ -523,7 +506,7 @@ private:
       if( mSceneGraphConstraint )
       {
         OwnerPointer< SceneGraph::ConstraintBase > transferOwnership( const_cast< SceneGraph::ConstraintBase* >( mSceneGraphConstraint ) );
-        ApplyConstraintMessage( GetEventThreadServices(), *targetObject, transferOwnership );
+        ApplyConstraintMessage( GetEventThreadServices(), targetObject, transferOwnership );
       }
       if( resetter != nullptr )
       {
@@ -553,18 +536,15 @@ private:
       {
         DALI_ASSERT_ALWAYS( source.object->IsPropertyAConstraintInput( source.propertyIndex ) );
 
-        SceneGraph::PropertyOwner* owner = const_cast< SceneGraph::PropertyOwner* >( source.object->GetSceneObject() );
+        SceneGraph::PropertyOwner& owner = const_cast< SceneGraph::PropertyOwner& >( source.object->GetSceneObject() );
 
         // The property owner will not exist, if the target object is off-stage
-        if( NULL != owner )
-        {
-          AddUnique( propertyOwners, owner );
-          inputProperty = const_cast< PropertyInputImpl* >( source.object->GetSceneObjectInputProperty( source.propertyIndex ) );
-          componentIndex = source.object->GetPropertyComponentIndex( source.propertyIndex );
+        AddUnique( propertyOwners, &owner );
+        inputProperty = const_cast< PropertyInputImpl* >( source.object->GetSceneObjectInputProperty( source.propertyIndex ) );
+        componentIndex = source.object->GetPropertyComponentIndex( source.propertyIndex );
 
-          // The scene-object property should exist, when the property owner exists
-          DALI_ASSERT_ALWAYS( NULL != inputProperty && "Constraint source property does not exist" );
-        }
+        // The scene-object property should exist, when the property owner exists
+        DALI_ASSERT_ALWAYS( NULL != inputProperty && "Constraint source property does not exist" );
       }
       else if ( LOCAL_PROPERTY == source.sourceType )
       {
@@ -587,18 +567,15 @@ private:
         {
           DALI_ASSERT_ALWAYS( objectParent->IsPropertyAConstraintInput( source.propertyIndex ) );
 
-          SceneGraph::PropertyOwner* owner = const_cast< SceneGraph::PropertyOwner* >( objectParent->GetSceneObject() );
+          SceneGraph::PropertyOwner& owner = const_cast< SceneGraph::PropertyOwner& >( objectParent->GetSceneObject() );
 
           // The property owner will not exist, if the parent object is off-stage
-          if ( NULL != owner )
-          {
-            AddUnique( propertyOwners, owner );
-            inputProperty = const_cast< PropertyInputImpl* >( objectParent->GetSceneObjectInputProperty( source.propertyIndex ) );
-            componentIndex = objectParent->GetPropertyComponentIndex( source.propertyIndex );
+          AddUnique( propertyOwners, &owner );
+          inputProperty = const_cast< PropertyInputImpl* >( objectParent->GetSceneObjectInputProperty( source.propertyIndex ) );
+          componentIndex = objectParent->GetPropertyComponentIndex( source.propertyIndex );
 
-            // The scene-object property should exist, when the property owner exists
-            DALI_ASSERT_ALWAYS( NULL != inputProperty && "Constraint source property does not exist" );
-          }
+          // The scene-object property should exist, when the property owner exists
+          DALI_ASSERT_ALWAYS( NULL != inputProperty && "Constraint source property does not exist" );
         }
       }
 
index 5881c36..c5455a4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -82,7 +82,7 @@ Path* Path::New()
 }
 
 Path::Path()
-: Object()
+: Object( nullptr ) // we don't have our own scene object
 {
 }
 
@@ -137,11 +137,6 @@ Property::Value Path::GetDefaultProperty( Property::Index index ) const
   return Property::Value();
 }
 
-Property::Value Path::GetDefaultPropertyCurrentValue( Property::Index index ) const
-{
-  return GetDefaultProperty( index ); // Event-side only properties
-}
-
 void Path::SetDefaultProperty(Property::Index index, const Property::Value& propertyValue)
 {
   const Property::Array* array = propertyValue.GetArray();
@@ -181,20 +176,20 @@ void Path::AddControlPoint(const Vector3& point )
   mControlPoint.PushBack( point );
 }
 
-unsigned int Path::GetNumberOfSegments() const
+uint32_t Path::GetNumberOfSegments() const
 {
-  return static_cast<unsigned int>( (mPoint.Size()>1) ? mPoint.Size()-1 : 0 );
+  return static_cast<uint32_t>( (mPoint.Size()>1) ? mPoint.Size()-1 : 0 );
 }
 
 void Path::GenerateControlPoints( float curvature )
 {
-  unsigned int numSegments = GetNumberOfSegments();
+  uint32_t numSegments = GetNumberOfSegments();
   DALI_ASSERT_ALWAYS( numSegments > 0 && "Need at least 1 segment to generate control points" ); // need at least 1 segment
 
   mControlPoint.Resize( numSegments * 2);
 
   //Generate two control points for each segment
-  for( unsigned int i(0); i<numSegments; ++i )
+  for( uint32_t i(0); i<numSegments; ++i )
   {
     //Segment end-points
     Vector3 p1 = mPoint[i];
@@ -245,10 +240,10 @@ void Path::GenerateControlPoints( float curvature )
   }
 }
 
-void Path::FindSegmentAndProgress( float t, unsigned int& segment, float& tLocal ) const
+void Path::FindSegmentAndProgress( float t, uint32_t& segment, float& tLocal ) const
 {
   //Find segment and local progress
-  unsigned int numSegs = GetNumberOfSegments();
+  uint32_t numSegs = GetNumberOfSegments();
 
   if( t <= 0.0f || numSegs == 0 )
   {
@@ -262,7 +257,7 @@ void Path::FindSegmentAndProgress( float t, unsigned int& segment, float& tLocal
   }
   else
   {
-    segment = static_cast<unsigned int>( t * static_cast<float>( numSegs ) );
+    segment = static_cast<uint32_t>( t * static_cast<float>( numSegs ) );
     float segLength = 1.0f / static_cast<float>( numSegs );
     float segStart  = static_cast<float>( segment ) * segLength;
     tLocal = (t - segStart) * static_cast<float>( numSegs );
@@ -283,7 +278,7 @@ bool Path::SampleAt( float t, Vector3& position, Vector3& tangent ) const
 
   if( PathIsComplete(mPoint, mControlPoint) )
   {
-    unsigned int segment;
+    uint32_t segment;
     float tLocal;
     FindSegmentAndProgress( t, segment, tLocal );
 
@@ -352,7 +347,7 @@ bool Path::SamplePosition( float t, Vector3& position ) const
 
   if( PathIsComplete(mPoint, mControlPoint) )
   {
-    unsigned int segment;
+    uint32_t segment;
     float tLocal;
     FindSegmentAndProgress( t, segment, tLocal );
 
@@ -404,7 +399,7 @@ bool Path::SampleTangent( float t, Vector3& tangent ) const
 
   if( PathIsComplete(mPoint, mControlPoint) )
   {
-    unsigned int segment;
+    uint32_t segment;
     float tLocal;
     FindSegmentAndProgress( t, segment, tLocal );
 
@@ -451,23 +446,23 @@ bool Path::SampleTangent( float t, Vector3& tangent ) const
   return done;
 }
 
-Vector3& Path::GetPoint( size_t index )
+Vector3& Path::GetPoint( uint32_t index )
 {
   DALI_ASSERT_ALWAYS( index < mPoint.Size() && "Path: Point index out of bounds" );
 
   return mPoint[index];
 }
 
-Vector3& Path::GetControlPoint( size_t index )
+Vector3& Path::GetControlPoint( uint32_t index )
 {
   DALI_ASSERT_ALWAYS( index < mControlPoint.Size() && "Path: Control Point index out of bounds" );
 
   return mControlPoint[index];
 }
 
-size_t Path::GetPointCount() const
+uint32_t Path::GetPointCount() const
 {
-  return mPoint.Size();
+  return static_cast<uint32_t>( mPoint.Size() );
 }
 
 void Path::ClearPoints()
index bc000c5..62346c0 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_PATH_H__
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -57,20 +57,6 @@ protected:
   virtual ~Path();
 
 private:
-  /**
-   * @copydoc Dali::Internal::Object::Observer::SceneObjectAdded()
-   */
-  virtual void SceneObjectAdded(Object& object){}
-
-  /**
-   * @copydoc Dali::Internal::Object::Observer::SceneObjectAdded()
-   */
-  virtual void SceneObjectRemoved(Object& object){}
-
-  /**
-   * @copydoc Dali::Internal::Object::Observer::ObjectDestroyed()
-   */
-  virtual void ObjectDestroyed(Object& object){}
 
   /**
    * @copydoc Dali::Internal::Object::SetDefaultProperty()
@@ -82,26 +68,6 @@ private:
    */
   virtual Property::Value GetDefaultProperty( Property::Index index ) const;
 
-  /**
-   * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
-   */
-  virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObject()
-   */
-  virtual const SceneGraph::PropertyOwner* GetSceneObject() const{ return NULL; }
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
-   */
-  virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const{ return NULL; }
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
-   */
-  virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const{ return NULL; }
-
 public:
 
   /**
@@ -160,17 +126,17 @@ public:
   /**
    * @copydoc Dali::Path::GetPoint
    */
-  Vector3& GetPoint( size_t index );
+  Vector3& GetPoint( uint32_t index );
 
   /**
    * @copydoc Dali::Path::GetControlPoint
    */
-  Vector3& GetControlPoint( size_t index );
+  Vector3& GetControlPoint( uint32_t index );
 
   /**
    * @copydoc Dali::Path::GetPointCount
    */
-  size_t GetPointCount() const;
+  uint32_t GetPointCount() const;
 
   /**
    * Clears the points of the path
@@ -231,12 +197,12 @@ private:
    * @param[out] tLocal Local progress in the segment
    *
    */
-  void FindSegmentAndProgress( float t, unsigned int& segment, float& tLocal ) const;
+  void FindSegmentAndProgress( float t, uint32_t& segment, float& tLocal ) const;
 
   /**
    * Helper function to calculate to number of segments in the path
    */
-  unsigned int GetNumberOfSegments() const;
+  uint32_t GetNumberOfSegments() const;
 
   Dali::Vector<Vector3> mPoint;            ///< Interpolation points
   Dali::Vector<Vector3> mControlPoint;     ///< Control points
diff --git a/dali/internal/event/common/object-impl-helper.h b/dali/internal/event/common/object-impl-helper.h
deleted file mode 100644 (file)
index 830def7..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-#ifndef DALI_INTERNAL_OBJECT_IMPL_HELPER_H
-#define DALI_INTERNAL_OBJECT_IMPL_HELPER_H
-
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDEs
-#include <cstring>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/object/property.h> // Dali::Property
-#include <dali/internal/event/common/event-thread-services.h>
-#include <dali/internal/update/common/animatable-property.h>
-#include <dali/internal/update/common/property-owner-messages.h>
-#include <dali/internal/update/manager/update-manager.h>
-
-namespace Dali
-{
-namespace Internal
-{
-class PropertyMetadata;
-class AnimatablePropertyMetadata;
-class CustomPropertyMetadata;
-class PropertyInputImpl;
-
-namespace SceneGraph
-{
-
-class PropertyBase;
-class PropertyOwner;
-
-} // namespace SceneGraph
-
-// methods needed as parameters
-using FindAnimatablePropertyMethod = AnimatablePropertyMetadata* (Object::*)(Property::Index index) const;
-using FindCustomPropertyMethod = CustomPropertyMetadata* (Object::*)(Property::Index index) const;
-
-/**
- * Helper utilities to be used by class that implement Object
- */
-namespace ObjectImplHelper
-{
-  // Get the (animatable) scene graph property. (All registered scene graph properties are animatable)
-  inline const SceneGraph::PropertyBase* GetRegisteredSceneGraphProperty( const Object* object,
-                                                                          FindAnimatablePropertyMethod findAnimatablePropertyMethod,
-                                                                          FindCustomPropertyMethod findCustomPropertyMethod,
-                                                                          Property::Index index )
-  {
-    const SceneGraph::PropertyBase* property = NULL;
-    if ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX && index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )
-    {
-      AnimatablePropertyMetadata* animatable = (object->*findAnimatablePropertyMethod)( index );
-      DALI_ASSERT_ALWAYS( animatable && "Property index is invalid" );
-      property = animatable->GetSceneGraphProperty();
-    }
-    else if ( ( index > CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties
-              ( index <= PROPERTY_CUSTOM_MAX_INDEX ) )
-    {
-      CustomPropertyMetadata* custom = (object->*findCustomPropertyMethod)( index );
-      DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
-      property = custom->GetSceneGraphProperty();
-    }
-    return property;
-  }
-
-  inline void SetSceneGraphProperty( EventThreadServices& eventThreadServices,
-                                     const Object* object,
-                                     Property::Index index,
-                                     const PropertyMetadata& entry,
-                                     const Property::Value& value )
-  {
-    const SceneGraph::PropertyOwner* sceneObject = object->GetSceneObject();
-
-    switch ( entry.GetType() )
-    {
-      case Property::BOOLEAN:
-      {
-        const SceneGraph::AnimatableProperty<bool>* property = dynamic_cast< const SceneGraph::AnimatableProperty<bool>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
-
-        // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::AnimatablePropertyMessage<bool>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<bool>::Bake, value.Get<bool>() );
-
-        break;
-      }
-
-      case Property::FLOAT:
-      {
-        const SceneGraph::AnimatableProperty<float>* property = dynamic_cast< const SceneGraph::AnimatableProperty<float>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
-
-        // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::AnimatablePropertyMessage<float>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<float>::Bake, value.Get<float>() );
-
-        break;
-      }
-
-      case Property::INTEGER:
-      {
-        const SceneGraph::AnimatableProperty<int>* property = dynamic_cast< const SceneGraph::AnimatableProperty<int>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
-
-        // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::AnimatablePropertyMessage<int>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<int>::Bake, value.Get<int>() );
-
-        break;
-      }
-
-      case Property::VECTOR2:
-      {
-        const SceneGraph::AnimatableProperty<Vector2>* property = dynamic_cast< const SceneGraph::AnimatableProperty<Vector2>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
-
-        // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::AnimatablePropertyMessage<Vector2>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<Vector2>::Bake, value.Get<Vector2>() );
-
-        break;
-      }
-
-      case Property::VECTOR3:
-      {
-        const SceneGraph::AnimatableProperty<Vector3>* property = dynamic_cast< const SceneGraph::AnimatableProperty<Vector3>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
-
-        // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::AnimatablePropertyMessage<Vector3>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<Vector3>::Bake, value.Get<Vector3>() );
-
-        break;
-      }
-
-      case Property::VECTOR4:
-      {
-        const SceneGraph::AnimatableProperty<Vector4>* property = dynamic_cast< const SceneGraph::AnimatableProperty<Vector4>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
-
-        // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::AnimatablePropertyMessage<Vector4>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<Vector4>::Bake, value.Get<Vector4>() );
-
-        break;
-      }
-
-      case Property::ROTATION:
-      {
-        const SceneGraph::AnimatableProperty<Quaternion>* property = dynamic_cast< const SceneGraph::AnimatableProperty<Quaternion>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
-
-        // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::AnimatablePropertyMessage<Quaternion>::Send( eventThreadServices, sceneObject, property,&SceneGraph::AnimatableProperty<Quaternion>::Bake,  value.Get<Quaternion>() );
-
-        break;
-      }
-
-      case Property::MATRIX:
-      {
-        const SceneGraph::AnimatableProperty<Matrix>* property = dynamic_cast< const SceneGraph::AnimatableProperty<Matrix>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
-
-        // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::AnimatablePropertyMessage<Matrix>::Send( eventThreadServices, sceneObject, property,&SceneGraph::AnimatableProperty<Matrix>::Bake,  value.Get<Matrix>() );
-
-        break;
-      }
-
-      case Property::MATRIX3:
-      {
-        const SceneGraph::AnimatableProperty<Matrix3>* property = dynamic_cast< const SceneGraph::AnimatableProperty<Matrix3>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
-
-        // property is being used in a separate thread; queue a message to set the property
-        SceneGraph::AnimatablePropertyMessage<Matrix3>::Send( eventThreadServices, sceneObject, property, &SceneGraph::AnimatableProperty<Matrix3>::Bake,  value.Get<Matrix3>() );
-
-        break;
-      }
-
-      default:
-      {
-        // ignore non-scene-graph types
-      }
-    }
-  }
-};
-
-
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // DALI_INTERNAL_OBJECT_IMPL_HELPER_H
index 5e68a6e..09e48c0 100644 (file)
@@ -26,6 +26,7 @@
 #include <dali/devel-api/object/handle-devel.h>
 #include <dali/internal/update/animation/scene-graph-constraint-base.h>
 #include <dali/internal/update/common/animatable-property.h>
+#include <dali/internal/update/common/property-owner.h>
 #include <dali/internal/update/common/property-owner-messages.h>
 #include <dali/internal/update/common/uniform-map.h>
 #include <dali/internal/event/animation/constraint-impl.h>
@@ -45,7 +46,7 @@ namespace Internal
 
 namespace // unnamed namespace
 {
-const int SUPPORTED_CAPABILITIES = Dali::Handle::DYNAMIC_PROPERTIES;  // Object provides this capability
+const int32_t SUPPORTED_CAPABILITIES = Dali::Handle::DYNAMIC_PROPERTIES;  // Object provides this capability
 
 #if defined(DEBUG_ENABLED)
 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_OBJECT" );
@@ -55,12 +56,9 @@ constexpr Property::Index MAX_PER_CLASS_PROPERTY_INDEX = ANIMATABLE_PROPERTY_REG
 
 } // unnamed namespace
 
-Object::Object()
-: mEventThreadServices( *Stage::GetCurrent() ),
-  mTypeInfo( NULL ),
-  mConstraints( NULL ),
-  mPropertyNotifications( NULL )
+IntrusivePtr<Object> Object::New()
 {
+  return new Object( nullptr ); // no scene object by default
 }
 
 void Object::AddObserver(Observer& observer)
@@ -430,7 +428,7 @@ void Object::SetProperty( Property::Index index, const Property::Value& property
   }
 }
 
-Property::Value Object::GetProperty(Property::Index index) const
+Property::Value Object::GetProperty( Property::Index index ) const
 {
   DALI_ASSERT_ALWAYS( index > Property::INVALID_INDEX && "Property index is out of bounds" );
 
@@ -608,7 +606,6 @@ Property::Index Object::RegisterProperty( const std::string& name, Property::Ind
   else
   {
     // Otherwise register the property
-
     if( Property::ANIMATABLE == accessMode )
     {
       index = RegisterSceneGraphProperty( name, key, PROPERTY_CUSTOM_START_INDEX + static_cast<Property::Index>( mCustomProperties.Count() ), propertyValue );
@@ -734,7 +731,7 @@ void Object::NotifyPropertyAnimation( Animation& animation, Property::Index inde
   }
   else
   {
-    PropertyMetadata* propertyMetadata = NULL;
+    PropertyMetadata* propertyMetadata = nullptr;
     if( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) )
     {
       propertyMetadata = FindAnimatableProperty( index );
@@ -776,45 +773,38 @@ void Object::AddUniformMapping( Property::Index propertyIndex, const std::string
   const PropertyInputImpl* propertyPtr = GetSceneObjectInputProperty( propertyIndex );
 
   // Check instead for newly registered properties
-  if( propertyPtr == NULL )
+  if( propertyPtr == nullptr )
   {
     PropertyMetadata* animatable = FindAnimatableProperty( propertyIndex );
-    if( animatable != NULL )
+    if( animatable )
     {
       propertyPtr = animatable->GetSceneGraphProperty();
     }
   }
 
-  if( propertyPtr == NULL )
+  if( propertyPtr == nullptr )
   {
     PropertyMetadata* custom = FindCustomProperty( propertyIndex );
-    if( custom != NULL )
+    if( custom )
     {
       propertyPtr = custom->GetSceneGraphProperty();
     }
   }
 
-  if( propertyPtr != NULL )
+  if( propertyPtr )
   {
-    const SceneGraph::PropertyOwner* sceneObject = GetPropertyOwner();
+    const SceneGraph::PropertyOwner& sceneObject = GetSceneObject();
 
-    if( sceneObject != NULL )
-    {
-      OwnerPointer< SceneGraph::UniformPropertyMapping > map = new SceneGraph::UniformPropertyMapping( uniformName, propertyPtr );
-      // Message takes ownership of Uniform map (and will delete it after copy)
-      AddUniformMapMessage( const_cast<EventThreadServices&>(GetEventThreadServices()), *sceneObject, map );
-    }
-    else
-    {
-      DALI_ASSERT_ALWAYS(0 && "MESH_REWORK - Need to store property whilst off-stage" );
-    }
+    OwnerPointer< SceneGraph::UniformPropertyMapping > map = new SceneGraph::UniformPropertyMapping( uniformName, propertyPtr );
+    // Message takes ownership of Uniform map (and will delete it after copy)
+    AddUniformMapMessage( const_cast<EventThreadServices&>(GetEventThreadServices()), sceneObject, map );
   }
 }
 
-void Object::RemoveUniformMapping( const std::string& uniformName )
+void Object::RemoveUniformMapping( const std::string& uniformName ) const
 {
-  const SceneGraph::PropertyOwner* sceneObject = GetSceneObject();
-  RemoveUniformMapMessage( GetEventThreadServices(), *sceneObject, uniformName);
+  const SceneGraph::PropertyOwner& sceneObject = GetSceneObject();
+  RemoveUniformMapMessage( const_cast<EventThreadServices&>(GetEventThreadServices()), sceneObject, uniformName);
 }
 
 void Object::ApplyConstraint( ConstraintBase& constraint )
@@ -828,7 +818,7 @@ void Object::ApplyConstraint( ConstraintBase& constraint )
 
 void Object::RemoveConstraint( ConstraintBase& constraint )
 {
-  // NULL if the Constraint sources are destroyed before Constraint::Apply()
+  // nullptr if the Constraint sources are destroyed before Constraint::Apply()
   if( mConstraints )
   {
     ConstraintIter it( std::find( mConstraints->begin(), mConstraints->end(), Dali::Constraint( &constraint ) ) );
@@ -844,19 +834,13 @@ void Object::RemoveConstraints()
   // guard against constraint sending messages during core destruction
   if( mConstraints && Stage::IsInstalled() )
   {
-    // If we have nothing in the scene-graph, just clear constraint containers
-    const SceneGraph::PropertyOwner* propertyOwner = GetSceneObject();
-    if ( NULL != propertyOwner )
+    for ( auto&& item : *mConstraints )
     {
-      const auto endIter = mConstraints->end();
-      for ( auto iter = mConstraints->begin(); endIter != iter; ++iter )
-      {
-        GetImplementation( *iter ).RemoveInternal();
-      }
+      GetImplementation( item ).RemoveInternal();
     }
 
     delete mConstraints;
-    mConstraints = NULL;
+    mConstraints = nullptr;
   }
 }
 
@@ -883,7 +867,7 @@ void Object::RemoveConstraints( uint32_t tag )
     if ( mConstraints->empty() )
     {
       delete mConstraints;
-      mConstraints = NULL;
+      mConstraints = nullptr;
     }
   }
 }
@@ -893,14 +877,66 @@ void Object::SetTypeInfo( const TypeInfo* typeInfo )
   mTypeInfo = typeInfo;
 }
 
+const SceneGraph::PropertyOwner& Object::GetSceneObject() const
+{
+  if( !mUpdateObject )
+  {
+    auto sceneObject = SceneGraph::PropertyOwner::New();
+    OwnerPointer< SceneGraph::PropertyOwner > transferOwnership( sceneObject );
+    mUpdateObject = sceneObject;
+    AddObjectMessage( const_cast<EventThreadServices&>( GetEventThreadServices() ).GetUpdateManager(), transferOwnership );
+  }
+  DALI_ASSERT_DEBUG( mUpdateObject && "there must always be a scene object" );
+  return *mUpdateObject;
+}
+
+const PropertyBase* Object::GetSceneObjectAnimatableProperty( Property::Index index ) const
+{
+  const SceneGraph::PropertyBase* property = nullptr;
+  if ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX && index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )
+  {
+    AnimatablePropertyMetadata* animatable = GetSceneAnimatableProperty( index, nullptr );
+    DALI_ASSERT_ALWAYS( animatable && "Property index is invalid" );
+
+    property = animatable->GetSceneGraphProperty();
+  }
+  else if ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties
+            ( index <= PROPERTY_CUSTOM_MAX_INDEX ) )
+  {
+    CustomPropertyMetadata* custom = FindCustomProperty( index );
+    DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
+
+    property = custom->GetSceneGraphProperty();
+  }
+  return property;
+}
+
+const PropertyInputImpl* Object::GetSceneObjectInputProperty( Property::Index index ) const
+{
+  // reuse animatable version as they are inputs as well
+  return GetSceneObjectAnimatableProperty( index );
+}
+
 int32_t Object::GetPropertyComponentIndex( Property::Index index ) const
 {
   int32_t componentIndex = Property::INVALID_COMPONENT_INDEX;
 
-  const TypeInfo* typeInfo( GetTypeInfo() );
-  if ( typeInfo )
+  if ( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) )
+  {
+    // check whether the animatable property is registered already, if not then register one.
+    AnimatablePropertyMetadata* animatableProperty = GetSceneAnimatableProperty( index, nullptr );
+    if( animatableProperty )
+    {
+      componentIndex = animatableProperty->componentIndex;
+    }
+  }
+  if( Property::INVALID_COMPONENT_INDEX == componentIndex )
   {
-    componentIndex = typeInfo->GetComponentIndex(index);
+    const TypeInfo* typeInfo( GetTypeInfo() );
+    if ( typeInfo )
+    {
+      componentIndex = typeInfo->GetComponentIndex(index);
+    }
   }
 
   return componentIndex;
@@ -911,24 +947,41 @@ DevelHandle::PropertySetSignalType& Object::PropertySetSignal()
   return mPropertySetSignal;
 }
 
+Object::Object( const SceneGraph::PropertyOwner* sceneObject )
+: mEventThreadServices( *Stage::GetCurrent() ),
+  mUpdateObject( sceneObject ),
+  mTypeInfo( nullptr ),
+  mConstraints( nullptr ),
+  mPropertyNotifications( nullptr )
+{
+}
+
 Object::~Object()
 {
   // Notification for observers
-  for( auto iter = mObservers.Begin(), endIter =  mObservers.End(); iter != endIter; ++iter)
+  for( auto&& item : mObservers )
   {
-    (*iter)->ObjectDestroyed(*this);
+    item->ObjectDestroyed( *this );
   }
-
   delete mConstraints;
   delete mPropertyNotifications;
+
+  // Guard to allow handle destruction after Core has been destroyed
+  if( Stage::IsInstalled() )
+  {
+    if( nullptr != mUpdateObject )
+    {
+      RemoveObjectMessage( GetEventThreadServices().GetUpdateManager(), mUpdateObject );
+    }
+  }
 }
 
 void Object::OnSceneObjectAdd()
 {
   // Notification for observers
-  for( auto iter = mObservers.Begin(), endIter =  mObservers.End(); iter != endIter; ++iter)
+  for( auto&& item : mObservers )
   {
-    (*iter)->SceneObjectAdded(*this);
+    item->SceneObjectAdded(*this);
   }
 
   // enable property notifications in scene graph
@@ -938,9 +991,9 @@ void Object::OnSceneObjectAdd()
 void Object::OnSceneObjectRemove()
 {
   // Notification for observers
-  for( auto iter = mObservers.Begin(), endIter = mObservers.End(); iter != endIter; ++iter )
+  for( auto&& item : mObservers )
   {
-    (*iter)->SceneObjectRemoved(*this);
+    item->SceneObjectRemoved(*this);
   }
 
   // disable property notifications in scene graph
@@ -966,7 +1019,7 @@ const TypeInfo* Object::GetTypeInfo() const
 
 CustomPropertyMetadata* Object::FindCustomProperty( Property::Index index ) const
 {
-  CustomPropertyMetadata* property( NULL );
+  CustomPropertyMetadata* property = nullptr;
   if ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX ) )
   {
     for ( std::size_t arrayIndex = 0; arrayIndex < mCustomProperties.Count(); arrayIndex++ )
@@ -980,10 +1033,10 @@ CustomPropertyMetadata* Object::FindCustomProperty( Property::Index index ) cons
   }
   else
   {
-    int arrayIndex = index - PROPERTY_CUSTOM_START_INDEX;
+    int32_t arrayIndex = index - PROPERTY_CUSTOM_START_INDEX;
     if( arrayIndex >= 0 )
     {
-      if( arrayIndex < static_cast<int>( mCustomProperties.Count() ) ) // we can only access the first 2 billion custom properties
+      if( arrayIndex < static_cast<int32_t>( mCustomProperties.Count() ) ) // we can only access the first 2 billion custom properties
       {
         property = static_cast<CustomPropertyMetadata*>(mCustomProperties[ arrayIndex ]);
       }
@@ -1002,10 +1055,10 @@ AnimatablePropertyMetadata* Object::FindAnimatableProperty( Property::Index inde
       return property;
     }
   }
-  return NULL;
+  return nullptr;
 }
 
-Property::Index Object::RegisterSceneGraphProperty(const std::string& name, Property::Index key, Property::Index index, const Property::Value& propertyValue) const
+Property::Index Object::RegisterSceneGraphProperty( const std::string& name, Property::Index key, Property::Index index, const Property::Value& propertyValue ) const
 {
   // Create a new property
   Dali::Internal::OwnerPointer<PropertyBase> newProperty;
@@ -1020,7 +1073,7 @@ Property::Index Object::RegisterSceneGraphProperty(const std::string& name, Prop
 
     case Property::INTEGER:
     {
-      newProperty = new AnimatableProperty<int>( propertyValue.Get<int>() );
+      newProperty = new AnimatableProperty<int32_t>( propertyValue.Get<int32_t>() );
       break;
     }
 
@@ -1078,34 +1131,25 @@ Property::Index Object::RegisterSceneGraphProperty(const std::string& name, Prop
     }
   }
 
-  // get the scene property owner from derived class
-  const SceneGraph::PropertyOwner* scenePropertyOwner = GetPropertyOwner();
-  // we can only pass properties to scene graph side if there is a scene object
-  if( scenePropertyOwner )
+  // get the scene property owner
+  const SceneGraph::PropertyOwner& scenePropertyOwner = GetSceneObject();
+  // keep a local pointer to the property as the OwnerPointer will pass its copy to the message
+  const PropertyBase* property = newProperty.Get();
+  if(index >= PROPERTY_CUSTOM_START_INDEX)
   {
-    // keep a local pointer to the property as the OwnerPointer will pass its copy to the message
-    const PropertyBase* property = newProperty.Get();
-    if(index >= PROPERTY_CUSTOM_START_INDEX)
-    {
-      DALI_ASSERT_ALWAYS( index <= PROPERTY_CUSTOM_MAX_INDEX && "Too many custom properties have been registered" );
+    DALI_ASSERT_ALWAYS( index <= PROPERTY_CUSTOM_MAX_INDEX && "Too many custom properties have been registered" );
 
-      mCustomProperties.PushBack( new CustomPropertyMetadata( name, key, propertyValue, property ) );
-    }
-    else
-    {
-      mAnimatableProperties.PushBack( new AnimatablePropertyMetadata( index, propertyValue, property ) );
-    }
-
-    // queue a message to add the property
-    InstallCustomPropertyMessage( const_cast<EventThreadServices&>(GetEventThreadServices()), *scenePropertyOwner, newProperty ); // Message takes ownership
-
-    return index;
+    mCustomProperties.PushBack( new CustomPropertyMetadata( name, key, propertyValue, property ) );
   }
   else
   {
-    // property was orphaned and killed so return invalid index
-    return Property::INVALID_INDEX;
+    mAnimatableProperties.PushBack( new AnimatablePropertyMetadata( index, propertyValue, property ) );
   }
+
+  // queue a message to add the property
+  InstallCustomPropertyMessage( const_cast<EventThreadServices&>(GetEventThreadServices()), scenePropertyOwner, newProperty ); // Message takes ownership
+
+  return index;
 }
 
 void Object::RegisterAnimatableProperty( const TypeInfo& typeInfo,
@@ -1206,6 +1250,21 @@ void Object::ResolveChildProperties()
   }
 }
 
+void Object::SetDefaultProperty( Property::Index index, const Property::Value& property )
+{
+  // do nothing
+}
+
+Property::Value Object::GetDefaultProperty(Property::Index index) const
+{
+  return Property::Value();
+}
+
+Property::Value Object::GetDefaultPropertyCurrentValue( Property::Index index ) const
+{
+  return GetDefaultProperty( index );
+}
+
 void Object::EnablePropertyNotifications()
 {
   if( mPropertyNotifications )
@@ -1245,7 +1304,7 @@ Property::Value Object::GetCurrentPropertyValue( const PropertyMetadata& entry )
       case Property::BOOLEAN:
       {
         const AnimatableProperty<bool>* property = static_cast< const AnimatableProperty<bool>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+        DALI_ASSERT_DEBUG( property );
 
         value = (*property)[ bufferIndex ];
         break;
@@ -1253,8 +1312,8 @@ Property::Value Object::GetCurrentPropertyValue( const PropertyMetadata& entry )
 
       case Property::INTEGER:
       {
-        const AnimatableProperty<int>* property = static_cast< const AnimatableProperty<int>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+        const AnimatableProperty<int32_t>* property = static_cast< const AnimatableProperty<int32_t>* >( entry.GetSceneGraphProperty() );
+        DALI_ASSERT_DEBUG( property );
 
         value = (*property)[ bufferIndex ];
         break;
@@ -1263,7 +1322,7 @@ Property::Value Object::GetCurrentPropertyValue( const PropertyMetadata& entry )
       case Property::FLOAT:
       {
         const AnimatableProperty<float>* property = static_cast< const AnimatableProperty<float>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+        DALI_ASSERT_DEBUG( property );
 
         value = (*property)[ bufferIndex ];
         break;
@@ -1272,7 +1331,7 @@ Property::Value Object::GetCurrentPropertyValue( const PropertyMetadata& entry )
       case Property::VECTOR2:
       {
         const AnimatableProperty<Vector2>* property = static_cast< const AnimatableProperty<Vector2>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+        DALI_ASSERT_DEBUG( property );
 
         if(entry.componentIndex == 0)
         {
@@ -1292,7 +1351,7 @@ Property::Value Object::GetCurrentPropertyValue( const PropertyMetadata& entry )
       case Property::VECTOR3:
       {
         const AnimatableProperty<Vector3>* property = static_cast< const AnimatableProperty<Vector3>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+        DALI_ASSERT_DEBUG( property );
 
         if(entry.componentIndex == 0)
         {
@@ -1316,7 +1375,7 @@ Property::Value Object::GetCurrentPropertyValue( const PropertyMetadata& entry )
       case Property::VECTOR4:
       {
         const AnimatableProperty<Vector4>* property = static_cast< const AnimatableProperty<Vector4>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+        DALI_ASSERT_DEBUG( property );
 
         if(entry.componentIndex == 0)
         {
@@ -1344,7 +1403,7 @@ Property::Value Object::GetCurrentPropertyValue( const PropertyMetadata& entry )
       case Property::MATRIX:
       {
         const AnimatableProperty<Matrix>* property = static_cast< const AnimatableProperty<Matrix>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+        DALI_ASSERT_DEBUG( property );
 
         value = (*property)[ bufferIndex ];
         break;
@@ -1353,7 +1412,7 @@ Property::Value Object::GetCurrentPropertyValue( const PropertyMetadata& entry )
       case Property::MATRIX3:
       {
         const AnimatableProperty<Matrix3>* property = static_cast< const AnimatableProperty<Matrix3>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+        DALI_ASSERT_DEBUG( property );
 
         value = (*property)[ bufferIndex ];
         break;
@@ -1362,7 +1421,7 @@ Property::Value Object::GetCurrentPropertyValue( const PropertyMetadata& entry )
       case Property::ROTATION:
       {
         const AnimatableProperty<Quaternion>* property = static_cast< const AnimatableProperty<Quaternion>* >( entry.GetSceneGraphProperty() );
-        DALI_ASSERT_DEBUG( NULL != property );
+        DALI_ASSERT_DEBUG( property );
 
         value = (*property)[ bufferIndex ];
         break;
@@ -1385,7 +1444,7 @@ void Object::SetSceneGraphProperty( Property::Index index, const PropertyMetadat
     case Property::BOOLEAN:
     {
       const AnimatableProperty<bool>* property = dynamic_cast< const AnimatableProperty<bool>* >( entry.GetSceneGraphProperty() );
-      DALI_ASSERT_DEBUG( NULL != property );
+      DALI_ASSERT_DEBUG( property );
 
       // property is being used in a separate thread; queue a message to set the property
       BakeMessage<bool>( GetEventThreadServices(), *property, value.Get<bool>() );
@@ -1394,18 +1453,18 @@ void Object::SetSceneGraphProperty( Property::Index index, const PropertyMetadat
 
     case Property::INTEGER:
     {
-      const AnimatableProperty<int>* property = dynamic_cast< const AnimatableProperty<int>* >( entry.GetSceneGraphProperty() );
-      DALI_ASSERT_DEBUG( NULL != property );
+      const AnimatableProperty<int32_t>* property = dynamic_cast< const AnimatableProperty<int32_t>* >( entry.GetSceneGraphProperty() );
+      DALI_ASSERT_DEBUG( property );
 
       // property is being used in a separate thread; queue a message to set the property
-      BakeMessage<int>( GetEventThreadServices(), *property, value.Get<int>() );
+      BakeMessage<int32_t>( GetEventThreadServices(), *property, value.Get<int32_t>() );
       break;
     }
 
     case Property::FLOAT:
     {
       const AnimatableProperty<float>* property = dynamic_cast< const AnimatableProperty<float>* >( entry.GetSceneGraphProperty() );
-      DALI_ASSERT_DEBUG( NULL != property );
+      DALI_ASSERT_DEBUG( property );
 
       // property is being used in a separate thread; queue a message to set the property
       BakeMessage<float>( GetEventThreadServices(), *property, value.Get<float>() );
@@ -1415,7 +1474,7 @@ void Object::SetSceneGraphProperty( Property::Index index, const PropertyMetadat
     case Property::VECTOR2:
     {
       const AnimatableProperty<Vector2>* property = dynamic_cast< const AnimatableProperty<Vector2>* >( entry.GetSceneGraphProperty() );
-      DALI_ASSERT_DEBUG( NULL != property );
+      DALI_ASSERT_DEBUG( property );
 
       // property is being used in a separate thread; queue a message to set the property
       if(entry.componentIndex == 0)
@@ -1436,7 +1495,7 @@ void Object::SetSceneGraphProperty( Property::Index index, const PropertyMetadat
     case Property::VECTOR3:
     {
       const AnimatableProperty<Vector3>* property = dynamic_cast< const AnimatableProperty<Vector3>* >( entry.GetSceneGraphProperty() );
-      DALI_ASSERT_DEBUG( NULL != property );
+      DALI_ASSERT_DEBUG( property );
 
       // property is being used in a separate thread; queue a message to set the property
       if(entry.componentIndex == 0)
@@ -1462,7 +1521,7 @@ void Object::SetSceneGraphProperty( Property::Index index, const PropertyMetadat
     case Property::VECTOR4:
     {
       const AnimatableProperty<Vector4>* property = dynamic_cast< const AnimatableProperty<Vector4>* >( entry.GetSceneGraphProperty() );
-      DALI_ASSERT_DEBUG( NULL != property );
+      DALI_ASSERT_DEBUG( property );
 
       // property is being used in a separate thread; queue a message to set the property
       if(entry.componentIndex == 0)
@@ -1491,7 +1550,7 @@ void Object::SetSceneGraphProperty( Property::Index index, const PropertyMetadat
     case Property::ROTATION:
     {
       const AnimatableProperty<Quaternion>* property = dynamic_cast< const AnimatableProperty<Quaternion>* >( entry.GetSceneGraphProperty() );
-      DALI_ASSERT_DEBUG( NULL != property );
+      DALI_ASSERT_DEBUG( property );
 
       // property is being used in a separate thread; queue a message to set the property
       BakeMessage<Quaternion>( GetEventThreadServices(), *property, value.Get<Quaternion>() );
@@ -1501,7 +1560,7 @@ void Object::SetSceneGraphProperty( Property::Index index, const PropertyMetadat
     case Property::MATRIX:
     {
       const AnimatableProperty<Matrix>* property = dynamic_cast< const AnimatableProperty<Matrix>* >( entry.GetSceneGraphProperty() );
-      DALI_ASSERT_DEBUG( NULL != property );
+      DALI_ASSERT_DEBUG( property );
 
       // property is being used in a separate thread; queue a message to set the property
       BakeMessage<Matrix>( GetEventThreadServices(), *property, value.Get<Matrix>() );
@@ -1511,7 +1570,7 @@ void Object::SetSceneGraphProperty( Property::Index index, const PropertyMetadat
     case Property::MATRIX3:
     {
       const AnimatableProperty<Matrix3>* property = dynamic_cast< const AnimatableProperty<Matrix3>* >( entry.GetSceneGraphProperty() );
-      DALI_ASSERT_DEBUG( NULL != property );
+      DALI_ASSERT_DEBUG( property );
 
       // property is being used in a separate thread; queue a message to set the property
       BakeMessage<Matrix3>( GetEventThreadServices(), *property, value.Get<Matrix3>() );
index 889d589..ac62d37 100644 (file)
@@ -59,10 +59,9 @@ class PropertyBase;
 class PropertyOwner;
 }
 
-typedef std::vector< Dali::Constraint >     ConstraintContainer;
-typedef ConstraintContainer::iterator       ConstraintIter;
-typedef ConstraintContainer::const_iterator ConstraintConstIter;
-
+using ConstraintContainer = std::vector< Dali::Constraint >;
+using ConstraintIter = ConstraintContainer::iterator;
+using ConstraintConstIter = ConstraintContainer::const_iterator;
 
 /**
  * A base class for objects which optionally provide properties.
@@ -72,19 +71,15 @@ typedef ConstraintContainer::const_iterator ConstraintConstIter;
  * An object for a property-owning object in the scene-graph.
  * This provides an interface for observing the addition/removal of scene-objects.
  *
- * The concrete derived class is responsible for:
- *   1) Adding & removing an object from the scene-graph. The OnSceneObjectAdd() and OnSceneObjectRemove()
- *      methods should be called by the derived class, to trigger observer callbacks.
- *   3) Implementing the GetSceneObject() methods, used to access the scene-object.
- *   4) Providing access to properties stored by the scene-graph object. These should match the properties
- *      reported by the base Dali::Internal::Object methods.
- *
+ * The derived class should either:
+ *   a) Create their own scene-graph object and pass it to Object constructor.
+ *   b) pass nullptr to Object constructor, in this case Object will create default scene object for property handling
  */
 class Object : public Dali::BaseObject
 {
 public:
 
-  typedef Dali::Handle::Capability Capability;
+  using Capability = Dali::Handle::Capability;
 
   class Observer
   {
@@ -117,9 +112,11 @@ public:
   };
 
   /**
-   * Constructor.
+   * Creates a new object
+   *
+   * @return an smart pointer to the object
    */
-  Object();
+  static IntrusivePtr<Object> New();
 
   /**
    * Add an observer to the object.
@@ -268,14 +265,17 @@ public:
   /******************************** Uniform Mappings ********************************/
 
   /**
-   * @copydoc Dali::Handle::AddUniformMapping()
+   * Adds uniform mapping for given property
+   * @param propertyIndex index of the property
+   * @param uniformName name of the uniform (same as property name)
    */
   void AddUniformMapping( Property::Index propertyIndex, const std::string& uniformName ) const;
 
   /**
-   * @copydoc Dali::Handle::RemoveUniformMapping( )
+   * Removes uniform mapping for given property
+   * @param uniformName name of the uniform (same as property name)
    */
-  void RemoveUniformMapping( const std::string& uniformName );
+  void RemoveUniformMapping( const std::string& uniformName ) const;
 
   /******************************** Constraints ********************************/
 
@@ -315,13 +315,13 @@ public:
     return PROPERTY_CUSTOM_START_INDEX;
   }
 
-  /********************  To be overridden by deriving classes ********************/
-
   /**
    * Retrieve the scene-graph object added by this object.
-   * @return A pointer to the object, or NULL if no object has been added to the scene-graph.
+   * @return reference to the scene-graph object, it will always exist
    */
-  virtual const SceneGraph::PropertyOwner* GetSceneObject() const = 0;
+  const SceneGraph::PropertyOwner& GetSceneObject() const;
+
+  /********************  Can be overridden by deriving classes ********************/
 
   /**
    * Retrieve an animatable property owned by the scene-graph object.
@@ -329,7 +329,7 @@ public:
    * @param[in] index The index of the property.
    * @return A dereferenceable pointer to a property, or NULL if a scene-object does not exist with this property.
    */
-  virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const = 0;
+  virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
 
   /**
    * Retrieve a constraint input-property owned by the scene-graph object.
@@ -337,7 +337,7 @@ public:
    * @param[in] index The index of the property.
    * @return A dereferenceable pointer to an input property, or NULL if a scene-object does not exist with this property.
    */
-  virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const = 0;
+  virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
 
   /**
    * Query whether the property is a component of a scene-graph property.
@@ -355,6 +355,13 @@ public:
 protected:
 
   /**
+   * Constructor. Protected so use New to construct an instance of this class
+   *
+   * @param sceneObject the scene graph property owner
+   */
+  Object( const SceneGraph::PropertyOwner* sceneObject );
+
+  /**
    * A reference counted object may only be deleted by calling Unreference()
    */
   virtual ~Object();
@@ -375,7 +382,7 @@ protected:
   virtual Object* GetParentObject() const
   {
     // By default the Object does not have a parent
-    return NULL;
+    return nullptr;
   };
 
   /**
@@ -415,7 +422,7 @@ protected:
    * @param [in] value The value of the property.
    * @return The index of the registered property or Property::INVALID_INDEX if registration failed.
    */
-  Property::Index RegisterSceneGraphProperty(const std::string& name, Property::Index key, Property::Index index, const Property::Value& propertyValue) const;
+  Property::Index RegisterSceneGraphProperty( const std::string& name, Property::Index key, Property::Index index, const Property::Value& propertyValue ) const;
 
   /**
    * Registers animatable scene property
@@ -446,21 +453,21 @@ private: // Default property extensions for derived classes
    * @param [in] index The index of the property.
    * @param [in] propertyValue The new value of the property.
    */
-  virtual void SetDefaultProperty( Property::Index index, const Property::Value& propertyValue ) = 0;
+  virtual void SetDefaultProperty( Property::Index index, const Property::Value& propertyValue );
 
   /**
    * Retrieve a default property value.
    * @param [in] index The index of the property.
    * @return The property value.
    */
-  virtual Property::Value GetDefaultProperty( Property::Index index ) const = 0;
+  virtual Property::Value GetDefaultProperty( Property::Index index ) const;
 
   /**
    * Retrieve the latest scene-graph value of a default property.
    * @param[in] index The index of the property.
    * @return The latest scene-graph value of a default property.
    */
-  virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const = 0;
+  virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
 
   /**
    * Notifies that a default property is being animated so the deriving class should update the cached value.
@@ -472,19 +479,10 @@ private: // Default property extensions for derived classes
   virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type propertyChangeType )
   { }
 
-  /**
-   * @todo this is virtual so that for now actor can override it,
-   * it needs to be removed and only have GetSceneObject but that requires changing actor and constraint logic
-   * Retrieve the scene-graph object added by this object.
-   * @return A pointer to the object, or NULL if no object has been added to the scene-graph.
-   */
-  virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const
-  {
-    return GetSceneObject();
-  }
-
 private:
 
+  // no default, copy or assignment
+  Object() = delete;
   Object(const Object& rhs) = delete;
   Object& operator=(const Object& rhs) = delete;
 
@@ -544,18 +542,26 @@ private:
 
   EventThreadServices& mEventThreadServices;
 
+protected:
+
+  // mutable because it's lazy initialised and GetSceneObject has to be const so it can be called from const methods
+  // const to prevent accidentally calling setters directly from event thread
+  // protected to allow fast access from derived classes that have their own scene object (no function call overhead)
+  mutable const SceneGraph::PropertyOwner* mUpdateObject; ///< Reference to object to hold the scene graph properties
+
 private:
 
   Dali::Vector<Observer*> mObservers;
   mutable OwnerContainer<PropertyMetadata*> mCustomProperties; ///< Used for accessing custom Node properties
   mutable OwnerContainer<PropertyMetadata*> mAnimatableProperties; ///< Used for accessing animatable Node properties
-  mutable TypeInfo const * mTypeInfo; ///< The type-info for this object, mutable so it can be lazy initialized from const method if it is required
+  mutable const TypeInfo* mTypeInfo; ///< The type-info for this object, mutable so it can be lazy initialized from const method if it is required
 
   ConstraintContainer* mConstraints;               ///< Container of owned -constraints.
 
   using PropertyNotificationContainer = std::vector< Dali::PropertyNotification >;
   PropertyNotificationContainer* mPropertyNotifications; ///< Container of owned property notifications.
   DevelHandle::PropertySetSignalType mPropertySetSignal;
+
 };
 
 } // namespace Internal
index 8f2f43f..aa4d607 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -66,7 +66,7 @@ void PropertyMetadata::SetPropertyValue( const Property::Value& propertyValue )
 
     case Property::RECTANGLE:
     {
-      Rect<int> convertedValue;
+      Rect<int32_t> convertedValue;
       if( propertyValue.Get( convertedValue ) )
       {
         value = convertedValue;
@@ -126,7 +126,7 @@ void PropertyMetadata::SetPropertyValue( const Property::Value& propertyValue )
 
     case Property::INTEGER:
     {
-      int convertedValue;
+      int32_t convertedValue;
       if( propertyValue.Get( convertedValue ) )
       {
         value = convertedValue;
index 09b62ab..a058ed7 100644 (file)
@@ -168,9 +168,9 @@ public: // Data
   /**
    * @brief The value of this property used to read/write by the event thread.
    *
-   * If a component index, then refers to the value in the PropertyMetatdata of the base property
+   * If this PropertyMetadata is for property component, then refers to the value in the PropertyMetadata of the base property
    * to ensure the components are kept in sync with the overall value on the event thread.
-   * Otherwise, this just refers to the storedValue.
+   * Otherwise, this refers to mStoredValue.
    */
   Property::Value& value;
 
@@ -181,7 +181,7 @@ public: // Data
 
 private:
 
-  Property::Value mStoredValue;                         ///< The stored property value used to read/write by the event thread
+  Property::Value mStoredValue;                         ///< The cached property value used to read/write by the event thread
   const SceneGraph::PropertyBase* mSceneGraphProperty;  ///< A pointer to a scene-graph property; should not be modified from actor-thread
   bool mWritable:1;                                     ///< Whether the property is writable
 };
index f119eda..a261fa2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -109,13 +109,8 @@ PropertyNotification::PropertyNotification( UpdateManager& updateManager,
       }
     }
 
-    // Check if target scene-object already present, and if so create our notification
-    // scene-object
-    const SceneGraph::PropertyOwner* object = mObject->GetSceneObject();
-    if (object)
-    {
-      CreateSceneObject();
-    }
+    // all objects always have scene object
+    CreateSceneObject();
   }
 
   // Connect to the property notification manager
index d8fcdb6..b7d6496 100644 (file)
@@ -237,11 +237,11 @@ void Stage::SurfaceResized( float width, float height )
     // if single render task to screen then set its viewport parameters
     if( 1 == mRenderTaskList->GetTaskCount() )
     {
-      Dali::RenderTask defaultRenderTask = mRenderTaskList->GetTask( 0u );
+      RenderTaskPtr defaultRenderTask = mRenderTaskList->GetTask( 0u );
 
-      if(!defaultRenderTask.GetTargetFrameBuffer())
+      if(!defaultRenderTask->GetTargetFrameBuffer())
       {
-        defaultRenderTask.SetViewport( Viewport( 0, 0, static_cast<int32_t>( width ), static_cast<int32_t>( height ) ) ); // truncated
+        defaultRenderTask->SetViewport( Viewport( 0, 0, static_cast<int32_t>( width ), static_cast<int32_t>( height ) ) ); // truncated
       }
     }
 
@@ -251,8 +251,8 @@ void Stage::SurfaceResized( float width, float height )
       Dali::Texture texture = Dali::Texture::New( Dali::TextureType::TEXTURE_2D, Dali::Pixel::RGB888, static_cast<uint32_t>( width ), static_cast<uint32_t>( height ) );
       frameBuffer.AttachColorTexture( texture );
 
-      Dali::RenderTask defaultRenderTask = mRenderTaskList->GetTask( 0u );
-      defaultRenderTask.SetFrameBuffer( frameBuffer );
+      RenderTaskPtr defaultRenderTask = mRenderTaskList->GetTask( 0u );
+      defaultRenderTask->SetFrameBuffer( &GetImplementation( frameBuffer ) );
     }
   }
 }
index fe1fd20..04249a8 100644 (file)
@@ -677,7 +677,7 @@ Property::Index TypeInfo::GetBasePropertyIndex( Property::Index index ) const
   return basePropertyIndex;
 }
 
-int TypeInfo::GetComponentIndex( Property::Index index ) const
+int32_t TypeInfo::GetComponentIndex( Property::Index index ) const
 {
   int componentIndex = Property::INVALID_COMPONENT_INDEX;
 
index fd2c395..f1cd4e7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -34,9 +34,10 @@ namespace Dali
 namespace Internal
 {
 
-GestureDetector::GestureDetector(Gesture::Type type)
-: mType(type),
-  mGestureEventProcessor(ThreadLocalStorage::Get().GetGestureEventProcessor())
+GestureDetector::GestureDetector(Gesture::Type type, const SceneGraph::PropertyOwner* sceneObject )
+: Object( sceneObject ),
+  mType( type ),
+  mGestureEventProcessor( ThreadLocalStorage::Get().GetGestureEventProcessor() )
 {
 }
 
@@ -196,36 +197,6 @@ void GestureDetector::ObjectDestroyed(Object& object)
   }
 }
 
-void GestureDetector::SetDefaultProperty( Property::Index index, const Property::Value& property )
-{
-  // None of our properties should be settable from Public API
-}
-
-Property::Value GestureDetector::GetDefaultProperty(Property::Index index) const
-{
-  return Property::Value();
-}
-
-Property::Value GestureDetector::GetDefaultPropertyCurrentValue( Property::Index index ) const
-{
-  return Property::Value();
-}
-
-const SceneGraph::PropertyOwner* GestureDetector::GetSceneObject() const
-{
-  return NULL;
-}
-
-const SceneGraph::PropertyBase* GestureDetector::GetSceneObjectAnimatableProperty( Property::Index index ) const
-{
-  return NULL;
-}
-
-const PropertyInputImpl* GestureDetector::GetSceneObjectInputProperty( Property::Index index ) const
-{
-  return NULL;
-}
-
 } // namespace Internal
 
 } // namespace Dali
index d18e4cb..f3fc8d5 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_GESTURE_DETECTOR_H__
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -114,8 +114,11 @@ protected: // Creation & Destruction
 
   /**
    * Construct a new GestureDetector.
+   * @param type the type of gesture
+   * @param pointer to the scene object, nullptr if none
+   * by default GestureDetectors don't have our own scene object
    */
-  GestureDetector(Gesture::Type mType);
+  GestureDetector(Gesture::Type type, const SceneGraph::PropertyOwner* sceneObject  = nullptr );
 
   /**
    * A reference counted object may only be deleted by calling Unreference()
@@ -125,10 +128,9 @@ protected: // Creation & Destruction
 private:
 
   // Undefined
-  GestureDetector(const GestureDetector&);
-
-  // Undefined
-  GestureDetector& operator=(const GestureDetector& rhs);
+  GestureDetector() = delete;
+  GestureDetector(const GestureDetector&) = delete;
+  GestureDetector& operator=(const GestureDetector& rhs) = delete;
 
   /**
    * @copydoc Dali::Internal::Object::Observer::SceneObjectAdded()
@@ -165,38 +167,6 @@ private:
    */
   virtual void OnActorDestroyed(Object& object) = 0;
 
-private: // Default property extensions from Object
-
-  /**
-   * @copydoc Dali::Internal::Object::SetDefaultProperty()
-   */
-  virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
-
-  /**
-   * @copydoc Dali::Internal::Object::GetDefaultProperty()
-   */
-  virtual Property::Value GetDefaultProperty( Property::Index index ) const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
-   */
-  virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObject()
-   */
-  virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
-   */
-  virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
-   */
-  virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
-
 protected:
 
   Gesture::Type                 mType;                  ///< The gesture detector will detect this type of gesture.
index 2d91ac2..456cbc9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -305,6 +305,10 @@ void GestureEventProcessor::SetPanGestureMultitapSmoothingRange( int value )
   mPanGestureProcessor.SetMultitapSmoothingRange( value );
 }
 
+const PanGestureProcessor& GestureEventProcessor::GetPanGestureProcessor()
+{
+  return mPanGestureProcessor;
+}
 
 } // namespace Internal
 
index 060fe00..9f2b859 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_GESTURE_EVENT_PROCESSOR_H__
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -237,6 +237,13 @@ public: // Called by Core
    */
   void SetPanGestureMultitapSmoothingRange( int value );
 
+public: // needed for PanGesture
+
+  /**
+   * @return the pan gesture processor
+   */
+  const PanGestureProcessor& GetPanGestureProcessor();
+
 private:
 
   // Undefined
index 6c8c8af..d05d16b 100644 (file)
@@ -507,7 +507,7 @@ bool HitTestRenderTask( const Vector< RenderTaskList::Exclusive >& exclusives,
 
         if( hit.actor )
         {
-          results.renderTask = Dali::RenderTask( &renderTask );
+          results.renderTask = RenderTaskPtr( &renderTask );
           results.actor = Dali::Actor( hit.actor );
           results.actorCoordinates = hit.hitPosition;
 
@@ -549,8 +549,8 @@ bool HitTestRenderTaskList( Stage& stage,
 
   for( RenderTaskList::RenderTaskContainer::reverse_iterator iter = tasks.rbegin(); endIter != iter; ++iter )
   {
-    RenderTask& renderTask = GetImplementation( *iter );
-    bool isOffscreenRenderTask = ( iter->GetTargetFrameBuffer() || iter->GetFrameBuffer() );
+    RenderTask& renderTask = *iter->Get();
+    bool isOffscreenRenderTask = ( renderTask.GetTargetFrameBuffer() || renderTask.GetFrameBuffer() );
     if( (onScreen && isOffscreenRenderTask) || (!onScreen && !isOffscreenRenderTask) )
     {
       // Skip to next task
index bfe9cb0..a160bc9 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_HIT_TEST_ALGORITHM_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,8 +19,9 @@
  */
 
 // INTERNAL INCLUDES
+#include <dali/public-api/actors/actor.h>
 #include <dali/devel-api/events/hit-test-algorithm.h>
-#include <dali/public-api/render-tasks/render-task.h>
+#include <dali/internal/event/render-tasks/render-task-impl.h>
 
 namespace Dali
 {
@@ -38,11 +39,11 @@ namespace HitTestAlgorithm
 
 struct Results
 {
-  Dali::RenderTask renderTask;       ///< The render-task displaying the actor.
-  Dali::Actor      actor;            ///< The hit actor.
-  Vector2          actorCoordinates; ///< The actor coordinates.
-  Vector4          rayOrigin;        ///< The point of origin of the ray.
-  Vector4          rayDirection;     ///< The direction vector of the ray.
+  RenderTaskPtr renderTask;       ///< The render-task displaying the actor.
+  Dali::Actor   actor;            ///< The hit actor.
+  Vector2       actorCoordinates; ///< The actor coordinates.
+  Vector4       rayOrigin;        ///< The point of origin of the ray.
+  Vector4       rayDirection;     ///< The direction vector of the ray.
 };
 
 /**
index a19da0f..2ddd84a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -229,7 +229,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
   DALI_LOG_INFO( gLogFilter, Debug::Concise, "\n" );
   DALI_LOG_INFO( gLogFilter, Debug::General, "Point(s): %d\n", event.GetPointCount() );
 
-  Dali::RenderTask currentRenderTask;
+  RenderTaskPtr currentRenderTask;
 
   for ( Integration::PointContainerConstIterator iter = event.points.begin(), beginIter = event.points.begin(), endIter = event.points.end(); iter != endIter; ++iter )
   {
@@ -289,7 +289,7 @@ void HoverEventProcessor::ProcessHoverEvent( const Integration::HoverEvent& even
     if ( mLastRenderTask )
     {
       Dali::Actor leaveEventConsumer;
-      RenderTask& lastRenderTaskImpl( GetImplementation( mLastRenderTask ) );
+      RenderTask& lastRenderTaskImpl = *mLastRenderTask.Get();
 
       if( lastPrimaryHitActor &&
           lastPrimaryHitActor != primaryHitActor &&
index d28989e..5cd0308 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_HOVER_EVENT_PROCESSOR_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,8 +19,8 @@
  */
 
 // INTERNAL INCLUDES
-#include <dali/public-api/render-tasks/render-task.h>
 #include <dali/internal/event/events/actor-observer.h>
+#include <dali/internal/event/render-tasks/render-task-impl.h>
 
 namespace Dali
 {
@@ -81,7 +81,7 @@ private:
   ActorObserver mLastPrimaryHitActor; ///< Stores the last primary point hit actor
   ActorObserver mLastConsumedActor; ///< Stores the last consumed actor
   ActorObserver mHoverStartConsumedActor; ///< Stores the hover-start consumed actor
-  Dali::RenderTask mLastRenderTask; ///< The RenderTask used for the last hit actor
+  RenderTaskPtr mLastRenderTask; ///< The RenderTask used for the last hit actor
 };
 
 } // namespace Internal
index d2d2e2e..37be013 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -179,7 +179,7 @@ void LongPressGestureProcessor::Process( const Integration::LongPressGestureEven
           if ( !mCurrentEmitters.empty() )
           {
             Vector2 actorCoords;
-            RenderTask& renderTaskImpl( GetImplementation( mCurrentRenderTask ) );
+            RenderTask& renderTaskImpl = *mCurrentRenderTask.Get();
             currentGesturedActor->ScreenToLocal( renderTaskImpl, actorCoords.x, actorCoords.y, longPressEvent.point.x, longPressEvent.point.y );
 
             EmitLongPressSignal( currentGesturedActor, mCurrentEmitters, longPressEvent, actorCoords );
index d34f246..e71e4e5 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_LONG_PRESS_GESTURE_EVENT_PROCESSOR_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,9 +19,9 @@
  */
 
 // INTERNAL INCLUDES
-#include <dali/public-api/render-tasks/render-task.h>
 #include <dali/internal/event/events/long-press-gesture-detector-impl.h>
 #include <dali/internal/event/events/gesture-processor.h>
+#include <dali/internal/event/render-tasks/render-task-impl.h>
 
 namespace Dali
 {
@@ -129,10 +129,10 @@ private:
   LongPressGestureDetectorContainer mGestureDetectors;
 
   GestureDetectorContainer mCurrentEmitters;
-  Dali::RenderTask mCurrentRenderTask;
+  RenderTaskPtr mCurrentRenderTask;
 
-  unsigned int mMinTouchesRequired;
-  unsigned int mMaxTouchesRequired;
+  uint32_t mMinTouchesRequired;
+  uint32_t mMaxTouchesRequired;
 
   const Integration::LongPressGestureEvent* mCurrentLongPressEvent; ///< Pointer to current longPressEvent, used when calling ProcessAndEmit()
 };
index d79d2d4..9a970b7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -94,19 +94,8 @@ float GetOppositeAngle( float angle )
 
 PanGestureDetectorPtr PanGestureDetector::New()
 {
-  return new PanGestureDetector;
-}
-
-PanGestureDetector::PanGestureDetector()
-: GestureDetector(Gesture::Pan),
-  mMinimumTouches(1),
-  mMaximumTouches(1),
-  mSceneObject(NULL)
-{
-}
-
-PanGestureDetector::~PanGestureDetector()
-{
+  const SceneGraph::PanGesture& sceneObject = ThreadLocalStorage::Get().GetGestureEventProcessor().GetPanGestureProcessor().GetSceneObject();
+  return new PanGestureDetector( sceneObject );
 }
 
 void PanGestureDetector::SetMinimumTouchesRequired(unsigned int minimum)
@@ -283,11 +272,6 @@ void PanGestureDetector::EmitPanGestureSignal(Dali::Actor actor, const PanGestur
   }
 }
 
-void PanGestureDetector::SetSceneObject( const SceneGraph::PanGesture* object )
-{
-  mSceneObject = object;
-}
-
 bool PanGestureDetector::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
 {
   bool connected( true );
@@ -311,6 +295,22 @@ void PanGestureDetector::SetPanGestureProperties( const PanGesture& pan )
   ThreadLocalStorage::Get().GetGestureEventProcessor().SetGestureProperties( pan );
 }
 
+PanGestureDetector::PanGestureDetector( const SceneGraph::PanGesture& sceneObject )
+: GestureDetector(Gesture::Pan, &sceneObject ),
+  mMinimumTouches(1),
+  mMaximumTouches(1)
+{
+}
+
+PanGestureDetector::~PanGestureDetector()
+{
+}
+
+const SceneGraph::PanGesture& PanGestureDetector::GetPanGestureSceneObject() const
+{
+  return static_cast<const SceneGraph::PanGesture&>( GetSceneObject() );
+}
+
 void PanGestureDetector::OnActorAttach(Actor& actor)
 {
   // Do nothing
@@ -336,7 +336,7 @@ Property::Value PanGestureDetector::GetDefaultProperty( Property::Index index )
   return GetDefaultPropertyCurrentValue( index ); // Scene-graph only properties
 }
 
-Property::Value PanGestureDetector::GetDefaultPropertyCurrentValue(Property::Index index) const
+Property::Value PanGestureDetector::GetDefaultPropertyCurrentValue( Property::Index index ) const
 {
   Property::Value value;
 
@@ -344,92 +344,43 @@ Property::Value PanGestureDetector::GetDefaultPropertyCurrentValue(Property::Ind
   {
     case Dali::PanGestureDetector::Property::SCREEN_POSITION:
     {
-      if(mSceneObject)
-      {
-        value = mSceneObject->GetScreenPositionProperty().Get();
-      }
-      else
-      {
-        value = Vector2();
-      }
+      value = GetPanGestureSceneObject().GetScreenPositionProperty().Get();
       break;
     }
 
     case Dali::PanGestureDetector::Property::SCREEN_DISPLACEMENT:
     {
-      if(mSceneObject)
-      {
-        value = mSceneObject->GetScreenDisplacementProperty().Get();
-      }
-      else
-      {
-        value = Vector2();
-      }
+      value = GetPanGestureSceneObject().GetScreenDisplacementProperty().Get();
       break;
     }
 
     case Dali::PanGestureDetector::Property::SCREEN_VELOCITY:
     {
-      if(mSceneObject)
-      {
-        value = mSceneObject->GetScreenVelocityProperty().Get();
-      }
-      else
-      {
-        value = Vector2();
-      }
+      value = GetPanGestureSceneObject().GetScreenVelocityProperty().Get();
       break;
     }
 
     case Dali::PanGestureDetector::Property::LOCAL_POSITION:
     {
-      if(mSceneObject)
-      {
-        value = mSceneObject->GetLocalPositionProperty().Get();
-      }
-      else
-      {
-        value = Vector2();
-      }
+      value = GetPanGestureSceneObject().GetLocalPositionProperty().Get();
       break;
     }
 
     case Dali::PanGestureDetector::Property::LOCAL_DISPLACEMENT:
     {
-      if(mSceneObject)
-      {
-        value = mSceneObject->GetLocalDisplacementProperty().Get();
-      }
-      else
-      {
-        value = Vector2();
-      }
+      value = GetPanGestureSceneObject().GetLocalDisplacementProperty().Get();
       break;
     }
 
     case Dali::PanGestureDetector::Property::LOCAL_VELOCITY:
     {
-      if(mSceneObject)
-      {
-        value = mSceneObject->GetLocalVelocityProperty().Get();
-      }
-      else
-      {
-        value = Vector2();
-      }
+      value = GetPanGestureSceneObject().GetLocalVelocityProperty().Get();
       break;
     }
 
     case Dali::PanGestureDetector::Property::PANNING:
     {
-      if(mSceneObject)
-      {
-        value = mSceneObject->GetPanningProperty().Get();
-      }
-      else
-      {
-        value = false;
-      }
+      value = GetPanGestureSceneObject().GetPanningProperty().Get();
       break;
     }
 
@@ -443,86 +394,61 @@ Property::Value PanGestureDetector::GetDefaultPropertyCurrentValue(Property::Ind
   return value;
 }
 
-const SceneGraph::PropertyOwner* PanGestureDetector::GetSceneObject() const
-{
-  // This method should only return an object connected to the scene-graph
-  return mSceneObject;
-}
-
-const SceneGraph::PropertyBase* PanGestureDetector::GetSceneObjectAnimatableProperty( Property::Index index ) const
-{
-  DALI_ASSERT_ALWAYS( IsPropertyAnimatable(index) && "Property is not animatable" );
-
-  // None of our properties are animatable
-  return NULL;
-}
-
 const PropertyInputImpl* PanGestureDetector::GetSceneObjectInputProperty( Property::Index index ) const
 {
-  const PropertyInputImpl* property( NULL );
-
-  // This method should only return a property of an object connected to the scene-graph
-  if ( !mSceneObject )
-  {
-    return property;
-  }
+  const PropertyInputImpl* property = nullptr;
 
-  if ( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties
-       ( index <= PROPERTY_CUSTOM_MAX_INDEX ) )
-  {
-    CustomPropertyMetadata* custom = FindCustomProperty( index );
-    DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
-    property = custom->GetSceneGraphProperty();
-  }
-  else
+  switch ( index )
   {
-    switch ( index )
+    case Dali::PanGestureDetector::Property::SCREEN_POSITION:
     {
-      case Dali::PanGestureDetector::Property::SCREEN_POSITION:
-      {
-        property = &mSceneObject->GetScreenPositionProperty();
-        break;
-      }
-
-      case Dali::PanGestureDetector::Property::SCREEN_DISPLACEMENT:
-      {
-        property = &mSceneObject->GetScreenDisplacementProperty();
-        break;
-      }
+      property = &GetPanGestureSceneObject().GetScreenPositionProperty();
+      break;
+    }
 
-      case Dali::PanGestureDetector::Property::SCREEN_VELOCITY:
-      {
-        property = &mSceneObject->GetScreenVelocityProperty();
-        break;
-      }
+    case Dali::PanGestureDetector::Property::SCREEN_DISPLACEMENT:
+    {
+      property = &GetPanGestureSceneObject().GetScreenDisplacementProperty();
+      break;
+    }
 
-      case Dali::PanGestureDetector::Property::LOCAL_POSITION:
-      {
-        property = &mSceneObject->GetLocalPositionProperty();
-        break;
-      }
+    case Dali::PanGestureDetector::Property::SCREEN_VELOCITY:
+    {
+      property = &GetPanGestureSceneObject().GetScreenVelocityProperty();
+      break;
+    }
 
-      case Dali::PanGestureDetector::Property::LOCAL_DISPLACEMENT:
-      {
-        property = &mSceneObject->GetLocalDisplacementProperty();
-        break;
-      }
+    case Dali::PanGestureDetector::Property::LOCAL_POSITION:
+    {
+      property = &GetPanGestureSceneObject().GetLocalPositionProperty();
+      break;
+    }
 
-      case Dali::PanGestureDetector::Property::LOCAL_VELOCITY:
-      {
-        property = &mSceneObject->GetLocalVelocityProperty();
-        break;
-      }
+    case Dali::PanGestureDetector::Property::LOCAL_DISPLACEMENT:
+    {
+      property = &GetPanGestureSceneObject().GetLocalDisplacementProperty();
+      break;
+    }
 
-      case Dali::PanGestureDetector::Property::PANNING:
-      {
-        property = &mSceneObject->GetPanningProperty();
-        break;
-      }
+    case Dali::PanGestureDetector::Property::LOCAL_VELOCITY:
+    {
+      property = &GetPanGestureSceneObject().GetLocalVelocityProperty();
+      break;
+    }
 
-      default:
-        break;
+    case Dali::PanGestureDetector::Property::PANNING:
+    {
+      property = &GetPanGestureSceneObject().GetPanningProperty();
+      break;
     }
+
+    default:
+      break;
+  }
+  if( !property )
+  {
+    // not our property, ask base
+    property = Object::GetSceneObjectInputProperty( index );
   }
 
   return property;
index dc0eed7..bc130b1 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_PAN_GESTURE_DETECTOR_H__
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -60,11 +60,6 @@ public: // Creation
    */
   static PanGestureDetectorPtr New();
 
-  /**
-   * Construct a new PanGestureDetector.
-   */
-  PanGestureDetector();
-
 public:
 
   /**
@@ -144,12 +139,6 @@ public:
    */
   void EmitPanGestureSignal(Dali::Actor actor, const PanGesture& pan);
 
-  /**
-   * Called by the PanGestureProcessor to set the scene object.
-   * @param[in]  object  The scene object.
-   */
-  void SetSceneObject( const SceneGraph::PanGesture* object );
-
 public: // Signals
 
   /**
@@ -181,6 +170,12 @@ public: // Override Pan Gesture
 protected:
 
   /**
+   * Construct a new PanGestureDetector.
+   * @param sceneObject the scene object
+   */
+  PanGestureDetector( const SceneGraph::PanGesture& sceneObject );
+
+  /**
    * A reference counted object may only be deleted by calling Unreference()
    */
   virtual ~PanGestureDetector();
@@ -188,10 +183,14 @@ protected:
 private:
 
   // Undefined
-  PanGestureDetector(const PanGestureDetector&);
+  PanGestureDetector() = delete;
+  PanGestureDetector(const PanGestureDetector&) = delete;
+  PanGestureDetector& operator=(const PanGestureDetector& rhs) = delete;
 
-  // Undefined
-  PanGestureDetector& operator=(const PanGestureDetector& rhs);
+  /**
+   * @return the pan gesture scene object
+   */
+  const SceneGraph::PanGesture& GetPanGestureSceneObject() const;
 
   // From GestureDetector
 
@@ -229,16 +228,6 @@ private:
   virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
 
   /**
-   * @copydoc Dali::Internal::Object::GetSceneObject()
-   */
-  virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
-   */
-  virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
-
-  /**
    * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
    */
   virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
@@ -252,8 +241,6 @@ private:
 
   AngleContainer mAngleContainer; ///< A container of all angles allowed for pan to occur.
 
-  const SceneGraph::PanGesture* mSceneObject; ///< Not owned
-
 };
 
 } // namespace Internal
index 1762821..d95fe0f 100644 (file)
@@ -195,7 +195,7 @@ void PanGestureProcessor::Process( const Integration::PanGestureEvent& panEvent
 
           if ( !outsideTouchesRangeEmitters.empty() || !mCurrentPanEmitters.empty() )
           {
-            currentGesturedActor->ScreenToLocal( GetImplementation( mCurrentRenderTask ), actorCoords.x, actorCoords.y, panEvent.currentPosition.x, panEvent.currentPosition.y );
+            currentGesturedActor->ScreenToLocal( *mCurrentRenderTask.Get(), actorCoords.x, actorCoords.y, panEvent.currentPosition.x, panEvent.currentPosition.y );
 
             // EmitPanSignal checks whether we have a valid actor and whether the container we are passing in has emitters before it emits the pan.
             EmitPanSignal( currentGesturedActor, outsideTouchesRangeEmitters, panEvent, actorCoords, Gesture::Finished, mCurrentRenderTask);
@@ -238,9 +238,6 @@ void PanGestureProcessor::AddGestureDetector( PanGestureDetector* gestureDetecto
 
   mGestureDetectors.push_back(gestureDetector);
 
-  // Set the pan scene object on the gesture detector
-  gestureDetector->SetSceneObject( mSceneObject );
-
   if (firstRegistration)
   {
     mMinTouchesRequired = gestureDetector->GetMinimumTouchesRequired();
@@ -400,6 +397,11 @@ void PanGestureProcessor::SetMultitapSmoothingRange( int value )
   mSceneObject->SetMultitapSmoothingRange( value );
 }
 
+const SceneGraph::PanGesture& PanGestureProcessor::GetSceneObject() const
+{
+  return *mSceneObject;
+}
+
 void PanGestureProcessor::UpdateDetection()
 {
   DALI_ASSERT_DEBUG(!mGestureDetectors.empty());
@@ -444,7 +446,7 @@ void PanGestureProcessor::EmitPanSignal( Actor* actor,
                                          const Integration::PanGestureEvent& panEvent,
                                          Vector2 localCurrent,
                                          Gesture::State state,
-                                         Dali::RenderTask renderTask )
+                                         RenderTaskPtr renderTask )
 {
   if ( actor && !gestureDetectors.empty() )
   {
@@ -455,7 +457,7 @@ void PanGestureProcessor::EmitPanSignal( Actor* actor,
     pan.screenPosition = panEvent.currentPosition;
     pan.position = localCurrent;
 
-    RenderTask& renderTaskImpl( GetImplementation( renderTask ) );
+    RenderTask& renderTaskImpl( *renderTask.Get() );
 
     Vector2 localPrevious;
     actor->ScreenToLocal( renderTaskImpl, localPrevious.x, localPrevious.y, panEvent.previousPosition.x, panEvent.previousPosition.y );
@@ -530,7 +532,7 @@ bool PanGestureProcessor::CheckGestureDetector( GestureDetector* detector, Actor
     {
       // It does, calculate the angle of the pan in local actor coordinates and ensures it fits
       // the detector's criteria.
-      RenderTask& renderTaskImpl( GetImplementation( mCurrentRenderTask ) );
+      RenderTask& renderTaskImpl = *mCurrentRenderTask.Get();
 
       Vector2 startPosition, currentPosition;
       actor->ScreenToLocal( renderTaskImpl, startPosition.x,   startPosition.y,   mPossiblePanPosition.x,              mPossiblePanPosition.y );
@@ -592,7 +594,7 @@ void PanGestureProcessor::EmitGestureSignal( Actor* actor, const GestureDetector
   mCurrentPanEmitters.clear();
   ResetActor();
 
-  actor->ScreenToLocal( GetImplementation(mCurrentRenderTask), actorCoordinates.x, actorCoordinates.y, mCurrentPanEvent->currentPosition.x, mCurrentPanEvent->currentPosition.y );
+  actor->ScreenToLocal( *mCurrentRenderTask.Get(), actorCoordinates.x, actorCoordinates.y, mCurrentPanEvent->currentPosition.x, mCurrentPanEvent->currentPosition.y );
 
   EmitPanSignal( actor, gestureDetectors, *mCurrentPanEvent, actorCoordinates, mCurrentPanEvent->state, mCurrentRenderTask );
 
index 871e6b4..7940951 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_PAN_GESTURE_EVENT_PROCESSOR_H__
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,9 +19,9 @@
  */
 
 // INTERNAL INCLUDES
-#include <dali/public-api/render-tasks/render-task.h>
 #include <dali/internal/event/events/pan-gesture-detector-impl.h>
 #include <dali/internal/event/events/gesture-processor.h>
+#include <dali/internal/event/render-tasks/render-task-impl.h>
 
 namespace Dali
 {
@@ -226,6 +226,13 @@ public: // To be called by GestureEventProcessor
    */
   void SetMultitapSmoothingRange( int value );
 
+public: // for PanGestureDetector
+
+  /**
+   * @return the pan gesture scene object
+   */
+  const SceneGraph::PanGesture& GetSceneObject() const;
+
 private:
 
   // Undefined
@@ -252,7 +259,7 @@ private:
                       const Integration::PanGestureEvent& panEvent,
                       Vector2 localCurrent,
                       Gesture::State state,
-                      Dali::RenderTask renderTask );
+                      RenderTaskPtr renderTask );
 
   // GestureProcessor overrides
 
@@ -277,11 +284,11 @@ private:
   Integration::GestureManager& mGestureManager;
   PanGestureDetectorContainer mGestureDetectors;
   GestureDetectorContainer mCurrentPanEmitters;
-  Dali::RenderTask mCurrentRenderTask;
+  RenderTaskPtr mCurrentRenderTask;
   Vector2 mPossiblePanPosition;
 
-  unsigned int mMinTouchesRequired;
-  unsigned int mMaxTouchesRequired;
+  uint32_t mMinTouchesRequired;
+  uint32_t mMaxTouchesRequired;
 
   Vector2 mLastVelocity;       ///< The last recorded velocity in local actor coordinates.
   Vector2 mLastScreenVelocity; ///< The last recorded velocity in screen coordinates.
index 6fc7c7c..d893726 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -159,7 +159,7 @@ void PinchGestureProcessor::Process( const Integration::PinchGestureEvent& pinch
           if ( !mCurrentPinchEmitters.empty() )
           {
             Vector2 actorCoords;
-            RenderTask& renderTaskImpl( GetImplementation(mCurrentRenderTask) );
+            RenderTask& renderTaskImpl( *mCurrentRenderTask.Get() );
             currentGesturedActor->ScreenToLocal( renderTaskImpl, actorCoords.x, actorCoords.y, pinchEvent.centerPoint.x, pinchEvent.centerPoint.y );
 
             EmitPinchSignal( currentGesturedActor, mCurrentPinchEmitters, pinchEvent, actorCoords );
index c76259c..9c1928c 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_PINCH_GESTURE_EVENT_PROCESSOR_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,9 +19,9 @@
  */
 
 // INTERNAL INCLUDES
-#include <dali/public-api/render-tasks/render-task.h>
 #include <dali/internal/event/events/pinch-gesture-detector-impl.h>
 #include <dali/internal/event/events/gesture-processor.h>
+#include <dali/internal/event/render-tasks/render-task-impl.h>
 
 namespace Dali
 {
@@ -125,7 +125,7 @@ private:
   Integration::GestureManager& mGestureManager;
   PinchGestureDetectorContainer mGestureDetectors;
   GestureDetectorContainer mCurrentPinchEmitters;
-  Dali::RenderTask mCurrentRenderTask;
+  RenderTaskPtr mCurrentRenderTask;
 
   const Integration::PinchGestureEvent* mCurrentPinchEvent; ///< Pointer to current PinchEvent, used when calling ProcessAndEmit()
 };
index 871d851..90f75ca 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -242,7 +242,7 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even
   DALI_LOG_INFO( gLogFilter, Debug::Concise, "\n" );
   DALI_LOG_INFO( gLogFilter, Debug::General, "Point(s): %d\n", event.GetPointCount() );
 
-  Dali::RenderTask currentRenderTask;
+  RenderTaskPtr currentRenderTask;
 
   for ( Integration::PointContainerConstIterator iter = event.points.begin(), beginIter = event.points.begin(), endIter = event.points.end(); iter != endIter; ++iter )
   {
@@ -302,7 +302,7 @@ void TouchEventProcessor::ProcessTouchEvent( const Integration::TouchEvent& even
     if ( mLastRenderTask )
     {
       Dali::Actor leaveEventConsumer;
-      RenderTask& lastRenderTaskImpl( GetImplementation( mLastRenderTask ) );
+      RenderTask& lastRenderTaskImpl = *mLastRenderTask.Get();
 
       if( lastPrimaryHitActor &&
           lastPrimaryHitActor != primaryHitActor &&
index e0c38b7..9ffa7f2 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_TOUCH_EVENT_PROCESSOR_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,8 +19,8 @@
  */
 
 // INTERNAL INCLUDES
-#include <dali/public-api/render-tasks/render-task.h>
 #include <dali/internal/event/events/actor-observer.h>
+#include <dali/internal/event/render-tasks/render-task-impl.h>
 
 namespace Dali
 {
@@ -91,7 +91,7 @@ private:
   ActorObserver mLastPrimaryHitActor; ///< Stores the last primary point hit actor
   ActorObserver mLastConsumedActor; ///< Stores the last consumed actor
   ActorObserver mTouchDownConsumedActor; ///< Stores the touch-down consumed actor
-  Dali::RenderTask mLastRenderTask; ///< The RenderTask used for the last hit actor
+  RenderTaskPtr mLastRenderTask; ///< The RenderTask used for the last hit actor
 };
 
 } // namespace Internal
diff --git a/dali/internal/event/object/custom-object-internal.cpp b/dali/internal/event/object/custom-object-internal.cpp
deleted file mode 100644 (file)
index 3bd6bca..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/internal/event/object/custom-object-internal.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/event/common/stage-impl.h>
-#include <dali/internal/update/common/animatable-property.h>
-#include <dali/internal/update/common/property-owner.h>
-#include <dali/internal/update/manager/update-manager.h>
-#include <dali/internal/update/animation/scene-graph-constraint-base.h>
-
-using Dali::Internal::SceneGraph::PropertyOwner;
-using Dali::Internal::SceneGraph::PropertyBase;
-using Dali::Internal::SceneGraph::UpdateManager;
-using Dali::Internal::SceneGraph::AnimatableProperty;
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-CustomObject* CustomObject::New()
-{
-  return new CustomObject();
-}
-
-const SceneGraph::PropertyOwner* CustomObject::GetSceneObject() const
-{
-  return mUpdateObject;
-}
-
-const PropertyBase* CustomObject::GetSceneObjectAnimatableProperty( Property::Index index ) const
-{
-  CustomPropertyMetadata* custom = FindCustomProperty( index );
-  DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
-  return custom->GetSceneGraphProperty();
-}
-
-const PropertyInputImpl* CustomObject::GetSceneObjectInputProperty( Property::Index index ) const
-{
-  return GetSceneObjectAnimatableProperty( index );
-}
-
-void CustomObject::SetDefaultProperty( Property::Index index, const Property::Value& property )
-{
-  // do nothing
-}
-
-Property::Value CustomObject::GetDefaultProperty(Property::Index index) const
-{
-  return Property::Value();
-}
-
-Property::Value CustomObject::GetDefaultPropertyCurrentValue( Property::Index index ) const
-{
-  return Property::Value();
-}
-
-CustomObject::~CustomObject()
-{
-  // Guard to allow handle destruction after Core has been destroyed
-  if( Stage::IsInstalled() )
-  {
-    if( NULL != mUpdateObject )
-    {
-      RemoveObjectMessage( GetEventThreadServices().GetUpdateManager(), mUpdateObject );
-      mUpdateObject = NULL; // object is about to be destroyed
-    }
-  }
-}
-
-CustomObject::CustomObject()
-{
-  mUpdateObject = PropertyOwner::New();
-
-  OwnerPointer< PropertyOwner > transferOwnership( mUpdateObject );
-  AddObjectMessage( GetEventThreadServices().GetUpdateManager(), transferOwnership );
-}
-
-} // namespace Internal
-
-} // namespace Dali
diff --git a/dali/internal/event/object/custom-object-internal.h b/dali/internal/event/object/custom-object-internal.h
deleted file mode 100644 (file)
index 22877bd..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-#ifndef __DALI_INTERNAL_CUSTOM_OBJECT_H__
-#define __DALI_INTERNAL_CUSTOM_OBJECT_H__
-
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/internal/event/common/object-impl.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace SceneGraph
-{
-class PropertyOwner;
-}
-
-class CustomObject : public Object
-{
-public:
-
-  /**
-   * Create a new custom object.
-   * @return A pointer to the newly allocated object.
-   */
-  static CustomObject* New();
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObject()
-   */
-  virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
-   */
-  virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
-   */
-  virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
-
-  /**
-   * @copydoc Dali::Internal::Object::SetDefaultProperty()
-   */
-  virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
-
-  /**
-   * @copydoc Dali::Internal::Object::GetDefaultProperty()
-   */
-  virtual Property::Value GetDefaultProperty( Property::Index index ) const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
-   */
-  virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
-
-protected:
-
-  /**
-   * A reference counted object may only be deleted by calling Unreference()
-   */
-  virtual ~CustomObject();
-
-  /**
-   * Private constructor; see also CustomObject::New()
-   */
-  CustomObject();
-
-  // Undefined
-  CustomObject(const CustomObject&);
-
-  // Undefined
-  CustomObject& operator=(const CustomObject& rhs);
-
-protected:
-
-  SceneGraph::PropertyOwner* mUpdateObject;
-};
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_CUSTOM_OBJECT_H__
index a95703f..14bc16b 100644 (file)
@@ -71,26 +71,46 @@ SignalConnectorType signalConnector1( mType, SIGNAL_FINISHED, &RenderTask::DoCon
 
 } // Unnamed namespace
 
-RenderTask* RenderTask::New()
+RenderTaskPtr RenderTask::New( Actor* sourceActor, CameraActor* cameraActor, SceneGraph::RenderTaskList& parentSceneObject )
 {
-  RenderTask* task( new RenderTask() );
+  // create scene object first so it's guaranteed to exist for the event side
+  auto sceneObject = SceneGraph::RenderTask::New();
+  OwnerPointer< SceneGraph::RenderTask > transferOwnership( sceneObject );
+  // pass the pointer to base for message passing
+  RenderTaskPtr task( new RenderTask( sceneObject ) );
+  // transfer scene object ownership to update manager
+  AddTaskMessage( task->GetEventThreadServices(), parentSceneObject, transferOwnership );
 
+  // Set the default source & camera actors
+  task->SetSourceActor( sourceActor );
+  task->SetCameraActor( cameraActor );
+
+  // no need for additional messages as scene objects defaults match ours
   return task;
 }
 
 void RenderTask::SetSourceActor( Actor* actor )
 {
+  mSourceActor = actor;
+  if ( mSourceActor )
+  {
+    SetSourceNodeMessage( GetEventThreadServices(), GetRenderTaskSceneObject(), &mSourceActor->GetNode() );
+  }
+  else
+  {
+    SetSourceNodeMessage( GetEventThreadServices(), GetRenderTaskSceneObject(), nullptr );
+  }
+  // set the actor on exclusive container for hit testing
   const Stage* stage = Stage::GetCurrent();
   if ( stage )
   {
     stage->GetRenderTaskList().SetExclusive( this, mExclusive );
   }
-  mSourceConnector.SetActor( actor );
 }
 
 Actor* RenderTask::GetSourceActor() const
 {
-  return mSourceConnector.mActor;
+  return mSourceActor;
 }
 
 void RenderTask::SetExclusive( bool exclusive )
@@ -105,11 +125,8 @@ void RenderTask::SetExclusive( bool exclusive )
       stage->GetRenderTaskList().SetExclusive( this, exclusive );
     }
 
-    if ( mSceneObject )
-    {
-      // mSceneObject is being used in a separate thread; queue a message to set the value
-      SetExclusiveMessage( GetEventThreadServices(), *mSceneObject, mExclusive );
-    }
+    // scene object is being used in a separate thread; queue a message to set the value
+    SetExclusiveMessage( GetEventThreadServices(), GetRenderTaskSceneObject(), mExclusive );
   }
 }
 
@@ -130,21 +147,20 @@ bool RenderTask::GetInputEnabled() const
 
 void RenderTask::SetCameraActor( CameraActor* cameraActor )
 {
-  if( cameraActor )
+  mCameraActor = cameraActor;
+  if( mCameraActor )
   {
-    mCameraConnector.mCamera = cameraActor->GetCamera();
+    SetCameraMessage( GetEventThreadServices(), GetRenderTaskSceneObject(), &mCameraActor->GetNode(), mCameraActor->GetCamera() );
   }
   else
   {
-    mCameraConnector.mCamera = NULL;
+    SetCameraMessage( GetEventThreadServices(), GetRenderTaskSceneObject(), nullptr, nullptr );
   }
-  mCameraConnector.SetActor( cameraActor );
 }
 
 CameraActor* RenderTask::GetCameraActor() const
 {
-  // camera connector can only point to camera actor
-  return static_cast< CameraActor* >( mCameraConnector.mActor );
+  return mCameraActor;
 }
 
 void RenderTask::SetTargetFrameBuffer( FrameBufferImagePtr image )
@@ -168,7 +184,7 @@ void RenderTask::SetFrameBuffer( FrameBufferPtr frameBuffer )
     renderFrameBufferPtr = mFrameBuffer->GetRenderObject();
   }
 
-  SetFrameBufferMessage( GetEventThreadServices(), *mSceneObject, renderFrameBufferPtr );
+  SetFrameBufferMessage( GetEventThreadServices(), GetRenderTaskSceneObject(), renderFrameBufferPtr );
 }
 
 FrameBuffer* RenderTask::GetFrameBuffer() const
@@ -191,38 +207,38 @@ RenderTask::ScreenToFrameBufferFunction RenderTask::GetScreenToFrameBufferFuncti
   return mScreenToFrameBufferFunction;
 }
 
-void RenderTask::SetScreenToFrameBufferMappingActor( Actor* mappingActor )
+void RenderTask::SetScreenToFrameBufferMappingActor( Dali::Actor& mappingActor )
 {
-  mMappingConnector.SetActor( mappingActor );
+  mInputMappingActor = WeakHandle<Dali::Actor>( mappingActor );
 }
 
-Actor* RenderTask::GetScreenToFrameBufferMappingActor() const
+Dali::Actor RenderTask::GetScreenToFrameBufferMappingActor() const
 {
-  return mMappingConnector.mActor;
+  return mInputMappingActor.GetHandle();
 }
 
 void RenderTask::SetViewportPosition(const Vector2& value)
 {
   mViewportPosition = value;
 
-  BakeViewportPositionMessage( GetEventThreadServices(), *mSceneObject, value );
+  BakeViewportPositionMessage( GetEventThreadServices(), GetRenderTaskSceneObject(), value );
 }
 
 Vector2 RenderTask::GetCurrentViewportPosition() const
 {
-  return mSceneObject->GetViewportPosition( GetEventThreadServices().GetEventBufferIndex() );
+  return GetRenderTaskSceneObject().GetViewportPosition( GetEventThreadServices().GetEventBufferIndex() );
 }
 
 void RenderTask::SetViewportSize(const Vector2& value)
 {
   mViewportSize = value;
 
-  BakeViewportSizeMessage( GetEventThreadServices(), *mSceneObject, value );
+  BakeViewportSizeMessage( GetEventThreadServices(), GetRenderTaskSceneObject(), value );
 }
 
 Vector2 RenderTask::GetCurrentViewportSize() const
 {
-  return mSceneObject->GetViewportSize( GetEventThreadServices().GetEventBufferIndex() );
+  return GetRenderTaskSceneObject().GetViewportSize( GetEventThreadServices().GetEventBufferIndex() );
 }
 
 void RenderTask::SetViewport( const Viewport& viewport )
@@ -235,7 +251,7 @@ void RenderTask::GetViewport( Viewport& viewPort ) const
 {
   BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex();
 
-  if(!mSceneObject->GetViewportEnabled( bufferIndex ))
+  if( !GetRenderTaskSceneObject().GetViewportEnabled( bufferIndex ) )
   {
     if ( mFrameBufferImage )
     {
@@ -257,8 +273,8 @@ void RenderTask::GetViewport( Viewport& viewPort ) const
   }
   else
   {
-    const Vector2& position = mSceneObject->GetViewportPosition(bufferIndex);
-    const Vector2& size = mSceneObject->GetViewportSize(bufferIndex);
+    const Vector2& position = GetRenderTaskSceneObject().GetViewportPosition(bufferIndex);
+    const Vector2& size = GetRenderTaskSceneObject().GetViewportSize(bufferIndex);
     viewPort.x = static_cast<int32_t>( position.x ); // truncated
     viewPort.y = static_cast<int32_t>( position.y ); // truncated
     viewPort.width = static_cast<int32_t>( size.width ); // truncated
@@ -272,17 +288,14 @@ void RenderTask::SetClearColor( const Vector4& color )
   {
     mClearColor = color;
 
-    if ( mSceneObject )
-    {
-      // mSceneObject is being used in a separate thread; queue a message to set the value
-      BakeClearColorMessage( GetEventThreadServices(), *mSceneObject, color );
-    }
+    // scene object is being used in a separate thread; queue a message to set the value
+    BakeClearColorMessage( GetEventThreadServices(), GetRenderTaskSceneObject(), color );
   }
 }
 
 const Vector4& RenderTask::GetClearColor() const
 {
-  return mSceneObject->GetClearColor( GetEventThreadServices().GetEventBufferIndex() );
+  return GetRenderTaskSceneObject().GetClearColor( GetEventThreadServices().GetEventBufferIndex() );
 }
 
 void RenderTask::SetSyncRequired( bool requiresSync )
@@ -291,11 +304,8 @@ void RenderTask::SetSyncRequired( bool requiresSync )
   {
     mRequiresSync = requiresSync;
 
-    if( mSceneObject )
-    {
-      // mSceneObject is being used in a separate thread; queue a message to set the value
-      SetSyncRequiredMessage( GetEventThreadServices(), *mSceneObject, requiresSync );
-    }
+    // scene object is being used in a separate thread; queue a message to set the value
+    SetSyncRequiredMessage( GetEventThreadServices(), GetRenderTaskSceneObject(), requiresSync );
   }
 }
 
@@ -310,11 +320,8 @@ void RenderTask::SetClearEnabled( bool enabled )
   {
     mClearEnabled = enabled;
 
-    if ( mSceneObject )
-    {
-      // mSceneObject is being used in a separate thread; queue a message to set the value
-      SetClearEnabledMessage( GetEventThreadServices(), *mSceneObject, mClearEnabled );
-    }
+    // scene object is being used in a separate thread; queue a message to set the value
+    SetClearEnabledMessage( GetEventThreadServices(), GetRenderTaskSceneObject(), mClearEnabled );
   }
 }
 
@@ -329,11 +336,8 @@ void RenderTask::SetCullMode( bool mode )
   {
     mCullMode = mode;
 
-    if ( mSceneObject )
-    {
-      // mSceneObject is being used in a separate thread; queue a message to set the value
-      SetCullModeMessage( GetEventThreadServices(), *mSceneObject, mCullMode );
-    }
+    // scene object is being used in a separate thread; queue a message to set the value
+    SetCullModeMessage( GetEventThreadServices(), GetRenderTaskSceneObject(), mCullMode );
   }
 }
 
@@ -351,11 +355,8 @@ void RenderTask::SetRefreshRate( uint32_t refreshRate )
 
   // Note - even when refreshRate is the same as mRefreshRate, a message should be sent
 
-  if ( mSceneObject )
-  {
-    // mSceneObject is being used in a separate thread; queue a message to set the value
-    SetRefreshRateMessage( GetEventThreadServices(), *mSceneObject, refreshRate );
-  }
+  // sceneObject is being used in a separate thread; queue a message to set the value
+  SetRefreshRateMessage( GetEventThreadServices(), GetRenderTaskSceneObject(), refreshRate );
 }
 
 uint32_t RenderTask::GetRefreshRate() const
@@ -372,9 +373,9 @@ bool RenderTask::IsHittable( Vector2& screenCoords ) const
   CameraActor* cameraActor = GetCameraActor();
 
   if ( mInputEnabled  &&
-       NULL != sourceActor    &&
+       nullptr != sourceActor &&
        sourceActor->OnStage() &&
-       NULL != cameraActor    &&
+       nullptr != cameraActor &&
        cameraActor->OnStage() )
   {
     // If the actors are rendered off-screen, then the screen coordinates must be converted
@@ -395,8 +396,11 @@ bool RenderTask::TranslateCoordinates( Vector2& screenCoords ) const
   bool inside( true );
   // If the actors are rendered off-screen, then the screen coordinates must be converted
   // the function should only be called for offscreen tasks
-  if( mFrameBufferImage && mMappingConnector.mActor )
+  Dali::Actor mappingActor = GetScreenToFrameBufferMappingActor();
+
+  if( mFrameBufferImage && mappingActor )
   {
+    Internal::Actor* inputMappingActor = &GetImplementation( mappingActor );
     CameraActor* localCamera = GetCameraActor();
     StagePtr stage = Stage::GetCurrent();
     if( stage )
@@ -411,8 +415,8 @@ bool RenderTask::TranslateCoordinates( Vector2& screenCoords ) const
         viewport.height = static_cast<int32_t>( size.height ); // truncated
 
         float localX, localY;
-        inside = mMappingConnector.mActor->ScreenToLocal(defaultCamera.GetViewMatrix(), defaultCamera.GetProjectionMatrix(), viewport, localX, localY, screenCoords.x, screenCoords.y);
-        Vector3 actorSize = mMappingConnector.mActor->GetCurrentSize();
+        inside = inputMappingActor->ScreenToLocal(defaultCamera.GetViewMatrix(), defaultCamera.GetProjectionMatrix(), viewport, localX, localY, screenCoords.x, screenCoords.y);
+        Vector3 actorSize = inputMappingActor->GetCurrentSize();
         if( inside && localX >= 0.f && localX <= actorSize.x && localY >= 0.f && localY <= actorSize.y)
         {
           screenCoords.x = localX;
@@ -470,36 +474,9 @@ bool RenderTask::ViewportToLocal(Actor* actor, float viewportX, float viewportY,
   return actor->ScreenToLocal( *this, localX, localY, viewportX, viewportY );
 }
 
-SceneGraph::RenderTask* RenderTask::CreateSceneObject()
-{
-  // This should only be called once, with no existing scene-object
-  DALI_ASSERT_DEBUG( NULL == mSceneObject );
-
-  // Keep the raw-pointer until DiscardSceneObject is called
-  mSceneObject = SceneGraph::RenderTask::New();
-
-  // Send messages to set other properties that may have changed since last time we were on stage
-  SetExclusiveMessage( GetEventThreadServices(), *mSceneObject, mExclusive );
-  SetClearColorMessage(  GetEventThreadServices(), *mSceneObject, mClearColor );
-  SetClearEnabledMessage(  GetEventThreadServices(), *mSceneObject, mClearEnabled );
-  SetCullModeMessage(  GetEventThreadServices(), *mSceneObject, mCullMode );
-  SetRefreshRateMessage(  GetEventThreadServices(), *mSceneObject, mRefreshRate );
-  SetSyncRequiredMessage( GetEventThreadServices(), *mSceneObject, mRequiresSync );
-  SetFrameBuffer( mFrameBuffer );
-
-  // Caller takes ownership
-  return mSceneObject;
-}
-
-SceneGraph::RenderTask* RenderTask::GetRenderTaskSceneObject()
-{
-  return mSceneObject;
-}
-
-void RenderTask::DiscardSceneObject()
+const SceneGraph::RenderTask& RenderTask::GetRenderTaskSceneObject() const
 {
-  // mSceneObject is not owned; throw away the raw-pointer
-  mSceneObject = NULL;
+  return *static_cast<const SceneGraph::RenderTask*>( mUpdateObject );
 }
 
 /********************************************************************************
@@ -679,37 +656,36 @@ void RenderTask::OnNotifyDefaultPropertyAnimation( Animation& animation, Propert
   }
 }
 
-const SceneGraph::PropertyOwner* RenderTask::GetSceneObject() const
-{
-  return mSceneObject;
-}
-
 const SceneGraph::PropertyBase* RenderTask::GetSceneObjectAnimatableProperty( Property::Index index ) const
 {
-  DALI_ASSERT_ALWAYS( IsPropertyAnimatable(index) && "Property is not animatable" );
-
   const SceneGraph::PropertyBase* property( NULL );
 
-  // This method should only return a property which is part of the scene-graph
-  if( mSceneObject != NULL )
+  switch ( index )
   {
-    switch ( index )
+    case Dali::RenderTask::Property::VIEWPORT_POSITION:
     {
-      case Dali::RenderTask::Property::VIEWPORT_POSITION:
-        property = &mSceneObject->mViewportPosition;
-        break;
-
-      case Dali::RenderTask::Property::VIEWPORT_SIZE:
-        property = &mSceneObject->mViewportSize;
-        break;
-
-      case Dali::RenderTask::Property::CLEAR_COLOR:
-        property = &mSceneObject->mClearColor;
-        break;
-
-      default:
-        break;
+      property = &GetRenderTaskSceneObject().mViewportPosition;
+      break;
+    }
+    case Dali::RenderTask::Property::VIEWPORT_SIZE:
+    {
+      property = &GetRenderTaskSceneObject().mViewportSize;
+      break;
     }
+    case Dali::RenderTask::Property::CLEAR_COLOR:
+    {
+      property = &GetRenderTaskSceneObject().mClearColor;
+      break;
+    }
+    default:
+    {
+      break;
+    }
+  }
+  if( !property )
+  {
+    // not our property, ask base
+    property = Object::GetSceneObjectAnimatableProperty( index );
   }
 
   return property;
@@ -717,35 +693,14 @@ const SceneGraph::PropertyBase* RenderTask::GetSceneObjectAnimatableProperty( Pr
 
 const PropertyInputImpl* RenderTask::GetSceneObjectInputProperty( Property::Index index ) const
 {
-  const PropertyInputImpl* property( NULL );
-  if( mSceneObject != NULL )
-  {
-    switch ( index )
-    {
-      case Dali::RenderTask::Property::VIEWPORT_POSITION:
-        property = &mSceneObject->mViewportPosition;
-        break;
-
-      case Dali::RenderTask::Property::VIEWPORT_SIZE:
-        property = &mSceneObject->mViewportSize;
-        break;
-
-      case Dali::RenderTask::Property::CLEAR_COLOR:
-        property = &mSceneObject->mClearColor;
-        break;
-
-      default:
-        break;
-    }
-  }
-
-  return property;
+  // animatable properties are input as well, Object::GetSceneObjectInputProperty does the same so no need to call it
+  return GetSceneObjectAnimatableProperty( index );
 }
 
 bool RenderTask::HasFinished()
 {
   bool finished = false;
-  const uint32_t counter = mSceneObject->GetRenderedOnceCounter();
+  const uint32_t counter = GetRenderTaskSceneObject().GetRenderedOnceCounter();
 
   if( mRefreshOnceCounter < counter )
   {
@@ -753,7 +708,7 @@ bool RenderTask::HasFinished()
     mRefreshOnceCounter = counter;
   }
 
-  DALI_LOG_INFO(gLogRender, Debug::General, "RenderTask::HasFinished()=%s SCRT:%p  SC\n", finished?"T":"F", mSceneObject);
+  DALI_LOG_INFO(gLogRender, Debug::General, "RenderTask::HasFinished()=%s SCRT:%p  SC\n", finished?"T":"F", &GetRenderTaskSceneObject());
 
   return finished;
 }
@@ -792,11 +747,11 @@ bool RenderTask::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface
   return connected;
 }
 
-RenderTask::RenderTask()
-: mSceneObject( NULL ),
-  mSourceConnector( Connector::SOURCE_CONNECTOR, *this ),
-  mCameraConnector( Connector::CAMERA_CONNECTOR, *this ),
-  mMappingConnector( Connector::MAPPING_CONNECTOR, *this  ),
+RenderTask::RenderTask( const SceneGraph::RenderTask* sceneObject )
+: Object( sceneObject ),
+  mSourceActor( nullptr ),
+  mCameraActor( nullptr ),
+  mInputMappingActor(),
   mClearColor( Dali::RenderTask::DEFAULT_CLEAR_COLOR ),
   mViewportPosition( Vector2::ZERO ),
   mViewportSize( Vector2::ZERO ),
@@ -810,104 +765,14 @@ RenderTask::RenderTask()
   mRequiresSync( false )
 {
   DALI_LOG_INFO(gLogRender, Debug::General, "RenderTask::RenderTask(this:%p)\n", this);
+  // scene object handles observation of source and camera
 }
 
 RenderTask::~RenderTask()
 {
   DALI_LOG_INFO(gLogRender, Debug::General, "RenderTask::~RenderTask(this:%p)\n", this);
-}
-
-// Helper class for connecting Nodes to the scene-graph RenderTask
-
-RenderTask::Connector::Connector( Type type, RenderTask& renderTask )
-: mType( type ),
-  mRenderTask( renderTask ),
-  mActor( NULL ),
-  mCamera( NULL )
-{
-}
-
-RenderTask::Connector::~Connector()
-{
-  SetActor( NULL );
-}
-
-void RenderTask::Connector::SetActor( Actor* actor )
-{
-  if ( mActor != actor )
-  {
-    if ( mActor )
-    {
-      mActor->RemoveObserver( *this );
-    }
-
-    mActor = actor;
-
-    if ( mActor )
-    {
-      mActor->AddObserver( *this );
-    }
-
-    UpdateRenderTask();
-  }
-}
-
-void RenderTask::Connector::SceneObjectAdded( Object& object )
-{
-  UpdateRenderTask();
-}
-
-void RenderTask::Connector::SceneObjectRemoved( Object& object )
-{
-  UpdateRenderTask();
-}
-
-void RenderTask::Connector::ObjectDestroyed( Object& object )
-{
-  if ( SOURCE_CONNECTOR == mType )
-  {
-    const Stage* stage = Stage::GetCurrent();
-    if ( stage )
-    {
-      stage->GetRenderTaskList().SetExclusive( &mRenderTask, false );
-    }
-  }
-
-  mActor = NULL;
-  mCamera = NULL; // only meaningful for the camera connector but no simple way to distinguish
-
-  UpdateRenderTask();
-}
-
-void RenderTask::Connector::UpdateRenderTask()
-{
-  // Guard to allow handle destruction after Core has been destroyed
-  if( Internal::Stage::IsInstalled() &&
-      mRenderTask.mSceneObject )
-  {
-    const SceneGraph::Node* node( NULL );
-
-    // Check whether a Node exists in the scene-graph
-    if ( NULL != mActor )
-    {
-      const SceneGraph::PropertyOwner* object = mActor->GetSceneObject();
-      if ( NULL != object )
-      {
-        // actors only point to nodes as their scene objects
-        node = static_cast< const SceneGraph::Node* >( object );
-      }
-    }
-
-    //the mapping node is not used in the scene graph
-    if ( SOURCE_CONNECTOR == mType )
-    {
-      SetSourceNodeMessage( mRenderTask.GetEventThreadServices(), *(mRenderTask.mSceneObject), node );
-    }
-    else if( CAMERA_CONNECTOR == mType )
-    {
-      SetCameraMessage( mRenderTask.GetEventThreadServices(), *(mRenderTask.mSceneObject), node, mCamera );
-    }
-  }
+  // scene object deletion is handled by our parent
+  // scene object handles observation of source and camera
 }
 
 } // namespace Internal
index 8b9f8aa..de111d0 100644 (file)
@@ -20,6 +20,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/public-api/object/base-object.h>
+#include <dali/public-api/object/weak-handle.h>
 #include <dali/public-api/render-tasks/render-task.h>
 #include <dali/internal/event/images/frame-buffer-image-impl.h>
 #include <dali/internal/event/common/object-impl.h>
@@ -37,20 +38,23 @@ class EventThreadServices;
 
 namespace SceneGraph
 {
+class RenderTaskList;
 class RenderTask;
 class Camera;
 }
 
+using RenderTaskPtr = IntrusivePtr<RenderTask>;
+
 class RenderTask : public Object
 {
 public:
 
-  typedef Dali::RenderTask::ScreenToFrameBufferFunction ScreenToFrameBufferFunction;
+  using ScreenToFrameBufferFunction = Dali::RenderTask::ScreenToFrameBufferFunction;
 
   /**
    * Creates a new RenderTask.
    */
-  static RenderTask* New();
+  static RenderTaskPtr New( Actor* sourceActor, CameraActor* cameraActor, SceneGraph::RenderTaskList& parentSceneObject );
 
   /**
    * @copydoc Dali::RenderTask::SetSourceActor()
@@ -125,12 +129,12 @@ public:
   /**
    * copydoc Dali::RenderTask::SetScreenToFrameBufferMappingActor
    */
-  void SetScreenToFrameBufferMappingActor( Actor* mappingActor );
+  void SetScreenToFrameBufferMappingActor( Dali::Actor& mappingActor );
 
   /**
    * copydoc Dali::RenderTask::GetScreenToFrameBufferMAppingActor
    */
-  Actor* GetScreenToFrameBufferMappingActor() const;
+  Dali::Actor GetScreenToFrameBufferMappingActor() const;
 
   /**
    * @copydoc Dali::RenderTask::SetViewportPosition
@@ -241,22 +245,10 @@ public:
 public: // Used by RenderTaskList, which owns the SceneGraph::RenderTasks
 
   /**
-   * Create the scene-graph RenderTask object.
-   * @pre CreateSceneObject has not already been called.
-   * @return A newly allocated scene-graph object; the caller takes ownership.
-   */
-  SceneGraph::RenderTask* CreateSceneObject();
-
-  /**
    * Retrieve the scene-graph RenderTask object.
-   * @return The scene-graph object, or NULL if this has been discarded.
-   */
-  SceneGraph::RenderTask* GetRenderTaskSceneObject();
-
-  /**
-   * Discard the scene-graph RenderTask object.
+   * @return The scene-graph object
    */
-  void DiscardSceneObject();
+  const SceneGraph::RenderTask& GetRenderTaskSceneObject() const;
 
 public: // Implementation of Object
 
@@ -281,11 +273,6 @@ public: // Implementation of Object
   virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType );
 
   /**
-   * @copydoc Dali::Internal::Object::GetSceneObject()
-   */
-  virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
-
-  /**
    * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
    */
   virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
@@ -330,92 +317,28 @@ public: //signals
 protected:
 
   /**
-   * Construct a new RenderTask.
+   * Constructor.
+   *
+   * @param sceneObject the scene graph object
    */
-  RenderTask();
+  RenderTask( const SceneGraph::RenderTask* sceneObject );
 
   /**
    * A reference counted object may only be deleted by calling Unreference()
    */
   virtual ~RenderTask();
 
-  /**
-   * Helper class for connecting Nodes to the scene-graph RenderTask
-   */
-  class Connector : public Object::Observer
-  {
-  public:
-
-    enum Type
-    {
-      SOURCE_CONNECTOR,
-      CAMERA_CONNECTOR,
-      MAPPING_CONNECTOR
-    };
-
-    /**
-     * Create the helper class
-     */
-    Connector( Type type, RenderTask& renderTask );
+private: // not copyable
 
-    /**
-     * Non-virtual destructor; not suitable as a base object.
-     */
-    ~Connector();
-
-    /**
-     * Set the actor to be observed.
-     * @param[in] actor The actor to be observed.
-     */
-    void SetActor( Actor* actor );
-
-    /**
-     * Update the scene-graph RenderTask with a new source/camera Node.
-     */
-    void UpdateRenderTask();
-
-  public: // From Object::Observer
-
-    /**
-     * @copydoc Dali::Internal::Object::Observer::SceneObjectAdded
-     */
-    virtual void SceneObjectAdded( Object& object );
-
-    /**
-     * @copydoc Dali::Internal::Object::Observer::SceneObjectAdded
-     */
-    virtual void SceneObjectRemoved( Object& object );
-
-    /**
-     * @copydoc Dali::Internal::Object::Observer::ObjectDestroyed
-     */
-    virtual void ObjectDestroyed( Object& object );
-
-  private:
-
-    // Undefined
-    Connector(const Connector&);
-
-    // Undefined
-    Connector& operator=(const Connector& rhs);
-
-  public:
-
-    const Type mType;
-
-    RenderTask& mRenderTask;
-
-    Actor* mActor; ///< Raw-pointer to the actor; not owned.
-    const SceneGraph::Camera* mCamera;    ///< Raw-pointer to camera scene-graph object; not owned.
-  };
+  RenderTask() = delete;
+  RenderTask( const RenderTask& ) = delete;
+  RenderTask& operator=( const RenderTask& ) = delete;
 
 private:
 
-  SceneGraph::RenderTask* mSceneObject; ///< Raw-pointer to the scene-graph object; not owned.
-
-  Connector mSourceConnector; ///< Responsible for connecting/disconnecting source Nodes
-  Connector mCameraConnector; ///< Responsible for connecting/disconnecting camera Nodes
-  Connector mMappingConnector; /// Responsible for connecting/disconnecting actor node, which used to mapping screen to frame buffer coordinate
+  Actor* mSourceActor; ///< Source actor, we cannot keep the actor alive so raw pointer.
+  CameraActor* mCameraActor; ///< Camera actor, we cannot keep the actor alive so raw pointer.
+  WeakHandle<Dali::Actor> mInputMappingActor; /// used to mapping screen to frame buffer coordinate, not kept alive by rendertask
 
   Vector4 mClearColor;       ///< Optional clear color
 
index 3c4fe79..c3a40d6 100644 (file)
@@ -53,57 +53,36 @@ RenderTaskListPtr RenderTaskList::New()
   return taskList;
 }
 
-Dali::RenderTask RenderTaskList::CreateTask()
+RenderTaskPtr RenderTaskList::CreateTask()
 {
   return CreateTask( &mDefaults.GetDefaultRootActor(), &mDefaults.GetDefaultCameraActor() );
 }
 
-Dali::RenderTask RenderTaskList::CreateTask( Actor* sourceActor, CameraActor* cameraActor)
+RenderTaskPtr RenderTaskList::CreateTask( Actor* sourceActor, CameraActor* cameraActor)
 {
-  RenderTask* taskImpl = RenderTask::New();
+  RenderTaskPtr task = RenderTask::New( sourceActor, cameraActor, *mSceneObject );
 
-  Dali::RenderTask newTask( taskImpl );
-  mTasks.push_back( newTask );
+  mTasks.push_back( task );
 
-  if ( mSceneObject )
-  {
-    SceneGraph::RenderTask* sceneObject = taskImpl->CreateSceneObject();
-
-    OwnerPointer< SceneGraph::RenderTask > transferOwnership( sceneObject );
-    AddTaskMessage( mEventThreadServices, *mSceneObject, transferOwnership );
-  }
-
-  // Set the default source & camera actors
-  taskImpl->SetSourceActor( sourceActor );
-  taskImpl->SetCameraActor( cameraActor );
-
-  return newTask;
+  return task;
 }
 
-void RenderTaskList::RemoveTask( Dali::RenderTask task )
+void RenderTaskList::RemoveTask( Internal::RenderTask& task )
 {
   for ( RenderTaskContainer::iterator iter = mTasks.begin(); mTasks.end() != iter; ++iter )
   {
-    if ( *iter == task )
+    if ( iter->Get() == &task )
     {
-      RenderTask& taskImpl = GetImplementation( task );
-      if ( mSceneObject )
-      {
-        SceneGraph::RenderTask* sceneObject = taskImpl.GetRenderTaskSceneObject();
-        DALI_ASSERT_DEBUG( NULL != sceneObject );
-
-        // Send a message to remove the scene-graph RenderTask
-        RemoveTaskMessage( mEventThreadServices, *mSceneObject, *sceneObject );
-
-        // The scene-graph RenderTask will be destroyed soon; discard the raw-pointer
-        taskImpl.DiscardSceneObject();
-      }
+      const SceneGraph::RenderTask& sceneObject = task.GetRenderTaskSceneObject();
 
+      // delete the task
       mTasks.erase( iter );
+      // send a message to remove the scene-graph RenderTask
+      RemoveTaskMessage( mEventThreadServices, *mSceneObject, sceneObject );
 
       for ( Vector< Exclusive >::Iterator exclusiveIt = mExclusives.Begin(); exclusiveIt != mExclusives.End(); ++exclusiveIt )
       {
-        if ( exclusiveIt->renderTaskPtr == &taskImpl )
+        if ( exclusiveIt->renderTaskPtr == iter->Get() )
         {
           mExclusives.Erase( exclusiveIt );
           break;
@@ -119,11 +98,11 @@ uint32_t RenderTaskList::GetTaskCount() const
   return static_cast<uint32_t>( mTasks.size() ); // only 4,294,967,295 render tasks supported
 }
 
-Dali::RenderTask RenderTaskList::GetTask( uint32_t index ) const
+RenderTaskPtr RenderTaskList::GetTask( uint32_t index ) const
 {
   DALI_ASSERT_ALWAYS( ( index < mTasks.size() ) && "RenderTask index out-of-range" );
 
-  return mTasks[index];
+  return mTasks[ index ];
 }
 
 void RenderTaskList::SetExclusive( RenderTask* task, bool exclusive )
@@ -158,87 +137,62 @@ void RenderTaskList::SetExclusive( RenderTask* task, bool exclusive )
 RenderTaskList::RenderTaskList()
 : mEventThreadServices( *Stage::GetCurrent() ),
   mDefaults( *Stage::GetCurrent() ),
-  mSceneObject( NULL )
+  mSceneObject( nullptr )
 {
 }
 
 RenderTaskList::~RenderTaskList()
 {
-  if( EventThreadServices::IsCoreRunning() )
+  if( EventThreadServices::IsCoreRunning() && mSceneObject )
   {
-    DestroySceneObject();
+    // Remove the render task list using a message to the update manager
+    RemoveRenderTaskListMessage( mEventThreadServices.GetUpdateManager(), *mSceneObject );
   }
 }
 
 void RenderTaskList::Initialize()
 {
-  // This should only be called once, with no existing scene-object
-  DALI_ASSERT_DEBUG( NULL == mSceneObject );
-
-  CreateSceneObject();
-
-  // set the callback to call us back when tasks are completed
-  mSceneObject->SetCompleteNotificationInterface( this );
-}
-
-void RenderTaskList::CreateSceneObject()
-{
-  DALI_ASSERT_DEBUG( mSceneObject == NULL );
-
   // Create a new render task list, Keep a const pointer to the render task list.
   mSceneObject = SceneGraph::RenderTaskList::New();
 
   OwnerPointer< SceneGraph::RenderTaskList > transferOwnership( const_cast< SceneGraph::RenderTaskList* >( mSceneObject ) );
   AddRenderTaskListMessage( mEventThreadServices.GetUpdateManager(), transferOwnership );
-}
 
-void RenderTaskList::DestroySceneObject()
-{
-  if ( mSceneObject != NULL )
-  {
-    // Remove the render task list using a message to the update manager
-    RemoveRenderTaskListMessage( mEventThreadServices.GetUpdateManager(), *mSceneObject );
-    mSceneObject = NULL;
-  }
+  // set the callback to call us back when tasks are completed
+  mSceneObject->SetCompleteNotificationInterface( this );
 }
 
 void RenderTaskList::NotifyCompleted()
 {
   DALI_LOG_TRACE_METHOD(gLogRenderList);
 
-  std::vector< Dali::RenderTask > finishedRenderTasks;
+  RenderTaskContainer finishedRenderTasks;
 
   // Since render tasks can be unreferenced during the signal emissions, iterators into render tasks pointers may be invalidated.
   // First copy the finished render tasks, then emit signals
-  for ( std::vector<Dali::RenderTask>::iterator it = mTasks.begin(), endIt = mTasks.end(); it != endIt; ++it )
+  for ( RenderTaskContainer::iterator iter = mTasks.begin(), endIt = mTasks.end(); iter != endIt; ++iter )
   {
-    Dali::RenderTask& renderTask( *it );
-
-    if( GetImplementation( renderTask ).HasFinished() )
+    if( (*iter)->HasFinished() )
     {
-      finishedRenderTasks.push_back( Dali::RenderTask( renderTask ) );
+      finishedRenderTasks.push_back( *iter );
     }
   }
 
   // Now it's safe to emit the signals
-  for ( std::vector<Dali::RenderTask>::iterator it = finishedRenderTasks.begin(), endIt = finishedRenderTasks.end(); it != endIt; ++it )
+  for ( auto&& item : finishedRenderTasks )
   {
-    Dali::RenderTask& handle( *it );
-
-    GetImplementation(handle).EmitSignalFinish();
+    item->EmitSignalFinish();
   }
 }
 
 void RenderTaskList::RecoverFromContextLoss()
 {
-  for ( RenderTaskContainer::iterator iter = mTasks.begin(); mTasks.end() != iter; ++iter )
+  for ( auto&& item : mTasks )
   {
-    Dali::RenderTask task = *iter;
-
     // If the render target renders only once to an offscreen, re-render the render task
-    if( task.GetRefreshRate() == Dali::RenderTask::REFRESH_ONCE && task.GetTargetFrameBuffer() )
+    if( item->GetRefreshRate() == Dali::RenderTask::REFRESH_ONCE && item->GetTargetFrameBuffer() )
     {
-      task.SetRefreshRate( Dali::RenderTask::REFRESH_ONCE );
+      item->SetRefreshRate( Dali::RenderTask::REFRESH_ONCE );
     }
   }
 }
index 6d351c2..55e37e8 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_RENDER_TASK_LIST_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,9 +21,9 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/object/base-object.h>
-#include <dali/public-api/render-tasks/render-task.h>
 #include <dali/public-api/render-tasks/render-task-list.h>
 #include <dali/internal/event/common/complete-notification-interface.h>
+#include <dali/internal/event/render-tasks/render-task-impl.h>
 
 namespace Dali
 {
@@ -37,7 +37,7 @@ class Actor;
 class CameraActor;
 
 class RenderTaskList;
-typedef IntrusivePtr<RenderTaskList> RenderTaskListPtr;
+using RenderTaskListPtr = IntrusivePtr<RenderTaskList>;
 
 namespace SceneGraph
 {
@@ -53,7 +53,7 @@ class RenderTaskList : public BaseObject, public CompleteNotificationInterface
 {
 public:
 
-  typedef std::vector< Dali::RenderTask > RenderTaskContainer;
+  using RenderTaskContainer = std::vector< RenderTaskPtr >;
 
   struct Exclusive
   {
@@ -70,7 +70,7 @@ public:
   /**
    * @copydoc Dali::RenderTaskList::CreateTask()
    */
-  Dali::RenderTask CreateTask();
+  RenderTaskPtr CreateTask();
 
   /**
    * @brief Creates a new RenderTask.
@@ -81,12 +81,12 @@ public:
    * @param[in] cameraActor The actor from which the scene is viewed for this render task.
    * @return A valid handle to a new RenderTask
    */
-  Dali::RenderTask CreateTask( Actor* sourceActor, CameraActor* cameraActor);
+  RenderTaskPtr CreateTask( Actor* sourceActor, CameraActor* cameraActor);
 
   /**
    * @copydoc Dali::RenderTaskList::RemoveTask()
    */
-  void RemoveTask( Dali::RenderTask task );
+  void RemoveTask( Internal::RenderTask& task );
 
   /**
    * @copydoc Dali::RenderTaskList::GetTaskCount()
@@ -96,7 +96,7 @@ public:
   /**
    * @copydoc Dali::RenderTaskList::GetTask()
    */
-  Dali::RenderTask GetTask( uint32_t index ) const;
+  RenderTaskPtr GetTask( uint32_t index ) const;
 
   /**
    * Retrieve the container of render-tasks.
@@ -156,16 +156,6 @@ protected:
    */
   void Initialize();
 
-  /**
-   * Helper to create a scene-graph render task list
-   */
-  void CreateSceneObject();
-
-  /**
-   * Helper to destroy a scene-graph render task list
-   */
-  void DestroySceneObject();
-
 private: // from CompleteNotificationInterface
 
   /**
index 2f66002..7adf28b 100644 (file)
@@ -22,7 +22,6 @@
 #include <dali/devel-api/scripting/scripting.h>
 #include <dali/devel-api/rendering/renderer-devel.h>
 #include <dali/public-api/object/type-registry.h>
-#include <dali/internal/event/common/object-impl-helper.h> // Dali::Internal::ObjectHelper
 #include <dali/internal/event/common/property-helper.h>    // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
 #include <dali/internal/event/common/property-input-impl.h>
 #include <dali/internal/render/renderers/render-geometry.h>
@@ -171,8 +170,17 @@ TypeRegistration mType( typeid( Dali::Renderer ), typeid( Dali::Handle ), Create
 
 RendererPtr Renderer::New()
 {
-  RendererPtr rendererPtr( new Renderer() );
-  rendererPtr->Initialize();
+  // create scene object first so it's guaranteed to exist for the event side
+  auto sceneObject = SceneGraph::Renderer::New();
+  OwnerPointer< SceneGraph::Renderer > transferOwnership( sceneObject );
+  // pass the pointer to base for message passing
+  RendererPtr rendererPtr( new Renderer( sceneObject ) );
+  // transfer scene object ownership to update manager
+  EventThreadServices& eventThreadServices = rendererPtr->GetEventThreadServices();
+  SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
+  AddRendererMessage( updateManager, transferOwnership );
+
+  eventThreadServices.RegisterObject( rendererPtr.Get() );
   return rendererPtr;
 }
 
@@ -181,48 +189,48 @@ void Renderer::SetGeometry( Geometry& geometry )
   mGeometry = &geometry;
 
   const Render::Geometry* geometrySceneObject = geometry.GetRenderObject();
-  SetGeometryMessage( GetEventThreadServices(), *mSceneObject, *geometrySceneObject );
+  SetGeometryMessage( GetEventThreadServices(), GetRendererSceneObject(), *geometrySceneObject );
 }
 
-Geometry* Renderer::GetGeometry() const
+GeometryPtr Renderer::GetGeometry() const
 {
-  return mGeometry.Get();
+  return mGeometry;
 }
 
 void Renderer::SetTextures( TextureSet& textureSet )
 {
   mTextureSet = &textureSet;
   const SceneGraph::TextureSet* textureSetSceneObject = textureSet.GetTextureSetSceneObject();
-  SetTexturesMessage( GetEventThreadServices(), *mSceneObject, *textureSetSceneObject );
+  SetTexturesMessage( GetEventThreadServices(), GetRendererSceneObject(), *textureSetSceneObject );
 }
 
-TextureSet* Renderer::GetTextures() const
+TextureSetPtr Renderer::GetTextures() const
 {
-  return mTextureSet.Get();
+  return mTextureSet;
 }
 
 void Renderer::SetShader( Shader& shader )
 {
   mShader = &shader;
-  SceneGraph::Shader& sceneGraphShader = *shader.GetShaderSceneObject();
-  SceneGraph::SetShaderMessage( GetEventThreadServices(), *mSceneObject, sceneGraphShader );
+  const SceneGraph::Shader& sceneGraphShader = shader.GetShaderSceneObject();
+  SceneGraph::SetShaderMessage( GetEventThreadServices(), GetRendererSceneObject(), sceneGraphShader );
 }
 
-Shader* Renderer::GetShader() const
+ShaderPtr Renderer::GetShader() const
 {
-  return mShader.Get();
+  return mShader;
 }
 
-void Renderer::SetDepthIndex( int depthIndex )
+void Renderer::SetDepthIndex( int32_t depthIndex )
 {
   if ( mDepthIndex != depthIndex )
   {
     mDepthIndex = depthIndex;
-    SetDepthIndexMessage( GetEventThreadServices(), *mSceneObject, depthIndex );
+    SetDepthIndexMessage( GetEventThreadServices(), GetRendererSceneObject(), depthIndex );
   }
 }
 
-int Renderer::GetDepthIndex() const
+int32_t Renderer::GetDepthIndex() const
 {
   return mDepthIndex;
 }
@@ -233,7 +241,7 @@ void Renderer::SetBlendMode( BlendMode::Type mode )
   {
     mBlendMode = mode;
 
-    SetBlendModeMessage( GetEventThreadServices(), *mSceneObject, mBlendMode );
+    SetBlendModeMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendMode );
   }
 }
 
@@ -245,7 +253,7 @@ BlendMode::Type Renderer::GetBlendMode() const
 void Renderer::SetBlendFunc( BlendFactor::Type srcFactorRgba, BlendFactor::Type destFactorRgba )
 {
   mBlendingOptions.SetBlendFunc( srcFactorRgba, destFactorRgba, srcFactorRgba, destFactorRgba );
-  SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
+  SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
 }
 
 void Renderer::SetBlendFunc( BlendFactor::Type srcFactorRgb,
@@ -254,7 +262,7 @@ void Renderer::SetBlendFunc( BlendFactor::Type srcFactorRgb,
                              BlendFactor::Type destFactorAlpha )
 {
   mBlendingOptions.SetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-  SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
+  SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
 }
 
 void Renderer::GetBlendFunc( BlendFactor::Type& srcFactorRgb,
@@ -271,14 +279,14 @@ void Renderer::GetBlendFunc( BlendFactor::Type& srcFactorRgb,
 void Renderer::SetBlendEquation( BlendEquation::Type equationRgba )
 {
   mBlendingOptions.SetBlendEquation( equationRgba, equationRgba );
-  SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
+  SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
 }
 
 void Renderer::SetBlendEquation( BlendEquation::Type equationRgb,
                                  BlendEquation::Type equationAlpha )
 {
   mBlendingOptions.SetBlendEquation( equationRgb, equationAlpha );
-  SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
+  SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
 }
 
 void Renderer::GetBlendEquation( BlendEquation::Type& equationRgb,
@@ -294,7 +302,7 @@ void Renderer::SetIndexedDrawFirstElement( uint32_t firstElement )
   if( firstElement != mIndexedDrawFirstElement )
   {
     mIndexedDrawFirstElement = firstElement;
-    SetIndexedDrawFirstElementMessage( GetEventThreadServices(), *mSceneObject, mIndexedDrawFirstElement );
+    SetIndexedDrawFirstElementMessage( GetEventThreadServices(), GetRendererSceneObject(), mIndexedDrawFirstElement );
   }
 }
 
@@ -303,7 +311,7 @@ void Renderer::SetIndexedDrawElementsCount( uint32_t elementsCount )
   if( elementsCount != mIndexedDrawElementCount )
   {
     mIndexedDrawElementCount = elementsCount;
-    SetIndexedDrawElementsCountMessage( GetEventThreadServices(), *mSceneObject, mIndexedDrawElementCount );
+    SetIndexedDrawElementsCountMessage( GetEventThreadServices(), GetRendererSceneObject(), mIndexedDrawElementCount );
   }
 }
 
@@ -321,7 +329,7 @@ void Renderer::EnablePreMultipliedAlpha( bool preMultipled )
       SetBlendFunc( BlendFactor::SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA );
     }
     mPremultipledAlphaEnabled = preMultipled;
-    SetEnablePreMultipliedAlphaMessage( GetEventThreadServices(), *mSceneObject, mPremultipledAlphaEnabled );
+    SetEnablePreMultipliedAlphaMessage( GetEventThreadServices(), GetRendererSceneObject(), mPremultipledAlphaEnabled );
   }
 }
 
@@ -330,9 +338,9 @@ bool Renderer::IsPreMultipliedAlphaEnabled() const
   return mPremultipledAlphaEnabled;
 }
 
-SceneGraph::Renderer* Renderer::GetRendererSceneObject()
+const SceneGraph::Renderer& Renderer::GetRendererSceneObject() const
 {
-  return mSceneObject;
+  return static_cast<const SceneGraph::Renderer&>( GetSceneObject() );
 }
 
 void Renderer::SetDefaultProperty( Property::Index index,
@@ -342,7 +350,7 @@ void Renderer::SetDefaultProperty( Property::Index index,
   {
     case Dali::Renderer::Property::DEPTH_INDEX:
     {
-      SetDepthIndex( propertyValue.Get<int>() );
+      SetDepthIndex( propertyValue.Get<int32_t>() );
       break;
     }
     case Dali::Renderer::Property::FACE_CULLING_MODE:
@@ -351,7 +359,7 @@ void Renderer::SetDefaultProperty( Property::Index index,
       if( Scripting::GetEnumerationProperty< FaceCullingMode::Type >( propertyValue, FACE_CULLING_MODE_TABLE, FACE_CULLING_MODE_TABLE_COUNT, convertedValue ) )
       {
         mFaceCullingMode = convertedValue;
-        SetFaceCullingModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
+        SetFaceCullingModeMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
       }
       break;
     }
@@ -372,7 +380,7 @@ void Renderer::SetDefaultProperty( Property::Index index,
       {
         BlendEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
         mBlendingOptions.SetBlendEquation( convertedValue, alphaEquation );
-        SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
+        SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
       }
       break;
     }
@@ -384,7 +392,7 @@ void Renderer::SetDefaultProperty( Property::Index index,
       {
         BlendEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
         mBlendingOptions.SetBlendEquation( rgbEquation, convertedValue );
-        SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
+        SetBlendingOptionsMessage( GetEventThreadServices(), GetRendererSceneObject(), mBlendingOptions.GetBitmask() );
       }
       break;
     }
@@ -452,7 +460,7 @@ void Renderer::SetDefaultProperty( Property::Index index,
     }
     case Dali::Renderer::Property::INDEX_RANGE_FIRST:
     {
-      int firstElement;
+      int32_t firstElement;
       if( propertyValue.Get( firstElement ) )
       {
         SetIndexedDrawFirstElement( firstElement );
@@ -461,7 +469,7 @@ void Renderer::SetDefaultProperty( Property::Index index,
     }
     case Dali::Renderer::Property::INDEX_RANGE_COUNT:
     {
-      int elementsCount;
+      int32_t elementsCount;
       if( propertyValue.Get( elementsCount ) )
       {
         SetIndexedDrawElementsCount( elementsCount );
@@ -474,7 +482,7 @@ void Renderer::SetDefaultProperty( Property::Index index,
       if( Scripting::GetEnumerationProperty< DepthWriteMode::Type >( propertyValue, DEPTH_WRITE_MODE_TABLE, DEPTH_WRITE_MODE_TABLE_COUNT, convertedValue ) )
       {
         mDepthWriteMode = convertedValue;
-        SetDepthWriteModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
+        SetDepthWriteModeMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
       }
       break;
     }
@@ -484,7 +492,7 @@ void Renderer::SetDefaultProperty( Property::Index index,
       if( Scripting::GetEnumerationProperty< DepthFunction::Type >( propertyValue, DEPTH_FUNCTION_TABLE, DEPTH_FUNCTION_TABLE_COUNT, convertedValue ) )
       {
         mDepthFunction = convertedValue;
-        SetDepthFunctionMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
+        SetDepthFunctionMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
       }
       break;
     }
@@ -494,7 +502,7 @@ void Renderer::SetDefaultProperty( Property::Index index,
       if( Scripting::GetEnumerationProperty< DepthTestMode::Type >( propertyValue, DEPTH_TEST_MODE_TABLE, DEPTH_TEST_MODE_TABLE_COUNT, convertedValue ) )
       {
         mDepthTestMode = convertedValue;
-        SetDepthTestModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
+        SetDepthTestModeMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
       }
       break;
     }
@@ -504,7 +512,7 @@ void Renderer::SetDefaultProperty( Property::Index index,
       if( Scripting::GetEnumerationProperty< RenderMode::Type >( propertyValue, RENDER_MODE_TABLE, RENDER_MODE_TABLE_COUNT, convertedValue ) )
       {
         mStencilParameters.renderMode = convertedValue;
-        SetRenderModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
+        SetRenderModeMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
       }
       break;
     }
@@ -514,45 +522,45 @@ void Renderer::SetDefaultProperty( Property::Index index,
       if( Scripting::GetEnumerationProperty< StencilFunction::Type >( propertyValue, STENCIL_FUNCTION_TABLE, STENCIL_FUNCTION_TABLE_COUNT, convertedValue ) )
       {
         mStencilParameters.stencilFunction = convertedValue;
-        SetStencilFunctionMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
+        SetStencilFunctionMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
       }
       break;
     }
     case Dali::Renderer::Property::STENCIL_FUNCTION_MASK:
     {
-      int stencilFunctionMask;
+      int32_t stencilFunctionMask;
       if( propertyValue.Get( stencilFunctionMask ) )
       {
         if( stencilFunctionMask != mStencilParameters.stencilFunctionMask )
         {
           mStencilParameters.stencilFunctionMask = stencilFunctionMask;
-          SetStencilFunctionMaskMessage( GetEventThreadServices(), *mSceneObject, stencilFunctionMask );
+          SetStencilFunctionMaskMessage( GetEventThreadServices(), GetRendererSceneObject(), stencilFunctionMask );
         }
       }
       break;
     }
     case Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE:
     {
-      int stencilFunctionReference;
+      int32_t stencilFunctionReference;
       if( propertyValue.Get( stencilFunctionReference ) )
       {
         if( stencilFunctionReference != mStencilParameters.stencilFunctionReference )
         {
           mStencilParameters.stencilFunctionReference = stencilFunctionReference;
-          SetStencilFunctionReferenceMessage( GetEventThreadServices(), *mSceneObject, stencilFunctionReference );
+          SetStencilFunctionReferenceMessage( GetEventThreadServices(), GetRendererSceneObject(), stencilFunctionReference );
         }
       }
       break;
     }
     case Dali::Renderer::Property::STENCIL_MASK:
     {
-      int stencilMask;
+      int32_t stencilMask;
       if( propertyValue.Get( stencilMask ) )
       {
         if( stencilMask != mStencilParameters.stencilMask )
         {
           mStencilParameters.stencilMask = stencilMask;
-          SetStencilMaskMessage( GetEventThreadServices(), *mSceneObject, stencilMask );
+          SetStencilMaskMessage( GetEventThreadServices(), GetRendererSceneObject(), stencilMask );
         }
       }
       break;
@@ -563,7 +571,7 @@ void Renderer::SetDefaultProperty( Property::Index index,
       if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) )
       {
         mStencilParameters.stencilOperationOnFail = convertedValue;
-        SetStencilOperationOnFailMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
+        SetStencilOperationOnFailMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
       }
       break;
     }
@@ -573,7 +581,7 @@ void Renderer::SetDefaultProperty( Property::Index index,
       if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) )
       {
         mStencilParameters.stencilOperationOnZFail = convertedValue;
-        SetStencilOperationOnZFailMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
+        SetStencilOperationOnZFailMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
       }
       break;
     }
@@ -583,7 +591,7 @@ void Renderer::SetDefaultProperty( Property::Index index,
       if( Scripting::GetEnumerationProperty< StencilOperation::Type >( propertyValue, STENCIL_OPERATION_TABLE, STENCIL_OPERATION_TABLE_COUNT, convertedValue ) )
       {
         mStencilParameters.stencilOperationOnZPass = convertedValue;
-        SetStencilOperationOnZPassMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
+        SetStencilOperationOnZPassMessage( GetEventThreadServices(), GetRendererSceneObject(), convertedValue );
       }
       break;
     }
@@ -595,7 +603,7 @@ void Renderer::SetDefaultProperty( Property::Index index,
         if( !Equals( mOpacity, opacity ) )
         {
           mOpacity = opacity;
-          BakeOpacityMessage( GetEventThreadServices(), *mSceneObject, mOpacity );
+          BakeOpacityMessage( GetEventThreadServices(), GetRendererSceneObject(), mOpacity );
         }
       }
       break;
@@ -603,14 +611,6 @@ void Renderer::SetDefaultProperty( Property::Index index,
   }
 }
 
-void Renderer::SetSceneGraphProperty( Property::Index index,
-                                      const PropertyMetadata& entry,
-                                      const Property::Value& value )
-{
-  ObjectImplHelper::SetSceneGraphProperty( GetEventThreadServices(), this, index, entry, value );
-  OnPropertySet(index, value);
-}
-
 Property::Value Renderer::GetDefaultProperty( Property::Index index ) const
 {
   Property::Value value;
@@ -670,32 +670,18 @@ void Renderer::OnNotifyDefaultPropertyAnimation( Animation& animation, Property:
   }
 }
 
-const SceneGraph::PropertyOwner* Renderer::GetPropertyOwner() const
-{
-  return mSceneObject;
-}
-
-const SceneGraph::PropertyOwner* Renderer::GetSceneObject() const
-{
-  return mSceneObject;
-}
-
 const SceneGraph::PropertyBase* Renderer::GetSceneObjectAnimatableProperty( Property::Index index ) const
 {
-  DALI_ASSERT_ALWAYS( IsPropertyAnimatable(index) && "Property is not animatable" );
   const SceneGraph::PropertyBase* property = NULL;
 
-  property = ObjectImplHelper::GetRegisteredSceneGraphProperty( this,
-                                                                &Renderer::FindAnimatableProperty,
-                                                                &Renderer::FindCustomProperty,
-                                                                index );
-
+  if( index == DevelRenderer::Property::OPACITY )
+  {
+    property = &GetRendererSceneObject().mOpacity;
+  }
   if( !property )
   {
-    if( index == DevelRenderer::Property::OPACITY )
-    {
-      property = &mSceneObject->mOpacity;
-    }
+    // not our property, ask base
+    property = Object::GetSceneObjectAnimatableProperty( index );
   }
 
   return property;
@@ -703,24 +689,12 @@ const SceneGraph::PropertyBase* Renderer::GetSceneObjectAnimatableProperty( Prop
 
 const PropertyInputImpl* Renderer::GetSceneObjectInputProperty( Property::Index index ) const
 {
-  const PropertyInputImpl* property = NULL;
-
-  const SceneGraph::PropertyBase* baseProperty = ObjectImplHelper::GetRegisteredSceneGraphProperty( this,
-                                                                                                    &Renderer::FindAnimatableProperty,
-                                                                                                    &Renderer::FindCustomProperty,
-                                                                                                    index );
-  property = static_cast<const PropertyInputImpl*>( baseProperty );
-
-  return property;
-}
-
-int Renderer::GetPropertyComponentIndex( Property::Index index ) const
-{
-  return Property::INVALID_COMPONENT_INDEX;
+  // reuse animatable property getter, Object::GetSceneObjectInputProperty does the same so no need to call that0
+  return GetSceneObjectAnimatableProperty( index );
 }
 
-Renderer::Renderer()
-: mSceneObject(NULL ),
+Renderer::Renderer( const SceneGraph::Renderer* sceneObject )
+: Object( sceneObject ),
   mDepthIndex( 0 ),
   mIndexedDrawFirstElement( 0 ),
   mIndexedDrawElementCount( 0 ),
@@ -736,22 +710,10 @@ Renderer::Renderer()
 {
 }
 
-void Renderer::Initialize()
-{
-  EventThreadServices& eventThreadServices = GetEventThreadServices();
-  SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
-
-  mSceneObject = SceneGraph::Renderer::New();
-  OwnerPointer< SceneGraph::Renderer > transferOwnership( mSceneObject );
-  AddRendererMessage( updateManager, transferOwnership );
-
-  eventThreadServices.RegisterObject( this );
-}
-
 void Renderer::SetBlendColor( const Vector4& blendColor )
 {
   mBlendingOptions.SetBlendColor( blendColor );
-  SetBlendColorMessage( GetEventThreadServices(), *mSceneObject, GetBlendColor() );
+  SetBlendColorMessage( GetEventThreadServices(), GetRendererSceneObject(), GetBlendColor() );
 }
 
 const Vector4& Renderer::GetBlendColor() const
@@ -770,7 +732,7 @@ Renderer::~Renderer()
   {
     EventThreadServices& eventThreadServices = GetEventThreadServices();
     SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
-    RemoveRendererMessage( updateManager, *mSceneObject );
+    RemoveRendererMessage( updateManager, GetRendererSceneObject() );
 
     eventThreadServices.UnregisterObject( this );
   }
@@ -941,27 +903,28 @@ bool Renderer::GetCachedPropertyValue( Property::Index index, Property::Value& v
 bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value& value  ) const
 {
   bool valueSet = true;
+  const SceneGraph::Renderer& sceneObject = GetRendererSceneObject();
 
   switch( index )
   {
     case Dali::Renderer::Property::DEPTH_INDEX:
     {
-      value = mSceneObject->GetDepthIndex();
+      value = sceneObject.GetDepthIndex();
       break;
     }
     case Dali::Renderer::Property::FACE_CULLING_MODE:
     {
-      value = mSceneObject->GetFaceCullingMode();
+      value = sceneObject.GetFaceCullingMode();
       break;
     }
     case Dali::Renderer::Property::BLEND_MODE:
     {
-      value = mSceneObject->GetBlendMode();
+      value = sceneObject.GetBlendMode();
       break;
     }
     case Dali::Renderer::Property::BLEND_EQUATION_RGB:
     {
-      uint32_t bitMask = mSceneObject->GetBlendingOptions();
+      uint32_t bitMask = sceneObject.GetBlendingOptions();
       BlendingOptions blendingOptions;
       blendingOptions.SetBitmask( bitMask );
       value = static_cast<int32_t>( blendingOptions.GetBlendEquationRgb() );
@@ -969,7 +932,7 @@ bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value&
     }
     case Dali::Renderer::Property::BLEND_EQUATION_ALPHA:
     {
-      uint32_t bitMask = mSceneObject->GetBlendingOptions();
+      uint32_t bitMask = sceneObject.GetBlendingOptions();
       BlendingOptions blendingOptions;
       blendingOptions.SetBitmask( bitMask );
       value = static_cast<int32_t>( blendingOptions.GetBlendEquationAlpha() );
@@ -977,7 +940,7 @@ bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value&
     }
     case Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB:
     {
-      uint32_t bitMask = mSceneObject->GetBlendingOptions();
+      uint32_t bitMask = sceneObject.GetBlendingOptions();
       BlendingOptions blendingOptions;
       blendingOptions.SetBitmask( bitMask );
       value = static_cast<int32_t>( blendingOptions.GetBlendSrcFactorRgb() );
@@ -985,7 +948,7 @@ bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value&
     }
     case Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB:
     {
-      uint32_t bitMask = mSceneObject->GetBlendingOptions();
+      uint32_t bitMask = sceneObject.GetBlendingOptions();
       BlendingOptions blendingOptions;
       blendingOptions.SetBitmask( bitMask );
       value = static_cast<int32_t>( blendingOptions.GetBlendDestFactorRgb() );
@@ -993,7 +956,7 @@ bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value&
     }
     case Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA:
     {
-      uint32_t bitMask = mSceneObject->GetBlendingOptions();
+      uint32_t bitMask = sceneObject.GetBlendingOptions();
       BlendingOptions blendingOptions;
       blendingOptions.SetBitmask( bitMask );
       value = static_cast<int32_t>( blendingOptions.GetBlendSrcFactorAlpha() );
@@ -1001,7 +964,7 @@ bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value&
     }
     case Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA:
     {
-      uint32_t bitMask = mSceneObject->GetBlendingOptions();
+      uint32_t bitMask = sceneObject.GetBlendingOptions();
       BlendingOptions blendingOptions;
       blendingOptions.SetBitmask( bitMask );
       value = static_cast<int32_t>( blendingOptions.GetBlendDestFactorAlpha() );
@@ -1009,90 +972,90 @@ bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value&
     }
     case Dali::Renderer::Property::BLEND_COLOR:
     {
-      value = mSceneObject->GetBlendColor();
+      value = sceneObject.GetBlendColor();
       break;
     }
     case Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA:
     {
-      value = mSceneObject->IsPreMultipliedAlphaEnabled();
+      value = sceneObject.IsPreMultipliedAlphaEnabled();
       break;
     }
     case Dali::Renderer::Property::INDEX_RANGE_FIRST:
     {
-      value = static_cast<int>( mSceneObject->GetIndexedDrawFirstElement() );
+      value = static_cast<int32_t>( sceneObject.GetIndexedDrawFirstElement() );
       break;
     }
     case Dali::Renderer::Property::INDEX_RANGE_COUNT:
     {
-      value = static_cast<int>( mSceneObject->GetIndexedDrawElementsCount() );
+      value = static_cast<int32_t>( sceneObject.GetIndexedDrawElementsCount() );
       break;
     }
     case Dali::Renderer::Property::DEPTH_WRITE_MODE:
     {
-      value = mSceneObject->GetDepthWriteMode();
+      value = sceneObject.GetDepthWriteMode();
       break;
     }
     case Dali::Renderer::Property::DEPTH_FUNCTION:
     {
-      value = mSceneObject->GetDepthFunction();
+      value = sceneObject.GetDepthFunction();
       break;
     }
     case Dali::Renderer::Property::DEPTH_TEST_MODE:
     {
-      value = mSceneObject->GetDepthTestMode();
+      value = sceneObject.GetDepthTestMode();
       break;
     }
     case Dali::Renderer::Property::STENCIL_FUNCTION:
     {
-      Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+      Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
       value = stencilParameters.stencilFunction;
       break;
     }
     case Dali::Renderer::Property::STENCIL_FUNCTION_MASK:
     {
-      Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+      Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
       value = stencilParameters.stencilFunctionMask;
       break;
     }
     case Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE:
     {
-      Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+      Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
       value = stencilParameters.stencilFunctionReference;
       break;
     }
     case Dali::Renderer::Property::STENCIL_MASK:
     {
-      Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+      Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
       value = stencilParameters.stencilMask;
       break;
     }
     case Dali::Renderer::Property::RENDER_MODE:
     {
-      Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+      Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
       value = stencilParameters.renderMode;
       break;
     }
     case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL:
     {
-      Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+      Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
       value = stencilParameters.stencilOperationOnFail;
       break;
     }
     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL:
     {
-      Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+      Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
       value = stencilParameters.stencilOperationOnZFail;
       break;
     }
     case Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS:
     {
-      Render::Renderer::StencilParameters stencilParameters = mSceneObject->GetStencilParameters();
+      Render::Renderer::StencilParameters stencilParameters = sceneObject.GetStencilParameters();
       value = stencilParameters.stencilOperationOnZPass;
       break;
     }
     case Dali::DevelRenderer::Property::OPACITY:
     {
-      value = mSceneObject->GetOpacity( GetEventThreadServices().GetEventBufferIndex() );
+      value = sceneObject.GetOpacity( GetEventThreadServices().GetEventBufferIndex() );
       break;
     }
     default:
@@ -1107,4 +1070,5 @@ bool Renderer::GetCurrentPropertyValue( Property::Index index, Property::Value&
 }
 
 } // namespace Internal
+
 } // namespace Dali
index f02d39c..7d8d4bb 100755 (executable)
@@ -62,7 +62,7 @@ public:
   /**
    * @copydoc Dali::Renderer::GetGeometry()
    */
-  Geometry* GetGeometry() const;
+  GeometryPtr GetGeometry() const;
 
   /**
    * @copydoc Dali::Renderer::SetTextures()
@@ -72,7 +72,7 @@ public:
   /**
    * @copydoc Dali::Renderer::GetTextures()
    */
-  TextureSet* GetTextures() const;
+  TextureSetPtr GetTextures() const;
 
   /**
    * @copydoc Dali::Renderer::SetShader()
@@ -82,90 +82,90 @@ public:
   /**
    * @copydoc Dali::Renderer::GetShader()
    */
-  Shader* GetShader() const;
+  ShaderPtr GetShader() const;
 
   /**
    * @copydoc Dali::Renderer::SetDepthIndex()
    */
-  void SetDepthIndex( int depthIndex );
+  void SetDepthIndex( int32_t depthIndex );
 
   /**
    * @copydoc Dali::Renderer::GetDepthIndex()
    */
-  int GetDepthIndex() const;
+  int32_t GetDepthIndex() const;
 
-   /**
-    * @copydoc Dali::Renderer::SetBlendMode()
-    */
-   void SetBlendMode( BlendMode::Type mode );
+  /**
+   * @copydoc Dali::Renderer::SetBlendMode()
+   */
+  void SetBlendMode( BlendMode::Type mode );
 
-   /**
-    * @copydoc Dali::Renderer::GetBlendMode()
-    */
-   BlendMode::Type GetBlendMode() const;
+  /**
+   * @copydoc Dali::Renderer::GetBlendMode()
+   */
+  BlendMode::Type GetBlendMode() const;
 
-   /**
-    * @copydoc Dali::Renderer::SetBlendFunc()
-    */
-   void SetBlendFunc( BlendFactor::Type srcFactorRgba, BlendFactor::Type destFactorRgba );
+  /**
+   * @copydoc Dali::Renderer::SetBlendFunc()
+   */
+  void SetBlendFunc( BlendFactor::Type srcFactorRgba, BlendFactor::Type destFactorRgba );
 
-   /**
-    * @copydoc Dali::Renderer::SetBlendFunc()
-    */
-   void SetBlendFunc( BlendFactor::Type srcFactorRgb,   BlendFactor::Type destFactorRgb,
-                      BlendFactor::Type srcFactorAlpha, BlendFactor::Type destFactorAlpha );
+  /**
+   * @copydoc Dali::Renderer::SetBlendFunc()
+   */
+  void SetBlendFunc( BlendFactor::Type srcFactorRgb,   BlendFactor::Type destFactorRgb,
+                     BlendFactor::Type srcFactorAlpha, BlendFactor::Type destFactorAlpha );
 
-   /**
-    * @copydoc Dali::Renderer::GetBlendFunc()
-    */
-   void GetBlendFunc( BlendFactor::Type& srcFactorRgb,   BlendFactor::Type& destFactorRgb,
-                      BlendFactor::Type& srcFactorAlpha, BlendFactor::Type& destFactorAlpha ) const;
+  /**
+   * @copydoc Dali::Renderer::GetBlendFunc()
+   */
+  void GetBlendFunc( BlendFactor::Type& srcFactorRgb,   BlendFactor::Type& destFactorRgb,
+                    BlendFactor::Type& srcFactorAlpha, BlendFactor::Type& destFactorAlpha ) const;
 
-   /**
-    * @copydoc Dali::Renderer::SetBlendEquation()
-    */
-   void SetBlendEquation( BlendEquation::Type equationRgba );
+  /**
+   * @copydoc Dali::Renderer::SetBlendEquation()
+   */
+  void SetBlendEquation( BlendEquation::Type equationRgba );
 
-   /**
-    * @copydoc Dali::Renderer::SetBlendEquation()
-    */
-   void SetBlendEquation( BlendEquation::Type equationRgb, BlendEquation::Type equationAlpha );
+  /**
+   * @copydoc Dali::Renderer::SetBlendEquation()
+   */
+  void SetBlendEquation( BlendEquation::Type equationRgb, BlendEquation::Type equationAlpha );
 
-   /**
-    * @copydoc Dali::Renderer::GetBlendEquation()
-    */
-   void GetBlendEquation( BlendEquation::Type& equationRgb, BlendEquation::Type& equationAlpha ) const;
+  /**
+   * @copydoc Dali::Renderer::GetBlendEquation()
+   */
+  void GetBlendEquation( BlendEquation::Type& equationRgb, BlendEquation::Type& equationAlpha ) const;
 
-   /**
-    * @copydoc Dali::Renderer::SetIndexedDrawFirstElement
-    */
-   void SetIndexedDrawFirstElement( uint32_t firstElement );
+  /**
+   * @copydoc Dali::Renderer::SetIndexedDrawFirstElement
+   */
+  void SetIndexedDrawFirstElement( uint32_t firstElement );
 
-   /**
-    * @copydoc Dali::Renderer::SetIndexedDrawElementsCount
-    */
-   void SetIndexedDrawElementsCount( uint32_t elementsCount );
+  /**
+   * @copydoc Dali::Renderer::SetIndexedDrawElementsCount
+   */
+  void SetIndexedDrawElementsCount( uint32_t elementsCount );
 
-   /**
-    * @brief Set whether the Pre-multiplied Alpha Blending is required
-    *
-    * @param[in] preMultipled whether alpha is pre-multiplied.
-    */
-   void EnablePreMultipliedAlpha( bool preMultipled );
+  /**
+   * @brief Set whether the Pre-multiplied Alpha Blending is required
+   *
+   * @param[in] preMultipled whether alpha is pre-multiplied.
+   */
+  void EnablePreMultipliedAlpha( bool preMultipled );
 
-   /**
-    * @brief Query whether alpha is pre-multiplied.
-    *
-    * @return True is alpha is pre-multiplied, false otherwise.
-    */
-   bool IsPreMultipliedAlphaEnabled() const;
+  /**
+   * @brief Query whether alpha is pre-multiplied.
+   *
+   * @return True is alpha is pre-multiplied, false otherwise.
+   */
+  bool IsPreMultipliedAlphaEnabled() const;
 
-   /**
-    * @brief Get the scene graph object
-    *
-    * @return the scene object
-    */
-   SceneGraph::Renderer* GetRendererSceneObject();
+  /**
+   * @brief Get the scene graph object
+   *
+   * @return the scene object
+   */
+  const SceneGraph::Renderer& GetRendererSceneObject() const;
 
 public: // Default property extensions from Object
 
@@ -175,11 +175,6 @@ public: // Default property extensions from Object
   virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
 
   /**
-   * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
-   */
-  virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value );
-
-  /**
    * @copydoc Dali::Internal::Object::GetDefaultProperty()
    */
   virtual Property::Value GetDefaultProperty( Property::Index index ) const;
@@ -195,16 +190,6 @@ public: // Default property extensions from Object
    virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType );
 
   /**
-   * @copydoc Dali::Internal::Object::GetPropertyOwner()
-   */
-  virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObject()
-   */
-  virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
-
-  /**
    * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
    */
   virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
@@ -214,22 +199,14 @@ public: // Default property extensions from Object
    */
   virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
 
-  /**
-   * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
-   */
-  virtual int GetPropertyComponentIndex( Property::Index index ) const;
-
 private: // implementation
 
   /**
-   * @brief Default constructor.
+   * @brief Constructor.
+   *
+   * @param sceneObject the scene graph renderer
    */
-  Renderer();
-
-  /**
-   * @brief Initializes the Renderer.
-   */
-  void Initialize();
+  Renderer( const SceneGraph::Renderer* sceneObject );
 
   /**
    * @brief Sets the blend color.
@@ -270,26 +247,26 @@ private: // unimplemented methods
   Renderer& operator=( const Renderer& );
 
 private: // data
-  SceneGraph::Renderer*               mSceneObject;
-  GeometryPtr                         mGeometry;                     ///< Connector that holds the geometry used by this renderer
-  TextureSetPtr                       mTextureSet;                   ///< Connector that holds the texture set used by this renderer
-  ShaderPtr                           mShader;                       ///< Connector that holds the shader used by this renderer
-
-  int                                 mDepthIndex;
-
-  uint32_t                              mIndexedDrawFirstElement;      ///< Offset of first element to draw from bound index buffer
-  uint32_t                              mIndexedDrawElementCount;      ///< Number of elements to draw
-
-  Render::Renderer::StencilParameters mStencilParameters;            ///< Struct containing all stencil related options
-  BlendingOptions                     mBlendingOptions;              ///< Local copy of blending options bitmask
-
-  float                               mOpacity;                      ///< Local copy of the opacity
-  DepthFunction::Type                 mDepthFunction:4;              ///< Local copy of the depth function
-  FaceCullingMode::Type               mFaceCullingMode:3;            ///< Local copy of the mode of face culling
-  BlendMode::Type                     mBlendMode:3;                  ///< Local copy of the mode of blending
-  DepthWriteMode::Type                mDepthWriteMode:3;             ///< Local copy of the depth write mode
-  DepthTestMode::Type                 mDepthTestMode:3;              ///< Local copy of the depth test mode
-  bool                                mPremultipledAlphaEnabled:1;   ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
+
+  GeometryPtr                         mGeometry;                   ///< Intrusive pointer to the geometry used by this renderer
+  TextureSetPtr                       mTextureSet;                 ///< Intrusive pointer to the texture set used by this renderer
+  ShaderPtr                           mShader;                     ///< Intrusive pointer to the shader used by this renderer
+
+  int32_t                             mDepthIndex;
+
+  uint32_t                            mIndexedDrawFirstElement;    ///< Offset of first element to draw from bound index buffer
+  uint32_t                            mIndexedDrawElementCount;    ///< Number of elements to draw
+
+  Render::Renderer::StencilParameters mStencilParameters;          ///< Struct containing all stencil related options
+  BlendingOptions                     mBlendingOptions;            ///< Local copy of blending options bitmask
+
+  float                               mOpacity;                    ///< Local copy of the opacity
+  DepthFunction::Type                 mDepthFunction:4;            ///< Local copy of the depth function
+  FaceCullingMode::Type               mFaceCullingMode:3;          ///< Local copy of the mode of face culling
+  BlendMode::Type                     mBlendMode:3;                ///< Local copy of the mode of blending
+  DepthWriteMode::Type                mDepthWriteMode:3;           ///< Local copy of the depth write mode
+  DepthTestMode::Type                 mDepthTestMode:3;            ///< Local copy of the depth test mode
+  bool                                mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
 };
 
 } // namespace Internal
index 1e670c9..1a7f11f 100644 (file)
@@ -21,7 +21,6 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/object/type-registry.h>
 #include <dali/devel-api/scripting/scripting.h>
-#include <dali/internal/event/common/object-impl-helper.h> // Dali::Internal::ObjectHelper
 #include <dali/internal/event/common/property-helper.h> // DALI_PROPERTY_TABLE_BEGIN, DALI_PROPERTY, DALI_PROPERTY_TABLE_END
 #include <dali/internal/event/common/thread-local-storage.h>
 #include <dali/internal/event/effects/shader-factory.h>
@@ -90,30 +89,34 @@ Property::Value HintString(const Dali::Shader::Hint::Value& hints)
   return Property::Value(s);
 }
 
-
 } // unnamed namespace
 
 ShaderPtr Shader::New( const std::string& vertexShader,
                        const std::string& fragmentShader,
                        Dali::Shader::Hint::Value hints )
 {
-  ShaderPtr shader( new Shader() );
-  shader->Initialize( vertexShader, fragmentShader, hints );
-  return shader;
-}
+  // create scene object first so it's guaranteed to exist for the event side
+  auto sceneObject = new SceneGraph::Shader( hints );
+  OwnerPointer< SceneGraph::Shader > transferOwnership( sceneObject );
+  // pass the pointer to base for message passing
+  ShaderPtr shader( new Shader( sceneObject ) );
+  // transfer scene object ownership to update manager
+  auto&& services = shader->GetEventThreadServices();
+  SceneGraph::UpdateManager& updateManager = services.GetUpdateManager();
+  AddShaderMessage( updateManager, transferOwnership );
 
-const SceneGraph::Shader* Shader::GetShaderSceneObject() const
-{
-  return mSceneObject;
+  services.RegisterObject( shader.Get() );
+  shader->SetShader( vertexShader, fragmentShader, hints );
+
+  return shader;
 }
 
-SceneGraph::Shader* Shader::GetShaderSceneObject()
+const SceneGraph::Shader& Shader::GetShaderSceneObject() const
 {
-  return mSceneObject;
+  return static_cast<const SceneGraph::Shader&>( GetSceneObject() );
 }
 
-void Shader::SetDefaultProperty( Property::Index index,
-                                 const Property::Value& propertyValue )
+void Shader::SetDefaultProperty( Property::Index index, const Property::Value& propertyValue )
 {
   switch(index)
   {
@@ -146,7 +149,7 @@ void Shader::SetDefaultProperty( Property::Index index,
               );
           }
 
-          Initialize(vertex, fragment, hints );
+          SetShader( vertex, fragment, hints );
         }
       }
       else
@@ -158,14 +161,6 @@ void Shader::SetDefaultProperty( Property::Index index,
   }
 }
 
-void Shader::SetSceneGraphProperty( Property::Index index,
-                                    const PropertyMetadata& entry,
-                                    const Property::Value& value )
-{
-  ObjectImplHelper::SetSceneGraphProperty( GetEventThreadServices(), this, index, entry, value );
-  OnPropertySet(index, value);
-}
-
 Property::Value Shader::GetDefaultProperty( Property::Index index ) const
 {
   Property::Value value;
@@ -194,84 +189,26 @@ Property::Value Shader::GetDefaultPropertyCurrentValue( Property::Index index )
   return GetDefaultProperty( index ); // Event-side only properties
 }
 
-const SceneGraph::PropertyOwner* Shader::GetPropertyOwner() const
-{
-  return mSceneObject;
-}
-
-const SceneGraph::PropertyOwner* Shader::GetSceneObject() const
+Shader::Shader( const SceneGraph::Shader* sceneObject )
+: Object( sceneObject ),
+  mShaderData( nullptr )
 {
-  return mSceneObject;
 }
 
-const SceneGraph::PropertyBase* Shader::GetSceneObjectAnimatableProperty( Property::Index index ) const
+void Shader::SetShader( const std::string& vertexSource,
+                        const std::string& fragmentSource,
+                        Dali::Shader::Hint::Value hints )
 {
-  DALI_ASSERT_ALWAYS( IsPropertyAnimatable( index ) && "Property is not animatable" );
-  const SceneGraph::PropertyBase* property = NULL;
-
-  property = ObjectImplHelper::GetRegisteredSceneGraphProperty( this,
-                                                                &Shader::FindAnimatableProperty,
-                                                                &Shader::FindCustomProperty,
-                                                                index );
-
-  if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
-  {
-    DALI_ASSERT_ALWAYS( 0 && "Property is not animatable" );
-  }
-
-  return property;
-}
-
-const PropertyInputImpl* Shader::GetSceneObjectInputProperty( Property::Index index ) const
-{
-  PropertyMetadata* property = NULL;
-
-  if( ( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && // Child properties are also stored as custom properties
-      ( index <= PROPERTY_CUSTOM_MAX_INDEX ) )
-  {
-    property = FindCustomProperty( index );
-  }
-  else if( ( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX ) )
-  {
-    property = FindAnimatableProperty( index );
-  }
-
-  DALI_ASSERT_ALWAYS( property && "property index is invalid" );
-  return property->GetSceneGraphProperty();
-}
-
-int Shader::GetPropertyComponentIndex( Property::Index index ) const
-{
-  return Property::INVALID_COMPONENT_INDEX;
-}
-
-Shader::Shader()
-  : mSceneObject( NULL ),
-    mShaderData( NULL )
-{
-}
-
-void Shader::Initialize(
-  const std::string& vertexSource,
-  const std::string& fragmentSource,
-  Dali::Shader::Hint::Value hints )
-{
-  EventThreadServices& eventThreadServices = GetEventThreadServices();
-  SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
-  mSceneObject = new SceneGraph::Shader( hints );
-
-  OwnerPointer< SceneGraph::Shader > transferOwnership( mSceneObject );
-  AddShaderMessage( updateManager, transferOwnership );
-
-  // Try to load a precompiled shader binary for the source pair:
+  // Try to load a pre-compiled shader binary for the source pair:
   ThreadLocalStorage& tls = ThreadLocalStorage::Get();
   ShaderFactory& shaderFactory = tls.GetShaderFactory();
   size_t shaderHash;
   mShaderData = shaderFactory.Load( vertexSource, fragmentSource, hints, shaderHash );
 
   // Add shader program to scene-object using a message to the UpdateManager
-  SetShaderProgramMessage( updateManager, *mSceneObject, mShaderData, (hints & Dali::Shader::Hint::MODIFIES_GEOMETRY) != 0x0 );
-  eventThreadServices.RegisterObject( this );
+  EventThreadServices& eventThreadServices = GetEventThreadServices();
+  SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
+  SetShaderProgramMessage( updateManager, GetShaderSceneObject(), mShaderData, (hints & Dali::Shader::Hint::MODIFIES_GEOMETRY) != 0x0 );
 }
 
 Shader::~Shader()
@@ -280,7 +217,7 @@ Shader::~Shader()
   {
     EventThreadServices& eventThreadServices = GetEventThreadServices();
     SceneGraph::UpdateManager& updateManager = eventThreadServices.GetUpdateManager();
-    RemoveShaderMessage( updateManager, *mSceneObject);
+    RemoveShaderMessage( updateManager, &GetShaderSceneObject() );
 
     eventThreadServices.UnregisterObject( this );
   }
index 9b01b2a..1e2f9f5 100644 (file)
@@ -54,17 +54,10 @@ public:
                         Dali::Shader::Hint::Value hints );
 
   /**
-   * @brief Get the shader scene object
-   *
-   * @return the shader scene object
-   */
-  const SceneGraph::Shader* GetShaderSceneObject() const;
-
-  /**
    * Retrieve the scene-graph shader added by this object.
    * @return A pointer to the shader.
    */
-  SceneGraph::Shader* GetShaderSceneObject();
+  const SceneGraph::Shader& GetShaderSceneObject() const;
 
 public: // Default property extensions from Object
 
@@ -74,11 +67,6 @@ public: // Default property extensions from Object
   virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
 
   /**
-   * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
-   */
-  virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value );
-
-  /**
    * @copydoc Dali::Internal::Object::GetDefaultProperty()
    */
   virtual Property::Value GetDefaultProperty( Property::Index index ) const;
@@ -88,38 +76,19 @@ public: // Default property extensions from Object
    */
   virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
 
-  /**
-   * @copydoc Dali::Internal::Object::GetPropertyOwner()
-   */
-  virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObject()
-   */
-  virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
-   */
-  virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
-
-  /**
-   * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
-   */
-  virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
+private: // implementation
 
   /**
-   * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
+   * Constructor
+   *
+   * @param sceneObject the scene object
    */
-  virtual int GetPropertyComponentIndex( Property::Index index ) const;
-
-private: // implementation
-  Shader();
+  Shader( const SceneGraph::Shader* sceneObject );
 
   /**
    * Second stage initialization
    */
-  void Initialize( const std::string& vertexShader, const std::string& fragmentShader, Dali::Shader::Hint::Value hints );
+  void SetShader( const std::string& vertexShader, const std::string& fragmentShader, Dali::Shader::Hint::Value hints );
 
 protected:
   /**
@@ -128,12 +97,15 @@ protected:
   virtual ~Shader();
 
 private: // unimplemented methods
-  Shader( const Shader& );
-  Shader& operator=( const Shader& );
+
+  Shader() = delete;
+  Shader( const Shader& ) = delete;
+  Shader& operator=( const Shader& ) = delete;
 
 private:
-  SceneGraph::Shader* mSceneObject;
+
   Internal::ShaderDataPtr mShaderData;
+
 };
 
 } // namespace Internal
index 4376b0f..5854c89 100644 (file)
@@ -74,7 +74,6 @@ internal_src_files = \
   $(internal_src_dir)/event/images/resource-image-impl.cpp \
   $(internal_src_dir)/event/images/native-image-impl.cpp \
   $(internal_src_dir)/event/images/pixel-data-impl.cpp \
-  $(internal_src_dir)/event/object/custom-object-internal.cpp \
   $(internal_src_dir)/event/render-tasks/render-task-impl.cpp \
   $(internal_src_dir)/event/render-tasks/render-task-list-impl.cpp \
   $(internal_src_dir)/event/rendering/frame-buffer-impl.cpp \
index ce7b1c0..ae18f06 100644 (file)
@@ -94,7 +94,7 @@ public:
     mLoopCount(1),
     mAlphaFunction(AlphaFunction::DEFAULT),
     mDisconnectAction(Dali::Animation::BakeFinal),
-    mActive(false),
+    mAnimationPlaying(false),
     mEnabled(true),
     mConnectedToSceneGraph(false),
     mAutoReverseEnabled( false )
@@ -376,16 +376,7 @@ public:
    */
   void SetActive( bool active )
   {
-    mActive = active;
-  }
-
-  /**
-   * Retrieve whether the animator has been set to active or not.
-   * @return The active state.
-   */
-  bool GetActive() const
-  {
-    return mActive;
+    mAnimationPlaying = active;
   }
 
   /**
@@ -447,7 +438,7 @@ protected:
   AlphaFunction mAlphaFunction;
 
   Dali::Animation::EndAction mDisconnectAction;     ///< EndAction to apply when target object gets disconnected from the stage.
-  bool mActive:1;                                   ///< Animator is "active" while it's running.
+  bool mAnimationPlaying:1;                         ///< whether disconnect has been applied while it's running.
   bool mEnabled:1;                                  ///< Animator is "enabled" while its target object is valid and on the stage.
   bool mConnectedToSceneGraph:1;                    ///< True if ConnectToSceneGraph() has been called in update-thread.
   bool mAutoReverseEnabled:1;
@@ -525,13 +516,12 @@ public:
   virtual void PropertyOwnerDisconnected( BufferIndex bufferIndex, PropertyOwner& owner )
   {
     // If we are active, then bake the value if required
-    if ( mActive && mDisconnectAction != Dali::Animation::Discard )
+    if ( mAnimationPlaying && mDisconnectAction != Dali::Animation::Discard )
     {
       // Bake to target-value if BakeFinal, otherwise bake current value
       Update( bufferIndex, ( mDisconnectAction == Dali::Animation::Bake ? mCurrentProgress : 1.0f ), true );
     }
 
-    mActive = false;
     mEnabled = false;
   }
 
@@ -685,13 +675,12 @@ public:
   virtual void PropertyOwnerDisconnected( BufferIndex bufferIndex, PropertyOwner& owner )
   {
     // If we are active, then bake the value if required
-    if ( mActive && mDisconnectAction != Dali::Animation::Discard )
+    if ( mAnimationPlaying && mDisconnectAction != Dali::Animation::Discard )
     {
       // Bake to target-value if BakeFinal, otherwise bake current value
       Update( bufferIndex, ( mDisconnectAction == Dali::Animation::Bake ? mCurrentProgress : 1.0f ), true );
     }
 
-    mActive = false;
     mEnabled = false;
   }
 
@@ -840,7 +829,8 @@ struct AnimateByInteger : public AnimatorFunctionBase
   using AnimatorFunctionBase::operator();
   float operator()(float alpha, const int32_t& property)
   {
-    return truncf(static_cast<float>( property ) + static_cast<float>( mRelative ) * alpha + 0.5f );
+    // integers need to be correctly rounded
+    return roundf(static_cast<float>( property ) + static_cast<float>( mRelative ) * alpha );
   }
 
   int32_t mRelative;
@@ -856,7 +846,8 @@ struct AnimateToInteger : public AnimatorFunctionBase
   using AnimatorFunctionBase::operator();
   float operator()(float alpha, const int32_t& property)
   {
-    return truncf(static_cast<float>( property ) + (static_cast<float>(mTarget - property) * alpha) + 0.5f);
+    // integers need to be correctly rounded
+    return roundf(static_cast<float>( property ) + (static_cast<float>(mTarget - property) * alpha) );
   }
 
   int32_t mTarget;
index 1c834fb..1cb1179 100644 (file)
@@ -105,22 +105,6 @@ namespace SceneGraph
 namespace
 {
 /**
- * Helper to reset animate-able objects to base values
- * @param container to iterate over
- * @param updateBufferIndex to use
- */
-template< class T >
-inline void ResetToBaseValues( OwnerContainer<T*>& container, BufferIndex updateBufferIndex )
-{
-  // Reset animatable properties to base values
-  // use reference to avoid extra copies of the iterator
-  for( auto&& iter : container )
-  {
-    iter->ResetToBaseValues( updateBufferIndex );
-  }
-}
-
-/**
  * Helper to Erase an object from OwnerContainer using discard queue
  * @param container to remove from
  * @param object to remove
@@ -433,10 +417,10 @@ void UpdateManager::AddCamera( OwnerPointer< Camera >& camera )
   mImpl->cameras.PushBack( camera.Release() ); // takes ownership
 }
 
-void UpdateManager::RemoveCamera( const Camera* camera )
+void UpdateManager::RemoveCamera( Camera* camera )
 {
   // Find the camera and destroy it
-  EraseUsingDiscardQueue( mImpl->cameras, const_cast<Camera*>( camera ), mImpl->discardQueue, mSceneGraphBuffers.GetUpdateBufferIndex() );
+  EraseUsingDiscardQueue( mImpl->cameras, camera, mImpl->discardQueue, mSceneGraphBuffers.GetUpdateBufferIndex() );
 }
 
 void UpdateManager::AddObject( OwnerPointer<PropertyOwner>& object )
index e3abdca..7e89944 100644 (file)
@@ -202,7 +202,7 @@ public:
    * Remove a camera from scene
    * @param[in] camera to remove
    */
-  void RemoveCamera( const Camera* camera );
+  void RemoveCamera( Camera* camera );
 
   /**
    * Add a newly created object.
@@ -810,13 +810,13 @@ inline void AddCameraMessage( UpdateManager& manager, OwnerPointer< Camera >& ca
 
 inline void RemoveCameraMessage( UpdateManager& manager, const Camera* camera )
 {
-  typedef MessageValue1< UpdateManager, const Camera* > LocalType;
+  typedef MessageValue1< UpdateManager, Camera* > LocalType;
 
   // Reserve some memory inside the message queue
   uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, camera );
+  new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, const_cast<Camera*>( camera ) );
 }
 
 inline void AddObjectMessage( UpdateManager& manager, OwnerPointer<PropertyOwner>& object )
@@ -831,7 +831,7 @@ inline void AddObjectMessage( UpdateManager& manager, OwnerPointer<PropertyOwner
   new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
 }
 
-inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object )
+inline void RemoveObjectMessage( UpdateManager& manager, const PropertyOwner* object )
 {
   typedef MessageValue1< UpdateManager, PropertyOwner* > LocalType;
 
@@ -839,7 +839,7 @@ inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object )
   uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object );
+  new (slot) LocalType( &manager, &UpdateManager::RemoveObject, const_cast<PropertyOwner*>( object ) );
 }
 
 inline void AddAnimationMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Animation >& animation )
@@ -961,7 +961,7 @@ inline void AddShaderMessage( UpdateManager& manager, OwnerPointer< Shader >& sh
 }
 
 // The render thread can safely change the Shader
-inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader )
+inline void RemoveShaderMessage( UpdateManager& manager, const Shader* shader )
 {
   typedef MessageValue1< UpdateManager, Shader* > LocalType;
 
@@ -969,11 +969,11 @@ inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader )
   uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader );
+  new (slot) LocalType( &manager, &UpdateManager::RemoveShader, const_cast<Shader*>( shader ) );
 }
 
 inline void SetShaderProgramMessage( UpdateManager& manager,
-                                     Shader& shader,
+                                     const Shader& shader,
                                      Internal::ShaderDataPtr shaderData,
                                      bool modifiesGeometry )
 {
@@ -983,7 +983,7 @@ inline void SetShaderProgramMessage( UpdateManager& manager,
   uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, shaderData, modifiesGeometry );
+  new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, const_cast<Shader*>( &shader ), shaderData, modifiesGeometry );
 }
 
 inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& color )
@@ -1057,14 +1057,14 @@ inline void AddRendererMessage( UpdateManager& manager, OwnerPointer< Renderer >
   new (slot) LocalType( &manager, &UpdateManager::AddRenderer, object );
 }
 
-inline void RemoveRendererMessage( UpdateManager& manager, Renderer& object )
+inline void RemoveRendererMessage( UpdateManager& manager, const Renderer& object )
 {
   typedef MessageValue1< UpdateManager, Renderer* > LocalType;
 
   // Reserve some memory inside the message queue
   uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &manager, &UpdateManager::RemoveRenderer, &object );
+  new (slot) LocalType( &manager, &UpdateManager::RemoveRenderer, const_cast<Renderer*>( &object ) );
 }
 
 // The render thread can safely change the Shader
index 813a99a..6f9f71f 100755 (executable)
@@ -286,7 +286,7 @@ void Node::AddRenderer( Renderer* renderer )
   mRenderer.PushBack( renderer );
 }
 
-void Node::RemoveRenderer( Renderer* renderer )
+void Node::RemoveRenderer( const Renderer* renderer )
 {
   RendererContainer::SizeType rendererCount( mRenderer.Size() );
   for( RendererContainer::SizeType i = 0; i < rendererCount; ++i )
index 54b51d1..37887af 100755 (executable)
@@ -206,7 +206,7 @@ public:
    * Remove a renderer from the node
    * @param[in] renderer The renderer to be removed
    */
-  void RemoveRenderer( Renderer* renderer );
+  void RemoveRenderer( const Renderer* renderer );
 
   /*
    * Get the renderer at the given index
@@ -264,6 +264,14 @@ public:
   }
 
   /**
+   * @return true if the node is connected to SceneGraph
+   */
+  bool ConnectedToScene()
+  {
+    return IsRoot() || GetParent();
+  }
+
+  /**
    * Connect a node to the scene-graph.
    * @pre A node cannot be added to itself.
    * @pre The parent node is connected to the scene-graph.
@@ -998,7 +1006,7 @@ inline void SetDrawModeMessage( EventThreadServices& eventThreadServices, const
   new (slot) LocalType( &node, &Node::SetDrawMode, drawMode );
 }
 
-inline void AddRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
+inline void AttachRendererMessage( EventThreadServices& eventThreadServices, const Node& node, const Renderer& renderer )
 {
   typedef MessageValue1< Node, Renderer* > LocalType;
 
@@ -1006,18 +1014,18 @@ inline void AddRendererMessage( EventThreadServices& eventThreadServices, const
   uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &node, &Node::AddRenderer, renderer );
+  new (slot) LocalType( &node, &Node::AddRenderer, const_cast<Renderer*>( &renderer ) );
 }
 
-inline void RemoveRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
+inline void DetachRendererMessage( EventThreadServices& eventThreadServices, const Node& node, const Renderer& renderer )
 {
-  typedef MessageValue1< Node, Renderer* > LocalType;
+  typedef MessageValue1< Node, const Renderer* > LocalType;
 
   // Reserve some memory inside the message queue
   uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &node, &Node::RemoveRenderer, renderer );
+  new (slot) LocalType( &node, &Node::RemoveRenderer, &renderer );
 }
 
 inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Node& node, uint32_t depthIndex )
index dfc59ac..b175fd5 100644 (file)
@@ -42,14 +42,18 @@ RenderTask* RenderTask::New()
 
 RenderTask::~RenderTask()
 {
-  // Remove exclusive flag from source node
-  if( mExclusive )
+  if ( mSourceNode )
   {
-    if( mSourceNode && (this == mSourceNode->GetExclusiveRenderTask() ) )
+    mSourceNode->RemoveObserver( *this );
+    if( mExclusive )
     {
-      mSourceNode->SetExclusiveRenderTask( NULL );
+      mSourceNode->SetExclusiveRenderTask( nullptr );
     }
   }
+  if ( mCameraNode )
+  {
+    mCameraNode->RemoveObserver( *this );
+  }
   if( mRenderSyncTracker )
   {
     mRenderMessageDispatcher->RemoveRenderTracker( *mRenderSyncTracker );
@@ -63,19 +67,27 @@ void RenderTask::Initialize( RenderMessageDispatcher& renderMessageDispatcher )
 
 void RenderTask::SetSourceNode( Node* node )
 {
-  // Remove exclusive flag from the old node, if necessary
-  if ( mSourceNode &&
-       this == mSourceNode->GetExclusiveRenderTask() )
+  // Stop observing the old node (if we were)
+  if ( mSourceNode )
   {
-    mSourceNode->SetExclusiveRenderTask( NULL );
+    mSourceNode->RemoveObserver( *this );
+    if( this == mSourceNode->GetExclusiveRenderTask() )
+    {
+      mSourceNode->SetExclusiveRenderTask( nullptr );
+    }
   }
 
   mSourceNode = node;
 
-  if ( mSourceNode && mExclusive )
+  if ( mSourceNode )
   {
-    mSourceNode->SetExclusiveRenderTask( this );
+    mSourceNode->AddObserver( *this );
+    if( mExclusive )
+    {
+      mSourceNode->SetExclusiveRenderTask( this );
+    }
   }
+  SetActiveStatus();
 }
 
 Node* RenderTask::GetSourceNode() const
@@ -95,7 +107,7 @@ void RenderTask::SetExclusive( bool exclusive )
     }
     else if ( this == mSourceNode->GetExclusiveRenderTask() )
     {
-      mSourceNode->SetExclusiveRenderTask( NULL );
+      mSourceNode->SetExclusiveRenderTask( nullptr );
     }
   }
 }
@@ -107,8 +119,19 @@ bool RenderTask::IsExclusive() const
 
 void RenderTask::SetCamera( Node* cameraNode, Camera* camera )
 {
+  if ( mCameraNode )
+  {
+    mCameraNode->RemoveObserver( *this );
+  }
+
   mCameraNode = cameraNode;
   mCamera = camera;
+
+  if ( mCameraNode )
+  {
+    mCameraNode->AddObserver( *this );
+  }
+  SetActiveStatus();
 }
 
 void RenderTask::SetFrameBuffer( Render::FrameBuffer* frameBuffer )
@@ -198,30 +221,7 @@ uint32_t RenderTask::GetRefreshRate() const
 
 bool RenderTask::ReadyToRender( BufferIndex updateBufferIndex )
 {
-  // If the source node of the render task is invisible we should still render
-  // We want the render task to complete and possible clear colors to happen
-
-  // Check the source node.
-  if( NULL == mSourceNode ||
-      ( !mSourceNode->IsRoot() && NULL == mSourceNode->GetParent() ) )
-  {
-    TASK_LOG_FMT( Debug::General, " Source actor not on stage.  Frame counter: %d\n", mFrameCounter );
-
-    // The source node is missing or disconnected.
-    return false;
-  }
-
-  // Check camera node
-  if( NULL == mCameraNode ||
-      NULL == mCameraNode->GetParent() ||
-      NULL == mCamera )
-  {
-    // The camera node is missing or disconnected.
-    TASK_LOG_FMT(Debug::General, " =F  No Camera  FC:%d\n", mFrameCounter );
-    return false;
-  }
-
-  return true;
+  return mActive;
 }
 
 bool RenderTask::IsRenderRequired()
@@ -341,30 +341,29 @@ uint32_t RenderTask::GetRenderedOnceCounter() const
   return mRenderedOnceCounter;
 }
 
-
 const Matrix& RenderTask::GetViewMatrix( BufferIndex bufferIndex ) const
 {
-  DALI_ASSERT_DEBUG( NULL != mCamera );
+  DALI_ASSERT_DEBUG( nullptr != mCamera );
 
   return mCamera->GetViewMatrix( bufferIndex );
 }
 
 SceneGraph::Camera& RenderTask::GetCamera() const
 {
-  DALI_ASSERT_DEBUG( NULL != mCamera );
+  DALI_ASSERT_DEBUG( nullptr != mCamera );
   return *mCamera;
 }
 
 const Matrix& RenderTask::GetProjectionMatrix( BufferIndex bufferIndex ) const
 {
-  DALI_ASSERT_DEBUG( NULL != mCamera );
+  DALI_ASSERT_DEBUG( nullptr != mCamera );
 
   return mCamera->GetProjectionMatrix( bufferIndex );
 }
 
 void RenderTask::PrepareRenderInstruction( RenderInstruction& instruction, BufferIndex updateBufferIndex )
 {
-  DALI_ASSERT_DEBUG( NULL != mCamera );
+  DALI_ASSERT_DEBUG( nullptr != mCamera );
 
   TASK_LOG(Debug::General);
 
@@ -373,8 +372,8 @@ void RenderTask::PrepareRenderInstruction( RenderInstruction& instruction, Buffe
 
   instruction.Reset( mCamera,
                      GetFrameBuffer(),
-                     viewportSet ? &viewport : NULL,
-                     mClearEnabled ? &GetClearColor( updateBufferIndex ) : NULL );
+                     viewportSet ? &viewport : nullptr,
+                     mClearEnabled ? &GetClearColor( updateBufferIndex ) : nullptr );
 
   if( mRequiresSync &&
       mRefreshRate == Dali::RenderTask::REFRESH_ONCE )
@@ -390,7 +389,7 @@ void RenderTask::PrepareRenderInstruction( RenderInstruction& instruction, Buffe
   else
   {
     // no sync needed, texture FBOs are "ready" the same frame they are rendered to
-    instruction.mRenderTracker = NULL;
+    instruction.mRenderTracker = nullptr;
   }
 }
 
@@ -452,30 +451,62 @@ void RenderTask::SetSyncRequired( bool requiresSync )
   mRequiresSync = requiresSync;
 }
 
+void RenderTask::PropertyOwnerConnected( PropertyOwner& owner )
+{
+  // check if we've gone from inactive to active
+  SetActiveStatus();
+}
+
+void RenderTask::PropertyOwnerDisconnected( BufferIndex /*updateBufferIndex*/, PropertyOwner& owner )
+{
+  mActive = false; // if either source or camera disconnected, we're no longer active
+}
+
+void RenderTask::PropertyOwnerDestroyed( PropertyOwner& owner )
+{
+  if( static_cast<PropertyOwner*>( mSourceNode ) == &owner )
+  {
+    mSourceNode = nullptr;
+  }
+  else if( static_cast<PropertyOwner*>( mCameraNode ) == &owner )
+  {
+    mCameraNode = nullptr;
+  }
+}
 
 RenderTask::RenderTask()
 : mViewportPosition( Vector2::ZERO),
   mViewportSize( Vector2::ZERO),
   mClearColor( Dali::RenderTask::DEFAULT_CLEAR_COLOR ),
-  mRenderMessageDispatcher( NULL ),
-  mRenderSyncTracker( NULL ),
-  mSourceNode( NULL ),
-  mCameraNode( NULL ),
-  mCamera( NULL ),
+  mRenderMessageDispatcher( nullptr ),
+  mRenderSyncTracker( nullptr ),
+  mSourceNode( nullptr ),
+  mCameraNode( nullptr ),
+  mCamera( nullptr ),
   mFrameBuffer(0),
+  mRefreshRate( Dali::RenderTask::DEFAULT_REFRESH_RATE ),
+  mFrameCounter( 0u ),
+  mRenderedOnceCounter( 0u ),
+  mState( (Dali::RenderTask::DEFAULT_REFRESH_RATE == Dali::RenderTask::REFRESH_ALWAYS)
+          ? RENDER_CONTINUOUSLY
+          : RENDER_ONCE_WAITING_FOR_RESOURCES ),
+  mRequiresSync( false ),
+  mActive( false ),
   mWaitingToRender( false ),
   mNotifyTrigger( false ),
   mExclusive( Dali::RenderTask::DEFAULT_EXCLUSIVE ),
   mClearEnabled( Dali::RenderTask::DEFAULT_CLEAR_ENABLED ),
-  mCullMode( Dali::RenderTask::DEFAULT_CULL_MODE ),
-  mState( (Dali::RenderTask::DEFAULT_REFRESH_RATE == Dali::RenderTask::REFRESH_ALWAYS)
-          ? RENDER_CONTINUOUSLY
-          : RENDER_ONCE_WAITING_FOR_RESOURCES ),
-  mRefreshRate( Dali::RenderTask::DEFAULT_REFRESH_RATE ),
-  mFrameCounter( 0u ),
-  mRenderedOnceCounter( 0u ),
-  mRequiresSync( false )
+  mCullMode( Dali::RenderTask::DEFAULT_CULL_MODE )
+{
+}
+
+void RenderTask::SetActiveStatus()
 {
+  // must have a source and camera both connected to scene
+  mActive = ( mSourceNode && mSourceNode->ConnectedToScene() &&
+              mCameraNode && mCameraNode->ConnectedToScene() && mCamera );
+  TASK_LOG_FMT( Debug::General, " Source node(%x) active %d.  Frame counter: %d\n", mSourceNode, mSourceNode && mSourceNode->ConnectedToScene(), mFrameCounter );
+  TASK_LOG_FMT( Debug::General, " Camera node(%x) active %d\n", mCameraNode, mCameraNode && mCameraNode->ConnectedToScene() );
 }
 
 } // namespace SceneGraph
index b8fc825..724681b 100644 (file)
@@ -49,11 +49,11 @@ class RenderMessageDispatcher;
 /**
  * RenderTasks describe how the Dali scene should be rendered.
  */
-class RenderTask : public PropertyOwner
+class RenderTask : public PropertyOwner, public PropertyOwner::Observer
 {
 public:
 
-  enum State
+  enum State : uint8_t
   {
     RENDER_CONTINUOUSLY,               ///< mRefreshRate > 0
     RENDER_ONCE_WAITING_FOR_RESOURCES, ///< mRefreshRate = REFRESH_ONCE
@@ -326,19 +326,35 @@ public:
    */
   void SetSyncRequired( bool requiresSync );
 
+private: // from PropertyOwner::Observer
+
+  /**
+   * @copydoc PropertyOwner::Observer::PropertyOwnerConnected( PropertyOwner& owner )
+   */
+  void PropertyOwnerConnected( PropertyOwner& owner );
+
+  /**
+   * @copydoc PropertyOwner::Observer::PropertyOwnerDisconnected( BufferIndex updateBufferIndex, PropertyOwner& owner )
+   */
+  void PropertyOwnerDisconnected( BufferIndex updateBufferIndex, PropertyOwner& owner );
+
+  /**
+   * @copydoc PropertyOwner::Observer::PropertyOwnerDestroyed( PropertyOwner& owner )
+   */
+  void PropertyOwnerDestroyed( PropertyOwner& owner );
+
 private:
 
+  void SetActiveStatus();
+
   /**
-   * Protected constructor.
+   * Constructor.
    */
   RenderTask();
 
   // Undefined
-  RenderTask(const RenderTask&);
-
-  // Undefined
-  RenderTask& operator=(const RenderTask&);
-
+  RenderTask(const RenderTask&) = delete;
+  RenderTask& operator=(const RenderTask&) = delete;
 
 public: // Animatable Properties
   AnimatableProperty< Vector2 >   mViewportPosition;    ///< viewportPosition
@@ -353,23 +369,24 @@ private:
   SceneGraph::Camera* mCamera;
   Render::FrameBuffer* mFrameBuffer;
 
-  bool mWaitingToRender:1; ///< True when an render once to FBO is waiting
-  bool mNotifyTrigger:1; ///< True if a render once render task has finished renderering
-  bool mExclusive: 1; ///< Whether the render task has exclusive access to the source actor (node in the scene graph implementation).
-  bool mClearEnabled: 1; ///< Whether previous results are cleared.
-  bool mCullMode: 1; ///< Whether renderers should be frustum culled
+  uint32_t mRefreshRate;   ///< REFRESH_ONCE, REFRESH_ALWAYS or render every N frames
+  uint32_t mFrameCounter;  ///< counter for rendering every N frames
+  uint32_t mRenderedOnceCounter;///< Incremented whenever state changes to RENDERED_ONCE_AND_NOTIFIED
 
-  State mState;                     ///< Render state.
-  uint32_t mRefreshRate;        ///< REFRESH_ONCE, REFRESH_ALWAYS or render every N frames
-  uint32_t mFrameCounter;       ///< counter for rendering every N frames
+  State mState;           ///< Render state.
 
-  uint32_t mRenderedOnceCounter;  ///< Incremented whenever state changes to RENDERED_ONCE_AND_NOTIFIED
-  bool mRequiresSync;              ///< Whether sync is needed to track the render
+  bool mRequiresSync:1;   ///< Whether sync is needed to track the render
+  bool mActive:1;         ///< True when the task is active, i.e. has valid source and camera
+  bool mWaitingToRender:1;///< True when an render once to FBO is waiting
+  bool mNotifyTrigger:1;  ///< True if a render once render task has finished renderering
+  bool mExclusive:1;      ///< Whether the render task has exclusive access to the source actor (node in the scene graph).
+  bool mClearEnabled:1;   ///< Whether previous results are cleared.
+  bool mCullMode:1;       ///< Whether renderers should be frustum culled
 
 };
 
 // Messages for RenderTask
-inline void SetFrameBufferMessage( EventThreadServices& eventThreadServices, RenderTask& task, Render::FrameBuffer* frameBuffer )
+inline void SetFrameBufferMessage( EventThreadServices& eventThreadServices, const RenderTask& task, Render::FrameBuffer* frameBuffer )
 {
   typedef MessageValue1< RenderTask, Render::FrameBuffer*> LocalType;
 
@@ -380,7 +397,7 @@ inline void SetFrameBufferMessage( EventThreadServices& eventThreadServices, Ren
   new (slot) LocalType( &task, &RenderTask::SetFrameBuffer, frameBuffer );
 }
 
-inline void SetClearColorMessage( EventThreadServices& eventThreadServices, RenderTask& task, const Vector4& value )
+inline void SetClearColorMessage( EventThreadServices& eventThreadServices, const RenderTask& task, const Vector4& value )
 {
   typedef MessageDoubleBuffered1< RenderTask, Vector4 > LocalType;
 
@@ -402,7 +419,7 @@ inline void BakeClearColorMessage( EventThreadServices& eventThreadServices, con
   new (slot) LocalType( &task, &RenderTask::BakeClearColor, value );
 }
 
-inline void SetClearEnabledMessage( EventThreadServices& eventThreadServices, RenderTask& task, bool enabled )
+inline void SetClearEnabledMessage( EventThreadServices& eventThreadServices, const RenderTask& task, bool enabled )
 {
   typedef MessageValue1< RenderTask, bool > LocalType;
 
@@ -413,7 +430,7 @@ inline void SetClearEnabledMessage( EventThreadServices& eventThreadServices, Re
   new (slot) LocalType( &task, &RenderTask::SetClearEnabled, enabled );
 }
 
-inline void SetCullModeMessage( EventThreadServices& eventThreadServices, RenderTask& task, bool mode )
+inline void SetCullModeMessage( EventThreadServices& eventThreadServices, const RenderTask& task, bool mode )
 {
   typedef MessageValue1< RenderTask, bool > LocalType;
 
@@ -424,7 +441,7 @@ inline void SetCullModeMessage( EventThreadServices& eventThreadServices, Render
   new (slot) LocalType( &task, &RenderTask::SetCullMode, mode );
 }
 
-inline void SetRefreshRateMessage( EventThreadServices& eventThreadServices, RenderTask& task, uint32_t refreshRate )
+inline void SetRefreshRateMessage( EventThreadServices& eventThreadServices, const RenderTask& task, uint32_t refreshRate )
 {
   typedef MessageValue1< RenderTask, uint32_t > LocalType;
 
@@ -435,7 +452,7 @@ inline void SetRefreshRateMessage( EventThreadServices& eventThreadServices, Ren
   new (slot) LocalType( &task, &RenderTask::SetRefreshRate, refreshRate );
 }
 
-inline void SetSourceNodeMessage( EventThreadServices& eventThreadServices, RenderTask& task, const Node* constNode )
+inline void SetSourceNodeMessage( EventThreadServices& eventThreadServices, const RenderTask& task, const Node* constNode )
 {
   // Scene graph thread can destroy this object.
   Node* node = const_cast< Node* >( constNode );
@@ -449,7 +466,7 @@ inline void SetSourceNodeMessage( EventThreadServices& eventThreadServices, Rend
   new (slot) LocalType( &task, &RenderTask::SetSourceNode, node );
 }
 
-inline void SetCameraMessage( EventThreadServices& eventThreadServices, RenderTask& task, const Node* constNode, const Camera* constCamera )
+inline void SetCameraMessage( EventThreadServices& eventThreadServices, const RenderTask& task, const Node* constNode, const Camera* constCamera )
 {
   typedef MessageValue2< RenderTask, Node*, Camera* > LocalType;
 
@@ -462,7 +479,7 @@ inline void SetCameraMessage( EventThreadServices& eventThreadServices, RenderTa
   new (slot) LocalType( &task, &RenderTask::SetCamera, node, camera );
 }
 
-inline void SetExclusiveMessage( EventThreadServices& eventThreadServices, RenderTask& task, bool exclusive )
+inline void SetExclusiveMessage( EventThreadServices& eventThreadServices, const RenderTask& task, bool exclusive )
 {
   typedef MessageValue1< RenderTask, bool > LocalType;
 
@@ -473,7 +490,7 @@ inline void SetExclusiveMessage( EventThreadServices& eventThreadServices, Rende
   new (slot) LocalType( &task, &RenderTask::SetExclusive, exclusive );
 }
 
-inline void SetSyncRequiredMessage(EventThreadServices& eventThreadServices, RenderTask& task, bool requiresSync )
+inline void SetSyncRequiredMessage(EventThreadServices& eventThreadServices, const RenderTask& task, bool requiresSync )
 {
   typedef MessageValue1< RenderTask, bool > LocalType;
 
index 1449f73..57d81a6 100755 (executable)
@@ -463,7 +463,7 @@ private:
 public:
 
   AnimatableProperty< float >  mOpacity;                          ///< The opacity value
-  int                          mDepthIndex;                       ///< Used only in PrepareRenderInstructions
+  int32_t                      mDepthIndex;                       ///< Used only in PrepareRenderInstructions
 
 };
 
@@ -491,7 +491,7 @@ inline void SetGeometryMessage( EventThreadServices& eventThreadServices, const
   new (slot) LocalType( &renderer, &Renderer::SetGeometry, const_cast<Render::Geometry*>(&geometry) );
 }
 
-inline void SetShaderMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, Shader& shader )
+inline void SetShaderMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, const Shader& shader )
 {
   typedef MessageValue1< Renderer, Shader* > LocalType;
 
@@ -499,7 +499,7 @@ inline void SetShaderMessage( EventThreadServices& eventThreadServices, const Re
   uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &renderer, &Renderer::SetShader, &shader );
+  new (slot) LocalType( &renderer, &Renderer::SetShader, const_cast<Shader*>( &shader ) );
 }
 
 inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, int depthIndex )
index da34a19..3dda29c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -82,12 +82,12 @@ void Path::Sample( float progress, Vector3& position, Vector3& tangent ) const
 
 Vector3& Path::GetPoint( size_t index )
 {
-  return GetImplementation(*this).GetPoint(index);
+  return GetImplementation(*this).GetPoint( static_cast<uint32_t>( index ) );
 }
 
 Vector3& Path::GetControlPoint( size_t index )
 {
-  return GetImplementation(*this).GetControlPoint(index);
+  return GetImplementation(*this).GetControlPoint( static_cast<uint32_t>( index ) );
 }
 
 size_t Path::GetPointCount() const
index f5a9171..1b48d5c 100644 (file)
@@ -24,7 +24,6 @@
 #include <dali/public-api/object/property-notification.h>
 #include <dali/internal/event/animation/constraint-impl.h>
 #include <dali/internal/event/common/object-impl.h>
-#include <dali/internal/event/object/custom-object-internal.h>
 #include <dali/integration-api/debug.h>
 
 namespace Dali
@@ -42,7 +41,7 @@ Handle::Handle()
 
 Handle Handle::New()
 {
-  return Handle( Internal::CustomObject::New() );
+  return Handle( Internal::Object::New().Get() );
 }
 
 Handle::~Handle()
@@ -132,7 +131,7 @@ Property::Value Handle::GetProperty( Property::Index index ) const
 
 Property::Value Handle::GetCurrentProperty( Property::Index index ) const
 {
-  return GetImplementation( *this ).GetCurrentProperty( index );
+  return GetImplementation(*this).GetCurrentProperty( index );
 }
 
 void Handle::GetPropertyIndices( Property::IndexContainer& indices ) const
index 8f8359c..555acca 100644 (file)
@@ -50,12 +50,15 @@ RenderTaskList& RenderTaskList::operator=(const RenderTaskList& rhs)
 
 RenderTask RenderTaskList::CreateTask()
 {
-  return GetImplementation(*this).CreateTask();
+  return RenderTask( GetImplementation(*this).CreateTask().Get() );
 }
 
 void RenderTaskList::RemoveTask( RenderTask task )
 {
-  GetImplementation(*this).RemoveTask( task );
+  if( task ) // don't crash if called with empty task handle
+  {
+    GetImplementation(*this).RemoveTask( GetImplementation( task ) );
+  }
 }
 
 uint32_t RenderTaskList::GetTaskCount() const
@@ -65,7 +68,7 @@ uint32_t RenderTaskList::GetTaskCount() const
 
 RenderTask RenderTaskList::GetTask( uint32_t index ) const
 {
-  return GetImplementation(*this).GetTask( index );
+  return RenderTask( GetImplementation(*this).GetTask( index ).Get() );
 }
 
 RenderTaskList::RenderTaskList( Internal::RenderTaskList* internal )
index 099a0ad..1e70040 100644 (file)
@@ -164,19 +164,12 @@ RenderTask::ScreenToFrameBufferFunction RenderTask::GetScreenToFrameBufferFuncti
 
 void RenderTask::SetScreenToFrameBufferMappingActor( Dali::Actor mappingActor )
 {
-  // NULL handle is allowed
-  Internal::Actor* actorImpl( NULL );
-  if ( mappingActor )
-  {
-    actorImpl = &GetImplementation( mappingActor );
-  }
-
-  GetImplementation(*this).SetScreenToFrameBufferMappingActor( actorImpl );
+  GetImplementation(*this).SetScreenToFrameBufferMappingActor( mappingActor );
 }
 
 Dali::Actor RenderTask::GetScreenToFrameBufferMappingActor() const
 {
-  return Dali::Actor(GetImplementation(*this).GetScreenToFrameBufferMappingActor());
+  return GetImplementation(*this).GetScreenToFrameBufferMappingActor();
 }
 
 void RenderTask::SetViewportPosition( Vector2 position )
index e894e30..11458e1 100644 (file)
@@ -64,8 +64,7 @@ void Renderer::SetGeometry( Geometry& geometry )
 
 Geometry Renderer::GetGeometry() const
 {
-  Internal::Geometry* geometryPtr( GetImplementation(*this).GetGeometry() );
-  return Dali::Geometry( geometryPtr );
+  return Dali::Geometry( GetImplementation(*this).GetGeometry().Get() );
 }
 
 void Renderer::SetTextures( TextureSet& textureSet )
@@ -76,8 +75,7 @@ void Renderer::SetTextures( TextureSet& textureSet )
 
 TextureSet Renderer::GetTextures() const
 {
-  Internal::TextureSet* textureSet( GetImplementation(*this).GetTextures() );
-  return Dali::TextureSet( textureSet );
+  return Dali::TextureSet( GetImplementation(*this).GetTextures().Get() );
 }
 
 void Renderer::SetShader( Shader& shader )
@@ -88,8 +86,7 @@ void Renderer::SetShader( Shader& shader )
 
 Shader Renderer::GetShader() const
 {
-  Internal::Shader* shaderPtr( GetImplementation(*this).GetShader() );
-  return Dali::Shader( shaderPtr );
+  return Dali::Shader( GetImplementation(*this).GetShader().Get() );
 }
 
 Renderer::Renderer( Internal::Renderer* pointer )