Draw polygons required by custom script in Godot editor
Since I have to draw many polygons in the Godot editor, and all objects will have a similar structure and logic to it. Therefore, I created a "scene" which includes all components a prototypical object needs, and tried to glue it together via primitive "tool" code in GDScript.
There should only be one 2D polygon per object, that servers different purposes: It's needed for highlighting (e.g. semi-transparent layer when mouseover occurs), and for collissions. So, I thought, it would be a good idea to export the PoolVector2Array to the most outer object, and set all necessary vectors in the script to it's children, when values are changed.
tool extends Area2D #class_name Interactable ##### All Children onready var SPRITE: Sprite = get_node("Sprite") onready var COL : CollisionPolygon2D = get_node("Collision") var is_mouse_hovered = false ############## Collision Shape export(PoolVector2Array) var shape setget setshape,getshape func setshape(new_value): shape = new_value self.COL.polygon = shape func getshape(): return shape
Everything seems to function, but I can't draw the polygon in the editor anymore: The polygon-drawing tools aren't showing up. That makes sense, I guess, but how can I have this feature?
I have a complex scene, which resembles a "ingame object prototype". It exposes some variables to the editor, one of them is a PoolVector2Array. Can I invoke the polygon-drawing capabilities of the Godot editor, to fill the variable?
Thanks in advance?