Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-picks for the 3.5 branch (future 3.5.2) - 2nd batch #69944

Merged
merged 24 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
29c309c
Add more info to WAV import errors
alex-pahdo Oct 24, 2022
6a794cf
Add JetBrains Fleet folder to gitignore
neikeq Oct 13, 2022
ad97db2
Document `Array.sort()` and `sort_custom()` using unstable sorting
Calinou Oct 7, 2022
c703029
Add note regarding RefCounted to EditorScript docs
zak-grumbles Sep 23, 2022
a8c0189
Cast between float and ints in SceneTreeTween.`tween_property()`
Mickeon Aug 30, 2022
b129ae2
libwebp: Sync with upstream 1.2.4
akien-mga Aug 23, 2022
a945538
added options for sorting transparent objects
QbieShay Jul 13, 2022
3d0f484
Fix CanvasLayer visibility toggle can only run once per frame
timothyqiu Dec 4, 2022
2b9efd7
Store Bullet total gravity, linear damp and angular damp calculations
madmiraal Dec 9, 2022
bacda47
Fix BackBufferCopy `rect` property appearing when not relevant in ins…
Calinou Dec 8, 2022
01ed2a8
Add GCC problem matcher to CI
raulsntos Oct 31, 2022
f145894
Add MSVC problem matcher to CI
DarkKilauea Nov 11, 2022
2d1b61e
Add VS's enc_temp_folder to .gitignore
anvilfolk Nov 18, 2022
d3d7226
[MSVC] Use symbols from .pdb only, to avoid incorrect names in the ba…
bruvzg Nov 29, 2022
4c16175
Update CA certificates to 2022.10 revision
DeeJayLSP Nov 29, 2022
7decec1
Add note about GROUP_CALL_UNIQUE not considering arguments
timothyqiu Dec 4, 2022
080104b
Fix libtheora source code being mistakenly `.gitignore`d
Calinou Dec 7, 2022
7ccffd6
Fix typo bug in heightmap shape
rburing Dec 10, 2022
421e103
SCons: Fix MSVC warning LNK4042 about dupe objects in regex
akien-mga Sep 27, 2022
9e6f9a4
doc: link GPUParticles2D to the 2D Particles demo
stevecotton Oct 24, 2022
2ead966
Add detail to NavigationPolygon outline error msg
smix8 Nov 10, 2022
0e0550a
Fix newlines not honored in Windows console
RandomShaper Oct 11, 2022
62be3b3
Fix burning CPU with udev disabled on Flatpak
nyanpasu64 Dec 4, 2022
8794711
Document `print_stack()` and `get_stack()` requiring a debugger conne…
Calinou Sep 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ jobs:
- name: Setup python and scons
uses: ./.github/actions/godot-deps

- name: Setup GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master

- name: Compilation
uses: ./.github/actions/godot-build
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
- name: Setup python and scons
uses: ./.github/actions/godot-deps

- name: Setup MSVC problem matcher
uses: ammaraskar/msvc-problem-matcher@master

- name: Compilation
uses: ./.github/actions/godot-build
with:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ gmon.out

# Jetbrains IDEs
.idea/
.fleet/

# Kate
*.kate-swp
Expand Down Expand Up @@ -240,6 +241,8 @@ xcuserdata/
[Rr]eleases/
x64/
x86/
# Not build results, this is Theora source code.
!thirdparty/libtheora/x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
Expand Down Expand Up @@ -316,6 +319,7 @@ _ReSharper*/

# Others
ClientBin/
enc_temp_folder/
~$*
*.dbmdl
*.dbproj.schemaview
Expand Down
4 changes: 3 additions & 1 deletion doc/classes/Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@
<method name="sort">
<description>
Sorts the array.
[b]Note:[/b] The sorting algorithm used is not [url=https://en.wikipedia.org/wiki/Sorting_algorithm#Stability]stable[/url]. This means that values considered equal may have their order changed when using [method sort].
[b]Note:[/b] Strings are sorted in alphabetical order (as opposed to natural order). This may lead to unexpected behavior when sorting an array of strings ending with a sequence of numbers. Consider the following example:
[codeblock]
var strings = ["string1", "string2", "string10", "string11"]
Expand All @@ -357,7 +358,8 @@
<description>
Sorts the array using a custom method. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return either [code]true[/code] or [code]false[/code].
For two elements [code]a[/code] and [code]b[/code], if the given method returns [code]true[/code], element [code]b[/code] will be after element [code]a[/code] in the array.
[b]Note:[/b] You cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior.
[b]Note:[/b] The sorting algorithm used is not [url=https://en.wikipedia.org/wiki/Sorting_algorithm#Stability]stable[/url]. This means that values considered equal may have their order changed when using [method sort_custom].
[b]Note:[/b] You cannot randomize the return value as the heapsort algorithm expects a deterministic result. Randomizing the return value will result in unexpected behavior.
[codeblock]
class MyCustomSorter:
static func sort_ascending(a, b):
Expand Down
12 changes: 6 additions & 6 deletions doc/classes/BackBufferCopy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
Copies a region of the screen (or the whole screen) to a buffer so it can be accessed in your shader scripts through the [code]texture(SCREEN_TEXTURE, ...)[/code] function.
</brief_description>
<description>
Node for back-buffering the currently-displayed screen. The region defined in the BackBufferCopy node is buffered with the content of the screen it covers, or the entire screen according to the copy mode set. Use the [code]texture(SCREEN_TEXTURE, ...)[/code] function in your shader scripts to access the buffer.
[b]Note:[/b] Since this node inherits from [Node2D] (and not [Control]), anchors and margins won't apply to child [Control]-derived nodes. This can be problematic when resizing the window. To avoid this, add [Control]-derived nodes as [i]siblings[/i] to the BackBufferCopy node instead of adding them as children.
Node for back-buffering the currently-displayed screen. The region defined in the [BackBufferCopy] node is buffered with the content of the screen it covers, or the entire screen according to the copy mode set. Use the [code]texture(SCREEN_TEXTURE, ...)[/code] function in your shader scripts to access the buffer.
[b]Note:[/b] Since this node inherits from [Node2D] (and not [Control]), anchors and margins won't apply to child [Control]-derived nodes. This can be problematic when resizing the window. To avoid this, add [Control]-derived nodes as [i]siblings[/i] to the [BackBufferCopy] node instead of adding them as children.
</description>
<tutorials>
</tutorials>
Expand All @@ -16,18 +16,18 @@
Buffer mode. See [enum CopyMode] constants.
</member>
<member name="rect" type="Rect2" setter="set_rect" getter="get_rect" default="Rect2( -100, -100, 200, 200 )">
The area covered by the BackBufferCopy. Only used if [member copy_mode] is [constant COPY_MODE_RECT].
The area covered by the [BackBufferCopy]. Only used if [member copy_mode] is [constant COPY_MODE_RECT].
</member>
</members>
<constants>
<constant name="COPY_MODE_DISABLED" value="0" enum="CopyMode">
Disables the buffering mode. This means the BackBufferCopy node will directly use the portion of screen it covers.
Disables the buffering mode. This means the [BackBufferCopy] node will directly use the portion of screen it covers.
</constant>
<constant name="COPY_MODE_RECT" value="1" enum="CopyMode">
BackBufferCopy buffers a rectangular region.
[BackBufferCopy] buffers a rectangular region.
</constant>
<constant name="COPY_MODE_VIEWPORT" value="2" enum="CopyMode">
BackBufferCopy buffers the entire screen.
[BackBufferCopy] buffers the entire screen.
</constant>
</constants>
</class>
1 change: 1 addition & 0 deletions doc/classes/EditorScript.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
print("Hello from the Godot Editor!")
[/codeblock]
[b]Note:[/b] The script is run in the Editor context, which means the output is visible in the console window started with the Editor (stdout) instead of the usual Godot [b]Output[/b] dock.
[b]Note:[/b] EditorScript is reference counted, meaning it is destroyed when nothing references it. This can cause errors during asynchronous operations if there are no references to the script.
</description>
<tutorials>
</tutorials>
Expand Down
3 changes: 2 additions & 1 deletion doc/classes/Particles2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
</description>
<tutorials>
<link title="Particle systems (2D)">$DOCS_URL/tutorials/2d/particle_systems_2d.html</link>
<link title="2D Dodge The Creeps Demo">https://godotengine.org/asset-library/asset/515</link>
<link title="2D Particles Demo">https://godotengine.org/asset-library/asset/118</link>
<link title="2D Dodge The Creeps Demo (uses GPUParticles2D for the trail behind the player)">https://godotengine.org/asset-library/asset/515</link>
</tutorials>
<methods>
<method name="capture_rect" qualifiers="const">
Expand Down
1 change: 1 addition & 0 deletions doc/classes/SceneTree.xml
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@
</constant>
<constant name="GROUP_CALL_UNIQUE" value="4" enum="GroupCallFlags">
Call a group only once even if the call is executed many times.
[b]Note:[/b] Arguments are not taken into account when deciding whether the call is unique or not. Therefore when the same method is called with different arguments, only the first call will be performed.
</constant>
<constant name="STRETCH_MODE_DISABLED" value="0" enum="StretchMode">
No stretching.
Expand Down
7 changes: 7 additions & 0 deletions doc/classes/VisualInstance.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@
The render layer(s) this [VisualInstance] is drawn on.
This object will only be visible for [Camera]s whose cull mask includes the render object this [VisualInstance] is set to.
</member>
<member name="sorting_offset" type="float" setter="set_sorting_offset" getter="get_sorting_offset" default="0.0">
The sorting offset used by this [VisualInstance]. Adjusting it to a higher value will make the [VisualInstance] reliably draw on top of other [VisualInstance]s that are otherwise positioned at the same spot.
</member>
<member name="sorting_use_aabb_center" type="bool" setter="set_sorting_use_aabb_center" getter="is_sorting_use_aabb_center" default="true">
If [code]true[/code], the object is sorted based on the [AABB] center. Sorted based on the global position otherwise.
The [AABB] center based sorting is generally more accurate for 3D models. The position based sorting instead allows to better control the drawing order when working with [Particles] and [CPUParticles].
</member>
</members>
<constants>
</constants>
Expand Down
12 changes: 7 additions & 5 deletions editor/import/resource_importer_wav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,26 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
file->get_buffer((uint8_t *)&riff, 4); //RIFF

if (riff[0] != 'R' || riff[1] != 'I' || riff[2] != 'F' || riff[3] != 'F') {
uint64_t length = file->get_len();
file->close();
memdelete(file);
ERR_FAIL_V(ERR_FILE_UNRECOGNIZED);
ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED, vformat("Not a WAV file. File should start with 'RIFF', but found '%s', in file of size %d bytes", riff, length));
}

/* GET FILESIZE */
file->get_32(); // filesize

/* CHECK WAVE */

char wave[4];

file->get_buffer((uint8_t *)&wave, 4); //RIFF
char wave[5];
wave[4] = 0;
file->get_buffer((uint8_t *)&wave, 4); //WAVE

if (wave[0] != 'W' || wave[1] != 'A' || wave[2] != 'V' || wave[3] != 'E') {
uint64_t length = file->get_len();
file->close();
memdelete(file);
ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED, "Not a WAV file (no WAVE RIFF header).");
ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED, vformat("Not a WAV file. Header should contain 'WAVE', but found '%s', in file of size %d bytes", wave, length));
}

// Let users override potential loop points from the WAV.
Expand Down
66 changes: 31 additions & 35 deletions modules/bullet/rigid_body_bullet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,15 @@
*/

Vector3 BulletPhysicsDirectBodyState::get_total_gravity() const {
Vector3 gVec;
B_TO_G(body->btBody->getGravity(), gVec);
return gVec;
return body->total_gravity;
}

float BulletPhysicsDirectBodyState::get_total_angular_damp() const {
return body->btBody->getAngularDamping();
return body->total_angular_damp;
}

float BulletPhysicsDirectBodyState::get_total_linear_damp() const {
return body->btBody->getLinearDamping();
return body->total_linear_damp;
}

Vector3 BulletPhysicsDirectBodyState::get_center_of_mass() const {
Expand Down Expand Up @@ -917,16 +915,9 @@ void RigidBodyBullet::reload_space_override_modificator() {
return;
}

if (omit_forces_integration) {
// Custom behaviour.
btBody->setGravity(btVector3(0, 0, 0));
btBody->setDamping(0, 0);
return;
}

Vector3 newGravity(0.0, 0.0, 0.0);
real_t newLinearDamp = MAX(0.0, linearDamp);
real_t newAngularDamp = MAX(0.0, angularDamp);
total_gravity = Vector3(0.0, 0.0, 0.0);
total_linear_damp = MAX(0.0, linearDamp);
total_angular_damp = MAX(0.0, angularDamp);

AreaBullet *currentArea;
// Variable used to calculate new gravity for gravity point areas, it is pointed by currentGravity pointer
Expand Down Expand Up @@ -977,49 +968,54 @@ void RigidBodyBullet::reload_space_override_modificator() {
/// This area adds its gravity/damp values to whatever has been
/// calculated so far. This way, many overlapping areas can combine
/// their physics to make interesting
newGravity += support_gravity;
newLinearDamp += currentArea->get_spOv_linearDamp();
newAngularDamp += currentArea->get_spOv_angularDamp();
total_gravity += support_gravity;
total_linear_damp += currentArea->get_spOv_linearDamp();
total_angular_damp += currentArea->get_spOv_angularDamp();
break;
case PhysicsServer::AREA_SPACE_OVERRIDE_COMBINE_REPLACE:
/// This area adds its gravity/damp values to whatever has been calculated
/// so far. Then stops taking into account the rest of the areas, even the
/// default one.
newGravity += support_gravity;
newLinearDamp += currentArea->get_spOv_linearDamp();
newAngularDamp += currentArea->get_spOv_angularDamp();
total_gravity += support_gravity;
total_linear_damp += currentArea->get_spOv_linearDamp();
total_angular_damp += currentArea->get_spOv_angularDamp();
stopped = true;
break;
case PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE:
/// This area replaces any gravity/damp, even the default one, and
/// stops taking into account the rest of the areas.
newGravity = support_gravity;
newLinearDamp = currentArea->get_spOv_linearDamp();
newAngularDamp = currentArea->get_spOv_angularDamp();
total_gravity = support_gravity;
total_linear_damp = currentArea->get_spOv_linearDamp();
total_angular_damp = currentArea->get_spOv_angularDamp();
stopped = true;
break;
case PhysicsServer::AREA_SPACE_OVERRIDE_REPLACE_COMBINE:
/// This area replaces any gravity/damp calculated so far, but keeps
/// calculating the rest of the areas, down to the default one.
newGravity = support_gravity;
newLinearDamp = currentArea->get_spOv_linearDamp();
newAngularDamp = currentArea->get_spOv_angularDamp();
total_gravity = support_gravity;
total_linear_damp = currentArea->get_spOv_linearDamp();
total_angular_damp = currentArea->get_spOv_angularDamp();
break;
}
}

