Animation callbacks now pass (target, property, value) instead of (None, None)

- Add convertDrawableToPython() and convertEntityToPython() helper functions
- Add animationValueToPython() to convert AnimationValue to Python objects
- Rewrite triggerCallback() to pass meaningful data:
  - target: The animated Frame/Sprite/Grid/Entity/etc.
  - property: String property name like "x", "opacity", "fill_color"
  - final_value: float, int, tuple (for colors/vectors), or string
- Update test_animation_callback_simple.py for new signature

closes #229

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John McCardle 2026-01-28 17:35:47 -05:00
commit e14f3cb9fc
2 changed files with 237 additions and 14 deletions

View file

@ -10,11 +10,13 @@ print("=" * 30)
# Global state to track callback
callback_count = 0
def my_callback(anim, target):
# #229 - Animation callbacks now receive (target, property, value) instead of (anim, target)
def my_callback(target, prop, value):
"""Simple callback that prints when animation completes"""
global callback_count
callback_count += 1
print(f"Animation completed! Callback #{callback_count}")
print(f" Target: {type(target).__name__}, Property: {prop}, Value: {value}")
# Create scene
callback_demo = mcrfpy.Scene("callback_demo")