Blender V5.3
blender::ed::AnimTransformable Class Reference

#include <ED_anim_transformable.hh>

Public Types

enum class  Type : int8_t { POSE_BONE , OBJECT }
enum class  PropertyType : int8_t { LOCATION , ROTATION , SCALE }

Public Member Functions

 AnimTransformable (Object &owner_id, bPoseChannel &pchan)
 AnimTransformable (Object &object)
Type type () const
ID * owner_id () const
StringRefNull fcurve_group_name () const
StringRefNull name () const
template<typename T>
T data () const
StringRefNull rna_path () const
std::string rna_path_to_property (PropertyType prop_type) const
std::string rna_path_to_property (const StringRef property_name) const
std::string rna_path_to_rotation (eRotationModes rotation_mode) const
std::string rna_path_to_rotation_mode () const
Rotation get_rotation () const
Rotation get_rotation_for_mode (eRotationModes mode) const
void set_rotation (const Rotation &rotation)
eRotationModes get_rotation_mode () const
void set_rotation_mode (eRotationModes mode)
void blend_rotation_to (const Rotation &target, float factor, AxisMutable axis_flag)
TransformFloats get_property (PropertyType prop_type) const
void set_property (PropertyType prop_type, Span< float > values, AxisMutable axis_flag)
void blend_property_to (PropertyType prop_type, Span< float > target, float factor, AxisMutable axis_flag)
void blend_property_to (PropertyType prop_type, float target, float factor, AxisMutable axis_flag)
float4x4 get_world_space (const Depsgraph &depsgraph) const
float4x4 world_to_local (const Depsgraph &depsgraph, const float4x4 &world_matrix) const
template<>
bPoseChannel * data () const
template<>
Object * data () const

Detailed Description

Provides a common interface to transform values for multiple structs. In a way this is similar to RNA, however RNA has the issue that the properties don't have consistent naming making it impossible to work with them in a generic way.

Definition at line 83 of file ED_anim_transformable.hh.

Member Enumeration Documentation

◆ PropertyType

Enumerator
LOCATION 
ROTATION 
SCALE 

Definition at line 90 of file ED_anim_transformable.hh.

◆ Type

Enumerator
POSE_BONE 
OBJECT 

Definition at line 85 of file ED_anim_transformable.hh.

Constructor & Destructor Documentation

◆ AnimTransformable() [1/2]

blender::ed::AnimTransformable::AnimTransformable ( Object & owner_id,
bPoseChannel & pchan )

◆ AnimTransformable() [2/2]

blender::ed::AnimTransformable::AnimTransformable ( Object & object)
explicit

Definition at line 321 of file transformable.cc.

References AnimTransformable(), blender::Object::loc, and name().

Member Function Documentation

◆ blend_property_to() [1/2]

void blender::ed::AnimTransformable::blend_property_to ( PropertyType prop_type,
float target,
float factor,
AxisMutable axis_flag )

Overloaded function that blends all values of the given property type to the same float.

Definition at line 472 of file transformable.cc.

References blender::ed::blend_linear(), blend_rotation_to(), blender::BLI_assert(), LOCATION, blender::ROT_MODE_QUAT, ROTATION, SCALE, and blender::Array< T, InlineBufferCapacity, Allocator >::size().

◆ blend_property_to() [2/2]

void blender::ed::AnimTransformable::blend_property_to ( PropertyType prop_type,
Span< float > target,
float factor,
AxisMutable axis_flag )

Do a linear blend of the property values towards the given target. It is asserted that the given span size equals the property size. When setting the rotation property, it is the responsibility of the caller to ensure that the values are in the correct mode. It is assumed the target is in the same rotation mode as the transformable.

Note
This will not work correctly for quaternion rotations. Use blend_rotation_to instead.

Definition at line 441 of file transformable.cc.

References blender::ed::blend_linear(), blend_rotation_to(), BLI_assert_msg, LOCATION, ROTATION, SCALE, blender::Array< T, InlineBufferCapacity, Allocator >::size(), and blender::Span< T >::size().

Referenced by data(), blender::pose_bone_blend_to(), blender::pose_slide_apply_linear(), blender::pose_slide_rest_pose_apply(), blender::ed::tests::TEST_F(), blender::ed::tests::TEST_F(), and blender::ed::tests::TEST_F().

◆ blend_rotation_to()

