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

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Galaxy
Regular
Posts: 38
Joined: Thu Dec 13, 2007 2:16 pm
Completed: The Sexual Fantasy Kingdom series
Organization: You can probably guess what it's called.
Deviantart: galaxypink
Location: Ohio, USA
Contact:

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

#1 Post 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.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2400
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

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

#2 Post 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.
< < insert Rick Cook quote here > >

Galaxy
Regular
Posts: 38
Joined: Thu Dec 13, 2007 2:16 pm
Completed: The Sexual Fantasy Kingdom series
Organization: You can probably guess what it's called.
Deviantart: galaxypink
Location: Ohio, USA
Contact:

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

#3 Post 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:

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

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

#4 Post 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.

Galaxy
Regular
Posts: 38
Joined: Thu Dec 13, 2007 2:16 pm
Completed: The Sexual Fantasy Kingdom series
Organization: You can probably guess what it's called.
Deviantart: galaxypink
Location: Ohio, USA
Contact:

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

#5 Post 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).

Post Reply

Who is online

Users browsing this forum: simple_human