diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-02-02 20:44:42 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-02-02 20:44:42 -0300 |
commit | 6349c50f5a2b2a1e2ad867582c7321942fc586d7 (patch) | |
tree | 20ff26d82659b5b311929d5a467ff8693ccd7c71 /tools | |
parent | 9c4c6e4c4feac786be69c8f18425c5d3258cfcf4 (diff) |
-Add some offset to spinboxes in tree, so revert icon does not annoy much when pops up, fixes #3415
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/icons/icon_reload_small.png | bin | 0 -> 447 bytes | |||
-rw-r--r-- | tools/editor/property_editor.cpp | 41 |
2 files changed, 29 insertions, 12 deletions
diff --git a/tools/editor/icons/icon_reload_small.png b/tools/editor/icons/icon_reload_small.png Binary files differnew file mode 100644 index 0000000000..957cdfcf4f --- /dev/null +++ b/tools/editor/icons/icon_reload_small.png diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 3dfc461bfe..efc821b874 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -714,7 +714,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty RES r = v; if (r.is_valid() && r->get_path().is_resource_file() && r->get_import_metadata().is_valid()) { menu->add_separator(); - menu->add_icon_item(get_icon("Reload","EditorIcons"),"Re-Import",OBJ_MENU_REIMPORT); + menu->add_icon_item(get_icon("ReloadSmall","EditorIcons"),"Re-Import",OBJ_MENU_REIMPORT); } /*if (r.is_valid() && r->get_path().is_resource_file()) { menu->set_item_tooltip(1,r->get_path()); @@ -2127,11 +2127,13 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) { bool has_reload=false; int found=-1; + bool is_disabled=false; for(int i=0;i<item->get_button_count(1);i++) { if (item->get_button_id(1,i)==3) { found=i; + is_disabled=item->is_button_disabled(1,i); break; } } @@ -2149,7 +2151,7 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) { bool changed = _is_property_different(v,vorig,usage); - if ((found!=-1)!=changed) { + //if ((found!=-1 && !is_disabled)!=changed) { if (changed) { @@ -2158,11 +2160,9 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) { } - } - - } - + //} + } } @@ -2176,10 +2176,20 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) { } } + //print_line("found: "+itos(found)+" has reload: "+itos(has_reload)+" is_disabled "+itos(is_disabled)); if (found!=-1 && !has_reload) { - item->erase_button(1,found); + + if (!is_disabled) { + item->erase_button(1,found); + if (item->get_cell_mode(1)==TreeItem::CELL_MODE_RANGE && item->get_text(1)==String()) { + item->add_button(1,get_icon("ReloadEmpty","EditorIcons"),3,true); + } + } } else if (found==-1 && has_reload) { - item->add_button(1,get_icon("Reload","EditorIcons"),3); + item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3); + } else if (found!=-1 && has_reload && is_disabled) { + item->erase_button(1,found); + item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3); } } @@ -2348,7 +2358,7 @@ void PropertyEditor::_refresh_item(TreeItem *p_item) { if (!has_reload && found!=-1) { p_item->erase_button(1,found); } else if (has_reload && found==-1) { - p_item->add_button(1,get_icon("Reload","EditorIcons"),3); + p_item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3); } #endif Dictionary d=p_item->get_metadata(0); @@ -3092,7 +3102,9 @@ void PropertyEditor::update_tree() { } bool has_reload=false; - if (_might_be_in_instance()) { + + bool mbi = _might_be_in_instance(); + if (mbi) { Variant vorig; Dictionary d=item->get_metadata(0); @@ -3103,7 +3115,7 @@ void PropertyEditor::update_tree() { if (_is_property_different(v,vorig,usage)) { //print_line("FOR "+String(p.name)+" RELOAD WITH: "+String(v)+"("+Variant::get_type_name(v.get_type())+")=="+String(vorig)+"("+Variant::get_type_name(vorig.get_type())+")"); - item->add_button(1,get_icon("Reload","EditorIcons"),3); + item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3); has_reload=true; } } @@ -3115,11 +3127,16 @@ void PropertyEditor::update_tree() { Variant orig_value; if (scr->get_property_default_value(p.name,orig_value)) { if (orig_value!=obj->get(p.name)) { - item->add_button(1,get_icon("Reload","EditorIcons"),3); + item->add_button(1,get_icon("ReloadSmall","EditorIcons"),3); + has_reload=true; } } } + if (mbi && !has_reload && item->get_cell_mode(1)==TreeItem::CELL_MODE_RANGE && item->get_text(1)==String()) { + item->add_button(1,get_icon("ReloadEmpty","EditorIcons"),3,true); + } + } |