Page 1 of 1

[SOLVED] How to access a transform inside a named store?

Posted: Thu Jul 25, 2019 2:43 pm
by trajano
I have the following code where I want to namespace my methods, but I want it to access a transformation that I defined outside. How do I refer to this transformation inside the python code?

Code: Select all

transform saybox_namebox_transform(xoffset=0, yoffset=0, degs = 10, yoffset_transform = 40, easein = 0.15):
    rotate_pad True
    xoffset xoffset
    yoffset yoffset
    rotate 0
    easein easein rotate degs yoffset pmui.scale_p(yoffset-yoffset_transform)

init python in pmui:
    from math import sqrt
    from renpy.defaultstore import At
    from renpy.display.core import absolute
    from renpy.display.imagelike import Frame, Solid
    from renpy.display.layout import AlphaMask, Composite
    def dialogbox(st, at, who=None):
        w = scale_f(1080)
        h = scale_f(375)
        z = sqrt(w*w + h*h)
        xoffset = absolute(-((z - w) /2.0 ))
        yoffset = absolute(-((z - h) /2.0 ))
        return Composite(
            (scale_p(w), scale_p(h)),
            (0,0), At(
                Composite(
                    (scale_p(1080), scale_p(375)),
                    (0,0), AlphaMask(Solid(say_extra_box_color),Frame("portrait-mode-ui/ui/say-alphamask.png")),
                    (0,0), "portrait-mode-ui/ui/say-dropshadow.png",
                    (scale_p(50), scale_p(50)), who
                ),
                saybox_namebox_transform(
                    xoffset=xoffset,
                    yoffset=yoffset,
                    yoffset_transform=40,
                    degs = 15,
                    easein = 0.20)
                ),
            (0, 0), At(
                Composite(
                    (scale_p(1080), scale_p(375)),
                    (0,0), AlphaMask(Solid(say_name_box_color), Frame("portrait-mode-ui/ui/say-alphamask.png")),
                    (0,0), "portrait-mode-ui/ui/say-dropshadow.png",
                    (scale_p(50), scale_p(50)), who
                ),
                saybox_namebox_transform(
                    xoffset=xoffset,
                    yoffset=yoffset,
                    yoffset_transform=40,
                    degs = 10)
                ),
            (0,0), AlphaMask(Solid(say_dialog_box_color_1), Frame("portrait-mode-ui/ui/say-alphamask.png")),
            (0,0), AlphaMask(Solid(say_dialog_box_color_2), Frame("portrait-mode-ui/ui/say-alphamask-gradient.png")),
            (0,0), At(AlphaMask(SideImage(), Frame("portrait-mode-ui/ui/say-alphamask-gradient.png")), saybox_side_image_transform),
            (0,0), "portrait-mode-ui/ui/say-dropshadow.png"
        ), None

Re: How to access a transform inside a named store?

Posted: Thu Jul 25, 2019 11:56 pm
by trajano
Solved:

Code: Select all

renpy.store
stores the values