void blender::ed::AnimTransformable::blend_rotation_to ( const Rotation & target,
float factor,
AxisMutable axis_flag )

◆ data() [1/3]

template<>
Object * blender::ed::AnimTransformable::data ( ) const

Definition at line 341 of file transformable.cc.

References blender::BLI_assert(), and OBJECT.

◆ data() [2/3]

template<>
bPoseChannel * blender::ed::AnimTransformable::data ( ) const

Definition at line 335 of file transformable.cc.

References blender::BLI_assert(), and POSE_BONE.

◆ data() [3/3]

◆ fcurve_group_name()

StringRefNull blender::ed::AnimTransformable::fcurve_group_name ( ) const
inline

◆ get_property()

TransformFloats blender::ed::AnimTransformable::get_property ( PropertyType prop_type) const

Returns a copy of the property values for the given property type. While this will return the values of the current rotation mode for PropertyType::ROTATION, it is best to use the explicit function for it so a Rotation struct is returned which has more features for dealing with different rotation modes.

Definition at line 390 of file transformable.cc.

References BLI_assert_unreachable, blender::ed::copy_pointers_to_values(), LOCATION, ROTATION, and SCALE.

Referenced by blender::ed::animrig::clean_baked_fcurves(), data(), blender::pose_bone_blend_to(), blender::pose_slide_apply_linear(), blender::store_starting_transform(), blender::ed::tests::TEST_F(), blender::ed::tests::TEST_F(), and blender::ed::tests::TEST_F().

◆ get_rotation()

Rotation blender::ed::AnimTransformable::get_rotation ( ) const

◆ get_rotation_for_mode()

Rotation blender::ed::AnimTransformable::get_rotation_for_mode ( eRotationModes mode) const

Returns a copy of the rotation for the given mode. This is not the current rotation converted to the given mode, but the values of the underlying rotation properties for the given mode. For example, this can return the axis-angle rotation property values, even when the transformable is in quaternion mode.

Definition at line 523 of file transformable.cc.

References blender::BLI_assert(), and blender::ed::copy_pointers_to_values().

Referenced by blender::convert_rotation_mode_range(), data(), and get_rotation().

◆ get_rotation_mode()

eRotationModes blender::ed::AnimTransformable::get_rotation_mode ( ) const

◆ get_world_space()

float4x4 blender::ed::AnimTransformable::get_world_space ( const Depsgraph & depsgraph) const

◆ name()

◆ owner_id()

◆ rna_path()

StringRefNull blender::ed::AnimTransformable::rna_path ( ) const

Definition at line 347 of file transformable.cc.

Referenced by data(), and blender::ed::tests::TEST_F().

◆ rna_path_to_property() [1/2]

std::string blender::ed::AnimTransformable::rna_path_to_property ( const StringRef property_name) const

Generic function that returns an rna path to the transformable for the property with the given name. Note that the resulting string doesn't need to be a valid and existing RNA path. It is up to the caller to pass the correct string for that.

Definition at line 371 of file transformable.cc.

◆ rna_path_to_property() [2/2]

std::string blender::ed::AnimTransformable::rna_path_to_property ( PropertyType prop_type) const

◆ rna_path_to_rotation()

std::string blender::ed::AnimTransformable::rna_path_to_rotation ( eRotationModes rotation_mode) const

◆ rna_path_to_rotation_mode()

std::string blender::ed::AnimTransformable::rna_path_to_rotation_mode ( ) const

◆ set_property()

◆ set_rotation()

void blender::ed::AnimTransformable::set_rotation ( const Rotation & rotation)

Sets the rotation for the mode the transformable is currently in. If that doesn't match with the given rotation, the rotation is converted.

Definition at line 533 of file transformable.cc.

References blender::BLI_assert(), blender::Array< T, InlineBufferCapacity, Allocator >::index_range(), and blender::ed::Rotation::values.

Referenced by data(), blender::pose_slide_apply_quat(), blender::slide_subjects_reset(), blender::ed::tests::TEST_F(), and blender::ed::tests::TEST_F().

◆ set_rotation_mode()

void blender::ed::AnimTransformable::set_rotation_mode ( eRotationModes mode)

Only sets the rotation mode, does not touch the rotation properties or their animation.

Definition at line 556 of file transformable.cc.

Referenced by data().

◆ type()

Type blender::ed::AnimTransformable::type ( ) const
inline

◆ world_to_local()


The documentation for this class was generated from the following files: