diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/SCsub | 29 | ||||
-rw-r--r-- | tools/editor/doc/doc_data.cpp | 7 | ||||
-rw-r--r-- | tools/editor/doc/doc_data.h | 1 | ||||
-rw-r--r-- | tools/editor/multi_node_edit.cpp | 21 | ||||
-rw-r--r-- | tools/editor/multi_node_edit.h | 4 | ||||
-rw-r--r-- | tools/editor/project_export.cpp | 23 | ||||
-rw-r--r-- | tools/editor/project_settings.cpp | 57 | ||||
-rw-r--r-- | tools/editor/property_editor.cpp | 190 | ||||
-rw-r--r-- | tools/editor/property_editor.h | 7 | ||||
-rw-r--r-- | tools/editor/settings_config_dialog.cpp | 23 |
10 files changed, 239 insertions, 123 deletions
diff --git a/tools/editor/SCsub b/tools/editor/SCsub index 76eb65748a..c9b2392eb2 100644 --- a/tools/editor/SCsub +++ b/tools/editor/SCsub @@ -3,6 +3,8 @@ Import('env') env.editor_sources = [] +import os + def make_certs_header(target, source, env): @@ -29,11 +31,21 @@ def make_certs_header(target, source, env): def make_doc_header(target, source, env): - src = source[0].srcnode().abspath dst = target[0].srcnode().abspath - f = open(src, "rb") g = open(dst, "wb") - buf = f.read() + buf = "" + docbegin = "" + docend = "" + for s in source: + src = s.srcnode().abspath + f = open(src, "rb") + content = f.read() + buf += content[content.find("<class"): content.rfind("</doc>")] + if len(docbegin) == 0: + docbegin = content[0: content.find("<class")] + if len(docend) == 0: + docend = content[content.rfind("</doc>"): len(buf)] + buf = docbegin + buf + docend decomp_size = len(buf) import zlib buf = zlib.compress(buf) @@ -146,8 +158,15 @@ if (env["tools"] == "yes"): f.close() # API documentation - env.Depends("#tools/editor/doc_data_compressed.h", "#doc/base/classes.xml") - env.Command("#tools/editor/doc_data_compressed.h", "#doc/base/classes.xml", make_doc_header) + docs = ["#doc/base/classes.xml"] + moduledir = os.path.join(os.getcwd(), "..", "..", "modules") + for m in os.listdir(moduledir): + curmodle = os.path.join(moduledir, m) + docfile = os.path.join(curmodle, "classes.xml") + if os.path.isdir(curmodle) and os.path.isfile(docfile): + docs.append(docfile) + env.Depends("#tools/editor/doc_data_compressed.h", docs) + env.Command("#tools/editor/doc_data_compressed.h", docs, make_doc_header) # Certificates env.Depends("#tools/editor/certs_compressed.h", "#thirdparty/certs/ca-certificates.crt") diff --git a/tools/editor/doc/doc_data.cpp b/tools/editor/doc/doc_data.cpp index e0a4750862..47b8edfa04 100644 --- a/tools/editor/doc/doc_data.cpp +++ b/tools/editor/doc/doc_data.cpp @@ -158,6 +158,13 @@ void DocData::merge_from(const DocData& p_data) { } +void DocData::remove_from(const DocData &p_data) { + for(Map<String,ClassDoc>::Element* E=p_data.class_list.front(); E; E=E->next()) { + if(class_list.has(E->key())) + class_list.erase(E->key()); + } +} + void DocData::generate(bool p_basic_types) { diff --git a/tools/editor/doc/doc_data.h b/tools/editor/doc/doc_data.h index fead1da510..7601013979 100644 --- a/tools/editor/doc/doc_data.h +++ b/tools/editor/doc/doc_data.h @@ -98,6 +98,7 @@ public: public: void merge_from(const DocData& p_data); + void remove_from(const DocData& p_data); void generate(bool p_basic_types=false); Error load(const String& p_path); Error save(const String& p_path); diff --git a/tools/editor/multi_node_edit.cpp b/tools/editor/multi_node_edit.cpp index 27bb6d66fc..0428d7ef30 100644 --- a/tools/editor/multi_node_edit.cpp +++ b/tools/editor/multi_node_edit.cpp @@ -29,9 +29,15 @@ #include "multi_node_edit.h" #include "editor_node.h" +#include "core/helper/math_fieldwise.h" bool MultiNodeEdit::_set(const StringName& p_name, const Variant& p_value){ + return _set_impl(p_name, p_value, ""); +} + +bool MultiNodeEdit::_set_impl(const StringName& p_name, const Variant& p_value, const String& p_field) { + Node *es = EditorNode::get_singleton()->get_edited_scene(); if (!es) return false; @@ -59,7 +65,15 @@ bool MultiNodeEdit::_set(const StringName& p_name, const Variant& p_value){ NodePath p_path = n->get_path_to(tonode); ur->add_do_property(n,name,p_path); } else { - ur->add_do_property(n,name,p_value); + Variant new_value; + if (p_field=="") { + // whole value + new_value=p_value; + } else { + // only one field + new_value=fieldwise_assign(n->get(name),p_value,p_field); + } + ur->add_do_property(n,name,new_value); } ur->add_undo_property(n,name,n->get(name)); @@ -167,6 +181,11 @@ void MultiNodeEdit::add_node(const NodePath& p_node){ nodes.push_back(p_node); } +void MultiNodeEdit::set_property_field(const StringName& p_property, const Variant& p_value, const String& p_field) { + + _set_impl(p_property, p_value, p_field); +} + MultiNodeEdit::MultiNodeEdit() { } diff --git a/tools/editor/multi_node_edit.h b/tools/editor/multi_node_edit.h index 290c529d48..26e557c1cb 100644 --- a/tools/editor/multi_node_edit.h +++ b/tools/editor/multi_node_edit.h @@ -41,6 +41,8 @@ class MultiNodeEdit : public Reference { PropertyInfo info; }; + bool _set_impl(const StringName& p_name, const Variant& p_value, const String& p_field); + protected: @@ -55,6 +57,8 @@ public: void clear_nodes(); void add_node(const NodePath& p_node); + void set_property_field(const StringName& p_property, const Variant& p_value, const String& p_field); + MultiNodeEdit(); }; diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index f6593a4895..fc6d8793d8 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -46,10 +46,14 @@ void ProjectExportDialog::_notification(int p_what) { - if (p_what==NOTIFICATION_READY) { - delete_preset->set_icon(get_icon("Del","EditorIcons")); - connect("confirmed",this,"_export_pck_zip"); - + switch (p_what) { + case NOTIFICATION_READY: { + delete_preset->set_icon(get_icon("Del","EditorIcons")); + connect("confirmed",this,"_export_pck_zip"); + } break; + case NOTIFICATION_POPUP_HIDE: { + EditorSettings::get_singleton()->set("interface/dialogs/export_bounds", get_rect()); + } break; } } @@ -66,7 +70,13 @@ void ProjectExportDialog::popup_export() { } _update_presets(); - popup_centered_ratio(); + + // Restore valid window bounds or pop up at default size. + if (EditorSettings::get_singleton()->has("interface/dialogs/export_bounds")) { + popup(EditorSettings::get_singleton()->get("interface/dialogs/export_bounds")); + } else { + popup_centered_ratio(); + } } void ProjectExportDialog::_add_preset(int p_platform) { @@ -664,6 +674,9 @@ void ProjectExportDialog::_bind_methods() { } ProjectExportDialog::ProjectExportDialog() { + set_title(TTR("Export")); + set_resizable(true); + HBoxContainer *hbox = memnew( HBoxContainer ); add_child(hbox); diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index ed3c59cc4a..15019b8ca8 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -73,34 +73,38 @@ static const char* _axis_names[JOY_AXIS_MAX*2] = { void ProjectSettings::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_TREE) { + switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + globals_editor->edit(GlobalConfig::get_singleton()); - globals_editor->edit(GlobalConfig::get_singleton()); + search_button->set_icon(get_icon("Zoom","EditorIcons")); + clear_button->set_icon(get_icon("Close","EditorIcons")); - search_button->set_icon(get_icon("Zoom","EditorIcons")); - clear_button->set_icon(get_icon("Close","EditorIcons")); + translation_list->connect("button_pressed",this,"_translation_delete"); + _update_actions(); + popup_add->add_icon_item(get_icon("Keyboard","EditorIcons"),TTR("Key "),InputEvent::KEY);//"Key " - because the word 'key' has already been used as a key animation + popup_add->add_icon_item(get_icon("JoyButton","EditorIcons"),TTR("Joy Button"),InputEvent::JOYPAD_BUTTON); + popup_add->add_icon_item(get_icon("JoyAxis","EditorIcons"),TTR("Joy Axis"),InputEvent::JOYPAD_MOTION); + popup_add->add_icon_item(get_icon("Mouse","EditorIcons"),TTR("Mouse Button"),InputEvent::MOUSE_BUTTON); - translation_list->connect("button_pressed",this,"_translation_delete"); - _update_actions(); - popup_add->add_icon_item(get_icon("Keyboard","EditorIcons"),TTR("Key "),InputEvent::KEY);//"Key " - because the word 'key' has already been used as a key animation - popup_add->add_icon_item(get_icon("JoyButton","EditorIcons"),TTR("Joy Button"),InputEvent::JOYPAD_BUTTON); - popup_add->add_icon_item(get_icon("JoyAxis","EditorIcons"),TTR("Joy Axis"),InputEvent::JOYPAD_MOTION); - popup_add->add_icon_item(get_icon("Mouse","EditorIcons"),TTR("Mouse Button"),InputEvent::MOUSE_BUTTON); + List<String> tfn; + ResourceLoader::get_recognized_extensions_for_type("Translation",&tfn); + for (List<String>::Element *E=tfn.front();E;E=E->next()) { - List<String> tfn; - ResourceLoader::get_recognized_extensions_for_type("Translation",&tfn); - for (List<String>::Element *E=tfn.front();E;E=E->next()) { - - translation_file_open->add_filter("*."+E->get()); - } + translation_file_open->add_filter("*."+E->get()); + } - List<String> rfn; - ResourceLoader::get_recognized_extensions_for_type("Resource",&rfn); - for (List<String>::Element *E=rfn.front();E;E=E->next()) { + List<String> rfn; + ResourceLoader::get_recognized_extensions_for_type("Resource",&rfn); + for (List<String>::Element *E=rfn.front();E;E=E->next()) { - translation_res_file_open->add_filter("*."+E->get()); - translation_res_option_file_open->add_filter("*."+E->get()); - } + translation_res_file_open->add_filter("*."+E->get()); + translation_res_option_file_open->add_filter("*."+E->get()); + } + } break; + case NOTIFICATION_POPUP_HIDE: { + EditorSettings::get_singleton()->set("interface/dialogs/project_settings_bounds", get_rect()); + } break; } } @@ -579,8 +583,12 @@ void ProjectSettings::_update_actions() { void ProjectSettings::popup_project_settings() { - //popup_centered(Size2(500,400)); - popup_centered_ratio(); + // Restore valid window bounds or pop up at default size. + if (EditorSettings::get_singleton()->has("interface/dialogs/project_settings_bounds")) { + popup(EditorSettings::get_singleton()->get("interface/dialogs/project_settings_bounds")); + } else { + popup_centered_ratio(); + } globals_editor->update_category_list(); _update_translations(); autoload_settings->update_autoload(); @@ -1224,6 +1232,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { singleton=this; set_title(TTR("Project Settings (godot.cfg)")); + set_resizable(true); undo_redo=&p_data->get_undo_redo(); data=p_data; diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index ec1de03bd6..533a5b156b 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -31,6 +31,8 @@ #include "scene/gui/label.h" #include "io/resource_loader.h" #include "io/image_loader.h" +#include "os/input.h" +#include "os/keyboard.h" #include "class_db.h" #include "print_string.h" #include "global_config.h" @@ -280,6 +282,7 @@ Variant CustomPropertyEditor::get_variant() const { return v; } + String CustomPropertyEditor::get_name() const { return name; @@ -291,6 +294,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty updating=true; name=p_name; v=p_variant; + field_names.clear(); hint=p_hint; hint_text=p_hint_text; type_button->hide(); @@ -667,22 +671,20 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty } break; case Variant::VECTOR2: { - List<String> names; - names.push_back("x"); - names.push_back("y"); - config_value_editors(2,2,10,names); + field_names.push_back("x"); + field_names.push_back("y"); + config_value_editors(2,2,10,field_names); Vector2 vec=v; value_editor[0]->set_text( String::num( vec.x) ); value_editor[1]->set_text( String::num( vec.y) ); } break; case Variant::RECT2: { - List<String> names; - names.push_back("x"); - names.push_back("y"); - names.push_back("w"); - names.push_back("h"); - config_value_editors(4,4,10,names); + field_names.push_back("x"); + field_names.push_back("y"); + field_names.push_back("w"); + field_names.push_back("h"); + config_value_editors(4,4,10,field_names); Rect2 r=v; value_editor[0]->set_text( String::num( r.pos.x) ); value_editor[1]->set_text( String::num( r.pos.y) ); @@ -691,11 +693,10 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty } break; case Variant::VECTOR3: { - List<String> names; - names.push_back("x"); - names.push_back("y"); - names.push_back("z"); - config_value_editors(3,3,10,names); + field_names.push_back("x"); + field_names.push_back("y"); + field_names.push_back("z"); + config_value_editors(3,3,10,field_names); Vector3 vec=v; value_editor[0]->set_text( String::num( vec.x) ); value_editor[1]->set_text( String::num( vec.y) ); @@ -703,12 +704,11 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty } break; case Variant::PLANE: { - List<String> names; - names.push_back("x"); - names.push_back("y"); - names.push_back("z"); - names.push_back("d"); - config_value_editors(4,4,10,names); + field_names.push_back("x"); + field_names.push_back("y"); + field_names.push_back("z"); + field_names.push_back("d"); + config_value_editors(4,4,10,field_names); Plane plane=v; value_editor[0]->set_text( String::num( plane.normal.x ) ); value_editor[1]->set_text( String::num( plane.normal.y ) ); @@ -718,12 +718,11 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty } break; case Variant::QUAT: { - List<String> names; - names.push_back("x"); - names.push_back("y"); - names.push_back("z"); - names.push_back("w"); - config_value_editors(4,4,10,names); + field_names.push_back("x"); + field_names.push_back("y"); + field_names.push_back("z"); + field_names.push_back("w"); + config_value_editors(4,4,10,field_names); Quat q=v; value_editor[0]->set_text( String::num( q.x ) ); value_editor[1]->set_text( String::num( q.y ) ); @@ -733,14 +732,13 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty } break; case Variant::RECT3: { - List<String> names; - names.push_back("px"); - names.push_back("py"); - names.push_back("pz"); - names.push_back("sx"); - names.push_back("sy"); - names.push_back("sz"); - config_value_editors(6,3,16,names); + field_names.push_back("px"); + field_names.push_back("py"); + field_names.push_back("pz"); + field_names.push_back("sx"); + field_names.push_back("sy"); + field_names.push_back("sz"); + config_value_editors(6,3,16,field_names); Rect3 aabb=v; value_editor[0]->set_text( String::num( aabb.pos.x ) ); @@ -753,14 +751,13 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty } break; case Variant::TRANSFORM2D: { - List<String> names; - names.push_back("xx"); - names.push_back("xy"); - names.push_back("yx"); - names.push_back("yy"); - names.push_back("ox"); - names.push_back("oy"); - config_value_editors(6,2,16,names); + field_names.push_back("xx"); + field_names.push_back("xy"); + field_names.push_back("yx"); + field_names.push_back("yy"); + field_names.push_back("ox"); + field_names.push_back("oy"); + config_value_editors(6,2,16,field_names); Transform2D basis=v; for(int i=0;i<6;i++) { @@ -771,17 +768,16 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty } break; case Variant::BASIS: { - List<String> names; - names.push_back("xx"); - names.push_back("xy"); - names.push_back("xz"); - names.push_back("yx"); - names.push_back("yy"); - names.push_back("yz"); - names.push_back("zx"); - names.push_back("zy"); - names.push_back("zz"); - config_value_editors(9,3,16,names); + field_names.push_back("xx"); + field_names.push_back("xy"); + field_names.push_back("xz"); + field_names.push_back("yx"); + field_names.push_back("yy"); + field_names.push_back("yz"); + field_names.push_back("zx"); + field_names.push_back("zy"); + field_names.push_back("zz"); + config_value_editors(9,3,16,field_names); Basis basis=v; for(int i=0;i<9;i++) { @@ -793,20 +789,19 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty case Variant::TRANSFORM: { - List<String> names; - names.push_back("xx"); - names.push_back("xy"); - names.push_back("xz"); - names.push_back("xo"); - names.push_back("yx"); - names.push_back("yy"); - names.push_back("yz"); - names.push_back("yo"); - names.push_back("zx"); - names.push_back("zy"); - names.push_back("zz"); - names.push_back("zo"); - config_value_editors(12,4,16,names); + field_names.push_back("xx"); + field_names.push_back("xy"); + field_names.push_back("xz"); + field_names.push_back("xo"); + field_names.push_back("yx"); + field_names.push_back("yy"); + field_names.push_back("yz"); + field_names.push_back("yo"); + field_names.push_back("zx"); + field_names.push_back("zy"); + field_names.push_back("zz"); + field_names.push_back("zo"); + config_value_editors(12,4,16,field_names); Transform tr=v; for(int i=0;i<9;i++) { @@ -1050,6 +1045,14 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty return true; } +////void CustomPropertyEditor::_save_properties_values(List<String> p_names) { +//// +//// field_names=p_names; +//// for (int i=0;i<p_names.size();i++) { +//// field_values.push_back(v.get(p_names[i])); +//// } +////} + void CustomPropertyEditor::_file_selected(String p_file) { switch(type) { @@ -1643,7 +1646,7 @@ void CustomPropertyEditor::_modified(String p_string) { vec.y=value_editor[1]->get_text().to_double(); } v=vec; - emit_signal("variant_changed"); + _emit_changed_whole_or_field(); } break; case Variant::RECT2: { @@ -1661,7 +1664,7 @@ void CustomPropertyEditor::_modified(String p_string) { r2.size.y=value_editor[3]->get_text().to_double(); } v=r2; - emit_signal("variant_changed"); + _emit_changed_whole_or_field(); } break; @@ -1678,7 +1681,7 @@ void CustomPropertyEditor::_modified(String p_string) { vec.z=value_editor[2]->get_text().to_double(); } v=vec; - emit_signal("variant_changed"); + _emit_changed_whole_or_field(); } break; case Variant::PLANE: { @@ -1696,7 +1699,7 @@ void CustomPropertyEditor::_modified(String p_string) { pl.d=value_editor[3]->get_text().to_double(); } v=pl; - emit_signal("variant_changed"); + _emit_changed_whole_or_field(); } break; case Variant::QUAT: { @@ -1714,7 +1717,7 @@ void CustomPropertyEditor::_modified(String p_string) { q.w=value_editor[3]->get_text().to_double(); } v=q; - emit_signal("variant_changed"); + _emit_changed_whole_or_field(); } break; case Variant::RECT3: { @@ -1738,7 +1741,7 @@ void CustomPropertyEditor::_modified(String p_string) { size.z=value_editor[5]->get_text().to_double(); } v=Rect3(pos,size); - emit_signal("variant_changed"); + _emit_changed_whole_or_field(); } break; case Variant::TRANSFORM2D: { @@ -1753,7 +1756,7 @@ void CustomPropertyEditor::_modified(String p_string) { } v=m; - emit_signal("variant_changed"); + _emit_changed_whole_or_field(); } break; case Variant::BASIS: { @@ -1769,7 +1772,7 @@ void CustomPropertyEditor::_modified(String p_string) { } v=m; - emit_signal("variant_changed"); + _emit_changed_whole_or_field(); } break; case Variant::TRANSFORM: { @@ -1797,7 +1800,7 @@ void CustomPropertyEditor::_modified(String p_string) { } v=Transform(basis,origin); - emit_signal("variant_changed"); + _emit_changed_whole_or_field(); } break; @@ -1864,6 +1867,15 @@ void CustomPropertyEditor::_modified(String p_string) { updating=false; } +void CustomPropertyEditor::_emit_changed_whole_or_field() { + + if (!Input::get_singleton()->is_key_pressed(KEY_SHIFT)) { + emit_signal("variant_changed"); + } else { + emit_signal("variant_field_changed",field_names[focused_value_editor]); + } +} + void CustomPropertyEditor::_range_modified(double p_value) { v=p_value; @@ -1885,6 +1897,7 @@ void CustomPropertyEditor::_focus_enter() { case Variant::TRANSFORM: { for (int i=0;i<MAX_VALUE_EDITORS;++i) { if (value_editor[i]->has_focus()) { + focused_value_editor=i; value_editor[i]->select_all(); break; } @@ -1997,6 +2010,7 @@ void CustomPropertyEditor::_bind_methods() { ADD_SIGNAL( MethodInfo("variant_changed") ); + ADD_SIGNAL( MethodInfo("variant_field_changed",PropertyInfo(Variant::STRING,"field")) ); ADD_SIGNAL( MethodInfo("resource_edit_request") ); } CustomPropertyEditor::CustomPropertyEditor() { @@ -2017,6 +2031,7 @@ CustomPropertyEditor::CustomPropertyEditor() { value_editor[i]->connect("focus_entered", this, "_focus_enter"); value_editor[i]->connect("focus_exited", this, "_focus_exit"); } + focused_value_editor=-1; for(int i=0;i<4;i++) { @@ -3904,7 +3919,7 @@ void PropertyEditor::_item_selected() { } -void PropertyEditor::_edit_set(const String& p_name, const Variant& p_value, bool p_refresh_all) { +void PropertyEditor::_edit_set(const String& p_name, const Variant& p_value, bool p_refresh_all, const String& p_changed_field) { if (autoclear) { TreeItem *item = tree->get_selected(); @@ -3914,7 +3929,7 @@ void PropertyEditor::_edit_set(const String& p_name, const Variant& p_value, boo } } - if (!undo_redo || obj->cast_to<MultiNodeEdit>() || obj->cast_to<ArrayPropertyEdit>()) { //kind of hacky + if (!undo_redo|| obj->cast_to<ArrayPropertyEdit>()) { //kind of hacky obj->set(p_name,p_value); if (p_refresh_all) @@ -3924,7 +3939,11 @@ void PropertyEditor::_edit_set(const String& p_name, const Variant& p_value, boo emit_signal(_prop_edited,p_name); + } else if (obj->cast_to<MultiNodeEdit>()) { + obj->cast_to<MultiNodeEdit>()->set_property_field(p_name,p_value,p_changed_field); + _changed_callbacks(obj,p_name); + emit_signal(_prop_edited,p_name); } else { undo_redo->create_action(TTR("Set")+" "+p_name,UndoRedo::MERGE_ENDS); @@ -4129,10 +4148,19 @@ void PropertyEditor::_custom_editor_edited() { if (!obj) return; - _edit_set(custom_editor->get_name(), custom_editor->get_variant()); } +void PropertyEditor::_custom_editor_edited_field(const String& p_field_name) { + + ERR_FAIL_COND(p_field_name==""); + + if (!obj) + return; + + _edit_set(custom_editor->get_name(), custom_editor->get_variant(), false, p_field_name); +} + void PropertyEditor::_custom_editor_request(bool p_arrow) { TreeItem * item = tree->get_edited(); @@ -4405,6 +4433,7 @@ void PropertyEditor::_bind_methods() { ClassDB::bind_method( "_item_selected",&PropertyEditor::_item_selected); ClassDB::bind_method( "_custom_editor_request",&PropertyEditor::_custom_editor_request); ClassDB::bind_method( "_custom_editor_edited",&PropertyEditor::_custom_editor_edited); + ClassDB::bind_method( "_custom_editor_edited_field",&PropertyEditor::_custom_editor_edited_field,DEFVAL("")); ClassDB::bind_method( "_resource_edit_request",&PropertyEditor::_resource_edit_request); ClassDB::bind_method( "_node_removed",&PropertyEditor::_node_removed); ClassDB::bind_method( "_edit_button",&PropertyEditor::_edit_button); @@ -4551,6 +4580,7 @@ PropertyEditor::PropertyEditor() { tree->connect("custom_popup_edited", this,"_custom_editor_request"); tree->connect("button_pressed", this,"_edit_button"); custom_editor->connect("variant_changed", this,"_custom_editor_edited"); + custom_editor->connect("variant_field_changed", this,"_custom_editor_edited_field"); custom_editor->connect("resource_edit_request", this,"_resource_edit_request",make_binds(),CONNECT_DEFERRED); tree->set_hide_folding(true); diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index 817b2716f0..e31a3313c1 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -88,9 +88,11 @@ class CustomPropertyEditor : public Popup { String name; Variant::Type type; Variant v; + List<String> field_names; int hint; String hint_text; LineEdit *value_editor[MAX_VALUE_EDITORS]; + int focused_value_editor; Label *value_label[MAX_VALUE_EDITORS]; HScrollBar *scroll[4]; Button *action_buttons[MAX_ACTION_BUTTONS]; @@ -141,6 +143,8 @@ class CustomPropertyEditor : public Popup { void config_value_editors(int p_amount, int p_columns,int p_label_w,const List<String>& p_strings); void config_action_buttons(const List<String>& p_strings); + void _emit_changed_whole_or_field(); + protected: @@ -204,6 +208,7 @@ class PropertyEditor : public Control { void _resource_edit_request(); void _custom_editor_edited(); + void _custom_editor_edited_field(const String& p_field_name); void _custom_editor_request(bool p_arrow); void _item_selected(); @@ -225,7 +230,7 @@ class PropertyEditor : public Control { void _node_removed(Node *p_node); friend class ProjectExportDialog; - void _edit_set(const String& p_name, const Variant& p_value,bool p_refresh_all=false); + void _edit_set(const String& p_name, const Variant& p_value,bool p_refresh_all=false, const String& p_changed_field=""); void _draw_flags(Object *ti,const Rect2& p_rect); bool _might_be_in_instance(); diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp index 6a62e035ec..7d8d6ffcec 100644 --- a/tools/editor/settings_config_dialog.cpp +++ b/tools/editor/settings_config_dialog.cpp @@ -93,10 +93,14 @@ void EditorSettingsDialog::popup_edit_settings() { search_box->grab_focus(); _update_shortcuts(); - popup_centered_ratio(0.7); -} - + // Restore valid window bounds or pop up at default size. + if (EditorSettings::get_singleton()->has("interface/dialogs/editor_settings_bounds")) { + popup(EditorSettings::get_singleton()->get("interface/dialogs/editor_settings_bounds")); + } else { + popup_centered_ratio(0.7); + } +} void EditorSettingsDialog::_clear_search_box() { @@ -121,10 +125,14 @@ void EditorSettingsDialog::_filter_shortcuts(const String& p_filter) { void EditorSettingsDialog::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_TREE) { - - clear_button->set_icon(get_icon("Close","EditorIcons")); - shortcut_clear_button->set_icon(get_icon("Close","EditorIcons")); + switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + clear_button->set_icon(get_icon("Close", "EditorIcons")); + shortcut_clear_button->set_icon(get_icon("Close", "EditorIcons")); + } break; + case NOTIFICATION_POPUP_HIDE: { + EditorSettings::get_singleton()->set("interface/dialogs/editor_settings_bounds", get_rect()); + } break; } } @@ -305,6 +313,7 @@ void EditorSettingsDialog::_bind_methods() { EditorSettingsDialog::EditorSettingsDialog() { set_title(TTR("Editor Settings")); + set_resizable(true); tabs = memnew( TabContainer ); add_child(tabs); |