From fbda3c5d88bbe2112a257ff93caeed98f4e9873a Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 11 Dec 2015 09:37:34 -0300 Subject: [PATCH] -remove (can be added back in editor settings) icons from property editor -remove ".." from file dialog when opening res://, fixes #2994 --- tools/editor/editor_file_dialog.cpp | 4 +- tools/editor/property_editor.cpp | 76 +++++++++++++++++++---------- tools/editor/property_editor.h | 1 + 3 files changed, 55 insertions(+), 26 deletions(-) diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index 104539c3089..7365cf90694 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -435,6 +435,8 @@ void EditorFileDialog::update_file_list() { } + String cdir = dir_access->get_current_dir(); + bool skip_pp = access==ACCESS_RESOURCES && cdir=="res://"; dir_access->list_dir_begin(); @@ -455,7 +457,7 @@ void EditorFileDialog::update_file_list() { if (show_hidden || !ishidden) { if (!isdir) files.push_back(item); - else + else if (item!=".." || !skip_pp) dirs.push_back(item); } } diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 7ab09f04874..0a06d78255e 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -2549,7 +2549,8 @@ void PropertyEditor::update_tree() { item->set_cell_mode( 1, TreeItem::CELL_MODE_CHECK ); item->set_text(1,"On"); item->set_checked( 1, obj->get( p.name ) ); - item->set_icon( 0, get_icon("Bool","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0, get_icon("Bool","EditorIcons") ); item->set_editable(1,!read_only); } break; @@ -2561,7 +2562,8 @@ void PropertyEditor::update_tree() { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_text(1, String::num(obj->get( p.name ),2) ); item->set_editable(1,!read_only); - item->set_icon( 0, get_icon("Curve","EditorIcons")); + if (show_type_icons) + item->set_icon( 0, get_icon("Curve","EditorIcons")); break; @@ -2631,7 +2633,8 @@ void PropertyEditor::update_tree() { // int c = p.hint_string.get_slice_count(","); item->set_text(1,p.hint_string); - item->set_icon( 0,get_icon("Enum","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0,get_icon("Enum","EditorIcons") ); item->set_range(1, obj->get( p.name ) ); item->set_editable(1,!read_only); break; @@ -2647,11 +2650,13 @@ void PropertyEditor::update_tree() { }; if (p.type==Variant::REAL) { - item->set_icon( 0, get_icon("Real","EditorIcons")); + if (show_type_icons) + item->set_icon( 0, get_icon("Real","EditorIcons")); item->set_range(1, obj->get( p.name ) ); } else { - item->set_icon( 0,get_icon("Integer","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0,get_icon("Integer","EditorIcons") ); item->set_range(1, obj->get( p.name ) ); } @@ -2671,7 +2676,8 @@ void PropertyEditor::update_tree() { item->set_cell_mode( 1, TreeItem::CELL_MODE_STRING ); item->set_editable(1,!read_only); - item->set_icon( 0, get_icon("File","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0, get_icon("File","EditorIcons") ); item->set_text(1,obj->get(p.name)); item->add_button(1,get_icon("Folder","EditorIcons")); @@ -2691,7 +2697,8 @@ void PropertyEditor::update_tree() { item->set_text(1, p.hint_string); item->set_range(1,idx); item->set_editable( 1, !read_only ); - item->set_icon( 0,get_icon("Enum","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0,get_icon("Enum","EditorIcons") ); } break; @@ -2699,7 +2706,8 @@ void PropertyEditor::update_tree() { item->set_cell_mode( 1, TreeItem::CELL_MODE_STRING ); item->set_editable(1,!read_only); - item->set_icon( 0, get_icon("String","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0, get_icon("String","EditorIcons") ); item->set_text(1,obj->get(p.name)); if (p.hint==PROPERTY_HINT_MULTILINE_TEXT) item->add_button(1,get_icon("MultiLine","EditorIcons") ); @@ -2719,7 +2727,8 @@ void PropertyEditor::update_tree() { item->set_text(1,"Array["+itos(v.call("size"))+"]"); else item->set_text(1,"Array[]"); - item->set_icon( 0, get_icon("ArrayData","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0, get_icon("ArrayData","EditorIcons") ); } break; @@ -2734,7 +2743,8 @@ void PropertyEditor::update_tree() { item->set_text(1,"IntArray["+itos(v.call("size"))+"]"); else item->set_text(1,"IntArray[]"); - item->set_icon( 0, get_icon("ArrayInt","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0, get_icon("ArrayInt","EditorIcons") ); } break; @@ -2748,7 +2758,8 @@ void PropertyEditor::update_tree() { item->set_text(1,"FloatArray["+itos(v.call("size"))+"]"); else item->set_text(1,"FloatArray[]"); - item->set_icon( 0, get_icon("ArrayReal","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0, get_icon("ArrayReal","EditorIcons") ); } break; @@ -2762,7 +2773,8 @@ void PropertyEditor::update_tree() { item->set_text(1,"String["+itos(v.call("size"))+"]"); else item->set_text(1,"String[]"); - item->set_icon( 0, get_icon("ArrayString","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0, get_icon("ArrayString","EditorIcons") ); } break; @@ -2776,7 +2788,8 @@ void PropertyEditor::update_tree() { item->set_text(1,"Byte["+itos(v.call("size"))+"]"); else item->set_text(1,"Byte[]"); - item->set_icon( 0, get_icon("ArrayData","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0, get_icon("ArrayData","EditorIcons") ); } break; @@ -2790,7 +2803,8 @@ void PropertyEditor::update_tree() { item->set_text(1,"Vector2["+itos(v.call("size"))+"]"); else item->set_text(1,"Vector2[]"); - item->set_icon( 0, get_icon("Vector2","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0, get_icon("Vector2","EditorIcons") ); } break; @@ -2804,7 +2818,8 @@ void PropertyEditor::update_tree() { item->set_text(1,"Vector3["+itos(v.call("size"))+"]"); else item->set_text(1,"Vector3[]"); - item->set_icon( 0, get_icon("Vector","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0, get_icon("Vector","EditorIcons") ); } break; @@ -2818,7 +2833,8 @@ void PropertyEditor::update_tree() { item->set_text(1,"Color["+itos(v.call("size"))+"]"); else item->set_text(1,"Color[]"); - item->set_icon( 0, get_icon("Color","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0, get_icon("Color","EditorIcons") ); } break; @@ -2827,7 +2843,8 @@ void PropertyEditor::update_tree() { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_editable( 1, true ); item->set_text(1,obj->get(p.name)); - item->set_icon( 0,get_icon("Vector2","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0,get_icon("Vector2","EditorIcons") ); } break; case Variant::RECT2: { @@ -2835,7 +2852,8 @@ void PropertyEditor::update_tree() { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_editable( 1, true ); item->set_text(1,obj->get(p.name)); - item->set_icon( 0,get_icon("Rect2","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0,get_icon("Rect2","EditorIcons") ); } break; case Variant::VECTOR3: { @@ -2843,7 +2861,8 @@ void PropertyEditor::update_tree() { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_editable( 1, true ); item->set_text(1,obj->get(p.name)); - item->set_icon( 0,get_icon("Vector","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0,get_icon("Vector","EditorIcons") ); } break; case Variant::MATRIX32: @@ -2858,7 +2877,8 @@ void PropertyEditor::update_tree() { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_editable( 1, true ); item->set_text(1,obj->get(p.name)); - item->set_icon( 0,get_icon("Matrix","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0,get_icon("Matrix","EditorIcons") ); } break; case Variant::PLANE: { @@ -2866,7 +2886,8 @@ void PropertyEditor::update_tree() { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_editable( 1, true ); item->set_text(1,obj->get(p.name)); - item->set_icon( 0,get_icon("Plane","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0,get_icon("Plane","EditorIcons") ); } break; case Variant::_AABB: { @@ -2874,7 +2895,8 @@ void PropertyEditor::update_tree() { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_editable( 1, true ); item->set_text(1,"AABB"); - item->set_icon( 0,get_icon("Rect3","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0,get_icon("Rect3","EditorIcons") ); } break; case Variant::QUAT: { @@ -2882,7 +2904,8 @@ void PropertyEditor::update_tree() { item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_editable( 1, true ); item->set_text(1,obj->get(p.name)); - item->set_icon( 0,get_icon("Quat","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0,get_icon("Quat","EditorIcons") ); } break; case Variant::COLOR: { @@ -2891,7 +2914,8 @@ void PropertyEditor::update_tree() { item->set_editable( 1, !read_only ); // item->set_text(1,obj->get(p.name)); item->set_custom_bg_color(1,obj->get(p.name)); - item->set_icon( 0,get_icon("Color","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0,get_icon("Color","EditorIcons") ); } break; case Variant::IMAGE: { @@ -2903,7 +2927,8 @@ void PropertyEditor::update_tree() { item->set_text(1,"[Image (empty)]"); else item->set_text(1,"[Image "+itos(img.get_width())+"x"+itos(img.get_height())+"]"); - item->set_icon( 0,get_icon("Image","EditorIcons") ); + if (show_type_icons) + item->set_icon( 0,get_icon("Image","EditorIcons") ); } break; case Variant::NODE_PATH: { @@ -3583,6 +3608,7 @@ PropertyEditor::PropertyEditor() { use_doc_hints=false; use_filter=false; subsection_selectable=false; + show_type_icons=EDITOR_DEF("inspector/show_type_icons",false); } diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index f004616c081..e933d7ab3b6 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -161,6 +161,7 @@ class PropertyEditor : public Control { bool keying; bool read_only; bool show_categories; + bool show_type_icons; float refresh_countdown; bool use_doc_hints; bool use_filter;