Pass transform events to children of containers.

This makes it possible of the children of containers to respond
to a button changing state differenty. Fixes #4578.
This commit is contained in:
Tom Rothamel
2024-01-06 18:47:34 -05:00
parent 7dc7184fdb
commit e19a29f20a
5 changed files with 31 additions and 1 deletions
+1
View File
@@ -304,6 +304,7 @@ init -1100 python:
config.drag_group_add_top = False
config.transitions_use_child_placement = True
config.interpolate_exprs = False
config.containers_pass_transform_events = False
# The version of Ren'Py this script is intended for, or
# None if it's intended for the current version.
+3
View File
@@ -1433,6 +1433,9 @@ defer_tl_scripts = False
# Should transitions take placement from child displayables?
transitions_use_child_placement = True
# Should containiers pass transform events to their children?
containers_pass_transform_events = True
del os
del collections
+12
View File
@@ -131,6 +131,18 @@ class Container(renpy.display.displayable.Displayable):
super(Container, self).__init__(**properties)
def set_transform_event(self, event):
"""
Sets the transform event of this displayable to event.
"""
super(Container, self).set_transform_event(event)
if renpy.config.containers_pass_transform_events:
for i in self.children:
i.set_transform_event(event)
def _handles_event(self, event):
for i in self.children:
if i._handles_event(event):
+5
View File
@@ -370,6 +370,11 @@ projects from the command line.
Other Changes
-------------
Containers (including fixed, hbox, vbox, side, grid, viewport, and vpgrid) now
pass transform events (like hover and idle) to their children, meaning that
children of a button can have their own transforms to respond to those
events.
:func:`persistent._clear` will re-run default statements that update
persistent variables, making it possible to avoid persistent becoming
entirely de-initialized.
+10 -1
View File
@@ -172,8 +172,17 @@ the old and new children provide the same placement information.
To disable this, add to your game::
define config.transition_use_child_placement = false
define config.transition_use_child_placement = False
**Containers pass Transform Events**
Containers (including fixed, hbox, vbox, side, grid, viewport, and vpgrid) now
pass transform events (like hover and idle) to their children, meaning that
children of a button can have their own transforms to respond to those
events.
To disable this, add to your game::
define containers_pass_transform_events = True
.. _incompatible-8.1.1: