Blender V4.5
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_Pose_dependency_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
99{
101
104}
105
106static void rna_Pose_IK_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
107{
108 // ob->pose->flag |= (POSE_LOCKED | POSE_DO_UNLOCK); /* XXX: when to use this? */
109 Object *ob = (Object *)ptr->owner_id;
110
113
114 BIK_clear_data(ob->pose);
115}
116
117static std::optional<std::string> rna_Pose_path(const PointerRNA * /*ptr*/)
118{
119 return "pose";
120}
121
122static std::optional<std::string> rna_PoseBone_path(const PointerRNA *ptr)
123{
124 const bPoseChannel *pchan = static_cast<const bPoseChannel *>(ptr->data);
125 char name_esc[sizeof(pchan->name) * 2];
126
127 BLI_str_escape(name_esc, pchan->name, sizeof(name_esc));
128 return fmt::format("pose.bones[\"{}\"]", name_esc);
129}
130
131/* shared for actions groups and bone groups */
132
133static bool rna_bone_group_poll(Object *ob, ReportList *reports)
134{
135 if (ID_IS_OVERRIDE_LIBRARY(ob)) {
136 BKE_report(reports, RPT_ERROR, "Cannot edit bone groups for library overrides");
137 return false;
138 }
139
140 return true;
141}
142
144{
145 Object *ob = (Object *)ptr->owner_id;
146 if (!rna_bone_group_poll(ob, nullptr)) {
147 return;
148 }
149
150 bActionGroup *grp = static_cast<bActionGroup *>(ptr->data);
151
152 /* ensure only valid values get set */
153 if ((value >= -1) && (value < 21)) {
154 grp->customCol = value;
155
156 /* sync colors stored with theme colors based on the index specified */
157 action_group_colors_sync(grp, nullptr);
158 }
159}
160
162{
163 bActionGroup *grp = static_cast<bActionGroup *>(ptr->data);
164
165 return (grp->customCol < 0);
166}
167
168static IDProperty **rna_PoseBone_idprops(PointerRNA *ptr)
169{
170 bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
171 return &pchan->prop;
172}
173
174static void rna_Pose_ik_solver_set(PointerRNA *ptr, int value)
175{
176 bPose *pose = (bPose *)ptr->data;
177
178 if (pose->iksolver != value) {
179 /* the solver has changed, must clean any temporary structures */
180 BIK_clear_data(pose);
181 if (pose->ikparam) {
182 MEM_freeN(pose->ikparam);
183 pose->ikparam = nullptr;
184 }
185 pose->iksolver = value;
187 }
188}
189
190static void rna_Pose_ik_solver_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
191{
192 Object *ob = (Object *)ptr->owner_id;
193 bPose *pose = static_cast<bPose *>(ptr->data);
194
195 BKE_pose_tag_recalc(bmain, pose); /* checks & sorts pose channels */
197
199
201
203}
204
205/* rotation - axis-angle */
206static void rna_PoseChannel_rotation_axis_angle_get(PointerRNA *ptr, float *value)
207{
208 bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
209
210 /* for now, assume that rotation mode is axis-angle */
211 value[0] = pchan->rotAngle;
212 copy_v3_v3(&value[1], pchan->rotAxis);
213}
214
215/* rotation - axis-angle */
216static void rna_PoseChannel_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
217{
218 bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
219
220 /* for now, assume that rotation mode is axis-angle */
221 pchan->rotAngle = value[0];
222 copy_v3_v3(pchan->rotAxis, &value[1]);
223
224 /* TODO: validate axis? */
225}
226
227static void rna_PoseChannel_rotation_mode_set(PointerRNA *ptr, int value)
228{
229 bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
230
231 /* use API Method for conversions... */
233 pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode, short(value));
234
235 /* finally, set the new rotation type */
236 pchan->rotmode = clamp_i(value, ROT_MODE_MIN, ROT_MODE_MAX);
237}
238
239static float rna_PoseChannel_length_get(PointerRNA *ptr)
240{
241 bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
242 return len_v3v3(pchan->pose_head, pchan->pose_tail);
243}
244
245static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value)
246{
247 Object *ob = (Object *)ptr->owner_id;
248 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
249 char oldname[sizeof(pchan->name)], newname[sizeof(pchan->name)];
250
251 /* need to be on the stack */
252 STRNCPY_UTF8(newname, value);
253 STRNCPY(oldname, pchan->name);
254
256 BLI_assert(BKE_id_is_in_global_main(static_cast<ID *>(ob->data)));
257 ED_armature_bone_rename(G_MAIN, static_cast<bArmature *>(ob->data), oldname, newname);
258}
259
260/* See rna_Bone_update_renamed() */
261static void rna_PoseChannel_name_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
262{
263 ID *id = ptr->owner_id;
264
265 /* Redraw Outliner / Dope-sheet. */
267
268 /* update animation channels */
270}
271
272static PointerRNA rna_PoseChannel_bone_get(PointerRNA *ptr)
273{
274 Object *ob = (Object *)ptr->owner_id;
275 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
276 PointerRNA tmp_ptr = *ptr;
277
278 /* Replace the id_data pointer with the Armature ID. */
279 tmp_ptr.owner_id = static_cast<ID *>(ob->data);
280
281 return RNA_pointer_create_with_parent(tmp_ptr, &RNA_Bone, pchan->bone);
282}
283
284static bool rna_PoseChannel_has_ik_get(PointerRNA *ptr)
285{
286 Object *ob = (Object *)ptr->owner_id;
287 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
288
289 return BKE_pose_channel_in_IK_chain(ob, pchan);
290}
291
292static StructRNA *rna_IKParam_refine(PointerRNA *ptr)
293{
294 bIKParam *param = (bIKParam *)ptr->data;
295
296 switch (param->iksolver) {
297 case IKSOLVER_ITASC:
298 return &RNA_Itasc;
299 default:
300 return &RNA_IKParam;
301 }
302}
303
304static PointerRNA rna_Pose_ikparam_get(PointerRNA *ptr)
305{
306 bPose *pose = (bPose *)ptr->data;
307 return RNA_pointer_create_with_parent(*ptr, &RNA_IKParam, pose->ikparam);
308}
309
310static StructRNA *rna_Pose_ikparam_typef(PointerRNA *ptr)
311{
312 bPose *pose = (bPose *)ptr->data;
313
314 switch (pose->iksolver) {
315 case IKSOLVER_ITASC:
316 return &RNA_Itasc;
317 default:
318 return &RNA_IKParam;
319 }
320}
321
322static void rna_Itasc_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
323{
324 Object *ob = (Object *)ptr->owner_id;
325 bItasc *itasc = static_cast<bItasc *>(ptr->data);
326
327 /* verify values */
328 itasc->precision = std::max(itasc->precision, 0.0001f);
329 itasc->minstep = std::max(itasc->minstep, 0.001f);
330 itasc->maxstep = std::max(itasc->maxstep, itasc->minstep);
331 itasc->feedback = std::max(itasc->feedback, 0.01f);
332 itasc->feedback = std::min(itasc->feedback, 100.0f);
333 itasc->maxvel = std::max(itasc->maxvel, 0.01f);
334 itasc->maxvel = std::min(itasc->maxvel, 100.0f);
336
338}
339
340static void rna_Itasc_update_rebuild(Main *bmain, Scene *scene, PointerRNA *ptr)
341{
342 Object *ob = (Object *)ptr->owner_id;
343 bPose *pose = ob->pose;
344
345 BKE_pose_tag_recalc(bmain, pose); /* checks & sorts pose channels */
346 rna_Itasc_update(bmain, scene, ptr);
347}
348
349static PointerRNA rna_PoseChannel_active_constraint_get(PointerRNA *ptr)
350{
351 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
352 bConstraint *con = BKE_constraints_active_get(&pchan->constraints);
353 return RNA_pointer_create_with_parent(*ptr, &RNA_Constraint, con);
354}
355
356static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr,
357 PointerRNA value,
358 ReportList * /*reports*/)
359{
360 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
361 BKE_constraints_active_set(&pchan->constraints, (bConstraint *)value.data);
362}
363
364static bConstraint *rna_PoseChannel_constraints_new(ID *id,
365 bPoseChannel *pchan,
366 Main *main,
367 int type)
368{
369 Object *ob = (Object *)id;
370 bConstraint *new_con = BKE_constraint_add_for_pose(ob, pchan, nullptr, type);
371
374
375 return new_con;
376}
377
378static void rna_PoseChannel_constraints_remove(
379 ID *id, bPoseChannel *pchan, Main *bmain, ReportList *reports, PointerRNA *con_ptr)
380{
381 bConstraint *con = static_cast<bConstraint *>(con_ptr->data);
383 Object *ob = (Object *)id;
384
385 if (BLI_findindex(&pchan->constraints, con) == -1) {
387 reports, RPT_ERROR, "Constraint '%s' not found in pose bone '%s'", con->name, pchan->name);
388 return;
389 }
390
391 BKE_constraint_remove_ex(&pchan->constraints, ob, con);
392 con_ptr->invalidate();
393
396
397 /* XXX(@ideasman42): is this really needed? */
398 BKE_constraints_active_set(&pchan->constraints, nullptr);
399
401
402 if (is_ik) {
403 BIK_clear_data(ob->pose);
404 }
405}
406
407static void rna_PoseChannel_constraints_move(
408 ID *id, bPoseChannel *pchan, Main *bmain, ReportList *reports, int from, int to)
409{
410 Object *ob = (Object *)id;
411
412 if (from == to) {
413 return;
414 }
415
416 if (!BLI_listbase_move_index(&pchan->constraints, from, to)) {
417 BKE_reportf(reports, RPT_ERROR, "Could not move constraint from index '%d' to '%d'", from, to);
418 return;
419 }
420
423}
424
425static bConstraint *rna_PoseChannel_constraints_copy(ID *id,
426 bPoseChannel *pchan,
427 Main *bmain,
428 PointerRNA *con_ptr)
429{
430 Object *ob = (Object *)id;
431 bConstraint *con = static_cast<bConstraint *>(con_ptr->data);
432 bConstraint *new_con = BKE_constraint_copy_for_pose(ob, pchan, con);
434
437
438 return new_con;
439}
440
441bool rna_PoseChannel_constraints_override_apply(Main *bmain,
443{
444 PointerRNA *ptr_dst = &rnaapply_ctx.ptr_dst;
445 PointerRNA *ptr_src = &rnaapply_ctx.ptr_src;
446 PropertyRNA *prop_dst = rnaapply_ctx.prop_dst;
448
450 "Unsupported RNA override operation on constraints collection");
451
452 bPoseChannel *pchan_dst = (bPoseChannel *)ptr_dst->data;
453 bPoseChannel *pchan_src = (bPoseChannel *)ptr_src->data;
454
455 /* Remember that insertion operations are defined and stored in correct order, which means that
456 * even if we insert several items in a row, we always insert first one, then second one, etc.
457 * So we should always find 'anchor' constraint in both _src *and* _dst */
458 const size_t name_offset = offsetof(bConstraint, name);
459 bConstraint *con_anchor = static_cast<bConstraint *>(
460 BLI_listbase_string_or_index_find(&pchan_dst->constraints,
461 opop->subitem_reference_name,
462 name_offset,
463 opop->subitem_reference_index));
464 /* If `con_anchor` is nullptr, `con_src` will be inserted in first position. */
465
467 &pchan_src->constraints, opop->subitem_local_name, name_offset, opop->subitem_local_index));
468
469 if (con_src == nullptr) {
470 BLI_assert(con_src != nullptr);
471 return false;
472 }
473
474 bConstraint *con_dst = BKE_constraint_duplicate_ex(con_src, 0, true);
475
476 /* This handles nullptr anchor as expected by adding at head of list. */
477 BLI_insertlinkafter(&pchan_dst->constraints, con_anchor, con_dst);
478
479 /* This should actually *not* be needed in typical cases.
480 * However, if overridden source was edited,
481 * we *may* have some new conflicting names. */
482 BKE_constraint_unique_name(con_dst, &pchan_dst->constraints);
483
484 // printf("%s: We inserted a constraint...\n", __func__);
485 RNA_property_update_main(bmain, nullptr, ptr_dst, prop_dst);
486 return true;
487}
488
489static int rna_PoseChannel_proxy_editable(const PointerRNA * /*ptr*/, const char ** /*r_info*/)
490{
491# if 0
492 Object *ob = (Object *)ptr->owner_id;
493 bArmature *arm = ob->data;
494 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
495
496 if (pchan->bone && (pchan->bone->layer & arm->layer_protected)) {
497 *r_info = "Can't edit property of a proxy on a protected layer";
498 return 0;
499 }
500# endif
501
502 return PROP_EDITABLE;
503}
504
505static int rna_PoseChannel_location_editable(const PointerRNA *ptr, int index)
506{
507 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
508
509 /* only if the axis in question is locked, not editable... */
510 if ((index == 0) && (pchan->protectflag & OB_LOCK_LOCX)) {
511 return 0;
512 }
513 if ((index == 1) && (pchan->protectflag & OB_LOCK_LOCY)) {
514 return 0;
515 }
516 if ((index == 2) && (pchan->protectflag & OB_LOCK_LOCZ)) {
517 return 0;
518 }
519 return PROP_EDITABLE;
520}
521
522static int rna_PoseChannel_scale_editable(const PointerRNA *ptr, int index)
523{
524 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
525
526 /* only if the axis in question is locked, not editable... */
527 if ((index == 0) && (pchan->protectflag & OB_LOCK_SCALEX)) {
528 return 0;
529 }
530 if ((index == 1) && (pchan->protectflag & OB_LOCK_SCALEY)) {
531 return 0;
532 }
533 if ((index == 2) && (pchan->protectflag & OB_LOCK_SCALEZ)) {
534 return 0;
535 }
536 return PROP_EDITABLE;
537}
538
539static int rna_PoseChannel_rotation_euler_editable(const PointerRNA *ptr, int index)
540{
541 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
542
543 /* only if the axis in question is locked, not editable... */
544 if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTX)) {
545 return 0;
546 }
547 if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTY)) {
548 return 0;
549 }
550 if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTZ)) {
551 return 0;
552 }
553 return PROP_EDITABLE;
554}
555
556static int rna_PoseChannel_rotation_4d_editable(const PointerRNA *ptr, int index)
557{
558 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
559
560 /* only consider locks if locking components individually... */
561 if (pchan->protectflag & OB_LOCK_ROT4D) {
562 /* only if the axis in question is locked, not editable... */
563 if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTW)) {
564 return 0;
565 }
566 if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTX)) {
567 return 0;
568 }
569 if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTY)) {
570 return 0;
571 }
572 if ((index == 3) && (pchan->protectflag & OB_LOCK_ROTZ)) {
573 return 0;
574 }
575 }
576
577 return PROP_EDITABLE;
578}
579
580/* not essential, but much faster than the default lookup function */
581static bool rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
582{
583 bPose *pose = (bPose *)ptr->data;
584 bPoseChannel *pchan = BKE_pose_channel_find_name(pose, key);
585 if (pchan) {
586 rna_pointer_create_with_ancestors(*ptr, &RNA_PoseBone, pchan, *r_ptr);
587 return true;
588 }
589 return false;
590}
591
592static void rna_PoseChannel_matrix_basis_get(PointerRNA *ptr, float *values)
593{
594 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
595 BKE_pchan_to_mat4(pchan, (float(*)[4])values);
596}
597
598static void rna_PoseChannel_matrix_basis_set(PointerRNA *ptr, const float *values)
599{
600 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
601 /* No compatibility for predictable result. */
602 BKE_pchan_apply_mat4(pchan, (const float(*)[4])values, false);
603}
604
605static void rna_PoseChannel_matrix_set(PointerRNA *ptr, const float *values)
606{
607 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
608 Object *ob = (Object *)ptr->owner_id;
609 float tmat[4][4];
610
611 BKE_armature_mat_pose_to_bone_ex(nullptr, ob, pchan, (const float(*)[4])values, tmat);
612
613 /* No compatibility for predictable result. */
614 BKE_pchan_apply_mat4(pchan, tmat, false);
615}
616
617static bPoseChannel *rna_PoseChannel_ensure_own_pchan(Object *ob,
618 Object *ref_ob,
619 bPoseChannel *ref_pchan)
620{
621 if (ref_ob != ob) {
622 /* We are trying to set a pchan from another object! Forbidden,
623 * try to find by name, or abort. */
624 if (ref_pchan != nullptr) {
625 ref_pchan = BKE_pose_channel_find_name(ob->pose, ref_pchan->name);
626 }
627 }
628 return ref_pchan;
629}
630
631static void rna_PoseChannel_custom_shape_transform_set(PointerRNA *ptr,
632 PointerRNA value,
633 ReportList * /*reports*/)
634{
635 bPoseChannel *pchan = (bPoseChannel *)ptr->data;
636 Object *ob = (Object *)ptr->owner_id;
637
638 pchan->custom_tx = rna_PoseChannel_ensure_own_pchan(
639 ob, (Object *)value.owner_id, static_cast<bPoseChannel *>(value.data));
640}
641
642void rna_Pose_custom_shape_set(PointerRNA *ptr, PointerRNA value, struct ReportList *reports)
643{
644 bPoseChannel *pchan = static_cast<bPoseChannel *>(ptr->data);
645 Object *custom_shape = static_cast<Object *>(value.data);
646
647 if (!custom_shape) {
648 id_us_min(reinterpret_cast<ID *>(pchan->custom));
649 pchan->custom = nullptr;
650 return;
651 }
652
653 /* This should be ensured by the RNA property type. */
654 BLI_assert(GS(custom_shape->id.name) == ID_OB);
655
656 if (custom_shape->type == OB_ARMATURE) {
657 BKE_report(reports, RPT_ERROR, "Cannot use armature object as custom bone shape");
658 return;
659 }
660
661 id_us_min(reinterpret_cast<ID *>(pchan->custom));
662 pchan->custom = custom_shape;
663 id_us_plus(reinterpret_cast<ID *>(pchan->custom));
664}
665
666bool rna_Pose_custom_shape_object_poll(PointerRNA * /*ptr*/, PointerRNA value)
667{
668 return (reinterpret_cast<Object *>(value.owner_id))->type != OB_ARMATURE;
669}
670
671#else
672
673void rna_def_actionbone_group_common(StructRNA *srna, int update_flag, const char *update_cb)
674{
675 PropertyRNA *prop;
676
677 /* color set + colors */
678 prop = RNA_def_property(srna, "color_set", PROP_ENUM, PROP_NONE);
679 RNA_def_property_enum_sdna(prop, nullptr, "customCol");
681 RNA_def_property_enum_funcs(prop, nullptr, "rna_ActionGroup_colorset_set", nullptr);
682 RNA_def_property_ui_text(prop, "Color Set", "Custom color set to use");
683 RNA_def_property_update(prop, update_flag, update_cb);
684
685 prop = RNA_def_property(srna, "is_custom_color_set", PROP_BOOLEAN, PROP_NONE);
686 RNA_def_property_boolean_funcs(prop, "rna_ActionGroup_is_custom_colorset_get", nullptr);
689 prop, "Custom Color Set", "Color set is user-defined instead of a fixed theme color set");
690
691 /* TODO: editing the colors for this should result in changes to the color type... */
692 prop = RNA_def_property(srna, "colors", PROP_POINTER, PROP_NONE);
694 RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
695 /* NOTE: the DNA data is not really a pointer, but this code works :) */
696 RNA_def_property_pointer_sdna(prop, nullptr, "cs");
698 prop, "Colors", "Copy of the colors associated with the group's color set");
699 RNA_def_property_update(prop, update_flag, update_cb);
700}
701
703 {IKSOLVER_STANDARD, "LEGACY", 0, "Standard", "Original IK solver"},
704 {IKSOLVER_ITASC, "ITASC", 0, "iTaSC", "Multi constraint, stateful IK solver"},
705 {0, nullptr, 0, nullptr, nullptr},
706};
707
709 {ITASC_SOLVER_SDLS, "SDLS", 0, "SDLS", "Selective Damped Least Square"},
710 {ITASC_SOLVER_DLS, "DLS", 0, "DLS", "Damped Least Square with Numerical Filtering"},
711 {0, nullptr, 0, nullptr, nullptr},
712};
713
715{
716 StructRNA *srna;
717 PropertyRNA *prop;
718
719 FunctionRNA *func;
720 PropertyRNA *parm;
721
722 RNA_def_property_srna(cprop, "PoseBoneConstraints");
723 srna = RNA_def_struct(brna, "PoseBoneConstraints", nullptr);
724 RNA_def_struct_sdna(srna, "bPoseChannel");
725 RNA_def_struct_ui_text(srna, "PoseBone Constraints", "Collection of pose bone constraints");
726
727 /* Collection active property */
728 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
729 RNA_def_property_struct_type(prop, "Constraint");
731 "rna_PoseChannel_active_constraint_get",
732 "rna_PoseChannel_active_constraint_set",
733 nullptr,
734 nullptr);
736 RNA_def_property_ui_text(prop, "Active Constraint", "Active PoseChannel constraint");
737
738 /* Constraint collection */
739 func = RNA_def_function(srna, "new", "rna_PoseChannel_constraints_new");
740 RNA_def_function_ui_description(func, "Add a constraint to this object");
742 FUNC_USE_MAIN | FUNC_USE_SELF_ID); /* ID and Main needed for refresh */
743 /* return type */
744 parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
745 RNA_def_function_return(func, parm);
746 /* constraint to add */
747 parm = RNA_def_enum(
748 func, "type", rna_enum_constraint_type_items, 1, "", "Constraint type to add");
750
751 func = RNA_def_function(srna, "remove", "rna_PoseChannel_constraints_remove");
752 RNA_def_function_ui_description(func, "Remove a constraint from this object");
754 func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); /* ID needed for refresh */
755 /* constraint to remove */
756 parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
759
760 func = RNA_def_function(srna, "move", "rna_PoseChannel_constraints_move");
761 RNA_def_function_ui_description(func, "Move a constraint to a different position");
763 parm = RNA_def_int(
764 func, "from_index", -1, INT_MIN, INT_MAX, "From Index", "Index to move", 0, 10000);
766 parm = RNA_def_int(func, "to_index", -1, INT_MIN, INT_MAX, "To Index", "Target index", 0, 10000);
768
769 func = RNA_def_function(srna, "copy", "rna_PoseChannel_constraints_copy");
770 RNA_def_function_ui_description(func, "Add a new constraint that is a copy of the given one");
772 /* constraint to copy */
773 parm = RNA_def_pointer(func,
774 "constraint",
775 "Constraint",
776 "",
777 "Constraint to copy - may belong to a different object");
780 /* return type */
781 parm = RNA_def_pointer(func, "new_constraint", "Constraint", "", "New constraint");
782 RNA_def_function_return(func, parm);
783}
784
786{
787 StructRNA *srna;
788 PropertyRNA *prop;
789
790 srna = RNA_def_struct(brna, "PoseBone", nullptr);
791 RNA_def_struct_sdna(srna, "bPoseChannel");
792 RNA_def_struct_ui_text(srna, "Pose Bone", "Channel defining pose data for a bone in a Pose");
793 RNA_def_struct_path_func(srna, "rna_PoseBone_path");
794 RNA_def_struct_idprops_func(srna, "rna_PoseBone_idprops");
795 RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
796
797 /* Bone Constraints */
798 prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
799 RNA_def_property_struct_type(prop, "Constraint");
802 RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this pose channel");
804 prop, nullptr, nullptr, "rna_PoseChannel_constraints_override_apply");
805
807
808 /* Name + Selection Status */
809 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
810 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_PoseChannel_name_set");
811 RNA_def_property_ui_text(prop, "Name", "");
812 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
814 RNA_def_property_update(prop, 0, "rna_PoseChannel_name_update");
815
816 /* Baked Bone Path cache data */
818
819 /* Relationships to other bones */
820 prop = RNA_def_property(srna, "bone", PROP_POINTER, PROP_NONE);
822 RNA_def_property_struct_type(prop, "Bone");
823 RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_bone_get", nullptr, nullptr, nullptr);
826 RNA_def_property_ui_text(prop, "Bone", "Bone associated with this PoseBone");
827
828 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
829 RNA_def_property_struct_type(prop, "PoseBone");
832 RNA_def_property_ui_text(prop, "Parent", "Parent of this pose bone");
833
834 prop = RNA_def_property(srna, "child", PROP_POINTER, PROP_NONE);
835 RNA_def_property_struct_type(prop, "PoseBone");
838 RNA_def_property_ui_text(prop, "Child", "Child of this pose bone");
839
840 /* Transformation settings */
841 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
842 RNA_def_property_float_sdna(prop, nullptr, "loc");
844 RNA_def_property_editable_array_func(prop, "rna_PoseChannel_location_editable");
845 RNA_def_property_ui_text(prop, "Location", "");
847 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
848
849 prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
852 RNA_def_property_editable_array_func(prop, "rna_PoseChannel_scale_editable");
854 RNA_def_property_ui_text(prop, "Scale", "");
855 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
856
857 prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
858 RNA_def_property_float_sdna(prop, nullptr, "quat");
860 RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
862 RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
863 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
864
865 /* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
866 * having a single one is better for Keyframing and other property-management situations...
867 */
868 prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
870 RNA_def_property_array(prop, 4);
872 "rna_PoseChannel_rotation_axis_angle_get",
873 "rna_PoseChannel_rotation_axis_angle_set",
874 nullptr);
875 RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
878 prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
879 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
880
881 prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
882 RNA_def_property_float_sdna(prop, nullptr, "eul");
884 RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_euler_editable");
885 RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
887 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
888
889 prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
890 RNA_def_property_enum_sdna(prop, nullptr, "rotmode");
893 RNA_def_property_enum_funcs(prop, nullptr, "rna_PoseChannel_rotation_mode_set", nullptr);
894 /* XXX... disabled, since proxy-locked layers are currently
895 * used for ensuring proxy-syncing too */
896 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
898 prop,
899 "Rotation Mode",
900 /* This description is shared by other "rotation_mode" properties. */
901 "The kind of rotation to apply, values from other rotation modes aren't used");
902 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
903
904 /* Curved bones settings - Applied on top of rest-pose values. */
905 rna_def_bone_curved_common(srna, true, false);
906
907 /* Custom BBone next/prev sources */
908 prop = RNA_def_property(srna, "bbone_custom_handle_start", PROP_POINTER, PROP_NONE);
909 RNA_def_property_pointer_sdna(prop, nullptr, "bbone_prev");
910 RNA_def_property_struct_type(prop, "PoseBone");
914 prop, "B-Bone Start Handle", "Bone that serves as the start handle for the B-Bone curve");
915 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
916
917 prop = RNA_def_property(srna, "bbone_custom_handle_end", PROP_POINTER, PROP_NONE);
918 RNA_def_property_pointer_sdna(prop, nullptr, "bbone_next");
919 RNA_def_property_struct_type(prop, "PoseBone");
923 prop, "B-Bone End Handle", "Bone that serves as the end handle for the B-Bone curve");
924 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
925
926 /* transform matrices - should be read-only since these are set directly by AnimSys evaluation */
927 prop = RNA_def_property(srna, "matrix_channel", PROP_FLOAT, PROP_MATRIX);
928 RNA_def_property_float_sdna(prop, nullptr, "chan_mat");
932 "Channel Matrix",
934 "4 matrix of the bone's location/rotation/scale channels (including "
935 "animation and drivers) and the effect of bone constraints");
936
937 /* writable because it touches loc/scale/rot directly */
938 prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
941 prop,
942 "Basis Matrix",
943 "Alternative access to location/scale/rotation relative to the parent and own rest bone");
945 prop, "rna_PoseChannel_matrix_basis_get", "rna_PoseChannel_matrix_basis_set", nullptr);
947 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
948
949 /* final matrix */
950 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
951 RNA_def_property_float_sdna(prop, nullptr, "pose_mat");
953 RNA_def_property_float_funcs(prop, nullptr, "rna_PoseChannel_matrix_set", nullptr);
955 "Pose Matrix",
957 "4 matrix after constraints and drivers are applied, in "
958 "the armature object space");
959 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
960
961 /* Head/Tail Coordinates (in Pose Space) - Automatically calculated... */
962 prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
963 RNA_def_property_float_sdna(prop, nullptr, "pose_head");
965 RNA_def_property_ui_text(prop, "Pose Head Position", "Location of head of the channel's bone");
967
968 prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
969 RNA_def_property_float_sdna(prop, nullptr, "pose_tail");
971 RNA_def_property_ui_text(prop, "Pose Tail Position", "Location of tail of the channel's bone");
973
974 prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_DISTANCE);
975 RNA_def_property_float_funcs(prop, "rna_PoseChannel_length_get", nullptr, nullptr);
977 RNA_def_property_ui_text(prop, "Length", "Length of the bone");
978
979 /* IK Settings */
980 prop = RNA_def_property(srna, "is_in_ik_chain", PROP_BOOLEAN, PROP_NONE);
981 RNA_def_property_boolean_funcs(prop, "rna_PoseChannel_has_ik_get", nullptr);
984 RNA_def_property_ui_text(prop, "Has IK", "Is part of an IK chain");
985 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
986
987 prop = RNA_def_property(srna, "lock_ik_x", PROP_BOOLEAN, PROP_NONE);
988 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_NO_XDOF);
989 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
990 RNA_def_property_ui_text(prop, "IK X Lock", "Disallow movement around the X axis");
991 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
992 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
993
994 prop = RNA_def_property(srna, "lock_ik_y", PROP_BOOLEAN, PROP_NONE);
995 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_NO_YDOF);
996 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
997 RNA_def_property_ui_text(prop, "IK Y Lock", "Disallow movement around the Y axis");
998 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
999 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1000
1001 prop = RNA_def_property(srna, "lock_ik_z", PROP_BOOLEAN, PROP_NONE);
1002 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_NO_ZDOF);
1003 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
1004 RNA_def_property_ui_text(prop, "IK Z Lock", "Disallow movement around the Z axis");
1005 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1006 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1007
1008 prop = RNA_def_property(srna, "use_ik_limit_x", PROP_BOOLEAN, PROP_NONE);
1009 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_XLIMIT);
1010 RNA_def_property_ui_text(prop, "IK X Limit", "Limit movement around the X axis");
1011 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1012 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1013
1014 prop = RNA_def_property(srna, "use_ik_limit_y", PROP_BOOLEAN, PROP_NONE);
1015 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_YLIMIT);
1016 RNA_def_property_ui_text(prop, "IK Y Limit", "Limit movement around the Y axis");
1017 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1018 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1019
1020 prop = RNA_def_property(srna, "use_ik_limit_z", PROP_BOOLEAN, PROP_NONE);
1021 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_ZLIMIT);
1022 RNA_def_property_ui_text(prop, "IK Z Limit", "Limit movement around the Z axis");
1023 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1024 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1025
1026 prop = RNA_def_property(srna, "use_ik_rotation_control", PROP_BOOLEAN, PROP_NONE);
1027 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_ROTCTL);
1028 RNA_def_property_ui_text(prop, "IK Rotation Control", "Apply channel rotation as IK constraint");
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, "use_ik_linear_control", PROP_BOOLEAN, PROP_NONE);
1033 RNA_def_property_boolean_sdna(prop, nullptr, "ikflag", BONE_IK_LINCTL);
1035 prop, "IK Linear Control", "Apply channel size as IK constraint if stretching is enabled");
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, "ik_min_x", PROP_FLOAT, PROP_ANGLE);
1040 RNA_def_property_float_sdna(prop, nullptr, "limitmin[0]");
1041 RNA_def_property_range(prop, -M_PI, 0.0f);
1042 RNA_def_property_ui_text(prop, "IK X Minimum", "Minimum angles for IK Limit");
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, "ik_max_x", PROP_FLOAT, PROP_ANGLE);
1047 RNA_def_property_float_sdna(prop, nullptr, "limitmax[0]");
1048 RNA_def_property_range(prop, 0.0f, M_PI);
1049 RNA_def_property_ui_text(prop, "IK X Maximum", "Maximum angles for IK Limit");
1050 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1051 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1052
1053 prop = RNA_def_property(srna, "ik_min_y", PROP_FLOAT, PROP_ANGLE);
1054 RNA_def_property_float_sdna(prop, nullptr, "limitmin[1]");
1055 RNA_def_property_range(prop, -M_PI, 0.0f);
1056 RNA_def_property_ui_text(prop, "IK Y Minimum", "Minimum angles for IK Limit");
1057 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1058 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1059
1060 prop = RNA_def_property(srna, "ik_max_y", PROP_FLOAT, PROP_ANGLE);
1061 RNA_def_property_float_sdna(prop, nullptr, "limitmax[1]");
1062 RNA_def_property_range(prop, 0.0f, M_PI);
1063 RNA_def_property_ui_text(prop, "IK Y Maximum", "Maximum angles for IK Limit");
1064 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1065 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1066
1067 prop = RNA_def_property(srna, "ik_min_z", PROP_FLOAT, PROP_ANGLE);
1068 RNA_def_property_float_sdna(prop, nullptr, "limitmin[2]");
1069 RNA_def_property_range(prop, -M_PI, 0.0f);
1070 RNA_def_property_ui_text(prop, "IK Z Minimum", "Minimum angles for IK Limit");
1071 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1072 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1073
1074 prop = RNA_def_property(srna, "ik_max_z", PROP_FLOAT, PROP_ANGLE);
1075 RNA_def_property_float_sdna(prop, nullptr, "limitmax[2]");
1076 RNA_def_property_range(prop, 0.0f, M_PI);
1077 RNA_def_property_ui_text(prop, "IK Z Maximum", "Maximum angles for IK Limit");
1078 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1079 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1080
1081 prop = RNA_def_property(srna, "ik_stiffness_x", PROP_FLOAT, PROP_NONE);
1082 RNA_def_property_float_sdna(prop, nullptr, "stiffness[0]");
1083 RNA_def_property_range(prop, 0.0f, 0.99f);
1084 RNA_def_property_ui_text(prop, "IK X Stiffness", "IK stiffness around the X axis");
1085 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1086 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1087
1088 prop = RNA_def_property(srna, "ik_stiffness_y", PROP_FLOAT, PROP_NONE);
1089 RNA_def_property_float_sdna(prop, nullptr, "stiffness[1]");
1090 RNA_def_property_range(prop, 0.0f, 0.99f);
1091 RNA_def_property_ui_text(prop, "IK Y Stiffness", "IK stiffness around the Y axis");
1092 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1093 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1094
1095 prop = RNA_def_property(srna, "ik_stiffness_z", PROP_FLOAT, PROP_NONE);
1096 RNA_def_property_float_sdna(prop, nullptr, "stiffness[2]");
1097 RNA_def_property_range(prop, 0.0f, 0.99f);
1098 RNA_def_property_ui_text(prop, "IK Z Stiffness", "IK stiffness around the Z axis");
1099 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1100 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1101
1102 prop = RNA_def_property(srna, "ik_stretch", PROP_FLOAT, PROP_FACTOR);
1103 RNA_def_property_float_sdna(prop, nullptr, "ikstretch");
1104 RNA_def_property_range(prop, 0.0f, 1.0f);
1105 RNA_def_property_ui_text(prop, "IK Stretch", "Allow scaling of the bone for IK");
1106 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1107 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1108
1109 prop = RNA_def_property(srna, "ik_rotation_weight", PROP_FLOAT, PROP_FACTOR);
1110 RNA_def_property_float_sdna(prop, nullptr, "ikrotweight");
1111 RNA_def_property_range(prop, 0.0f, 1.0f);
1112 RNA_def_property_ui_text(prop, "IK Rotation Weight", "Weight of rotation constraint for IK");
1113 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1114 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1115
1116 prop = RNA_def_property(srna, "ik_linear_weight", PROP_FLOAT, PROP_FACTOR);
1117 RNA_def_property_float_sdna(prop, nullptr, "iklinweight");
1118 RNA_def_property_range(prop, 0.0f, 1.0f);
1119 RNA_def_property_ui_text(prop, "IK Lin Weight", "Weight of scale constraint for IK");
1120 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1121 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1122
1123 /* custom bone shapes */
1124 prop = RNA_def_property(srna, "custom_shape", PROP_POINTER, PROP_NONE);
1125 RNA_def_property_pointer_sdna(prop, nullptr, "custom");
1126 RNA_def_property_struct_type(prop, "Object");
1130 prop, "Custom Object", "Object that defines custom display shape for this bone");
1131 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1133 prop, nullptr, "rna_Pose_custom_shape_set", nullptr, "rna_Pose_custom_shape_object_poll");
1134 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
1135
1136 prop = RNA_def_property(srna, "custom_shape_scale_xyz", PROP_FLOAT, PROP_XYZ);
1137 RNA_def_property_float_sdna(prop, nullptr, "custom_scale_xyz");
1140 RNA_def_property_ui_text(prop, "Custom Shape Scale", "Adjust the size of the custom shape");
1141 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1142
1143 prop = RNA_def_property(srna, "custom_shape_translation", PROP_FLOAT, PROP_XYZ);
1144 RNA_def_property_float_sdna(prop, nullptr, "custom_translation");
1147 prop, "Custom Shape Translation", "Adjust the location of the custom shape");
1149 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1150
1151 prop = RNA_def_property(srna, "custom_shape_rotation_euler", PROP_FLOAT, PROP_EULER);
1152 RNA_def_property_float_sdna(prop, nullptr, "custom_rotation_euler");
1154 prop, "Custom Shape Rotation", "Adjust the rotation of the custom shape");
1156 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1157
1158 prop = RNA_def_property(srna, "use_custom_shape_bone_size", PROP_BOOLEAN, PROP_NONE);
1160 prop, nullptr, "drawflag", PCHAN_DRAW_NO_CUSTOM_BONE_SIZE);
1162 prop, "Scale to Bone Length", "Scale the custom object by the bone length");
1163 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1164
1165 prop = RNA_def_property(srna, "custom_shape_transform", PROP_POINTER, PROP_NONE);
1166 RNA_def_property_pointer_sdna(prop, nullptr, "custom_tx");
1167 RNA_def_property_struct_type(prop, "PoseBone");
1171 "Custom Shape Transform",
1172 "Bone that defines the display transform of this custom shape");
1173 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1175 prop, nullptr, "rna_PoseChannel_custom_shape_transform_set", nullptr, nullptr);
1176 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1177
1178 prop = RNA_def_property(srna, "custom_shape_wire_width", PROP_FLOAT, PROP_NONE);
1179 RNA_def_property_float_sdna(prop, nullptr, "custom_shape_wire_width");
1180 RNA_def_property_ui_text(prop, "Wire Width", "Adjust the line thickness of custom shapes");
1181 /* When changing the upper limit of the range, also adjust the WIRE_WIDTH_COMPRESSION in
1182 * overlay_shader_shared.hh */
1183 RNA_def_property_range(prop, 1.0f, 16.0f);
1184 RNA_def_property_ui_range(prop, 1.0f, 10.0f, 1, 1);
1185 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1186
1187 prop = RNA_def_property(srna, "color", PROP_POINTER, PROP_NONE);
1188 RNA_def_property_struct_type(prop, "BoneColor");
1191
1192 /* transform locks */
1193 prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
1194 RNA_def_property_boolean_bitset_array_sdna(prop, nullptr, "protectflag", OB_LOCK_LOCX, 3);
1195 RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location when transforming");
1196 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1198 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1199 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1200
1201 prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
1202 RNA_def_property_boolean_bitset_array_sdna(prop, nullptr, "protectflag", OB_LOCK_ROTX, 3);
1203 RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation when transforming");
1204 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1206 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1207 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1208
1209 /* XXX this is sub-optimal - it really should be included above, but due to technical reasons
1210 * we can't do this! */
1211 prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
1212 RNA_def_property_boolean_sdna(prop, nullptr, "protectflag", OB_LOCK_ROTW);
1214 prop,
1215 "Lock Rotation (4D Angle)",
1216 "Lock editing of 'angle' component of four-component rotations when transforming");
1217 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1219 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1220 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1221
1222 /* XXX this needs a better name */
1223 prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
1224 RNA_def_property_boolean_sdna(prop, nullptr, "protectflag", OB_LOCK_ROT4D);
1226 prop,
1227 "Lock Rotations (4D)",
1228 "Lock editing of four component rotations by components (instead of as Eulers)");
1230 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1231 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1232
1233 prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
1234 RNA_def_property_boolean_bitset_array_sdna(prop, nullptr, "protectflag", OB_LOCK_SCALEX, 3);
1235 RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale when transforming");
1236 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1238 RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1239 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1240
1242}
1243
1245{
1246 static const EnumPropertyItem prop_itasc_mode_items[] = {
1247 {0,
1248 "ANIMATION",
1249 0,
1250 "Animation",
1251 "Stateless solver computing pose starting from current action and non-IK constraints"},
1253 "SIMULATION",
1254 0,
1255 "Simulation",
1256 "State-full solver running in real-time context and ignoring actions "
1257 "and non-IK constraints"},
1258 {0, nullptr, 0, nullptr, nullptr},
1259 };
1260 static const EnumPropertyItem prop_itasc_reiteration_items[] = {
1261 {0,
1262 "NEVER",
1263 0,
1264 "Never",
1265 "The solver does not reiterate, not even on first frame (starts from rest pose)"},
1267 "INITIAL",
1268 0,
1269 "Initial",
1270 "The solver reiterates (converges) on the first frame but not on "
1271 "subsequent frame"},
1273 "ALWAYS",
1274 0,
1275 "Always",
1276 "The solver reiterates (converges) on all frames"},
1277 {0, nullptr, 0, nullptr, nullptr},
1278 };
1279
1280 StructRNA *srna;
1281 PropertyRNA *prop;
1282
1283 srna = RNA_def_struct(brna, "Itasc", "IKParam");
1284 RNA_def_struct_sdna(srna, "bItasc");
1285 RNA_def_struct_ui_text(srna, "bItasc", "Parameters for the iTaSC IK solver");
1286
1287 prop = RNA_def_property(srna, "precision", PROP_FLOAT, PROP_NONE);
1288 RNA_def_property_float_sdna(prop, nullptr, "precision");
1289 RNA_def_property_range(prop, 0.0f, 0.1f);
1290 RNA_def_property_ui_text(prop, "Precision", "Precision of convergence in case of reiteration");
1291 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1292
1293 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
1294 RNA_def_property_int_sdna(prop, nullptr, "numiter");
1295 RNA_def_property_range(prop, 0, 1000);
1297 prop, "Iterations", "Maximum number of iterations for convergence in case of reiteration");
1298 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1299
1300 prop = RNA_def_property(srna, "step_count", PROP_INT, PROP_NONE);
1301 RNA_def_property_int_sdna(prop, nullptr, "numstep");
1302 RNA_def_property_range(prop, 1.0f, 50.0f);
1303 RNA_def_property_ui_text(prop, "Num Steps", "Divide the frame interval into this many steps");
1304 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1305
1306 prop = RNA_def_property(srna, "translate_root_bones", PROP_BOOLEAN, PROP_NONE);
1309 prop, "Translate Roots", "Translate root (i.e. parentless) bones to the armature origin");
1310 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1311
1312 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1313 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1314 RNA_def_property_enum_items(prop, prop_itasc_mode_items);
1315 RNA_def_property_ui_text(prop, "Mode", nullptr);
1316 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update_rebuild");
1317
1318 prop = RNA_def_property(srna, "reiteration_method", PROP_ENUM, PROP_NONE);
1319 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1320 RNA_def_property_enum_items(prop, prop_itasc_reiteration_items);
1322 "Reiteration",
1323 "Defines if the solver is allowed to reiterate (converge until "
1324 "precision is met) on none, first or all frames");
1325 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1326
1327 prop = RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
1328 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ITASC_AUTO_STEP);
1330 "Auto Step",
1331 "Automatically determine the optimal number of steps for best "
1332 "performance/accuracy trade off");
1333 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1334
1335 prop = RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_FACTOR);
1336 RNA_def_property_float_sdna(prop, nullptr, "minstep");
1337 RNA_def_property_range(prop, 0.0f, 0.1f);
1339 prop, "Min Step", "Lower bound for timestep in second in case of automatic substeps");
1340 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1341
1342 prop = RNA_def_property(srna, "step_max", PROP_FLOAT, PROP_FACTOR);
1343 RNA_def_property_float_sdna(prop, nullptr, "maxstep");
1344 RNA_def_property_range(prop, 0.0f, 1.0f);
1346 prop, "Max Step", "Higher bound for timestep in second in case of automatic substeps");
1347 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1348
1349 prop = RNA_def_property(srna, "feedback", PROP_FLOAT, PROP_NONE);
1350 RNA_def_property_float_sdna(prop, nullptr, "feedback");
1351 RNA_def_property_range(prop, 0.0f, 100.0f);
1353 prop,
1354 "Feedback",
1355 "Feedback coefficient for error correction, average response time is 1/feedback");
1356 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1357
1358 prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
1359 RNA_def_property_float_sdna(prop, nullptr, "maxvel");
1360 RNA_def_property_range(prop, 0.0f, 100.0f);
1361 RNA_def_property_ui_text(prop, "Max Velocity", "Maximum joint velocity in radians/second");
1362 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1363
1364 prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
1365 RNA_def_property_enum_sdna(prop, nullptr, "solver");
1368 prop, "Solver", "Solving method selection: automatic damping or manual damping");
1369 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update_rebuild");
1370
1371 prop = RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_FACTOR);
1372 RNA_def_property_float_sdna(prop, nullptr, "dampmax");
1373 RNA_def_property_range(prop, 0.0f, 1.0f);
1375 "Damp",
1376 "Maximum damping coefficient when singular value is nearly 0 "
1377 "(higher values produce results with more stability, less reactivity)");
1378 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1379
1380 prop = RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_FACTOR);
1381 RNA_def_property_float_sdna(prop, nullptr, "dampeps");
1382 RNA_def_property_range(prop, 0.0f, 1.0f);
1384 "Epsilon",
1385 "Singular value under which damping is progressively applied "
1386 "(higher values produce results with more stability, less reactivity)");
1387 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1388}
1389
1391{
1392 StructRNA *srna;
1393 PropertyRNA *prop;
1394
1395 srna = RNA_def_struct(brna, "IKParam", nullptr);
1396 RNA_def_struct_sdna(srna, "bIKParam");
1397 RNA_def_struct_ui_text(srna, "IKParam", "Base type for IK solver parameters");
1398 RNA_def_struct_refine_func(srna, "rna_IKParam_refine");
1399
1400 prop = RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
1401 RNA_def_property_enum_sdna(prop, nullptr, "iksolver");
1404 RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these parameters are defined");
1405}
1406
1407static void rna_def_pose(BlenderRNA *brna)
1408{
1409 StructRNA *srna;
1410 PropertyRNA *prop;
1411
1412 /* struct definition */
1413 srna = RNA_def_struct(brna, "Pose", nullptr);
1414 RNA_def_struct_sdna(srna, "bPose");
1416 srna, "Pose", "A collection of pose channels, including settings for animating bones");
1417
1418 /* pose channels */
1419 prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
1420 RNA_def_property_collection_sdna(prop, nullptr, "chanbase", nullptr);
1421 RNA_def_property_struct_type(prop, "PoseBone");
1423 RNA_def_property_ui_text(prop, "Pose Bones", "Individual pose bones for the armature");
1424 /* can be removed, only for fast lookup */
1426 nullptr,
1427 nullptr,
1428 nullptr,
1429 nullptr,
1430 nullptr,
1431 nullptr,
1432 "rna_PoseBones_lookup_string",
1433 nullptr);
1434
1435 /* ik solvers */
1436 prop = RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
1437 RNA_def_property_enum_sdna(prop, nullptr, "iksolver");
1438 RNA_def_property_enum_funcs(prop, nullptr, "rna_Pose_ik_solver_set", nullptr);
1440 RNA_def_property_ui_text(prop, "IK Solver", "Selection of IK solver for IK chain");
1441 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_ik_solver_update");
1442
1443 prop = RNA_def_property(srna, "ik_param", PROP_POINTER, PROP_NONE);
1444 RNA_def_property_struct_type(prop, "IKParam");
1446 prop, "rna_Pose_ikparam_get", nullptr, "rna_Pose_ikparam_typef", nullptr);
1448 RNA_def_property_ui_text(prop, "IK Param", "Parameters for IK solver");
1449
1451
1452 /* pose edit options */
1453 prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
1454 RNA_def_property_boolean_sdna(prop, nullptr, "flag", POSE_MIRROR_EDIT);
1456 prop, "X-Axis Mirror", "Apply changes to matching bone on opposite side of X-Axis");
1457 RNA_def_struct_path_func(srna, "rna_Pose_path");
1458 RNA_def_property_update(prop, 0, "rna_Pose_update");
1460
1461 prop = RNA_def_property(srna, "use_mirror_relative", PROP_BOOLEAN, PROP_NONE);
1464 prop,
1465 "Relative Mirror",
1466 "Apply relative transformations in X-mirror mode (not supported with Auto IK)");
1467 RNA_def_struct_path_func(srna, "rna_Pose_path");
1468 RNA_def_property_update(prop, 0, "rna_Pose_update");
1470
1471 prop = RNA_def_property(srna, "use_auto_ik", PROP_BOOLEAN, PROP_NONE);
1472 RNA_def_property_boolean_sdna(prop, nullptr, "flag", POSE_AUTO_IK);
1474 prop, "Auto IK", "Add temporary IK constraints while grabbing bones in Pose Mode");
1475 RNA_def_struct_path_func(srna, "rna_Pose_path");
1476 RNA_def_property_update(prop, 0, "rna_Pose_update");
1478
1480
1481 /* animviz */
1483
1484 RNA_api_pose(srna);
1485}
1486
1488{
1489 rna_def_pose(brna);
1492 rna_def_pose_itasc(brna);
1493}
1494
1495#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])
Definition armature.cc:2323
void BKE_pchan_apply_mat4(bPoseChannel *pchan, const float mat[4][4], bool use_compat)
Definition armature.cc:2389
void BKE_pchan_to_mat4(const bPoseChannel *pchan, float r_chanmat[4][4])
Definition armature.cc:2947
void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode)
Definition armature.cc:2414
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:353
void id_us_min(ID *id)
Definition lib_id.cc:361
bool BKE_id_is_in_global_main(ID *id)
Definition lib_id.cc:2480
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:126
#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
MINLINE int clamp_i(int value, int min, int max)
#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:688
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:962
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:982
@ LIBOVERRIDE_OP_INSERT_AFTER
Definition DNA_ID.h:230
@ ID_OB
@ ITASC_SOLVER_SDLS
@ ITASC_SOLVER_DLS
@ IKSOLVER_STANDARD
@ IKSOLVER_ITASC
@ ROT_MODE_MAX
@ ROT_MODE_MIN
@ 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_NO_CUSTOM_BONE_SIZE
@ POSE_AUTO_IK
@ POSE_MIRROR_EDIT
@ POSE_MIRROR_RELATIVE
@ CONSTRAINT_OVERRIDE_LIBRARY_LOCAL
@ CONSTRAINT_TYPE_SPLINEIK
@ CONSTRAINT_TYPE_KINEMATIC
Object is a sort of wrapper for general info.
@ 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
@ OB_ARMATURE
Read Guarded memory(de)allocation.
ParameterFlag
Definition RNA_types.hh:510
@ PARM_RNAPTR
Definition RNA_types.hh:513
@ PARM_REQUIRED
Definition RNA_types.hh:511
@ FUNC_USE_REPORTS
Definition RNA_types.hh:805
@ FUNC_USE_MAIN
Definition RNA_types.hh:803
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:792
@ PROP_FLOAT
Definition RNA_types.hh:152
@ PROP_BOOLEAN
Definition RNA_types.hh:150
@ PROP_ENUM
Definition RNA_types.hh:154
@ PROP_INT
Definition RNA_types.hh:151
@ PROP_STRING
Definition RNA_types.hh:153
@ PROP_POINTER
Definition RNA_types.hh:155
@ PROP_COLLECTION
Definition RNA_types.hh:156
#define RNA_TRANSLATION_PREC_DEFAULT
Definition RNA_types.hh:212
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:469
@ PROPOVERRIDE_NO_COMPARISON
Definition RNA_types.hh:477
@ PROPOVERRIDE_LIBRARY_INSERTION
Definition RNA_types.hh:494
PropertyFlag
Definition RNA_types.hh:286
@ PROP_THICK_WRAP
Definition RNA_types.hh:397
@ PROP_ANIMATABLE
Definition RNA_types.hh:305
@ PROP_PROPORTIONAL
Definition RNA_types.hh:335
@ PROP_EDITABLE
Definition RNA_types.hh:292
@ PROP_LIB_EXCEPTION
Definition RNA_types.hh:298
@ PROP_NEVER_NULL
Definition RNA_types.hh:351
@ PROP_PTR_NO_OWNERSHIP
Definition RNA_types.hh:369
@ PROP_ID_REFCOUNT
Definition RNA_types.hh:338
@ PROP_MATRIX
Definition RNA_types.hh:253
@ PROP_XYZ
Definition RNA_types.hh:257
@ PROP_DISTANCE
Definition RNA_types.hh:244
@ PROP_ANGLE
Definition RNA_types.hh:240
@ PROP_AXISANGLE
Definition RNA_types.hh:256
@ PROP_EULER
Definition RNA_types.hh:254
@ PROP_NONE
Definition RNA_types.hh:221
@ PROP_FACTOR
Definition RNA_types.hh:239
@ PROP_TRANSLATION
Definition RNA_types.hh:249
@ PROP_QUATERNION
Definition RNA_types.hh:255
#define NC_GEOM
Definition WM_types.hh:390
#define ND_DATA
Definition WM_types.hh:506
#define NC_ANIMATION
Definition WM_types.hh:385
#define NA_ADDED
Definition WM_types.hh:583
#define ND_POSE
Definition WM_types.hh:455
ReportList * reports
Definition WM_types.hh:1025
#define ND_CONSTRAINT
Definition WM_types.hh:461
#define NA_REMOVED
Definition WM_types.hh:584
#define NA_RENAME
Definition WM_types.hh:585
#define NC_OBJECT
Definition WM_types.hh:376
#define ND_ANIMCHAN
Definition WM_types.hh:493
void ED_armature_bone_rename(Main *bmain, bArmature *arm, const char *oldnamep, const char *newnamep)
#define offsetof(t, d)
#define main()
#define ID_IS_OVERRIDE_LIBRARY(_id)
#define GS(a)
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)
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_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:1390
static const EnumPropertyItem prop_solver_items[]
Definition rna_pose.cc:708
const EnumPropertyItem rna_enum_color_sets_items[]
Definition rna_pose.cc:29
static void rna_def_pose_channel(BlenderRNA *brna)
Definition rna_pose.cc:785
static void rna_def_pose(BlenderRNA *brna)
Definition rna_pose.cc:1407
static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cprop)
Definition rna_pose.cc:714
static const EnumPropertyItem prop_iksolver_items[]
Definition rna_pose.cc:702
static void rna_def_pose_itasc(BlenderRNA *brna)
Definition rna_pose.cc:1244
void RNA_def_pose(BlenderRNA *brna)
Definition rna_pose.cc:1487
void rna_def_actionbone_group_common(StructRNA *srna, int update_flag, const char *update_cb)
Definition rna_pose.cc:673
#define FLT_MAX
Definition stdcycles.h:14
Definition DNA_ID.h:404
char name[66]
Definition DNA_ID.h:415
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
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4227