Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement BoneConstraint3D with CopyTransform/ConvertTransform/Aim Modifiers #100984

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions doc/classes/AimModifier3D.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AimModifier3D" inherits="BoneConstraint3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
The [AimModifier3D] rotates a bone to look at a reference bone.
</brief_description>
<description>
This is a simple version of [LookAtModifier3D] that only allows bone to the reference without advanced options such as angle limitation or time-based interpolation.
The feature is simplified, but instead it is implemented with smooth tracking without euler, see [method set_use_euler].
</description>
<tutorials>
</tutorials>
<methods>
<method name="get_forward_axis" qualifiers="const">
<return type="int" enum="SkeletonModifier3D.BoneAxis" />
<param index="0" name="index" type="int" />
<description>
Returns the forward axis of the bone.
</description>
</method>
<method name="get_primary_rotation_axis" qualifiers="const">
<return type="int" enum="Vector3.Axis" />
<param index="0" name="index" type="int" />
<description>
Returns the axis of the first rotation. It is enabled only if [method is_using_euler] is [code]true[/code].
</description>
</method>
<method name="is_using_euler" qualifiers="const">
<return type="bool" />
<param index="0" name="index" type="int" />
<description>
Returns [code]true[/code] if it provides rotation with using euler.
</description>
</method>
<method name="is_using_secondary_rotation" qualifiers="const">
<return type="bool" />
<param index="0" name="index" type="int" />
<description>
Returns [code]true[/code] if it provides rotation by two axes. It is enabled only if [method is_using_euler] is [code]true[/code].
</description>
</method>
<method name="set_forward_axis">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="axis" type="int" enum="SkeletonModifier3D.BoneAxis" />
<description>
Sets the forward axis of the bone.
</description>
</method>
<method name="set_primary_rotation_axis">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="axis" type="int" enum="Vector3.Axis" />
<description>
Sets the axis of the first rotation. It is enabled only if [method is_using_euler] is [code]true[/code].
</description>
</method>
<method name="set_use_euler">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="enabled" type="bool" />
<description>
If sets [param enabled] to [code]true[/code], it provides rotation with using euler.
If sets [param enabled] to [code]false[/code], it provides rotation with using rotation by arc generated from the forward axis vector and the vector toward the reference.
</description>
</method>
<method name="set_use_secondary_rotation">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="enabled" type="bool" />
<description>
If sets [param enabled] to [code]true[/code], it provides rotation by two axes. It is enabled only if [method is_using_euler] is [code]true[/code].
</description>
</method>
</methods>
<members>
<member name="setting_count" type="int" setter="set_setting_count" getter="get_setting_count" default="0">
The number of settings in the modifier.
</member>
</members>
</class>
111 changes: 111 additions & 0 deletions doc/classes/BoneConstraint3D.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="BoneConstraint3D" inherits="SkeletonModifier3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
A node that may modify Skeleton3D's bone with associating the two bones.
</brief_description>
<description>
Base class of [SkeletonModifier3D] that modifies the bone set in [method set_apply_bone] based on the transform of the bone retrieved by [method get_reference_bone].
</description>
<tutorials>
</tutorials>
<methods>
<method name="clear_setting">
<return type="void" />
<description>
Clear all settings.
</description>
</method>
<method name="get_amount" qualifiers="const">
<return type="float" />
<param index="0" name="index" type="int" />
<description>
Returns the apply amount of the setting at [param index].
</description>
</method>
<method name="get_apply_bone" qualifiers="const">
<return type="int" />
<param index="0" name="index" type="int" />
<description>
Returns the apply bone of the setting at [param index]. This bone will be modified.
</description>
</method>
<method name="get_apply_bone_name" qualifiers="const">
<return type="String" />
<param index="0" name="index" type="int" />
<description>
Returns the apply bone name of the setting at [param index]. This bone will be modified.
</description>
</method>
<method name="get_reference_bone" qualifiers="const">
<return type="int" />
<param index="0" name="index" type="int" />
<description>
Returns the reference bone of the setting at [param index].
This bone will be only referenced and not modified by this modifier.
</description>
</method>
<method name="get_reference_bone_name" qualifiers="const">
<return type="String" />
<param index="0" name="index" type="int" />
<description>
Returns the reference bone name of the setting at [param index].
This bone will be only referenced and not modified by this modifier.
</description>
</method>
<method name="get_setting_count" qualifiers="const">
<return type="int" />
<description>
Returns the number of settings in the modifier.
</description>
</method>
<method name="set_amount">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="amount" type="float" />
<description>
Sets the apply amount of the setting at [param index] to [param amount].
</description>
</method>
<method name="set_apply_bone">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="bone" type="int" />
<description>
Sets the apply bone of the setting at [param index] to [param bone]. This bone will be modified.
</description>
</method>
<method name="set_apply_bone_name">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="bone_name" type="String" />
<description>
Sets the apply bone of the setting at [param index] to [param bone_name]. This bone will be modified.
</description>
</method>
<method name="set_reference_bone">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="bone" type="int" />
<description>
Sets the reference bone of the setting at [param index] to [param bone].
This bone will be only referenced and not modified by this modifier.
</description>
</method>
<method name="set_reference_bone_name">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="bone_name" type="String" />
<description>
Sets the reference bone of the setting at [param index] to [param bone_name].
This bone will be only referenced and not modified by this modifier.
</description>
</method>
<method name="set_setting_count">
<return type="void" />
<param index="0" name="count" type="int" />
<description>
Sets the number of settings in the modifier.
</description>
</method>
</methods>
</class>
192 changes: 192 additions & 0 deletions doc/classes/ConvertTransformModifier3D.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ConvertTransformModifier3D" inherits="BoneConstraint3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
A [SkeletonModifier3D] that apply transform to the bone which converted from reference.
</brief_description>
<description>
Apply the copied transform of the bone set by [method BoneConstraint3D.set_reference_bone] to the bone set by [method BoneConstraint3D.set_apply_bone] about the specific axis with remapping it with some options.
There are 4 ways to apply the transform, depending on the combination of [method set_relative] and [method set_additive].
[b]Relative + Additive:[/b]
- Extract reference pose relative to the rest and add it to the apply bone's pose.
[b]Relative + Not Additive:[/b]
- Extract reference pose relative to the rest and add it to the apply bone's rest.
[b]Not Relative + Additive:[/b]
- Extract reference pose absolutely and add it to the apply bone's pose.
[b]Not Relative + Not Additive:[/b]
- Extract reference pose absolutely and the apply bone's pose is replaced with it.
</description>
<tutorials>
</tutorials>
<methods>
<method name="get_apply_axis" qualifiers="const">
<return type="int" enum="Vector3.Axis" />
<param index="0" name="index" type="int" />
<description>
Returns the axis of the remapping destination transform.
</description>
</method>
<method name="get_apply_range_max" qualifiers="const">
<return type="float" />
<param index="0" name="index" type="int" />
<description>
Returns the maximum value of the remapping destination range.
</description>
</method>
<method name="get_apply_range_min" qualifiers="const">
<return type="float" />
<param index="0" name="index" type="int" />
<description>
Returns the minimum value of the remapping destination range.
</description>
</method>
<method name="get_apply_transform_mode" qualifiers="const">
<return type="int" enum="ConvertTransformModifier3D.TransformMode" />
<param index="0" name="index" type="int" />
<description>
Returns the operation of the remapping destination transform.
</description>
</method>
<method name="get_reference_axis" qualifiers="const">
<return type="int" enum="Vector3.Axis" />
<param index="0" name="index" type="int" />
<description>
Returns the axis of the remapping source transform.
</description>
</method>
<method name="get_reference_range_max" qualifiers="const">
<return type="float" />
<param index="0" name="index" type="int" />
<description>
Returns the maximum value of the remapping source range.
</description>
</method>
<method name="get_reference_range_min" qualifiers="const">
<return type="float" />
<param index="0" name="index" type="int" />
<description>
Returns the minimum value of the remapping source range.
</description>
</method>
<method name="get_reference_transform_mode" qualifiers="const">
<return type="int" enum="ConvertTransformModifier3D.TransformMode" />
<param index="0" name="index" type="int" />
<description>
Returns the operation of the remapping source transform.
</description>
</method>
<method name="is_additive" qualifiers="const">
<return type="bool" />
<param index="0" name="index" type="int" />
<description>
Returns [code]true[/code] if the additive option is enabled in the setting at [param index].
</description>
</method>
<method name="is_relative" qualifiers="const">
<return type="bool" />
<param index="0" name="index" type="int" />
<description>
Returns [code]true[/code] if the relative option is enabled in the setting at [param index].
</description>
</method>
<method name="set_additive">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="enabled" type="bool" />
<description>
Sets additive option in the setting at [param index] to [param enabled]. This mainly affects the process of applying transform to the [method BoneConstraint3D.set_apply_bone].
If sets [param enabled] to [code]true[/code], the processed transform is added to the pose of the current apply bone.
If sets [param enabled] to [code]false[/code], the pose of the current apply bone is replaced with the processed transform. However, if set [method set_relative] to [code]true[/code], the transform is relative to rest.
</description>
</method>
<method name="set_apply_axis">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="axis" type="int" enum="Vector3.Axis" />
<description>
Sets the axis of the remapping destination transform.
</description>
</method>
<method name="set_apply_range_max">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="range_max" type="float" />
<description>
Sets the maximum value of the remapping destination range.
</description>
</method>
<method name="set_apply_range_min">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="range_min" type="float" />
<description>
Sets the minimum value of the remapping destination range.
</description>
</method>
<method name="set_apply_transform_mode">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="transform_mode" type="int" enum="ConvertTransformModifier3D.TransformMode" />
<description>
Sets the operation of the remapping destination transform.
</description>
</method>
<method name="set_reference_axis">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="axis" type="int" enum="Vector3.Axis" />
<description>
Sets the axis of the remapping source transform.
</description>
</method>
<method name="set_reference_range_max">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="range_max" type="float" />
<description>
Sets the maximum value of the remapping source range.
</description>
</method>
<method name="set_reference_range_min">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="range_min" type="float" />
<description>
Sets the minimum value of the remapping source range.
</description>
</method>
<method name="set_reference_transform_mode">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="transform_mode" type="int" enum="ConvertTransformModifier3D.TransformMode" />
<description>
Sets the operation of the remapping source transform.
</description>
</method>
<method name="set_relative">
<return type="void" />
<param index="0" name="index" type="int" />
<param index="1" name="enabled" type="bool" />
<description>
Sets relative option in the setting at [param index] to [param enabled].
If sets [param enabled] to [code]true[/code], the extractedand applying transform is relative to the rest.
If sets [param enabled] to [code]false[/code], the extractedtransform is absolute.
</description>
</method>
</methods>
<members>
<member name="setting_count" type="int" setter="set_setting_count" getter="get_setting_count" default="0">
The number of settings in the modifier.
</member>
</members>
<constants>
<constant name="TRANSFORM_MODE_POSITION" value="0" enum="TransformMode">
Convert with position. Transfer the difference.
</constant>
<constant name="TRANSFORM_MODE_ROTATION" value="1" enum="TransformMode">
Convert with rotation. The angle is the roll for the specified axis.
</constant>
<constant name="TRANSFORM_MODE_SCALE" value="2" enum="TransformMode">
Convert with scale. Transfers the ratio, not the difference.
</constant>
</constants>
</class>
Loading