Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Brandon Hustus | |
Old Version | Published before Godot 3 was released. |
Hi all-
I’m working on a project that requires a custom Node2D class. It behaves much like the Sprite class, though instead of drawing a single sprite it draws several sprites layered over one another, which creates a pseudo-3D effect.
When the Sprite node is given a texture, its orange bounding box resizes in the editor for easier visual manipulation. However, I’m unable to figure out how to replicate this functionality; I attempted to override CanvasItem’s get_item_rect
method in the tool script I’m using, but this was fruitless. Currently the bounding box is fixed at a width of about (64,64), but it would make things much easier if I was able to make the edit box the same size as the bottom sprite of the object.
Is there a way to do this, or do I need to delve into GDScript plugins (or, even further, C++ modules) to make this happen?
I see there is an undocumented function void edit_set_rect(Rect2 rect)
inherited from CanvasItem
, but last time I heard of it it was because it doesn’t works. You can give it a try, but I’m not sure it works.
Zylann | 2016-10-23 23:29