godotengine / godot-proposals

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

Ability to have 3D Widgets / Gizmo on @tool @export vector or transform variables #8634

Open Grumoth opened 9 months ago

Grumoth commented 9 months ago

Describe the project you are working on

Impious , A turn based 3D RPG Roguelike image

Describe the problem or limitation you are having in your project

Currently, when creating world content tools, exposing Vector3 @export variables such as 'position' , 'rotation' , 'scale' doesn't have a way to easily control them other than setting them by hand. Adding 3D Widgets / Gizmos to adjust them would be so valuable.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

One of the things I miss from UE , is the ability to expose a 3D widget for @export variables on @tool mode.

image

When setting up a world transform @export variable, it shows this widget so you can control it with a Gizmo, which means, usability, precision and a workflow speed improvement image

This is specially handy when making customizable scenes to speed development without requiring to make "editable children" to tweak the transform of any child node of your scene. Case example scenario: Having a 'main light prop' scene that customizes any light in the world, assigning a mesh and a Light3D.

image

Having different types of meshes and lights and then adjust the lights position to match the mesh or direction, exposing those vectors and changing values one by one by hand, results in non precise and difficult way to tweak them

image

The only way to make this usable would be to make all the scene editable and tweak it with the gizmo, which results in giant node trees and would lead to non-consistent workflow just for setting one transform of one object

image

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

One way could be to set specific exports for this need, something like : image Or alternatively, an export with the whole transform, which may be more suitable : image

That would create another gizmo besides the node one that should be attached to that specific variable, so you could control both transforms in a single node. In this example, I created a gizmo scene attached that would act the same. The fact is that , if you have to create another node, attach it, assign it manually, you don't take advantage of the export scripts and it's quite cumbersome if you have to add it to many objects, expand, select, tweak...etc. You would just add directly the object you need .instead

https://github.com/godotengine/godot-proposals/assets/7796648/1ee70a44-2f7a-4224-8590-6bfaf9b341a8

May look like is not much of a deal, but having multiple gizmos at the same time to control different transforms wide opens the possibilities of customizable scenes, like look_at , directions, object placement in a very very friendly manner . I firmly believe many users would embrace this heavily. image

I suppose the main caveats engine-wise are: -how to select those widgets, may be incompatible with the object selection? -applying transforms like blender-mode ('G','R','S') would collide with it most surely

If this enhancement will not be used often, can it be worked around with a few lines of script?

There is maybe a way of doing that via Gizmo plugins, but at this state the docs are quite confusing and the whole thing would be sooo difficult to setup for just a "small" feature. If it's out of the box, is something everyone could take advantage.

Is there a reason why this should be core and not an add-on in the asset library?

It improves UX and opens wide 3D creation out of the box, and it would be to tied to the core for being an addon I think

Okxa commented 3 months ago

I have created an experimental addon which can be used to export Transform3D, Basis, Quaternion & Vector3 (Both plain and ones representing euler angles) variables with gizmos (It uses gizmo plugin subgizmos): https://codeberg.org/Okxa/godot-exportable-gizmos-addon

The addon is kinda hacky in some ways and also it requres to set a custom hint_string, either with _get_property_list() or _validate_property(). See the projects README for more information on usage & implementation.

But anyways this seems very good feature to have built in.