Add 'Copy Node Path' action to right mouse menu
This commit is contained in:
parent
82d087638d
commit
65db43d5ae
2 changed files with 17 additions and 2 deletions
|
@ -104,6 +104,9 @@ void SceneTreeDock::_unhandled_key_input(InputEvent p_event) {
|
||||||
else if (ED_IS_SHORTCUT("scene_tree/delete_no_confirm", p_event)) {
|
else if (ED_IS_SHORTCUT("scene_tree/delete_no_confirm", p_event)) {
|
||||||
_tool_selected(TOOL_ERASE, true);
|
_tool_selected(TOOL_ERASE, true);
|
||||||
}
|
}
|
||||||
|
else if(ED_IS_SHORTCUT("scene_tree/copy_node_path", p_event)) {
|
||||||
|
_tool_selected(TOOL_COPY_NODE_PATH);
|
||||||
|
}
|
||||||
else if (ED_IS_SHORTCUT("scene_tree/delete", p_event)) {
|
else if (ED_IS_SHORTCUT("scene_tree/delete", p_event)) {
|
||||||
_tool_selected(TOOL_ERASE);
|
_tool_selected(TOOL_ERASE);
|
||||||
}
|
}
|
||||||
|
@ -673,7 +676,17 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||||
new_scene_from_dialog->set_title(TTR("Save New Scene As.."));
|
new_scene_from_dialog->set_title(TTR("Save New Scene As.."));
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
case TOOL_COPY_NODE_PATH: {
|
||||||
|
List<Node*> selection = editor_selection->get_selected_node_list();
|
||||||
|
|
||||||
|
if(List<Node*>::Element *e = selection.front()) {
|
||||||
|
if(Node *node = e->get()) {
|
||||||
|
Node *root = EditorNode::get_singleton()->get_edited_scene();
|
||||||
|
NodePath path = root->get_path().rel_path_to(node->get_path());
|
||||||
|
OS::get_singleton()->set_clipboard(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1807,11 +1820,11 @@ void SceneTreeDock::_tree_rmb(const Vector2& p_menu_pos) {
|
||||||
menu->add_separator();
|
menu->add_separator();
|
||||||
menu->add_icon_shortcut(get_icon("Blend","EditorIcons"),ED_GET_SHORTCUT("scene_tree/merge_from_scene"), TOOL_MERGE_FROM_SCENE);
|
menu->add_icon_shortcut(get_icon("Blend","EditorIcons"),ED_GET_SHORTCUT("scene_tree/merge_from_scene"), TOOL_MERGE_FROM_SCENE);
|
||||||
menu->add_icon_shortcut(get_icon("Save","EditorIcons"),ED_GET_SHORTCUT("scene_tree/save_branch_as_scene"), TOOL_NEW_SCENE_FROM);
|
menu->add_icon_shortcut(get_icon("Save","EditorIcons"),ED_GET_SHORTCUT("scene_tree/save_branch_as_scene"), TOOL_NEW_SCENE_FROM);
|
||||||
|
menu->add_separator();
|
||||||
|
menu->add_icon_shortcut(get_icon("Duplicate","EditorIcons"), ED_GET_SHORTCUT("scene_tree/copy_node_path"), TOOL_COPY_NODE_PATH);
|
||||||
}
|
}
|
||||||
menu->add_separator();
|
menu->add_separator();
|
||||||
|
|
||||||
menu->add_icon_shortcut(get_icon("Remove","EditorIcons"), ED_SHORTCUT("scene_tree/delete", TTR("Delete Node(s)"), KEY_DELETE), TOOL_ERASE);
|
menu->add_icon_shortcut(get_icon("Remove","EditorIcons"), ED_SHORTCUT("scene_tree/delete", TTR("Delete Node(s)"), KEY_DELETE), TOOL_ERASE);
|
||||||
|
|
||||||
menu->set_size(Size2(1,1));
|
menu->set_size(Size2(1,1));
|
||||||
menu->set_pos(p_menu_pos);
|
menu->set_pos(p_menu_pos);
|
||||||
menu->popup();
|
menu->popup();
|
||||||
|
@ -1913,6 +1926,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec
|
||||||
ED_SHORTCUT("scene_tree/reparent", TTR("Reparent"));
|
ED_SHORTCUT("scene_tree/reparent", TTR("Reparent"));
|
||||||
ED_SHORTCUT("scene_tree/merge_from_scene", TTR("Merge From Scene"));
|
ED_SHORTCUT("scene_tree/merge_from_scene", TTR("Merge From Scene"));
|
||||||
ED_SHORTCUT("scene_tree/save_branch_as_scene", TTR("Save Branch as Scene"));
|
ED_SHORTCUT("scene_tree/save_branch_as_scene", TTR("Save Branch as Scene"));
|
||||||
|
ED_SHORTCUT("scene_tree/copy_node_path", TTR("Copy Node Path"), KEY_MASK_CMD|KEY_C);
|
||||||
ED_SHORTCUT("scene_tree/delete_no_confirm", TTR("Delete (No Confirm)"), KEY_MASK_SHIFT|KEY_DELETE);
|
ED_SHORTCUT("scene_tree/delete_no_confirm", TTR("Delete (No Confirm)"), KEY_MASK_SHIFT|KEY_DELETE);
|
||||||
ED_SHORTCUT("scene_tree/delete", TTR("Delete"), KEY_DELETE);
|
ED_SHORTCUT("scene_tree/delete", TTR("Delete"), KEY_DELETE);
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ class SceneTreeDock : public VBoxContainer {
|
||||||
TOOL_MERGE_FROM_SCENE,
|
TOOL_MERGE_FROM_SCENE,
|
||||||
TOOL_MULTI_EDIT,
|
TOOL_MULTI_EDIT,
|
||||||
TOOL_ERASE,
|
TOOL_ERASE,
|
||||||
|
TOOL_COPY_NODE_PATH,
|
||||||
TOOL_BUTTON_MAX
|
TOOL_BUTTON_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue