1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

-remove (can be added back in editor settings) icons from property editor

-remove ".." from file dialog when opening res://, fixes #2994
This commit is contained in:
Juan Linietsky
2015-12-11 09:37:34 -03:00
parent 46497c4508
commit fbda3c5d88
3 changed files with 55 additions and 26 deletions

View File

@@ -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(); dir_access->list_dir_begin();
@@ -455,7 +457,7 @@ void EditorFileDialog::update_file_list() {
if (show_hidden || !ishidden) { if (show_hidden || !ishidden) {
if (!isdir) if (!isdir)
files.push_back(item); files.push_back(item);
else else if (item!=".." || !skip_pp)
dirs.push_back(item); dirs.push_back(item);
} }
} }

View File

@@ -2549,7 +2549,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CHECK ); item->set_cell_mode( 1, TreeItem::CELL_MODE_CHECK );
item->set_text(1,"On"); item->set_text(1,"On");
item->set_checked( 1, obj->get( p.name ) ); 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); item->set_editable(1,!read_only);
} break; } break;
@@ -2561,7 +2562,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_text(1, String::num(obj->get( p.name ),2) ); item->set_text(1, String::num(obj->get( p.name ),2) );
item->set_editable(1,!read_only); 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; break;
@@ -2631,7 +2633,8 @@ void PropertyEditor::update_tree() {
// int c = p.hint_string.get_slice_count(","); // int c = p.hint_string.get_slice_count(",");
item->set_text(1,p.hint_string); 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_range(1, obj->get( p.name ) );
item->set_editable(1,!read_only); item->set_editable(1,!read_only);
break; break;
@@ -2647,11 +2650,13 @@ void PropertyEditor::update_tree() {
}; };
if (p.type==Variant::REAL) { 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 ) ); item->set_range(1, obj->get( p.name ) );
} else { } 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 ) ); 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_cell_mode( 1, TreeItem::CELL_MODE_STRING );
item->set_editable(1,!read_only); 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->set_text(1,obj->get(p.name));
item->add_button(1,get_icon("Folder","EditorIcons")); 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_text(1, p.hint_string);
item->set_range(1,idx); item->set_range(1,idx);
item->set_editable( 1, !read_only ); 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; } break;
@@ -2699,7 +2706,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_STRING ); item->set_cell_mode( 1, TreeItem::CELL_MODE_STRING );
item->set_editable(1,!read_only); 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)); item->set_text(1,obj->get(p.name));
if (p.hint==PROPERTY_HINT_MULTILINE_TEXT) if (p.hint==PROPERTY_HINT_MULTILINE_TEXT)
item->add_button(1,get_icon("MultiLine","EditorIcons") ); 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"))+"]"); item->set_text(1,"Array["+itos(v.call("size"))+"]");
else else
item->set_text(1,"Array[]"); 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; } break;
@@ -2734,7 +2743,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"IntArray["+itos(v.call("size"))+"]"); item->set_text(1,"IntArray["+itos(v.call("size"))+"]");
else else
item->set_text(1,"IntArray[]"); 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; } break;
@@ -2748,7 +2758,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"FloatArray["+itos(v.call("size"))+"]"); item->set_text(1,"FloatArray["+itos(v.call("size"))+"]");
else else
item->set_text(1,"FloatArray[]"); 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; } break;
@@ -2762,7 +2773,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"String["+itos(v.call("size"))+"]"); item->set_text(1,"String["+itos(v.call("size"))+"]");
else else
item->set_text(1,"String[]"); 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; } break;
@@ -2776,7 +2788,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"Byte["+itos(v.call("size"))+"]"); item->set_text(1,"Byte["+itos(v.call("size"))+"]");
else else
item->set_text(1,"Byte[]"); 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; } break;
@@ -2790,7 +2803,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"Vector2["+itos(v.call("size"))+"]"); item->set_text(1,"Vector2["+itos(v.call("size"))+"]");
else else
item->set_text(1,"Vector2[]"); 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; } break;
@@ -2804,7 +2818,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"Vector3["+itos(v.call("size"))+"]"); item->set_text(1,"Vector3["+itos(v.call("size"))+"]");
else else
item->set_text(1,"Vector3[]"); 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; } break;
@@ -2818,7 +2833,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"Color["+itos(v.call("size"))+"]"); item->set_text(1,"Color["+itos(v.call("size"))+"]");
else else
item->set_text(1,"Color[]"); 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; } break;
@@ -2827,7 +2843,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, true ); item->set_editable( 1, true );
item->set_text(1,obj->get(p.name)); 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; } break;
case Variant::RECT2: { case Variant::RECT2: {
@@ -2835,7 +2852,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, true ); item->set_editable( 1, true );
item->set_text(1,obj->get(p.name)); 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; } break;
case Variant::VECTOR3: { case Variant::VECTOR3: {
@@ -2843,7 +2861,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, true ); item->set_editable( 1, true );
item->set_text(1,obj->get(p.name)); 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; } break;
case Variant::MATRIX32: case Variant::MATRIX32:
@@ -2858,7 +2877,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, true ); item->set_editable( 1, true );
item->set_text(1,obj->get(p.name)); 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; } break;
case Variant::PLANE: { case Variant::PLANE: {
@@ -2866,7 +2886,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, true ); item->set_editable( 1, true );
item->set_text(1,obj->get(p.name)); 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; } break;
case Variant::_AABB: { case Variant::_AABB: {
@@ -2874,7 +2895,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, true ); item->set_editable( 1, true );
item->set_text(1,"AABB"); 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; } break;
case Variant::QUAT: { case Variant::QUAT: {
@@ -2882,7 +2904,8 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, true ); item->set_editable( 1, true );
item->set_text(1,obj->get(p.name)); 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; } break;
case Variant::COLOR: { case Variant::COLOR: {
@@ -2891,7 +2914,8 @@ void PropertyEditor::update_tree() {
item->set_editable( 1, !read_only ); item->set_editable( 1, !read_only );
// item->set_text(1,obj->get(p.name)); // item->set_text(1,obj->get(p.name));
item->set_custom_bg_color(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; } break;
case Variant::IMAGE: { case Variant::IMAGE: {
@@ -2903,7 +2927,8 @@ void PropertyEditor::update_tree() {
item->set_text(1,"[Image (empty)]"); item->set_text(1,"[Image (empty)]");
else else
item->set_text(1,"[Image "+itos(img.get_width())+"x"+itos(img.get_height())+"]"); 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; } break;
case Variant::NODE_PATH: { case Variant::NODE_PATH: {
@@ -3583,6 +3608,7 @@ PropertyEditor::PropertyEditor() {
use_doc_hints=false; use_doc_hints=false;
use_filter=false; use_filter=false;
subsection_selectable=false; subsection_selectable=false;
show_type_icons=EDITOR_DEF("inspector/show_type_icons",false);
} }

View File

@@ -161,6 +161,7 @@ class PropertyEditor : public Control {
bool keying; bool keying;
bool read_only; bool read_only;
bool show_categories; bool show_categories;
bool show_type_icons;
float refresh_countdown; float refresh_countdown;
bool use_doc_hints; bool use_doc_hints;
bool use_filter; bool use_filter;