mirror of
https://github.com/rive-app/rive-cpp.git
synced 2026-01-18 21:21:17 +01:00
fix(UAT): only trigger callback when instance is created from scripting (#11283) 7564ef1fcb
Co-authored-by: hernan <hernan@rive.app>
This commit is contained in:
@@ -1 +1 @@
|
||||
f32a23806c0ba3bab2eb697ff29bfb30471aef81
|
||||
7564ef1fcba0c6b2c387c52734c5590774c81f60
|
||||
|
||||
@@ -277,7 +277,7 @@ private:
|
||||
uint32_t findViewModelId(ViewModel* search) const;
|
||||
#ifdef WITH_RIVE_TOOLS
|
||||
ViewModelInstanceCreated m_viewmodelInstanceCreatedCallback = nullptr;
|
||||
bool m_triggerViewModelCreatedCallback = true;
|
||||
bool m_triggerViewModelCreatedCallback = false;
|
||||
#endif
|
||||
};
|
||||
} // namespace rive
|
||||
|
||||
@@ -27,6 +27,9 @@ public:
|
||||
ViewModelInstance* instance(const std::string& name);
|
||||
rcp<ViewModelInstance> createInstance();
|
||||
void file(File* value) { m_file = value; };
|
||||
#ifdef WITH_RIVE_TOOLS
|
||||
File* file() { return m_file; };
|
||||
#endif
|
||||
ViewModelInstance* defaultInstance();
|
||||
size_t instanceCount() const;
|
||||
std::vector<ViewModelProperty*> properties() { return m_Properties; }
|
||||
|
||||
@@ -233,7 +233,13 @@ int ScriptedViewModel::instance(lua_State* L)
|
||||
{
|
||||
if (m_viewModel)
|
||||
{
|
||||
#ifdef WITH_RIVE_TOOLS
|
||||
m_viewModel->file()->triggerViewModelCreatedCallback(true);
|
||||
#endif
|
||||
auto instance = m_viewModel->createInstance();
|
||||
#ifdef WITH_RIVE_TOOLS
|
||||
m_viewModel->file()->triggerViewModelCreatedCallback(false);
|
||||
#endif
|
||||
lua_newrive<ScriptedViewModel>(L, L, m_viewModel, instance);
|
||||
}
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user