summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLyuma <xn.lyuma@gmail.com>2024-04-16 21:44:44 -0700
committerLyuma <xn.lyuma@gmail.com>2024-04-18 01:49:12 -0700
commitcb7ef2b8de2e0234f2085c23a97a6bf64ef936d7 (patch)
tree861938e177349ff37c29852c9ac3596a6bb60021
parent3b1806182a3564736ad64793b203c2c13c251f56 (diff)
downloadredot-engine-cb7ef2b8de2e0234f2085c23a97a6bf64ef936d7.tar.gz
Add SkeletonIK3D get/set_interpolation compat from #87888
-rw-r--r--doc/classes/SkeletonIK3D.xml3
-rw-r--r--misc/extension_api_validation/4.2-stable.expected3
-rw-r--r--scene/3d/skeleton_ik_3d.cpp16
-rw-r--r--scene/3d/skeleton_ik_3d.h5
4 files changed, 24 insertions, 3 deletions
diff --git a/doc/classes/SkeletonIK3D.xml b/doc/classes/SkeletonIK3D.xml
index 6de6d9d186..4858a6ce22 100644
--- a/doc/classes/SkeletonIK3D.xml
+++ b/doc/classes/SkeletonIK3D.xml
@@ -55,6 +55,9 @@
</method>
</methods>
<members>
+ <member name="interpolation" type="float" setter="set_interpolation" getter="get_interpolation" deprecated="Use [member SkeletonModifier3D.influence] instead.">
+ Interpolation value for how much the IK results are applied to the current skeleton bone chain. A value of [code]1.0[/code] will overwrite all skeleton bone transforms completely while a value of [code]0.0[/code] will visually disable the SkeletonIK.
+ </member>
<member name="magnet" type="Vector3" setter="set_magnet_position" getter="get_magnet_position" default="Vector3(0, 0, 0)">
Secondary target position (first is [member target] property or [member target_node]) for the IK chain. Use magnet position (pole target) to control the bending of the IK chain. Only works if the bone chain has more than 2 bones. The middle chain bone position will be linearly interpolated with the magnet position.
</member>
diff --git a/misc/extension_api_validation/4.2-stable.expected b/misc/extension_api_validation/4.2-stable.expected
index 6471c5a142..05b2cec687 100644
--- a/misc/extension_api_validation/4.2-stable.expected
+++ b/misc/extension_api_validation/4.2-stable.expected
@@ -264,9 +264,6 @@ Removed VisualShaderNodeComment, which is replaced by VisualShaderNodeFrame.
GH-87888
--------
Validate extension JSON: API was removed: classes/Skeleton3D/properties/animate_physical_bones
-Validate extension JSON: API was removed: classes/SkeletonIK3D/methods/get_interpolation
-Validate extension JSON: API was removed: classes/SkeletonIK3D/methods/set_interpolation
-Validate extension JSON: API was removed: classes/SkeletonIK3D/properties/interpolation
These base class is changed to SkeletonModifier3D which is processed by Skeleton3D with the assumption that it is Skeleton3D's child.
diff --git a/scene/3d/skeleton_ik_3d.cpp b/scene/3d/skeleton_ik_3d.cpp
index 9581ae58d8..78a21ba9e1 100644
--- a/scene/3d/skeleton_ik_3d.cpp
+++ b/scene/3d/skeleton_ik_3d.cpp
@@ -366,6 +366,12 @@ void SkeletonIK3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "target_node"), "set_target_node", "get_target_node");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "min_distance", PROPERTY_HINT_NONE, "suffix:m"), "set_min_distance", "get_min_distance");
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_iterations"), "set_max_iterations", "get_max_iterations");
+
+#ifndef DISABLE_DEPRECATED
+ ClassDB::bind_method(D_METHOD("set_interpolation", "interpolation"), &SkeletonIK3D::_set_interpolation);
+ ClassDB::bind_method(D_METHOD("get_interpolation"), &SkeletonIK3D::_get_interpolation);
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "interpolation", PROPERTY_HINT_RANGE, "0,1,0.001", PROPERTY_USAGE_NONE), "set_interpolation", "get_interpolation");
+#endif
}
void SkeletonIK3D::_process_modification() {
@@ -415,6 +421,16 @@ StringName SkeletonIK3D::get_tip_bone() const {
return tip_bone;
}
+#ifndef DISABLE_DEPRECATED
+void SkeletonIK3D::_set_interpolation(real_t p_interpolation) {
+ set_influence(p_interpolation);
+}
+
+real_t SkeletonIK3D::_get_interpolation() const {
+ return get_influence();
+}
+#endif
+
void SkeletonIK3D::set_target_transform(const Transform3D &p_target) {
target = p_target;
reload_goal();
diff --git a/scene/3d/skeleton_ik_3d.h b/scene/3d/skeleton_ik_3d.h
index eff018f2cc..5d6020194e 100644
--- a/scene/3d/skeleton_ik_3d.h
+++ b/scene/3d/skeleton_ik_3d.h
@@ -134,6 +134,11 @@ class SkeletonIK3D : public SkeletonModifier3D {
Variant target_node_override_ref = Variant();
FabrikInverseKinematic::Task *task = nullptr;
+#ifndef DISABLE_DEPRECATED
+ void _set_interpolation(real_t p_interpolation);
+ real_t _get_interpolation() const;
+#endif // DISABLE_DEPRECATED
+
protected:
void _validate_property(PropertyInfo &p_property) const;