Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: godotengine/godot
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 92c8e87
Choose a base ref
..
head repository: godotengine/godot
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4d984b6
Choose a head ref
Showing with 354 additions and 263 deletions.
  1. +2 −32 core/math/transform_interpolator.cpp
  2. +9 −2 doc/classes/AnimationMixer.xml
  3. +1 −1 doc/classes/Basis.xml
  4. +1 −1 doc/classes/Button.xml
  5. +7 −3 doc/classes/EditorExportPlugin.xml
  6. +1 −0 doc/classes/Mesh.xml
  7. +3 −2 doc/classes/NodePath.xml
  8. +1 −1 doc/classes/Transform3D.xml
  9. +2 −2 drivers/vulkan/SCsub
  10. +9 −0 drivers/vulkan/rendering_context_driver_vulkan.cpp
  11. +5 −18 editor/animation_bezier_editor.cpp
  12. +0 −1 editor/animation_bezier_editor.h
  13. +4 −20 editor/animation_track_editor.cpp
  14. +2 −0 editor/connections_dialog.cpp
  15. +7 −11 editor/editor_file_system.cpp
  16. +0 −1 editor/editor_file_system.h
  17. +8 −0 editor/editor_node.cpp
  18. +3 −0 editor/editor_node.h
  19. +2 −13 editor/editor_settings_dialog.cpp
  20. +1 −0 editor/groups_editor.cpp
  21. +22 −0 editor/plugins/animation_library_editor.cpp
  22. +1 −0 editor/plugins/animation_library_editor.h
  23. +28 −2 editor/plugins/polygon_2d_editor_plugin.cpp
  24. +1 −1 editor/plugins/sprite_frames_editor_plugin.cpp
  25. +2 −1 editor/plugins/tiles/tile_map_layer_editor.cpp
  26. +2 −13 editor/project_settings_editor.cpp
  27. +68 −65 main/main.cpp
  28. +2 −1 main/main.h
  29. +23 −8 modules/gdscript/gdscript_cache.cpp
  30. +2 −0 modules/gdscript/gdscript_cache.h
  31. +33 −20 platform/android/java_godot_lib_jni.cpp
  32. +0 −2 platform/web/SCsub
  33. +12 −4 platform/web/js/libs/library_godot_javascript_singleton.js
  34. +12 −10 platform/windows/detect.py
  35. +2 −2 scene/animation/animation_player.h
  36. +1 −1 scene/gui/button.cpp
  37. +0 −10 scene/gui/texture_rect.cpp
  38. +14 −0 scene/resources/animation.cpp
  39. +1 −0 scene/resources/animation.h
  40. +8 −15 scene/resources/atlas_texture.cpp
  41. +50 −0 scene/resources/packed_scene.cpp
  42. +1 −0 scene/resources/packed_scene.h
  43. +1 −0 servers/rendering/shader_language.cpp
34 changes: 2 additions & 32 deletions core/math/transform_interpolator.cpp
Original file line number Diff line number Diff line change
@@ -33,44 +33,14 @@
#include "core/math/transform_2d.h"

