Merge pull request #103980 from Calinou/editor-resource-dropdown-add-paste-as-unique
Add Paste as Unique option to the editor resource picker dropdown
This commit is contained in:
commit
23066df271
2 changed files with 15 additions and 5 deletions
|
|
@ -290,6 +290,7 @@ void EditorResourcePicker::_update_menu_items() {
|
|||
|
||||
if (paste_valid) {
|
||||
edit_menu->add_item(TTR("Paste"), OBJ_MENU_PASTE);
|
||||
edit_menu->add_item(TTRC("Paste as Unique"), OBJ_MENU_PASTE_AS_UNIQUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -439,12 +440,20 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
|
|||
EditorSettings::get_singleton()->set_resource_clipboard(edited_resource);
|
||||
} break;
|
||||
|
||||
case OBJ_MENU_PASTE: {
|
||||
case OBJ_MENU_PASTE:
|
||||
case OBJ_MENU_PASTE_AS_UNIQUE: {
|
||||
edited_resource = EditorSettings::get_singleton()->get_resource_clipboard();
|
||||
if (edited_resource->is_built_in() && EditorNode::get_singleton()->get_edited_scene() &&
|
||||
edited_resource->get_path().get_slice("::", 0) != EditorNode::get_singleton()->get_edited_scene()->get_scene_file_path()) {
|
||||
// Automatically make resource unique if it belongs to another scene.
|
||||
_edit_menu_cbk(OBJ_MENU_MAKE_UNIQUE);
|
||||
if (p_which == OBJ_MENU_PASTE_AS_UNIQUE ||
|
||||
(EditorNode::get_singleton()->get_edited_scene() && edited_resource->is_built_in() && edited_resource->get_path().get_slice("::", 0) != EditorNode::get_singleton()->get_edited_scene()->get_scene_file_path())) {
|
||||
// Automatically make resource unique if it belongs to another scene,
|
||||
// or if requested by the user with the Paste as Unique option.
|
||||
if (p_which == OBJ_MENU_PASTE_AS_UNIQUE) {
|
||||
// Use the recursive version when using Paste as Unique.
|
||||
// This will show up a dialog to select which resources to make unique.
|
||||
_edit_menu_cbk(OBJ_MENU_MAKE_UNIQUE_RECURSIVE);
|
||||
} else {
|
||||
_edit_menu_cbk(OBJ_MENU_MAKE_UNIQUE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
_resource_changed();
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ class EditorResourcePicker : public HBoxContainer {
|
|||
OBJ_MENU_SAVE_AS,
|
||||
OBJ_MENU_COPY,
|
||||
OBJ_MENU_PASTE,
|
||||
OBJ_MENU_PASTE_AS_UNIQUE,
|
||||
OBJ_MENU_SHOW_IN_FILE_SYSTEM,
|
||||
|
||||
TYPE_BASE_ID = 100,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue