IcterusGames / SimpleGrassTextured

Plugin to make grass on Godot 4
MIT License
216 stars 16 forks source link

Add check before autoload is added #28

Open janos-ijgyarto opened 1 month ago

janos-ijgyarto commented 1 month ago

The following line adds the "SimpleGrass" autoload: https://github.com/IcterusGames/SimpleGrassTextured/blob/e06628419e26feb84832c8c53f38da945567328a/addons/simplegrasstextured/plugin.gd#L437

In its current state, every time the editor is opened, this causes the autoload to be added redundantly. While this doesn't actually change the contents of the project configuration, the editor still sees it as a "change" and will therefore enter the "unsaved changes" state (i.e if you then try to exit, Godot will ask if you want to save changes)

The plugin already checks whether the shaders are present before it tries to add them, so I believe the autoload should also have such a check. This simple change should fix it:

if not ProjectSettings.has_setting("autoload/SimpleGrass"):
    add_autoload_singleton("SimpleGrass", "res://addons/simplegrasstextured/singleton.tscn")
ZaggZGuy commented 2 weeks ago

Even with this updated code, I'm having issues with that default texture replacing albedo textures. Oddly, only with Multiple instances of the Simple Grass textured node being in use at the same time, & using mesh instances.

ZaggZGuy commented 2 weeks ago

This may not be a relating issue. So i will submit a new issue.