void TransformInterpolator::interpolate_transform_2d(const Transform2D &p_prev, const Transform2D &p_curr, Transform2D &r_result, real_t p_fraction) {
// Extract parameters.
Vector2 p1 = p_prev.get_origin();
Vector2 p2 = p_curr.get_origin();

// Special case for physics interpolation, if flipping, don't interpolate basis.
// If the determinant polarity changes, the handedness of the coordinate system changes.
if (_sign(p_prev.determinant()) != _sign(p_curr.determinant())) {
r_result.columns[0] = p_curr.columns[0];
r_result.columns[1] = p_curr.columns[1];
r_result.set_origin(p1.lerp(p2, p_fraction));
r_result.set_origin(p_prev.get_origin().lerp(p_curr.get_origin(), p_fraction));
return;
}

real_t r1 = p_prev.get_rotation();
real_t r2 = p_curr.get_rotation();

Size2 s1 = p_prev.get_scale();
Size2 s2 = p_curr.get_scale();

// Slerp rotation.
Vector2 v1(Math::cos(r1), Math::sin(r1));
Vector2 v2(Math::cos(r2), Math::sin(r2));

real_t dot = v1.dot(v2);

dot = CLAMP(dot, -1, 1);

Vector2 v;

if (dot > 0.9995f) {
v = v1.lerp(v2, p_fraction).normalized(); // Linearly interpolate to avoid numerical precision issues.
} else {
real_t angle = p_fraction * Math::acos(dot);
Vector2 v3 = (v2 - v1 * dot).normalized();
v = v1 * Math::cos(angle) + v3 * Math::sin(angle);
}

// Construct matrix.
r_result = Transform2D(Math::atan2(v.y, v.x), p1.lerp(p2, p_fraction));
r_result.scale_basis(s1.lerp(s2, p_fraction));
r_result = p_prev.interpolate_with(p_curr, p_fraction);
}
11 changes: 9 additions & 2 deletions doc/classes/AnimationMixer.xml
Original file line number Diff line number Diff line change
@@ -27,6 +27,13 @@
<param index="1" name="library" type="AnimationLibrary" />
<description>
Adds [param library] to the animation player, under the key [param name].
AnimationMixer has a global library by default with an empty string as key. For adding an animation to the global library:
[codeblocks]
[gdscript]
var global_library = mixer.get_animation_library("")
global_library.add_animation("animation_name", animation_resource)
[/gdscript]
[/codeblocks]
</description>
</method>
<method name="advance">
@@ -182,10 +189,10 @@
func _process(delta):
if Input.is_action_just_pressed("animate"):
state_machine.travel("Animate")
var current_root_motion_rotation_accumulator: Quaternion = animation_tree.get_root_motion_Quaternion_accumulator()
var current_root_motion_rotation_accumulator: Quaternion = animation_tree.get_root_motion_rotation_accumulator()
var difference: Quaternion = prev_root_motion_rotation_accumulator.inverse() * current_root_motion_rotation_accumulator
prev_root_motion_rotation_accumulator = current_root_motion_rotation_accumulator
transform.basis *= difference
transform.basis *= Basis(difference)
[/gdscript]
[/codeblocks]
However, if the animation loops, an unintended discrete change may occur, so this is only useful for some simple use cases.
2 changes: 1 addition & 1 deletion doc/classes/Basis.xml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
A [Basis] is composed by 3 axis vectors, each representing a column of the matrix: [member x], [member y], and [member z]. The length of each axis ([method Vector3.length]) influences the basis's scale, while the direction of all axes influence the rotation. Usually, these axes are perpendicular to one another. However, when you rotate any axis individually, the basis becomes sheared. Applying a sheared basis to a 3D model will make the model appear distorted.
A [Basis] is [b]orthogonal[/b] if its axes are perpendicular to each other. A basis is [b]normalized[/b] if the length of every axis is [code]1[/code]. A basis is [b]uniform[/b] if all axes share the same length (see [method get_scale]). A basis is [b]orthonormal[/b] if it is both orthogonal and normalized, which allows it to only represent rotations. A basis is [b]conformal[/b] if it is both orthogonal and uniform, which ensures it is not distorted.
For a general introduction, see the [url=$DOCS_URL/tutorials/math/matrices_and_transforms.html]Matrices and transforms[/url] tutorial.
[b]Note:[/b] Godot uses a [url=https://en.wikipedia.org/wiki/Right-hand_rule]right-handed coordinate system[/url], which is a common standard. For directions, the convention for built-in types like [Camera3D] is for -Z to point forward (+X is right, +Y is up, and +Z is back). Other objects may use different direction conventions. For more information, see the [url=$DOCS_URL/tutorials/assets_pipeline/importing_scenes.html#d-asset-direction-conventions]Importing 3D Scenes[/url] tutorial.
[b]Note:[/b] Godot uses a [url=https://en.wikipedia.org/wiki/Right-hand_rule]right-handed coordinate system[/url], which is a common standard. For directions, the convention for built-in types like [Camera3D] is for -Z to point forward (+X is right, +Y is up, and +Z is back). Other objects may use different direction conventions. For more information, see the [url=$DOCS_URL/tutorials/assets_pipeline/importing_3d_scenes/model_export_considerations.html#d-asset-direction-conventions]3D asset direction conventions[/url] tutorial.
[b]Note:[/b] The basis matrices are exposed as [url=https://www.mindcontrol.org/~hplus/graphics/matrix-layout.html]column-major[/url] order, which is the same as OpenGL. However, they are stored internally in row-major order, which is the same as DirectX.
</description>
<tutorials>
2 changes: 1 addition & 1 deletion doc/classes/Button.xml
Original file line number Diff line number Diff line change
@@ -119,7 +119,7 @@
Icon modulate [Color] used when the [Button] is being pressed.
</theme_item>
<theme_item name="align_to_largest_stylebox" data_type="constant" type="int" default="0">
This constant acts as a boolean. If [code]true[/code], text and icon are always aligned to the largest stylebox margins, otherwise it's aligned to the current button state stylebox margins.
This constant acts as a boolean. If [code]true[/code], the minimum size of the button and text/icon alignment is always based on the largest stylebox margins, otherwise it's based on the current button state stylebox margins.
</theme_item>
<theme_item name="h_separation" data_type="constant" type="int" default="4">
The horizontal space between [Button]'s icon and text. Negative values will be treated as [code]0[/code] when used.
10 changes: 7 additions & 3 deletions doc/classes/EditorExportPlugin.xml
Original file line number Diff line number Diff line change
@@ -17,15 +17,16 @@
<param index="1" name="features" type="PackedStringArray" />
<description>
Return [code]true[/code] if this plugin will customize resources based on the platform and features used.
When enabled, [method _get_customization_configuration_hash], [method _customize_resource] and [method _customize_scene] will be called and must be implemented.
When enabled, [method _get_customization_configuration_hash] and [method _customize_resource] will be called and must be implemented.
</description>
</method>
<method name="_begin_customize_scenes" qualifiers="virtual const">
<return type="bool" />
<param index="0" name="platform" type="EditorExportPlatform" />
<param index="1" name="features" type="PackedStringArray" />
<description>
Return true if this plugin will customize scenes based on the platform and features used.
Return [code]true[/code] if this plugin will customize scenes based on the platform and features used.
When enabled, [method _get_customization_configuration_hash] and [method _customize_scene] will be called and must be implemented.
</description>
</method>
<method name="_customize_resource" qualifiers="virtual">
@@ -35,6 +36,7 @@
<description>
Customize a resource. If changes are made to it, return the same or a new resource. Otherwise, return [code]null[/code].
The [i]path[/i] argument is only used when customizing an actual file, otherwise this means that this resource is part of another one and it will be empty.
Calling [method skip] inside this callback will make the file not included in the export.
Implementing this method is required if [method _begin_customize_resources] returns [code]true[/code].
</description>
</method>
@@ -44,6 +46,7 @@
<param index="1" name="path" type="String" />
<description>
Customize a scene. If changes are made to it, return the same or a new scene. Otherwise, return [code]null[/code]. If a new scene is returned, it is up to you to dispose of the old one.
Calling [method skip] inside this callback will make the file not included in the export.
Implementing this method is required if [method _begin_customize_scenes] returns [code]true[/code].
</description>
</method>
@@ -81,8 +84,9 @@
<param index="1" name="type" type="String" />
<param index="2" name="features" type="PackedStringArray" />
<description>
Virtual method to be overridden by the user. Called for each exported file, providing arguments that can be used to identify the file. [param path] is the path of the file, [param type] is the [Resource] represented by the file (e.g. [PackedScene]) and [param features] is the list of features for the export.
Virtual method to be overridden by the user. Called for each exported file, except for imported resources (resources that have an associated [code].import[/code] file). The arguments can be used to identify the file. [param path] is the path of the file, [param type] is the [Resource] represented by the file (e.g. [PackedScene]), and [param features] is the list of features for the export.
Calling [method skip] inside this callback will make the file not included in the export.
Use [method _customize_resource] for imported resources that are not handled by this function.
</description>
</method>
<method name="_get_android_dependencies" qualifiers="virtual const">
1 change: 1 addition & 0 deletions doc/classes/Mesh.xml
Original file line number Diff line number Diff line change
@@ -223,6 +223,7 @@
</constant>
<constant name="ARRAY_NORMAL" value="1" enum="ArrayType">
[PackedVector3Array] of vertex normals.
[b]Note:[/b] The array has to consist of normal vectors, otherwise they will be normalized by the engine, potentially causing visual discrepancies.
</constant>
<constant name="ARRAY_TANGENT" value="2" enum="ArrayType">
[PackedFloat32Array] of vertex tangents. Each element in groups of 4 floats, first 3 floats determine the tangent, and the last the binormal direction as -1 or 1.
5 changes: 3 additions & 2 deletions doc/classes/NodePath.xml
Original file line number Diff line number Diff line change
@@ -23,11 +23,12 @@
[/codeblock]
Despite their name, node paths may also point to a property:
[codeblock]
^"position" # Points to this object's position.
^"position:x" # Points to this object's position in the x axis.
^":position" # Points to this object's position.
^":position:x" # Points to this object's position in the x axis.
^"Camera3D:rotation:y" # Points to the child Camera3D and its y rotation.
^"/root:size:x" # Points to the root Window and its width.
[/codeblock]
In some situations, it's possible to omit the leading [code]:[/code] when pointing to an object's property. As an example, this is the case with [method Object.set_indexed] and [method Tween.tween_property], as those methods call [method NodePath.get_as_property_path] under the hood. However, it's generally recommended to keep the [code]:[/code] prefix.
Node paths cannot check whether they are valid and may point to nodes or properties that do not exist. Their meaning depends entirely on the context in which they're used.
You usually do not have to worry about the [NodePath] type, as strings are automatically converted to the type when necessary. There are still times when defining node paths is useful. For example, exported [NodePath] properties allow you to easily select any node within the currently edited scene. They are also automatically updated when moving, renaming or deleting nodes in the scene tree editor. See also [annotation @GDScript.@export_node_path].
See also [StringName], which is a similar type designed for optimized strings.
2 changes: 1 addition & 1 deletion doc/classes/Transform3D.xml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
<description>
The [Transform3D] built-in [Variant] type is a 3×4 matrix representing a transformation in 3D space. It contains a [Basis], which on its own can represent rotation, scale, and shear. Additionally, combined with its own [member origin], the transform can also represent a translation.
For a general introduction, see the [url=$DOCS_URL/tutorials/math/matrices_and_transforms.html]Matrices and transforms[/url] tutorial.
[b]Note:[/b] Godot uses a [url=https://en.wikipedia.org/wiki/Right-hand_rule]right-handed coordinate system[/url], which is a common standard. For directions, the convention for built-in types like [Camera3D] is for -Z to point forward (+X is right, +Y is up, and +Z is back). Other objects may use different direction conventions. For more information, see the [url=$DOCS_URL/tutorials/assets_pipeline/importing_scenes.html#d-asset-direction-conventions]Importing 3D Scenes[/url] tutorial.
[b]Note:[/b] Godot uses a [url=https://en.wikipedia.org/wiki/Right-hand_rule]right-handed coordinate system[/url], which is a common standard. For directions, the convention for built-in types like [Camera3D] is for -Z to point forward (+X is right, +Y is up, and +Z is back). Other objects may use different direction conventions. For more information, see the [url=$DOCS_URL/tutorials/assets_pipeline/importing_3d_scenes/model_export_considerations.html#d-asset-direction-conventions]3D asset direction conventions[/url] tutorial.
</description>
<tutorials>
<link title="Math documentation index">$DOCS_URL/tutorials/math/index.html</link>
4 changes: 2 additions & 2 deletions drivers/vulkan/SCsub
Original file line number Diff line number Diff line change
@@ -16,14 +16,14 @@ if env["use_volk"]:
if env["platform"] == "android":
env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_ANDROID_KHR"])
elif env["platform"] == "ios":
env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_IOS_MVK"])
env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_IOS_MVK", "VK_USE_PLATFORM_METAL_EXT"])
elif env["platform"] == "linuxbsd":
if env["x11"]:
env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_XLIB_KHR"])
if env["wayland"]:
env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_WAYLAND_KHR"])
elif env["platform"] == "macos":
env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_MACOS_MVK"])
env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_MACOS_MVK", "VK_USE_PLATFORM_METAL_EXT"])
elif env["platform"] == "windows":
env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_WIN32_KHR"])

9 changes: 9 additions & 0 deletions drivers/vulkan/rendering_context_driver_vulkan.cpp
Original file line number Diff line number Diff line change
@@ -102,6 +102,10 @@ Error RenderingContextDriverVulkan::_initialize_instance_extensions() {
// This extension allows us to use the properties2 features to query additional device capabilities.
_register_requested_instance_extension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, false);

#if defined(USE_VOLK) && (defined(MACOS_ENABLED) || defined(IOS_ENABLED))
_register_requested_instance_extension(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME, true);
#endif

// Only enable debug utils in verbose mode or DEV_ENABLED.
// End users would get spammed with messages of varying verbosity due to the
// mess that thirdparty layers/extensions and drivers seem to leave in their
@@ -360,6 +364,11 @@ Error RenderingContextDriverVulkan::_initialize_instance() {

VkInstanceCreateInfo instance_info = {};
instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;

#if defined(USE_VOLK) && (defined(MACOS_ENABLED) || defined(IOS_ENABLED))
instance_info.flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
#endif

instance_info.pApplicationInfo = &app_info;
instance_info.enabledExtensionCount = enabled_extension_names.size();
instance_info.ppEnabledExtensionNames = enabled_extension_names.ptr();
23 changes: 5 additions & 18 deletions editor/animation_bezier_editor.cpp
Original file line number Diff line number Diff line change
@@ -872,14 +872,14 @@ void AnimationBezierTrackEdit::_change_selected_keys_handle_mode(Animation::Hand
}

void AnimationBezierTrackEdit::_clear_selection_for_anim(const Ref<Animation> &p_anim) {
if (!(animation == p_anim)) {
if (!(animation == p_anim) || !is_visible()) {
return;
}
_clear_selection();
}

void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int p_track, real_t p_pos, bool p_single) {
if (!(animation == p_anim)) {
if (!(animation == p_anim) || !is_visible()) {
return;
}

@@ -1220,7 +1220,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
//insert new point
if (mb->get_position().x >= limit && mb->get_position().x < get_size().width && mb->is_command_or_control_pressed()) {
float h = (get_size().height / 2.0 - mb->get_position().y) * timeline_v_zoom + timeline_v_scroll;
Array new_point = make_default_bezier_key(h);
Array new_point = animation->make_default_bezier_key(h);

real_t time = ((mb->get_position().x - limit) / timeline->get_zoom_scale()) + timeline->get_value();
while (animation->track_find_key(selected_track, time, Animation::FIND_MODE_APPROX) != -1) {
@@ -1643,19 +1643,6 @@ void AnimationBezierTrackEdit::_zoom_callback(float p_zoom_factor, Vector2 p_ori
queue_redraw();
}

Array AnimationBezierTrackEdit::make_default_bezier_key(float p_value) {
Array new_point;
new_point.resize(5);

new_point[0] = p_value;
new_point[1] = -0.25;
new_point[2] = 0;
new_point[3] = 0.25;
new_point[4] = 0;

return new_point;
}

float AnimationBezierTrackEdit::get_bezier_key_value(Array p_bezier_key_array) {
return p_bezier_key_array[0];
}
@@ -1675,7 +1662,7 @@ void AnimationBezierTrackEdit::_menu_selected(int p_index) {
time += 0.001;
}
float h = (get_size().height / 2.0 - menu_insert_key.y) * timeline_v_zoom + timeline_v_scroll;
Array new_point = make_default_bezier_key(h);
Array new_point = animation->make_default_bezier_key(h);
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action(TTR("Add Bezier Point"));
undo_redo->add_do_method(animation.ptr(), "track_insert_key", selected_track, time, new_point);
@@ -1877,7 +1864,7 @@ void AnimationBezierTrackEdit::paste_keys(real_t p_ofs, bool p_ofs_valid) {

Variant value = key.value;
if (key.track_type != Animation::TYPE_BEZIER) {
value = make_default_bezier_key(key.value);
value = animation->make_default_bezier_key(key.value);
}

undo_redo->add_do_method(animation.ptr(), "track_insert_key", selected_track, dst_time, value, key.transition);
1 change: 0 additions & 1 deletion editor/animation_bezier_editor.h
Original file line number Diff line number Diff line change
@@ -198,7 +198,6 @@ class AnimationBezierTrackEdit : public Control {
void _notification(int p_what);

public:
static Array make_default_bezier_key(float p_value);
static float get_bezier_key_value(Array p_bezier_key_array);

virtual String get_tooltip(const Point2 &p_pos) const override;
Loading