mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-24 04:46:48 +01:00
Removed unused variables from the SceneTreeDock.
This commit is contained in:
parent
4e5f2f684a
commit
d963444bad
@ -393,18 +393,12 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
switch (p_tool) {
|
||||
#ifdef MODULE_REGEX_ENABLED
|
||||
case TOOL_BATCH_RENAME: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
if (editor_selection->get_selected_node_list().size() > 1) {
|
||||
rename_dialog->popup_centered();
|
||||
}
|
||||
} break;
|
||||
#endif // MODULE_REGEX_ENABLED
|
||||
case TOOL_RENAME: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
Tree *tree = scene_tree->get_scene_tree();
|
||||
if (tree->is_anything_selected()) {
|
||||
tree->grab_focus();
|
||||
@ -413,10 +407,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
} break;
|
||||
case TOOL_NEW:
|
||||
case TOOL_REPARENT_TO_NEW_NODE: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (reset_create_dialog && !p_confirm_override) {
|
||||
create_dialog->set_base_type("Node");
|
||||
reset_create_dialog = false;
|
||||
@ -447,9 +437,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
}
|
||||
} break;
|
||||
case TOOL_INSTANCE: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
Node *scene = edited_scene;
|
||||
|
||||
if (!scene) {
|
||||
@ -590,10 +577,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
editor_data->get_undo_redo().commit_action();
|
||||
} break;
|
||||
case TOOL_REPLACE: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!_validate_no_foreign()) {
|
||||
break;
|
||||
}
|
||||
@ -624,10 +607,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
attach_script_to_selected(false);
|
||||
} break;
|
||||
case TOOL_DETACH_SCRIPT: {
|
||||
if (!profile_allow_script_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
Array selection = editor_selection->get_selected_nodes();
|
||||
|
||||
if (selection.empty()) {
|
||||
@ -654,10 +633,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
} break;
|
||||
case TOOL_MOVE_UP:
|
||||
case TOOL_MOVE_DOWN: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!scene_tree->get_selected()) {
|
||||
break;
|
||||
}
|
||||
@ -729,10 +704,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
|
||||
} break;
|
||||
case TOOL_DUPLICATE: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!edited_scene) {
|
||||
break;
|
||||
}
|
||||
@ -807,10 +778,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
}
|
||||
} break;
|
||||
case TOOL_REPARENT: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!scene_tree->get_selected()) {
|
||||
break;
|
||||
}
|
||||
@ -836,10 +803,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
|
||||
} break;
|
||||
case TOOL_MAKE_ROOT: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
List<Node *> nodes = editor_selection->get_selected_node_list();
|
||||
ERR_FAIL_COND(nodes.size() != 1);
|
||||
|
||||
@ -895,10 +858,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
editor_data->get_undo_redo().commit_action();
|
||||
} break;
|
||||
case TOOL_MULTI_EDIT: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
Node *root = EditorNode::get_singleton()->get_edited_scene();
|
||||
if (!root) {
|
||||
break;
|
||||
@ -913,10 +872,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
} break;
|
||||
|
||||
case TOOL_ERASE: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
List<Node *> remove_list = editor_selection->get_selected_node_list();
|
||||
|
||||
if (remove_list.empty()) {
|
||||
@ -962,17 +917,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
|
||||
} break;
|
||||
case TOOL_MERGE_FROM_SCENE: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
EditorNode::get_singleton()->merge_from_scene();
|
||||
} break;
|
||||
case TOOL_NEW_SCENE_FROM: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
Node *scene = editor_data->get_edited_scene_root();
|
||||
|
||||
if (!scene) {
|
||||
@ -1055,10 +1002,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
EditorNode::get_singleton()->set_visible_editor(EditorNode::EDITOR_SCRIPT);
|
||||
} break;
|
||||
case TOOL_SCENE_EDITABLE_CHILDREN: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
@ -1076,10 +1019,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
}
|
||||
} break;
|
||||
case TOOL_SCENE_USE_PLACEHOLDER: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
@ -1107,10 +1046,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
}
|
||||
} break;
|
||||
case TOOL_SCENE_MAKE_LOCAL: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
@ -1144,17 +1079,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
}
|
||||
} break;
|
||||
case TOOL_SCENE_CLEAR_INHERITANCE: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
clear_inherit_confirm->popup_centered_minsize();
|
||||
} break;
|
||||
case TOOL_SCENE_CLEAR_INHERITANCE_CONFIRM: {
|
||||
if (!profile_allow_editing) {
|
||||
break;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
@ -2243,10 +2170,7 @@ void SceneTreeDock::_delete_confirm(bool p_cut) {
|
||||
}
|
||||
|
||||
void SceneTreeDock::_update_script_button() {
|
||||
if (!profile_allow_script_editing) {
|
||||
button_create_script->hide();
|
||||
button_detach_script->hide();
|
||||
} else if (editor_selection->get_selection().size() == 0) {
|
||||
if (editor_selection->get_selection().size() == 0) {
|
||||
button_create_script->hide();
|
||||
button_detach_script->hide();
|
||||
} else if (editor_selection->get_selection().size() == 1) {
|
||||
@ -2823,11 +2747,8 @@ void SceneTreeDock::_add_children_to_popup(Object *p_obj, int p_depth) {
|
||||
void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
||||
if (!EditorNode::get_singleton()->get_edited_scene()) {
|
||||
menu->clear();
|
||||
if (profile_allow_editing) {
|
||||
menu->add_icon_shortcut(get_theme_icon("Add", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW);
|
||||
menu->add_icon_shortcut(get_theme_icon("Instance", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/instance_scene"), TOOL_INSTANCE);
|
||||
}
|
||||
|
||||
menu->add_icon_shortcut(get_theme_icon("Add", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW);
|
||||
menu->add_icon_shortcut(get_theme_icon("Instance", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/instance_scene"), TOOL_INSTANCE);
|
||||
menu->set_size(Size2(1, 1));
|
||||
menu->set_position(p_menu_pos);
|
||||
menu->popup();
|
||||
@ -2848,18 +2769,16 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
||||
if (selection.size() == 1) {
|
||||
Node *selected = selection[0];
|
||||
|
||||
if (profile_allow_editing) {
|
||||
subresources.clear();
|
||||
menu_subresources->clear();
|
||||
menu_subresources->set_size(Size2(1, 1));
|
||||
_add_children_to_popup(selection.front()->get(), 0);
|
||||
if (menu->get_item_count() > 0) {
|
||||
menu->add_separator();
|
||||
}
|
||||
|
||||
menu->add_icon_shortcut(get_theme_icon("Add", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW);
|
||||
menu->add_icon_shortcut(get_theme_icon("Instance", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/instance_scene"), TOOL_INSTANCE);
|
||||
subresources.clear();
|
||||
menu_subresources->clear();
|
||||
menu_subresources->set_size(Size2(1, 1));
|
||||
_add_children_to_popup(selection.front()->get(), 0);
|
||||
if (menu->get_item_count() > 0) {
|
||||
menu->add_separator();
|
||||
}
|
||||
|
||||
menu->add_icon_shortcut(get_theme_icon("Add", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW);
|
||||
menu->add_icon_shortcut(get_theme_icon("Instance", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/instance_scene"), TOOL_INSTANCE);
|
||||
menu->add_icon_shortcut(get_theme_icon("Collapse", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/expand_collapse_all"), TOOL_EXPAND_COLLAPSE);
|
||||
menu->add_separator();
|
||||
|
||||
@ -2870,111 +2789,102 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
||||
}
|
||||
}
|
||||
|
||||
if (profile_allow_editing) {
|
||||
menu->add_shortcut(ED_GET_SHORTCUT("scene_tree/cut_node"), TOOL_CUT);
|
||||
menu->add_shortcut(ED_GET_SHORTCUT("scene_tree/copy_node"), TOOL_COPY);
|
||||
if (selection.size() == 1 && !node_clipboard.empty()) {
|
||||
menu->add_shortcut(ED_GET_SHORTCUT("scene_tree/paste_node"), TOOL_PASTE);
|
||||
menu->add_shortcut(ED_GET_SHORTCUT("scene_tree/cut_node"), TOOL_CUT);
|
||||
menu->add_shortcut(ED_GET_SHORTCUT("scene_tree/copy_node"), TOOL_COPY);
|
||||
if (selection.size() == 1 && !node_clipboard.empty()) {
|
||||
menu->add_shortcut(ED_GET_SHORTCUT("scene_tree/paste_node"), TOOL_PASTE);
|
||||
}
|
||||
menu->add_separator();
|
||||
|
||||
bool add_separator = false;
|
||||
|
||||
if (full_selection.size() == 1) {
|
||||
add_separator = true;
|
||||
menu->add_icon_shortcut(get_theme_icon("ScriptCreate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/attach_script"), TOOL_ATTACH_SCRIPT);
|
||||
if (existing_script.is_valid()) {
|
||||
menu->add_icon_shortcut(get_theme_icon("ScriptExtend", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/extend_script"), TOOL_EXTEND_SCRIPT);
|
||||
}
|
||||
}
|
||||
|
||||
if (existing_script.is_valid() && exisiting_script_removable) {
|
||||
add_separator = true;
|
||||
menu->add_icon_shortcut(get_theme_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/detach_script"), TOOL_DETACH_SCRIPT);
|
||||
} else if (full_selection.size() > 1) {
|
||||
bool script_exists = false;
|
||||
for (List<Node *>::Element *E = full_selection.front(); E; E = E->next()) {
|
||||
if (!E->get()->get_script().is_null()) {
|
||||
script_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (script_exists) {
|
||||
add_separator = true;
|
||||
menu->add_icon_shortcut(get_theme_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/detach_script"), TOOL_DETACH_SCRIPT);
|
||||
}
|
||||
}
|
||||
|
||||
if (add_separator) {
|
||||
menu->add_separator();
|
||||
}
|
||||
|
||||
if (profile_allow_script_editing) {
|
||||
bool add_separator = false;
|
||||
|
||||
if (full_selection.size() == 1) {
|
||||
add_separator = true;
|
||||
menu->add_icon_shortcut(get_theme_icon("ScriptCreate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/attach_script"), TOOL_ATTACH_SCRIPT);
|
||||
if (existing_script.is_valid()) {
|
||||
menu->add_icon_shortcut(get_theme_icon("ScriptExtend", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/extend_script"), TOOL_EXTEND_SCRIPT);
|
||||
}
|
||||
// Allow multi-toggling scene unique names but only if all selected nodes are owned by the edited scene root.
|
||||
bool all_owned = true;
|
||||
for (List<Node *>::Element *e = full_selection.front(); e; e = e->next()) {
|
||||
Node *node = e->get();
|
||||
if (node->get_owner() != EditorNode::get_singleton()->get_edited_scene()) {
|
||||
all_owned = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (existing_script.is_valid() && exisiting_script_removable) {
|
||||
add_separator = true;
|
||||
menu->add_icon_shortcut(get_theme_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/detach_script"), TOOL_DETACH_SCRIPT);
|
||||
} else if (full_selection.size() > 1) {
|
||||
bool script_exists = false;
|
||||
for (List<Node *>::Element *E = full_selection.front(); E; E = E->next()) {
|
||||
if (!E->get()->get_script().is_null()) {
|
||||
script_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (script_exists) {
|
||||
add_separator = true;
|
||||
menu->add_icon_shortcut(get_theme_icon("ScriptRemove", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/detach_script"), TOOL_DETACH_SCRIPT);
|
||||
}
|
||||
}
|
||||
|
||||
if (add_separator && profile_allow_editing) {
|
||||
}
|
||||
if (all_owned) {
|
||||
// Group "toggle_unique_name" with "copy_node_path", if it is available.
|
||||
if (menu->get_item_index(TOOL_COPY_NODE_PATH) == -1) {
|
||||
menu->add_separator();
|
||||
}
|
||||
Node *node = full_selection[0];
|
||||
menu->add_icon_shortcut(get_theme_icon("SceneUniqueName", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/toggle_unique_name"), TOOL_TOGGLE_SCENE_UNIQUE_NAME);
|
||||
menu->set_item_text(menu->get_item_index(TOOL_TOGGLE_SCENE_UNIQUE_NAME), node->is_unique_name_in_owner() ? TTR("Revoke Unique Name") : TTR("Access as Unique Name"));
|
||||
}
|
||||
|
||||
if (profile_allow_editing) {
|
||||
// Allow multi-toggling scene unique names but only if all selected nodes are owned by the edited scene root.
|
||||
bool all_owned = true;
|
||||
for (List<Node *>::Element *e = full_selection.front(); e; e = e->next()) {
|
||||
Node *node = e->get();
|
||||
if (node->get_owner() != EditorNode::get_singleton()->get_edited_scene()) {
|
||||
all_owned = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (all_owned) {
|
||||
// Group "toggle_unique_name" with "copy_node_path", if it is available.
|
||||
if (menu->get_item_index(TOOL_COPY_NODE_PATH) == -1) {
|
||||
menu->add_separator();
|
||||
}
|
||||
Node *node = full_selection[0];
|
||||
menu->add_icon_shortcut(get_theme_icon("SceneUniqueName", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/toggle_unique_name"), TOOL_TOGGLE_SCENE_UNIQUE_NAME);
|
||||
menu->set_item_text(menu->get_item_index(TOOL_TOGGLE_SCENE_UNIQUE_NAME), node->is_unique_name_in_owner() ? TTR("Revoke Unique Name") : TTR("Access as Unique Name"));
|
||||
add_separator = false;
|
||||
|
||||
if (full_selection.size() == 1) {
|
||||
add_separator = true;
|
||||
menu->add_icon_shortcut(get_theme_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/rename"), TOOL_RENAME);
|
||||
}
|
||||
|
||||
bool can_replace = true;
|
||||
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
|
||||
if (E->get() != edited_scene && (E->get()->get_owner() != edited_scene || E->get()->get_filename() != "")) {
|
||||
can_replace = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (profile_allow_editing) {
|
||||
bool add_separator = false;
|
||||
if (can_replace) {
|
||||
add_separator = true;
|
||||
menu->add_icon_shortcut(get_theme_icon("Reload", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/change_node_type"), TOOL_REPLACE);
|
||||
}
|
||||
|
||||
if (full_selection.size() == 1) {
|
||||
add_separator = true;
|
||||
menu->add_icon_shortcut(get_theme_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/rename"), TOOL_RENAME);
|
||||
if (scene_tree->get_selected() != edited_scene) {
|
||||
if (add_separator) {
|
||||
menu->add_separator();
|
||||
}
|
||||
|
||||
bool can_replace = true;
|
||||
for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
|
||||
if (E->get() != edited_scene && (E->get()->get_owner() != edited_scene || E->get()->get_filename() != "")) {
|
||||
can_replace = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (can_replace) {
|
||||
add_separator = true;
|
||||
menu->add_icon_shortcut(get_theme_icon("Reload", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/change_node_type"), TOOL_REPLACE);
|
||||
}
|
||||
|
||||
if (scene_tree->get_selected() != edited_scene) {
|
||||
if (add_separator) {
|
||||
menu->add_separator();
|
||||
}
|
||||
menu->add_icon_shortcut(get_theme_icon("MoveUp", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/move_up"), TOOL_MOVE_UP);
|
||||
menu->add_icon_shortcut(get_theme_icon("MoveDown", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/move_down"), TOOL_MOVE_DOWN);
|
||||
menu->add_icon_shortcut(get_theme_icon("Duplicate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/duplicate"), TOOL_DUPLICATE);
|
||||
menu->add_icon_shortcut(get_theme_icon("Reparent", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/reparent"), TOOL_REPARENT);
|
||||
menu->add_icon_shortcut(get_theme_icon("ReparentToNewNode", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/reparent_to_new_node"), TOOL_REPARENT_TO_NEW_NODE);
|
||||
if (selection.size() == 1) {
|
||||
menu->add_icon_shortcut(get_theme_icon("NewRoot", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/make_root"), TOOL_MAKE_ROOT);
|
||||
}
|
||||
menu->add_icon_shortcut(get_theme_icon("MoveUp", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/move_up"), TOOL_MOVE_UP);
|
||||
menu->add_icon_shortcut(get_theme_icon("MoveDown", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/move_down"), TOOL_MOVE_DOWN);
|
||||
menu->add_icon_shortcut(get_theme_icon("Duplicate", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/duplicate"), TOOL_DUPLICATE);
|
||||
menu->add_icon_shortcut(get_theme_icon("Reparent", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/reparent"), TOOL_REPARENT);
|
||||
menu->add_icon_shortcut(get_theme_icon("ReparentToNewNode", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/reparent_to_new_node"), TOOL_REPARENT_TO_NEW_NODE);
|
||||
if (selection.size() == 1) {
|
||||
menu->add_icon_shortcut(get_theme_icon("NewRoot", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/make_root"), TOOL_MAKE_ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
if (selection.size() == 1) {
|
||||
if (profile_allow_editing) {
|
||||
menu->add_separator();
|
||||
menu->add_icon_shortcut(get_theme_icon("Blend", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/merge_from_scene"), TOOL_MERGE_FROM_SCENE);
|
||||
menu->add_icon_shortcut(get_theme_icon("CreateNewSceneFrom", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/save_branch_as_scene"), TOOL_NEW_SCENE_FROM);
|
||||
}
|
||||
menu->add_separator();
|
||||
menu->add_icon_shortcut(get_theme_icon("Blend", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/merge_from_scene"), TOOL_MERGE_FROM_SCENE);
|
||||
menu->add_icon_shortcut(get_theme_icon("CreateNewSceneFrom", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/save_branch_as_scene"), TOOL_NEW_SCENE_FROM);
|
||||
if (full_selection.size() == 1) {
|
||||
menu->add_separator();
|
||||
menu->add_icon_shortcut(get_theme_icon("CopyNodePath", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/copy_node_path"), TOOL_COPY_NODE_PATH);
|
||||
@ -2986,30 +2896,24 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
||||
bool is_top_level = selection[0]->get_owner() == nullptr;
|
||||
if (is_inherited && is_top_level) {
|
||||
menu->add_separator();
|
||||
if (profile_allow_editing) {
|
||||
menu->add_item(TTR("Clear Inheritance"), TOOL_SCENE_CLEAR_INHERITANCE);
|
||||
}
|
||||
menu->add_item(TTR("Clear Inheritance"), TOOL_SCENE_CLEAR_INHERITANCE);
|
||||
menu->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Open in Editor"), TOOL_SCENE_OPEN_INHERITED);
|
||||
} else if (!is_top_level) {
|
||||
menu->add_separator();
|
||||
bool editable = EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(selection[0]);
|
||||
bool placeholder = selection[0]->get_scene_instance_load_placeholder();
|
||||
if (profile_allow_editing) {
|
||||
menu->add_check_item(TTR("Editable Children"), TOOL_SCENE_EDITABLE_CHILDREN);
|
||||
menu->add_check_item(TTR("Load As Placeholder"), TOOL_SCENE_USE_PLACEHOLDER);
|
||||
menu->add_item(TTR("Make Local"), TOOL_SCENE_MAKE_LOCAL);
|
||||
}
|
||||
menu->add_check_item(TTR("Editable Children"), TOOL_SCENE_EDITABLE_CHILDREN);
|
||||
menu->add_check_item(TTR("Load As Placeholder"), TOOL_SCENE_USE_PLACEHOLDER);
|
||||
menu->add_item(TTR("Make Local"), TOOL_SCENE_MAKE_LOCAL);
|
||||
menu->add_icon_item(get_theme_icon("Load", "EditorIcons"), TTR("Open in Editor"), TOOL_SCENE_OPEN);
|
||||
if (profile_allow_editing) {
|
||||
menu->set_item_checked(menu->get_item_idx_from_text(TTR("Editable Children")), editable);
|
||||
menu->set_item_checked(menu->get_item_idx_from_text(TTR("Load As Placeholder")), placeholder);
|
||||
}
|
||||
menu->set_item_checked(menu->get_item_idx_from_text(TTR("Editable Children")), editable);
|
||||
menu->set_item_checked(menu->get_item_idx_from_text(TTR("Load As Placeholder")), placeholder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MODULE_REGEX_ENABLED
|
||||
if (profile_allow_editing && selection.size() > 1) {
|
||||
if (selection.size() > 1) {
|
||||
//this is not a commonly used action, it makes no sense for it to be where it was nor always present.
|
||||
menu->add_separator();
|
||||
menu->add_icon_shortcut(get_theme_icon("Rename", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/batch_rename"), TOOL_BATCH_RENAME);
|
||||
@ -3017,11 +2921,8 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
||||
#endif // MODULE_REGEX_ENABLED
|
||||
menu->add_separator();
|
||||
menu->add_icon_item(get_theme_icon("Help", "EditorIcons"), TTR("Open Documentation"), TOOL_OPEN_DOCUMENTATION);
|
||||
|
||||
if (profile_allow_editing) {
|
||||
menu->add_separator();
|
||||
menu->add_icon_shortcut(get_theme_icon("Remove", "EditorIcons"), ED_SHORTCUT("scene_tree/delete", TTR("Delete Node(s)"), KEY_DELETE), TOOL_ERASE);
|
||||
}
|
||||
menu->add_separator();
|
||||
menu->add_icon_shortcut(get_theme_icon("Remove", "EditorIcons"), ED_SHORTCUT("scene_tree/delete", TTR("Delete Node(s)"), KEY_DELETE), TOOL_ERASE);
|
||||
menu->set_size(Size2(1, 1));
|
||||
menu->set_position(p_menu_pos);
|
||||
menu->popup();
|
||||
@ -3064,10 +2965,6 @@ void SceneTreeDock::attach_script_to_selected(bool p_extend) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!profile_allow_script_editing) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
if (selection.empty()) {
|
||||
return;
|
||||
@ -3553,9 +3450,6 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
|
||||
set_process_input(true);
|
||||
set_process(true);
|
||||
|
||||
profile_allow_editing = true;
|
||||
profile_allow_script_editing = true;
|
||||
|
||||
EDITOR_DEF("interface/editors/show_scene_tree_root_selection", true);
|
||||
EDITOR_DEF("interface/editors/derive_script_globals_by_name", true);
|
||||
EDITOR_DEF("_use_favorites_root_selection", false);
|
||||
|
@ -276,9 +276,6 @@ class SceneTreeDock : public VBoxContainer {
|
||||
void _create_remap_for_node(Node *p_node, Map<RES, RES> &r_remap);
|
||||
void _create_remap_for_resource(RES p_resource, Map<RES, RES> &r_remap);
|
||||
|
||||
bool profile_allow_editing;
|
||||
bool profile_allow_script_editing;
|
||||
|
||||
bool _update_node_path(Node *p_root_node, NodePath &r_node_path, Map<Node *, NodePath> *p_renames) const;
|
||||
bool _check_node_path_recursive(Node *p_root_node, Variant &r_variant, Map<Node *, NodePath> *p_renames) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user