Godot: Autotile set_cellv & set_cell while game is running must trigger autotile adjustments

Created on 4 Dec 2017  路  11Comments  路  Source: godotengine/godot

Operating system or device, Godot version, GPU Model and driver (if graphics related):
Any

Feature description:
While running a game, using set_cell, set_cellv, etc, a trigger should be done to make tile adjustment according to autotile properties of the tilemap

feature proposal core

Most helpful comment

Correct. My PR will essentially let you "recalculate" the autotiling after modifying cells via code, which currently does not happen.

All 11 comments

There is an argument to set the autotile coords manually, but I agree that it would be much more useful if it did it automatically (hence "auto" tile). I wouldn't mind working on this as it's something that I need as well so I'm going to go ahead and try to figure it out, but I would appreciate if @MarianoGnu could at least point me in the right direction.

I'm working on this now. It looks like the best way to do this might be to expose the update_bitmask_area(Vector2 pos) function, as well as adding a update_bitmask_region(Vector2 start, Vector2 end) function that works the same as the prior, but over a region defined by two Vector2s. With these changes, you can update individual cells or entire regions of cells.
With these changes, I have this working on my end (it just requires a manual call after calling set_cell*(), but that may be for the best I assume).
Any feedback on this?

I went ahead and opened PR #13991, which allows manually updating an autotile update. I'm not sure that having the tiling update every time set_cell is called is a great idea, since we could see a lot of wasted processing time if we update many cells at once, since each cell may need to be updated multiple times depending on the other set_cell calls

This is to get autotile effect while editing tilemaps by code?

Correct. My PR will essentially let you "recalculate" the autotiling after modifying cells via code, which currently does not happen.

update_bitmask should be manually called from script, otherwhise this could start to randomly change the subtile ids of tiles and mess up the map.

@TotCac My PR was just merged. Have you had a chance to test my changes?

@CyanBlob since this is a change to the public API, would you mind taking a crack a documenting these new methods? As a mere engine user, I would find that very useful. :)

@brainsick Sure! I'll look into it. :)

I'll review ASAP. Thx

Working good for me. Should I close ?

Was this page helpful?
0 / 5 - 0 ratings