Godot-Palette-Swap-Shader icon indicating copy to clipboard operation
Godot-Palette-Swap-Shader copied to clipboard

Using `PaletteGenerator.gd` always results in "Assertion failed: No selected node has 'texture' property with a valid Texture."

Open svioletg opened this issue 1 year ago • 3 comments

The shader itself is working just fine, and I've been able to manually create palettes and have them work as expected, but I can't seem to use the provided palette generator script at all. I've tried it on both AnimatedSprite2D and Sprite2D and neither seem to work - just gives me this same error.

svioletg avatar Sep 04 '24 22:09 svioletg

Do you run the script with Sprite2D node selected in scene tree? Does it have a texture assigned?

KoBeWi avatar Sep 04 '24 23:09 KoBeWi

I have my AnimatedSprite2D node selected when running it, it has animations and sprites present in its SpriteFrames, the "Texture" dropdown in the inspector only shows "Filter" and "Repeat" fields (which are both set to "Inherit")

svioletg avatar Sep 05 '24 01:09 svioletg

The generator only works on nodes with texture property that holds any Texture2D. "Texture" category is something else and unrelated. Though maybe the detection could be improved. It wasn't intended to be super reliable though; at worst you can just drop the texture to 2D editor, which will create a sprite, and use it to generate palette.

KoBeWi avatar Sep 05 '24 13:09 KoBeWi

I reworked the generator, it's now a Tools menu option.

KoBeWi avatar Mar 10 '25 13:03 KoBeWi