godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

In Editor, copy and paste Vector values #3077

Closed AhNesh closed 3 years ago

AhNesh commented 3 years ago

Describe the project you are working on

I am creating NPC resources, describing which model they use, what dialog they have, etc, and where they spawn in the world (as a position vector and a rotation vector).

Describe the problem or limitation you are having in your project

To find the position I want the NPC to spawn at, I add a character model scene to the scene and place it where I want it. Then I have to write the Translation and Rotation Degrees vectors into my resource, one field at a time. I find this cumbersome, especially since they both use the Inspector window.

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

I think it would be nice to be able to copy a vector value in the editor, and then paste it into another vector field, whether that field is another field in the same node, in another node in the same scene, a node in another scene, or in a resource.

I think copy & paste could be useful for Vector2, Vector3 and maybe Transform.

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

Perhaps as copy and paste buttons next to the reset button, or a right-click context menu where you can select copy or paste.

If it uses shortcuts, how to differentiate copying and pasting just one of the values and copying and pasting the whole vector? Perhaps when text is selected it copies only that value, but if cursor is just placed in text (no text highlighted) it can copy all the values? That way ctrl+c keeps working as it does now.

Somehow you would have to check if the value on the clipboard or wherever it is stored is a vector when you paste into a vector field. If it isn't paste the value into the selected field, if it is paste each part of the vector into each field of the vector.

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

If this can be solved as an editor plugin, some pointers as to how to make that would be great! Then I could make the add-on and share it. Problem solved.

I found this https://github.com/samw3/godot-copy-transform, but it only works between nodes, not resources.

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

For me it would be fine as an add-on if that is possible, but I am not sure if it is.

Calinou commented 3 years ago

Duplicate of https://github.com/godotengine/godot-proposals/issues/1504.