Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Show/Hide Events for Widgets Inside hbox #5417

Open
Komisari opened this issue Mar 14, 2024 · 3 comments
Open

Inconsistent Show/Hide Events for Widgets Inside hbox #5417

Komisari opened this issue Mar 14, 2024 · 3 comments

Comments

@Komisari
Copy link

I am experiencing an issue with the show/hide events of widgets, specifically instances of Blueprints_MainButton, when they are placed inside containers in a screen. The widgets outside of the hbox correctly trigger show/hide events, but those inside do not.

Also, children that has Transforms inside of CDD's doesn't trigger show/hide events when appearing onscreen. I will talk about those later.

screen blueprints_screen_intro():
    zorder 1

    default first_box = Blueprints_MainButton("blueprints",delay=1)
    default second_box = Blueprints_MainButton("gear",delay=2)
    default third_box = Blueprints_MainButton("leave",small=True,delay=3)

    add third_box at Blueprints_MainButton_Anim(third_box.delay,third_box.size)
    hbox:
        xpos 775
        ycenter .5
        spacing 27

        add first_box at Blueprints_MainButton_Anim(first_box.delay,first_box.size)
        add second_box at Blueprints_MainButton_Anim(second_box.delay,second_box.size)

Expected Behavior:

  • All instances of Blueprints_MainButton, regardless of their position (inside or outside the hbox), should trigger show/hide events defined in the Blueprints_MainButton_Anim transform.

Actual Behavior:

  • The third_box, placed outside the hbox, correctly triggers the show/hide events.
  • first_box and second_box, placed inside the hbox, do not trigger show/hide events.
  • When elements are moved outside of the hbox, they correctly trigger the events, indicating that the issue is isolated to widgets inside the hbox.
  • Other events like hover and idle work as expected for all widgets, suggesting that the issue is specific to show/hide events.

Additional Context:

  • Blueprints_MainButton are CDDs.
  • The expected functionality is for these widgets to consistently trigger show/hide animations, irrespective of their placement in the screen's hierarchy.

Attempted Solutions:

  • Swapping widgets between inside and outside of the hbox confirms that the issue is related to their placement.
  • I even tried to "encapsulate" everything inside a showif True:, expecting to somehow trigger it, but only made everything inside the showif NOT trigger any show/hide events. Inside the hbox or not.
  • Maybe this was CDD problem so I created a Solid() with a simple Transform inside a Fixed. The show/hide animation didn't trigger, too. But it did outside the Fixed, so this is not a hbox specifically problem.

Additional CDD problem

Children with Transforms inside a CDD correctly trigger idle/hover and other events, but it doesn't trigger show/hide when appearing on a screen or showing it.

# Rest of the code here
self.fixed = At(Button(
                fxd,
                action=self.action,
                xysize=self.size,
            ),Blueprints_MainButton_Anim(self.delay,self.size))

            renpy.redraw(self,0)


def render(self, width, height, st, at):
    render = renpy.Render(*self.size)
    render.place(self.fixed)
    return render

This was a problem I had for quite some time. I "kinda" made myself a workaround;

self.fixed = At(Button(
                fxd,
                action=self.action,
                xysize=self.size,
            ),Blueprints_MainButton_Anim(self.delay,self.size))

            renpy.redraw(self,0)
            self.appear()

        def appear(self):
            self.fixed.set_transform_event("show")

        def render(self, width, height, st, at):
            render = renpy.Render(*self.size)
            render.place(self.fixed)
            return render

Once everything is created, I draw the CDD and then set the transform event to "show" or "hide" when I have to hide it.

Going back to the children inside containers not triggering show/hide. I think that's new. I don't remember having this problem before.

I'm sorry if this submit is a mess, it's my first time doing something like this, I hope it helps.

@renpytom
Copy link
Member

Blueprints_MainButton isn't part of Ren'Py. Is this a game mod?

@Elckarow
Copy link
Contributor

displayables inside containers don't recieve transform events (outside of those related to focus like hover, idle, etc...)

@Komisari
Copy link
Author

Komisari commented Mar 14, 2024

Blueprints_MainButton isn't part of Ren'Py. Is this a game mod?

Blueprints_MainButton is just a CDD that I've made myself. But the issue is there even with other displayables, like images or Solid(), for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants