Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Root position of the saved scene (prefab) ignored after drag and drop into new scene #89719

Closed
gmikhail opened this issue Mar 20, 2024 · 7 comments

Comments

@gmikhail
Copy link

gmikhail commented Mar 20, 2024

Tested versions

v4.2.1.stable.official [b09f793]

System information

Godot v4.2.1.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 with Max-Q Design (NVIDIA; 31.0.15.5186) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 Threads)

Issue description

I have a scene with an object (for the sake of convenience I will call it prefab). When I drag a prefab into a new scene - the root position of prefab are ignored after the mouse drag is complete. But during the preview, when I can move the prefab around the scene with the mouse, the preview takes into account the root coordinates.

Visual example:

1

Root coordinates of my prefab scene:

2024-03-20 202829

For the sake of simplicity, I simply moved the sphere up by 0.5m. But during the tests, I discovered that all initial coordinates (XYZ) are ignored.

As you can see, I expect that after releasing the mouse button (complete dragging), the prefab will be in the same place where I currently see it, but it turns out to be in the wrong place.

Currently, as a workaround, I have to create an empty root Node3D with zero coordinates in my prefab scene. But I think that the current behavior is a bug because during the preview everything is displayed correctly.

Steps to reproduce

  1. Open scene.tscn from MRP.
  2. Drag and drop prefab.tscn into the open scene using the mouse.
  3. Watch how the final position of the prefab changes when you release the mouse button.

Minimal reproduction project (MRP)

PrefabPositionBug.zip

@AThousandShips
Copy link
Member

AThousandShips commented Mar 20, 2024

This is by design, and changing this would break existing projects (assuming the position is taken directly, instead of the action dropping it)

See also:

@gmikhail
Copy link
Author

In this case, it would be nice to display a warning so that users can see that changing the root transform is not recommended because it will be overridden.

Otherwise I still consider it a bug. After all, if it is possible to change the root coordinates, and during the preview they are displayed correctly (as an offset relative to the current mouse coordinates), then resetting the coordinates after dragging is completed is not what users expect.

Drag and drop must be WYSIWYG.

@AThousandShips
Copy link
Member

AThousandShips commented Mar 20, 2024

Then the part about it using the original offset when drag-dropping is a bug yes, but the bug is that the offset is displayed, not that it isn't applied, as the position is designed to be ignored

I'd argue that ignoring the offset (and having a warning) is the appropriate approach, editing with an offset like that is confusing and hard to use IMO, and also creates issues like:

@ryevdokimov
Copy link
Contributor

This is fixed in 4.3 by: #87126

@gmikhail
Copy link
Author

MRP behavior in Godot 4.3-dev5:

GIF

On one side, drag and drop is now WYSIWYG, just like the users expects. Now I can set the offset of the root node and it will work as expected.

On the other side, @AThousandShips was against this. But honestly, it’s more convenient for me that the position of the root node of the prefab is taken into account rather than ignored. Therefore, the changes suit me.


But I got another bug, I don’t know whether it’s related to this fix or not, but when I drag several prefabs one after another, they are created inside each other. You can see this in the attached GIF.

This is not expected behavior. If I need to drag a bunch of different prefabs, I now have to manually deselect the newly-dragged prefab that was automatically selected in the current scene, whereas before (see GIF in the first post) I could just drag prefabs into the scene without thinking about it.

@ryevdokimov
Copy link
Contributor

That behavior was added by: #87623

To make them children of the root node you must hold alt.

@gmikhail
Copy link
Author

Thanks to everyone, in this case I think the issue can be closed as resolved.

@AThousandShips AThousandShips added this to the 4.3 milestone Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants