-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
CanvasItemEditor: Fix losing position for drag'n'dropped scenes #39754
CanvasItemEditor: Fix losing position for drag'n'dropped scenes #39754
Conversation
I am not sure this is the expected behavior in fact. If I am not mistaking, when you position a node2d as instantiated into a scene, you override the instantiated scene's position in the instantiating scene. So, basically, it's like you ignore the original position in the subscene. This behaviors continue once you dropped the node anyway, as you won't have the origin as considered as the initial position in the instantiated scene. I think the right way to solve the problem would be to simply set the position to (0,0) during the drag&drop preview, it would probably be more consistent IMHO. |
The whole point being that if you design your scene with a root node that has a non-zero position, you have a valid reason to do so. The editor shouldn't discard this information. |
Well, that's the question. What I mean is that this information will be discarded anyway once you drop the subscene, as the original position is overridden in the parent scene. So basically, once the subscene is dropped, you have no more way to adjust the subscene position considering the original position in the subscene as there is not even a pivot icon considering this origin. Basically, for now, the position information of the root node in the subscene is only used for the drag&drop preview, but nowhere else. So I think the simple solution would be to reset the position to zero in the preview. We can also go for your solution, which might be a little bit more expected for the drag&drop, but I fear that it also could mislead users into thinking that they can still manipulate the scene with an origin which is no more considered once the scene is instantiated. |
Sure it make sense too. If this is the most expected behavior I guess it makes sense. :) |
I forgot to leave a review, sorry ;_; |
Post-merge reviews are still welcome :) Especially if you disagree with the change ;) |
Cherry-picked for 3.2.3. |
Fixes #26549.
Supersedes #36309.
Note: Tested on
3.2
as drag and drop is broken on Linux/X11 inmaster
.Some issues I noticed (not created by this fix):
(*)
, and it also opens a new, empty scene which takes focus, so it looks like it didn't even work.