// Add default gravity and damping from space.
if (!stopped) {
newGravity += space->get_gravity_direction() * space->get_gravity_magnitude();
newLinearDamp += space->get_linear_damp();
newAngularDamp += space->get_angular_damp();
total_gravity += space->get_gravity_direction() * space->get_gravity_magnitude();
total_linear_damp += space->get_linear_damp();
total_angular_damp += space->get_angular_damp();
}

btVector3 newBtGravity;
G_TO_B(newGravity * gravity_scale, newBtGravity);

btBody->setGravity(newBtGravity);
btBody->setDamping(newLinearDamp, newAngularDamp);
if (omit_forces_integration) {
// Don't apply gravity or damping.
btBody->setGravity(btVector3(0, 0, 0));
btBody->setDamping(0, 0);
} else {
btVector3 newBtGravity;
G_TO_B(total_gravity * gravity_scale, newBtGravity);
btBody->setGravity(newBtGravity);
btBody->setDamping(total_linear_damp, total_angular_damp);
}
}

void RigidBodyBullet::reload_kinematic_shapes() {
Expand Down
3 changes: 3 additions & 0 deletions modules/bullet/rigid_body_bullet.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ class RigidBodyBullet : public RigidCollisionObjectBullet {
real_t gravity_scale;
real_t linearDamp;
real_t angularDamp;
Vector3 total_gravity;
real_t total_linear_damp;
real_t total_angular_damp;
bool can_sleep;
bool omit_forces_integration;
bool can_integrate_forces;
Expand Down
6 changes: 4 additions & 2 deletions modules/gdscript/doc_classes/@GDScript.xml
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@
<method name="get_stack">
<return type="Array" />
<description>
Returns an array of dictionaries representing the current call stack.
Returns an array of dictionaries representing the current call stack. See also [method print_stack].
[codeblock]
func _ready():
foo()
Expand All @@ -374,6 +374,7 @@
[codeblock]
[{function:bar, line:12, source:res://script.gd}, {function:foo, line:9, source:res://script.gd}, {function:_ready, line:6, source:res://script.gd}]
[/codeblock]
[b]Note:[/b] [method get_stack] only works if the running instance is connected to a debugging server (i.e. an editor instance). [method get_stack] will not work in projects exported in release mode, or in projects exported in debug mode if not connected to a debugging server.
</description>
</method>
<method name="hash">
Expand Down Expand Up @@ -727,11 +728,12 @@
<method name="print_stack">
<return type="void" />
<description>
Prints a stack track at code location, only works when running with debugger turned on.
Prints a stack trace at the current code location. See also [method get_stack].
Output in the console would look something like this:
[codeblock]
Frame 0 - res://test.gd:16 in function '_process'
[/codeblock]
[b]Note:[/b] [method print_stack] only works if the running instance is connected to a debugging server (i.e. an editor instance). [method print_stack] will not work in projects exported in release mode, or in projects exported in debug mode if not connected to a debugging server.
</description>
</method>
<method name="printerr" qualifiers="vararg">
Expand Down
2 changes: 1 addition & 1 deletion modules/regex/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ if env["builtin_pcre2"]:
env_pcre2["OBJSUFFIX"] = "_" + width + env_pcre2["OBJSUFFIX"]
env_pcre2.Append(CPPDEFINES=[("PCRE2_CODE_UNIT_WIDTH", width)])
env_pcre2.add_source_files(thirdparty_obj, thirdparty_sources)
env.modules_sources += thirdparty_obj

pcre2_builtin("16")
pcre2_builtin("32")
env.modules_sources += thirdparty_obj


# Godot source files
Expand Down
Loading