-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GridMap enhancement - A signal or callback for on_cell_changed() #11855
Comments
Keep in mind that if you do auto-tiling, it implies changing neighbor tiles to connect, and that will trigger |
what about |
Still in the use case of auto-tiling, I was more thinking about a different path to set tiles in an auto-tiling way, something more specialized than a generic "a tile changed". I remember there was an existing issue where people were discussing this? Note: I read this is for GridMap, but what I mean is also valid for TileMap ;) |
Yes! Actually, when making an autotile system, i reserve the first handful of tiles in a set for "air, material 1, material 2, etc", rather than the 32 different tiles / orientations that could represent them. So you paint in materials, and let the auto tile script define the actual tiles. I believe this is exactly what you're also describing. 😄 It would obviously be ideal to have this entire concept baked right into the engine implementation of GridMap (but that is a lot of work, that's why i'm not asking for it). But with a simple notification of some sort that i can respond to in script, i can hack together something that works. As long as it is either only called when a cell's index actually changes, or is called with the old/new state passed as a parameter. |
Yeah that's my point: |
There have been various PRs for this (current one that could be merged is #33832), but I'm still unclear about the use case for this signal. See discussion in #40044 (comment). Signals are normally not emitted for actions that are taken knowingly by the developer, as you can emit your own signal at the same time as you change the cell yourself. Similarly, TileMap doesn't emit any signal when you change cells, as this is something that is always done by yourself. Edit: Re-reading the OP and reading #33832 (comment) I see that this could be useful for |
We rediscussed this today in a PR review meeting, and the conclusion is pretty much the same as what I commented above. I do see a use case for this but that's something which requires more design discussion to be implemented in a similar way for both TileMaps and GridMaps. As I understand it the only use case is for tool scripts/editor plugins to implement things like auto-tiling, in which case that's something which would likely be best implemented via EditorPlugin or similar APIs, instead of in the core GridMap. I think the discussion should be moved to https://github.com/godotengine/godot-proposals to assess such a proposal, see what's the "right" design for this. Then the implementation should be fairly straightforward once we reach consensus. |
The GridMap node would be an order of magnitude more powerful if I could have an editor script be able to detect whenever a cell has changed.
This could be achieved by any of a number of options. I'm not sure which would be the most appropriate method:
With this simple addition, I could write an auto-tile editor script in GDScript that I could share with everyone. You could have variation in tiles occur automatically; ie, place a tree tile and have a random one of six tree models spawn. You could have tiles automatically rotate in specific ways.
There would be lots of possibilities opened up by this.
The text was updated successfully, but these errors were encountered: