Skip to content

Commit

Permalink
Merge pull request #43683 from akien-mga/3.2-cherrypicks
Browse files Browse the repository at this point in the history
Cherry-picks for the 3.2 branch (future 3.2.4) - 9th batch
  • Loading branch information
akien-mga authored Nov 19, 2020
2 parents 09f3a21 + 27eaf35 commit 06389f7
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 26 deletions.
10 changes: 10 additions & 0 deletions core/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Reference>(p_ptr)) {
ERR_PRINT("A class intended to be used as a singleton must *not* inherit from Reference.");
}
#endif
}
5 changes: 1 addition & 4 deletions core/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ class Engine {
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:
Expand Down
8 changes: 3 additions & 5 deletions core/resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Res
List<PropertyInfo> plist;
get_property_list(&plist);

Resource *r = Object::cast_to<Resource>(ClassDB::instance(get_class()));
ERR_FAIL_COND_V(!r, Ref<Resource>());
Ref<Resource> r = Object::cast_to<Resource>(ClassDB::instance(get_class()));
ERR_FAIL_COND_V(r.is_null(), Ref<Resource>());

r->local_scene = p_for_scene;

Expand Down Expand Up @@ -186,9 +186,7 @@ Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Res
r->set(E->get().name, p);
}

RES res = Ref<Resource>(r);

return res;
return r;
}

void Resource::configure_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource> > &remap_cache) {
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/SceneTree.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
<argument index="0" name="exit_code" type="int" default="-1">
</argument>
<description>
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.
</description>
</method>
<method name="reload_current_scene">
Expand Down
2 changes: 1 addition & 1 deletion editor/plugins/canvas_item_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &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<CanvasItem *> selection = _get_edited_canvas_items();

// Remove not movable nodes
Expand Down
2 changes: 2 additions & 0 deletions editor/plugins/spatial_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions editor/plugins/tile_set_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,13 +517,15 @@ 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]);
tools[SHAPE_NEW_POLYGON]->set_toggle_mode(true);
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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions editor/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 + ")");
Expand Down
9 changes: 8 additions & 1 deletion platform/android/export/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2630,6 +2630,13 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {

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");
Expand All @@ -2644,7 +2651,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
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;
Expand Down
29 changes: 17 additions & 12 deletions platform/osx/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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"]
Expand All @@ -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:
Expand Down

0 comments on commit 06389f7

Please sign in to comment.