summaryrefslogtreecommitdiff
path: root/scene/animation
diff options
context:
space:
mode:
Diffstat (limited to 'scene/animation')
-rw-r--r--scene/animation/animation_blend_space_1d.cpp10
-rw-r--r--scene/animation/animation_blend_space_2d.cpp32
-rw-r--r--scene/animation/animation_blend_tree.cpp30
-rw-r--r--scene/animation/animation_node_state_machine.cpp14
-rw-r--r--scene/animation/animation_player.cpp15
-rw-r--r--scene/animation/animation_tree.cpp10
-rw-r--r--scene/animation/root_motion_view.cpp34
-rw-r--r--scene/animation/root_motion_view.h6
-rw-r--r--scene/animation/tween.cpp14
9 files changed, 90 insertions, 75 deletions
diff --git a/scene/animation/animation_blend_space_1d.cpp b/scene/animation/animation_blend_space_1d.cpp
index 15f562242f..6e5d964b76 100644
--- a/scene/animation/animation_blend_space_1d.cpp
+++ b/scene/animation/animation_blend_space_1d.cpp
@@ -47,14 +47,14 @@ void AnimationNodeBlendSpace1D::_validate_property(PropertyInfo &property) const
String left = property.name.get_slicec('/', 0);
int idx = left.get_slicec('_', 2).to_int();
if (idx >= blend_points_used) {
- property.usage = 0;
+ property.usage = PROPERTY_USAGE_NONE;
}
}
AnimationRootNode::_validate_property(property);
}
void AnimationNodeBlendSpace1D::_tree_changed() {
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendSpace1D::_bind_methods() {
@@ -120,7 +120,7 @@ void AnimationNodeBlendSpace1D::add_blend_point(const Ref<AnimationRootNode> &p_
blend_points[p_at_index].node->connect("tree_changed", callable_mp(this, &AnimationNodeBlendSpace1D::_tree_changed), varray(), CONNECT_REFERENCE_COUNTED);
blend_points_used++;
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendSpace1D::set_blend_point_position(int p_point, float p_position) {
@@ -140,7 +140,7 @@ void AnimationNodeBlendSpace1D::set_blend_point_node(int p_point, const Ref<Anim
blend_points[p_point].node = p_node;
blend_points[p_point].node->connect("tree_changed", callable_mp(this, &AnimationNodeBlendSpace1D::_tree_changed), varray(), CONNECT_REFERENCE_COUNTED);
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
float AnimationNodeBlendSpace1D::get_blend_point_position(int p_point) const {
@@ -164,7 +164,7 @@ void AnimationNodeBlendSpace1D::remove_blend_point(int p_point) {
}
blend_points_used--;
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
int AnimationNodeBlendSpace1D::get_blend_point_count() const {
diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp
index 9c4bc107dd..d88a9badf4 100644
--- a/scene/animation/animation_blend_space_2d.cpp
+++ b/scene/animation/animation_blend_space_2d.cpp
@@ -34,8 +34,8 @@
void AnimationNodeBlendSpace2D::get_parameter_list(List<PropertyInfo> *r_list) const {
r_list->push_back(PropertyInfo(Variant::VECTOR2, blend_position));
- r_list->push_back(PropertyInfo(Variant::INT, closest, PROPERTY_HINT_NONE, "", 0));
- r_list->push_back(PropertyInfo(Variant::FLOAT, length_internal, PROPERTY_HINT_NONE, "", 0));
+ r_list->push_back(PropertyInfo(Variant::INT, closest, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
+ r_list->push_back(PropertyInfo(Variant::FLOAT, length_internal, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
}
Variant AnimationNodeBlendSpace2D::get_parameter_default_value(const StringName &p_parameter) const {
@@ -84,7 +84,7 @@ void AnimationNodeBlendSpace2D::add_blend_point(const Ref<AnimationRootNode> &p_
_queue_auto_triangles();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendSpace2D::set_blend_point_position(int p_point, const Vector2 &p_position) {
@@ -103,7 +103,7 @@ void AnimationNodeBlendSpace2D::set_blend_point_node(int p_point, const Ref<Anim
blend_points[p_point].node = p_node;
blend_points[p_point].node->connect("tree_changed", callable_mp(this, &AnimationNodeBlendSpace2D::_tree_changed), varray(), CONNECT_REFERENCE_COUNTED);
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
Vector2 AnimationNodeBlendSpace2D::get_blend_point_position(int p_point) const {
@@ -143,7 +143,7 @@ void AnimationNodeBlendSpace2D::remove_blend_point(int p_point) {
blend_points[i] = blend_points[i + 1];
}
blend_points_used--;
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
int AnimationNodeBlendSpace2D::get_blend_point_count() const {
@@ -321,7 +321,7 @@ void AnimationNodeBlendSpace2D::_queue_auto_triangles() {
}
trianges_dirty = true;
- call_deferred("_update_triangles");
+ call_deferred(SNAME("_update_triangles"));
}
void AnimationNodeBlendSpace2D::_update_triangles() {
@@ -332,7 +332,7 @@ void AnimationNodeBlendSpace2D::_update_triangles() {
trianges_dirty = false;
triangles.clear();
if (blend_points_used < 3) {
- emit_signal("triangles_updated");
+ emit_signal(SNAME("triangles_updated"));
return;
}
@@ -347,7 +347,7 @@ void AnimationNodeBlendSpace2D::_update_triangles() {
for (int i = 0; i < triangles.size(); i++) {
add_triangle(triangles[i].points[0], triangles[i].points[1], triangles[i].points[2]);
}
- emit_signal("triangles_updated");
+ emit_signal(SNAME("triangles_updated"));
}
Vector2 AnimationNodeBlendSpace2D::get_closest_point(const Vector2 &p_point) {
@@ -387,19 +387,19 @@ Vector2 AnimationNodeBlendSpace2D::get_closest_point(const Vector2 &p_point) {
}
void AnimationNodeBlendSpace2D::_blend_triangle(const Vector2 &p_pos, const Vector2 *p_points, float *r_weights) {
- if (p_pos.distance_squared_to(p_points[0]) < CMP_EPSILON2) {
+ if (p_pos.is_equal_approx(p_points[0])) {
r_weights[0] = 1;
r_weights[1] = 0;
r_weights[2] = 0;
return;
}
- if (p_pos.distance_squared_to(p_points[1]) < CMP_EPSILON2) {
+ if (p_pos.is_equal_approx(p_points[1])) {
r_weights[0] = 0;
r_weights[1] = 1;
r_weights[2] = 0;
return;
}
- if (p_pos.distance_squared_to(p_points[2]) < CMP_EPSILON2) {
+ if (p_pos.is_equal_approx(p_points[2])) {
r_weights[0] = 0;
r_weights[1] = 0;
r_weights[2] = 1;
@@ -532,10 +532,10 @@ float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) {
float from = 0.0;
if (blend_mode == BLEND_MODE_DISCRETE_CARRY && closest != -1) {
//see how much animation remains
- from = blend_node(blend_points[closest].name, blend_points[closest].node, p_time, true, 0.0, FILTER_IGNORE, false) - length_internal;
+ from = length_internal - blend_node(blend_points[closest].name, blend_points[closest].node, p_time, false, 0.0, FILTER_IGNORE, false);
}
- mind = blend_node(blend_points[new_closest].name, blend_points[new_closest].node, from, true, 1.0, FILTER_IGNORE, false) + from;
+ mind = blend_node(blend_points[new_closest].name, blend_points[new_closest].node, from, true, 1.0, FILTER_IGNORE, false);
length_internal = from + mind;
closest = new_closest;
@@ -556,13 +556,13 @@ String AnimationNodeBlendSpace2D::get_caption() const {
void AnimationNodeBlendSpace2D::_validate_property(PropertyInfo &property) const {
if (auto_triangles && property.name == "triangles") {
- property.usage = 0;
+ property.usage = PROPERTY_USAGE_NONE;
}
if (property.name.begins_with("blend_point_")) {
String left = property.name.get_slicec('/', 0);
int idx = left.get_slicec('_', 2).to_int();
if (idx >= blend_points_used) {
- property.usage = 0;
+ property.usage = PROPERTY_USAGE_NONE;
}
}
AnimationRootNode::_validate_property(property);
@@ -586,7 +586,7 @@ Ref<AnimationNode> AnimationNodeBlendSpace2D::get_child_by_name(const StringName
}
void AnimationNodeBlendSpace2D::_tree_changed() {
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendSpace2D::set_blend_mode(BlendMode p_blend_mode) {
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index ad6115fa16..200a688067 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -43,7 +43,7 @@ StringName AnimationNodeAnimation::get_animation() const {
Vector<String> (*AnimationNodeAnimation::get_editable_animation_list)() = nullptr;
void AnimationNodeAnimation::get_parameter_list(List<PropertyInfo> *r_list) const {
- r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", 0));
+ r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
}
void AnimationNodeAnimation::_validate_property(PropertyInfo &property) const {
@@ -130,10 +130,10 @@ AnimationNodeAnimation::AnimationNodeAnimation() {
void AnimationNodeOneShot::get_parameter_list(List<PropertyInfo> *r_list) const {
r_list->push_back(PropertyInfo(Variant::BOOL, active));
- r_list->push_back(PropertyInfo(Variant::BOOL, prev_active, PROPERTY_HINT_NONE, "", 0));
- r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", 0));
- r_list->push_back(PropertyInfo(Variant::FLOAT, remaining, PROPERTY_HINT_NONE, "", 0));
- r_list->push_back(PropertyInfo(Variant::FLOAT, time_to_restart, PROPERTY_HINT_NONE, "", 0));
+ r_list->push_back(PropertyInfo(Variant::BOOL, prev_active, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
+ r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
+ r_list->push_back(PropertyInfo(Variant::FLOAT, remaining, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
+ r_list->push_back(PropertyInfo(Variant::FLOAT, time_to_restart, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
}
Variant AnimationNodeOneShot::get_parameter_default_value(const StringName &p_parameter) const {
@@ -607,10 +607,10 @@ void AnimationNodeTransition::get_parameter_list(List<PropertyInfo> *r_list) con
}
r_list->push_back(PropertyInfo(Variant::INT, current, PROPERTY_HINT_ENUM, anims));
- r_list->push_back(PropertyInfo(Variant::INT, prev_current, PROPERTY_HINT_NONE, "", 0));
- r_list->push_back(PropertyInfo(Variant::INT, prev, PROPERTY_HINT_NONE, "", 0));
- r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", 0));
- r_list->push_back(PropertyInfo(Variant::FLOAT, prev_xfading, PROPERTY_HINT_NONE, "", 0));
+ r_list->push_back(PropertyInfo(Variant::INT, prev_current, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
+ r_list->push_back(PropertyInfo(Variant::INT, prev, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
+ r_list->push_back(PropertyInfo(Variant::FLOAT, time, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
+ r_list->push_back(PropertyInfo(Variant::FLOAT, prev_xfading, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE));
}
Variant AnimationNodeTransition::get_parameter_default_value(const StringName &p_parameter) const {
@@ -752,7 +752,7 @@ void AnimationNodeTransition::_validate_property(PropertyInfo &property) const {
if (n != "count") {
int idx = n.to_int();
if (idx >= enabled_inputs) {
- property.usage = 0;
+ property.usage = PROPERTY_USAGE_NONE;
}
}
}
@@ -816,7 +816,7 @@ void AnimationNodeBlendTree::add_node(const StringName &p_name, Ref<AnimationNod
nodes[p_name] = n;
emit_changed();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
p_node->connect("tree_changed", callable_mp(this, &AnimationNodeBlendTree::_tree_changed), varray(), CONNECT_REFERENCE_COUNTED);
p_node->connect("changed", callable_mp(this, &AnimationNodeBlendTree::_node_changed), varray(p_name), CONNECT_REFERENCE_COUNTED);
@@ -896,7 +896,7 @@ void AnimationNodeBlendTree::remove_node(const StringName &p_name) {
}
emit_changed();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringName &p_new_name) {
@@ -921,7 +921,7 @@ void AnimationNodeBlendTree::rename_node(const StringName &p_name, const StringN
//connection must be done with new name
nodes[p_new_name].node->connect("changed", callable_mp(this, &AnimationNodeBlendTree::_node_changed), varray(p_new_name), CONNECT_REFERENCE_COUNTED);
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendTree::connect_node(const StringName &p_input_node, int p_input_index, const StringName &p_output_node) {
@@ -1125,11 +1125,11 @@ void AnimationNodeBlendTree::reset_state() {
graph_offset = Vector2();
nodes.clear();
emit_changed();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendTree::_tree_changed() {
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeBlendTree::_node_changed(const StringName &p_node) {
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index f494f5c163..6496331cb0 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -57,7 +57,7 @@ void AnimationNodeStateMachineTransition::set_advance_condition(const StringName
} else {
advance_condition_name = StringName();
}
- emit_signal("advance_condition_changed");
+ emit_signal(SNAME("advance_condition_changed"));
}
StringName AnimationNodeStateMachineTransition::get_advance_condition() const {
@@ -539,7 +539,7 @@ void AnimationNodeStateMachine::add_node(const StringName &p_name, Ref<Animation
states[p_name] = state;
emit_changed();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
p_node->connect("tree_changed", callable_mp(this, &AnimationNodeStateMachine::_tree_changed), varray(), CONNECT_REFERENCE_COUNTED);
}
@@ -559,7 +559,7 @@ void AnimationNodeStateMachine::replace_node(const StringName &p_name, Ref<Anima
states[p_name].node = p_node;
emit_changed();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
p_node->connect("tree_changed", callable_mp(this, &AnimationNodeStateMachine::_tree_changed), varray(), CONNECT_REFERENCE_COUNTED);
}
@@ -636,7 +636,7 @@ void AnimationNodeStateMachine::remove_node(const StringName &p_name) {
}*/
emit_changed();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeStateMachine::rename_node(const StringName &p_name, const StringName &p_new_name) {
@@ -669,7 +669,7 @@ void AnimationNodeStateMachine::rename_node(const StringName &p_name, const Stri
}*/
//path.clear(); //clear path
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeStateMachine::get_node_list(List<StringName> *r_nodes) const {
@@ -923,7 +923,7 @@ void AnimationNodeStateMachine::reset_state() {
graph_offset = Vector2();
emit_changed();
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeStateMachine::set_node_position(const StringName &p_name, const Vector2 &p_position) {
@@ -937,7 +937,7 @@ Vector2 AnimationNodeStateMachine::get_node_position(const StringName &p_name) c
}
void AnimationNodeStateMachine::_tree_changed() {
- emit_signal("tree_changed");
+ emit_signal(SNAME("tree_changed"));
}
void AnimationNodeStateMachine::_bind_methods() {
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 799c81c2ab..14ca325c25 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -513,7 +513,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
}
#endif
- static_cast<Node2D *>(pa->object)->set_rotation(Math::deg2rad((double)value));
+ static_cast<Node2D *>(pa->object)->set_rotation((double)value);
} break;
case SP_NODE2D_SCALE: {
#ifdef DEBUG_ENABLED
@@ -557,6 +557,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
}
#endif
+ static_assert(VARIANT_ARG_MAX == 8, "This code needs to be updated if VARIANT_ARG_MAX != 8");
if (can_call) {
if (method_call_mode == ANIMATION_METHOD_CALL_DEFERRED) {
MessageQueue::get_singleton()->push_call(
@@ -566,7 +567,10 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
s >= 2 ? params[1] : Variant(),
s >= 3 ? params[2] : Variant(),
s >= 4 ? params[3] : Variant(),
- s >= 5 ? params[4] : Variant());
+ s >= 5 ? params[4] : Variant(),
+ s >= 6 ? params[5] : Variant(),
+ s >= 7 ? params[6] : Variant(),
+ s >= 8 ? params[7] : Variant());
} else {
nc->node->call(
method,
@@ -574,7 +578,10 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
s >= 2 ? params[1] : Variant(),
s >= 3 ? params[2] : Variant(),
s >= 4 ? params[3] : Variant(),
- s >= 5 ? params[4] : Variant());
+ s >= 5 ? params[4] : Variant(),
+ s >= 6 ? params[5] : Variant(),
+ s >= 7 ? params[6] : Variant(),
+ s >= 8 ? params[7] : Variant());
}
}
}
@@ -1325,7 +1332,7 @@ float AnimationPlayer::get_current_animation_length() const {
void AnimationPlayer::_animation_changed() {
clear_caches();
- emit_signal("caches_cleared");
+ emit_signal(SNAME("caches_cleared"));
if (is_playing()) {
playback.seeked = true; //need to restart stuff, like audio
}
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index 6fac70bdd5..72448fc4f7 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -385,7 +385,7 @@ void AnimationNode::_set_filters(const Array &p_filters) {
void AnimationNode::_validate_property(PropertyInfo &property) const {
if (!has_filter() && (property.name == "filter_enabled" || property.name == "filters")) {
- property.usage = 0;
+ property.usage = PROPERTY_USAGE_NONE;
}
}
@@ -985,6 +985,7 @@ void AnimationTree::_process_graph(float p_delta) {
int s = params.size();
+ static_assert(VARIANT_ARG_MAX == 8, "This code needs to be updated if VARIANT_ARG_MAX != 8");
ERR_CONTINUE(s > VARIANT_ARG_MAX);
if (can_call) {
t->object->call_deferred(
@@ -993,7 +994,10 @@ void AnimationTree::_process_graph(float p_delta) {
s >= 2 ? params[1] : Variant(),
s >= 3 ? params[2] : Variant(),
s >= 4 ? params[3] : Variant(),
- s >= 5 ? params[4] : Variant());
+ s >= 5 ? params[4] : Variant(),
+ s >= 6 ? params[5] : Variant(),
+ s >= 7 ? params[6] : Variant(),
+ s >= 8 ? params[7] : Variant());
}
}
@@ -1327,7 +1331,7 @@ void AnimationTree::_tree_changed() {
return;
}
- call_deferred("_update_properties");
+ call_deferred(SNAME("_update_properties"));
properties_dirty = true;
}
diff --git a/scene/animation/root_motion_view.cpp b/scene/animation/root_motion_view.cpp
index b963cf5702..770996820d 100644
--- a/scene/animation/root_motion_view.cpp
+++ b/scene/animation/root_motion_view.cpp
@@ -77,7 +77,7 @@ bool RootMotionView::get_zero_y() const {
void RootMotionView::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
- RS::get_singleton()->immediate_set_material(immediate, StandardMaterial3D::get_material_rid_for_2d(false, true, false, false, false));
+ immediate_material = StandardMaterial3D::get_material_for_2d(false, true, false, false, false);
first = true;
}
@@ -119,11 +119,12 @@ void RootMotionView::_notification(int p_what) {
}
accumulated.origin.z = Math::fposmod(accumulated.origin.z, cell_size);
- RS::get_singleton()->immediate_clear(immediate);
+ immediate->clear_surfaces();
int cells_in_radius = int((radius / cell_size) + 1.0);
- RS::get_singleton()->immediate_begin(immediate, RS::PRIMITIVE_LINES);
+ immediate->surface_begin(Mesh::PRIMITIVE_LINES, immediate_material);
+
for (int i = -cells_in_radius; i < cells_in_radius; i++) {
for (int j = -cells_in_radius; j < cells_in_radius; j++) {
Vector3 from(i * cell_size, 0, j * cell_size);
@@ -138,21 +139,21 @@ void RootMotionView::_notification(int p_what) {
c_i.a *= MAX(0, 1.0 - from_i.length() / radius);
c_j.a *= MAX(0, 1.0 - from_j.length() / radius);
- RS::get_singleton()->immediate_color(immediate, c);
- RS::get_singleton()->immediate_vertex(immediate, from);
+ immediate->surface_set_color(c);
+ immediate->surface_add_vertex(from);
- RS::get_singleton()->immediate_color(immediate, c_i);
- RS::get_singleton()->immediate_vertex(immediate, from_i);
+ immediate->surface_set_color(c_i);
+ immediate->surface_add_vertex(from_i);
- RS::get_singleton()->immediate_color(immediate, c);
- RS::get_singleton()->immediate_vertex(immediate, from);
+ immediate->surface_set_color(c);
+ immediate->surface_add_vertex(from);
- RS::get_singleton()->immediate_color(immediate, c_j);
- RS::get_singleton()->immediate_vertex(immediate, from_j);
+ immediate->surface_set_color(c_j);
+ immediate->surface_add_vertex(from_j);
}
}
- RS::get_singleton()->immediate_end(immediate);
+ immediate->surface_end();
}
}
@@ -188,12 +189,13 @@ void RootMotionView::_bind_methods() {
}
RootMotionView::RootMotionView() {
- set_process_internal(true);
- immediate = RenderingServer::get_singleton()->immediate_create();
- set_base(immediate);
+ if (Engine::get_singleton()->is_editor_hint()) {
+ set_process_internal(true);
+ }
+ immediate.instantiate();
+ set_base(immediate->get_rid());
}
RootMotionView::~RootMotionView() {
set_base(RID());
- RenderingServer::get_singleton()->free(immediate);
}
diff --git a/scene/animation/root_motion_view.h b/scene/animation/root_motion_view.h
index 4cd3c7b443..55fd2d2b73 100644
--- a/scene/animation/root_motion_view.h
+++ b/scene/animation/root_motion_view.h
@@ -32,12 +32,12 @@
#define ROOT_MOTION_VIEW_H
#include "scene/3d/visual_instance_3d.h"
-
+#include "scene/resources/immediate_mesh.h"
class RootMotionView : public VisualInstance3D {
GDCLASS(RootMotionView, VisualInstance3D);
public:
- RID immediate;
+ Ref<ImmediateMesh> immediate;
NodePath path;
float cell_size = 1.0;
float radius = 10.0;
@@ -46,6 +46,8 @@ public:
bool first = true;
bool zero_y = true;
+ Ref<Material> immediate_material;
+
Transform3D accumulated;
private:
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index 7bf616e602..761046c14a 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -264,7 +264,7 @@ bool Tween::step(float p_delta) {
rem_delta = step_delta;
if (!step_active) {
- emit_signal("step_finished", current_step);
+ emit_signal(SNAME("step_finished"), current_step);
current_step++;
if (current_step == tweeners.size()) {
@@ -272,9 +272,9 @@ bool Tween::step(float p_delta) {
if (loops_done == loops) {
running = false;
dead = true;
- emit_signal("finished");
+ emit_signal(SNAME("finished"));
} else {
- emit_signal("loop_finished", loops_done);
+ emit_signal(SNAME("loop_finished"), loops_done);
current_step = 0;
start_tweeners();
}
@@ -690,7 +690,7 @@ bool PropertyTweener::step(float &r_delta) {
} else {
finished = true;
r_delta = elapsed_time - delay - duration;
- emit_signal("finished");
+ emit_signal(SNAME("finished"));
return false;
}
}
@@ -745,7 +745,7 @@ bool IntervalTweener::step(float &r_delta) {
} else {
finished = true;
r_delta = elapsed_time - duration;
- emit_signal("finished");
+ emit_signal(SNAME("finished"));
return false;
}
}
@@ -784,7 +784,7 @@ bool CallbackTweener::step(float &r_delta) {
finished = true;
r_delta = elapsed_time - delay;
- emit_signal("finished");
+ emit_signal(SNAME("finished"));
return false;
}
@@ -854,7 +854,7 @@ bool MethodTweener::step(float &r_delta) {
} else {
finished = true;
r_delta = elapsed_time - delay - duration;
- emit_signal("finished");
+ emit_signal(SNAME("finished"));
return false;
}
}