Skip to content

Commit

Permalink
Merge pull request #45726 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) - 20th batch
  • Loading branch information
akien-mga authored Feb 5, 2021
2 parents f9bf6fc + 84e356d commit 48381ba
Show file tree
Hide file tree
Showing 84 changed files with 13,252 additions and 531 deletions.
39 changes: 31 additions & 8 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,14 @@ if profile:
opts = Variables(customs, ARGUMENTS)

# Target build options
opts.Add("arch", "Platform-dependent architecture (arm/arm64/x86/x64/mips/...)", "")
opts.Add(EnumVariable("bits", "Target platform bits", "default", ("default", "32", "64")))
opts.Add("p", "Platform (alias for 'platform')", "")
opts.Add("platform", "Target platform (%s)" % ("|".join(platform_list),), "")
opts.Add(BoolVariable("tools", "Build the tools (a.k.a. the Godot editor)", True))
opts.Add(EnumVariable("target", "Compilation target", "debug", ("debug", "release_debug", "release")))
opts.Add("arch", "Platform-dependent architecture (arm/arm64/x86/x64/mips/...)", "")
opts.Add(EnumVariable("bits", "Target platform bits", "default", ("default", "32", "64")))
opts.Add(EnumVariable("optimize", "Optimization type", "speed", ("speed", "size")))
opts.Add(BoolVariable("tools", "Build the tools (a.k.a. the Godot editor)", True))
opts.Add(BoolVariable("production", "Set defaults to build Godot for use in production", False))
opts.Add(BoolVariable("use_lto", "Use link-time optimization", False))

# Components
Expand All @@ -122,11 +123,11 @@ opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver", False))
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")

# Advanced options
opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False))
opts.Add(BoolVariable("dev", "If yes, alias for verbose=yes warnings=extra werror=yes", False))
opts.Add(BoolVariable("progress", "Show a progress indicator during compilation", True))
opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False))
opts.Add(EnumVariable("warnings", "Level of compilation warnings", "all", ("extra", "all", "moderate", "no")))
opts.Add(BoolVariable("werror", "Treat compiler warnings as errors", False))
opts.Add(BoolVariable("dev", "If yes, alias for verbose=yes warnings=extra werror=yes", False))
opts.Add("extra_suffix", "Custom extra suffix added to the base filename of all generated binary files", "")
opts.Add(BoolVariable("vsproj", "Generate a Visual Studio solution", False))
opts.Add(
Expand Down Expand Up @@ -313,10 +314,32 @@ if selected_platform in platform_list:
env.Tool("compilation_db")
env.Alias("compiledb", env.CompilationDatabase())

# 'dev' and 'production' are aliases to set default options if they haven't been set
# manually by the user. We use `ARGUMENTS.get()` to check if they were manually set.
if env["dev"]:
env["verbose"] = True
env["warnings"] = "extra"
env["werror"] = True
env["verbose"] = ARGUMENTS.get("verbose", True)
env["warnings"] = ARGUMENTS.get("warnings", "extra")
env["werror"] = ARGUMENTS.get("werror", True)
if env["production"]:
env["use_static_cpp"] = ARGUMENTS.get("use_static_cpp", True)
env["use_lto"] = ARGUMENTS.get("use_lto", True)
env["debug_symbols"] = ARGUMENTS.get("debug_symbols", False)
if not env["tools"] and env["target"] == "debug":
print(
"WARNING: Requested `production` build with `tools=no target=debug`, "
"this will give you a full debug template (use `target=release_debug` "
"for an optimized template with debug features)."
)
if env.msvc:
print(
"WARNING: For `production` Windows builds, you should use MinGW with GCC "
"or Clang instead of Visual Studio, as they can better optimize the "
"GDScript VM in a very significant way. MSVC LTO also doesn't work "
"reliably for our use case."
"If you want to use MSVC nevertheless for production builds, set "
"`debug_symbols=no use_lto=no` instead of the `production=yes` option."
)
Exit(255)

env.extra_suffix = ""

Expand Down
3 changes: 3 additions & 0 deletions core/math/audio_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ static inline float undenormalise(volatile float f) {
return (v.i & 0x7f800000) < 0x08000000 ? 0.0f : f;
}

static const float AUDIO_PEAK_OFFSET = 0.0000000001f;
static const float AUDIO_MIN_PEAK_DB = -200.0f; // linear2db(AUDIO_PEAK_OFFSET)

struct AudioFrame {

//left and right samples
Expand Down
5 changes: 3 additions & 2 deletions doc/classes/File.xml
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,9 @@
</methods>
<members>
<member name="endian_swap" type="bool" setter="set_endian_swap" getter="get_endian_swap" default="false">
If [code]true[/code], the file's endianness is swapped. Use this if you're dealing with files written on big-endian machines.
[b]Note:[/b] This is about the file format, not CPU type. This is always reset to [code]false[/code] whenever you open the file.
If [code]true[/code], the file is read with big-endian [url=https://en.wikipedia.org/wiki/Endianness]endianness[/url]. If [code]false[/code], the file is read with little-endian endianness. If in doubt, leave this to [code]false[/code] as most files are written with little-endian endianness.
[b]Note:[/b] [member endian_swap] is only about the file format, not the CPU type. The CPU endianness doesn't affect the default endianness for files written.
[b]Note:[/b] This is always reset to [code]false[/code] whenever you open the file. Therefore, you must set [member endian_swap] [i]after[/i] opening the file, not before.
</member>
</members>
<constants>
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6452,7 +6452,7 @@ EditorNode::EditorNode() {
p = help_menu->get_popup();
p->set_hide_on_window_lose_focus(true);
p->connect("id_pressed", this, "_menu_option");
p->add_icon_shortcut(gui_base->get_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("editor/editor_help", TTR("Search"), KEY_MASK_SHIFT | KEY_F1), HELP_SEARCH);
p->add_icon_shortcut(gui_base->get_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("editor/editor_help", TTR("Search")), HELP_SEARCH);
p->add_separator();
p->add_icon_shortcut(gui_base->get_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/online_docs", TTR("Online Docs")), HELP_DOCS);
p->add_icon_shortcut(gui_base->get_icon("Instance", "EditorIcons"), ED_SHORTCUT("editor/q&a", TTR("Q&A")), HELP_QA);
Expand Down
4 changes: 2 additions & 2 deletions editor/plugins/spatial_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2803,7 +2803,7 @@ void SpatialEditorViewport::_menu_option(int p_option) {
case VIEW_FRONT: {

cursor.x_rot = 0;
cursor.y_rot = 0;
cursor.y_rot = Math_PI;
set_message(TTR("Front View."), 2);
name = TTR("Front");
_set_auto_orthogonal();
Expand All @@ -2813,7 +2813,7 @@ void SpatialEditorViewport::_menu_option(int p_option) {
case VIEW_REAR: {

cursor.x_rot = 0;
cursor.y_rot = Math_PI;
cursor.y_rot = 0;
set_message(TTR("Rear View."), 2);
name = TTR("Rear");
_set_auto_orthogonal();
Expand Down
43 changes: 32 additions & 11 deletions editor/plugins/texture_region_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,21 +467,42 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
Vector2 dragged(mm->get_relative().x / draw_zoom, mm->get_relative().y / draw_zoom);
hscroll->set_value(hscroll->get_value() - dragged.x);
vscroll->set_value(vscroll->get_value() - dragged.y);

} else if (drag) {

if (edited_margin >= 0) {
float new_margin = 0;
if (edited_margin == 0)
new_margin = prev_margin + (mm->get_position().y - drag_from.y) / draw_zoom;
else if (edited_margin == 1)
new_margin = prev_margin - (mm->get_position().y - drag_from.y) / draw_zoom;
else if (edited_margin == 2)
new_margin = prev_margin + (mm->get_position().x - drag_from.x) / draw_zoom;
else if (edited_margin == 3)
new_margin = prev_margin - (mm->get_position().x - drag_from.x) / draw_zoom;
else
ERR_PRINT("Unexpected edited_margin");
if (snap_mode != SNAP_GRID) {
if (edited_margin == 0) {
new_margin = prev_margin + (mm->get_position().y - drag_from.y) / draw_zoom;
} else if (edited_margin == 1) {
new_margin = prev_margin - (mm->get_position().y - drag_from.y) / draw_zoom;
} else if (edited_margin == 2) {
new_margin = prev_margin + (mm->get_position().x - drag_from.x) / draw_zoom;
} else if (edited_margin == 3) {
new_margin = prev_margin - (mm->get_position().x - drag_from.x) / draw_zoom;
} else {
ERR_PRINT("Unexpected edited_margin");
}

if (snap_mode == SNAP_PIXEL) {
new_margin = Math::round(new_margin);
}
} else {
Vector2 pos_snapped = snap_point(mtx.affine_inverse().xform(mm->get_position()));
Rect2 rect_rounded = Rect2(rect.position.round(), rect.size.round());

if (edited_margin == 0) {
new_margin = pos_snapped.y - rect_rounded.position.y;
} else if (edited_margin == 1) {
new_margin = rect_rounded.size.y + rect_rounded.position.y - pos_snapped.y;
} else if (edited_margin == 2) {
new_margin = pos_snapped.x - rect_rounded.position.x;
} else if (edited_margin == 3) {
new_margin = rect_rounded.size.x + rect_rounded.position.x - pos_snapped.x;
} else {
ERR_PRINT("Unexpected edited_margin");
}
}

if (new_margin < 0)
new_margin = 0;
Expand Down
4 changes: 4 additions & 0 deletions editor/translations/af.po
Original file line number Diff line number Diff line change
Expand Up @@ -7401,6 +7401,10 @@ msgstr ""
msgid "Yaw"
msgstr ""

#: editor/plugins/spatial_editor_plugin.cpp
msgid "Size"
msgstr ""

#: editor/plugins/spatial_editor_plugin.cpp
msgid "Objects Drawn"
msgstr ""
Expand Down
5 changes: 5 additions & 0 deletions editor/translations/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -7334,6 +7334,11 @@ msgstr "حدّة"
msgid "Yaw"
msgstr "الإنحراف Yaw"

#: editor/plugins/spatial_editor_plugin.cpp
#, fuzzy
msgid "Size"
msgstr "الحجم: "

#: editor/plugins/spatial_editor_plugin.cpp
msgid "Objects Drawn"
msgstr "كائنات مرسومة"
Expand Down
Loading

0 comments on commit 48381ba

Please sign in to comment.