ConditionSwitch() will override child displayable position properties with the previous child's position properties

Bug #680266 reported by Spiky Caterpillar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ren'Py
Fix Released
Medium
Tom Rothamel

Bug Description

The following code would be expected to display 'Right' on the right and 'Left' on the left; instead, the first time 'Left' is displayed, it will be on the right side, as a result of the fact that ConditionSwitches call update_state before rendering their children.

    image test = ConditionSwitch('pos=="right"',Text('Right',xalign=1.0,yalign=0.5),'pos=="left"',Text('Left',xalign=0.0,yalign=0.5))
    $ pos = 'right'
    show test
    "Test on right"
    $ pos = 'left'
    "Test should be on left."
    "Test should be on left again."

Moving the call to self.update_state() in renpy.display.motion.Transform.render() after the child displayable is rendered fixes the bug; I haven't noticed the change causing any new problems, but I haven't tested extensively.

Revision history for this message
Spiky Caterpillar (spikycaterpillar) wrote :
Revision history for this message
Spiky Caterpillar (spikycaterpillar) wrote :

That first patch causes a traceback on at least some ATL animations (for example,

    show expression im.Composite((1600,600),
        (0,0),current_cell.background(),
        (800,0),current_cell.background(new_facing)) behind border:
        ypos 32
        xpos 208
        anchor (0,0)
        linear .5 xpos (208-800)

since apparently the child is first set inside update_state. A possibly better patch is attached.

Revision history for this message
Tom Rothamel (renpytom) wrote :

Fixed in the dev branch, aiming at a slightly more fundamental issue.

Changed in renpy:
milestone: none → 6.12
importance: Undecided → Medium
assignee: nobody → renpytom (renpytom)
status: New → Fix Committed
Tom Rothamel (renpytom)
Changed in renpy:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.