summaryrefslogtreecommitdiff
path: root/scene/animation
diff options
context:
space:
mode:
Diffstat (limited to 'scene/animation')
-rw-r--r--scene/animation/animation_blend_space_2d.cpp3
-rw-r--r--scene/animation/animation_player.cpp11
-rw-r--r--scene/animation/animation_player.h65
-rw-r--r--scene/animation/tween.cpp59
4 files changed, 73 insertions, 65 deletions
diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp
index 638531df41..ad60249f9a 100644
--- a/scene/animation/animation_blend_space_2d.cpp
+++ b/scene/animation/animation_blend_space_2d.cpp
@@ -29,7 +29,8 @@
/*************************************************************************/
#include "animation_blend_space_2d.h"
-#include "core/math/delaunay.h"
+
+#include "core/math/delaunay_2d.h"
void AnimationNodeBlendSpace2D::get_parameter_list(List<PropertyInfo> *r_list) const {
r_list->push_back(PropertyInfo(Variant::VECTOR2, blend_position));
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 8228cf67bd..7bac09f839 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -1479,9 +1479,14 @@ void AnimationPlayer::_set_process(bool p_process, bool p_force) {
switch (animation_process_mode) {
- case ANIMATION_PROCESS_PHYSICS: set_physics_process_internal(p_process && active); break;
- case ANIMATION_PROCESS_IDLE: set_process_internal(p_process && active); break;
- case ANIMATION_PROCESS_MANUAL: break;
+ case ANIMATION_PROCESS_PHYSICS:
+ set_physics_process_internal(p_process && active);
+ break;
+ case ANIMATION_PROCESS_IDLE:
+ set_process_internal(p_process && active);
+ break;
+ case ANIMATION_PROCESS_MANUAL:
+ break;
}
processing = p_process;
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index c134aff707..d709082f62 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -87,41 +87,37 @@ private:
struct TrackNodeCache {
NodePath path;
- uint32_t id;
+ uint32_t id = 0;
RES resource;
- Node *node;
- Node3D *spatial;
- Node2D *node_2d;
- Skeleton3D *skeleton;
- int bone_idx;
+ Node *node = nullptr;
+ Node3D *spatial = nullptr;
+ Node2D *node_2d = nullptr;
+ Skeleton3D *skeleton = nullptr;
+ int bone_idx = -1;
// accumulated transforms
Vector3 loc_accum;
Quat rot_accum;
Vector3 scale_accum;
- uint64_t accum_pass;
+ uint64_t accum_pass = 0;
- bool audio_playing;
- float audio_start;
- float audio_len;
+ bool audio_playing = false;
+ float audio_start = 0.0;
+ float audio_len = 0.0;
- bool animation_playing;
+ bool animation_playing = false;
struct PropertyAnim {
- TrackNodeCache *owner;
- SpecialProperty special; //small optimization
+ TrackNodeCache *owner = nullptr;
+ SpecialProperty special = SP_NONE; //small optimization
Vector<StringName> subpath;
- Object *object;
+ Object *object = nullptr;
Variant value_accum;
- uint64_t accum_pass;
+ uint64_t accum_pass = 0;
Variant capture;
- PropertyAnim() :
- owner(nullptr),
- special(SP_NONE),
- object(nullptr),
- accum_pass(0) {}
+ PropertyAnim() {}
};
Map<StringName, PropertyAnim> property_anim;
@@ -129,32 +125,17 @@ private:
struct BezierAnim {
Vector<StringName> bezier_property;
- TrackNodeCache *owner;
- float bezier_accum;
- Object *object;
- uint64_t accum_pass;
-
- BezierAnim() :
- owner(nullptr),
- bezier_accum(0.0),
- object(nullptr),
- accum_pass(0) {}
+ TrackNodeCache *owner = nullptr;
+ float bezier_accum = 0.0;
+ Object *object = nullptr;
+ uint64_t accum_pass = 0;
+
+ BezierAnim() {}
};
Map<StringName, BezierAnim> bezier_anim;
- TrackNodeCache() :
- id(0),
- node(nullptr),
- spatial(nullptr),
- node_2d(nullptr),
- skeleton(nullptr),
- bone_idx(-1),
- accum_pass(0),
- audio_playing(false),
- audio_start(0.0),
- audio_len(0.0),
- animation_playing(false) {}
+ TrackNodeCache() {}
};
struct TrackNodeCacheKey {
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index d0c6cac8cf..b826907a3a 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -353,7 +353,8 @@ Variant Tween::_get_final_val(const InterpolateData &p_data) const {
// If we're looking at an INT value, instead convert it to a FLOAT
// This is better for interpolation
- if (final_val.get_type() == Variant::INT) final_val = final_val.operator real_t();
+ if (final_val.get_type() == Variant::INT)
+ final_val = final_val.operator real_t();
return final_val;
}
@@ -395,7 +396,8 @@ Variant &Tween::_get_delta_val(InterpolateData &p_data) {
// If we're looking at an INT value, instead convert it to a FLOAT
// This is better for interpolation
- if (final_val.get_type() == Variant::INT) final_val = final_val.operator real_t();
+ if (final_val.get_type() == Variant::INT)
+ final_val = final_val.operator real_t();
// Calculate the delta based on the initial value and the final value
_calc_delta_val(p_data.initial_val, final_val, p_data.delta_val);
@@ -409,7 +411,8 @@ Variant &Tween::_get_delta_val(InterpolateData &p_data) {
// If we're looking at an INT value, instead convert it to a FLOAT
// This is better for interpolation
- if (initial_val.get_type() == Variant::INT) initial_val = initial_val.operator real_t();
+ if (initial_val.get_type() == Variant::INT)
+ initial_val = initial_val.operator real_t();
// Calculate the delta based on the initial value and the final value
_calc_delta_val(initial_val, p_data.final_val, p_data.delta_val);
@@ -823,8 +826,12 @@ void Tween::set_active(bool p_active) {
// Depending on physics or idle, set processing
switch (tween_process_mode) {
- case TWEEN_PROCESS_IDLE: set_process_internal(p_active); break;
- case TWEEN_PROCESS_PHYSICS: set_physics_process_internal(p_active); break;
+ case TWEEN_PROCESS_IDLE:
+ set_process_internal(p_active);
+ break;
+ case TWEEN_PROCESS_PHYSICS:
+ set_physics_process_internal(p_active);
+ break;
}
}
@@ -1334,11 +1341,14 @@ void Tween::interpolate_property(Object *p_object, NodePath p_property, Variant
// If no initial value given, grab the initial value from the object
// TODO: Is this documented? This is very useful and removes a lot of clutter from tweens!
- if (p_initial_val.get_type() == Variant::NIL) p_initial_val = p_object->get_indexed(p_property.get_subnames());
+ if (p_initial_val.get_type() == Variant::NIL)
+ p_initial_val = p_object->get_indexed(p_property.get_subnames());
// Convert any integers into REALs as they are better for interpolation
- if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t();
- if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t();
+ if (p_initial_val.get_type() == Variant::INT)
+ p_initial_val = p_initial_val.operator real_t();
+ if (p_final_val.get_type() == Variant::INT)
+ p_final_val = p_final_val.operator real_t();
// Build the interpolation data
_build_interpolation(INTER_PROPERTY, p_object, &p_property, nullptr, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay);
@@ -1352,8 +1362,10 @@ void Tween::interpolate_method(Object *p_object, StringName p_method, Variant p_
}
// Convert any integers into REALs as they are better for interpolation
- if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t();
- if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t();
+ if (p_initial_val.get_type() == Variant::INT)
+ p_initial_val = p_initial_val.operator real_t();
+ if (p_final_val.get_type() == Variant::INT)
+ p_final_val = p_final_val.operator real_t();
// Build the interpolation data
_build_interpolation(INTER_METHOD, p_object, nullptr, &p_method, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay);
@@ -1486,10 +1498,12 @@ void Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini
// If no initial value is given, grab it from the source object
// TODO: Is this documented? It's really helpful for decluttering tweens
- if (p_initial_val.get_type() == Variant::NIL) p_initial_val = p_object->get_indexed(p_property.get_subnames());
+ if (p_initial_val.get_type() == Variant::NIL)
+ p_initial_val = p_object->get_indexed(p_property.get_subnames());
// Convert initial INT values to FLOAT as they are better for interpolation
- if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t();
+ if (p_initial_val.get_type() == Variant::INT)
+ p_initial_val = p_initial_val.operator real_t();
// Confirm the source and target objects are valid
ERR_FAIL_COND(p_object == nullptr);
@@ -1515,7 +1529,8 @@ void Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini
ERR_FAIL_COND(!target_prop_valid);
// Convert target INT to FLOAT since it is better for interpolation
- if (target_val.get_type() == Variant::INT) target_val = target_val.operator real_t();
+ if (target_val.get_type() == Variant::INT)
+ target_val = target_val.operator real_t();
// Verify that the target value and initial value are the same type
ERR_FAIL_COND(target_val.get_type() != p_initial_val.get_type());
@@ -1550,7 +1565,8 @@ void Tween::follow_method(Object *p_object, StringName p_method, Variant p_initi
return;
}
// Convert initial INT values to FLOAT as they are better for interpolation
- if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t();
+ if (p_initial_val.get_type() == Variant::INT)
+ p_initial_val = p_initial_val.operator real_t();
// Verify the source and target objects are valid
ERR_FAIL_COND(p_object == nullptr);
@@ -1576,7 +1592,8 @@ void Tween::follow_method(Object *p_object, StringName p_method, Variant p_initi
ERR_FAIL_COND(error.error != Callable::CallError::CALL_OK);
// Convert target INT values to FLOAT as they are better for interpolation
- if (target_val.get_type() == Variant::INT) target_val = target_val.operator real_t();
+ if (target_val.get_type() == Variant::INT)
+ target_val = target_val.operator real_t();
ERR_FAIL_COND(target_val.get_type() != p_initial_val.get_type());
// Make the new InterpolateData for the method follow
@@ -1613,7 +1630,8 @@ void Tween::targeting_property(Object *p_object, NodePath p_property, Object *p_
p_initial_property = p_initial_property.get_as_property_path();
// Convert the initial INT values to FLOAT as they are better for Interpolation
- if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t();
+ if (p_final_val.get_type() == Variant::INT)
+ p_final_val = p_final_val.operator real_t();
// Verify both objects are valid
ERR_FAIL_COND(p_object == nullptr);
@@ -1639,7 +1657,8 @@ void Tween::targeting_property(Object *p_object, NodePath p_property, Object *p_
ERR_FAIL_COND(!initial_prop_valid);
// Convert the initial INT value to FLOAT as it is better for interpolation
- if (initial_val.get_type() == Variant::INT) initial_val = initial_val.operator real_t();
+ if (initial_val.get_type() == Variant::INT)
+ initial_val = initial_val.operator real_t();
ERR_FAIL_COND(initial_val.get_type() != p_final_val.get_type());
// Build the InterpolateData object
@@ -1679,7 +1698,8 @@ void Tween::targeting_method(Object *p_object, StringName p_method, Object *p_in
}
// Convert final INT values to FLOAT as they are better for interpolation
- if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t();
+ if (p_final_val.get_type() == Variant::INT)
+ p_final_val = p_final_val.operator real_t();
// Make sure the given objects are valid
ERR_FAIL_COND(p_object == nullptr);
@@ -1705,7 +1725,8 @@ void Tween::targeting_method(Object *p_object, StringName p_method, Object *p_in
ERR_FAIL_COND(error.error != Callable::CallError::CALL_OK);
// Convert initial INT values to FLOAT as they aer better for interpolation
- if (initial_val.get_type() == Variant::INT) initial_val = initial_val.operator real_t();
+ if (initial_val.get_type() == Variant::INT)
+ initial_val = initial_val.operator real_t();
ERR_FAIL_COND(initial_val.get_type() != p_final_val.get_type());
// Build the new InterpolateData object