summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-12-17 20:02:41 +0100
committerGitHub <noreply@github.com>2017-12-17 20:02:41 +0100
commit3ce5a74df2572c48f12e86335c5c0a919d195b55 (patch)
tree155d2b5c488fd7b1d7d0572e51991060709ec68d /editor
parent89a32b49778b5411b2bc562260c49925eb219334 (diff)
parent002a0271fe5ab8564cd08bcc74ec5c8082e1e080 (diff)
Merge pull request #14770 from volzhs/sub-resources
Show sub-resources as sub-menu
Diffstat (limited to 'editor')
-rw-r--r--editor/scene_tree_dock.cpp12
-rw-r--r--editor/scene_tree_dock.h1
2 files changed, 8 insertions, 5 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 4d5d467857..6fbca5c904 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1699,12 +1699,11 @@ void SceneTreeDock::_add_children_to_popup(Object *p_obj, int p_depth) {
icon = get_icon("Object", "EditorIcons");
if (menu->get_item_count() == 0) {
- menu->add_item(TTR("Sub-Resources:"));
- menu->set_item_disabled(0, true);
+ menu->add_submenu_item(TTR("Sub-Resources:"), "Sub-Resources");
}
- int index = menu->get_item_count();
- menu->add_icon_item(icon, E->get().name.capitalize(), EDIT_SUBRESOURCE_BASE + subresources.size());
- menu->set_item_h_offset(index, p_depth * 10 * EDSCALE);
+ int index = menu_subresources->get_item_count();
+ menu_subresources->add_icon_item(icon, E->get().name.capitalize(), EDIT_SUBRESOURCE_BASE + subresources.size());
+ menu_subresources->set_item_h_offset(index, p_depth * 10 * EDSCALE);
subresources.push_back(obj->get_instance_id());
_add_children_to_popup(obj, p_depth + 1);
@@ -2049,6 +2048,9 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
menu = memnew(PopupMenu);
add_child(menu);
menu->connect("id_pressed", this, "_tool_selected");
+ menu_subresources = memnew(PopupMenu);
+ menu_subresources->set_name("Sub-Resources");
+ menu->add_child(menu_subresources);
first_enter = true;
restore_script_editor_on_drag = false;
diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h
index 41d5bda180..6a281bb7e8 100644
--- a/editor/scene_tree_dock.h
+++ b/editor/scene_tree_dock.h
@@ -119,6 +119,7 @@ class SceneTreeDock : public VBoxContainer {
TextureRect *filter_icon;
PopupMenu *menu;
+ PopupMenu *menu_subresources;
ConfirmationDialog *clear_inherit_confirm;
bool first_enter;