Skip to content

Commit

Permalink
Refactor modification nodes to make properties more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
lyuma committed Sep 4, 2022
1 parent 622f517 commit 62d8e79
Show file tree
Hide file tree
Showing 56 changed files with 2,825 additions and 4,754 deletions.
29 changes: 3 additions & 26 deletions doc/classes/BoneAttachment3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@
Returns the [NodePath] to the external [Skeleton3D] node, if one has been set.
</description>
</method>
<method name="get_override_mode" qualifiers="const">
<return type="int" />
<description>
Returns the override mode for the BoneAttachment3D node.
</description>
</method>
<method name="get_override_pose" qualifiers="const">
<return type="bool" />
<description>
Returns whether the BoneAttachment3D node is overriding the bone pose of the bone it's attached to.
</description>
</method>
<method name="get_use_external_skeleton" qualifiers="const">
<return type="bool" />
<description>
Expand All @@ -48,20 +36,6 @@
Sets the [NodePath] to the external skeleton that the BoneAttachment3D node should use. The external [Skeleton3D] node is only used when [code]use_external_skeleton[/code] is set to [code]true[/code].
</description>
</method>
<method name="set_override_mode">
<return type="void" />
<param index="0" name="override_mode" type="int" />
<description>
Sets the override mode for the BoneAttachment3D node. The override mode defines which of the bone poses the BoneAttachment3D node will override.
</description>
</method>
<method name="set_override_pose">
<return type="void" />
<param index="0" name="override_pose" type="bool" />
<description>
Sets whether the BoneAttachment3D node will override the bone pose of the bone it is attached to. When set to [code]true[/code], the BoneAttachment3D node can change the pose of the bone.
</description>
</method>
<method name="set_use_external_skeleton">
<return type="void" />
<param index="0" name="use_external_skeleton" type="bool" />
Expand All @@ -77,5 +51,8 @@
<member name="bone_name" type="String" setter="set_bone_name" getter="get_bone_name" default="&quot;&quot;">
The name of the attached bone.
</member>
<member name="override_pose" type="bool" setter="set_override_pose" getter="get_override_pose" default="false">
If true, the BoneAttachment3D node will override the bone pose of the bone it is attached to. When set to [code]true[/code], the BoneAttachment3D node can change the pose of the bone. When set to [code]false[/code], the BoneAttachment3D will always be set to the bone's transform.
</member>
</members>
</class>
10 changes: 6 additions & 4 deletions doc/classes/PhysicalBone2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
<tutorials>
</tutorials>
<methods>
<method name="get_cached_bone_node">
<return type="Node2D" />
<description>
</description>
</method>
<method name="get_joint" qualifiers="const">
<return type="Joint2D" />
<description>
Expand All @@ -28,10 +33,7 @@
<member name="auto_configure_joint" type="bool" setter="set_auto_configure_joint" getter="get_auto_configure_joint" default="true">
If [code]true[/code], the [code]PhysicalBone2D[/code] node will automatically configure the first [Joint2D] child node. The automatic configuration is limited to setting up the node properties and positioning the [Joint2D].
</member>
<member name="bone2d_index" type="int" setter="set_bone2d_index" getter="get_bone2d_index" default="-1">
The index of the [Bone2D] node that this [code]PhysicalBone2D[/code] node is supposed to be simulating.
</member>
<member name="bone2d_nodepath" type="NodePath" setter="set_bone2d_nodepath" getter="get_bone2d_nodepath" default="NodePath(&quot;&quot;)">
<member name="bone_node" type="NodePath" setter="set_bone_node" getter="get_bone_node" default="NodePath(&quot;&quot;)">
The [NodePath] to the [Bone2D] node that this [code]PhysicalBone2D[/code] node is supposed to be simulating.
</member>
<member name="follow_bone_when_simulating" type="bool" setter="set_follow_bone_when_simulating" getter="get_follow_bone_when_simulating" default="false">
Expand Down
23 changes: 1 addition & 22 deletions doc/classes/Skeleton2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,12 @@
</brief_description>
<description>
Skeleton2D parents a hierarchy of [Bone2D] objects. It is a requirement of [Bone2D]. Skeleton2D holds a reference to the rest pose of its children and acts as a single point of access to its bones.
To setup different types of inverse kinematics for the given Skeleton2D, a [SkeletonModificationStack2D] should be created. They can be applied by creating the desired number of modifications, which can be done by increasing [member SkeletonModificationStack2D.modification_count].
To setup different types of inverse kinematics for the given Skeleton2D, various [SkeletonModification2D] nodes should be added as children. They will update in node order.
</description>
<tutorials>
<link title="2D skeletons">$DOCS_URL/tutorials/animation/2d_skeletons.html</link>
</tutorials>
<methods>
<method name="execute_modifications">
<return type="void" />
<param index="0" name="delta" type="float" />
<param index="1" name="execution_mode" type="int" />
<description>
Executes all the modifications on the [SkeletonModificationStack2D], if the Skeleton3D has one assigned.
</description>
</method>
<method name="get_bone">
<return type="Bone2D" />
<param index="0" name="idx" type="int" />
Expand All @@ -39,12 +31,6 @@
Returns the local pose override transform for [param bone_idx].
</description>
</method>
<method name="get_modification_stack" qualifiers="const">
<return type="SkeletonModificationStack2D" />
<description>
Returns the [SkeletonModificationStack2D] attached to this skeleton, if one exists.
</description>
</method>
<method name="get_skeleton" qualifiers="const">
<return type="RID" />
<description>
Expand All @@ -63,13 +49,6 @@
[b]Note:[/b] The pose transform needs to be a local transform relative to the [Bone2D] node at [param bone_idx]!
</description>
</method>
<method name="set_modification_stack">
<return type="void" />
<param index="0" name="modification_stack" type="SkeletonModificationStack2D" />
<description>
Sets the [SkeletonModificationStack2D] attached to this skeleton.
</description>
</method>
</methods>
<signals>
<signal name="bone_setup_changed">
Expand Down
97 changes: 4 additions & 93 deletions doc/classes/Skeleton3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Skeleton3D provides a hierarchical interface for managing bones, including pose, rest and animation (see [Animation]). It can also use ragdoll physics.
The overall transform of a bone with respect to the skeleton is determined by the following hierarchical order: rest pose, custom pose and pose.
Note that "global pose" below refers to the overall transform of the bone with respect to skeleton, so it not the actual global/world transform of the bone.
To setup different types of inverse kinematics for the given Skeleton3D, various [SkeletonModification2D] nodes should be added as children. They will update in node order.
</description>
<tutorials>
<link title="3D Inverse Kinematics Demo">https://godotengine.org/asset-library/asset/523</link>
Expand All @@ -32,38 +33,18 @@
Removes the global pose override on all bones in the skeleton.
</description>
</method>
<method name="clear_bones_local_pose_override">
<return type="void" />
<description>
Removes the local pose override on all bones in the skeleton.
</description>
</method>
<method name="create_skin_from_rest_transforms">
<return type="Skin" />
<description>
</description>
</method>
<method name="execute_modifications">
<return type="void" />
<param index="0" name="delta" type="float" />
<param index="1" name="execution_mode" type="int" />
<description>
Executes all the modifications on the [SkeletonModificationStack3D], if the Skeleton3D has one assigned.
</description>
</method>
<method name="find_bone" qualifiers="const">
<return type="int" />
<param index="0" name="name" type="String" />
<description>
Returns the bone index that matches [param name] as its name.
</description>
</method>
<method name="force_update_all_bone_transforms">
<return type="void" />
<description>
Force updates the bone transforms/poses for all bones in the skeleton.
</description>
</method>
<method name="force_update_bone_child_transform">
<return type="void" />
<param index="0" name="bone_idx" type="int" />
Expand Down Expand Up @@ -112,13 +93,6 @@
Returns the global rest transform for [param bone_idx].
</description>
</method>
<method name="get_bone_local_pose_override" qualifiers="const">
<return type="Transform3D" />
<param index="0" name="bone_idx" type="int" />
<description>
Returns the local pose override transform for [param bone_idx].
</description>
</method>
<method name="get_bone_name" qualifiers="const">
<return type="String" />
<param index="0" name="bone_idx" type="int" />
Expand Down Expand Up @@ -166,42 +140,15 @@
Returns the rest transform for a bone [param bone_idx].
</description>
</method>
<method name="get_modification_stack">
<return type="SkeletonModificationStack3D" />
<description>
Returns the modification stack attached to this skeleton, if one exists.
</description>
</method>
<method name="get_parentless_bones" qualifiers="const">
<return type="PackedInt32Array" />
<description>
Returns an array with all of the bones that are parentless. Another way to look at this is that it returns the indexes of all the bones that are not dependent or modified by other bones in the Skeleton.
</description>
</method>
<method name="global_pose_to_local_pose">
<return type="Transform3D" />
<param index="0" name="bone_idx" type="int" />
<param index="1" name="global_pose" type="Transform3D" />
<description>
Takes the passed-in global pose and converts it to local pose transform.
This can be used to easily convert a global pose from [method get_bone_global_pose] to a global transform in [method set_bone_local_pose_override].
</description>
</method>
<method name="global_pose_to_world_transform">
<return type="Transform3D" />
<param index="0" name="global_pose" type="Transform3D" />
<description>
Takes the passed-in global pose and converts it to a world transform.
This can be used to easily convert a global pose from [method get_bone_global_pose] to a global transform usable with a node's transform, like [member Node3D.global_transform] for example.
</description>
</method>
<method name="global_pose_z_forward_to_bone_forward">
<return type="Basis" />
<param index="0" name="bone_idx" type="int" />
<param index="1" name="basis" type="Basis" />
<method name="get_version" qualifiers="const">
<return type="int" />
<description>
Rotates the given [Basis] so that the forward axis of the Basis is facing in the forward direction of the bone at [param bone_idx].
This is helper function to make using [method Transform3D.looking_at] easier with bone poses.
</description>
</method>
<method name="is_bone_enabled" qualifiers="const">
Expand All @@ -211,15 +158,6 @@
Returns whether the bone pose for the bone at [param bone_idx] is enabled.
</description>
</method>
<method name="local_pose_to_global_pose">
<return type="Transform3D" />
<param index="0" name="bone_idx" type="int" />
<param index="1" name="local_pose" type="Transform3D" />
<description>
Converts the passed-in local pose to a global pose relative to the inputted bone, [param bone_idx].
This could be used to convert [method get_bone_pose] for use with the [method set_bone_global_pose_override] function.
</description>
</method>
<method name="localize_rests">
<return type="void" />
<description>
Expand Down Expand Up @@ -293,19 +231,7 @@
<description>
Sets the global pose transform, [param pose], for the bone at [param bone_idx].
[param amount] is the interpolation strength that will be used when applying the pose, and [param persistent] determines if the applied pose will remain.
[b]Note:[/b] The pose transform needs to be a global pose! Use [method world_transform_to_global_pose] to convert a world transform, like one you can get from a [Node3D], to a global pose.
</description>
</method>
<method name="set_bone_local_pose_override">
<return type="void" />
<param index="0" name="bone_idx" type="int" />
<param index="1" name="pose" type="Transform3D" />
<param index="2" name="amount" type="float" />
<param index="3" name="persistent" type="bool" default="false" />
<description>
Sets the local pose transform, [param pose], for the bone at [param bone_idx].
[param amount] is the interpolation strength that will be used when applying the pose, and [param persistent] determines if the applied pose will remain.
[b]Note:[/b] The pose transform needs to be a local pose! Use [method global_pose_to_local_pose] to convert a global pose to a local pose.
[b]Note:[/b] The pose transform needs to be a global pose! To convert a world transform from a [Node3D] to a global bone pose, multiply the [method Transform3D.affine_inverse] of the node's [member Node3D.global_transform] by the desired world transform.
</description>
</method>
<method name="set_bone_name">
Expand Down Expand Up @@ -353,28 +279,13 @@
Sets the rest transform for bone [param bone_idx].
</description>
</method>
<method name="set_modification_stack">
<return type="void" />
<param index="0" name="modification_stack" type="SkeletonModificationStack3D" />
<description>
Sets the modification stack for this skeleton to the passed-in modification stack, [param modification_stack].
</description>
</method>
<method name="unparent_bone_and_rest">
<return type="void" />
<param index="0" name="bone_idx" type="int" />
<description>
Unparents the bone at [param bone_idx] and sets its rest position to that of its parent prior to being reset.
</description>
</method>
<method name="world_transform_to_global_pose">
<return type="Transform3D" />
<param index="0" name="world_transform" type="Transform3D" />
<description>
Takes the passed-in global transform and converts it to a global pose.
This can be used to easily convert a global transform from [member Node3D.global_transform] to a global pose usable with [method set_bone_global_pose_override], for example.
</description>
</method>
</methods>
<members>
<member name="animate_physical_bones" type="bool" setter="set_animate_physical_bones" getter="get_animate_physical_bones" default="true">
Expand Down
55 changes: 0 additions & 55 deletions doc/classes/SkeletonIK3D.xml

This file was deleted.

Loading

0 comments on commit 62d8e79

Please sign in to comment.