diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-08-26 17:34:25 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-08-26 17:38:25 -0300 |
commit | ec49f41e19f1088b1bc8df4e8ef360270aa34204 (patch) | |
tree | 763e70d166d6ca41c8795aceacfdf53dd7c9020f /tools | |
parent | 963ed2d9fae503f82754d11b5ce24182489839f8 (diff) |
Even more work on visual script editor:
-Added constructor nodes, specialized and conversion ones.
-Cleaned up how unconnected input default values are shown and edited (much cleaner)
-Dragging scene nodes into graph makes a call dialog appear by deault
-Dragging properties into graph is set by default, not get
-fixed dragging internal functions into graph
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/property_editor.cpp | 34 | ||||
-rw-r--r-- | tools/editor/property_selector.h | 4 |
2 files changed, 36 insertions, 2 deletions
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index d7e527f473..9fc9d52aa1 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -84,6 +84,11 @@ 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::OBJECT: { @@ -283,6 +288,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 +338,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++) { @@ -1117,6 +1147,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) { diff --git a/tools/editor/property_selector.h b/tools/editor/property_selector.h index c70b949a3b..f7f0e7e167 100644 --- a/tools/editor/property_selector.h +++ b/tools/editor/property_selector.h @@ -42,12 +42,12 @@ public: void select_method_from_base_type(const String& p_base,const String& p_current=""); void select_method_from_script(const Ref<Script>& p_script,const String& p_current=""); void select_method_from_basic_type(Variant::Type p_type,const String& p_current=""); - void select_method_from_instance(Object* p_instance, const String &p_current); + void select_method_from_instance(Object* p_instance, const String &p_current=""); void select_property_from_base_type(const String& p_base,const String& p_current=""); void select_property_from_script(const Ref<Script>& p_script,const String& p_current=""); void select_property_from_basic_type(Variant::Type p_type,InputEvent::Type p_event_type,const String& p_current=""); - void select_property_from_instance(Object* p_instance, const String &p_current); + void select_property_from_instance(Object* p_instance, const String &p_current=""); PropertySelector(); }; |