Skip to content

Add Replace to SceneTree context menu#112985

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
DexterFstone:Add-Replace-to-SceneTree-context-menu
Feb 18, 2026
Merged

Add Replace to SceneTree context menu#112985
Repiteo merged 1 commit into
godotengine:masterfrom
DexterFstone:Add-Replace-to-SceneTree-context-menu

Conversation

@DexterFstone

Copy link
Copy Markdown
Contributor

closes godotengine/godot-proposals#13616

2025-11-20.17-26-57.mp4
@DexterFstone DexterFstone requested a review from a team November 20, 2025 14:32
@AThousandShips AThousandShips added this to the 4.x milestone Nov 20, 2025
@AdriaandeJongh

Copy link
Copy Markdown
Contributor

The paste options are getting increasingly confusing by adding another option. Not sure if it should be part of this PR but I can imagine that the three paste options should become something like as follows:

  • Paste (as Child)
  • Paste as Sibling
  • Paste as Replacement
@KoBeWi

KoBeWi commented Jan 19, 2026

Copy link
Copy Markdown
Member

I tested this new option. The "pasted" node keeps all properties from the replaced node, and pasting a scene makes it lose instancing. What makes this different from simply changing the type?

@DexterFstone DexterFstone force-pushed the Add-Replace-to-SceneTree-context-menu branch from 273da92 to 203532f Compare January 29, 2026 09:25
@DexterFstone

Copy link
Copy Markdown
Contributor Author

I tested this new option. The "pasted" node keeps all properties from the replaced node, and pasting a scene makes it lose instancing.

Fixed
Tests:

  • OLD IS NODE && NEW IS NODE
  • OLD IS NODE && NEW IS SCENE
  • OLD IS SCENE && NEW IS NODE
  • OLD IS SCENE && NEW IS SCENE
@DexterFstone DexterFstone force-pushed the Add-Replace-to-SceneTree-context-menu branch from 203532f to 68fc000 Compare January 29, 2026 09:29
@DexterFstone DexterFstone force-pushed the Add-Replace-to-SceneTree-context-menu branch from 68fc000 to 979d01b Compare February 6, 2026 07:23
@DexterFstone

This comment was marked as resolved.

@KoBeWi

KoBeWi commented Feb 6, 2026

Copy link
Copy Markdown
Member

Rebase your branch.

Comment thread editor/docks/scene_tree_dock.cpp Outdated
Comment thread editor/docks/scene_tree_dock.cpp Outdated
@DexterFstone DexterFstone force-pushed the Add-Replace-to-SceneTree-context-menu branch from 979d01b to 6264bee Compare February 6, 2026 12:39
@DexterFstone

DexterFstone commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

Rebase your branch.

It was, but it seems there is a connection issue, and it was not completed correctly.
VS doesn't show me any errors

@DexterFstone

Copy link
Copy Markdown
Contributor Author

I notice that this PR can resolve godotengine/godot-proposals#4991 and godotengine/godot-proposals#12284
If you onenning target scene and copying the root node, you can replace it with a node

@DexterFstone DexterFstone force-pushed the Add-Replace-to-SceneTree-context-menu branch from 6264bee to cd3e243 Compare February 12, 2026 18:44
@DexterFstone DexterFstone requested a review from a team as a code owner February 12, 2026 18:44

@KoBeWi KoBeWi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functionality is fine overall, but some of the details are disputable. Like, should the properties be preserved? Or at least the position? When replacing with a branch (i.e. node with children), should the children also be pasted? What if pasting multiple nodes? Currently it only uses the first one in the clipboard.

Though the only problematic part is how this new operation handles child nodes. It's actually bugged for non-scene children, but that's an already-existing bug: #116281 It would be nice to resolve it properly, to avoid manually adding/removing nodes.

Comment thread editor/docks/scene_tree_dock.cpp Outdated
Comment thread editor/docks/scene_tree_dock.cpp Outdated
Comment thread editor/docks/scene_tree_dock.cpp Outdated
@DexterFstone DexterFstone force-pushed the Add-Replace-to-SceneTree-context-menu branch from cd3e243 to 57fb0c8 Compare February 14, 2026 16:18
@DexterFstone

Copy link
Copy Markdown
Contributor Author

should the properties be preserved? Or at least the position?

Now the position will remain the same

When replacing with a branch (i.e. node with children), should the children also be pasted?

Well, the main use case of paste as a replacement is for the Packed Scenes; other than that, if the user wants the children, copy and paste can be used

@DexterFstone DexterFstone force-pushed the Add-Replace-to-SceneTree-context-menu branch from 57fb0c8 to f0ba73f Compare February 14, 2026 16:48
@DexterFstone

Copy link
Copy Markdown
Contributor Author

What if pasting multiple nodes? Currently it only uses the first one in the clipboard.

You mean when the number of selectend node is equal to the number of clipboard nodes?

@KoBeWi KoBeWi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor details left, but seems mostly fine now.

Comment thread editor/docks/scene_tree_dock.cpp Outdated
Comment thread editor/docks/scene_tree_dock.cpp
Comment thread editor/docks/scene_tree_dock.cpp Outdated
Comment thread editor/docks/scene_tree_dock.cpp Outdated
@DexterFstone DexterFstone force-pushed the Add-Replace-to-SceneTree-context-menu branch from f0ba73f to 5d9c855 Compare February 15, 2026 16:57
Comment thread editor/docks/scene_tree_dock.cpp Outdated
@KoBeWi KoBeWi modified the milestones: 4.x, 4.7 Feb 15, 2026
@DexterFstone DexterFstone force-pushed the Add-Replace-to-SceneTree-context-menu branch from 5d9c855 to f37446c Compare February 15, 2026 20:05
@Repiteo Repiteo merged commit 551978e into godotengine:master Feb 18, 2026
20 checks passed
@Repiteo

Repiteo commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment