Skip to content

CopyTransformModifier3D

Inherits: BoneConstraint3D < SkeletonModifier3D < Entity3D < Entity < Object

A SkeletonModifier3D that apply transform to the bone which copied from reference.

Apply the copied transform of the bone set by BoneConstraint3D.set_reference_bone() to the bone set by BoneConstraint3D.set_apply_bone() with processing it with some masks and options.

There are 4 ways to apply the transform, depending on the combination of set_relative() and set_additive().

Relative + Additive:

  • Extract reference pose relative to the rest and add it to the apply bone’s pose.

Relative + Not Additive:

  • Extract reference pose relative to the rest and add it to the apply bone’s rest.

Not Relative + Additive:

  • Extract reference pose absolutely and add it to the apply bone’s pose.

Not Relative + Not Additive:

  • Extract reference pose absolutely and the apply bone’s pose is replaced with it.

Note: The relative and global options are only available when BoneConstraint3D.get_reference_type() is BoneConstraint3D.REFERENCE_TYPE_BONE. See also BoneConstraint3D.ReferenceType.

Type Name Default
int setting_count 0
Returns Method
BitField[AxisFlag] get_axis_flags(index: int) const
BitField[TransformFlag] get_copy_flags(index: int) const
BitField[AxisFlag] get_invert_flags(index: int) const
bool is_additive(index: int) const
bool is_axis_x_enabled(index: int) const
bool is_axis_x_inverted(index: int) const
bool is_axis_y_enabled(index: int) const
bool is_axis_y_inverted(index: int) const
bool is_axis_z_enabled(index: int) const
bool is_axis_z_inverted(index: int) const
bool is_global(index: int) const
bool is_position_copying(index: int) const
bool is_relative(index: int) const
bool is_rotation_copying(index: int) const
bool is_scale_copying(index: int) const
void set_additive(index: int, enabled: bool)
void set_axis_flags(index: int, axis_flags: BitField[AxisFlag])
void set_axis_x_enabled(index: int, enabled: bool)
void set_axis_x_inverted(index: int, enabled: bool)
void set_axis_y_enabled(index: int, enabled: bool)
void set_axis_y_inverted(index: int, enabled: bool)
void set_axis_z_enabled(index: int, enabled: bool)
void set_axis_z_inverted(index: int, enabled: bool)
void set_copy_flags(index: int, copy_flags: BitField[TransformFlag])
void set_copy_position(index: int, enabled: bool)
void set_copy_rotation(index: int, enabled: bool)
void set_copy_scale(index: int, enabled: bool)
void set_global(index: int, enabled: bool)
void set_invert_flags(index: int, axis_flags: BitField[AxisFlag])
void set_relative(index: int, enabled: bool)

TransformFlag

enum TransformFlag (flags)

TRANSFORM_FLAG_POSITION = 1

If set, allows to copy the position.

TRANSFORM_FLAG_ROTATION = 2

If set, allows to copy the rotation.

TRANSFORM_FLAG_SCALE = 4

If set, allows to copy the scale.

TRANSFORM_FLAG_ALL = 7

If set, allows to copy the position/rotation/scale.

AxisFlag

enum AxisFlag (flags)

AXIS_FLAG_X = 1

If set, allows to process the X-axis.

AXIS_FLAG_Y = 2

If set, allows to process the Y-axis.

AXIS_FLAG_Z = 4

If set, allows to process the Z-axis.

AXIS_FLAG_ALL = 7

If set, allows to process the all axes.

setting_count

int setting_count = 0

The number of settings in the modifier.

get_axis_flags

BitField[AxisFlag] get_axis_flags(index: int) const

Returns the axis flags of the setting at index.

get_copy_flags

BitField[TransformFlag] get_copy_flags(index: int) const

Returns the copy flags of the setting at index.

get_invert_flags

BitField[AxisFlag] get_invert_flags(index: int) const

Returns the invert flags of the setting at index.

is_additive

bool is_additive(index: int) const

Returns true if the additive option is enabled in the setting at index.

is_axis_x_enabled

bool is_axis_x_enabled(index: int) const

Returns true if the enable flags has the flag for the X-axis in the setting at index. See also set_axis_flags().

is_axis_x_inverted

bool is_axis_x_inverted(index: int) const

Returns true if the invert flags has the flag for the X-axis in the setting at index. See also set_invert_flags().

is_axis_y_enabled

bool is_axis_y_enabled(index: int) const

Returns true if the enable flags has the flag for the Y-axis in the setting at index. See also set_axis_flags().

