diff options
28 files changed, 229 insertions, 251 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a9ada58e64..6cb52cf5ff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -87,7 +87,7 @@ rebase -i`` and relevant help about rebasing or ammending commits on the Internet). This git style guide has some good practices to have in mind: -https://github.com/agis-/git-style-guide +[Git Style Guide](https://github.com/agis-/git-style-guide) #### Format your commit logs with readability in mind diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 03ec336291..6362090902 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -1655,13 +1655,13 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const { } else if (p_index == CoreStringNames::singleton->a) { return v->a; } else if (p_index == CoreStringNames::singleton->r8) { - return v->r * 255.0; + return int(v->r * 255.0); } else if (p_index == CoreStringNames::singleton->g8) { - return v->g * 255.0; + return int(v->g * 255.0); } else if (p_index == CoreStringNames::singleton->b8) { - return v->b * 255.0; + return int(v->b * 255.0); } else if (p_index == CoreStringNames::singleton->a8) { - return v->a * 255.0; + return int(v->a * 255.0); } else if (p_index == CoreStringNames::singleton->h) { return v->get_h(); } else if (p_index == CoreStringNames::singleton->s) { diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py index e89b49eb4d..170ded9f50 100644 --- a/doc/tools/doc_status.py +++ b/doc/tools/doc_status.py @@ -250,15 +250,16 @@ class ClassStatus: for tag in list(c): if tag.tag in ['methods']: for sub_tag in list(tag): - methods.append(sub_tag.find('name')) + methods.append(sub_tag.attrib['name']) if tag.tag in ['members']: for sub_tag in list(tag): try: - methods.remove(sub_tag.find('setter')) - methods.remove(sub_tag.find('getter')) + if(sub_tag.attrib['setter'].startswith('_') == False): + methods.remove(sub_tag.attrib['setter']) + if(sub_tag.attrib['getter'].startswith('_') == False): + methods.remove(sub_tag.attrib['getter']) except: pass - for tag in list(c): if tag.tag == 'brief_description': @@ -269,7 +270,7 @@ class ClassStatus: elif tag.tag in ['methods', 'signals']: for sub_tag in list(tag): - if sub_tag.find('name') in methods or tag.tag == 'signals': + if sub_tag.attrib['name'] in methods or tag.tag == 'signals': descr = sub_tag.find('description') status.progresses[tag.tag].increment(len(descr.text.strip()) > 0) elif tag.tag in ['constants', 'members']: diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 18f47852b5..34881c8aff 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1454,7 +1454,7 @@ void EditorNode::_edit_current() { } } else if (current_res->get_path().is_resource_file()) { if (FileAccess::exists(current_res->get_path() + ".import")) { - editable_warning = TTR("This resource was imported, so it's not editable. Change it's settings in the import panel and re-import."); + editable_warning = TTR("This resource was imported, so it's not editable. Change its settings in the import panel and then re-import."); } } } else if (is_node) { diff --git a/editor/icons/icon_viewport_speed.svg b/editor/icons/icon_viewport_speed.svg index 5d47fbbe89..e64b5a8059 100644 --- a/editor/icons/icon_viewport_speed.svg +++ b/editor/icons/icon_viewport_speed.svg @@ -1,113 +1,4 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="24" - height="24" - version="1.1" - viewBox="0 0 24 24" - id="svg2" - inkscape:version="0.91 r13725" - sodipodi:docname="icon_viewport_speed.svg"> - <metadata - id="metadata12"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <defs - id="defs10" /> - <sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="1920" - inkscape:window-height="1017" - id="namedview8" - showgrid="true" - inkscape:zoom="55.837564" - inkscape:cx="12.355509" - inkscape:cy="13.455858" - inkscape:window-x="-8" - inkscape:window-y="32" - inkscape:window-maximized="1" - inkscape:current-layer="g4"> - <inkscape:grid - type="xygrid" - id="grid4196" /> - </sodipodi:namedview> - <g - transform="translate(0,-1028.4)" - id="g4"> - <circle - style="fill:#e0e0e0;fill-opacity:0.99607843;stroke:#000000;stroke-width:1.02133572;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - id="path4150" - cy="1033.9" - cx="16.5" - r="2.9893322" /> - <rect - y="1031.4" - x="5" - height="0.99997556" - width="7" - id="rect4188" - style="fill:#000000;fill-opacity:0.99607843;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - <rect - style="fill:#e0e0e0;fill-opacity:0.99607843;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843" - id="rect4178" - width="7" - height="1.0000244" - x="5" - y="1030.4" /> - <rect - y="1035.4" - x="1" - height="0.99997556" - width="6" - id="rect4190" - style="fill:#000000;fill-opacity:0.99607843;stroke:none;stroke-width:0.98120075;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - <rect - style="fill:#e0e0e0;fill-opacity:0.99607843;stroke:none;stroke-width:0.98308611;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843" - id="rect4180" - width="6" - height="0.99997556" - x="1" - y="1034.4" /> - <rect - y="1042.4" - x="2" - height="1.0000244" - width="7" - id="rect4192" - style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - <rect - style="fill:#e0e0e0;fill-opacity:0.99607843;stroke:none;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843" - id="rect4182" - width="7" - height="0.99997556" - x="2" - y="1041.4" /> - <path - style="fill:#e0e0e0;fill-opacity:0.99607843;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - d="m 4.121611,1045.8307 -0.1638725,2.0132 6.1803345,0.6321 2.865785,-3.8285 3.825066,1.2671 -1.634214,3.6617 1.802597,0.9365 2.751611,-5.7254 -5.323873,-2.3187 1.381211,-2.6534 2.589918,2.1082 4.477133,-2.2965 -0.976935,-1.5052 -3.180386,1.3802 -3.253887,-2.6678 -4.922628,-2.5117 -3.6554378,3.6189 1.4307035,1.5154 2.4736963,-2.3877 2.012407,0.9882 -1.262113,3.517 -2.5945824,4.631 z" - id="path4186" - inkscape:connector-curvature="0" - sodipodi:nodetypes="ccccccccccccccccccccccc" /> - </g> +<svg width="16" height="16" version="1.1" viewBox="0 0 4.2333333 4.2333333" xmlns="http://www.w3.org/2000/svg"> +<path d="m1.5875 0c-0.28858 0-0.52917 0.24059-0.52917 0.52917v0.61132c-0.085589-0.051-0.18113-0.0891-0.28525-0.0853-0.34849 0.0127-0.5952 0.37346-0.48059 0.70278l0.26355 0.79066c0.048664 0.14623 0.15979 0.24805 0.29249 0.30644l-0.60927 0.40669c-0.13121 0.0845-0.22102 0.22389-0.24133 0.3633-0.020312 0.13941 0.017471 0.26985 0.087333 0.37465s0.17614 0.19045 0.31264 0.22532c0.13634 0.0348 0.29946 6e-3 0.42788-0.0827h5.159e-4l1.0852-0.72348 0.26097 0.52192c0.11682 0.23391 0.39274 0.34829 0.64079 0.26561l0.79375-0.26458-0.00775 3e-3c0.15105-0.0454 0.27732-0.15615 0.33486-0.2863 0.057538-0.13015 0.055144-0.26773 0.014986-0.38809-0.03156-0.0946-0.10972-0.1687-0.19275-0.23617 0.069099-0.0546 0.1445-0.10364 0.18035-0.19325 0.051761-0.12941 0.045257-0.29292-0.02377-0.43098l-0.26459-0.52946c-0.089407-0.17933-0.27348-0.29308-0.47335-0.29305h-0.1111c0.052029-0.0817 0.1111-0.16214 0.1111-0.26458v-0.79375c0-0.28858-0.24059-0.52917-0.52917-0.52917z" color="#000000" color-rendering="auto" dominant-baseline="auto" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> +<path d="m1.5875 0.26458c-0.14658 0-0.26458 0.118-0.26458 0.26459v0.79375c0 0.14658 0.118 0.26458 0.26458 0.26458h0.26458v0.262a0.26461 0.26461 0 0 0 -0.083716 0.0165l-0.5426 0.18086-0.18087-0.5426a0.26461 0.26461 0 0 0 -0.262 -0.18448 0.26461 0.26461 0 0 0 -0.2403 0.3514l0.26458 0.79375a0.26461 0.26461 0 0 0 0.33486 0.16743l0.44545-0.14831v0.16174c0 0.0108 0.00495 0.02 0.0062 0.0305l-1.2113 0.80771a0.26461 0.26461 0 1 0 0.29352 0.44028l1.3379-0.89194 0.39532 0.79014a0.26461 0.26461 0 0 0 0.32039 0.1328l0.79375-0.26458a0.26461 0.26461 0 1 0 -0.16743 -0.50175l-0.57619 0.19172-0.25787-0.51625c0.072998-0.047 0.12402-0.12495 0.12402-0.21859v-0.26458h0.36587l0.1912 0.38292a0.26461 0.26461 0 1 0 0.47336 -0.23668l-0.26458-0.52916a0.26461 0.26461 0 0 0 -0.23668 -0.14625h-0.79375v-0.26458h0.26458c0.14658 0 0.26458-0.118 0.26458-0.26458v-0.79375c0-0.14659-0.118-0.26459-0.26458-0.26459zm0 0.52917h0.26458v0.52917h-0.26458z" fill="#fff" fill-opacity=".99608"/> </svg> diff --git a/editor/icons/icon_viewport_zoom.svg b/editor/icons/icon_viewport_zoom.svg index 3b5c8d2096..18d4ec32ce 100644 --- a/editor/icons/icon_viewport_zoom.svg +++ b/editor/icons/icon_viewport_zoom.svg @@ -1,64 +1,6 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="24" - height="24" - version="1.1" - viewBox="0 0 24 24" - id="svg2" - inkscape:version="0.91 r13725" - sodipodi:docname="icon_viewport_zoom.svg"> - <metadata - id="metadata12"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <defs - id="defs10" /> - <sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="1920" - inkscape:window-height="1017" - id="namedview8" - showgrid="true" - inkscape:zoom="32" - inkscape:cx="12.62433" - inkscape:cy="11.793762" - inkscape:window-x="-8" - inkscape:window-y="32" - inkscape:window-maximized="1" - inkscape:current-layer="g4"> - <inkscape:grid - type="xygrid" - id="grid4798" /> - </sodipodi:namedview> - <g - transform="translate(0,-1028.4)" - id="g4"> - <path - d="m 8.9917563,1029.9083 a 7.4877313,7.4846399 0 0 0 -7.4877312,7.4847 7.4877313,7.4846399 0 0 0 7.4877312,7.4847 7.4877313,7.4846399 0 0 0 4.1240927,-1.2455 l 6.464009,6.4613 2.11768,-2.1168 -6.464008,-6.4613 a 7.4877313,7.4846399 0 0 0 1.246002,-4.1224 7.4877313,7.4846399 0 0 0 -7.4877307,-7.4847 z m 0,2.9939 a 4.4926389,4.4907841 0 0 1 4.4926387,4.4908 4.4926389,4.4907841 0 0 1 -4.4926387,4.4909 4.4926389,4.4907841 0 0 1 -4.4926386,-4.4909 4.4926389,4.4907841 0 0 1 4.4926386,-4.4908 z" - id="path6" - style="fill:#e0e0e0;fill-opacity:0.99607999;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - inkscape:connector-curvature="0" /> - </g> +<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> +<g> +<path d="m6 0c-3.3019 0-6 2.6981-6 6s2.6981 6 6 6h0.00195c0.88828 0 1.737-0.2588 2.5332-0.6367l3.8281 3.8281c0.39053 0.3904 1.0235 0.3904 1.4141 0l1.4141-1.4141c0.39033-0.3905 0.39033-1.0235 0-1.414l-3.791-3.791c0.02779-0.058 0.06588-0.1109 0.0918-0.17 0.05554-0.1268 0.08414-0.2638 0.08398-0.4023h1.4238c0.55226-1e-4 0.99994-0.4477 1-1v-1h1c0.55226-1e-4 0.99994-0.4477 1-1v-2c-5.5e-5 -0.5523-0.44774-0.9999-1-1h-1v-1c-5.5e-5 -0.5523-0.44774-0.9999-1-1h-2c-0.55226 1e-4 -0.99994 0.4477-1 1v1h-0.00977c1.44e-4 -0.3151-0.14822-0.6118-0.40039-0.8008-1.0353-0.7764-2.2938-1.1967-3.5879-1.1992h-0.00195z" color="#000000" color-rendering="auto" dominant-baseline="auto" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/> +<path d="m6 1a5 5 0 0 0 -5 5 5 5 0 0 0 5 5 5 5 0 0 0 2.752 -0.83398l4.3184 4.3184 1.4141-1.4141-4.3184-4.3184a5 5 0 0 0 0.41016 -0.75195h-0.57617v-2h-1a3 3 0 0 1 -3 3 3 3 0 0 1 -3 -3 3 3 0 0 1 3 -3 3 3 0 0 1 2 0.76758v-1.7676h0.99023a5 5 0 0 0 -2.9902 -1zm5 0v2h-2v2h2v2h2v-2h2v-2h-2v-2z" fill="#fff"/> +</g> </svg> diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h index 64ac2535a9..d0faab5892 100644 --- a/editor/script_editor_debugger.h +++ b/editor/script_editor_debugger.h @@ -166,9 +166,6 @@ class ScriptEditorDebugger : public Control { void _method_changed(Object *p_base, const StringName &p_name, VARIANT_ARG_DECLARE); void _property_changed(Object *p_base, const StringName &p_property, const Variant &p_value); - static void _method_changeds(void *p_ud, Object *p_base, const StringName &p_name, VARIANT_ARG_DECLARE); - static void _property_changeds(void *p_ud, Object *p_base, const StringName &p_property, const Variant &p_value); - void _error_selected(int p_idx); void _error_stack_selected(int p_idx); @@ -196,6 +193,9 @@ public: void set_live_debugging(bool p_enable); + static void _method_changeds(void *p_ud, Object *p_base, const StringName &p_name, VARIANT_ARG_DECLARE); + static void _property_changeds(void *p_ud, Object *p_base, const StringName &p_property, const Variant &p_value); + void live_debug_create_node(const NodePath &p_parent, const String &p_type, const String &p_name); void live_debug_instance_node(const NodePath &p_parent, const String &p_path, const String &p_name); void live_debug_remove_node(const NodePath &p_at); diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index 86979a1174..c052845be9 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -35,6 +35,7 @@ #include "os/keyboard.h" #include "project_settings.h" #include "scene/gui/margin_container.h" +#include "script_editor_debugger.h" void EditorSettingsDialog::ok_pressed() { @@ -91,6 +92,7 @@ void EditorSettingsDialog::popup_edit_settings() { search_box->grab_focus(); _update_shortcuts(); + set_process_unhandled_input(true); // Restore valid window bounds or pop up at default size. if (EditorSettings::get_singleton()->has_setting("interface/dialogs/editor_settings_bounds")) { @@ -121,19 +123,62 @@ void EditorSettingsDialog::_filter_shortcuts(const String &p_filter) { _update_shortcuts(); } +void EditorSettingsDialog::_undo_redo_callback(void *p_self, const String &p_name) { + EditorNode::get_log()->add_message(p_name); +} + void EditorSettingsDialog::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_READY: { + ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger(); + undo_redo->set_method_notify_callback(sed->_method_changeds, sed); + undo_redo->set_property_notify_callback(sed->_property_changeds, sed); + undo_redo->set_commit_notify_callback(_undo_redo_callback, this); + } break; 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()); + set_process_unhandled_input(false); } break; } } +void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) { + + Ref<InputEventKey> k = p_event; + + if (k.is_valid() && is_window_modal_on_top()) { + + if (k->is_pressed()) { + + bool handled = false; + + if (ED_IS_SHORTCUT("editor/undo", p_event)) { + String action = undo_redo->get_current_action_name(); + if (action != "") + EditorNode::get_log()->add_message("UNDO: " + action); + undo_redo->undo(); + handled = true; + } + if (ED_IS_SHORTCUT("editor/redo", p_event)) { + undo_redo->redo(); + String action = undo_redo->get_current_action_name(); + if (action != "") + EditorNode::get_log()->add_message("REDO: " + action); + handled = true; + } + + if (handled) { + accept_event(); + } + } + } +} + void EditorSettingsDialog::_update_shortcuts() { shortcuts->clear(); @@ -212,30 +257,28 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column if (!sc.is_valid()) return; //pointless, there is nothing - UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Erase Shortcut"); - ur->add_do_method(sc.ptr(), "set_shortcut", Ref<InputEvent>()); - ur->add_undo_method(sc.ptr(), "set_shortcut", sc->get_shortcut()); - ur->add_do_method(this, "_update_shortcuts"); - ur->add_undo_method(this, "_update_shortcuts"); - ur->add_do_method(this, "_settings_changed"); - ur->add_undo_method(this, "_settings_changed"); - ur->commit_action(); + undo_redo->create_action("Erase Shortcut"); + undo_redo->add_do_method(sc.ptr(), "set_shortcut", Ref<InputEvent>()); + undo_redo->add_undo_method(sc.ptr(), "set_shortcut", sc->get_shortcut()); + undo_redo->add_do_method(this, "_update_shortcuts"); + undo_redo->add_undo_method(this, "_update_shortcuts"); + undo_redo->add_do_method(this, "_settings_changed"); + undo_redo->add_undo_method(this, "_settings_changed"); + undo_redo->commit_action(); } else if (p_idx == 2) { //revert to original if (!sc.is_valid()) return; //pointless, there is nothing Ref<InputEvent> original = sc->get_meta("original"); - UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Restore Shortcut"); - ur->add_do_method(sc.ptr(), "set_shortcut", original); - ur->add_undo_method(sc.ptr(), "set_shortcut", sc->get_shortcut()); - ur->add_do_method(this, "_update_shortcuts"); - ur->add_undo_method(this, "_update_shortcuts"); - ur->add_do_method(this, "_settings_changed"); - ur->add_undo_method(this, "_settings_changed"); - ur->commit_action(); + undo_redo->create_action("Restore Shortcut"); + undo_redo->add_do_method(sc.ptr(), "set_shortcut", original); + undo_redo->add_undo_method(sc.ptr(), "set_shortcut", sc->get_shortcut()); + undo_redo->add_do_method(this, "_update_shortcuts"); + undo_redo->add_undo_method(this, "_update_shortcuts"); + undo_redo->add_do_method(this, "_settings_changed"); + undo_redo->add_undo_method(this, "_settings_changed"); + undo_redo->commit_action(); } } @@ -276,19 +319,19 @@ void EditorSettingsDialog::_press_a_key_confirm() { Ref<ShortCut> sc = EditorSettings::get_singleton()->get_shortcut(shortcut_configured); - UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo(); - ur->create_action("Change Shortcut '" + shortcut_configured + "'"); - ur->add_do_method(sc.ptr(), "set_shortcut", ie); - ur->add_undo_method(sc.ptr(), "set_shortcut", sc->get_shortcut()); - ur->add_do_method(this, "_update_shortcuts"); - ur->add_undo_method(this, "_update_shortcuts"); - ur->add_do_method(this, "_settings_changed"); - ur->add_undo_method(this, "_settings_changed"); - ur->commit_action(); + undo_redo->create_action("Change Shortcut '" + shortcut_configured + "'"); + undo_redo->add_do_method(sc.ptr(), "set_shortcut", ie); + undo_redo->add_undo_method(sc.ptr(), "set_shortcut", sc->get_shortcut()); + undo_redo->add_do_method(this, "_update_shortcuts"); + undo_redo->add_undo_method(this, "_update_shortcuts"); + undo_redo->add_do_method(this, "_settings_changed"); + undo_redo->add_undo_method(this, "_settings_changed"); + undo_redo->commit_action(); } void EditorSettingsDialog::_bind_methods() { + ClassDB::bind_method(D_METHOD("_unhandled_input"), &EditorSettingsDialog::_unhandled_input); ClassDB::bind_method(D_METHOD("_settings_save"), &EditorSettingsDialog::_settings_save); ClassDB::bind_method(D_METHOD("_settings_changed"), &EditorSettingsDialog::_settings_changed); ClassDB::bind_method(D_METHOD("_settings_property_edited"), &EditorSettingsDialog::_settings_property_edited); @@ -305,6 +348,7 @@ EditorSettingsDialog::EditorSettingsDialog() { set_title(TTR("Editor Settings")); set_resizable(true); + undo_redo = memnew(UndoRedo); tabs = memnew(TabContainer); tabs->set_tab_align(TabContainer::ALIGN_LEFT); @@ -336,7 +380,7 @@ EditorSettingsDialog::EditorSettingsDialog() { property_editor->get_property_editor()->set_use_filter(true); property_editor->register_search_box(search_box); property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); - property_editor->get_property_editor()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo()); + property_editor->get_property_editor()->set_undo_redo(undo_redo); vbc->add_child(property_editor); property_editor->get_property_editor()->connect("property_edited", this, "_settings_property_edited"); @@ -400,3 +444,7 @@ EditorSettingsDialog::EditorSettingsDialog() { updating = false; } + +EditorSettingsDialog::~EditorSettingsDialog() { + memdelete(undo_redo); +} diff --git a/editor/settings_config_dialog.h b/editor/settings_config_dialog.h index 8a66d5098c..a03b15c06d 100644 --- a/editor/settings_config_dialog.h +++ b/editor/settings_config_dialog.h @@ -50,6 +50,7 @@ class EditorSettingsDialog : public AcceptDialog { Timer *timer; + UndoRedo *undo_redo; Tree *shortcuts; ConfirmationDialog *press_a_key; @@ -65,6 +66,7 @@ class EditorSettingsDialog : public AcceptDialog { void _settings_property_edited(const String &p_name); void _settings_save(); + void _unhandled_input(const Ref<InputEvent> &p_event); void _notification(int p_what); void _press_a_key_confirm(); @@ -78,6 +80,8 @@ class EditorSettingsDialog : public AcceptDialog { void _update_shortcuts(); void _shortcut_button_pressed(Object *p_item, int p_column, int p_idx); + static void _undo_redo_callback(void *p_self, const String &p_name); + protected: static void _bind_methods(); @@ -85,6 +89,7 @@ public: void popup_edit_settings(); EditorSettingsDialog(); + ~EditorSettingsDialog(); }; #endif // SETTINGS_CONFIG_DIALOG_H diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 69895e58e2..ba8c7df9cc 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -51,6 +51,7 @@ #define CACHED_STRING_NAME(m_var) (CSharpLanguage::get_singleton()->get_string_names().m_var) +#ifdef TOOLS_ENABLED static bool _create_project_solution_if_needed() { String sln_path = GodotSharpDirs::get_project_sln_path(); @@ -65,6 +66,7 @@ static bool _create_project_solution_if_needed() { return true; } +#endif CSharpLanguage *CSharpLanguage::singleton = NULL; @@ -1268,8 +1270,11 @@ bool CSharpScript::_update_exports() { for (int i = 0; i < fields.size(); i++) { GDMonoField *field = fields[i]; - if (field->is_static() || field->get_visibility() != GDMono::PUBLIC) + if (field->is_static()) { + if (field->has_attribute(CACHED_CLASS(ExportAttribute))) + ERR_PRINTS("Cannot export field because it is static: " + top->get_full_name() + "." + field->get_name()); continue; + } String name = field->get_name(); StringName cname = name; @@ -1277,17 +1282,39 @@ bool CSharpScript::_update_exports() { if (member_info.has(cname)) continue; - Variant::Type type = GDMonoMarshal::managed_to_variant_type(field->get_type()); + ManagedType field_type = field->get_type(); + Variant::Type type = GDMonoMarshal::managed_to_variant_type(field_type); if (field->has_attribute(CACHED_CLASS(ExportAttribute))) { + // Field has Export attribute MonoObject *attr = field->get_attribute(CACHED_CLASS(ExportAttribute)); - // Field has Export attribute - int hint = CACHED_FIELD(ExportAttribute, hint)->get_int_value(attr); - String hint_string = CACHED_FIELD(ExportAttribute, hint_string)->get_string_value(attr); - int usage = CACHED_FIELD(ExportAttribute, usage)->get_int_value(attr); + PropertyHint hint; + String hint_string; + + if (type == Variant::NIL) { + ERR_PRINTS("Unknown type of exported field: " + top->get_full_name() + "." + field->get_name()); + continue; + } else if (type == Variant::INT && field_type.type_encoding == MONO_TYPE_VALUETYPE && mono_class_is_enum(field_type.type_class->get_raw())) { + type = Variant::INT; + hint = PROPERTY_HINT_ENUM; + + Vector<MonoClassField *> fields = field_type.type_class->get_enum_fields(); + + for (int i = 0; i < fields.size(); i++) { + if (i > 0) + hint_string += ","; + hint_string += mono_field_get_name(fields[i]); + } + } else if (type == Variant::OBJECT && CACHED_CLASS(GodotReference)->is_assignable_from(field_type.type_class)) { + hint = PROPERTY_HINT_RESOURCE_TYPE; + hint_string = NATIVE_GDMONOCLASS_NAME(field_type.type_class); + } else { + hint = PropertyHint(CACHED_FIELD(ExportAttribute, hint)->get_int_value(attr)); + hint_string = CACHED_FIELD(ExportAttribute, hint_string)->get_string_value(attr); + } - PropertyInfo prop_info = PropertyInfo(type, name, PropertyHint(hint), hint_string, PropertyUsageFlags(usage)); + PropertyInfo prop_info = PropertyInfo(type, name, hint, hint_string, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_SCRIPT_VARIABLE); member_info[cname] = prop_info; exported_members_cache.push_back(prop_info); @@ -1711,16 +1738,6 @@ void CSharpScript::update_exports() { #ifdef TOOLS_ENABLED _update_exports(); - - if (placeholders.size()) { - Map<StringName, Variant> values; - List<PropertyInfo> propnames; - _update_exports_values(values, propnames); - - for (Set<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) { - E->get()->update(propnames, values); - } - } #endif } diff --git a/modules/mono/glue/cs_files/ExportAttribute.cs b/modules/mono/glue/cs_files/ExportAttribute.cs index af3f603d6d..a4e7d447dd 100644 --- a/modules/mono/glue/cs_files/ExportAttribute.cs +++ b/modules/mono/glue/cs_files/ExportAttribute.cs @@ -7,13 +7,11 @@ namespace Godot { private int hint; private string hint_string; - private int usage; - public ExportAttribute(int hint = GD.PROPERTY_HINT_NONE, string hint_string = "", int usage = GD.PROPERTY_USAGE_DEFAULT) + public ExportAttribute(int hint = GD.PROPERTY_HINT_NONE, string hint_string = "") { this.hint = hint; this.hint_string = hint_string; - this.usage = usage; } } } diff --git a/modules/mono/mono_gd/gd_mono_class.cpp b/modules/mono/mono_gd/gd_mono_class.cpp index 0134ace5d7..77ba0ee90e 100644 --- a/modules/mono/mono_gd/gd_mono_class.cpp +++ b/modules/mono/mono_gd/gd_mono_class.cpp @@ -43,6 +43,14 @@ bool GDMonoClass::is_assignable_from(GDMonoClass *p_from) const { return mono_class_is_assignable_from(mono_class, p_from->mono_class); } +String GDMonoClass::get_full_name() const { + + String res = namespace_name; + if (res.length()) + res += "."; + return res + class_name; +} + GDMonoClass *GDMonoClass::get_parent_class() { if (assembly) { @@ -56,6 +64,30 @@ GDMonoClass *GDMonoClass::get_parent_class() { return NULL; } +#ifdef TOOLS_ENABLED +Vector<MonoClassField *> GDMonoClass::get_enum_fields() { + + bool class_is_enum = mono_class_is_enum(mono_class); + ERR_FAIL_COND_V(!class_is_enum, Vector<MonoClassField *>()); + + Vector<MonoClassField *> enum_fields; + + void *iter = NULL; + MonoClassField *raw_field = NULL; + while ((raw_field = mono_class_get_fields(get_raw(), &iter)) != NULL) { + uint32_t field_flags = mono_field_get_flags(raw_field); + + // Enums have an instance field named value__ which holds the value of the enum. + // Enum constants are static, so we will use this to ignore the value__ field. + if (field_flags & MONO_FIELD_ATTR_PUBLIC && field_flags & MONO_FIELD_ATTR_STATIC) { + enum_fields.push_back(raw_field); + } + } + + return enum_fields; +} +#endif + bool GDMonoClass::has_method(const StringName &p_name) { return get_method(p_name) != NULL; diff --git a/modules/mono/mono_gd/gd_mono_class.h b/modules/mono/mono_gd/gd_mono_class.h index 1e72553879..ef1ca425a7 100644 --- a/modules/mono/mono_gd/gd_mono_class.h +++ b/modules/mono/mono_gd/gd_mono_class.h @@ -98,8 +98,14 @@ public: _FORCE_INLINE_ MonoClass *get_raw() const { return mono_class; } _FORCE_INLINE_ const GDMonoAssembly *get_assembly() const { return assembly; } + String get_full_name() const; + GDMonoClass *get_parent_class(); +#ifdef TOOLS_ENABLED + Vector<MonoClassField *> get_enum_fields(); +#endif + bool has_method(const StringName &p_name); bool has_attribute(GDMonoClass *p_attr_class); diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index c2d8eeaa32..81315ee87a 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -51,6 +51,7 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { { \ m_type val = p_value.operator m_type(); \ mono_field_set_value(p_object, mono_field, &val); \ + break; \ } #define SET_FROM_ARRAY_AND_BREAK(m_type) \ @@ -137,6 +138,9 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) { if (tclass == CACHED_CLASS(Plane)) SET_FROM_STRUCT_AND_BREAK(Plane); + if (mono_class_is_enum(tclass->get_raw())) + SET_FROM_PRIMITIVE(signed int); + ERR_EXPLAIN(String() + "Attempted to set the value of a field of unmarshallable type: " + tclass->get_name()); ERR_FAIL(); } break; diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index 9a6c8f0cd6..77a1ef3cb0 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -112,6 +112,9 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) { if (tclass == CACHED_CLASS(Plane)) return Variant::PLANE; + + if (mono_class_is_enum(tclass->get_raw())) + return Variant::INT; } break; case MONO_TYPE_ARRAY: @@ -165,9 +168,12 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) { return Variant::DICTIONARY; } } break; + + default: { + } break; } - // No error, the caller will decide what to do in this case + // Unknown return Variant::NIL; } @@ -299,6 +305,11 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty if (tclass == CACHED_CLASS(Plane)) RETURN_BOXED_STRUCT(Plane, p_var); + + if (mono_class_is_enum(tclass->get_raw())) { + int val = p_var->operator signed int(); + return BOX_ENUM(tclass->get_raw(), val); + } } break; case MONO_TYPE_ARRAY: @@ -515,6 +526,9 @@ Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type) { if (tclass == CACHED_CLASS(Plane)) RETURN_UNBOXED_STRUCT(Plane, p_obj); + + if (mono_class_is_enum(tclass->get_raw())) + return unbox<int32_t>(p_obj); } break; case MONO_TYPE_ARRAY: diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h index 38dd22357d..9f403b787f 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.h +++ b/modules/mono/mono_gd/gd_mono_marshal.h @@ -53,6 +53,7 @@ T unbox(MonoObject *p_obj) { #define BOX_UINT8(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(uint8_t), &x) #define BOX_BOOLEAN(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(bool), &x) #define BOX_PTR(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(IntPtr), x) +#define BOX_ENUM(m_enum_class, x) mono_value_box(mono_domain_get(), m_enum_class, &x) Variant::Type managed_to_variant_type(const ManagedType &p_type); diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp index d23fcf8a67..53e45002c4 100644 --- a/modules/mono/mono_gd/gd_mono_utils.cpp +++ b/modules/mono/mono_gd/gd_mono_utils.cpp @@ -86,6 +86,7 @@ void MonoCache::clear_members() { class_NodePath = NULL; class_RID = NULL; class_GodotObject = NULL; + class_GodotReference = NULL; class_Node = NULL; class_Control = NULL; class_Spatial = NULL; @@ -95,7 +96,6 @@ void MonoCache::clear_members() { class_ExportAttribute = NULL; field_ExportAttribute_hint = NULL; field_ExportAttribute_hint_string = NULL; - field_ExportAttribute_usage = NULL; class_ToolAttribute = NULL; class_RemoteAttribute = NULL; class_SyncAttribute = NULL; @@ -153,6 +153,7 @@ void update_godot_api_cache() { CACHE_CLASS_AND_CHECK(NodePath, GODOT_API_CLASS(NodePath)); CACHE_CLASS_AND_CHECK(RID, GODOT_API_CLASS(NodePath)); CACHE_CLASS_AND_CHECK(GodotObject, GODOT_API_CLASS(Object)); + CACHE_CLASS_AND_CHECK(GodotReference, GODOT_API_CLASS(Reference)); CACHE_CLASS_AND_CHECK(Node, GODOT_API_CLASS(Node)); CACHE_CLASS_AND_CHECK(Control, GODOT_API_CLASS(Control)); CACHE_CLASS_AND_CHECK(Spatial, GODOT_API_CLASS(Spatial)); @@ -163,7 +164,6 @@ void update_godot_api_cache() { CACHE_CLASS_AND_CHECK(ExportAttribute, GODOT_API_CLASS(ExportAttribute)); CACHE_FIELD_AND_CHECK(ExportAttribute, hint, CACHED_CLASS(ExportAttribute)->get_field("hint")); CACHE_FIELD_AND_CHECK(ExportAttribute, hint_string, CACHED_CLASS(ExportAttribute)->get_field("hint_string")); - CACHE_FIELD_AND_CHECK(ExportAttribute, usage, CACHED_CLASS(ExportAttribute)->get_field("usage")); CACHE_CLASS_AND_CHECK(ToolAttribute, GODOT_API_CLASS(ToolAttribute)); CACHE_CLASS_AND_CHECK(RemoteAttribute, GODOT_API_CLASS(RemoteAttribute)); CACHE_CLASS_AND_CHECK(SyncAttribute, GODOT_API_CLASS(SyncAttribute)); diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h index bbda3a01d4..e3af57e78a 100644 --- a/modules/mono/mono_gd/gd_mono_utils.h +++ b/modules/mono/mono_gd/gd_mono_utils.h @@ -88,6 +88,7 @@ struct MonoCache { GDMonoClass *class_NodePath; GDMonoClass *class_RID; GDMonoClass *class_GodotObject; + GDMonoClass *class_GodotReference; GDMonoClass *class_Node; GDMonoClass *class_Control; GDMonoClass *class_Spatial; @@ -97,7 +98,6 @@ struct MonoCache { GDMonoClass *class_ExportAttribute; GDMonoField *field_ExportAttribute_hint; GDMonoField *field_ExportAttribute_hint_string; - GDMonoField *field_ExportAttribute_usage; GDMonoClass *class_ToolAttribute; GDMonoClass *class_RemoteAttribute; GDMonoClass *class_SyncAttribute; @@ -164,7 +164,7 @@ String get_exception_name_and_message(MonoObject *p_ex); } // GDMonoUtils -#define NATIVE_GDMONOCLASS_NAME(m_class) (GDMonoMarshal::mono_string_to_godot((MonoString *)m_class->get_field("nativeName")->get_value(NULL))) +#define NATIVE_GDMONOCLASS_NAME(m_class) (GDMonoMarshal::mono_string_to_godot((MonoString *)m_class->get_field(BINDINGS_NATIVE_NAME_FIELD)->get_value(NULL))) #define CACHED_CLASS(m_class) (GDMonoUtils::mono_cache.class_##m_class) #define CACHED_CLASS_RAW(m_class) (GDMonoUtils::mono_cache.class_##m_class->get_raw()) diff --git a/modules/mono/signal_awaiter_utils.cpp b/modules/mono/signal_awaiter_utils.cpp index 99bcc72b41..7e99df29a1 100644 --- a/modules/mono/signal_awaiter_utils.cpp +++ b/modules/mono/signal_awaiter_utils.cpp @@ -119,7 +119,9 @@ void SignalAwaiterHandle::_bind_methods() { SignalAwaiterHandle::SignalAwaiterHandle(uint32_t p_managed_handle) : MonoGCHandle(p_managed_handle) { +#ifdef DEBUG_ENABLED conn_target_id = 0; +#endif } SignalAwaiterHandle::~SignalAwaiterHandle() { diff --git a/modules/openssl/stream_peer_openssl.cpp b/modules/openssl/stream_peer_openssl.cpp index c19bdc4214..6d1d5485f3 100644 --- a/modules/openssl/stream_peer_openssl.cpp +++ b/modules/openssl/stream_peer_openssl.cpp @@ -30,7 +30,7 @@ #include "stream_peer_openssl.h" // Compatibility with OpenSSL 1.1.0. -#if OPENSSL_VERSION_NUMBER >= 0x10100000L +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) #define BIO_set_num(b, n) #else #define BIO_set_num(b, n) ((b)->num = (n)) @@ -269,7 +269,7 @@ int StreamPeerOpenSSL::_bio_puts(BIO *b, const char *str) { return _bio_write(b, str, strlen(str)); } -#if OPENSSL_VERSION_NUMBER >= 0x10100000L +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) BIO_METHOD *StreamPeerOpenSSL::_bio_method = NULL; BIO_METHOD *StreamPeerOpenSSL::_get_bio_method() { @@ -568,7 +568,7 @@ void StreamPeerOpenSSL::initialize_ssl() { load_certs_func = _load_certs; _create = _create_func; -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) CRYPTO_malloc_init(); // Initialize malloc, free, etc for OpenSSL's use #endif SSL_library_init(); // Initialize OpenSSL's SSL libraries diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h index 535114058d..ad09564447 100644 --- a/modules/openssl/stream_peer_openssl.h +++ b/modules/openssl/stream_peer_openssl.h @@ -53,7 +53,7 @@ private: static int _bio_gets(BIO *b, char *buf, int len); static int _bio_puts(BIO *b, const char *str); -#if OPENSSL_VERSION_NUMBER >= 0x10100000L +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) static BIO_METHOD *_bio_method; #else static BIO_METHOD _bio_method; diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 1f7f67fe10..8c68c9ffd1 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -239,6 +239,9 @@ def configure(env): if (platform.system() == "Linux"): env.Append(LIBS=['dl']) + if (platform.system().find("BSD") >= 0): + env.Append(LIBS=['execinfo']) + ## Cross-compilation if (is64 and env["bits"] == "32"): diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index bc18d0c1f0..48e2d8f81e 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -35,7 +35,11 @@ #include "servers/physics/physics_server_sw.h" #include "servers/visual/visual_server_raster.h" #include "servers/visual/visual_server_wrap_mt.h" + +#ifdef HAVE_MNTENT #include <mntent.h> +#endif + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -2182,6 +2186,7 @@ static String get_mountpoint(const String &p_path) { return ""; } +#ifdef HAVE_MNTENT dev_t dev = s.st_dev; FILE *fd = setmntent("/proc/mounts", "r"); if (!fd) { @@ -2199,6 +2204,7 @@ static String get_mountpoint(const String &p_path) { } endmntent(fd); +#endif return ""; } diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp index c6b6c02129..064a249190 100644 --- a/scene/3d/arvr_nodes.cpp +++ b/scene/3d/arvr_nodes.cpp @@ -204,7 +204,7 @@ void ARVRController::_notification(int p_what) { int mask = 1; // check button states for (int i = 0; i < 16; i++) { - bool was_pressed = (button_states && mask) == mask; + bool was_pressed = (button_states & mask) == mask; bool is_pressed = Input::get_singleton()->is_joy_button_pressed(joy_id, i); if (!was_pressed && is_pressed) { @@ -336,6 +336,7 @@ String ARVRController::get_configuration_warning() const { ARVRController::ARVRController() { controller_id = 0; is_active = true; + button_states = 0; }; ARVRController::~ARVRController(){ diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index a034c7224f..623a110263 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -489,7 +489,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) { if (mb->get_button_index() == BUTTON_RIGHT) { - emit_signal("item_rmb_selected", i, pos); + emit_signal("item_rmb_selected", i, get_local_mouse_position()); } } else { @@ -500,7 +500,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) { if (items[i].selected && mb->get_button_index() == BUTTON_RIGHT) { - emit_signal("item_rmb_selected", i, pos); + emit_signal("item_rmb_selected", i, get_local_mouse_position()); } else { bool selected = !items[i].selected; @@ -515,7 +515,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) { if (mb->get_button_index() == BUTTON_RIGHT) { - emit_signal("item_rmb_selected", i, pos); + emit_signal("item_rmb_selected", i, get_local_mouse_position()); } else if (/*select_mode==SELECT_SINGLE &&*/ mb->is_doubleclick()) { emit_signal("item_activated", i); diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp index 116e0ac354..e88742a3e3 100644 --- a/scene/gui/slider.cpp +++ b/scene/gui/slider.cpp @@ -157,6 +157,12 @@ void Slider::_notification(int p_what) { mouse_inside = false; update(); } break; + case NOTIFICATION_VISIBILITY_CHANGED: // fallthrough + case NOTIFICATION_EXIT_TREE: { + + mouse_inside = false; + grab.active = false; + } break; case NOTIFICATION_DRAW: { RID ci = get_canvas_item(); Size2i size = get_size(); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 37a393b55b..12c8b0d89b 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2711,7 +2711,7 @@ void Viewport::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "debug_draw", PROPERTY_HINT_ENUM, "Disabled,Unshaded,Overdraw,Wireframe"), "set_debug_draw", "get_debug_draw"); ADD_GROUP("Render Target", "render_target_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_target_v_flip"), "set_vflip", "get_vflip"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_target_clear_mode", PROPERTY_HINT_ENUM, "Always,Never,NextFrame"), "set_clear_mode", "get_clear_mode"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "render_target_clear_mode", PROPERTY_HINT_ENUM, "Always,Never,Next Frame"), "set_clear_mode", "get_clear_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "render_target_update_mode", PROPERTY_HINT_ENUM, "Disabled,Once,When Visible,Always"), "set_update_mode", "get_update_mode"); ADD_GROUP("Audio Listener", "audio_listener_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "audio_listener_enable_2d"), "set_as_audio_listener_2d", "is_audio_listener_2d"); diff --git a/thirdparty/enet/enet/enet.h b/thirdparty/enet/enet/enet.h index 8c9ad5463e..246cbb0a62 100644 --- a/thirdparty/enet/enet/enet.h +++ b/thirdparty/enet/enet/enet.h @@ -10,6 +10,7 @@ extern "C" { #endif +#include <stdint.h> #include <stdlib.h> #include "enet/godot.h" |