diff --git a/.rive_head b/.rive_head index 0b7e2bba..bc473b5b 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -bbc2bba5b013552e946e505d5f9445d6fe0b129f +432e7ae6ca80109e6f49a776cd639a0b4ec99ab9 diff --git a/include/rive/artboard.hpp b/include/rive/artboard.hpp index 7113e571..866d931b 100644 --- a/include/rive/artboard.hpp +++ b/include/rive/artboard.hpp @@ -44,7 +44,7 @@ class SMINumber; class SMITrigger; #ifdef WITH_RIVE_TOOLS -typedef void (*ArtboardCallback)(Artboard*); +typedef void (*ArtboardCallback)(void*); #endif class Artboard : public ArtboardBase, public CoreContext @@ -376,6 +376,7 @@ class Artboard : public ArtboardBase, public CoreContext ArtboardCallback m_layoutDirtyCallback = nullptr; public: + void* callbackUserData; void onLayoutChanged(ArtboardCallback callback) { m_layoutChangedCallback = callback; } void onLayoutDirty(ArtboardCallback callback) { m_layoutDirtyCallback = callback; } #endif diff --git a/src/artboard.cpp b/src/artboard.cpp index 498360c1..a6ee8585 100644 --- a/src/artboard.cpp +++ b/src/artboard.cpp @@ -35,7 +35,12 @@ using namespace rive; -Artboard::Artboard() {} +Artboard::Artboard() +{ +#ifdef WITH_RIVE_TOOLS + callbackUserData = this; +#endif +} Artboard::~Artboard() { @@ -511,7 +516,7 @@ void Artboard::propagateSize() #ifdef WITH_RIVE_TOOLS if (m_layoutChangedCallback != nullptr) { - m_layoutChangedCallback(this); + m_layoutChangedCallback(callbackUserData); } #endif } @@ -687,7 +692,7 @@ void Artboard::markLayoutDirty(LayoutComponent* layoutComponent) #ifdef WITH_RIVE_TOOLS if (m_dirtyLayout.empty() && m_layoutDirtyCallback != nullptr) { - m_layoutDirtyCallback(this); + m_layoutDirtyCallback(callbackUserData); } #endif m_dirtyLayout.insert(layoutComponent);