is_axis_y_inverted

bool is_axis_y_inverted(index: int) const

Returns true if the invert flags has the flag for the Y-axis in the setting at index. See also set_invert_flags().

is_axis_z_enabled

bool is_axis_z_enabled(index: int) const

Returns true if the enable flags has the flag for the Z-axis in the setting at index. See also set_axis_flags().

is_axis_z_inverted

bool is_axis_z_inverted(index: int) const

Returns true if the invert flags has the flag for the Z-axis in the setting at index. See also set_invert_flags().

is_global

bool is_global(index: int) const

Returns true if the global option is enabled in the setting at index.

is_position_copying

bool is_position_copying(index: int) const

Returns true if the copy flags has the flag for the position in the setting at index. See also set_copy_flags().

is_relative

bool is_relative(index: int) const

Returns true if the relative option is enabled in the setting at index.

is_rotation_copying

bool is_rotation_copying(index: int) const

Returns true if the copy flags has the flag for the rotation in the setting at index. See also set_copy_flags().

is_scale_copying

bool is_scale_copying(index: int) const

Returns true if the copy flags has the flag for the scale in the setting at index. See also set_copy_flags().

set_additive

void set_additive(index: int, enabled: bool)

Sets additive option in the setting at index to enabled. This mainly affects the process of applying transform to the BoneConstraint3D.set_apply_bone().

If enabled is true, the processed transform is added to the pose of the current apply bone.

If enabled is false, the pose of the current apply bone is replaced with the processed transform. However, if set set_relative() to true, the transform is relative to rest.

set_axis_flags

void set_axis_flags(index: int, axis_flags: BitField[AxisFlag])

Sets the flags to copy axes. If the flag is valid, the axis is copied.

set_axis_x_enabled

void set_axis_x_enabled(index: int, enabled: bool)

If enabled is true, the X-axis will be copied.

set_axis_x_inverted

void set_axis_x_inverted(index: int, enabled: bool)

If enabled is true, the X-axis will be inverted.

set_axis_y_enabled

void set_axis_y_enabled(index: int, enabled: bool)

If enabled is true, the Y-axis will be copied.

set_axis_y_inverted

void set_axis_y_inverted(index: int, enabled: bool)

If enabled is true, the Y-axis will be inverted.

set_axis_z_enabled

void set_axis_z_enabled(index: int, enabled: bool)

If enabled is true, the Z-axis will be copied.

set_axis_z_inverted

void set_axis_z_inverted(index: int, enabled: bool)

If enabled is true, the Z-axis will be inverted.

set_copy_flags

void set_copy_flags(index: int, copy_flags: BitField[TransformFlag])

Sets the flags to process the transform operations. If the flag is valid, the transform operation is processed.

Note: If the rotation is valid for only one axis, it respects the roll of the valid axis. If the rotation is valid for two axes, it discards the roll of the invalid axis.

set_copy_position

void set_copy_position(index: int, enabled: bool)

If enabled is true, the position will be copied.

set_copy_rotation

void set_copy_rotation(index: int, enabled: bool)

If enabled is true, the rotation will be copied.

set_copy_scale

void set_copy_scale(index: int, enabled: bool)

If enabled is true, the scale will be copied.

set_global

void set_global(index: int, enabled: bool)

Sets the global option in the setting at index to enabled.

If enabled is true, the global pose of the reference bone is extracted and applied so that the global pose of the apply bone coincides with it.

If enabled is false, the local pose of the reference bone is extracted and applied to the local pose of the apply bone.

Note: If the parent of the reference bone has a non-uniform scale, the reference bone is sheared as seen from global space. Since the local pose cannot bring in the shear, the scale may not be applied as intended.

set_invert_flags

void set_invert_flags(index: int, axis_flags: BitField[AxisFlag])

Sets the flags to inverte axes. If the flag is valid, the axis is copied.

Note: An inverted scale means an inverse number, not a negative scale. For example, inverting 2.0 means 0.5.

Note: An inverted rotation flips the elements of the quaternion. For example, a two-axis inversion will flip the roll of each axis, and a three-axis inversion will flip the final orientation. However, be aware that flipping only one axis may cause unintended rotation by the unflipped axes, due to the characteristics of the quaternion.

set_relative

void set_relative(index: int, enabled: bool)

Sets relative option in the setting at index to enabled.

If enabled is true, the extracted and applying transform is relative to the rest.

If enabled is false, the extracted transform is absolute.