Blender V5.0
rna_pose.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10#include <cstring>
11
12#include "RNA_define.hh"
13#include "RNA_enum_types.hh"
14
15#include "rna_internal.hh"
16
17#include "DNA_action_types.h"
18#include "DNA_object_types.h"
19
20#include "BLI_math_base.h"
21
23
24#include "UI_resources.hh"
25
26#include "WM_types.hh"
27
28/* Bone and Group Color Sets */
30 {0, "DEFAULT", 0, "Default Colors", ""},
31 {1, "THEME01", ICON_COLORSET_01_VEC, "01 - Theme Color Set", ""},
32 {2, "THEME02", ICON_COLORSET_02_VEC, "02 - Theme Color Set", ""},
33 {3, "THEME03", ICON_COLORSET_03_VEC, "03 - Theme Color Set", ""},
34 {4, "THEME04", ICON_COLORSET_04_VEC, "04 - Theme Color Set", ""},
35 {5, "THEME05", ICON_COLORSET_05_VEC, "05 - Theme Color Set", ""},
36 {6, "THEME06", ICON_COLORSET_06_VEC, "06 - Theme Color Set", ""},
37 {7, "THEME07", ICON_COLORSET_07_VEC, "07 - Theme Color Set", ""},
38 {8, "THEME08", ICON_COLORSET_08_VEC, "08 - Theme Color Set", ""},
39 {9, "THEME09", ICON_COLORSET_09_VEC, "09 - Theme Color Set", ""},
40 {10, "THEME10", ICON_COLORSET_10_VEC, "10 - Theme Color Set", ""},
41 {11, "THEME11", ICON_COLORSET_11_VEC, "11 - Theme Color Set", ""},
42 {12, "THEME12", ICON_COLORSET_12_VEC, "12 - Theme Color Set", ""},
43 {13, "THEME13", ICON_COLORSET_13_VEC, "13 - Theme Color Set", ""},
44 {14, "THEME14", ICON_COLORSET_14_VEC, "14 - Theme Color Set", ""},
45 {15, "THEME15", ICON_COLORSET_15_VEC, "15 - Theme Color Set", ""},
46 {16, "THEME16", ICON_COLORSET_16_VEC, "16 - Theme Color Set", ""},
47 {17, "THEME17", ICON_COLORSET_17_VEC, "17 - Theme Color Set", ""},
48 {18, "THEME18", ICON_COLORSET_18_VEC, "18 - Theme Color Set", ""},
49 {19, "THEME19", ICON_COLORSET_19_VEC, "19 - Theme Color Set", ""},
50 {20, "THEME20", ICON_COLORSET_20_VEC, "20 - Theme Color Set", ""},
51 {-1, "CUSTOM", 0, "Custom Color Set", ""},
52 {0, nullptr, 0, nullptr, nullptr},
53};
54
55#ifdef RNA_RUNTIME
56
57# include <algorithm>
58
59# include <fmt/format.h>
60
61# include "BLI_math_vector.h"
62# include "BLI_string.h"
63# include "BLI_string_utf8.h"
64
65# include "MEM_guardedalloc.h"
66
67# include "DNA_constraint_types.h"
68
69# include "BIK_api.h"
70
71# include "BKE_action.hh"
72# include "BKE_armature.hh"
73# include "BKE_constraint.h"
74# include "BKE_context.hh"
75# include "BKE_global.hh"
76# include "BKE_lib_id.hh"
77# include "BKE_main.hh"
78# include "BKE_report.hh"
79
80# include "DEG_depsgraph.hh"
81# include "DEG_depsgraph_build.hh"
82
83# include "ED_armature.hh"
84# include "ED_object.hh"
85
86# include "WM_api.hh"
87
88# include "RNA_access.hh"
89
90static void rna_Pose_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
91{
92 // ob->pose->flag |= (POSE_LOCKED | POSE_DO_UNLOCK); /* XXX when to use this? */
93
96}
97
98static void rna_PoseBone_visibility_update(Main * /* bmain */,
99 Scene * /* scene */,
101{
104}
105
106static void rna_Pose_dependency_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
107{
109
112}
113
114static void rna_Pose_IK_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
115{
116 // ob->pose->flag |= (POSE_LOCKED | POSE_DO_UNLOCK); /* XXX: when to use this? */
117 Object *ob = (Object *)ptr->owner_id;
118
121
122 BIK_clear_data(ob->pose);
123}
124
125static std::optional<std::string> rna_Pose_path(const PointerRNA * /*ptr*/)
126{
127 return "pose";
128}
129
130static std::optional<std::string> rna_PoseBone_path(const PointerRNA *ptr)
131{
132 const bPoseChannel *pchan = static_cast<const bPoseChannel *>(ptr->data);
133 char name_esc[sizeof(pchan->name) * 2];
134
135 BLI_str_escape(name_esc, pchan->name, sizeof(name_esc));
136 return fmt::format("pose.bones[\"{}\"]", name_esc);
137}
138
139/* shared for actions groups and bone groups */
140
141static bool rna_bone_group_poll(Object *ob, ReportList *reports)
142{
143 if (ID_IS_OVERRIDE_LIBRARY(ob)) {
144 BKE_report(reports, RPT_ERROR, "Cannot edit bone groups for library overrides");
145 return false;
146 }
147
148 return true;
149}
150
152{
153 Object *ob = (Object *)ptr->owner_id;
154 if (!rna_bone_group_poll(ob, nullptr)) {
155 return;
156 }
157
158 bActionGroup *grp = static_cast<bActionGroup *>(ptr->data);
159
160 /* ensure only valid values get set */
161 if ((value >= -1) && (value < 21)) {
162 grp->customCol = value;
163
164 /* sync colors stored with theme colors based on the index specified */
165 action_group_colors_sync(grp, nullptr);
166 }
167}
168
170{
171 bActionGroup *grp = static_cast<bActionGroup *>(ptr->data);
172
173 return (grp->customCol < 0);
174}
175
176static IDProperty **rna_PoseBone_idprops(PointerRNA *ptr)
177{
178 bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
179 return &pchan->prop;
180}
181
182static IDProperty **rna_PoseBone_system_idprops(PointerRNA *ptr)
183{
184 bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
185 return &pchan->system_properties;
186}
187
188static void rna_Pose_ik_solver_set(PointerRNA *ptr, int value)
189{
190 bPose *pose = (bPose *)ptr->data;
191
192 if (pose->iksolver != value) {
193 /* the solver has changed, must clean any temporary structures */
194 BIK_clear_data(pose);
195 if (pose->ikparam) {
196 MEM_freeN(pose->ikparam);
197 pose->ikparam = nullptr;
198 }
199 pose->iksolver = value;
201 }
202}
203
204static void rna_Pose_ik_solver_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
205{
206 Object *ob = (Object *)ptr->owner_id;
207 bPose *pose = static_cast<bPose *>(ptr->data);
208
209 BKE_pose_tag_recalc(bmain, pose); /* checks & sorts pose channels */
211
213
215
217}
218
219/* rotation - axis-angle */
220static void rna_PoseChannel_rotation_axis_angle_get(PointerRNA *ptr, float *value)
221{
222 bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
223
224 /* for now, assume that rotation mode is axis-angle */
225 value[0] = pchan->rotAngle;
226 copy_v3_v3(&value[1], pchan->rotAxis);
227}
228
229/* rotation - axis-angle */
230static void rna_PoseChannel_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
231{
232 bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
233
234 /* for now, assume that rotation mode is axis-angle */
235 pchan->rotAngle = value[0];
236 copy_v3_v3(pchan->rotAxis, &value[1]);
237
238 /* TODO: validate axis? */
239}
240
241static void rna_PoseChannel_rotation_mode_set(PointerRNA *ptr, int value)
242{
243 bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
244
245 /* use API Method for conversions... */
247 pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode, short(value));
248
249 /* finally, set the new rotation type */
250 pchan->rotmode = value;
251}
252
253static float rna_PoseChannel_length_get(PointerRNA *ptr)
254{
255 bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
256 return len_v3v3(pchan->pose_head, pchan->pose_tail);
257}
258
259static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value)
260{
261 Object *ob = (Object *)ptr->owner_id;
262 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
263 char oldname[sizeof(pchan->name)], newname[sizeof(pchan->name)];
264
265 /* need to be on the stack */
266 STRNCPY_UTF8(newname, value);
267 STRNCPY(oldname, pchan->name); /* Allow non UTF8 encoding for the old name. */
268
270 BLI_assert(BKE_id_is_in_global_main(static_cast<ID *>(ob->data)));
271 ED_armature_bone_rename(G_MAIN, static_cast<bArmature *>(ob->data), oldname, newname);
272}
273
274/* See rna_Bone_update_renamed() */
275static void rna_PoseChannel_name_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
276{
277 ID *id = ptr->owner_id;
278
279 /* redraw view */
281
282 /* update animation channels */
284}
285
286static PointerRNA rna_PoseChannel_bone_get(PointerRNA *ptr)
287{
288 Object *ob = (Object *)ptr->owner_id;
289 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
290 PointerRNA tmp_ptr = *ptr;
291
292 /* Replace the id_data pointer with the Armature ID. */
293 tmp_ptr.owner_id = static_cast<ID *>(ob->data);
294
295 return RNA_pointer_create_with_parent(tmp_ptr, &RNA_Bone, pchan->bone);
296}
297
298static bool rna_PoseChannel_has_ik_get(PointerRNA *ptr)
299{
300 Object *ob = (Object *)ptr->owner_id;
301 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
302
303 return BKE_pose_channel_in_IK_chain(ob, pchan);
304}
305
306static StructRNA *rna_IKParam_refine(PointerRNA *ptr)
307{
308 bIKParam *param = (bIKParam *)ptr->data;
309
310 switch (param->iksolver) {
311 case IKSOLVER_ITASC:
312 return &RNA_Itasc;
313 default:
314 return &RNA_IKParam;
315 }
316}
317
318static PointerRNA rna_Pose_ikparam_get(PointerRNA *ptr)
319{
320 bPose *pose = (bPose *)ptr->data;
321 return RNA_pointer_create_with_parent(*ptr, &RNA_IKParam, pose->ikparam);
322}
323
324static StructRNA *rna_Pose_ikparam_typef(PointerRNA *ptr)
325{
326 bPose *pose = (bPose *)ptr->data;
327
328 switch (pose->iksolver) {
329 case IKSOLVER_ITASC:
330 return &RNA_Itasc;
331 default:
332 return &RNA_IKParam;
333 }
334}
335
336static void rna_Itasc_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
337{
338 Object *ob = (Object *)ptr->owner_id;
339 bItasc *itasc = static_cast<bItasc *>(ptr->data);
340
341 /* verify values */
342 itasc->precision = std::max(itasc->precision, 0.0001f);
343 itasc->minstep = std::max(itasc->minstep, 0.001f);
344 itasc->maxstep = std::max(itasc->maxstep, itasc->minstep);
345 itasc->feedback = std::max(itasc->feedback, 0.01f);
346 itasc->feedback = std::min(itasc->feedback, 100.0f);
347 itasc->maxvel = std::max(itasc->maxvel, 0.01f);
348 itasc->maxvel = std::min(itasc->maxvel, 100.0f);
350
352}
353
354static void rna_Itasc_update_rebuild(Main *bmain, Scene *scene, PointerRNA *ptr)
355{
356 Object *ob = (Object *)ptr->owner_id;
357 bPose *pose = ob->pose;
358
359 BKE_pose_tag_recalc(bmain, pose); /* checks & sorts pose channels */
360 rna_Itasc_update(bmain, scene, ptr);
361}
362
363static PointerRNA rna_PoseChannel_active_constraint_get(PointerRNA *ptr)
364{
365 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
366 bConstraint *con = BKE_constraints_active_get(&pchan->constraints);
367 return RNA_pointer_create_with_parent(*ptr, &RNA_Constraint, con);
368}
369
370static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr,
371 PointerRNA value,
372 ReportList * /*reports*/)
373{
374 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
375 BKE_constraints_active_set(&pchan->constraints, (bConstraint *)value.data);
376}
377
378static bConstraint *rna_PoseChannel_constraints_new(ID *id,
379 bPoseChannel *pchan,
380 Main *main,
381 int type)
382{
383 Object *ob = (Object *)id;
384 bConstraint *new_con = BKE_constraint_add_for_pose(ob, pchan, nullptr, type);
385
388
389 return new_con;
390}
391
392static void rna_PoseChannel_constraints_remove(
393 ID *id, bPoseChannel *pchan, Main *bmain, ReportList *reports, PointerRNA *con_ptr)
394{
395 bConstraint *con = static_cast<bConstraint *>(con_ptr->data);
397 Object *ob = (Object *)id;
398
399 if (BLI_findindex(&pchan->constraints, con) == -1) {
401 reports, RPT_ERROR, "Constraint '%s' not found in pose bone '%s'", con->name, pchan->name);
402 return;
403 }
404
405 BKE_constraint_remove_ex(&pchan->constraints, ob, con);
406 con_ptr->invalidate();
407
410
411 /* XXX(@ideasman42): is this really needed? */
412 BKE_constraints_active_set(&pchan->constraints, nullptr);
413
415
416 if (is_ik) {
417 BIK_clear_data(ob->pose);
418 }
419}
420
421static void rna_PoseChannel_constraints_move(
422 ID *id, bPoseChannel *pchan, Main *bmain, ReportList *reports, int from, int to)
423{
424 Object *ob = (Object *)id;
425
426 if (from == to) {
427 return;
428 }
429
430 if (!BLI_listbase_move_index(&pchan->constraints, from, to)) {
431 BKE_reportf(reports, RPT_ERROR, "Could not move constraint from index '%d' to '%d'", from, to);
432 return;
433 }
434
437}
438
439static bConstraint *rna_PoseChannel_constraints_copy(ID *id,
440 bPoseChannel *pchan,
441 Main *bmain,
442 PointerRNA *con_ptr)
443{
444 Object *ob = (Object *)id;
445 bConstraint *con = static_cast<bConstraint *>(con_ptr->data);
446 bConstraint *new_con = BKE_constraint_copy_for_pose(ob, pchan, con);
448
451
452 return new_con;
453}
454
455bool rna_PoseChannel_constraints_override_apply(Main *bmain,
457{
458 PointerRNA *ptr_dst = &rnaapply_ctx.ptr_dst;
459 PointerRNA *ptr_src = &rnaapply_ctx.ptr_src;
460 PropertyRNA *prop_dst = rnaapply_ctx.prop_dst;
462
464 "Unsupported RNA override operation on constraints collection");
465
466 bPoseChannel *pchan_dst = (bPoseChannel *)ptr_dst->data;
467 bPoseChannel *pchan_src = (bPoseChannel *)ptr_src->data;
468
469 /* Remember that insertion operations are defined and stored in correct order, which means that
470 * even if we insert several items in a row, we always insert first one, then second one, etc.
471 * So we should always find 'anchor' constraint in both _src *and* _dst */
472 const size_t name_offset = offsetof(bConstraint, name);
473 bConstraint *con_anchor = static_cast<bConstraint *>(
474 BLI_listbase_string_or_index_find(&pchan_dst->constraints,
475 opop->subitem_reference_name,
476 name_offset,
477 opop->subitem_reference_index));
478 /* If `con_anchor` is nullptr, `con_src` will be inserted in first position. */
479
481 &pchan_src->constraints, opop->subitem_local_name, name_offset, opop->subitem_local_index));
482
483 if (con_src == nullptr) {
484 BLI_assert(con_src != nullptr);
485 return false;
486 }
487
488 bConstraint *con_dst = BKE_constraint_duplicate_ex(con_src, 0, true);
489
490 /* This handles nullptr anchor as expected by adding at head of list. */
491 BLI_insertlinkafter(&pchan_dst->constraints, con_anchor, con_dst);
492
493 /* This should actually *not* be needed in typical cases.
494 * However, if overridden source was edited,
495 * we *may* have some new conflicting names. */
496 BKE_constraint_unique_name(con_dst, &pchan_dst->constraints);
497
498 // printf("%s: We inserted a constraint...\n", __func__);
499 RNA_property_update_main(bmain, nullptr, ptr_dst, prop_dst);
500 return true;
501}
502
503static int rna_PoseChannel_proxy_editable(const PointerRNA * /*ptr*/, const char ** /*r_info*/)
504{
505# if 0
506 Object *ob = (Object *)ptr->owner_id;
507 bArmature *arm = ob->data;
508 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
509
510 if (pchan->bone && (pchan->bone->layer & arm->layer_protected)) {
511 *r_info = "Can't edit property of a proxy on a protected layer";
512 return 0;
513 }
514# endif
515
516 return PROP_EDITABLE;
517}
518
519static int rna_PoseChannel_location_editable(const PointerRNA *ptr, int index)
520{
521 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
522
523 /* only if the axis in question is locked, not editable... */
524 if ((index == 0) && (pchan->protectflag & OB_LOCK_LOCX)) {
525 return 0;
526 }
527 if ((index == 1) && (pchan->protectflag & OB_LOCK_LOCY)) {
528 return 0;
529 }
530 if ((index == 2) && (pchan->protectflag & OB_LOCK_LOCZ)) {
531 return 0;
532 }
533 return PROP_EDITABLE;
534}
535
536static int rna_PoseChannel_scale_editable(const PointerRNA *ptr, int index)
537{
538 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
539
540 /* only if the axis in question is locked, not editable... */
541 if ((index == 0) && (pchan->protectflag & OB_LOCK_SCALEX)) {
542 return 0;
543 }
544 if ((index == 1) && (pchan->protectflag & OB_LOCK_SCALEY)) {
545 return 0;
546 }
547 if ((index == 2) && (pchan->protectflag & OB_LOCK_SCALEZ)) {
548 return 0;
549 }
550 return PROP_EDITABLE;
551}
552
553static int rna_PoseChannel_rotation_euler_editable(const PointerRNA *ptr, int index)
554{
555 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
556
557 /* only if the axis in question is locked, not editable... */
558 if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTX)) {
559 return 0;
560 }
561 if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTY)) {
562 return 0;
563 }
564 if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTZ)) {
565 return 0;
566 }
567 return PROP_EDITABLE;
568}
569
570static int rna_PoseChannel_rotation_4d_editable(const PointerRNA *ptr, int index)
571{
572 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
573
574 /* only consider locks if locking components individually... */
575 if (pchan->protectflag & OB_LOCK_ROT4D) {
576 /* only if the axis in question is locked, not editable... */
577 if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTW)) {
578 return 0;
579 }
580 if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTX)) {
581 return 0;
582 }
583 if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTY)) {
584 return 0;
585 }
586 if ((index == 3) && (pchan->protectflag & OB_LOCK_ROTZ)) {
587 return 0;
588 }
589 }
590
591 return PROP_EDITABLE;
592}
593
594/* not essential, but much faster than the default lookup function */
595static bool rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
596{
597 bPose *pose = (bPose *)ptr->data;
598 bPoseChannel *pchan = BKE_pose_channel_find_name(pose, key);
599 if (pchan) {
600 rna_pointer_create_with_ancestors(*ptr, &RNA_PoseBone, pchan, *r_ptr);
601 return true;
602 }
603 return false;
604}
605
606static void rna_PoseChannel_matrix_basis_get(PointerRNA *ptr, float *values)
607{
608 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
609 BKE_pchan_to_mat4(pchan, (float (*)[4])values);
610}
611
612static void rna_PoseChannel_matrix_basis_set(PointerRNA *ptr, const float *values)
613{
614 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
615 /* No compatibility for predictable result. */
616 BKE_pchan_apply_mat4(pchan, (const float (*)[4])values, false);
617}
618
619static void rna_PoseChannel_matrix_set(PointerRNA *ptr, const float *values)
620{
621 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
622 Object *ob = (Object *)ptr->owner_id;
623 float tmat[4][4];
624
625 BKE_armature_mat_pose_to_bone_ex(nullptr, ob, pchan, (const float (*)[4])values, tmat);
626
627 /* No compatibility for predictable result. */
628 BKE_pchan_apply_mat4(pchan, tmat, false);
629}
630
631static bPoseChannel *rna_PoseChannel_ensure_own_pchan(Object *ob,
632 Object *ref_ob,
633 bPoseChannel *ref_pchan)
634{
635 if (ref_ob != ob) {
636 /* We are trying to set a pchan from another object! Forbidden,
637 * try to find by name, or abort. */
638 if (ref_pchan != nullptr) {
639 ref_pchan = BKE_pose_channel_find_name(ob->pose, ref_pchan->name);
640 }
641 }
642 return ref_pchan;
643}
644
645static void rna_PoseChannel_custom_shape_transform_set(PointerRNA *ptr,
646 PointerRNA value,
647 ReportList * /*reports*/)
648{
649 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
650 Object *ob = (Object *)ptr->owner_id;
651
652 pchan->custom_tx = rna_PoseChannel_ensure_own_pchan(
653 ob, (Object *)value.owner_id, static_cast<bPoseChannel *>(value.data));
654}
655
656void rna_Pose_custom_shape_set(PointerRNA *ptr, PointerRNA value, struct ReportList *reports)
657{
658 bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
659 Object *custom_shape = static_cast<Object *>(value.data);
660
661 if (!custom_shape) {
662 id_us_min(reinterpret_cast<ID *>(pchan->custom));
663 pchan->custom = nullptr;
664 return;
665 }
666
667 /* This should be ensured by the RNA property type. */
668 BLI_assert(GS(custom_shape->id.name) == ID_OB);
669
670 if (custom_shape->type == OB_ARMATURE) {
671 BKE_report(reports, RPT_ERROR, "Cannot use armature object as custom bone shape");
672 return;
673 }
674
675 id_us_min(reinterpret_cast<ID *>(pchan->custom));
676 pchan->custom = custom_shape;
677 id_us_plus(reinterpret_cast<ID *>(pchan->custom));
678}
679
680bool rna_Pose_custom_shape_object_poll(PointerRNA * /*ptr*/, PointerRNA value)
681{
682 return (reinterpret_cast<Object *>(value.owner_id))->type != OB_ARMATURE;
683}
684
685static void rna_Pose_select_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
686{
687 ID *id = ptr->owner_id;
688
689 if (!id) {
690 /* There shouldn't be a pose bone without an object. */
692 return;
693 }
694 BLI_assert(GS(id->name) == ID_OB);
695 Object *ob = (Object *)id;
696 bArmature *arm = (bArmature *)ob->data;
697
698 if (arm->flag & ARM_HAS_VIZ_DEPS) {
700 }
701
703
706}
707
708#else
709
710void rna_def_actionbone_group_common(StructRNA *srna, int update_flag, const char *update_cb)
711{
712 PropertyRNA *prop;
713
714 /* color set + colors */
715 prop = RNA_def_property(srna, "color_set", PROP_ENUM, PROP_NONE);
716 RNA_def_property_enum_sdna(prop, nullptr, "customCol");
718 RNA_def_property_enum_funcs(prop, nullptr, "rna_ActionGroup_colorset_set", nullptr);
719 RNA_def_property_ui_text(prop, "Color Set", "Custom color set to use");
720 RNA_def_property_update(prop, update_flag, update_cb);
721
722 prop = RNA_def_property(srna, "is_custom_color_set", PROP_BOOLEAN, PROP_NONE);
723 RNA_def_property_boolean_funcs(prop, "rna_ActionGroup_is_custom_colorset_get", nullptr);
726 prop, "Custom Color Set", "Color set is user-defined instead of a fixed theme color set");
727
728 /* TODO: editing the colors for this should result in changes to the color type... */
729 prop = RNA_def_property(srna, "colors", PROP_POINTER, PROP_NONE);
731 RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
732 /* NOTE: the DNA data is not really a pointer, but this code works :) */
733 RNA_def_property_pointer_sdna(prop, nullptr, "cs");
735 prop, "Colors", "Copy of the colors associated with the group's color set");
736 RNA_def_property_update(prop, update_flag, update_cb);
737}
738
740 {IKSOLVER_STANDARD, "LEGACY", 0, "Standard", "Original IK solver"},
741 {IKSOLVER_ITASC, "ITASC", 0, "iTaSC", "Multi constraint, stateful IK solver"},
742 {0, nullptr, 0, nullptr, nullptr},
743};
744
746 {ITASC_SOLVER_SDLS, "SDLS", 0, "SDLS", "Selective Damped Least Square"},
747 {ITASC_SOLVER_DLS, "DLS", 0, "DLS", "Damped Least Square with Numerical Filtering"},
748 {0, nullptr, 0, nullptr, nullptr},
749};
750
752{
753 StructRNA *srna;
754 PropertyRNA *prop;
755
756 FunctionRNA *func;
757 PropertyRNA *parm;
758
759 RNA_def_property_srna(cprop, "PoseBoneConstraints");
760 srna = RNA_def_struct(brna, "PoseBoneConstraints", nullptr);
761 RNA_def_struct_sdna(srna, "bPoseChannel");
762 RNA_def_struct_ui_text(srna, "PoseBone Constraints", "Collection of pose bone constraints");
763
764 /* Collection active property */
765 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
766 RNA_def_property_struct_type(prop, "Constraint");
768 "rna_PoseChannel_active_constraint_get",
769 "rna_PoseChannel_active_constraint_set",
770 nullptr,
771 nullptr);
773 RNA_def_property_ui_text(prop, "Active Constraint", "Active PoseChannel constraint");
774
775 /* Constraint collection */
776 func = RNA_def_function(srna, "new", "rna_PoseChannel_constraints_new");
777 RNA_def_function_ui_description(func, "Add a constraint to this object");
779 FUNC_USE_MAIN | FUNC_USE_SELF_ID); /* ID and Main needed for refresh */
780 /* return type */
781 parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
782 RNA_def_function_return(func, parm);
783 /* constraint to add */
784 parm = RNA_def_enum(
785 func, "type", rna_enum_constraint_type_items, 1, "", "Constraint type to add");
787
788 func = RNA_def_function(srna, "remove", "rna_PoseChannel_constraints_remove");
789 RNA_def_function_ui_description(func, "Remove a constraint from this object");
791 func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); /* ID needed for refresh */
792 /* constraint to remove */
793 parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
796
797 func = RNA_def_function(srna, "move", "rna_PoseChannel_constraints_move");
798 RNA_def_function_ui_description(func, "Move a constraint to a different position");
800 parm = RNA_def_int(
801 func, "from_index", -1, INT_MIN, INT_MAX, "From Index", "Index to move", 0, 10000);
803 parm = RNA_def_int(func, "to_index", -1, INT_MIN, INT_MAX, "To Index", "Target index", 0, 10000);
805
806 func = RNA_def_function(srna, "copy", "rna_PoseChannel_constraints_copy");
807 RNA_def_function_ui_description(func, "Add a new constraint that is a copy of the given one");
809 /* constraint to copy */
810 parm = RNA_def_pointer(func,
811 "constraint",
812 "Constraint",
813 "",
814 "Constraint to copy - may belong to a different object");
817 /* return type */
818 parm = RNA_def_pointer(func, "new_constraint", "Constraint", "", "New constraint");
819 RNA_def_function_return(func, parm);
820}
821
823{
824 StructRNA *srna;
825 PropertyRNA *prop;
826
827 srna = RNA_def_struct(brna, "PoseBone", nullptr);
828 RNA_def_struct_sdna(srna, "bPoseChannel");
829 RNA_def_struct_ui_text(srna, "Pose Bone", "Channel defining pose data for a bone in a Pose");
830 RNA_def_struct_path_func(srna, "rna_PoseBone_path");
831 RNA_def_struct_idprops_func(srna, "rna_PoseBone_idprops");
832 RNA_def_struct_system_idprops_func(srna, "rna_PoseBone_system_idprops");
833 RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
834
835 /* Bone Constraints */
836 prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
837 RNA_def_property_struct_type(prop, "Constraint");
840 RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this pose channel");
842 prop, nullptr, nullptr, "rna_PoseChannel_constraints_override_apply");
843
845
846 /* Name + Selection Status */
847 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
848 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_PoseChannel_name_set");
849 RNA_def_property_ui_text(prop, "Name", "");
850 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
852 RNA_def_property_update(prop, 0, "rna_PoseChannel_name_update");
853
854 /* Baked Bone Path cache data */
856
857 /* Relationships to other bones */
858 prop = RNA_def_property(srna, "bone", PROP_POINTER, PROP_NONE);
860 RNA_def_property_struct_type(prop, "Bone");
861 RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_bone_get", nullptr, nullptr, nullptr);
864 RNA_def_property_ui_text(prop, "Bone", "Bone associated with this PoseBone");
865
866 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
867 RNA_def_property_struct_type(prop, "PoseBone");
870 RNA_def_property_ui_text(prop, "Parent", "Parent of this pose bone");
871
872 prop = RNA_def_property(srna, "child", PROP_POINTER, PROP_NONE);
873 RNA_def_property_struct_type(prop, "PoseBone");
876 RNA_def_property_ui_text(prop, "Child", "Child of this pose bone");
877
878 /* Transformation settings */
879 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
880 RNA_def_property_float_sdna(prop, nullptr, "loc");
882 RNA_def_property_editable_array_func(prop, "rna_PoseChannel_location_editable");
883 RNA_def_property_ui_text(prop, "Location", "");
885 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
886
887 prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
890 RNA_def_property_editable_array_func(prop, "rna_PoseChannel_scale_editable");
892 RNA_def_property_ui_text(prop, "Scale", "");
893 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
894
895 prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
896 RNA_def_property_float_sdna(prop, nullptr, "quat");
898 RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
900 RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
901 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
902
903 /* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
904 * having a single one is better for Keyframing and other property-management situations...
905 */
906 prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
908 RNA_def_property_array(prop, 4);
910 "rna_PoseChannel_rotation_axis_angle_get",
911 "rna_PoseChannel_rotation_axis_angle_set",
912 nullptr);
913 RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
916 prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
917 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
918
919 prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
920 RNA_def_property_float_sdna(prop, nullptr, "eul");
922 RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_euler_editable");
923 RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
925 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
926
927 prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
928 RNA_def_property_enum_sdna(prop, nullptr, "rotmode");
931 RNA_def_property_enum_funcs(prop, nullptr, "rna_PoseChannel_rotation_mode_set", nullptr);
932 /* XXX... disabled, since proxy-locked layers are currently
933 * used for ensuring proxy-syncing too */
934 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
936 prop,
937 "Rotation Mode",
938 /* This description is shared by other "rotation_mode" properties. */
939 "The kind of rotation to apply, values from other rotation modes are not used");
940 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
941
942 /* Curved bones settings - Applied on top of rest-pose values. */
943 rna_def_bone_curved_common(srna, true, false);
944
945 /* Custom BBone next/prev sources */
946 prop = RNA_def_property(srna, "bbone_custom_handle_start", PROP_POINTER, PROP_NONE);
947 RNA_def_property_pointer_sdna(prop, nullptr, "bbone_prev");
948 RNA_def_property_struct_type(prop, "PoseBone");
952 prop, "B-Bone Start Handle", "Bone that serves as the start handle for the B-Bone curve");
953 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
954
955 prop = RNA_def_property(srna, "bbone_custom_handle_end", PROP_POINTER, PROP_NONE);
956 RNA_def_property_pointer_sdna(prop, nullptr, "bbone_next");
957 RNA_def_property_struct_type(prop, "PoseBone");
961 prop, "B-Bone End Handle", "Bone that serves as the end handle for the B-Bone curve");
962 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
963
964 /* transform matrices - should be read-only since these are set directly by AnimSys evaluation */
965 prop = RNA_def_property(srna, "matrix_channel", PROP_FLOAT, PROP_MATRIX);
966 RNA_def_property_float_sdna(prop, nullptr, "chan_mat");
970 "Channel Matrix",
972 "4 matrix of the bone's location/rotation/scale channels (including "
973 "animation and drivers) and the effect of bone constraints");
974
975 /* writable because it touches loc/scale/rot directly */
976 prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
979 prop,
980 "Basis Matrix",
981 "Alternative access to location/scale/rotation relative to the parent and own rest bone");
983 prop, "rna_PoseChannel_matrix_basis_get", "rna_PoseChannel_matrix_basis_set", nullptr);
985 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
986
987 /* final matrix */
988 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
989 RNA_def_property_float_sdna(prop, nullptr, "pose_mat");
991 RNA_def_property_float_funcs(prop, nullptr, "rna_PoseChannel_matrix_set", nullptr);
993 "Pose Matrix",
995 "4 matrix after constraints and drivers are applied, in "
996 "the armature object space");
997 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
998
999 /* Head/Tail Coordinates (in Pose Space) - Automatically calculated... */
1000 prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
1001 RNA_def_property_float_sdna(prop, nullptr, "pose_head");
1003 RNA_def_property_ui_text(prop, "Pose Head Position", "Location of head of the channel's bone");
1005
1006 prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
1007 RNA_def_property_float_sdna(prop, nullptr, "pose_tail");
1009 RNA_def_property_ui_text(prop, "Pose Tail Position", "Location of tail of the channel's bone");
1011
1012 prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_DISTANCE);
1013 RNA_def_property_float_funcs(prop, "rna_PoseChannel_length_get", nullptr, nullptr);
1015 RNA_def_property_ui_text(prop, "Length", "Length of the bone");
1016
1017 /* IK Settings */
1018 prop = RNA_def_property(srna, "is_in_ik_chain", PROP_BOOLEAN, PROP_NONE);
1019 RNA_def_property_boolean_funcs(prop, "rna_PoseChannel_has_ik_get", nullptr);
1022 RNA_def_property_ui_text(prop, "Has IK", "Is part of an IK chain");
1023 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1024
1025 prop = RNA_def_property(srna, "lock_ik_x", PROP_BOOLEAN, PROP_NONE);
1026 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_NO_XDOF);
1027 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
1028 RNA_def_property_ui_text(prop, "IK X Lock", "Disallow movement around the X axis");
1029 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1030 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1031
1032 prop = RNA_def_property(srna, "lock_ik_y", PROP_BOOLEAN, PROP_NONE);
1033 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_NO_YDOF);
1034 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
1035 RNA_def_property_ui_text(prop, "IK Y Lock", "Disallow movement around the Y axis");
1036 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1037 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1038
1039 prop = RNA_def_property(srna, "lock_ik_z", PROP_BOOLEAN, PROP_NONE);
1040 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_NO_ZDOF);
1041 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
1042 RNA_def_property_ui_text(prop, "IK Z Lock", "Disallow movement around the Z axis");
1043 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1044 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1045
1046 prop = RNA_def_property(srna, "use_ik_limit_x", PROP_BOOLEAN, PROP_NONE);
1047 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_XLIMIT);
1048 RNA_def_property_ui_text(prop, "IK X Limit", "Limit movement around the X axis");
1049 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1050 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1051
1052 prop = RNA_def_property(srna, "use_ik_limit_y", PROP_BOOLEAN, PROP_NONE);
1053 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_YLIMIT);
1054 RNA_def_property_ui_text(prop, "IK Y Limit", "Limit movement around the Y axis");
1055 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1056 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1057
1058 prop = RNA_def_property(srna, "use_ik_limit_z", PROP_BOOLEAN, PROP_NONE);
1059 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_ZLIMIT);
1060 RNA_def_property_ui_text(prop, "IK Z Limit", "Limit movement around the Z axis");
1061 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1062 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1063
1064 prop = RNA_def_property(srna, "use_ik_rotation_control", PROP_BOOLEAN, PROP_NONE);
1065 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_ROTCTL);
1066 RNA_def_property_ui_text(prop, "IK Rotation Control", "Apply channel rotation as IK constraint");
1067 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1068 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1069
1070 prop = RNA_def_property(srna, "use_ik_linear_control", PROP_BOOLEAN, PROP_NONE);
1071 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_LINCTL);
1073 prop, "IK Linear Control", "Apply channel size as IK constraint if stretching is enabled");
1074 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1075 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1076
1077 prop = RNA_def_property(srna, "ik_min_x", PROP_FLOAT, PROP_ANGLE);
1078 RNA_def_property_float_sdna(prop, nullptr, "limitmin[0]");
1079 RNA_def_property_range(prop, -M_PI, 0.0f);
1080 RNA_def_property_ui_text(prop, "IK X Minimum", "Minimum angles for IK Limit");
1081 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1082 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1083
1084 prop = RNA_def_property(srna, "ik_max_x", PROP_FLOAT, PROP_ANGLE);
1085 RNA_def_property_float_sdna(prop, nullptr, "limitmax[0]");
1086 RNA_def_property_range(prop, 0.0f, M_PI);
1087 RNA_def_property_ui_text(prop, "IK X Maximum", "Maximum angles for IK Limit");
1088 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1089 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1090
1091 prop = RNA_def_property(srna, "ik_min_y", PROP_FLOAT, PROP_ANGLE);
1092 RNA_def_property_float_sdna(prop, nullptr, "limitmin[1]");
1093 RNA_def_property_range(prop, -M_PI, 0.0f);
1094 RNA_def_property_ui_text(prop, "IK Y Minimum", "Minimum angles for IK Limit");
1095 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1096 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1097
1098 prop = RNA_def_property(srna, "ik_max_y", PROP_FLOAT, PROP_ANGLE);
1099 RNA_def_property_float_sdna(prop, nullptr, "limitmax[1]");
1100 RNA_def_property_range(prop, 0.0f, M_PI);
1101 RNA_def_property_ui_text(prop, "IK Y Maximum", "Maximum angles for IK Limit");
1102 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1103 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1104
1105 prop = RNA_def_property(srna, "ik_min_z", PROP_FLOAT, PROP_ANGLE);
1106 RNA_def_property_float_sdna(prop, nullptr, "limitmin[2]");
1107 RNA_def_property_range(prop, -M_PI, 0.0f);
1108 RNA_def_property_ui_text(prop, "IK Z Minimum", "Minimum angles for IK Limit");
1109 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1110 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1111
1112 prop = RNA_def_property(srna, "ik_max_z", PROP_FLOAT, PROP_ANGLE);
1113 RNA_def_property_float_sdna(prop, nullptr, "limitmax[2]");
1114 RNA_def_property_range(prop, 0.0f, M_PI);
1115 RNA_def_property_ui_text(prop, "IK Z Maximum", "Maximum angles for IK Limit");
1116 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1117 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1118
1119 prop = RNA_def_property(srna, "ik_stiffness_x", PROP_FLOAT, PROP_NONE);
1120 RNA_def_property_float_sdna(prop, nullptr, "stiffness[0]");
1121 RNA_def_property_range(prop, 0.0f, 0.99f);
1122 RNA_def_property_ui_text(prop, "IK X Stiffness", "IK stiffness around the X axis");
1123 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1124 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1125
1126 prop = RNA_def_property(srna, "ik_stiffness_y", PROP_FLOAT, PROP_NONE);
1127 RNA_def_property_float_sdna(prop, nullptr, "stiffness[1]");
1128 RNA_def_property_range(prop, 0.0f, 0.99f);
1129 RNA_def_property_ui_text(prop, "IK Y Stiffness", "IK stiffness around the Y axis");
1130 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1131 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1132
1133 prop = RNA_def_property(srna, "ik_stiffness_z", PROP_FLOAT, PROP_NONE);
1134 RNA_def_property_float_sdna(prop, nullptr, "stiffness[2]");
1135 RNA_def_property_range(prop, 0.0f, 0.99f);
1136 RNA_def_property_ui_text(prop, "IK Z Stiffness", "IK stiffness around the Z axis");
1137 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1138 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1139
1140 prop = RNA_def_property(srna, "ik_stretch", PROP_FLOAT, PROP_FACTOR);
1141 RNA_def_property_float_sdna(prop, nullptr, "ikstretch");
1142 RNA_def_property_range(prop, 0.0f, 1.0f);
1143 RNA_def_property_ui_text(prop, "IK Stretch", "Allow scaling of the bone for IK");
1144 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1145 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1146
1147 prop = RNA_def_property(srna, "ik_rotation_weight", PROP_FLOAT, PROP_FACTOR);
1148 RNA_def_property_float_sdna(prop, nullptr, "ikrotweight");
1149 RNA_def_property_range(prop, 0.0f, 1.0f);
1150 RNA_def_property_ui_text(prop, "IK Rotation Weight", "Weight of rotation constraint for IK");
1151 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1152 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1153
1154 prop = RNA_def_property(srna, "ik_linear_weight", PROP_FLOAT, PROP_FACTOR);
1155 RNA_def_property_float_sdna(prop, nullptr, "iklinweight");
1156 RNA_def_property_range(prop, 0.0f, 1.0f);
1157 RNA_def_property_ui_text(prop, "IK Lin Weight", "Weight of scale constraint for IK");
1158 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1159 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1160
1161 /* custom bone shapes */
1162 prop = RNA_def_property(srna, "custom_shape", PROP_POINTER, PROP_NONE);
1163 RNA_def_property_pointer_sdna(prop, nullptr, "custom");
1164 RNA_def_property_struct_type(prop, "Object");
1168 prop, "Custom Object", "Object that defines custom display shape for this bone");
1169 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1171 prop, nullptr, "rna_Pose_custom_shape_set", nullptr, "rna_Pose_custom_shape_object_poll");
1172 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
1173
1174 prop = RNA_def_property(srna, "custom_shape_scale_xyz", PROP_FLOAT, PROP_XYZ);
1175 RNA_def_property_float_sdna(prop, nullptr, "custom_scale_xyz");
1178 RNA_def_property_ui_text(prop, "Custom Shape Scale", "Adjust the size of the custom shape");
1179 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1180
1181 prop = RNA_def_property(srna, "custom_shape_translation", PROP_FLOAT, PROP_XYZ);
1182 RNA_def_property_float_sdna(prop, nullptr, "custom_translation");
1185 prop, "Custom Shape Translation", "Adjust the location of the custom shape");
1187 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1188
1189 prop = RNA_def_property(srna, "custom_shape_rotation_euler", PROP_FLOAT, PROP_EULER);
1190 RNA_def_property_float_sdna(prop, nullptr, "custom_rotation_euler");
1192 prop, "Custom Shape Rotation", "Adjust the rotation of the custom shape");
1194 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1195
1196 prop = RNA_def_property(srna, "use_transform_at_custom_shape", PROP_BOOLEAN, PROP_NONE);
1199 prop,
1200 "Affect Gizmo",
1201 "The location and orientation of the Custom Shape Transform bone will be used for transform "
1202 "gizmos and for other transform operators in the 3D Viewport. When disabled, the 3D "
1203 "Viewport will still use the actual bone transform for these, even when the custom bone "
1204 "shape transform is overridden.");
1205 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1206
1207 prop = RNA_def_property(srna, "use_transform_around_custom_shape", PROP_BOOLEAN, PROP_NONE);
1210 prop,
1211 "Use As Pivot",
1212 "Transform the bone as if it was a child of the Custom Shape Transform bone. This can be "
1213 "useful when combining shape-key and armature deformations.");
1214 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1215
1216 prop = RNA_def_property(srna, "use_custom_shape_bone_size", PROP_BOOLEAN, PROP_NONE);
1218 prop, nullptr, "drawflag", PCHAN_DRAW_NO_CUSTOM_BONE_SIZE);
1220 prop, "Scale to Bone Length", "Scale the custom object by the bone length");
1221 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1222
1223 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
1225 RNA_def_property_boolean_sdna(prop, nullptr, "drawflag", PCHAN_DRAW_HIDDEN);
1226 RNA_def_property_ui_text(prop, "Hide", "Bone is not visible except for Edit Mode");
1227 RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
1228 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_PoseBone_visibility_update");
1229
1230 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1232 RNA_def_property_boolean_sdna(prop, nullptr, "flag", POSE_SELECTED);
1233 RNA_def_property_ui_text(prop, "Select", "Bone is selected in Pose Mode");
1234 RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
1236 RNA_def_property_update(prop, 0, "rna_Pose_select_update");
1237
1238 prop = RNA_def_property(srna, "custom_shape_transform", PROP_POINTER, PROP_NONE);
1239 RNA_def_property_pointer_sdna(prop, nullptr, "custom_tx");
1240 RNA_def_property_struct_type(prop, "PoseBone");
1244 "Custom Shape Transform",
1245 "Bone that defines the display transform of this custom shape");
1246 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1248 prop, nullptr, "rna_PoseChannel_custom_shape_transform_set", nullptr, nullptr);
1249 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1250
1251 prop = RNA_def_property(srna, "custom_shape_wire_width", PROP_FLOAT, PROP_NONE);
1252 RNA_def_property_float_sdna(prop, nullptr, "custom_shape_wire_width");
1253 RNA_def_property_ui_text(prop, "Wire Width", "Adjust the line thickness of custom shapes");
1254 /* When changing the upper limit of the range, also adjust the WIRE_WIDTH_COMPRESSION in
1255 * overlay_shader_shared.hh */
1256 RNA_def_property_range(prop, 1.0f, 16.0f);
1257 RNA_def_property_ui_range(prop, 1.0f, 10.0f, 1, 1);
1258 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1259
1260 prop = RNA_def_property(srna, "color", PROP_POINTER, PROP_NONE);
1261 RNA_def_property_struct_type(prop, "BoneColor");
1264
1265 /* transform locks */
1266 prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
1267 RNA_def_property_boolean_bitset_array_sdna(prop, nullptr, "protectflag", OB_LOCK_LOCX, 3);
1268 RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location when transforming");
1269 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1271 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1272 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1273
1274 prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
1275 RNA_def_property_boolean_bitset_array_sdna(prop, nullptr, "protectflag", OB_LOCK_ROTX, 3);
1276 RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation when transforming");
1277 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1279 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1280 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1281
1282 /* XXX this is sub-optimal - it really should be included above, but due to technical reasons
1283 * we can't do this! */
1284 prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
1285 RNA_def_property_boolean_sdna(prop, nullptr, "protectflag", OB_LOCK_ROTW);
1287 prop,
1288 "Lock Rotation (4D Angle)",
1289 "Lock editing of 'angle' component of four-component rotations when transforming");
1290 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1292 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1293 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1294
1295 /* XXX this needs a better name */
1296 prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
1297 RNA_def_property_boolean_sdna(prop, nullptr, "protectflag", OB_LOCK_ROT4D);
1299 prop,
1300 "Lock Rotations (4D)",
1301 "Lock editing of four component rotations by components (instead of as Eulers)");
1303 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1304 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1305
1306 prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
1307 RNA_def_property_boolean_bitset_array_sdna(prop, nullptr, "protectflag", OB_LOCK_SCALEX, 3);
1308 RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale when transforming");
1309 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1311 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1312 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1313
1315}
1316
1318{
1319 static const EnumPropertyItem prop_itasc_mode_items[] = {
1320 {0,
1321 "ANIMATION",
1322 0,
1323 "Animation",
1324 "Stateless solver computing pose starting from current action and non-IK constraints"},
1326 "SIMULATION",
1327 0,
1328 "Simulation",
1329 "State-full solver running in real-time context and ignoring actions "
1330 "and non-IK constraints"},
1331 {0, nullptr, 0, nullptr, nullptr},
1332 };
1333 static const EnumPropertyItem prop_itasc_reiteration_items[] = {
1334 {0,
1335 "NEVER",
1336 0,
1337 "Never",
1338 "The solver does not reiterate, not even on first frame (starts from rest pose)"},
1340 "INITIAL",
1341 0,
1342 "Initial",
1343 "The solver reiterates (converges) on the first frame but not on "
1344 "subsequent frame"},
1346 "ALWAYS",
1347 0,
1348 "Always",
1349 "The solver reiterates (converges) on all frames"},
1350 {0, nullptr, 0, nullptr, nullptr},
1351 };
1352
1353 StructRNA *srna;
1354 PropertyRNA *prop;
1355
1356 srna = RNA_def_struct(brna, "Itasc", "IKParam");
1357 RNA_def_struct_sdna(srna, "bItasc");
1358 RNA_def_struct_ui_text(srna, "bItasc", "Parameters for the iTaSC IK solver");
1359
1360 prop = RNA_def_property(srna, "precision", PROP_FLOAT, PROP_NONE);
1361 RNA_def_property_float_sdna(prop, nullptr, "precision");
1362 RNA_def_property_range(prop, 0.0f, 0.1f);
1363 RNA_def_property_ui_text(prop, "Precision", "Precision of convergence in case of reiteration");
1364 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1365
1366 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
1367 RNA_def_property_int_sdna(prop, nullptr, "numiter");
1368 RNA_def_property_range(prop, 0, 1000);
1370 prop, "Iterations", "Maximum number of iterations for convergence in case of reiteration");
1371 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1372
1373 prop = RNA_def_property(srna, "step_count", PROP_INT, PROP_NONE);
1374 RNA_def_property_int_sdna(prop, nullptr, "numstep");
1375 RNA_def_property_range(prop, 1.0f, 50.0f);
1376 RNA_def_property_ui_text(prop, "Num Steps", "Divide the frame interval into this many steps");
1377 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1378
1379 prop = RNA_def_property(srna, "translate_root_bones", PROP_BOOLEAN, PROP_NONE);
1382 prop, "Translate Roots", "Translate root (i.e. parentless) bones to the armature origin");
1383 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1384
1385 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1386 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1387 RNA_def_property_enum_items(prop, prop_itasc_mode_items);
1388 RNA_def_property_ui_text(prop, "Mode", nullptr);
1389 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update_rebuild");
1390
1391 prop = RNA_def_property(srna, "reiteration_method", PROP_ENUM, PROP_NONE);
1392 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1393 RNA_def_property_enum_items(prop, prop_itasc_reiteration_items);
1395 "Reiteration",
1396 "Defines if the solver is allowed to reiterate (converge until "
1397 "precision is met) on none, first or all frames");
1398 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1399
1400 prop = RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
1401 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ITASC_AUTO_STEP);
1403 "Auto Step",
1404 "Automatically determine the optimal number of steps for best "
1405 "performance/accuracy trade off");
1406 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1407
1408 prop = RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_FACTOR);
1409 RNA_def_property_float_sdna(prop, nullptr, "minstep");
1410 RNA_def_property_range(prop, 0.0f, 0.1f);
1412 prop, "Min Step", "Lower bound for timestep in second in case of automatic substeps");
1413 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1414
1415 prop = RNA_def_property(srna, "step_max", PROP_FLOAT, PROP_FACTOR);
1416 RNA_def_property_float_sdna(prop, nullptr, "maxstep");
1417 RNA_def_property_range(prop, 0.0f, 1.0f);
1419 prop, "Max Step", "Higher bound for timestep in second in case of automatic substeps");
1420 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1421
1422 prop = RNA_def_property(srna, "feedback", PROP_FLOAT, PROP_NONE);
1423 RNA_def_property_float_sdna(prop, nullptr, "feedback");
1424 RNA_def_property_range(prop, 0.0f, 100.0f);
1426 prop,
1427 "Feedback",
1428 "Feedback coefficient for error correction, average response time is 1/feedback");
1429 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1430
1431 prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
1432 RNA_def_property_float_sdna(prop, nullptr, "maxvel");
1433 RNA_def_property_range(prop, 0.0f, 100.0f);
1434 RNA_def_property_ui_text(prop, "Max Velocity", "Maximum joint velocity in radians/second");
1435 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1436
1437 prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
1438 RNA_def_property_enum_sdna(prop, nullptr, "solver");
1441 prop, "Solver", "Solving method selection: automatic damping or manual damping");
1442 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update_rebuild");
1443
1444 prop = RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_FACTOR);
1445 RNA_def_property_float_sdna(prop, nullptr, "dampmax");
1446 RNA_def_property_range(prop, 0.0f, 1.0f);
1448 "Damp",
1449 "Maximum damping coefficient when singular value is nearly 0 "
1450 "(higher values produce results with more stability, less reactivity)");
1451 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1452
1453 prop = RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_FACTOR);
1454 RNA_def_property_float_sdna(prop, nullptr, "dampeps");
1455 RNA_def_property_range(prop, 0.0f, 1.0f);
1457 "Epsilon",
1458 "Singular value under which damping is progressively applied "
1459 "(higher values produce results with more stability, less reactivity)");
1460 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1461}
1462
1464{
1465 StructRNA *srna;
1466 PropertyRNA *prop;
1467
1468 srna = RNA_def_struct(brna, "IKParam", nullptr);
1469 RNA_def_struct_sdna(srna, "bIKParam");
1470 RNA_def_struct_ui_text(srna, "IKParam", "Base type for IK solver parameters");
1471 RNA_def_struct_refine_func(srna, "rna_IKParam_refine");
1472
1473 prop = RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
1474 RNA_def_property_enum_sdna(prop, nullptr, "iksolver");
1477 RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these parameters are defined");
1478}
1479
1480static void rna_def_pose(BlenderRNA *brna)
1481{
1482 StructRNA *srna;
1483 PropertyRNA *prop;
1484
1485 /* struct definition */
1486 srna = RNA_def_struct(brna, "Pose", nullptr);
1487 RNA_def_struct_sdna(srna, "bPose");
1489 srna, "Pose", "A collection of pose channels, including settings for animating bones");
1490
1491 /* pose channels */
1492 prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
1493 RNA_def_property_collection_sdna(prop, nullptr, "chanbase", nullptr);
1494 RNA_def_property_struct_type(prop, "PoseBone");
1496 RNA_def_property_ui_text(prop, "Pose Bones", "Individual pose bones for the armature");
1497 /* can be removed, only for fast lookup */
1499 nullptr,
1500 nullptr,
1501 nullptr,
1502 nullptr,
1503 nullptr,
1504 nullptr,
1505 "rna_PoseBones_lookup_string",
1506 nullptr);
1507
1508 /* ik solvers */
1509 prop = RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
1510 RNA_def_property_enum_sdna(prop, nullptr, "iksolver");
1511 RNA_def_property_enum_funcs(prop, nullptr, "rna_Pose_ik_solver_set", nullptr);
1513 RNA_def_property_ui_text(prop, "IK Solver", "Selection of IK solver for IK chain");
1514 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_ik_solver_update");
1515
1516 prop = RNA_def_property(srna, "ik_param", PROP_POINTER, PROP_NONE);
1517 RNA_def_property_struct_type(prop, "IKParam");
1519 prop, "rna_Pose_ikparam_get", nullptr, "rna_Pose_ikparam_typef", nullptr);
1521 RNA_def_property_ui_text(prop, "IK Param", "Parameters for IK solver");
1522
1524
1525 /* pose edit options */
1526 prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
1527 RNA_def_property_boolean_sdna(prop, nullptr, "flag", POSE_MIRROR_EDIT);
1529 prop, "X-Axis Mirror", "Apply changes to matching bone on opposite side of X-Axis");
1530 RNA_def_struct_path_func(srna, "rna_Pose_path");
1531 RNA_def_property_update(prop, 0, "rna_Pose_update");
1533
1534 prop = RNA_def_property(srna, "use_mirror_relative", PROP_BOOLEAN, PROP_NONE);
1537 prop,
1538 "Relative Mirror",
1539 "Apply relative transformations in X-mirror mode (not supported with Auto IK)");
1540 RNA_def_struct_path_func(srna, "rna_Pose_path");
1541 RNA_def_property_update(prop, 0, "rna_Pose_update");
1543
1544 prop = RNA_def_property(srna, "use_auto_ik", PROP_BOOLEAN, PROP_NONE);
1545 RNA_def_property_boolean_sdna(prop, nullptr, "flag", POSE_AUTO_IK);
1547 prop, "Auto IK", "Add temporary IK constraints while grabbing bones in Pose Mode");
1548 RNA_def_struct_path_func(srna, "rna_Pose_path");
1549 RNA_def_property_update(prop, 0, "rna_Pose_update");
1551
1553
1554 /* animviz */
1556
1557 RNA_api_pose(srna);
1558}
1559
1561{
1562 rna_def_pose(brna);
1565 rna_def_pose_itasc(brna);
1566}
1567
1568#endif
void BIK_update_param(struct bPose *pose)
void BIK_clear_data(struct bPose *pose)
Blender kernel action and pose functionality.
void BKE_pose_tag_recalc(Main *bmain, bPose *pose) ATTR_NONNULL(1
void BKE_pose_ikparam_init(bPose *pose) ATTR_NONNULL(1)
void BKE_pose_update_constraint_flags(bPose *pose) ATTR_NONNULL(1)
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
bool BKE_pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan)
void action_group_colors_sync(bActionGroup *grp, const bActionGroup *ref_grp)
void BKE_armature_mat_pose_to_bone_ex(Depsgraph *depsgraph, Object *ob, const bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
void BKE_pchan_apply_mat4(bPoseChannel *pchan, const float mat[4][4], bool use_compat)
void BKE_pchan_to_mat4(const bPoseChannel *pchan, float r_chanmat[4][4])
void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode)
bool BKE_constraint_remove_ex(ListBase *list, struct Object *ob, struct bConstraint *con)
struct bConstraint * BKE_constraint_copy_for_pose(struct Object *ob, struct bPoseChannel *pchan, struct bConstraint *src)
struct bConstraint * BKE_constraint_add_for_pose(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type)
struct bConstraint * BKE_constraint_duplicate_ex(struct bConstraint *src, int flag, bool do_extern)
struct bConstraint * BKE_constraints_active_get(struct ListBase *list)
void BKE_constraints_active_set(ListBase *list, struct bConstraint *con)
void BKE_constraint_unique_name(struct bConstraint *con, struct ListBase *list)
#define G_MAIN
void id_us_plus(ID *id)
Definition lib_id.cc:358
void id_us_min(ID *id)
Definition lib_id.cc:366
bool BKE_id_is_in_global_main(ID *id)
Definition lib_id.cc:2500
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
@ RPT_ERROR
Definition BKE_report.hh:39
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
#define BLI_assert_unreachable()
Definition BLI_assert.h:93
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:586
bool BLI_listbase_move_index(ListBase *listbase, int from, int to) ATTR_NONNULL()
Definition listbase.cc:467
void void * BLI_listbase_string_or_index_find(const ListBase *listbase, const char *string, size_t string_offset, int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:754
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition listbase.cc:332
#define M_PI
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_v3(float r[3], const float a[3])
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:693
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
#define BLI_STR_UTF8_MULTIPLICATION_SIGN
#define ELEM(...)
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ ID_RECALC_TRANSFORM
Definition DNA_ID.h:1054
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1118
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ LIBOVERRIDE_OP_INSERT_AFTER
Definition DNA_ID.h:240
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition DNA_ID.h:730
@ ID_OB
@ ITASC_SOLVER_SDLS
@ ITASC_SOLVER_DLS
@ IKSOLVER_STANDARD
@ IKSOLVER_ITASC
@ ITASC_REITERATION
@ ITASC_AUTO_STEP
@ ITASC_TRANSLATE_ROOT_BONES
@ ITASC_SIMULATION
@ ITASC_INITIAL_REITERATION
@ BONE_IK_ZLIMIT
@ BONE_IK_XLIMIT
@ BONE_IK_NO_ZDOF
@ BONE_IK_ROTCTL
@ BONE_IK_YLIMIT
@ BONE_IK_NO_YDOF
@ BONE_IK_LINCTL
@ BONE_IK_NO_XDOF
@ PCHAN_DRAW_HIDDEN
@ PCHAN_DRAW_NO_CUSTOM_BONE_SIZE
@ POSE_SELECTED
@ POSE_TRANSFORM_AT_CUSTOM_TX
@ POSE_TRANSFORM_AROUND_CUSTOM_TX
@ POSE_AUTO_IK
@ POSE_MIRROR_EDIT
@ POSE_MIRROR_RELATIVE
@ ARM_HAS_VIZ_DEPS
@ CONSTRAINT_OVERRIDE_LIBRARY_LOCAL
@ CONSTRAINT_TYPE_SPLINEIK
@ CONSTRAINT_TYPE_KINEMATIC
Object is a sort of wrapper for general info.
@ OB_ARMATURE
@ OB_LOCK_ROTZ
@ OB_LOCK_ROT4D
@ OB_LOCK_SCALEZ
@ OB_LOCK_ROTX
@ OB_LOCK_SCALEX
@ OB_LOCK_ROTW
@ OB_LOCK_LOCY
@ OB_LOCK_LOCZ
@ OB_LOCK_ROTY
@ OB_LOCK_SCALEY
@ OB_LOCK_LOCX
Read Guarded memory(de)allocation.
ParameterFlag
Definition RNA_types.hh:544
@ PARM_RNAPTR
Definition RNA_types.hh:547
@ PARM_REQUIRED
Definition RNA_types.hh:545
@ FUNC_USE_REPORTS
Definition RNA_types.hh:914
@ FUNC_USE_MAIN
Definition RNA_types.hh:912
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:889
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_BOOLEAN
Definition RNA_types.hh:162
@ PROP_ENUM
Definition RNA_types.hh:166
@ PROP_INT
Definition RNA_types.hh:163
@ PROP_STRING
Definition RNA_types.hh:165
@ PROP_POINTER
Definition RNA_types.hh:167
@ PROP_COLLECTION
Definition RNA_types.hh:168
#define RNA_TRANSLATION_PREC_DEFAULT
Definition RNA_types.hh:224
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:503
@ PROPOVERRIDE_NO_COMPARISON
Definition RNA_types.hh:511
@ PROPOVERRIDE_LIBRARY_INSERTION
Definition RNA_types.hh:528
PropertyFlag
Definition RNA_types.hh:300
@ PROP_THICK_WRAP
Definition RNA_types.hh:423
@ PROP_ANIMATABLE
Definition RNA_types.hh:319
@ PROP_PROPORTIONAL
Definition RNA_types.hh:349
@ PROP_EDITABLE
Definition RNA_types.hh:306
@ PROP_LIB_EXCEPTION
Definition RNA_types.hh:312
@ PROP_NEVER_NULL
Definition RNA_types.hh:377
@ PROP_PTR_NO_OWNERSHIP
Definition RNA_types.hh:395
@ PROP_ID_REFCOUNT
Definition RNA_types.hh:364
@ PROP_MATRIX
Definition RNA_types.hh:265
@ PROP_XYZ
Definition RNA_types.hh:269
@ PROP_DISTANCE
Definition RNA_types.hh:256
@ PROP_ANGLE
Definition RNA_types.hh:252
@ PROP_AXISANGLE
Definition RNA_types.hh:268
@ PROP_EULER
Definition RNA_types.hh:266
@ PROP_NONE
Definition RNA_types.hh:233
@ PROP_FACTOR
Definition RNA_types.hh:251
@ PROP_TRANSLATION
Definition RNA_types.hh:261
@ PROP_QUATERNION
Definition RNA_types.hh:267
#define NC_GEOM
Definition WM_types.hh:393
#define ND_DATA
Definition WM_types.hh:509
#define NC_ANIMATION
Definition WM_types.hh:388
#define NA_ADDED
Definition WM_types.hh:586
#define ND_POSE
Definition WM_types.hh:458
#define ND_CONSTRAINT
Definition WM_types.hh:464
#define NA_REMOVED
Definition WM_types.hh:587
#define NC_OBJECT
Definition WM_types.hh:379
#define ND_ANIMCHAN
Definition WM_types.hh:496
void ED_armature_bone_rename(Main *bmain, bArmature *arm, const char *oldnamep, const char *newnamep)
#define offsetof(t, d)
#define GS(x)
#define main()
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
void object_test_constraints(Main *bmain, Object *ob)
void constraint_dependency_tag_update(Main *bmain, Object *ob, bConstraint *con)
void constraint_update(Main *bmain, Object *ob)
void constraint_tag_update(Main *bmain, Object *ob, bConstraint *con)
const char * name
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
void rna_pointer_create_with_ancestors(const PointerRNA &parent, StructRNA *type, void *data, PointerRNA &r_ptr)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
void rna_def_animviz_common(StructRNA *srna)
void rna_def_motionpath_common(StructRNA *srna)
void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editbone)
const EnumPropertyItem rna_enum_constraint_type_items[]
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_define_lib_overridable(const bool make_overridable)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_struct_system_idprops_func(StructRNA *srna, const char *system_idproperties)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
const float rna_default_quaternion[4]
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
const float rna_default_scale_3d[3]
void RNA_def_property_boolean_bitset_array_sdna(PropertyRNA *prop, const char *structname, const char *propname, const int64_t booleanbit, const int length)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
const float rna_default_axis_angle[4]
void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editable)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
const int rna_matrix_dimsize_4x4[]
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
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)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
bool rna_ActionGroup_is_custom_colorset_get(PointerRNA *ptr)
void RNA_api_pose(StructRNA *srna)
void rna_ActionGroup_colorset_set(PointerRNA *ptr, int value)
void RNA_api_pose_channel(StructRNA *srna)
const EnumPropertyItem rna_enum_object_rotation_mode_items[]
static void rna_def_pose_ikparam(BlenderRNA *brna)
Definition rna_pose.cc:1463
static const EnumPropertyItem prop_solver_items[]
Definition rna_pose.cc:745
const EnumPropertyItem rna_enum_color_sets_items[]
Definition rna_pose.cc:29
static void rna_def_pose_channel(BlenderRNA *brna)
Definition rna_pose.cc:822
static void rna_def_pose(BlenderRNA *brna)
Definition rna_pose.cc:1480
static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cprop)
Definition rna_pose.cc:751
static const EnumPropertyItem prop_iksolver_items[]
Definition rna_pose.cc:739
static void rna_def_pose_itasc(BlenderRNA *brna)
Definition rna_pose.cc:1317
void RNA_def_pose(BlenderRNA *brna)
Definition rna_pose.cc:1560
void rna_def_actionbone_group_common(StructRNA *srna, int update_flag, const char *update_cb)
Definition rna_pose.cc:710
#define FLT_MAX
Definition stdcycles.h:14
Definition DNA_ID.h:414
char name[258]
Definition DNA_ID.h:432
struct bPose * pose
ID * owner_id
Definition RNA_types.hh:51
void invalidate()
Definition RNA_types.hh:110
void * data
Definition RNA_types.hh:53
IDOverrideLibraryPropertyOperation * liboverride_operation
float precision
IDProperty * prop
struct Bone * bone
struct bPoseChannel * custom_tx
struct Object * custom
IDProperty * system_properties
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4238