[Bugfix] Caption Python property setters don't call markDirty() #289
Labels
No labels
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
priority:tier4-deferred
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:procgen
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
john/McRogueFace#289
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
Caption has two code paths for setting properties. The animation/C++ path (
setProperty()) correctly callsmarkDirty(). The Pythontp_getsetsetter path does not.Affected setters (UICaption.cpp)
set_text()text.setString(...)set_color_member()text.setFillColor(...)/text.setOutlineColor(...)set_float_member()text.setOutlineThickness(...)/text.setCharacterSize(...)set_vec_member()text.setPosition(...)Meanwhile, the
setProperty()path (line 580+) callsmarkDirty()for every single property. This is the path used bycap.animate(...).Contrast with UIFrame
UIFrame::set_color_member()(line 371-422) does callself->data->markDirty(). Soframe.fill_color = Color(...)propagates dirty flags correctly, butcaption.fill_color = Color(...)does not. Same property name, sibling widget types, different correctness.Contrast with UISprite, UICircle, UILine, UIArc
These types use the unified
setProperty()dispatch throughUIDrawable::set_float_member()base class for x/y, but their type-specific setters (in their respectivesetProperty()methods) all callmarkDirty(). Caption's tp_getset setters are the outlier — they bypasssetProperty()entirely and go straight to SFML calls.Reproduction
Note on x/y setters
Caption's
xandyproperties useUIDrawable::set_float_member()(the base class), which callsdrawable->onPositionChanged(). Caption'sonPositionChanged()(line 162-166) syncs the SFML text position but does not callmarkDirty()ormarkCompositeDirty(). This means moving a Caption within a cached Frame also doesn't invalidate the cache.Fix
Add
self->data->markDirty()(or the appropriatemarkContentDirty()/markCompositeDirty()) to each setter. For position changes,markCompositeDirty()is sufficient (texture content unchanged, just position). For content changes (text, color, font_size, outline), usemarkDirty()/markContentDirty().Impact
Same as #288 — only manifests with
clip_children=Trueorcache_subtree=Trueon a parent Frame. Combined with #288, these two bugs make Frame render caching appear completely broken for any dynamic content.