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