godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.13k stars 78 forks source link

Add dedicated rect editors to objects with `rect` properties #526

Open KoBeWi opened 4 years ago

KoBeWi commented 4 years ago

Describe the project you are working on: 2D game.

Describe the problem or limitation you are having in your project: I use visibility notifiers to enable enemies when they enter screen or remove dead ones out of view. However my notifiers aren't accurate, because I'm too lazy to set them properly. See this image It's very tempting to use the handles, but these are standard 2D handles. They don't modify the rect, just scale the node. If I wanted to set the rects to correct values, I need to enter them by hand. That's too much work, meh.

Describe the feature / enhancement and how it helps to overcome the problem or limitation: The handles should edit the rect value VisibilityNotifier2D, not its scale.

This might apply to other nodes too (Particles2D, Sprite with rect_region enabled, anything that has rects that you could edit).

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams: Add a specialized editor to edit 2D rects where applicable, overriding the default scaling behavior. Similar thing as in Controls, but for Node2D-derived nodes.

If this enhancement will not be used often, can it be worked around with a few lines of script?: This requires a plugin. That's more than few lines. Also everyone using these nodes will use the functionality.

Is there a reason why this should be core and not an add-on in the asset library?: It's usability thing for core nodes.

Calinou commented 4 years ago

Isn't this proposal about following the CollisionShape2D behavior, but for VisibilityEnabler and VisibilityNotifier? In other words, the default 2D gizmos should be hidden and specific gizmos should be added. I remember seeing a way to ignore scaling as well, so it doesn't even show up in the Inspector (in 3D at least).

KoBeWi commented 4 years ago

Isn't this proposal about following the CollisionShape2D behavior, but for VisibilityEnabler and VisibilityNotifier?

Basically yes.

But I've wanted this functionality in other nodes on numerous occasions. E.g. it's also useful in a Sprite with region_rect enabled. Or for editing visibility rect in Particles2D (although this one can be done automatically).

KoBeWi commented 4 years ago

This is somewhat related - I just thought it would be useful to have this for Camera2D, i.e. edit the visible rectangle, which would change the zoom. It's useful e.g. for animations with dynamically moving and zooming camera.

AnilBK commented 3 years ago

I have a similar proposal for rect editor, but for 3D.

The best way to solve this would be "Rect Transform Tool" like in Unity.This would be placed next to Move,Rotate and Scale in the editor.

For 2D, rects could be modified without modifying the scale. Similarly in 3D, 3D Primitive Meshes and extents of other nodes like Collision shape, could be modified in a given direction,without directly modifying the scale.