summaryrefslogtreecommitdiff
path: root/scene/animation
diff options
context:
space:
mode:
Diffstat (limited to 'scene/animation')
-rw-r--r--scene/animation/animation_blend_space_2d.cpp12
-rw-r--r--scene/animation/animation_cache.cpp12
-rw-r--r--scene/animation/animation_node_state_machine.cpp4
-rw-r--r--scene/animation/animation_player.cpp12
-rw-r--r--scene/animation/animation_tree.cpp8
-rw-r--r--scene/animation/animation_tree_player.cpp12
6 files changed, 28 insertions, 32 deletions
diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp
index bba25d64d9..3c93a0c8ec 100644
--- a/scene/animation/animation_blend_space_2d.cpp
+++ b/scene/animation/animation_blend_space_2d.cpp
@@ -24,7 +24,7 @@ void AnimationNodeBlendSpace2D::add_blend_point(const Ref<AnimationRootNode> &p_
for (int i = 0; i < triangles.size(); i++) {
for (int j = 0; j < 3; j++) {
if (triangles[i].points[j] >= p_at_index) {
- triangles[i].points[j]++;
+ triangles.write[i].points[j]++;
}
}
}
@@ -81,7 +81,7 @@ void AnimationNodeBlendSpace2D::remove_blend_point(int p_point) {
erase = true;
break;
} else if (triangles[i].points[j] > p_point) {
- triangles[i].points[j]--;
+ triangles.write[i].points[j]--;
}
}
if (erase) {
@@ -264,9 +264,9 @@ Vector<int> AnimationNodeBlendSpace2D::_get_triangles() const {
t.resize(triangles.size() * 3);
for (int i = 0; i < triangles.size(); i++) {
- t[i * 3 + 0] = triangles[i].points[0];
- t[i * 3 + 1] = triangles[i].points[1];
- t[i * 3 + 2] = triangles[i].points[2];
+ t.write[i * 3 + 0] = triangles[i].points[0];
+ t.write[i * 3 + 1] = triangles[i].points[1];
+ t.write[i * 3 + 2] = triangles[i].points[2];
}
return t;
}
@@ -284,7 +284,7 @@ void AnimationNodeBlendSpace2D::_update_triangles() {
Vector<Vector2> points;
points.resize(blend_points_used);
for (int i = 0; i < blend_points_used; i++) {
- points[i] = blend_points[i].position;
+ points.write[i] = blend_points[i].position;
}
Vector<Delaunay2D::Triangle> triangles = Delaunay2D::triangulate(points);
diff --git a/scene/animation/animation_cache.cpp b/scene/animation/animation_cache.cpp
index 949a0be3bc..756907c41c 100644
--- a/scene/animation/animation_cache.cpp
+++ b/scene/animation/animation_cache.cpp
@@ -43,7 +43,7 @@ void AnimationCache::_node_exit_tree(Node *p_node) {
if (path_cache[i].node != p_node)
continue;
- path_cache[i].valid = false; //invalidate path cache
+ path_cache.write[i].valid = false; //invalidate path cache
}
}
@@ -196,7 +196,7 @@ void AnimationCache::set_track_transform(int p_idx, const Transform &p_transform
ERR_FAIL_COND(!cache_valid);
ERR_FAIL_INDEX(p_idx, path_cache.size());
- Path &p = path_cache[p_idx];
+ Path &p = path_cache.write[p_idx];
if (!p.valid)
return;
@@ -217,7 +217,7 @@ void AnimationCache::set_track_value(int p_idx, const Variant &p_value) {
ERR_FAIL_COND(!cache_valid);
ERR_FAIL_INDEX(p_idx, path_cache.size());
- Path &p = path_cache[p_idx];
+ Path &p = path_cache.write[p_idx];
if (!p.valid)
return;
@@ -232,7 +232,7 @@ void AnimationCache::call_track(int p_idx, const StringName &p_method, const Var
ERR_FAIL_COND(!cache_valid);
ERR_FAIL_INDEX(p_idx, path_cache.size());
- Path &p = path_cache[p_idx];
+ Path &p = path_cache.write[p_idx];
if (!p.valid)
return;
@@ -297,11 +297,11 @@ void AnimationCache::set_all(float p_time, float p_delta) {
call_track(i, name, NULL, 0, err);
} else {
- Vector<Variant *> argptrs;
+ Vector<const Variant *> argptrs;
argptrs.resize(args.size());
for (int j = 0; j < args.size(); j++) {
- argptrs[j] = &args[j];
+ argptrs.write[j] = &args.write[j];
}
call_track(i, name, (const Variant **)&argptrs[0], args.size(), err);
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index 36587a1e91..f478112a36 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -169,11 +169,11 @@ void AnimationNodeStateMachine::rename_node(const StringName &p_name, const Stri
for (int i = 0; i < transitions.size(); i++) {
if (transitions[i].from == p_name) {
- transitions[i].from = p_new_name;
+ transitions.write[i].from = p_new_name;
}
if (transitions[i].to == p_name) {
- transitions[i].to = p_new_name;
+ transitions.write[i].to = p_new_name;
}
}
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 111620dac1..2782354432 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -233,7 +233,7 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) {
for (int i = 0; i < a->get_track_count(); i++) {
- p_anim->node_cache[i] = NULL;
+ p_anim->node_cache.write[i] = NULL;
RES resource;
Vector<StringName> leftover_path;
Node *child = parent->get_node_and_resource(a->track_get_path(i), resource, leftover_path);
@@ -265,12 +265,12 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) {
if (node_cache_map.has(key)) {
- p_anim->node_cache[i] = &node_cache_map[key];
+ p_anim->node_cache.write[i] = &node_cache_map[key];
} else {
node_cache_map[key] = TrackNodeCache();
- p_anim->node_cache[i] = &node_cache_map[key];
+ p_anim->node_cache.write[i] = &node_cache_map[key];
p_anim->node_cache[i]->path = a->track_get_path(i);
p_anim->node_cache[i]->node = child;
p_anim->node_cache[i]->resource = resource;
@@ -331,11 +331,7 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) {
if (!p_anim->node_cache[i]->bezier_anim.has(a->track_get_path(i).get_concatenated_subnames())) {
TrackNodeCache::BezierAnim ba;
- String path = leftover_path[leftover_path.size() - 1];
- Vector<String> index = path.split(".");
- for (int j = 0; j < index.size(); j++) {
- ba.bezier_property.push_back(index[j]);
- }
+ ba.bezier_property = leftover_path;
ba.object = resource.is_valid() ? (Object *)resource.ptr() : (Object *)child;
ba.owner = p_anim->node_cache[i];
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index 4fa66e8ede..de9f82dadc 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -78,9 +78,9 @@ float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p
return 0;
}
- inputs[p_input].last_pass = state->last_pass;
+ inputs.write[p_input].last_pass = state->last_pass;
- return _blend_node(node, p_time, p_seek, p_blend, p_filter, p_optimize, &inputs[p_input].activity);
+ return _blend_node(node, p_time, p_seek, p_blend, p_filter, p_optimize, &inputs.write[p_input].activity);
}
float AnimationNode::blend_node(Ref<AnimationNode> p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize) {
@@ -221,7 +221,7 @@ StringName AnimationNode::get_input_connection(int p_input) {
void AnimationNode::set_input_connection(int p_input, const StringName &p_connection) {
ERR_FAIL_INDEX(p_input, inputs.size());
- inputs[p_input].connected_to = p_connection;
+ inputs.write[p_input].connected_to = p_connection;
}
String AnimationNode::get_caption() const {
@@ -248,7 +248,7 @@ void AnimationNode::add_input(const String &p_name) {
void AnimationNode::set_input_name(int p_input, const String &p_name) {
ERR_FAIL_INDEX(p_input, inputs.size());
ERR_FAIL_COND(p_name.find(".") != -1 || p_name.find("/") != -1);
- inputs[p_input].name = p_name;
+ inputs.write[p_input].name = p_name;
emit_changed();
}
diff --git a/scene/animation/animation_tree_player.cpp b/scene/animation/animation_tree_player.cpp
index 026215508b..179f5d9698 100644
--- a/scene/animation/animation_tree_player.cpp
+++ b/scene/animation/animation_tree_player.cpp
@@ -1152,7 +1152,7 @@ void AnimationTreePlayer::transition_node_set_input_auto_advance(const StringNam
GET_NODE(NODE_TRANSITION, TransitionNode);
ERR_FAIL_INDEX(p_input, n->input_data.size());
- n->input_data[p_input].auto_advance = p_auto_advance;
+ n->input_data.write[p_input].auto_advance = p_auto_advance;
}
void AnimationTreePlayer::transition_node_set_xfade_time(const StringName &p_node, float p_time) {
@@ -1365,7 +1365,7 @@ void AnimationTreePlayer::remove_node(const StringName &p_node) {
for (int i = 0; i < nb->inputs.size(); i++) {
if (nb->inputs[i].node == p_node)
- nb->inputs[i].node = StringName();
+ nb->inputs.write[i].node = StringName();
}
}
@@ -1426,11 +1426,11 @@ Error AnimationTreePlayer::connect_nodes(const StringName &p_src_node, const Str
for (int i = 0; i < nb->inputs.size(); i++) {
if (nb->inputs[i].node == p_src_node)
- nb->inputs[i].node = StringName();
+ nb->inputs.write[i].node = StringName();
}
}
- dst->inputs[p_dst_input].node = p_src_node;
+ dst->inputs.write[p_dst_input].node = p_src_node;
_clear_cycle_test();
@@ -1463,7 +1463,7 @@ void AnimationTreePlayer::disconnect_nodes(const StringName &p_node, int p_input
NodeBase *dst = node_map[p_node];
ERR_FAIL_INDEX(p_input, dst->inputs.size());
- dst->inputs[p_input].node = StringName();
+ dst->inputs.write[p_input].node = StringName();
last_error = CONNECT_INCOMPLETE;
dirty_caches = true;
}
@@ -1703,7 +1703,7 @@ Error AnimationTreePlayer::node_rename(const StringName &p_node, const StringNam
for (int i = 0; i < nb->inputs.size(); i++) {
if (nb->inputs[i].node == p_node) {
- nb->inputs[i].node = p_new_name;
+ nb->inputs.write[i].node = p_new_name;
}
}
}