{
// The default plugin name
const char* DEFAULT_OBJECT_NAME("libdali2-vector-animation-renderer-plugin.so");
+// The rive animation plugin name
+const char* RIVE_OBJECT_NAME("libdali2-rive-animation-renderer-plugin.so");
} // namespace
{
mSharedObjectName = DEFAULT_OBJECT_NAME;
}
-
- Initialize();
}
VectorAnimationRendererPluginProxy::~VectorAnimationRendererPluginProxy()
}
}
-void VectorAnimationRendererPluginProxy::Initialize()
+void VectorAnimationRendererPluginProxy::Initialize(AnimationFormat format)
{
+ // initialization should be once
+ if(mPlugin)
+ {
+ return;
+ }
+
+ if(format == AnimationFormat::RIVE)
+ {
+ // for Rive
+ mSharedObjectName = RIVE_OBJECT_NAME;
+ }
+ else
+ {
+ // for Json
+ mSharedObjectName = DEFAULT_OBJECT_NAME;
+ }
+
mLibHandle = dlopen(mSharedObjectName.c_str(), RTLD_LAZY);
char* error = dlerror();
bool VectorAnimationRendererPluginProxy::Load(const std::string& url)
{
+ AnimationFormat format;
+ std::string extensionName = url.substr(url.find_last_of(".") + 1);
+ if(extensionName == "riv")
+ {
+ format = AnimationFormat::RIVE;
+ }
+ else
+ {
+ format = AnimationFormat::JSON;
+ }
+
+ Initialize(format);
+
if(mPlugin)
{
return mPlugin->Load(url);
private:
/**
+ * Vector Animation formats.
+ */
+ enum class AnimationFormat
+ {
+ NONE = 0,
+ JSON,
+ RIVE
+ };
+
+ /**
* Dynamically loads the plugin.
*/
- void Initialize();
+ void Initialize(AnimationFormat format);
private:
using CreateVectorAnimationRendererFunction = Dali::VectorAnimationRendererPlugin* (*)();