Skip to content

Commit

Permalink
do not exclude proxies from drawables list
Browse files Browse the repository at this point in the history
we had an optimization where we would exclude drawable proxies from the drawables list if they had nothing to draw.
But listeners may make use of those proxies, so we can't remove them from the list of drawables.

Diffs=
d30f3e3ca6 do not exclude proxies from drawables list (#8762)

Co-authored-by: hernan <hernan@rive.app>
  • Loading branch information
bodymovin and bodymovin committed Dec 17, 2024
1 parent 914d487 commit 2107b55
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b9773680e341b946fa06d046cfeeda8f97555645
d30f3e3ca6175e5f0bc7f029f6acf7de08d18355
4 changes: 4 additions & 0 deletions include/rive/drawable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class Drawable : public DrawableBase
DrawableFlag::Opaque) == DrawableFlag::Opaque;
}

virtual bool isProxy() { return false; }

bool isChildOfLayout(LayoutComponent* layout);

StatusCode onAddedDirty(CoreContext* context) override;
Expand Down Expand Up @@ -86,6 +88,8 @@ class DrawableProxy : public Drawable

Core* hitTest(HitInfo*, const Mat2D&) override { return nullptr; }

bool isProxy() override { return true; }

ProxyDrawing* proxyDrawing() const { return m_proxyDrawing; }
};
} // namespace rive
Expand Down
3 changes: 1 addition & 2 deletions src/animation/state_machine_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1293,8 +1293,7 @@ StateMachineInstance::StateMachineInstance(const StateMachine* machine,
{
continue;
}
if (hittable->is<LayoutComponent>() ||
hittable->is<DrawableProxy>())
if (hittable->is<LayoutComponent>() || hittable->isProxy())
{
auto component = hittable->as<Drawable>();
HitLayout* hitLayout;
Expand Down
14 changes: 4 additions & 10 deletions src/artboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,9 @@ StatusCode Artboard::initialize()
// child of the layout, so we insert a proxy before it
do
{
if (currentLayout->clip() || currentLayout->hasShapePaints())
{
m_Drawables.insert(m_Drawables.begin() + i,
currentLayout->proxy());
i += 1;
}
m_Drawables.insert(m_Drawables.begin() + i,
currentLayout->proxy());
i += 1;
layouts.pop_back();
if (!layouts.empty())
{
Expand All @@ -364,10 +361,7 @@ StatusCode Artboard::initialize()
while (!layouts.empty())
{
auto layout = layouts.back();
if (layout->clip() || layout->hasShapePaints())
{
m_Drawables.push_back(layout->proxy());
}
m_Drawables.push_back(layout->proxy());
layouts.pop_back();
}

Expand Down

0 comments on commit 2107b55

Please sign in to comment.