Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Layered Image Visualizer for Ren'Py [Addon]

Visually construct character expressions to paste into script · By Feniks

Need Support? Post here! Sticky

A topic by Feniks created Sep 01, 2023 Views: 380 Replies: 15
Viewing posts 1 to 6
Developer

If you're having trouble or run into any bugs with the code, post a comment here! I will try to get back to you within a few days.

Hi! Thank you so much for creating this tool! I'm not sure if this is user error on my part (and sorry if so), but when I copied the folder into my game and ran the launcher, it threw this error:

I'm sorry, but errors were detected in your script. Please correct the errors listed below, and try again.
File "game/image_tools/image_attributes_tool.rpy", line 803: keyword argument 'align' is incompatible with 'xpos'.
    ypos sprt.SPACER*3 align (0.0, 0.0)
                            ^
Ren'Py Version: Ren'Py 8.1.3.23091805
Mon Sep 25 11:13:23 2023

If I comment out

 ypos sprt.SPACER*3 align (0.0, 0.0)

in image_attributes_tool.rpy (line 803), it runs just fine. I'm pretty new at ren'py (&python) so I'm not really sure what can be done to fix this.

Developer (3 edits) (+2)

Oh no worries! Thank you for bringing it to my attention. You can change it to 

ypos sprt.SPACER*3 anchor (0.0, 0.0)

to make the issue go away - it's a developer warning since align technically also tries to set ypos. It's due to a config value called check_conflicting_properties introduced in the most recent Ren'Py version - you can also disable it with 

define config.check_conflicting_properties = False

to avoid these sorts of errors, though I'll also update the code to avoid that issue.

thank you so much!

(3 edits)

Heeeey, i have a bunch of suggestions, feel free to add them or not.

>A way to hide the group menu and show the sprite in fullscreen. Often I'm using your tool to check if I forgot to draw an arm variant for some clothes, so what I like to do is just take a screenshot of the sprite, draw over it in Photoshop the sleeves it's missing and export the image that I add over it in the layered image lol. But sometimes the arm is cropped out. Also maybe being able to change the background color?

>This one is probably hard to implement, but I like opening your tool when writing dialogues when I'm not sure which expression to use (I have it on a keyshortcut). So when you open the menu, it would be great if it could update the sprite with the attributes of the currently shown tag lol (if it's actually being shown). So when I open up I can see instantly my sprite and the different options without having to manually clean and choose all the attributes.

Have a great day!

(1 edit)

Hi there, this is really embarrassing, but I'm a noob and can't figure out how to make images show at all. I tried using the image tags I've defined and called in script.rpy, but that didn't work. The tutorial just says to enter tags, so I'm kind of at a loss. Sorry if I missed something incredibly obvious, that's definitely possible. Thanks for any help you can provide.

Edit: Sorry, forgot to mention that I got it working in the Attributes tool, but for some reason it doesn't work in the Layered Image tool.

Developer

The layered image visualizer has a stricter requirement than the attributes tool - namely, that the image needs to be a layered image. So, specifically, you need a declaration like layeredimage eileen standing: and then you could type in eileen standing to the visualizer to adjust it. It is not sufficient to have image eileen standing = "..." or similar. If you aren't sure what layered images are, you can read more about them in the docs: https://www.renpy.org/doc/html/layeredimage.html#layered-images

If you're still having trouble, feel free to post your layered image declaration and the results of typing in that name to the tool and I'll see what I can do to help!

Thank you so much for your swift and detailed reply!! That totally makes sense, I'll give it a shot.

(5 edits)

Hi, I keep having a python error that bricks the entire plugin until I delete the game project's cache. It happens if I click the "multiple" button and my filenames have underscore in them (eileen_m_smile.png)

RecursionError: maximum recursion depth exceeded while calling a Python object

It would be good to explain the different folder/file structures you are supporting and the different filenames you expect to work with your scripts. The absolute ideal scenario would be to have an example sprite + layeredimage provided, which I believe would be a fair request for a paid plugin. You could for example use the Agustina sprite.

You could also mention that the sprite's layeredimage and every attribute need to be manually declared in advance ("group outfit auto" doesn't seem to work). I wouldn't have known from the itch description, only by reading this thread and getting errors I learned of this.

Developer

Hello! I'll need you to be more specific about the errors you're encountering; the layered image tool is set up to work with basically any layered image declaration as it only checks the LayeredImage object after Ren'Py has already handled all the groups and such. I tested it with the following code:

layeredimage august:
    always "august_base"
    group outfit auto
    group eyes auto:
        attribute open default
    group eyebrows auto:
        attribute normal default
    group mouth auto:
        attribute smile default
    group glasses auto
    group emotion auto

and had no issues using it in the tool. These filenames have underscores in them also (august_eyebrows_frown.png and so on), so the file naming is not inherently a problem. The intention is that the tool supports as many layered image declarations as possible, which is why there are not limits listed on the itch page.


I managed to solve the recursion error. It was a layer that was incorrectly called in code ("august base" instead of the correct "august_base" when the filename was "august_base.png"). The same error also appeared in-game when the sprite was called. Solving this error also made layer groups declared with "auto" appear.

That said, if the error appears once it still bricks your layeredimage tool until the game's persistent data is removed. It would be great if there was some kind of error message but the tool doesn't get bricked, as this kind of slipups is probably a common occurence during the dev process.

For using the "Update Crop" feature, I ran across this error. I was just wondering how I could prevent this error from occurring so I can use the crop feature.

File "game/image_tools/layered_image_visualizer.rpy", line 895, in event
x=x/self.width
ZeroDivisionError: float division by zero
Developer

Did you set up a layered image in the main page of the layered image visualizer by typing in its name? This generally only happens if there isn't a valid image for the tool to use, so it's empty.

I believe I set it up. At the very least, everything appears as it should. I'm just trying to figure out why I keep getting that float error.

Developer

Is it possible that your attributes do not have `default` attributes set up, such that `show tau` with no additional attributes would show nothing at all? That's an issue with the crop tool, as it only uses the provided image tag (e.g. `tau`) for cropping purposes. Your layered images should always have sensible `default` attributes set if they're required (e.g. a default mouth attribute because the character should always have a mouth). It looks to me in the screenshot like if you don't have a `tbase` attribute set, the sprite simply doesn't have a base at all and is made up of the hair/arms/expression parts, which supports this. You can set up attributes with the `default` keyword e.g.

group tbase auto:
    attribute casual default
(+1)

Oh my gosh, thank you so much for telling me about this! You see, I had been working with pre-rendered sprites for so long that layered images are still new to me. I knew it was something on my end, but I was able to implement a default attribute set. Thank you very much for your help! You've done a great job with all these tools, and I feel like I've been able to do a lot more creative things in my game thanks to them.