After a bit of research I managed to make this script that you can attach to the root node of the tileset scene and check the "reset" box to generate a numbered sprite for each tile.
Note: only works with square images and doesn't delete previously created sprites (to protect against accidental clicks). It's okay to have blank tiles as long as the tileset image is square... or you can edit my script if you don't like blank tiles. It's not as elegant as the plugin scripts I found, but it works fine for my needs.
tool
extends Node
export(bool) var reset = false setget onReset
#config
var tileSize = 16
var tileCount = 16
var spritesheet = preload("res://map/tileset.png")
func _ready():
pass
func onReset(isTriggered):
if(isTriggered):
reset = false
for y in range(tileCount):
for x in range(tileCount):
var tile = Sprite.new()
add_child(tile)
tile.set_owner(self)
tile.set_name(str(x+y*tileCount))
tile.set_texture(spritesheet)
tile.set_region(true)
tile.set_region_rect(Rect2(x*tileSize, y*tileSize, tileSize, tileSize))
tile.set_pos(Vector2(x*tileSize+tileSize/2, y*tileSize+tileSize/2))
This took some time to figure out but it was well worth it in order to not do this by hand!
Edit: added the offset (tileSize/2) so the sprites line up correctly