Page 1 of 1

Popup a menu and apply a transform to whatever's under it?

Posted: Thu Oct 06, 2016 9:18 am
by Galaxy
I've got this transform based on Alex's code from this topic. It works just as I want it to, if I apply it to things as they show up in the game script. Like so:

Code: Select all

init:
    transform blur(child):
        contains:
            im.MatrixColor(child, im.matrix.saturation(.5) * im.matrix.tint(1.0, 0.8, 0.6) * im.matrix.brightness(0.2) * im.matrix.opacity(1.0)) 
        contains:
            im.MatrixColor(child, im.matrix.saturation(.5) * im.matrix.tint(1.0, 0.8, 0.6) * im.matrix.brightness(0.2) * im.matrix.opacity(0.6)) 
            xoffset -1
        contains:
            im.MatrixColor(child, im.matrix.saturation(.5) * im.matrix.tint(1.0, 0.8, 0.6) * im.matrix.brightness(0.2) * im.matrix.opacity(0.6)) 
            xoffset 1
        contains:
            im.MatrixColor(child, im.matrix.saturation(.5) * im.matrix.tint(1.0, 0.8, 0.6) * im.matrix.brightness(0.2) * im.matrix.opacity(0.6)) 
            yoffset -1
        contains:
            im.MatrixColor(child, im.matrix.saturation(.5) * im.matrix.tint(1.0, 0.8, 0.6) * im.matrix.brightness(0.2) * im.matrix.opacity(0.6)) 
            yoffset 1
        contains:
            im.MatrixColor(child, im.matrix.saturation(.5) * im.matrix.tint(1.0, 0.8, 0.6) * im.matrix.brightness(0.2) * im.matrix.opacity(0.3)) 
            xoffset -2
        contains:
            im.MatrixColor(child, im.matrix.saturation(.5) * im.matrix.tint(1.0, 0.8, 0.6) * im.matrix.brightness(0.2) * im.matrix.opacity(0.3)) 
            xoffset 2
        contains:
            im.MatrixColor(child, im.matrix.saturation(.5) * im.matrix.tint(1.0, 0.8, 0.6) * im.matrix.brightness(0.2) * im.matrix.opacity(0.3)) 
            yoffset -2
        contains:
            im.MatrixColor(child, im.matrix.saturation(.5) * im.matrix.tint(1.0, 0.8, 0.6) * im.matrix.brightness(0.2) * im.matrix.opacity(0.3)) 
            yoffset 2
Then:

Code: Select all

label start:
    show eileen happy:
        xpos 0.5
    $ renpy.pause()
    show eileen happy at blur
    with dissolve
    "Some good memories"

#or whatever, you get the idea. Feel free to use this code and play with the values
But what I want is to use this effect during NVL, and when I display images on a new layer (the idea being you click an object in the scene, and a small pop-up image shows a closeup of that object, while the rest of the images are blurred in the background).

And, possibly for going to Preferences or Save/Load, or the "Are you sure you want to quit?" screen... instead of having one specific game menu root image.


So... the transform function itself works great, but I don't know if it's possible to create a function that will apply this transform to the whole background and any characters currently visible, when those new screens are called... and remove it and restore the previous images when the screens are dismissed.

Is this too much to ask?

There may be no such method and I can ham-fist a manual version during pop-ups and NVL only - but I'd love to have a single function for it, and to be able to do game menus this way too.

Re: Popup a menu and apply a transform to whatever's under i

Posted: Thu Oct 06, 2016 9:29 am
by Ocelot
One idea is to take a screenshot using renpy.screenshot, use resulting image as background and apply transform to it.

Not the most efficient way, but I am not sure if there is a way to get all currently displaying displayables.

Re: Popup a menu and apply a transform to whatever's under i

Posted: Thu Oct 06, 2016 10:18 am
by Galaxy
That could actually be a more efficient way, because the transform would only have to be run once, instead of once for each image... as long as there's also a way to delete those screenshots after they're no longer needed! :mrgreen:

Re: Popup a menu and apply a transform to whatever's under i

Posted: Thu Oct 06, 2016 10:19 am
by papiersam
One idea is to take a screenshot using renpy.screenshot, use resulting image as background and apply transform to it.
It's an idea, but I wouldn't recommend it. It's far too slow, especially considering the nature of transforms.
And, possibly for going to Preferences or Save/Load, or the "Are you sure you want to quit?" screen... instead of having one specific game menu root image.
Either try

Code: Select all

    config.exit_transition = blur
    config.enter_transition = blur
in the options.rpy, or add

Code: Select all

at blur
to the menu in question.

Re: Popup a menu and apply a transform to whatever's under i

Posted: Thu Oct 06, 2016 1:07 pm
by Galaxy
r_sami wrote: Either try

Code: Select all

    config.exit_transition = blur
    config.enter_transition = blur
in the options.rpy, or add

Code: Select all

at blur
to the menu in question.
Neither of those things worked, but I appreciate the response. For the config. transitions in options, it either did nothing or gave me errors, depending on when in the init order I defined the transform. Adding it to menus didn't do anything (no errors, but no effect).