Blender  V3.3
rna_pose.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include <stdlib.h>
8 #include <string.h>
9 
10 #include "RNA_define.h"
11 #include "RNA_enum_types.h"
12 
13 #include "rna_internal.h"
14 
15 #include "DNA_action_types.h"
16 #include "DNA_armature_types.h"
17 #include "DNA_constraint_types.h"
18 #include "DNA_object_types.h"
19 #include "DNA_scene_types.h"
20 
21 #include "BLI_math.h"
22 
23 #include "BLT_translation.h"
24 
25 #include "UI_resources.h"
26 
27 #include "WM_types.h"
28 
29 /* Bone and Group Color Sets */
31  {0, "DEFAULT", 0, "Default Colors", ""},
32  {1, "THEME01", ICON_COLORSET_01_VEC, "01 - Theme Color Set", ""},
33  {2, "THEME02", ICON_COLORSET_02_VEC, "02 - Theme Color Set", ""},
34  {3, "THEME03", ICON_COLORSET_03_VEC, "03 - Theme Color Set", ""},
35  {4, "THEME04", ICON_COLORSET_04_VEC, "04 - Theme Color Set", ""},
36  {5, "THEME05", ICON_COLORSET_05_VEC, "05 - Theme Color Set", ""},
37  {6, "THEME06", ICON_COLORSET_06_VEC, "06 - Theme Color Set", ""},
38  {7, "THEME07", ICON_COLORSET_07_VEC, "07 - Theme Color Set", ""},
39  {8, "THEME08", ICON_COLORSET_08_VEC, "08 - Theme Color Set", ""},
40  {9, "THEME09", ICON_COLORSET_09_VEC, "09 - Theme Color Set", ""},
41  {10, "THEME10", ICON_COLORSET_10_VEC, "10 - Theme Color Set", ""},
42  {11, "THEME11", ICON_COLORSET_11_VEC, "11 - Theme Color Set", ""},
43  {12, "THEME12", ICON_COLORSET_12_VEC, "12 - Theme Color Set", ""},
44  {13, "THEME13", ICON_COLORSET_13_VEC, "13 - Theme Color Set", ""},
45  {14, "THEME14", ICON_COLORSET_14_VEC, "14 - Theme Color Set", ""},
46  {15, "THEME15", ICON_COLORSET_15_VEC, "15 - Theme Color Set", ""},
47  {16, "THEME16", ICON_COLORSET_16_VEC, "16 - Theme Color Set", ""},
48  {17, "THEME17", ICON_COLORSET_17_VEC, "17 - Theme Color Set", ""},
49  {18, "THEME18", ICON_COLORSET_18_VEC, "18 - Theme Color Set", ""},
50  {19, "THEME19", ICON_COLORSET_19_VEC, "19 - Theme Color Set", ""},
51  {20, "THEME20", ICON_COLORSET_20_VEC, "20 - Theme Color Set", ""},
52  {-1, "CUSTOM", 0, "Custom Color Set", ""},
53  {0, NULL, 0, NULL, NULL},
54 };
55 
56 #ifdef RNA_RUNTIME
57 
58 # include "BLI_ghash.h"
59 # include "BLI_string_utils.h"
60 
61 # include "BIK_api.h"
62 # include "BKE_action.h"
63 # include "BKE_armature.h"
64 
65 # include "DNA_userdef_types.h"
66 
67 # include "MEM_guardedalloc.h"
68 
69 # include "BKE_constraint.h"
70 # include "BKE_context.h"
71 # include "BKE_global.h"
72 # include "BKE_idprop.h"
73 
74 # include "DEG_depsgraph.h"
75 # include "DEG_depsgraph_build.h"
76 
77 # include "ED_armature.h"
78 # include "ED_object.h"
79 
80 # include "WM_api.h"
81 
82 # include "RNA_access.h"
83 
84 static void rna_Pose_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
85 {
86  /* XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); */
87 
90 }
91 
92 static void rna_Pose_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
93 {
95 
98 }
99 
100 static void rna_Pose_IK_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
101 {
102  /* XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); */
103  Object *ob = (Object *)ptr->owner_id;
104 
107 
108  BIK_clear_data(ob->pose);
109 }
110 
111 static char *rna_Pose_path(const PointerRNA *UNUSED(ptr))
112 {
113  return BLI_strdup("pose");
114 }
115 
116 static char *rna_PoseBone_path(const PointerRNA *ptr)
117 {
118  const bPoseChannel *pchan = ptr->data;
119  char name_esc[sizeof(pchan->name) * 2];
120 
121  BLI_str_escape(name_esc, pchan->name, sizeof(name_esc));
122  return BLI_sprintfN("pose.bones[\"%s\"]", name_esc);
123 }
124 
125 /* Bone groups only. */
126 
127 static bool rna_bone_group_poll(Object *ob, ReportList *reports)
128 {
129  if (ID_IS_OVERRIDE_LIBRARY(ob)) {
130  BKE_report(reports, RPT_ERROR, "Cannot edit bone groups for proxies or library overrides");
131  return false;
132  }
133 
134  return true;
135 }
136 
137 static bActionGroup *rna_bone_group_new(ID *id, bPose *pose, ReportList *reports, const char *name)
138 {
139  if (!rna_bone_group_poll((Object *)id, reports)) {
140  return NULL;
141  }
142 
143  bActionGroup *grp = BKE_pose_add_group(pose, name);
145  return grp;
146 }
147 
148 static void rna_bone_group_remove(ID *id, bPose *pose, ReportList *reports, PointerRNA *grp_ptr)
149 {
150  if (!rna_bone_group_poll((Object *)id, reports)) {
151  return;
152  }
153 
154  bActionGroup *grp = grp_ptr->data;
155  const int grp_idx = BLI_findindex(&pose->agroups, grp);
156 
157  if (grp_idx == -1) {
158  BKE_reportf(reports, RPT_ERROR, "Bone group '%s' not found in this object", grp->name);
159  return;
160  }
161 
162  BKE_pose_remove_group(pose, grp, grp_idx + 1);
164 }
165 
166 /* shared for actions groups and bone groups */
167 
169 {
170  Object *ob = (Object *)ptr->owner_id;
171  if (!rna_bone_group_poll(ob, NULL)) {
172  return;
173  }
174 
175  bActionGroup *grp = ptr->data;
176 
177  /* ensure only valid values get set */
178  if ((value >= -1) && (value < 21)) {
179  grp->customCol = value;
180 
181  /* sync colors stored with theme colors based on the index specified */
183  }
184 }
185 
187 {
188  bActionGroup *grp = ptr->data;
189 
190  return (grp->customCol < 0);
191 }
192 
193 static void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value)
194 {
195  Object *ob = (Object *)ptr->owner_id;
196  if (!rna_bone_group_poll(ob, NULL)) {
197  return;
198  }
199 
200  bActionGroup *agrp = ptr->data;
201 
202  /* copy the new name into the name slot */
203  BLI_strncpy_utf8(agrp->name, value, sizeof(agrp->name));
204 
206  agrp,
208  '.',
209  offsetof(bActionGroup, name),
210  sizeof(agrp->name));
211 }
212 
213 static IDProperty **rna_PoseBone_idprops(PointerRNA *ptr)
214 {
215  bPoseChannel *pchan = ptr->data;
216  return &pchan->prop;
217 }
218 
219 static void rna_Pose_ik_solver_set(struct PointerRNA *ptr, int value)
220 {
221  bPose *pose = (bPose *)ptr->data;
222 
223  if (pose->iksolver != value) {
224  /* the solver has changed, must clean any temporary structures */
225  BIK_clear_data(pose);
226  if (pose->ikparam) {
227  MEM_freeN(pose->ikparam);
228  pose->ikparam = NULL;
229  }
230  pose->iksolver = value;
231  BKE_pose_ikparam_init(pose);
232  }
233 }
234 
235 static void rna_Pose_ik_solver_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
236 {
237  Object *ob = (Object *)ptr->owner_id;
238  bPose *pose = ptr->data;
239 
240  BKE_pose_tag_recalc(bmain, pose); /* checks & sorts pose channels */
242 
244 
245  object_test_constraints(bmain, ob);
246 
248 }
249 
250 /* rotation - axis-angle */
251 static void rna_PoseChannel_rotation_axis_angle_get(PointerRNA *ptr, float *value)
252 {
253  bPoseChannel *pchan = ptr->data;
254 
255  /* for now, assume that rotation mode is axis-angle */
256  value[0] = pchan->rotAngle;
257  copy_v3_v3(&value[1], pchan->rotAxis);
258 }
259 
260 /* rotation - axis-angle */
261 static void rna_PoseChannel_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
262 {
263  bPoseChannel *pchan = ptr->data;
264 
265  /* for now, assume that rotation mode is axis-angle */
266  pchan->rotAngle = value[0];
267  copy_v3_v3(pchan->rotAxis, &value[1]);
268 
269  /* TODO: validate axis? */
270 }
271 
272 static void rna_PoseChannel_rotation_mode_set(PointerRNA *ptr, int value)
273 {
274  bPoseChannel *pchan = ptr->data;
275 
276  /* use API Method for conversions... */
278  pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode, (short)value);
279 
280  /* finally, set the new rotation type */
281  pchan->rotmode = value;
282 }
283 
284 static float rna_PoseChannel_length_get(PointerRNA *ptr)
285 {
286  bPoseChannel *pchan = ptr->data;
287  return len_v3v3(pchan->pose_head, pchan->pose_tail);
288 }
289 
290 static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value)
291 {
292  Object *ob = (Object *)ptr->owner_id;
293  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
294  char oldname[sizeof(pchan->name)], newname[sizeof(pchan->name)];
295 
296  /* need to be on the stack */
297  BLI_strncpy_utf8(newname, value, sizeof(pchan->name));
298  BLI_strncpy(oldname, pchan->name, sizeof(pchan->name));
299 
302  ED_armature_bone_rename(G_MAIN, ob->data, oldname, newname);
303 }
304 
305 /* See rna_Bone_update_renamed() */
306 static void rna_PoseChannel_name_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
307 {
308  ID *id = ptr->owner_id;
309 
310  /* redraw view */
312 
313  /* update animation channels */
315 }
316 
317 static PointerRNA rna_PoseChannel_bone_get(PointerRNA *ptr)
318 {
319  Object *ob = (Object *)ptr->owner_id;
320  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
321  PointerRNA tmp_ptr = *ptr;
322 
323  /* Replace the id_data pointer with the Armature ID. */
324  tmp_ptr.owner_id = ob->data;
325 
326  return rna_pointer_inherit_refine(&tmp_ptr, &RNA_Bone, pchan->bone);
327 }
328 
329 static bool rna_PoseChannel_has_ik_get(PointerRNA *ptr)
330 {
331  Object *ob = (Object *)ptr->owner_id;
332  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
333 
334  return BKE_pose_channel_in_IK_chain(ob, pchan);
335 }
336 
337 static StructRNA *rna_IKParam_refine(PointerRNA *ptr)
338 {
339  bIKParam *param = (bIKParam *)ptr->data;
340 
341  switch (param->iksolver) {
342  case IKSOLVER_ITASC:
343  return &RNA_Itasc;
344  default:
345  return &RNA_IKParam;
346  }
347 }
348 
349 static PointerRNA rna_Pose_ikparam_get(struct PointerRNA *ptr)
350 {
351  bPose *pose = (bPose *)ptr->data;
352  return rna_pointer_inherit_refine(ptr, &RNA_IKParam, pose->ikparam);
353 }
354 
355 static StructRNA *rna_Pose_ikparam_typef(PointerRNA *ptr)
356 {
357  bPose *pose = (bPose *)ptr->data;
358 
359  switch (pose->iksolver) {
360  case IKSOLVER_ITASC:
361  return &RNA_Itasc;
362  default:
363  return &RNA_IKParam;
364  }
365 }
366 
367 static void rna_Itasc_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
368 {
369  Object *ob = (Object *)ptr->owner_id;
370  bItasc *itasc = ptr->data;
371 
372  /* verify values */
373  if (itasc->precision < 0.0001f) {
374  itasc->precision = 0.0001f;
375  }
376  if (itasc->minstep < 0.001f) {
377  itasc->minstep = 0.001f;
378  }
379  if (itasc->maxstep < itasc->minstep) {
380  itasc->maxstep = itasc->minstep;
381  }
382  if (itasc->feedback < 0.01f) {
383  itasc->feedback = 0.01f;
384  }
385  if (itasc->feedback > 100.0f) {
386  itasc->feedback = 100.0f;
387  }
388  if (itasc->maxvel < 0.01f) {
389  itasc->maxvel = 0.01f;
390  }
391  if (itasc->maxvel > 100.0f) {
392  itasc->maxvel = 100.0f;
393  }
394  BIK_update_param(ob->pose);
395 
397 }
398 
399 static void rna_Itasc_update_rebuild(Main *bmain, Scene *scene, PointerRNA *ptr)
400 {
401  Object *ob = (Object *)ptr->owner_id;
402  bPose *pose = ob->pose;
403 
404  BKE_pose_tag_recalc(bmain, pose); /* checks & sorts pose channels */
405  rna_Itasc_update(bmain, scene, ptr);
406 }
407 
408 static PointerRNA rna_PoseChannel_bone_group_get(PointerRNA *ptr)
409 {
410  Object *ob = (Object *)ptr->owner_id;
411  bPose *pose = (ob) ? ob->pose : NULL;
412  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
413  bActionGroup *grp;
414 
415  if (pose) {
416  grp = BLI_findlink(&pose->agroups, pchan->agrp_index - 1);
417  }
418  else {
419  grp = NULL;
420  }
421 
422  return rna_pointer_inherit_refine(ptr, &RNA_BoneGroup, grp);
423 }
424 
425 static void rna_PoseChannel_bone_group_set(PointerRNA *ptr,
426  PointerRNA value,
427  struct ReportList *UNUSED(reports))
428 {
429  Object *ob = (Object *)ptr->owner_id;
430  bPose *pose = (ob) ? ob->pose : NULL;
431  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
432 
433  if (pose) {
434  pchan->agrp_index = BLI_findindex(&pose->agroups, value.data) + 1;
435  }
436  else {
437  pchan->agrp_index = 0;
438  }
439 }
440 
441 static int rna_PoseChannel_bone_group_index_get(PointerRNA *ptr)
442 {
443  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
444  return MAX2(pchan->agrp_index - 1, 0);
445 }
446 
447 static void rna_PoseChannel_bone_group_index_set(PointerRNA *ptr, int value)
448 {
449  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
450  pchan->agrp_index = value + 1;
451 }
452 
453 static void rna_PoseChannel_bone_group_index_range(
454  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
455 {
456  Object *ob = (Object *)ptr->owner_id;
457  bPose *pose = (ob) ? ob->pose : NULL;
458 
459  *min = 0;
460  *max = pose ? max_ii(0, BLI_listbase_count(&pose->agroups) - 1) : 0;
461 }
462 
463 static PointerRNA rna_Pose_active_bone_group_get(PointerRNA *ptr)
464 {
465  bPose *pose = (bPose *)ptr->data;
467  ptr, &RNA_BoneGroup, BLI_findlink(&pose->agroups, pose->active_group - 1));
468 }
469 
470 static void rna_Pose_active_bone_group_set(PointerRNA *ptr,
471  PointerRNA value,
472  struct ReportList *UNUSED(reports))
473 {
474  bPose *pose = (bPose *)ptr->data;
475  pose->active_group = BLI_findindex(&pose->agroups, value.data) + 1;
476 }
477 
478 static int rna_Pose_active_bone_group_index_get(PointerRNA *ptr)
479 {
480  bPose *pose = (bPose *)ptr->data;
481  return MAX2(pose->active_group - 1, 0);
482 }
483 
484 static void rna_Pose_active_bone_group_index_set(PointerRNA *ptr, int value)
485 {
486  bPose *pose = (bPose *)ptr->data;
487  pose->active_group = value + 1;
488 }
489 
490 static void rna_Pose_active_bone_group_index_range(
491  PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
492 {
493  bPose *pose = (bPose *)ptr->data;
494 
495  *min = 0;
496  *max = max_ii(0, BLI_listbase_count(&pose->agroups) - 1);
497 }
498 
499 # if 0
500 static void rna_pose_bgroup_name_index_get(PointerRNA *ptr, char *value, int index)
501 {
502  bPose *pose = (bPose *)ptr->data;
503  bActionGroup *grp;
504 
505  grp = BLI_findlink(&pose->agroups, index - 1);
506 
507  if (grp) {
508  BLI_strncpy(value, grp->name, sizeof(grp->name));
509  }
510  else {
511  value[0] = '\0';
512  }
513 }
514 
515 static int rna_pose_bgroup_name_index_length(PointerRNA *ptr, int index)
516 {
517  bPose *pose = (bPose *)ptr->data;
518  bActionGroup *grp;
519 
520  grp = BLI_findlink(&pose->agroups, index - 1);
521  return (grp) ? strlen(grp->name) : 0;
522 }
523 
524 static void rna_pose_bgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
525 {
526  bPose *pose = (bPose *)ptr->data;
527  bActionGroup *grp;
528  int a;
529 
530  for (a = 1, grp = pose->agroups.first; grp; grp = grp->next, a++) {
531  if (STREQ(grp->name, value)) {
532  *index = a;
533  return;
534  }
535  }
536 
537  *index = 0;
538 }
539 
540 static void rna_pose_pgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
541 {
542  bPose *pose = (bPose *)ptr->data;
543  bActionGroup *grp;
544 
545  for (grp = pose->agroups.first; grp; grp = grp->next) {
546  if (STREQ(grp->name, value)) {
547  BLI_strncpy(result, value, maxlen);
548  return;
549  }
550  }
551 
552  result[0] = '\0';
553 }
554 # endif
555 
556 static PointerRNA rna_PoseChannel_active_constraint_get(PointerRNA *ptr)
557 {
558  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
560  return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
561 }
562 
563 static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr,
564  PointerRNA value,
565  struct ReportList *UNUSED(reports))
566 {
567  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
569 }
570 
571 static bConstraint *rna_PoseChannel_constraints_new(ID *id,
572  bPoseChannel *pchan,
573  Main *main,
574  int type)
575 {
576  Object *ob = (Object *)id;
577  bConstraint *new_con = BKE_constraint_add_for_pose(ob, pchan, NULL, type);
578 
581 
582  return new_con;
583 }
584 
585 static void rna_PoseChannel_constraints_remove(
586  ID *id, bPoseChannel *pchan, Main *bmain, ReportList *reports, PointerRNA *con_ptr)
587 {
588  bConstraint *con = con_ptr->data;
589  const bool is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
590  Object *ob = (Object *)id;
591 
592  if (BLI_findindex(&pchan->constraints, con) == -1) {
593  BKE_reportf(
594  reports, RPT_ERROR, "Constraint '%s' not found in pose bone '%s'", con->name, pchan->name);
595  return;
596  }
597 
598  BKE_constraint_remove(&pchan->constraints, con);
599  RNA_POINTER_INVALIDATE(con_ptr);
600 
601  ED_object_constraint_update(bmain, ob);
602 
603  /* XXX(Campbell): is this really needed? */
605 
607 
608  if (is_ik) {
609  BIK_clear_data(ob->pose);
610  }
611 }
612 
613 static void rna_PoseChannel_constraints_move(
614  ID *id, bPoseChannel *pchan, Main *bmain, ReportList *reports, int from, int to)
615 {
616  Object *ob = (Object *)id;
617 
618  if (from == to) {
619  return;
620  }
621 
622  if (!BLI_listbase_move_index(&pchan->constraints, from, to)) {
623  BKE_reportf(reports, RPT_ERROR, "Could not move constraint from index '%d' to '%d'", from, to);
624  return;
625  }
626 
629 }
630 
631 static bConstraint *rna_PoseChannel_constraints_copy(ID *id,
632  bPoseChannel *pchan,
633  Main *bmain,
634  PointerRNA *con_ptr)
635 {
636  Object *ob = (Object *)id;
637  bConstraint *con = con_ptr->data;
638  bConstraint *new_con = BKE_constraint_copy_for_pose(ob, pchan, con);
640 
641  ED_object_constraint_dependency_tag_update(bmain, ob, new_con);
643 
644  return new_con;
645 }
646 
647 bool rna_PoseChannel_constraints_override_apply(Main *bmain,
648  PointerRNA *ptr_dst,
649  PointerRNA *ptr_src,
650  PointerRNA *UNUSED(ptr_storage),
651  PropertyRNA *prop_dst,
652  PropertyRNA *UNUSED(prop_src),
653  PropertyRNA *UNUSED(prop_storage),
654  const int UNUSED(len_dst),
655  const int UNUSED(len_src),
656  const int UNUSED(len_storage),
657  PointerRNA *UNUSED(ptr_item_dst),
658  PointerRNA *UNUSED(ptr_item_src),
659  PointerRNA *UNUSED(ptr_item_storage),
661 {
663  "Unsupported RNA override operation on constraints collection");
664 
665  bPoseChannel *pchan_dst = (bPoseChannel *)ptr_dst->data;
666  bPoseChannel *pchan_src = (bPoseChannel *)ptr_src->data;
667 
668  /* Remember that insertion operations are defined and stored in correct order, which means that
669  * even if we insert several items in a row, we always insert first one, then second one, etc.
670  * So we should always find 'anchor' constraint in both _src *and* _dst */
671  const size_t name_offset = offsetof(bConstraint, name);
674  name_offset,
676  /* If `con_anchor` is NULL, `con_src` will be inserted in first position. */
677 
679  &pchan_src->constraints, opop->subitem_local_name, name_offset, opop->subitem_local_index);
680 
681  if (con_src == NULL) {
682  BLI_assert(con_src != NULL);
683  return false;
684  }
685 
686  bConstraint *con_dst = BKE_constraint_duplicate_ex(con_src, 0, true);
687 
688  /* This handles NULL anchor as expected by adding at head of list. */
689  BLI_insertlinkafter(&pchan_dst->constraints, con_anchor, con_dst);
690 
691  /* This should actually *not* be needed in typical cases.
692  * However, if overridden source was edited,
693  * we *may* have some new conflicting names. */
694  BKE_constraint_unique_name(con_dst, &pchan_dst->constraints);
695 
696  // printf("%s: We inserted a constraint...\n", __func__);
697  RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);
698  return true;
699 }
700 
701 static int rna_PoseChannel_proxy_editable(PointerRNA *UNUSED(ptr), const char **UNUSED(r_info))
702 {
703 # if 0
704  Object *ob = (Object *)ptr->owner_id;
705  bArmature *arm = ob->data;
706  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
707 
708  if (pchan->bone && (pchan->bone->layer & arm->layer_protected)) {
709  *r_info = "Can't edit property of a proxy on a protected layer";
710  return 0;
711  }
712 # endif
713 
714  return PROP_EDITABLE;
715 }
716 
717 static int rna_PoseChannel_location_editable(PointerRNA *ptr, int index)
718 {
719  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
720 
721  /* only if the axis in question is locked, not editable... */
722  if ((index == 0) && (pchan->protectflag & OB_LOCK_LOCX)) {
723  return 0;
724  }
725  else if ((index == 1) && (pchan->protectflag & OB_LOCK_LOCY)) {
726  return 0;
727  }
728  else if ((index == 2) && (pchan->protectflag & OB_LOCK_LOCZ)) {
729  return 0;
730  }
731  else {
732  return PROP_EDITABLE;
733  }
734 }
735 
736 static int rna_PoseChannel_scale_editable(PointerRNA *ptr, int index)
737 {
738  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
739 
740  /* only if the axis in question is locked, not editable... */
741  if ((index == 0) && (pchan->protectflag & OB_LOCK_SCALEX)) {
742  return 0;
743  }
744  else if ((index == 1) && (pchan->protectflag & OB_LOCK_SCALEY)) {
745  return 0;
746  }
747  else if ((index == 2) && (pchan->protectflag & OB_LOCK_SCALEZ)) {
748  return 0;
749  }
750  else {
751  return PROP_EDITABLE;
752  }
753 }
754 
755 static int rna_PoseChannel_rotation_euler_editable(PointerRNA *ptr, int index)
756 {
757  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
758 
759  /* only if the axis in question is locked, not editable... */
760  if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTX)) {
761  return 0;
762  }
763  else if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTY)) {
764  return 0;
765  }
766  else if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTZ)) {
767  return 0;
768  }
769  else {
770  return PROP_EDITABLE;
771  }
772 }
773 
774 static int rna_PoseChannel_rotation_4d_editable(PointerRNA *ptr, int index)
775 {
776  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
777 
778  /* only consider locks if locking components individually... */
779  if (pchan->protectflag & OB_LOCK_ROT4D) {
780  /* only if the axis in question is locked, not editable... */
781  if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTW)) {
782  return 0;
783  }
784  else if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTX)) {
785  return 0;
786  }
787  else if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTY)) {
788  return 0;
789  }
790  else if ((index == 3) && (pchan->protectflag & OB_LOCK_ROTZ)) {
791  return 0;
792  }
793  }
794 
795  return PROP_EDITABLE;
796 }
797 
798 /* not essential, but much faster than the default lookup function */
799 static int rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
800 {
801  bPose *pose = (bPose *)ptr->data;
802  bPoseChannel *pchan = BKE_pose_channel_find_name(pose, key);
803  if (pchan) {
804  RNA_pointer_create(ptr->owner_id, &RNA_PoseBone, pchan, r_ptr);
805  return true;
806  }
807  else {
808  return false;
809  }
810 }
811 
812 static void rna_PoseChannel_matrix_basis_get(PointerRNA *ptr, float *values)
813 {
814  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
815  BKE_pchan_to_mat4(pchan, (float(*)[4])values);
816 }
817 
818 static void rna_PoseChannel_matrix_basis_set(PointerRNA *ptr, const float *values)
819 {
820  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
821  BKE_pchan_apply_mat4(pchan, (float(*)[4])values, false); /* no compat for predictable result */
822 }
823 
824 static void rna_PoseChannel_matrix_set(PointerRNA *ptr, const float *values)
825 {
826  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
827  Object *ob = (Object *)ptr->owner_id;
828  float tmat[4][4];
829 
830  BKE_armature_mat_pose_to_bone_ex(NULL, ob, pchan, (float(*)[4])values, tmat);
831 
832  BKE_pchan_apply_mat4(pchan, tmat, false); /* no compat for predictable result */
833 }
834 
835 static bPoseChannel *rna_PoseChannel_ensure_own_pchan(Object *ob,
836  Object *ref_ob,
837  bPoseChannel *ref_pchan)
838 {
839  if (ref_ob != ob) {
840  /* We are trying to set a pchan from another object! Forbidden,
841  * try to find by name, or abort. */
842  if (ref_pchan != NULL) {
843  ref_pchan = BKE_pose_channel_find_name(ob->pose, ref_pchan->name);
844  }
845  }
846  return ref_pchan;
847 }
848 
849 static void rna_PoseChannel_custom_shape_transform_set(PointerRNA *ptr,
850  PointerRNA value,
851  struct ReportList *UNUSED(reports))
852 {
853  bPoseChannel *pchan = (bPoseChannel *)ptr->data;
854  Object *ob = (Object *)ptr->owner_id;
855 
856  pchan->custom_tx = rna_PoseChannel_ensure_own_pchan(ob, (Object *)value.owner_id, value.data);
857 }
858 
859 #else
860 
861 void rna_def_actionbone_group_common(StructRNA *srna, int update_flag, const char *update_cb)
862 {
863  PropertyRNA *prop;
864 
865  /* color set + colors */
866  prop = RNA_def_property(srna, "color_set", PROP_ENUM, PROP_NONE);
867  RNA_def_property_enum_sdna(prop, NULL, "customCol");
869  RNA_def_property_enum_funcs(prop, NULL, "rna_ActionGroup_colorset_set", NULL);
870  RNA_def_property_ui_text(prop, "Color Set", "Custom color set to use");
871  RNA_def_property_update(prop, update_flag, update_cb);
872 
873  prop = RNA_def_property(srna, "is_custom_color_set", PROP_BOOLEAN, PROP_NONE);
874  RNA_def_property_boolean_funcs(prop, "rna_ActionGroup_is_custom_colorset_get", NULL);
877  prop, "Custom Color Set", "Color set is user-defined instead of a fixed theme color set");
878 
879  /* TODO: editing the colors for this should result in changes to the color type... */
880  prop = RNA_def_property(srna, "colors", PROP_POINTER, PROP_NONE);
882  RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
883  /* NOTE: the DNA data is not really a pointer, but this code works :) */
884  RNA_def_property_pointer_sdna(prop, NULL, "cs");
886  prop, "Colors", "Copy of the colors associated with the group's color set");
887  RNA_def_property_update(prop, update_flag, update_cb);
888 }
889 
890 static void rna_def_bone_group(BlenderRNA *brna)
891 {
892  StructRNA *srna;
893  PropertyRNA *prop;
894 
895  /* struct */
896  srna = RNA_def_struct(brna, "BoneGroup", NULL);
897  RNA_def_struct_sdna(srna, "bActionGroup");
898  RNA_def_struct_ui_text(srna, "Bone Group", "Groups of Pose Channels (Bones)");
899  RNA_def_struct_ui_icon(srna, ICON_GROUP_BONE);
900 
901  /* name */
902  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
903  RNA_def_property_ui_text(prop, "Name", "");
904  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BoneGroup_name_set");
905  RNA_def_struct_name_property(srna, prop);
906 
907  /* TODO: add some runtime-collections stuff to access grouped bones. */
908 
909  /* color set */
910  rna_def_actionbone_group_common(srna, NC_OBJECT | ND_POSE, "rna_Pose_update");
911 }
912 
914  {IKSOLVER_STANDARD, "LEGACY", 0, "Standard", "Original IK solver"},
915  {IKSOLVER_ITASC, "ITASC", 0, "iTaSC", "Multi constraint, stateful IK solver"},
916  {0, NULL, 0, NULL, NULL},
917 };
918 
920  {ITASC_SOLVER_SDLS, "SDLS", 0, "SDLS", "Selective Damped Least Square"},
921  {ITASC_SOLVER_DLS, "DLS", 0, "DLS", "Damped Least Square with Numerical Filtering"},
922  {0, NULL, 0, NULL, NULL},
923 };
924 
926 {
927  StructRNA *srna;
928  PropertyRNA *prop;
929 
930  FunctionRNA *func;
931  PropertyRNA *parm;
932 
933  RNA_def_property_srna(cprop, "PoseBoneConstraints");
934  srna = RNA_def_struct(brna, "PoseBoneConstraints", NULL);
935  RNA_def_struct_sdna(srna, "bPoseChannel");
936  RNA_def_struct_ui_text(srna, "PoseBone Constraints", "Collection of pose bone constraints");
937 
938  /* Collection active property */
939  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
940  RNA_def_property_struct_type(prop, "Constraint");
942  "rna_PoseChannel_active_constraint_get",
943  "rna_PoseChannel_active_constraint_set",
944  NULL,
945  NULL);
947  RNA_def_property_ui_text(prop, "Active Constraint", "Active PoseChannel constraint");
948 
949  /* Constraint collection */
950  func = RNA_def_function(srna, "new", "rna_PoseChannel_constraints_new");
951  RNA_def_function_ui_description(func, "Add a constraint to this object");
953  FUNC_USE_MAIN | FUNC_USE_SELF_ID); /* ID and Main needed for refresh */
954  /* return type */
955  parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
956  RNA_def_function_return(func, parm);
957  /* constraint to add */
958  parm = RNA_def_enum(
959  func, "type", rna_enum_constraint_type_items, 1, "", "Constraint type to add");
961 
962  func = RNA_def_function(srna, "remove", "rna_PoseChannel_constraints_remove");
963  RNA_def_function_ui_description(func, "Remove a constraint from this object");
965  func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); /* ID needed for refresh */
966  /* constraint to remove */
967  parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
970 
971  func = RNA_def_function(srna, "move", "rna_PoseChannel_constraints_move");
972  RNA_def_function_ui_description(func, "Move a constraint to a different position");
974  parm = RNA_def_int(
975  func, "from_index", -1, INT_MIN, INT_MAX, "From Index", "Index to move", 0, 10000);
977  parm = RNA_def_int(func, "to_index", -1, INT_MIN, INT_MAX, "To Index", "Target index", 0, 10000);
979 
980  func = RNA_def_function(srna, "copy", "rna_PoseChannel_constraints_copy");
981  RNA_def_function_ui_description(func, "Add a new constraint that is a copy of the given one");
983  /* constraint to copy */
984  parm = RNA_def_pointer(func,
985  "constraint",
986  "Constraint",
987  "",
988  "Constraint to copy - may belong to a different object");
991  /* return type */
992  parm = RNA_def_pointer(func, "new_constraint", "Constraint", "", "New constraint");
993  RNA_def_function_return(func, parm);
994 }
995 
997 {
998  StructRNA *srna;
999  PropertyRNA *prop;
1000 
1001  srna = RNA_def_struct(brna, "PoseBone", NULL);
1002  RNA_def_struct_sdna(srna, "bPoseChannel");
1003  RNA_def_struct_ui_text(srna, "Pose Bone", "Channel defining pose data for a bone in a Pose");
1004  RNA_def_struct_path_func(srna, "rna_PoseBone_path");
1005  RNA_def_struct_idprops_func(srna, "rna_PoseBone_idprops");
1006  RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
1007 
1008  /* Bone Constraints */
1009  prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
1010  RNA_def_property_struct_type(prop, "Constraint");
1013  RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this pose channel");
1014  RNA_def_property_override_funcs(prop, NULL, NULL, "rna_PoseChannel_constraints_override_apply");
1015 
1017 
1018  /* Name + Selection Status */
1019  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1020  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_PoseChannel_name_set");
1021  RNA_def_property_ui_text(prop, "Name", "");
1022  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1023  RNA_def_struct_name_property(srna, prop);
1024  RNA_def_property_update(prop, 0, "rna_PoseChannel_name_update");
1025 
1026  /* Baked Bone Path cache data */
1028 
1029  /* Relationships to other bones */
1030  prop = RNA_def_property(srna, "bone", PROP_POINTER, PROP_NONE);
1032  RNA_def_property_struct_type(prop, "Bone");
1033  RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_bone_get", NULL, NULL, NULL);
1036  RNA_def_property_ui_text(prop, "Bone", "Bone associated with this PoseBone");
1037 
1038  prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
1039  RNA_def_property_struct_type(prop, "PoseBone");
1042  RNA_def_property_ui_text(prop, "Parent", "Parent of this pose bone");
1043 
1044  prop = RNA_def_property(srna, "child", PROP_POINTER, PROP_NONE);
1045  RNA_def_property_struct_type(prop, "PoseBone");
1048  RNA_def_property_ui_text(prop, "Child", "Child of this pose bone");
1049 
1050  /* Transformation settings */
1051  prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
1052  RNA_def_property_float_sdna(prop, NULL, "loc");
1054  RNA_def_property_editable_array_func(prop, "rna_PoseChannel_location_editable");
1055  RNA_def_property_ui_text(prop, "Location", "");
1056  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
1057  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1058 
1059  prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
1060  RNA_def_property_float_sdna(prop, NULL, "size");
1063  RNA_def_property_editable_array_func(prop, "rna_PoseChannel_scale_editable");
1065  RNA_def_property_ui_text(prop, "Scale", "");
1066  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1067 
1068  prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
1069  RNA_def_property_float_sdna(prop, NULL, "quat");
1071  RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
1073  RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
1074  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1075 
1076  /* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
1077  * having a single one is better for Keyframing and other property-management situations...
1078  */
1079  prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
1081  RNA_def_property_array(prop, 4);
1083  "rna_PoseChannel_rotation_axis_angle_get",
1084  "rna_PoseChannel_rotation_axis_angle_set",
1085  NULL);
1086  RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
1089  prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
1090  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1091 
1092  prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
1093  RNA_def_property_float_sdna(prop, NULL, "eul");
1095  RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_euler_editable");
1096  RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
1097  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1098 
1099  prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
1100  RNA_def_property_enum_sdna(prop, NULL, "rotmode");
1103  RNA_def_property_enum_funcs(prop, NULL, "rna_PoseChannel_rotation_mode_set", NULL);
1104  /* XXX... disabled, since proxy-locked layers are currently
1105  * used for ensuring proxy-syncing too */
1106  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1107  RNA_def_property_ui_text(prop, "Rotation Mode", "");
1108  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1109 
1110  /* Curved bones settings - Applied on top of restpose values */
1111  rna_def_bone_curved_common(srna, true, false);
1112 
1113  /* Custom BBone next/prev sources */
1114  prop = RNA_def_property(srna, "bbone_custom_handle_start", PROP_POINTER, PROP_NONE);
1115  RNA_def_property_pointer_sdna(prop, NULL, "bbone_prev");
1116  RNA_def_property_struct_type(prop, "PoseBone");
1120  prop, "B-Bone Start Handle", "Bone that serves as the start handle for the B-Bone curve");
1121  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
1122 
1123  prop = RNA_def_property(srna, "bbone_custom_handle_end", PROP_POINTER, PROP_NONE);
1124  RNA_def_property_pointer_sdna(prop, NULL, "bbone_next");
1125  RNA_def_property_struct_type(prop, "PoseBone");
1129  prop, "B-Bone End Handle", "Bone that serves as the end handle for the B-Bone curve");
1130  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
1131 
1132  /* transform matrices - should be read-only since these are set directly by AnimSys evaluation */
1133  prop = RNA_def_property(srna, "matrix_channel", PROP_FLOAT, PROP_MATRIX);
1134  RNA_def_property_float_sdna(prop, NULL, "chan_mat");
1137  RNA_def_property_ui_text(prop, "Channel Matrix", "4x4 matrix, before constraints");
1138 
1139  /* writable because it touches loc/scale/rot directly */
1140  prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
1143  prop,
1144  "Basis Matrix",
1145  "Alternative access to location/scale/rotation relative to the parent and own rest bone");
1147  prop, "rna_PoseChannel_matrix_basis_get", "rna_PoseChannel_matrix_basis_set", NULL);
1149  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1150 
1151  /* final matrix */
1152  prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
1153  RNA_def_property_float_sdna(prop, NULL, "pose_mat");
1155  RNA_def_property_float_funcs(prop, NULL, "rna_PoseChannel_matrix_set", NULL);
1157  prop,
1158  "Pose Matrix",
1159  "Final 4x4 matrix after constraints and drivers are applied (object space)");
1160  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1161 
1162  /* Head/Tail Coordinates (in Pose Space) - Automatically calculated... */
1163  prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
1164  RNA_def_property_float_sdna(prop, NULL, "pose_head");
1166  RNA_def_property_ui_text(prop, "Pose Head Position", "Location of head of the channel's bone");
1167  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
1168 
1169  prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
1170  RNA_def_property_float_sdna(prop, NULL, "pose_tail");
1172  RNA_def_property_ui_text(prop, "Pose Tail Position", "Location of tail of the channel's bone");
1173  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
1174 
1175  prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_DISTANCE);
1176  RNA_def_property_float_funcs(prop, "rna_PoseChannel_length_get", NULL, NULL);
1178  RNA_def_property_ui_text(prop, "Length", "Length of the bone");
1179 
1180  /* IK Settings */
1181  prop = RNA_def_property(srna, "is_in_ik_chain", PROP_BOOLEAN, PROP_NONE);
1182  RNA_def_property_boolean_funcs(prop, "rna_PoseChannel_has_ik_get", NULL);
1184  RNA_def_property_ui_text(prop, "Has IK", "Is part of an IK chain");
1185  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1186 
1187  prop = RNA_def_property(srna, "lock_ik_x", PROP_BOOLEAN, PROP_NONE);
1189  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
1190  RNA_def_property_ui_text(prop, "IK X Lock", "Disallow movement around the X axis");
1191  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1192  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1193 
1194  prop = RNA_def_property(srna, "lock_ik_y", PROP_BOOLEAN, PROP_NONE);
1196  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
1197  RNA_def_property_ui_text(prop, "IK Y Lock", "Disallow movement around the Y axis");
1198  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1199  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1200 
1201  prop = RNA_def_property(srna, "lock_ik_z", PROP_BOOLEAN, PROP_NONE);
1203  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
1204  RNA_def_property_ui_text(prop, "IK Z Lock", "Disallow movement around the Z axis");
1205  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1206  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1207 
1208  prop = RNA_def_property(srna, "use_ik_limit_x", PROP_BOOLEAN, PROP_NONE);
1210  RNA_def_property_ui_text(prop, "IK X Limit", "Limit movement around the X axis");
1211  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1212  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1213 
1214  prop = RNA_def_property(srna, "use_ik_limit_y", PROP_BOOLEAN, PROP_NONE);
1216  RNA_def_property_ui_text(prop, "IK Y Limit", "Limit movement around the Y axis");
1217  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1218  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1219 
1220  prop = RNA_def_property(srna, "use_ik_limit_z", PROP_BOOLEAN, PROP_NONE);
1222  RNA_def_property_ui_text(prop, "IK Z Limit", "Limit movement around the Z axis");
1223  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1224  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1225 
1226  prop = RNA_def_property(srna, "use_ik_rotation_control", PROP_BOOLEAN, PROP_NONE);
1228  RNA_def_property_ui_text(prop, "IK Rotation Control", "Apply channel rotation as IK constraint");
1229  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1230  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1231 
1232  prop = RNA_def_property(srna, "use_ik_linear_control", PROP_BOOLEAN, PROP_NONE);
1235  prop, "IK Linear Control", "Apply channel size as IK constraint if stretching is enabled");
1236  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1237  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1238 
1239  prop = RNA_def_property(srna, "ik_min_x", PROP_FLOAT, PROP_ANGLE);
1240  RNA_def_property_float_sdna(prop, NULL, "limitmin[0]");
1241  RNA_def_property_range(prop, -M_PI, 0.0f);
1242  RNA_def_property_ui_text(prop, "IK X Minimum", "Minimum angles for IK Limit");
1243  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1244  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1245 
1246  prop = RNA_def_property(srna, "ik_max_x", PROP_FLOAT, PROP_ANGLE);
1247  RNA_def_property_float_sdna(prop, NULL, "limitmax[0]");
1248  RNA_def_property_range(prop, 0.0f, M_PI);
1249  RNA_def_property_ui_text(prop, "IK X Maximum", "Maximum angles for IK Limit");
1250  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1251  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1252 
1253  prop = RNA_def_property(srna, "ik_min_y", PROP_FLOAT, PROP_ANGLE);
1254  RNA_def_property_float_sdna(prop, NULL, "limitmin[1]");
1255  RNA_def_property_range(prop, -M_PI, 0.0f);
1256  RNA_def_property_ui_text(prop, "IK Y Minimum", "Minimum angles for IK Limit");
1257  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1258  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1259 
1260  prop = RNA_def_property(srna, "ik_max_y", PROP_FLOAT, PROP_ANGLE);
1261  RNA_def_property_float_sdna(prop, NULL, "limitmax[1]");
1262  RNA_def_property_range(prop, 0.0f, M_PI);
1263  RNA_def_property_ui_text(prop, "IK Y Maximum", "Maximum angles for IK Limit");
1264  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1265  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1266 
1267  prop = RNA_def_property(srna, "ik_min_z", PROP_FLOAT, PROP_ANGLE);
1268  RNA_def_property_float_sdna(prop, NULL, "limitmin[2]");
1269  RNA_def_property_range(prop, -M_PI, 0.0f);
1270  RNA_def_property_ui_text(prop, "IK Z Minimum", "Minimum angles for IK Limit");
1271  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1272  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1273 
1274  prop = RNA_def_property(srna, "ik_max_z", PROP_FLOAT, PROP_ANGLE);
1275  RNA_def_property_float_sdna(prop, NULL, "limitmax[2]");
1276  RNA_def_property_range(prop, 0.0f, M_PI);
1277  RNA_def_property_ui_text(prop, "IK Z Maximum", "Maximum angles for IK Limit");
1278  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1279  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1280 
1281  prop = RNA_def_property(srna, "ik_stiffness_x", PROP_FLOAT, PROP_NONE);
1282  RNA_def_property_float_sdna(prop, NULL, "stiffness[0]");
1283  RNA_def_property_range(prop, 0.0f, 0.99f);
1284  RNA_def_property_ui_text(prop, "IK X Stiffness", "IK stiffness around the X axis");
1285  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1286  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1287 
1288  prop = RNA_def_property(srna, "ik_stiffness_y", PROP_FLOAT, PROP_NONE);
1289  RNA_def_property_float_sdna(prop, NULL, "stiffness[1]");
1290  RNA_def_property_range(prop, 0.0f, 0.99f);
1291  RNA_def_property_ui_text(prop, "IK Y Stiffness", "IK stiffness around the Y axis");
1292  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1293  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1294 
1295  prop = RNA_def_property(srna, "ik_stiffness_z", PROP_FLOAT, PROP_NONE);
1296  RNA_def_property_float_sdna(prop, NULL, "stiffness[2]");
1297  RNA_def_property_range(prop, 0.0f, 0.99f);
1298  RNA_def_property_ui_text(prop, "IK Z Stiffness", "IK stiffness around the Z axis");
1299  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1300  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1301 
1302  prop = RNA_def_property(srna, "ik_stretch", PROP_FLOAT, PROP_FACTOR);
1303  RNA_def_property_float_sdna(prop, NULL, "ikstretch");
1304  RNA_def_property_range(prop, 0.0f, 1.0f);
1305  RNA_def_property_ui_text(prop, "IK Stretch", "Allow scaling of the bone for IK");
1306  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1307  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
1308 
1309  prop = RNA_def_property(srna, "ik_rotation_weight", PROP_FLOAT, PROP_FACTOR);
1310  RNA_def_property_float_sdna(prop, NULL, "ikrotweight");
1311  RNA_def_property_range(prop, 0.0f, 1.0f);
1312  RNA_def_property_ui_text(prop, "IK Rotation Weight", "Weight of rotation constraint for IK");
1313  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1314  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1315 
1316  prop = RNA_def_property(srna, "ik_linear_weight", PROP_FLOAT, PROP_FACTOR);
1317  RNA_def_property_float_sdna(prop, NULL, "iklinweight");
1318  RNA_def_property_range(prop, 0.0f, 1.0f);
1319  RNA_def_property_ui_text(prop, "IK Lin Weight", "Weight of scale constraint for IK");
1320  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1321  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1322 
1323  /* custom bone shapes */
1324  prop = RNA_def_property(srna, "custom_shape", PROP_POINTER, PROP_NONE);
1325  RNA_def_property_pointer_sdna(prop, NULL, "custom");
1326  RNA_def_property_struct_type(prop, "Object");
1330  prop, "Custom Object", "Object that defines custom display shape for this bone");
1331  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1332  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
1333 
1334  prop = RNA_def_property(srna, "custom_shape_scale_xyz", PROP_FLOAT, PROP_XYZ);
1335  RNA_def_property_float_sdna(prop, NULL, "custom_scale_xyz");
1338  RNA_def_property_ui_text(prop, "Custom Shape Scale", "Adjust the size of the custom shape");
1339  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1340 
1341  prop = RNA_def_property(srna, "custom_shape_translation", PROP_FLOAT, PROP_XYZ);
1342  RNA_def_property_float_sdna(prop, NULL, "custom_translation");
1345  prop, "Custom Shape Translation", "Adjust the location of the custom shape");
1346  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
1347  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1348 
1349  prop = RNA_def_property(srna, "custom_shape_rotation_euler", PROP_FLOAT, PROP_EULER);
1350  RNA_def_property_float_sdna(prop, NULL, "custom_rotation_euler");
1352  prop, "Custom Shape Rotation", "Adjust the rotation of the custom shape");
1353  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1354 
1355  prop = RNA_def_property(srna, "use_custom_shape_bone_size", PROP_BOOLEAN, PROP_NONE);
1358  prop, "Scale to Bone Length", "Scale the custom object by the bone length");
1359  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1360 
1361  prop = RNA_def_property(srna, "custom_shape_transform", PROP_POINTER, PROP_NONE);
1362  RNA_def_property_pointer_sdna(prop, NULL, "custom_tx");
1363  RNA_def_property_struct_type(prop, "PoseBone");
1367  "Custom Shape Transform",
1368  "Bone that defines the display transform of this custom shape");
1369  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1371  prop, NULL, "rna_PoseChannel_custom_shape_transform_set", NULL, NULL);
1372  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1373 
1374  /* bone groups */
1375  prop = RNA_def_property(srna, "bone_group_index", PROP_INT, PROP_NONE);
1376  RNA_def_property_int_sdna(prop, NULL, "agrp_index");
1380  "rna_PoseChannel_bone_group_index_get",
1381  "rna_PoseChannel_bone_group_index_set",
1382  "rna_PoseChannel_bone_group_index_range");
1384  prop, "Bone Group Index", "Bone group this pose channel belongs to (0 means no group)");
1385  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1386  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1387 
1388  prop = RNA_def_property(srna, "bone_group", PROP_POINTER, PROP_NONE);
1389  RNA_def_property_struct_type(prop, "BoneGroup");
1392  prop, "rna_PoseChannel_bone_group_get", "rna_PoseChannel_bone_group_set", NULL, NULL);
1393  RNA_def_property_ui_text(prop, "Bone Group", "Bone group this pose channel belongs to");
1394  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1395  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1396 
1397  /* transform locks */
1398  prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
1399  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
1400  RNA_def_property_array(prop, 3);
1401  RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location when transforming");
1402  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1403  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1404  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1405 
1406  prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
1407  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
1408  RNA_def_property_array(prop, 3);
1409  RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation when transforming");
1410  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1411  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1412  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1413 
1414  /* XXX this is sub-optimal - it really should be included above, but due to technical reasons
1415  * we can't do this! */
1416  prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
1417  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
1419  prop,
1420  "Lock Rotation (4D Angle)",
1421  "Lock editing of 'angle' component of four-component rotations when transforming");
1422  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1423  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1424  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1425 
1426  /* XXX this needs a better name */
1427  prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
1428  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
1430  prop,
1431  "Lock Rotations (4D)",
1432  "Lock editing of four component rotations by components (instead of as Eulers)");
1433  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1434  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1435 
1436  prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
1437  RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
1438  RNA_def_property_array(prop, 3);
1439  RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale when transforming");
1440  RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1441  RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
1442  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1443 
1444  RNA_api_pose_channel(srna);
1445 }
1446 
1447 static void rna_def_pose_itasc(BlenderRNA *brna)
1448 {
1449  static const EnumPropertyItem prop_itasc_mode_items[] = {
1450  {0,
1451  "ANIMATION",
1452  0,
1453  "Animation",
1454  "Stateless solver computing pose starting from current action and non-IK constraints"},
1456  "SIMULATION",
1457  0,
1458  "Simulation",
1459  "State-full solver running in real-time context and ignoring actions "
1460  "and non-IK constraints"},
1461  {0, NULL, 0, NULL, NULL},
1462  };
1463  static const EnumPropertyItem prop_itasc_reiteration_items[] = {
1464  {0,
1465  "NEVER",
1466  0,
1467  "Never",
1468  "The solver does not reiterate, not even on first frame (starts from rest pose)"},
1470  "INITIAL",
1471  0,
1472  "Initial",
1473  "The solver reiterates (converges) on the first frame but not on "
1474  "subsequent frame"},
1476  "ALWAYS",
1477  0,
1478  "Always",
1479  "The solver reiterates (converges) on all frames"},
1480  {0, NULL, 0, NULL, NULL},
1481  };
1482 
1483  StructRNA *srna;
1484  PropertyRNA *prop;
1485 
1486  srna = RNA_def_struct(brna, "Itasc", "IKParam");
1487  RNA_def_struct_sdna(srna, "bItasc");
1488  RNA_def_struct_ui_text(srna, "bItasc", "Parameters for the iTaSC IK solver");
1489 
1490  prop = RNA_def_property(srna, "precision", PROP_FLOAT, PROP_NONE);
1491  RNA_def_property_float_sdna(prop, NULL, "precision");
1492  RNA_def_property_range(prop, 0.0f, 0.1f);
1493  RNA_def_property_ui_text(prop, "Precision", "Precision of convergence in case of reiteration");
1494  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1495 
1496  prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
1497  RNA_def_property_int_sdna(prop, NULL, "numiter");
1498  RNA_def_property_range(prop, 0, 1000);
1500  prop, "Iterations", "Maximum number of iterations for convergence in case of reiteration");
1501  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1502 
1503  prop = RNA_def_property(srna, "step_count", PROP_INT, PROP_NONE);
1504  RNA_def_property_int_sdna(prop, NULL, "numstep");
1505  RNA_def_property_range(prop, 1.0f, 50.0f);
1506  RNA_def_property_ui_text(prop, "Num Steps", "Divide the frame interval into this many steps");
1507  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1508 
1509  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1511  RNA_def_property_enum_items(prop, prop_itasc_mode_items);
1512  RNA_def_property_ui_text(prop, "Mode", NULL);
1513  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update_rebuild");
1514 
1515  prop = RNA_def_property(srna, "reiteration_method", PROP_ENUM, PROP_NONE);
1517  RNA_def_property_enum_items(prop, prop_itasc_reiteration_items);
1519  "Reiteration",
1520  "Defines if the solver is allowed to reiterate (converge until "
1521  "precision is met) on none, first or all frames");
1522  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1523 
1524  prop = RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
1527  "Auto Step",
1528  "Automatically determine the optimal number of steps for best "
1529  "performance/accuracy trade off");
1530  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1531 
1532  prop = RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_FACTOR);
1533  RNA_def_property_float_sdna(prop, NULL, "minstep");
1534  RNA_def_property_range(prop, 0.0f, 0.1f);
1536  prop, "Min Step", "Lower bound for timestep in second in case of automatic substeps");
1537  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1538 
1539  prop = RNA_def_property(srna, "step_max", PROP_FLOAT, PROP_FACTOR);
1540  RNA_def_property_float_sdna(prop, NULL, "maxstep");
1541  RNA_def_property_range(prop, 0.0f, 1.0f);
1543  prop, "Max Step", "Higher bound for timestep in second in case of automatic substeps");
1544  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1545 
1546  prop = RNA_def_property(srna, "feedback", PROP_FLOAT, PROP_NONE);
1547  RNA_def_property_float_sdna(prop, NULL, "feedback");
1548  RNA_def_property_range(prop, 0.0f, 100.0f);
1550  prop,
1551  "Feedback",
1552  "Feedback coefficient for error correction, average response time is 1/feedback");
1553  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1554 
1555  prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
1556  RNA_def_property_float_sdna(prop, NULL, "maxvel");
1557  RNA_def_property_range(prop, 0.0f, 100.0f);
1558  RNA_def_property_ui_text(prop, "Max Velocity", "Maximum joint velocity in radians/second");
1559  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1560 
1561  prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
1562  RNA_def_property_enum_sdna(prop, NULL, "solver");
1565  prop, "Solver", "Solving method selection: automatic damping or manual damping");
1566  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update_rebuild");
1567 
1568  prop = RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_FACTOR);
1569  RNA_def_property_float_sdna(prop, NULL, "dampmax");
1570  RNA_def_property_range(prop, 0.0f, 1.0f);
1572  "Damp",
1573  "Maximum damping coefficient when singular value is nearly 0 "
1574  "(higher values produce results with more stability, less reactivity)");
1575  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1576 
1577  prop = RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_FACTOR);
1578  RNA_def_property_float_sdna(prop, NULL, "dampeps");
1579  RNA_def_property_range(prop, 0.0f, 1.0f);
1581  "Epsilon",
1582  "Singular value under which damping is progressively applied "
1583  "(higher values produce results with more stability, less reactivity)");
1584  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
1585 }
1586 
1588 {
1589  StructRNA *srna;
1590  PropertyRNA *prop;
1591 
1592  srna = RNA_def_struct(brna, "IKParam", NULL);
1593  RNA_def_struct_sdna(srna, "bIKParam");
1594  RNA_def_struct_ui_text(srna, "IKParam", "Base type for IK solver parameters");
1595  RNA_def_struct_refine_func(srna, "rna_IKParam_refine");
1596 
1597  prop = RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
1598  RNA_def_property_enum_sdna(prop, NULL, "iksolver");
1601  RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these parameters are defined");
1602 }
1603 
1604 /* pose.bone_groups */
1605 static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop)
1606 {
1607  StructRNA *srna;
1608  PropertyRNA *prop;
1609 
1610  FunctionRNA *func;
1611  PropertyRNA *parm;
1612 
1613  RNA_def_property_srna(cprop, "BoneGroups");
1614  srna = RNA_def_struct(brna, "BoneGroups", NULL);
1615  RNA_def_struct_sdna(srna, "bPose");
1616  RNA_def_struct_ui_text(srna, "Bone Groups", "Collection of bone groups");
1617 
1618  func = RNA_def_function(srna, "new", "rna_bone_group_new");
1619  RNA_def_function_ui_description(func, "Add a new bone group to the object");
1620  RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS); /* ID needed for refresh */
1621  RNA_def_string(func, "name", "Group", MAX_NAME, "", "Name of the new group");
1622  /* return type */
1623  parm = RNA_def_pointer(func, "group", "BoneGroup", "", "New bone group");
1624  RNA_def_function_return(func, parm);
1625 
1626  func = RNA_def_function(srna, "remove", "rna_bone_group_remove");
1627  RNA_def_function_ui_description(func, "Remove a bone group from this object");
1628  RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID); /* ID needed for refresh */
1629  /* bone group to remove */
1630  parm = RNA_def_pointer(func, "group", "BoneGroup", "", "Removed bone group");
1633 
1634  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1635  RNA_def_property_struct_type(prop, "BoneGroup");
1638  prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", NULL, NULL);
1639  RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
1640  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1641 
1642  prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
1643  RNA_def_property_int_sdna(prop, NULL, "active_group");
1645  "rna_Pose_active_bone_group_index_get",
1646  "rna_Pose_active_bone_group_index_set",
1647  "rna_Pose_active_bone_group_index_range");
1648  RNA_def_property_ui_text(prop, "Active Bone Group Index", "Active index in bone groups array");
1649  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
1650 }
1651 
1652 static void rna_def_pose(BlenderRNA *brna)
1653 {
1654  StructRNA *srna;
1655  PropertyRNA *prop;
1656 
1657  /* struct definition */
1658  srna = RNA_def_struct(brna, "Pose", NULL);
1659  RNA_def_struct_sdna(srna, "bPose");
1661  srna, "Pose", "A collection of pose channels, including settings for animating bones");
1662 
1663  /* pose channels */
1664  prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
1665  RNA_def_property_collection_sdna(prop, NULL, "chanbase", NULL);
1666  RNA_def_property_struct_type(prop, "PoseBone");
1668  RNA_def_property_ui_text(prop, "Pose Bones", "Individual pose bones for the armature");
1669  /* can be removed, only for fast lookup */
1671  prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_PoseBones_lookup_string", NULL);
1672 
1673  /* bone groups */
1674  prop = RNA_def_property(srna, "bone_groups", PROP_COLLECTION, PROP_NONE);
1675  RNA_def_property_collection_sdna(prop, NULL, "agroups", NULL);
1676  RNA_def_property_struct_type(prop, "BoneGroup");
1677  RNA_def_property_ui_text(prop, "Bone Groups", "Groups of the bones");
1678  rna_def_bone_groups(brna, prop);
1679 
1680  /* ik solvers */
1681  prop = RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
1682  RNA_def_property_enum_sdna(prop, NULL, "iksolver");
1683  RNA_def_property_enum_funcs(prop, NULL, "rna_Pose_ik_solver_set", NULL);
1685  RNA_def_property_ui_text(prop, "IK Solver", "Selection of IK solver for IK chain");
1686  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_ik_solver_update");
1687 
1688  prop = RNA_def_property(srna, "ik_param", PROP_POINTER, PROP_NONE);
1689  RNA_def_property_struct_type(prop, "IKParam");
1691  prop, "rna_Pose_ikparam_get", NULL, "rna_Pose_ikparam_typef", NULL);
1693  RNA_def_property_ui_text(prop, "IK Param", "Parameters for IK solver");
1694 
1696 
1697  /* pose edit options */
1698  prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
1701  prop, "X-Axis Mirror", "Apply changes to matching bone on opposite side of X-Axis");
1702  RNA_def_struct_path_func(srna, "rna_Pose_path");
1703  RNA_def_property_update(prop, 0, "rna_Pose_update");
1705 
1706  prop = RNA_def_property(srna, "use_mirror_relative", PROP_BOOLEAN, PROP_NONE);
1709  prop,
1710  "Relative Mirror",
1711  "Apply relative transformations in X-mirror mode (not supported with Auto IK)");
1712  RNA_def_struct_path_func(srna, "rna_Pose_path");
1713  RNA_def_property_update(prop, 0, "rna_Pose_update");
1715 
1716  prop = RNA_def_property(srna, "use_auto_ik", PROP_BOOLEAN, PROP_NONE);
1719  prop, "Auto IK", "Add temporary IK constraints while grabbing bones in Pose Mode");
1720  RNA_def_struct_path_func(srna, "rna_Pose_path");
1721  RNA_def_property_update(prop, 0, "rna_Pose_update");
1723 
1725 
1726  /* animviz */
1727  rna_def_animviz_common(srna);
1728 
1729  RNA_api_pose(srna);
1730 }
1731 
1733 {
1734  rna_def_pose(brna);
1735  rna_def_pose_channel(brna);
1736  rna_def_pose_ikparam(brna);
1737  rna_def_pose_itasc(brna);
1738  rna_def_bone_group(brna);
1739 }
1740 
1741 #endif
void BIK_update_param(struct bPose *pose)
Definition: ikplugin_api.c:112
void BIK_clear_data(struct bPose *pose)
Definition: ikplugin_api.c:94
Blender kernel action and pose functionality.
void BKE_pose_tag_recalc(struct Main *bmain, struct bPose *pose)
Definition: action.c:1719
struct bActionGroup * BKE_pose_add_group(struct bPose *pose, const char *name)
Definition: action.c:1266
struct bPoseChannel * BKE_pose_channel_find_name(const struct bPose *pose, const char *name)
void BKE_pose_ikparam_init(struct bPose *pose)
Definition: action.c:877
void BKE_pose_remove_group(struct bPose *pose, struct bActionGroup *grp, int index)
Definition: action.c:1284
void action_group_colors_sync(struct bActionGroup *grp, const struct bActionGroup *ref_grp)
void BKE_pose_update_constraint_flags(struct bPose *pose)
Definition: action.c:1192
bool BKE_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan)
Definition: action.c:920
void BKE_pchan_to_mat4(const struct bPoseChannel *pchan, float r_chanmat[4][4])
void BKE_pchan_apply_mat4(struct bPoseChannel *pchan, const float mat[4][4], bool use_compat)
Definition: armature.c:1958
void BKE_armature_mat_pose_to_bone_ex(struct Depsgraph *depsgraph, struct Object *ob, struct bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
Definition: armature.c:1892
void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode)
Definition: armature.c:1983
bool BKE_constraint_remove(ListBase *list, struct bConstraint *con)
Definition: constraint.c:5592
struct bConstraint * BKE_constraints_active_get(struct ListBase *list)
Definition: constraint.c:6001
struct bConstraint * BKE_constraint_copy_for_pose(struct Object *ob, struct bPoseChannel *pchan, struct bConstraint *src)
Definition: constraint.c:5955
void BKE_constraints_active_set(ListBase *list, struct bConstraint *con)
Definition: constraint.c:6017
struct bConstraint * BKE_constraint_add_for_pose(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type)
Definition: constraint.c:5858
void BKE_constraint_unique_name(struct bConstraint *con, struct ListBase *list)
Definition: constraint.c:112
struct bConstraint * BKE_constraint_duplicate_ex(struct bConstraint *src, int flag, bool do_extern)
Definition: constraint.c:5947
#define G_MAIN
Definition: BKE_global.h:267
bool BKE_id_is_in_global_main(struct ID *id)
Definition: lib_id.c:1902
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.c:83
#define BLI_assert(a)
Definition: BLI_assert.h:46
bool BLI_listbase_move_index(ListBase *listbase, int from, int to) ATTR_NONNULL()
Definition: listbase.c:436
void void * BLI_listbase_string_or_index_find(const struct ListBase *listbase, const char *string, size_t string_offset, int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition: listbase.c:301
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int max_ii(int a, int b)
#define M_PI
Definition: BLI_math_base.h:20
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])
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:42
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
size_t size_t char size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL()
Definition: string.c:250
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL(1
bool BLI_uniquename(struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_len)
Definition: string_utils.c:309
#define UNUSED(x)
#define MAX2(a, b)
#define ELEM(...)
#define STREQ(a, b)
#define CTX_DATA_(context, msgid)
#define BLT_I18NCONTEXT_ID_ARMATURE
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_TRANSFORM
Definition: DNA_ID.h:771
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
@ IDOVERRIDE_LIBRARY_OP_INSERT_AFTER
Definition: DNA_ID.h:230
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition: DNA_ID.h:588
@ ITASC_SOLVER_SDLS
@ ITASC_SOLVER_DLS
@ IKSOLVER_STANDARD
@ IKSOLVER_ITASC
@ ITASC_REITERATION
@ ITASC_AUTO_STEP
@ 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
#define MAX_NAME
Definition: DNA_defs.h:48
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
void ED_object_constraint_tag_update(struct Main *bmain, struct Object *ob, struct bConstraint *con)
void ED_object_constraint_update(struct Main *bmain, struct Object *ob)
void ED_object_constraint_dependency_tag_update(struct Main *bmain, struct Object *ob, struct bConstraint *con)
void object_test_constraints(struct Main *bmain, struct Object *ob)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
#define RNA_POINTER_INVALIDATE(ptr)
Definition: RNA_access.h:744
@ PARM_RNAPTR
Definition: RNA_types.h:354
@ PARM_REQUIRED
Definition: RNA_types.h:352
@ FUNC_USE_REPORTS
Definition: RNA_types.h:663
@ FUNC_USE_MAIN
Definition: RNA_types.h:661
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:650
@ PROP_FLOAT
Definition: RNA_types.h:61
@ PROP_BOOLEAN
Definition: RNA_types.h:59
@ PROP_ENUM
Definition: RNA_types.h:63
@ PROP_INT
Definition: RNA_types.h:60
@ PROP_STRING
Definition: RNA_types.h:62
@ PROP_POINTER
Definition: RNA_types.h:64
@ PROP_COLLECTION
Definition: RNA_types.h:65
#define RNA_TRANSLATION_PREC_DEFAULT
Definition: RNA_types.h:117
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition: RNA_types.h:312
@ PROPOVERRIDE_NO_COMPARISON
Definition: RNA_types.h:320
@ PROPOVERRIDE_LIBRARY_INSERTION
Definition: RNA_types.h:337
@ PROP_THICK_WRAP
Definition: RNA_types.h:285
@ PROP_ANIMATABLE
Definition: RNA_types.h:202
@ PROP_PROPORTIONAL
Definition: RNA_types.h:223
@ PROP_EDITABLE
Definition: RNA_types.h:189
@ PROP_LIB_EXCEPTION
Definition: RNA_types.h:195
@ PROP_NEVER_NULL
Definition: RNA_types.h:239
@ PROP_PTR_NO_OWNERSHIP
Definition: RNA_types.h:257
@ PROP_ID_REFCOUNT
Definition: RNA_types.h:226
@ PROP_MATRIX
Definition: RNA_types.h:158
@ PROP_XYZ
Definition: RNA_types.h:162
@ PROP_DISTANCE
Definition: RNA_types.h:149
@ PROP_ANGLE
Definition: RNA_types.h:145
@ PROP_AXISANGLE
Definition: RNA_types.h:161
@ PROP_EULER
Definition: RNA_types.h:159
@ PROP_NONE
Definition: RNA_types.h:126
@ PROP_FACTOR
Definition: RNA_types.h:144
@ PROP_TRANSLATION
Definition: RNA_types.h:154
@ PROP_UNSIGNED
Definition: RNA_types.h:142
@ PROP_QUATERNION
Definition: RNA_types.h:160
#define NC_GEOM
Definition: WM_types.h:343
#define ND_DATA
Definition: WM_types.h:456
#define NC_ANIMATION
Definition: WM_types.h:338
#define NA_ADDED
Definition: WM_types.h:525
#define ND_POSE
Definition: WM_types.h:407
#define ND_CONSTRAINT
Definition: WM_types.h:413
#define NA_REMOVED
Definition: WM_types.h:526
#define NC_OBJECT
Definition: WM_types.h:329
#define ND_ANIMCHAN
Definition: WM_types.h:444
void ED_armature_bone_rename(Main *bmain, bArmature *arm, const char *oldnamep, const char *newnamep)
int main(int argc, char *argv[])
StackEntry * from
Scene scene
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
static unsigned a[3]
Definition: RandGen.cpp:78
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2143
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
Definition: rna_access.c:186
void rna_def_animviz_common(StructRNA *srna)
Definition: rna_animviz.c:315
void rna_def_motionpath_common(StructRNA *srna)
Definition: rna_animviz.c:96
void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editbone)
Definition: rna_armature.c:649
const EnumPropertyItem rna_enum_constraint_type_items[]
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
Definition: rna_define.c:1148
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2740
void RNA_define_lib_overridable(const bool make_overridable)
Definition: rna_define.c:742
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
Definition: rna_define.c:1193
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4170
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2236
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1526
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3285
const float rna_default_quaternion[4]
Definition: rna_define.c:1590
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4312
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3126
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1645
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
Definition: rna_define.c:1653
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4273
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3474
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)
Definition: rna_define.c:3420
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1237
const float rna_default_scale_3d[3]
Definition: rna_define.c:1592
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2944
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
Definition: rna_define.c:1598
const float rna_default_axis_angle[4]
Definition: rna_define.c:1591
void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editable)
Definition: rna_define.c:2867
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1872
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1048
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1539
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1737
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1772
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2769
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4347
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2900
const int rna_matrix_dimsize_4x4[]
Definition: rna_define.c:1595
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
Definition: rna_define.c:3224
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
Definition: rna_define.c:2855
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1257
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2669
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1103
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4342
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1495
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
Definition: rna_define.c:3385
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1028
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2601
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3028
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1245
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3687
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
Definition: rna_define.c:1160
void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
Definition: rna_define.c:2879
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3597
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2493
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1664
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3783
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2343
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
Definition: rna_define.c:2043
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
Definition: rna_define.c:2327
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
Definition: rna_define.c:1503
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1518
void RNA_api_pose_channel(struct StructRNA *srna)
Definition: rna_pose_api.c:139
bool rna_ActionGroup_is_custom_colorset_get(struct PointerRNA *ptr)
void RNA_api_pose(struct StructRNA *srna)
Definition: rna_pose_api.c:113
void rna_ActionGroup_colorset_set(struct PointerRNA *ptr, int value)
const EnumPropertyItem rna_enum_object_rotation_mode_items[]
Definition: rna_object.c:281
static void rna_def_pose_ikparam(BlenderRNA *brna)
Definition: rna_pose.c:1587
static const EnumPropertyItem prop_solver_items[]
Definition: rna_pose.c:919
const EnumPropertyItem rna_enum_color_sets_items[]
Definition: rna_pose.c:30
static void rna_def_pose_channel(BlenderRNA *brna)
Definition: rna_pose.c:996
static void rna_def_pose(BlenderRNA *brna)
Definition: rna_pose.c:1652
static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_pose.c:925
static const EnumPropertyItem prop_iksolver_items[]
Definition: rna_pose.c:913
static void rna_def_pose_itasc(BlenderRNA *brna)
Definition: rna_pose.c:1447
void RNA_def_pose(BlenderRNA *brna)
Definition: rna_pose.c:1732
static void rna_def_bone_group(BlenderRNA *brna)
Definition: rna_pose.c:890
void rna_def_actionbone_group_common(StructRNA *srna, int update_flag, const char *update_cb)
Definition: rna_pose.c:861
static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_pose.c:1605
static void update_cb(PBVHNode *node, void *rebuild)
Definition: sculpt_undo.c:133
#define min(a, b)
Definition: sort.c:35
Definition: DNA_ID.h:368
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
struct bPose * pose
void * data
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
struct bActionGroup * next
ListBase constraints
IDProperty * prop
struct Bone * bone
struct bPoseChannel * custom_tx
float pose_head[3]
float pose_tail[3]
void * ikparam
ListBase agroups
int active_group
float max
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480