| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="BoneTwistDisperser3D" inherits="SkeletonModifier3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A node that propagates and disperses the child bone's twist to the parent bones. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | This [BoneTwistDisperser3D] allows for smooth twist interpolation between multiple bones by dispersing the end bone's twist to the parents. This only changes the twist without changing the global position of each joint. |
| 8 | This is useful for smoothly twisting bones in combination with [CopyTransformModifier3D] and IK. |
| 9 | [b]Note:[/b] If an extracted twist is greater than 180 degrees, flipping occurs. This is similar to [ConvertTransformModifier3D]. |
| 10 | </description> |
| 11 | <tutorials> |
| 12 | </tutorials> |
| 13 | <methods> |
| 14 | <method name="clear_settings"> |
| 15 | <return type="void" /> |
| 16 | <description> |
| 17 | Clears all settings. |
| 18 | </description> |
| 19 | </method> |
| 20 | <method name="get_damping_curve" qualifiers="const"> |
| 21 | <return type="Curve" /> |
| 22 | <param index="0" name="index" type="int" /> |
| 23 | <description> |
| 24 | Returns the damping curve when [method get_disperse_mode] is [constant DISPERSE_MODE_CUSTOM]. |
| 25 | </description> |
| 26 | </method> |
| 27 | <method name="get_disperse_mode" qualifiers="const"> |
| 28 | <return type="int" enum="BoneTwistDisperser3D.DisperseMode" /> |
| 29 | <param index="0" name="index" type="int" /> |
| 30 | <description> |
| 31 | Returns whether to use automatic amount assignment or to allow manual assignment. |
| 32 | </description> |
| 33 | </method> |
| 34 | <method name="get_end_bone" qualifiers="const"> |
| 35 | <return type="int" /> |
| 36 | <param index="0" name="index" type="int" /> |
| 37 | <description> |
| 38 | Returns the end bone index of the bone chain. |
| 39 | </description> |
| 40 | </method> |
| 41 | <method name="get_end_bone_direction" qualifiers="const"> |
| 42 | <return type="int" enum="SkeletonModifier3D.BoneDirection" /> |
| 43 | <param index="0" name="index" type="int" /> |
| 44 | <description> |
| 45 | Returns the tail direction of the end bone of the bone chain when [method is_end_bone_extended] is [code]true[/code]. |
| 46 | </description> |
| 47 | </method> |
| 48 | <method name="get_end_bone_name" qualifiers="const"> |
| 49 | <return type="String" /> |
| 50 | <param index="0" name="index" type="int" /> |
| 51 | <description> |
| 52 | Returns the end bone name of the bone chain. |
| 53 | </description> |
| 54 | </method> |
| 55 | <method name="get_joint_bone" qualifiers="const"> |
| 56 | <return type="int" /> |
| 57 | <param index="0" name="index" type="int" /> |
| 58 | <param index="1" name="joint" type="int" /> |
| 59 | <description> |
| 60 | Returns the bone index at [param joint] in the bone chain's joint list. |
| 61 | </description> |
| 62 | </method> |
| 63 | <method name="get_joint_bone_name" qualifiers="const"> |
| 64 | <return type="String" /> |
| 65 | <param index="0" name="index" type="int" /> |
| 66 | <param index="1" name="joint" type="int" /> |
| 67 | <description> |
| 68 | Returns the bone name at [param joint] in the bone chain's joint list. |
| 69 | </description> |
| 70 | </method> |
| 71 | <method name="get_joint_count" qualifiers="const"> |
| 72 | <return type="int" /> |
| 73 | <param index="0" name="index" type="int" /> |
| 74 | <description> |
| 75 | Returns the joint count of the bone chain's joint list. |
| 76 | </description> |
| 77 | </method> |
| 78 | <method name="get_joint_twist_amount" qualifiers="const"> |
| 79 | <return type="float" /> |
| 80 | <param index="0" name="index" type="int" /> |
| 81 | <param index="1" name="joint" type="int" /> |
| 82 | <description> |
| 83 | Returns the twist amount at [param joint] in the bone chain's joint list when [method get_disperse_mode] is [constant DISPERSE_MODE_CUSTOM]. |
| 84 | </description> |
| 85 | </method> |
| 86 | <method name="get_reference_bone" qualifiers="const"> |
| 87 | <return type="int" /> |
| 88 | <param index="0" name="index" type="int" /> |
| 89 | <description> |
| 90 | Returns the reference bone to extract twist of the setting at [param index]. |
| 91 | This bone is either the end of the chain or its parent, depending on [method is_end_bone_extended]. |
| 92 | </description> |
| 93 | </method> |
| 94 | <method name="get_reference_bone_name" qualifiers="const"> |
| 95 | <return type="String" /> |
| 96 | <param index="0" name="index" type="int" /> |
| 97 | <description> |
| 98 | Returns the reference bone name to extract twist of the setting at [param index]. |
| 99 | This bone is either the end of the chain or its parent, depending on [method is_end_bone_extended]. |
| 100 | </description> |
| 101 | </method> |
| 102 | <method name="get_root_bone" qualifiers="const"> |
| 103 | <return type="int" /> |
| 104 | <param index="0" name="index" type="int" /> |
| 105 | <description> |
| 106 | Returns the root bone index of the bone chain. |
| 107 | </description> |
| 108 | </method> |
| 109 | <method name="get_root_bone_name" qualifiers="const"> |
| 110 | <return type="String" /> |
| 111 | <param index="0" name="index" type="int" /> |
| 112 | <description> |
| 113 | Returns the root bone name of the bone chain. |
| 114 | </description> |
| 115 | </method> |
| 116 | <method name="get_twist_from" qualifiers="const"> |
| 117 | <return type="Quaternion" /> |
| 118 | <param index="0" name="index" type="int" /> |
| 119 | <description> |
| 120 | Returns the rotation to an arbitrary state before twisting for the current bone pose to extract the twist when [method is_twist_from_rest] is [code]false[/code]. |
| 121 | </description> |
| 122 | </method> |
| 123 | <method name="get_weight_position" qualifiers="const"> |
| 124 | <return type="float" /> |
| 125 | <param index="0" name="index" type="int" /> |
| 126 | <description> |
| 127 | Returns the position at which to divide the segment between joints for weight assignment when [method get_disperse_mode] is [constant DISPERSE_MODE_WEIGHTED]. |
| 128 | </description> |
| 129 | </method> |
| 130 | <method name="is_end_bone_extended" qualifiers="const"> |
| 131 | <return type="bool" /> |
| 132 | <param index="0" name="index" type="int" /> |
| 133 | <description> |
| 134 | Returns [code]true[/code] if the end bone is extended to have a tail. |
| 135 | </description> |
| 136 | </method> |
| 137 | <method name="is_twist_from_rest" qualifiers="const"> |
| 138 | <return type="bool" /> |
| 139 | <param index="0" name="index" type="int" /> |
| 140 | <description> |
| 141 | Returns [code]true[/code] if extracting the twist amount from the difference between the bone rest and the current bone pose. |
| 142 | </description> |
| 143 | </method> |
| 144 | <method name="set_damping_curve"> |
| 145 | <return type="void" /> |
| 146 | <param index="0" name="index" type="int" /> |
| 147 | <param index="1" name="curve" type="Curve" /> |
| 148 | <description> |
| 149 | Sets the damping curve when [method get_disperse_mode] is [constant DISPERSE_MODE_CUSTOM]. |
| 150 | </description> |
| 151 | </method> |
| 152 | <method name="set_disperse_mode"> |
| 153 | <return type="void" /> |
| 154 | <param index="0" name="index" type="int" /> |
| 155 | <param index="1" name="disperse_mode" type="int" enum="BoneTwistDisperser3D.DisperseMode" /> |
| 156 | <description> |
| 157 | Sets whether to use automatic amount assignment or to allow manual assignment. |
| 158 | </description> |
| 159 | </method> |
| 160 | <method name="set_end_bone"> |
| 161 | <return type="void" /> |
| 162 | <param index="0" name="index" type="int" /> |
| 163 | <param index="1" name="bone" type="int" /> |
| 164 | <description> |
| 165 | Sets the end bone index of the bone chain. |
| 166 | </description> |
| 167 | </method> |
| 168 | <method name="set_end_bone_direction"> |
| 169 | <return type="void" /> |
| 170 | <param index="0" name="index" type="int" /> |
| 171 | <param index="1" name="bone_direction" type="int" enum="SkeletonModifier3D.BoneDirection" /> |
| 172 | <description> |
| 173 | Sets the end bone tail direction of the bone chain when [method is_end_bone_extended] is [code]true[/code]. |
| 174 | </description> |
| 175 | </method> |
| 176 | <method name="set_end_bone_name"> |
| 177 | <return type="void" /> |
| 178 | <param index="0" name="index" type="int" /> |
| 179 | <param index="1" name="bone_name" type="String" /> |
| 180 | <description> |
| 181 | Sets the end bone name of the bone chain. |
| 182 | [b]Note:[/b] The end bone must be a child of the root bone. |
| 183 | </description> |
| 184 | </method> |
| 185 | <method name="set_extend_end_bone"> |
| 186 | <return type="void" /> |
| 187 | <param index="0" name="index" type="int" /> |
| 188 | <param index="1" name="enabled" type="bool" /> |
| 189 | <description> |
| 190 | If [param enabled] is [code]true[/code], the end bone is extended to have a tail. |
| 191 | If [param enabled] is [code]false[/code], [method get_reference_bone] becomes a parent of the end bone and it uses the vector to the end bone as a twist axis. |
| 192 | </description> |
| 193 | </method> |
| 194 | <method name="set_joint_twist_amount"> |
| 195 | <return type="void" /> |
| 196 | <param index="0" name="index" type="int" /> |
| 197 | <param index="1" name="joint" type="int" /> |
| 198 | <param index="2" name="twist_amount" type="float" /> |
| 199 | <description> |
| 200 | Sets the twist amount at [param joint] in the bone chain's joint list when [method get_disperse_mode] is [constant DISPERSE_MODE_CUSTOM]. |
| 201 | </description> |
| 202 | </method> |
| 203 | <method name="set_root_bone"> |
| 204 | <return type="void" /> |
| 205 | <param index="0" name="index" type="int" /> |
| 206 | <param index="1" name="bone" type="int" /> |
| 207 | <description> |
| 208 | Sets the root bone index of the bone chain. |
| 209 | </description> |
| 210 | </method> |
| 211 | <method name="set_root_bone_name"> |
| 212 | <return type="void" /> |
| 213 | <param index="0" name="index" type="int" /> |
| 214 | <param index="1" name="bone_name" type="String" /> |
| 215 | <description> |
| 216 | Sets the root bone name of the bone chain. |
| 217 | </description> |
| 218 | </method> |
| 219 | <method name="set_twist_from"> |
| 220 | <return type="void" /> |
| 221 | <param index="0" name="index" type="int" /> |
| 222 | <param index="1" name="from" type="Quaternion" /> |
| 223 | <description> |
| 224 | Sets the rotation to an arbitrary state before twisting for the current bone pose to extract the twist when [method is_twist_from_rest] is [code]false[/code]. |
| 225 | In other words, by calling [method set_twist_from] by [signal SkeletonModifier3D.modification_processed] of a specific [SkeletonModifier3D], you can extract only the twists generated by modifiers processed after that but before this [BoneTwistDisperser3D]. |
| 226 | </description> |
| 227 | </method> |
| 228 | <method name="set_twist_from_rest"> |
| 229 | <return type="void" /> |
| 230 | <param index="0" name="index" type="int" /> |
| 231 | <param index="1" name="enabled" type="bool" /> |
| 232 | <description> |
| 233 | If [param enabled] is [code]true[/code], it extracts the twist amount from the difference between the bone rest and the current bone pose. |
| 234 | If [param enabled] is [code]false[/code], it extracts the twist amount from the difference between [method get_twist_from] and the current bone pose. See also [method set_twist_from]. |
| 235 | </description> |
| 236 | </method> |
| 237 | <method name="set_weight_position"> |
| 238 | <return type="void" /> |
| 239 | <param index="0" name="index" type="int" /> |
| 240 | <param index="1" name="weight_position" type="float" /> |
| 241 | <description> |
| 242 | Sets the position at which to divide the segment between joints for weight assignment when [method get_disperse_mode] is [constant DISPERSE_MODE_WEIGHTED]. |
| 243 | For example, when [param weight_position] is [code]0.5[/code], if two bone segments with a length of [code]1.0[/code] exist between three joints, weights are assigned to each joint from root to end at ratios of [code]0.5[/code], [code]1.0[/code], and [code]0.5[/code]. Then amounts become [code]0.25[/code], [code]0.75[/code], and [code]1.0[/code] respectively. |
| 244 | </description> |
| 245 | </method> |
| 246 | </methods> |
| 247 | <members> |
| 248 | <member name="mutable_bone_axes" type="bool" setter="set_mutable_bone_axes" getter="are_bone_axes_mutable" default="true"> |
| 249 | If [code]true[/code], the solver retrieves the bone axis from the bone pose every frame. |
| 250 | If [code]false[/code], the solver retrieves the bone axis from the bone rest and caches it. |
| 251 | </member> |
| 252 | <member name="setting_count" type="int" setter="set_setting_count" getter="get_setting_count" default="0"> |
| 253 | The number of settings. |
| 254 | </member> |
| 255 | </members> |
| 256 | <constants> |
| 257 | <constant name="DISPERSE_MODE_EVEN" value="0" enum="DisperseMode"> |
| 258 | Assign amounts so that they monotonically increase from [code]0.0[/code] to [code]1.0[/code], ensuring all weights are equal. For example, with five joints, the amounts would be [code]0.2[/code], [code]0.4[/code], [code]0.6[/code], [code]0.8[/code], and [code]1.0[/code] starting from the root bone. |
| 259 | </constant> |
| 260 | <constant name="DISPERSE_MODE_WEIGHTED" value="1" enum="DisperseMode"> |
| 261 | Assign amounts so that they monotonically increase from [code]0.0[/code] to [code]1.0[/code], based on the length of the bones between joint segments. See also [method set_weight_position]. |
| 262 | </constant> |
| 263 | <constant name="DISPERSE_MODE_CUSTOM" value="2" enum="DisperseMode"> |
| 264 | You can assign arbitrary amounts to the joint list. See also [method set_joint_twist_amount]. |
| 265 | When [method is_end_bone_extended] is [code]false[/code], a child of the reference bone exists solely to determine the twist axis, so its custom amount has absolutely no effect at all. |
| 266 | </constant> |
| 267 | </constants> |
| 268 | </class> |