(Vector) Add AddPropertyValueCallback method 49/278249/4
authorHeeyong Song <heeyong.song@samsung.com>
Mon, 18 Jul 2022 06:10:59 +0000 (15:10 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Thu, 21 Jul 2022 09:51:07 +0000 (18:51 +0900)
Change-Id: I1d57f6d144416dd60b80d5db0edc40f73d229514

dali/devel-api/adaptor-framework/vector-animation-renderer-plugin.h
dali/devel-api/adaptor-framework/vector-animation-renderer.cpp
dali/devel-api/adaptor-framework/vector-animation-renderer.h
dali/internal/vector-animation/common/vector-animation-renderer-impl.cpp
dali/internal/vector-animation/common/vector-animation-renderer-impl.h
dali/internal/vector-animation/common/vector-animation-renderer-plugin-proxy.cpp
dali/internal/vector-animation/common/vector-animation-renderer-plugin-proxy.h

index 8569640..6c96e76 100644 (file)
@@ -36,6 +36,7 @@ class VectorAnimationRendererPlugin
 {
 public:
   using UploadCompletedSignalType = Dali::VectorAnimationRenderer::UploadCompletedSignalType;
+  using VectorProperty            = Dali::VectorAnimationRenderer::VectorProperty;
 
   /**
    * @brief Constructor
@@ -138,6 +139,30 @@ public:
   virtual void InvalidateBuffer() = 0;
 
   /**
+   * @brief Sets property value for the specified keyPath. This keyPath can resolve to multiple contents.
+   * In that case, the callback's value will apply to all of them.
+   *
+   * @param[in] keyPath The key path used to target a specific content or a set of contents that will be updated.
+   * @param[in] property The property to set.
+   * @param[in] callback The callback what gets called every time the animation is rendered.
+   * @param[in] id The Id to specify the callback. It should be unique and will be passed when the callback is called.
+   *
+   * @note A callback of the following type may be used:
+   * id  The id to specify the callback.
+   * property The property that represent what you are trying to change.
+   * frameNumber The current frame number.
+   * It returns a Property::Value to set according to the property type.
+   *
+   * @code
+   *   Property::Value MyFunction(int32_t id, VectorProperty property, uint32_t frameNumber);
+   * @endcode
+   *
+   * The keypath should conatin object names separated by (.) and can handle globe(**) or wildchar(*).
+   * Ownership of the callback is passed onto this class.
+   */
+  virtual void AddPropertyValueCallback(const std::string& keyPath, VectorProperty property, CallbackBase* callback, int32_t id) = 0;
+
+  /**
    * @brief Connect to this signal to be notified when the texture upload is completed.
    *
    * @return The signal to connect to.
index 47d6368..5663e81 100644 (file)
@@ -108,6 +108,11 @@ void VectorAnimationRenderer::InvalidateBuffer()
   GetImplementation(*this).InvalidateBuffer();
 }
 
+void VectorAnimationRenderer::AddPropertyValueCallback(const std::string& keyPath, VectorProperty property, CallbackBase* callback, int32_t id)
+{
+  GetImplementation(*this).AddPropertyValueCallback(keyPath, property, callback, id);
+}
+
 VectorAnimationRenderer::UploadCompletedSignalType& VectorAnimationRenderer::UploadCompletedSignal()
 {
   return GetImplementation(*this).UploadCompletedSignal();
index 956dc94..37cb214 100644 (file)
@@ -46,6 +46,20 @@ class VectorAnimationRenderer;
 class DALI_ADAPTOR_API VectorAnimationRenderer : public BaseHandle
 {
 public:
+  enum class VectorProperty
+  {
+    FILL_COLOR,         ///< Fill color of the object, Type Property::VECTOR3
+    FILL_OPACITY,       ///< Fill opacity of the object, Type Property::FLOAT
+    STROKE_COLOR,       ///< Stroke color of the object, Type Property::VECTOR3
+    STROKE_OPACTY,      ///< Stroke opacity of the object, Type Property::FLOAT
+    STROKE_WIDTH,       ///< Stroke width of the object, Type Property::FLOAT
+    TRANSFORM_ANCHOR,   ///< Transform anchor of the Layer and Group object, Type Property::VECTOR2
+    TRANSFORM_POSITION, ///< Transform position of the Layer and Group object, Type Property::VECTOR2
+    TRANSFORM_SCALE,    ///< Transform scale of the Layer and Group object, Type Property::VECTOR2 [0..100]
+    TRANSFORM_ROTATION, ///< Transform rotation of the Layer and Group object, Type Property::FLOAT [0..360] in degrees
+    TRANSFORM_OPACITY   ///< Transform opacity of the Layer and Group object, Type Property::FLOAT
+  };
+
   /// @brief UploadCompleted signal type.
   using UploadCompletedSignalType = Signal<void()>;
 
@@ -168,6 +182,30 @@ public:
    */
   void InvalidateBuffer();
 
+  /**
+   * @brief Sets property value for the specified keyPath. This keyPath can resolve to multiple contents.
+   * In that case, the callback's value will apply to all of them.
+   *
+   * @param[in] keyPath The key path used to target a specific content or a set of contents that will be updated.
+   * @param[in] property The property to set.
+   * @param[in] callback The callback that gets called every time the animation is rendered.
+   * @param[in] id The Id to specify the callback. It should be unique and will be passed when the callback is called.
+   *
+   * @note A callback of the following type may be used:
+   * id  The id to specify the callback.
+   * property The property that represent what you are trying to change.
+   * frameNumber The current frame number.
+   * It returns a Property::Value to set according to the property type.
+   *
+   * @code
+   *   Property::Value MyFunction(int32_t id, VectorProperty property, uint32_t frameNumber);
+   * @endcode
+   *
+   * The keypath should contain object names separated by (.) and can handle globe(**) or wildchar(*).
+   * Ownership of the callback is passed onto this class.
+   */
+  void AddPropertyValueCallback(const std::string& keyPath, VectorProperty property, CallbackBase* callback, int32_t id);
+
 public: // Signals
   /**
    * @brief Connect to this signal to be notified when the texture upload is completed.
index 0116570..3ff18f2 100644 (file)
@@ -111,6 +111,11 @@ void VectorAnimationRenderer::InvalidateBuffer()
   mPlugin.InvalidateBuffer();
 }
 
+void VectorAnimationRenderer::AddPropertyValueCallback(const std::string& keyPath, Dali::VectorAnimationRenderer::VectorProperty property, CallbackBase* callback, int32_t id)
+{
+  mPlugin.AddPropertyValueCallback(keyPath, property, callback, id);
+}
+
 Dali::VectorAnimationRenderer::UploadCompletedSignalType& VectorAnimationRenderer::UploadCompletedSignal()
 {
   return mPlugin.UploadCompletedSignal();
index 1924cf4..b9522cb 100644 (file)
@@ -103,6 +103,11 @@ public:
   void InvalidateBuffer();
 
   /**
+   * @copydoc Dali::VectorAnimationRenderer::AddPropertyValueCallback()
+   */
+  void AddPropertyValueCallback(const std::string& keyPath, Dali::VectorAnimationRenderer::VectorProperty property, CallbackBase* callback, int32_t id);
+
+  /**
    * @copydoc Dali::VectorAnimationRenderer::UploadCompletedSignal()
    */
   Dali::VectorAnimationRenderer::UploadCompletedSignalType& UploadCompletedSignal();
index d5d0f0f..000c319 100644 (file)
@@ -195,6 +195,14 @@ void VectorAnimationRendererPluginProxy::InvalidateBuffer()
   }
 }
 
+void VectorAnimationRendererPluginProxy::AddPropertyValueCallback(const std::string& keyPath, Dali::VectorAnimationRenderer::VectorProperty property, CallbackBase* callback, int32_t id)
+{
+  if(mPlugin)
+  {
+    mPlugin->AddPropertyValueCallback(keyPath, property, callback, id);
+  }
+}
+
 VectorAnimationRendererPlugin::UploadCompletedSignalType& VectorAnimationRendererPluginProxy::UploadCompletedSignal()
 {
   if(mPlugin)
index c71dc87..6537256 100644 (file)
@@ -99,6 +99,11 @@ public:
   void InvalidateBuffer();
 
   /**
+   * @copydoc Dali::VectorAnimationRendererPlugin::AddPropertyValueCallback()
+   */
+  void AddPropertyValueCallback(const std::string& keyPath, Dali::VectorAnimationRenderer::VectorProperty property, CallbackBase* callback, int32_t id);
+
+  /**
    * @copydoc Dali::VectorAnimationRendererPlugin::UploadCompletedSignal()
    */
   VectorAnimationRendererPlugin::UploadCompletedSignalType& UploadCompletedSignal();