diff --git a/core/engine.cpp b/core/engine.cpp index 454e889255b..9f68b9ccef2 100644 --- a/core/engine.cpp +++ b/core/engine.cpp @@ -236,3 +236,13 @@ Engine::Engine() { _frame_step = 0; editor_hint = false; } + +Engine::Singleton::Singleton(const StringName &p_name, Object *p_ptr) : + name(p_name), + ptr(p_ptr) { +#ifdef DEBUG_ENABLED + if (Object::cast_to(p_ptr)) { + ERR_PRINT("A class intended to be used as a singleton must *not* inherit from Reference."); + } +#endif +} diff --git a/core/engine.h b/core/engine.h index 4bb3f73bff3..4345a53db3d 100644 --- a/core/engine.h +++ b/core/engine.h @@ -42,10 +42,7 @@ public: struct Singleton { StringName name; Object *ptr; - Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL) : - name(p_name), - ptr(p_ptr) { - } + Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL); }; private: diff --git a/core/resource.cpp b/core/resource.cpp index bc761be9779..1de8d1d0c4d 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -155,8 +155,8 @@ Ref Resource::duplicate_for_local_scene(Node *p_for_scene, Map plist; get_property_list(&plist); - Resource *r = Object::cast_to(ClassDB::instance(get_class())); - ERR_FAIL_COND_V(!r, Ref()); + Ref r = Object::cast_to(ClassDB::instance(get_class())); + ERR_FAIL_COND_V(r.is_null(), Ref()); r->local_scene = p_for_scene; @@ -186,9 +186,7 @@ Ref Resource::duplicate_for_local_scene(Node *p_for_scene, Mapset(E->get().name, p); } - RES res = Ref(r); - - return res; + return r; } void Resource::configure_for_local_scene(Node *p_for_scene, Map, Ref > &remap_cache) { diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml index 058fc6a7cb8..d3828c1b1f4 100644 --- a/doc/classes/SceneTree.xml +++ b/doc/classes/SceneTree.xml @@ -188,7 +188,7 @@ - Quits the application. A process [code]exit_code[/code] can optionally be passed as an argument. If this argument is [code]0[/code] or greater, it will override the [member OS.exit_code] defined before quitting the application. + Quits the application at the end of the current iteration. A process [code]exit_code[/code] can optionally be passed as an argument. If this argument is [code]0[/code] or greater, it will override the [member OS.exit_code] defined before quitting the application. diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index a752bbb067a..9d61ed18a94 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1491,7 +1491,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref &p_event) { // Start rotation if (drag_type == DRAG_NONE) { if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed()) { - if ((b->get_control() && !b->get_alt() && tool == TOOL_SELECT) || tool == TOOL_ROTATE) { + if ((b->get_command() && !b->get_alt() && tool == TOOL_SELECT) || tool == TOOL_ROTATE) { List selection = _get_edited_canvas_items(); // Remove not movable nodes diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index aeec28eaee1..abe949c952b 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -4993,6 +4993,8 @@ void SpatialEditor::_menu_item_pressed(int p_option) { } } } + _finish_grid(); + _init_grid(); view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(p_option), grid_enabled); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 75a2c26a0d3..f77bbd866a4 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -517,6 +517,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tools[SHAPE_NEW_RECTANGLE]->set_button_group(tg); tools[SHAPE_NEW_RECTANGLE]->set_tooltip(TTR("Create a new rectangle.")); tools[SHAPE_NEW_RECTANGLE]->connect("pressed", this, "_on_tool_clicked", varray(SHAPE_NEW_RECTANGLE)); + tools[SHAPE_NEW_RECTANGLE]->set_shortcut(ED_SHORTCUT("tileset_editor/shape_new_rectangle", TTR("New Rectangle"), KEY_MASK_SHIFT | KEY_R)); tools[SHAPE_NEW_POLYGON] = memnew(ToolButton); toolbar->add_child(tools[SHAPE_NEW_POLYGON]); @@ -524,6 +525,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { tools[SHAPE_NEW_POLYGON]->set_button_group(tg); tools[SHAPE_NEW_POLYGON]->set_tooltip(TTR("Create a new polygon.")); tools[SHAPE_NEW_POLYGON]->connect("pressed", this, "_on_tool_clicked", varray(SHAPE_NEW_POLYGON)); + tools[SHAPE_NEW_POLYGON]->set_shortcut(ED_SHORTCUT("tileset_editor/shape_new_polygon", TTR("New Polygon"), KEY_MASK_SHIFT | KEY_P)); separator_shape_toggle = memnew(VSeparator); toolbar->add_child(separator_shape_toggle); @@ -535,6 +537,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { toolbar->add_child(separator_delete); tools[SHAPE_DELETE] = memnew(ToolButton); tools[SHAPE_DELETE]->connect("pressed", this, "_on_tool_clicked", varray(SHAPE_DELETE)); + tools[SHAPE_DELETE]->set_shortcut(ED_SHORTCUT("tileset_editor/shape_delete", TTR("Delete Selected Shape"), KEY_MASK_SHIFT | KEY_BACKSPACE)); toolbar->add_child(tools[SHAPE_DELETE]); spin_priority = memnew(SpinBox); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index ec9834136ba..b8ee9e1293c 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2121,7 +2121,7 @@ void ProjectManager::_run_project_confirm() { if (selected_main == "") { run_error_diag->set_text(TTR("Can't run project: no main scene defined.\nPlease edit the project and set the main scene in the Project Settings under the \"Application\" category.")); run_error_diag->popup_centered(); - return; + continue; } const String &selected = selected_list[i].project_key; @@ -2130,7 +2130,7 @@ void ProjectManager::_run_project_confirm() { if (!DirAccess::exists(path + "/.import")) { run_error_diag->set_text(TTR("Can't run project: Assets need to be imported.\nPlease edit the project to trigger the initial import.")); run_error_diag->popup_centered(); - return; + continue; } print_line("Running project: " + path + " (" + selected + ")"); diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index b42c0d31340..c42e57457bf 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -2630,6 +2630,13 @@ public: Error _zip_align_project(const String &sdk_path, const String &unaligned_file_path, const String &aligned_file_path) { // Look for the zipalign tool. + String zipalign_command_name; +#ifdef WINDOWS_ENABLED + zipalign_command_name = "zipalign.exe"; +#else + zipalign_command_name = "zipalign"; +#endif + String zipalign_command; Error errn; String build_tools_dir = sdk_path.plus_file("build-tools"); @@ -2644,7 +2651,7 @@ public: while (!sub_dir.empty()) { if (!sub_dir.begins_with(".") && da->current_is_dir()) { // Check if the tool is here. - String tool_path = build_tools_dir.plus_file(sub_dir).plus_file("zipalign"); + String tool_path = build_tools_dir.plus_file(sub_dir).plus_file(zipalign_command_name); if (FileAccess::exists(tool_path)) { zipalign_command = tool_path; break; diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 0e11c85ab58..26517e308e5 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -45,9 +45,11 @@ def configure(env): if env["target"] == "release": if env["debug_symbols"] != "full": if env["optimize"] == "speed": # optimize for speed (default) - env.Prepend(CCFLAGS=["-O3", "-fomit-frame-pointer", "-ftree-vectorize", "-msse2"]) + env.Prepend(CCFLAGS=["-O3", "-fomit-frame-pointer", "-ftree-vectorize"]) else: # optimize for size - env.Prepend(CCFLAGS=["-Os", "-ftree-vectorize", "-msse2"]) + env.Prepend(CCFLAGS=["-Os", "-ftree-vectorize"]) + if env["arch"] != "arm64": + env.Prepend(CCFLAGS=["-msse2"]) if env["debug_symbols"] == "yes": env.Prepend(CCFLAGS=["-g2"]) @@ -81,16 +83,16 @@ def configure(env): if "OSXCROSS_ROOT" in os.environ: env["osxcross"] = True - if not "osxcross" in env: # regular native build - if env["arch"] == "arm64": - print("Building for macOS 10.15+, platform arm64.") - env.Append(CCFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15", "-target", "arm64-apple-macos10.15"]) - env.Append(LINKFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15", "-target", "arm64-apple-macos10.15"]) - else: - print("Building for macOS 10.9+, platform x86-64.") - env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.9"]) - env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.9"]) + if env["arch"] == "arm64": + print("Building for macOS 10.15+, platform arm64.") + env.Append(CCFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15"]) + env.Append(LINKFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15"]) + else: + print("Building for macOS 10.9+, platform x86-64.") + env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.9"]) + env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.9"]) + if not "osxcross" in env: # regular native build if env["macports_clang"] != "no": mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local") mpclangver = env["macports_clang"] @@ -111,7 +113,10 @@ def configure(env): else: # osxcross build root = os.environ.get("OSXCROSS_ROOT", 0) - basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-" + if env["arch"] == "arm64": + basecmd = root + "/target/bin/arm64-apple-" + env["osxcross_sdk"] + "-" + else: + basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-" ccache_path = os.environ.get("CCACHE") if ccache_path is None: