diff options
Diffstat (limited to 'tools/editor/property_editor.cpp')
-rw-r--r-- | tools/editor/property_editor.cpp | 90 |
1 files changed, 62 insertions, 28 deletions
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 4ed3f3cbe0..9fb623022b 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -2217,9 +2217,9 @@ TreeItem *PropertyEditor::get_parent_node(String p_path,HashMap<String,TreeItem* } item->set_editable(0,false); - item->set_selectable(0,false); + item->set_selectable(0,subsection_selectable); item->set_editable(1,false); - item->set_selectable(1,false); + item->set_selectable(1,subsection_selectable); if (item->get_parent()==root) { @@ -2559,7 +2559,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; @@ -2571,7 +2572,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; @@ -2641,7 +2643,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; @@ -2657,11 +2660,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 ) ); } @@ -2681,7 +2686,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")); @@ -2701,7 +2707,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; @@ -2709,7 +2716,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") ); @@ -2729,7 +2737,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; @@ -2744,7 +2753,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; @@ -2758,7 +2768,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; @@ -2772,7 +2783,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; @@ -2786,7 +2798,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; @@ -2800,7 +2813,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; @@ -2814,7 +2828,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; @@ -2828,7 +2843,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; @@ -2837,7 +2853,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: { @@ -2845,7 +2862,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: { @@ -2853,7 +2871,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: @@ -2868,7 +2887,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: { @@ -2876,7 +2896,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: { @@ -2884,7 +2905,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: { @@ -2892,7 +2914,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: { @@ -2901,7 +2924,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: { @@ -2913,7 +2937,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: { @@ -3521,7 +3546,15 @@ void PropertyEditor::register_text_enter(Node* p_line_edit) { if (search_box) search_box->connect("text_changed",this,"_filter_changed"); +} + +void PropertyEditor::set_subsection_selectable(bool p_selectable) { + if (p_selectable==subsection_selectable) + return; + + subsection_selectable=p_selectable; + update_tree(); } PropertyEditor::PropertyEditor() { @@ -3583,8 +3616,9 @@ PropertyEditor::PropertyEditor() { show_categories=false; refresh_countdown=0; use_doc_hints=false; - use_filter=false; + subsection_selectable=false; + show_type_icons=EDITOR_DEF("inspector/show_type_icons",false); } |