diff options
Diffstat (limited to 'tools/editor/property_editor.cpp')
-rw-r--r-- | tools/editor/property_editor.cpp | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index ea036593b8..de10e68f33 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -84,6 +84,20 @@ void CustomPropertyEditor::_menu_option(int p_which) { v=val; emit_signal("variant_changed"); + } else if (hint==PROPERTY_HINT_ENUM) { + + v=p_which; + emit_signal("variant_changed"); + + } + } break; + case Variant::STRING: { + + if (hint==PROPERTY_HINT_ENUM) { + + v=hint_text.get_slice(",",p_which); + emit_signal("variant_changed"); + } } break; case Variant::OBJECT: { @@ -283,6 +297,16 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty switch(type) { + case Variant::BOOL: { + + CheckBox *c=checks20[0]; + c->set_text("True"); + c->set_pos(Vector2(4,4)); + c->set_pressed(v); + c->show(); + set_size(checks20[0]->get_pos()+checks20[0]->get_size()+Vector2(4,4)*EDSCALE); + + } break; case Variant::INT: case Variant::REAL: { @@ -323,9 +347,24 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty set_size(Size2(70,35)*EDSCALE); } + } else if (hint==PROPERTY_HINT_ENUM) { + + menu->clear(); + Vector<String> options = hint_text.split(","); + for(int i=0;i<options.size();i++) { + menu->add_item(options[i],i); + } + menu->set_pos(get_pos()); + menu->popup(); + hide(); + updating=false; + return false; + } else if (hint==PROPERTY_HINT_ALL_FLAGS) { + checks20[0]->set_text(""); + uint32_t flgs = v; for(int i=0;i<2;i++) { @@ -416,7 +455,16 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty config_action_buttons(names); } else if (hint==PROPERTY_HINT_ENUM) { - + menu->clear(); + Vector<String> options = hint_text.split(","); + for(int i=0;i<options.size();i++) { + menu->add_item(options[i],i); + } + menu->set_pos(get_pos()); + menu->popup(); + hide(); + updating=false; + return false; } else if (hint==PROPERTY_HINT_MULTILINE_TEXT) { @@ -1117,6 +1165,10 @@ void CustomPropertyEditor::_action_pressed(int p_which) { return; switch(type) { + case Variant::BOOL: { + v=checks20[0]->is_pressed(); + emit_signal("variant_changed"); + } break; case Variant::INT: { if (hint==PROPERTY_HINT_ALL_FLAGS) { @@ -1151,6 +1203,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { file->clear_filters(); + if (hint_text!="") { Vector<String> extensions=hint_text.split(","); for(int i=0;i<extensions.size();i++) { @@ -3703,7 +3756,7 @@ void PropertyEditor::_edit_set(const String& p_name, const Variant& p_value) { } else { - undo_redo->create_action(TTR("Set")+" "+p_name,true); + undo_redo->create_action(TTR("Set")+" "+p_name,UndoRedo::MERGE_ENDS); undo_redo->add_do_property(obj,p_name,p_value); undo_redo->add_undo_property(obj,p_name,obj->get(p_name)); undo_redo->add_do_method(this,"_changed_callback",obj,p_name); @@ -4504,7 +4557,7 @@ void SectionedPropertyEditor::update_category_list() { else if ( !(pi.usage&PROPERTY_USAGE_EDITOR) ) continue; - if (pi.name.find(":")!=-1 || pi.name=="script/script") + if (pi.name.find(":")!=-1 || pi.name=="script/script" || pi.name.begins_with("resource/")) continue; int sp = pi.name.find("/"); if (sp!=-1) { |