42static float rna_PoseBone_do_envelope(
ID *self,
bPoseChannel *chan,
const float vec[3])
44 Bone *bone = chan->bone_get(id_cast<Object &>(*self));
51 bone->rad_head *
scale,
52 bone->rad_tail *
scale,
56static void rna_PoseBone_bbone_segment_index(
ID *self,
63 Bone *bone = pchan->bone_get(id_cast<Object &>(*self));
64 if (!bone || bone->segments <= 1) {
68 if (pchan->runtime.bbone_segments != bone->segments) {
71 "Bone '%s' has out of date B-Bone segment data - depsgraph update required!",
79static void rna_PoseBone_bbone_segment_matrix(
82 Bone *bone = pchan->bone_get(id_cast<Object &>(*self));
83 if (!bone || bone->segments <= 1) {
87 if (pchan->runtime.bbone_segments != bone->segments) {
90 "Bone '%s' has out of date B-Bone segment data - depsgraph update required!",
94 if (index < 0 || index > pchan->runtime.bbone_segments) {
96 reports,
RPT_ERROR,
"Invalid index %d for B-Bone segments of '%s'!",
index, pchan->name);
101 copy_m4_m4(
reinterpret_cast<float (*)[4]
>(mat_ret), pchan->runtime.bbone_rest_mats[
index].mat);
104 copy_m4_m4(
reinterpret_cast<float (*)[4]
>(mat_ret), pchan->runtime.bbone_pose_mats[
index].mat);
108static void rna_PoseBone_compute_bbone_handles(
ID *self,
119 Object *ob = id_cast<Object *>(self);
120 bArmature &armature = id_cast<bArmature &>(*ob->data);
122 Bone *bone = pchan->bone_get(*ob);
123 if (!bone || bone->segments <= 1) {
132 ¶ms, ret_h1, ret_roll1, ret_h2, ret_roll2, ease || offsets, offsets);
135static void rna_Pose_apply_pose_from_action(
ID *pose_owner,
138 const float evaluation_time)
141 Object *pose_owner_ob = id_cast<Object *>(pose_owner);
151static void rna_Pose_blend_pose_from_action(
ID *pose_owner,
154 const float blend_factor,
155 const float evaluation_time)
158 Object *pose_owner_ob = id_cast<Object *>(pose_owner);
168static void rna_Pose_backup_create(
ID *pose_owner,
bAction *action)
171 if (!action || action->wrap().slot_array_num == 0) {
176 Object *pose_owner_ob = id_cast<Object *>(pose_owner);
180static bool rna_Pose_backup_restore(
ID *pose_owner,
bContext *
C)
183 Object *pose_owner_ob = id_cast<Object *>(pose_owner);
197static void rna_Pose_backup_clear(
ID *pose_owner)
200 Object *pose_owner_ob = id_cast<Object *>(pose_owner);
216 func =
RNA_def_function(srna,
"apply_pose_from_action",
"rna_Pose_apply_pose_from_action");
220 "Apply the given action to this pose by evaluating it at a specific time. Only updates the "
221 "pose of selected bones, or all bones if none are selected.");
222 parm =
RNA_def_pointer(func,
"action",
"Action",
"Action",
"The Action containing the pose");
230 "Time at which the given action is evaluated to obtain the pose",
234 func =
RNA_def_function(srna,
"blend_pose_from_action",
"rna_Pose_blend_pose_from_action");
237 "Blend the given action into this pose by evaluating it at a "
238 "specific time. Only updates the "
239 "pose of selected bones, or all bones if none are selected.");
240 parm =
RNA_def_pointer(func,
"action",
"Action",
"Action",
"The Action containing the pose");
248 "How much the given Action affects the final pose",
257 "Time at which the given action is evaluated to obtain the pose",
264 "Create a backup of the current pose. Only those bones that are animated in the Action are "
265 "backed up. The object owns the backup, and each object can have only one backup at a time. "
266 "When you no longer need it, it must be freed use ``backup_clear()``.");
272 "An Action with animation data for the bones. "
273 "Only the animated bones will be included in the backup.");
280 "Restore the previously made pose backup. "
281 "This can be called multiple times. See ``Pose.backup_create()`` for more info.");
288 "``True`` when the backup was restored, ``False`` if there was no backup to restore");
293 func,
"Free a previously made pose backup. See ``Pose.backup_create()`` for more info.");
302 func =
RNA_def_function(srna,
"evaluate_envelope",
"rna_PoseBone_do_envelope");
312 "Position in 3d space to evaluate",
322 func =
RNA_def_function(srna,
"bbone_segment_index",
"rna_PoseBone_bbone_segment_index");
325 func,
"Retrieve the index and blend factor of the B-Bone segments based on vertex position");
333 "Vertex position in armature pose space",
346 func =
RNA_def_function(srna,
"bbone_segment_matrix",
"rna_PoseBone_bbone_segment_matrix");
348 func,
"Retrieve the matrix of the joint between B-Bone segments if available");
354 parm =
RNA_def_int(func,
"index", 0, 0,
INT_MAX,
"",
"Index of the segment endpoint", 0, 10000);
356 parm =
RNA_def_boolean(func,
"rest",
false,
"",
"Return the rest pose matrix");
359 func =
RNA_def_function(srna,
"compute_bbone_handles",
"rna_PoseBone_compute_bbone_handles");
361 func,
"Retrieve the vectors and rolls coming from B-Bone custom handles");
366 parm,
"",
"The direction vector of the start handle in bone local space");
378 parm =
RNA_def_boolean(func,
"rest",
false,
"",
"Return the rest pose state");
379 parm =
RNA_def_boolean(func,
"ease",
false,
"",
"Apply scale from ease values");
381 func,
"offsets",
false,
"",
"Apply roll and curve offsets from bone properties");
Functions and classes to work with Actions.
Functions to work with animation poses.
float3x3 scale(float3x3 mat, float2 scale)
void pose_apply_action(Span< Object * > objects, Action &pose_action, const AnimationEvalContext *anim_eval_context, float blend_factor)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_function_output(FunctionRNA *, PropertyRNA *ret)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_api_pose_channel(StructRNA *srna)
float distfactor_to_bone(const float3 &position, const float3 &head, const float3 &tail, float radius_head, float radius_tail, float falloff_distance)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void BKE_pchan_bbone_deform_segment_index(bke::PChanBoneConst pchanbone, const float *co, int *r_index, float *r_blend_next)
void DEG_id_tag_update(ID *id, unsigned int flags)
void RNA_api_pose(StructRNA *srna)
bool BKE_pose_backup_restore_on_object(struct Object *ob)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void BKE_pchan_bbone_spline_params_get(bke::PChanBoneConst pchanbone, const bArmature &armature, bool rest, BBoneSplineParameters *param)
void BKE_pose_backup_create_on_object(struct Object *ob, const struct bAction *action)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier_c_str, const char *call)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void BKE_pchan_bbone_handles_compute(const BBoneSplineParameters *param, float h1[3], float *r_roll1, float h2[3], float *r_roll2, bool ease, bool offsets)
void RNA_def_function_flag(FunctionRNA *func, FunctionFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
PropertyRNA * RNA_def_float_vector_xyz(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_pose_backup_clear(struct Object *ob)
ID_Type GS(const char *name)
void copy_m4_m4(float m1[4][4], const float m2[4][4])
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void RNA_def_property_array(PropertyRNA *prop, int length)
const int rna_matrix_dimsize_4x4[]