+1 vote

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?

in Engine by (45 points)

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.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.