Blender  V3.3
rna_armature.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include <stdlib.h>
8 
9 #include "BLI_math.h"
10 
11 #include "RNA_access.h"
12 #include "RNA_define.h"
13 
14 #include "rna_internal.h"
15 
16 #include "DNA_armature_types.h"
17 #include "DNA_object_types.h"
18 #include "DNA_scene_types.h"
19 
20 #include "WM_api.h"
21 #include "WM_types.h"
22 
23 #ifdef RNA_RUNTIME
24 
25 # include "BLI_math_vector.h"
26 
27 # include "BKE_action.h"
28 # include "BKE_context.h"
29 # include "BKE_global.h"
30 # include "BKE_idprop.h"
31 # include "BKE_main.h"
32 
33 # include "BKE_armature.h"
34 # include "ED_armature.h"
35 
36 # include "DEG_depsgraph.h"
37 # include "DEG_depsgraph_build.h"
38 
39 static void rna_Armature_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
40 {
41  ID *id = ptr->owner_id;
42 
43  DEG_id_tag_update(id, 0);
45  // WM_main_add_notifier(NC_OBJECT|ND_POSE, NULL);
46 }
47 
48 static void rna_Armature_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
49 {
50  ID *id = ptr->owner_id;
51 
53 
54  DEG_id_tag_update(id, 0);
56 }
57 
58 static void rna_Armature_act_bone_set(PointerRNA *ptr,
59  PointerRNA value,
60  struct ReportList *UNUSED(reports))
61 {
62  bArmature *arm = (bArmature *)ptr->data;
63 
64  if (value.owner_id == NULL && value.data == NULL) {
65  arm->act_bone = NULL;
66  }
67  else {
68  if (value.owner_id != &arm->id) {
69  Object *ob = (Object *)value.owner_id;
70 
71  if (GS(ob->id.name) != ID_OB || (ob->data != arm)) {
72  printf("ERROR: armature set active bone - new active doesn't come from this armature\n");
73  return;
74  }
75  }
76 
77  arm->act_bone = value.data;
78  arm->act_bone->flag |= BONE_SELECTED;
79  }
80 }
81 
82 static void rna_Armature_act_edit_bone_set(PointerRNA *ptr,
83  PointerRNA value,
84  struct ReportList *UNUSED(reports))
85 {
86  bArmature *arm = (bArmature *)ptr->data;
87 
88  if (value.owner_id == NULL && value.data == NULL) {
89  arm->act_edbone = NULL;
90  }
91  else {
92  if (value.owner_id != &arm->id) {
93  /* raise an error! */
94  }
95  else {
96  arm->act_edbone = value.data;
97  ((EditBone *)arm->act_edbone)->flag |= BONE_SELECTED;
98  }
99  }
100 }
101 
102 static EditBone *rna_Armature_edit_bone_new(bArmature *arm, ReportList *reports, const char *name)
103 {
104  if (arm->edbo == NULL) {
105  BKE_reportf(reports,
106  RPT_ERROR,
107  "Armature '%s' not in edit mode, cannot add an editbone",
108  arm->id.name + 2);
109  return NULL;
110  }
111  return ED_armature_ebone_add(arm, name);
112 }
113 
114 static void rna_Armature_edit_bone_remove(bArmature *arm,
115  ReportList *reports,
116  PointerRNA *ebone_ptr)
117 {
118  EditBone *ebone = ebone_ptr->data;
119  if (arm->edbo == NULL) {
120  BKE_reportf(reports,
121  RPT_ERROR,
122  "Armature '%s' not in edit mode, cannot remove an editbone",
123  arm->id.name + 2);
124  return;
125  }
126 
127  if (BLI_findindex(arm->edbo, ebone) == -1) {
128  BKE_reportf(reports,
129  RPT_ERROR,
130  "Armature '%s' does not contain bone '%s'",
131  arm->id.name + 2,
132  ebone->name);
133  return;
134  }
135 
136  ED_armature_ebone_remove(arm, ebone);
137  RNA_POINTER_INVALIDATE(ebone_ptr);
138 }
139 
140 static void rna_Armature_update_layers(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
141 {
142  bArmature *arm = (bArmature *)ptr->owner_id;
143 
146 }
147 
148 static void rna_Armature_redraw_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
149 {
150  ID *id = ptr->owner_id;
151 
154 }
155 
156 /* Unselect bones when hidden */
157 static void rna_Bone_hide_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
158 {
159  bArmature *arm = (bArmature *)ptr->owner_id;
160  Bone *bone = (Bone *)ptr->data;
161 
162  if (bone->flag & BONE_HIDDEN_P) {
163  bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
164  }
165 
168 }
169 
170 /* called whenever a bone is renamed */
171 static void rna_Bone_update_renamed(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
172 {
173  ID *id = ptr->owner_id;
174 
175  /* redraw view */
177 
178  /* update animation channels */
180 }
181 
182 static void rna_Bone_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
183 {
184  ID *id = ptr->owner_id;
185 
186  /* 1) special updates for cases where rigs try to hook into armature drawing stuff
187  * e.g. Mask Modifier - 'Armature' option
188  * 2) tag armature for copy-on-write, so that selection status (set by addons)
189  * will update properly, like standard tools do already
190  */
191  if (id) {
192  if (GS(id->name) == ID_AR) {
193  bArmature *arm = (bArmature *)id;
194 
195  if (arm->flag & ARM_HAS_VIZ_DEPS) {
197  }
198 
200  }
201  else if (GS(id->name) == ID_OB) {
202  Object *ob = (Object *)id;
203  bArmature *arm = (bArmature *)ob->data;
204 
205  if (arm->flag & ARM_HAS_VIZ_DEPS) {
207  }
208 
210  }
211  }
212 
214 
215  /* spaces that show animation data of the selected bone need updating */
217 }
218 
219 static char *rna_Bone_path(const PointerRNA *ptr)
220 {
221  const ID *id = ptr->owner_id;
222  const Bone *bone = (const Bone *)ptr->data;
223  char name_esc[sizeof(bone->name) * 2];
224 
225  BLI_str_escape(name_esc, bone->name, sizeof(name_esc));
226 
227  /* special exception for trying to get the path where ID-block is Object
228  * - this will be assumed to be from a Pose Bone...
229  */
230  if (id) {
231  if (GS(id->name) == ID_OB) {
232  return BLI_sprintfN("pose.bones[\"%s\"].bone", name_esc);
233  }
234  }
235 
236  /* from armature... */
237  return BLI_sprintfN("bones[\"%s\"]", name_esc);
238 }
239 
240 static IDProperty **rna_Bone_idprops(PointerRNA *ptr)
241 {
242  Bone *bone = ptr->data;
243  return &bone->prop;
244 }
245 
246 static IDProperty **rna_EditBone_idprops(PointerRNA *ptr)
247 {
248  EditBone *ebone = ptr->data;
249  return &ebone->prop;
250 }
251 
252 static void rna_bone_layer_set(int *layer, const bool *values)
253 {
254  int i, tot = 0;
255 
256  /* ensure we always have some layer selected */
257  for (i = 0; i < 32; i++) {
258  if (values[i]) {
259  tot++;
260  }
261  }
262 
263  if (tot == 0) {
264  return;
265  }
266 
267  for (i = 0; i < 32; i++) {
268  if (values[i]) {
269  *layer |= (1u << i);
270  }
271  else {
272  *layer &= ~(1u << i);
273  }
274  }
275 }
276 
277 static void rna_Bone_layer_set(PointerRNA *ptr, const bool *values)
278 {
279  bArmature *arm = (bArmature *)ptr->owner_id;
280  Bone *bone = (Bone *)ptr->data;
281 
282  rna_bone_layer_set(&bone->layer, values);
284 }
285 
286 /* TODO: remove the deprecation stubs. */
287 static bool rna_use_inherit_scale_get(char inherit_scale_mode)
288 {
289  return inherit_scale_mode <= BONE_INHERIT_SCALE_FIX_SHEAR;
290 }
291 
292 static void rna_use_inherit_scale_set(char *inherit_scale_mode, bool value)
293 {
294  bool cur_value = (*inherit_scale_mode <= BONE_INHERIT_SCALE_FIX_SHEAR);
295  if (value != cur_value) {
296  *inherit_scale_mode = (value ? BONE_INHERIT_SCALE_FULL : BONE_INHERIT_SCALE_NONE);
297  }
298 }
299 
300 static bool rna_EditBone_use_inherit_scale_get(PointerRNA *ptr)
301 {
302  return rna_use_inherit_scale_get(((EditBone *)ptr->data)->inherit_scale_mode);
303 }
304 
305 static void rna_EditBone_use_inherit_scale_set(PointerRNA *ptr, bool value)
306 {
307  rna_use_inherit_scale_set(&((EditBone *)ptr->data)->inherit_scale_mode, value);
308 }
309 
310 static bool rna_Bone_use_inherit_scale_get(PointerRNA *ptr)
311 {
312  return rna_use_inherit_scale_get(((Bone *)ptr->data)->inherit_scale_mode);
313 }
314 
315 static void rna_Bone_use_inherit_scale_set(PointerRNA *ptr, bool value)
316 {
317  rna_use_inherit_scale_set(&((Bone *)ptr->data)->inherit_scale_mode, value);
318 }
319 
320 static void rna_Armature_layer_set(PointerRNA *ptr, const bool *values)
321 {
322  bArmature *arm = (bArmature *)ptr->data;
323  int i, tot = 0;
324 
325  /* ensure we always have some layer selected */
326  for (i = 0; i < 32; i++) {
327  if (values[i]) {
328  tot++;
329  }
330  }
331 
332  if (tot == 0) {
333  return;
334  }
335 
336  for (i = 0; i < 32; i++) {
337  if (values[i]) {
338  arm->layer |= (1u << i);
339  }
340  else {
341  arm->layer &= ~(1u << i);
342  }
343  }
344 }
345 
346 static void rna_EditBone_name_set(PointerRNA *ptr, const char *value)
347 {
348  bArmature *arm = (bArmature *)ptr->owner_id;
349  EditBone *ebone = (EditBone *)ptr->data;
350  char oldname[sizeof(ebone->name)], newname[sizeof(ebone->name)];
351 
352  /* need to be on the stack */
353  BLI_strncpy_utf8(newname, value, sizeof(ebone->name));
354  BLI_strncpy(oldname, ebone->name, sizeof(ebone->name));
355 
357  ED_armature_bone_rename(G_MAIN, arm, oldname, newname);
358 }
359 
360 static void rna_Bone_name_set(PointerRNA *ptr, const char *value)
361 {
362  bArmature *arm = (bArmature *)ptr->owner_id;
363  Bone *bone = (Bone *)ptr->data;
364  char oldname[sizeof(bone->name)], newname[sizeof(bone->name)];
365 
366  /* need to be on the stack */
367  BLI_strncpy_utf8(newname, value, sizeof(bone->name));
368  BLI_strncpy(oldname, bone->name, sizeof(bone->name));
369 
371  ED_armature_bone_rename(G_MAIN, arm, oldname, newname);
372 }
373 
374 static void rna_EditBone_layer_set(PointerRNA *ptr, const bool values[])
375 {
376  EditBone *data = (EditBone *)(ptr->data);
377  rna_bone_layer_set(&data->layer, values);
378 }
379 
380 static void rna_EditBone_connected_check(EditBone *ebone)
381 {
382  if (ebone->parent) {
383  if (ebone->flag & BONE_CONNECTED) {
384  /* Attach this bone to its parent */
385  copy_v3_v3(ebone->head, ebone->parent->tail);
386 
387  if (ebone->flag & BONE_ROOTSEL) {
388  ebone->parent->flag |= BONE_TIPSEL;
389  }
390  }
391  else if (!(ebone->parent->flag & BONE_ROOTSEL)) {
392  ebone->parent->flag &= ~BONE_TIPSEL;
393  }
394  }
395 }
396 
397 static void rna_EditBone_connected_set(PointerRNA *ptr, bool value)
398 {
399  EditBone *ebone = (EditBone *)(ptr->data);
400 
401  if (value) {
402  ebone->flag |= BONE_CONNECTED;
403  }
404  else {
405  ebone->flag &= ~BONE_CONNECTED;
406  }
407 
408  rna_EditBone_connected_check(ebone);
409 }
410 
411 static PointerRNA rna_EditBone_parent_get(PointerRNA *ptr)
412 {
413  EditBone *data = (EditBone *)(ptr->data);
414  return rna_pointer_inherit_refine(ptr, &RNA_EditBone, data->parent);
415 }
416 
417 static void rna_EditBone_parent_set(PointerRNA *ptr,
418  PointerRNA value,
419  struct ReportList *UNUSED(reports))
420 {
421  EditBone *ebone = (EditBone *)(ptr->data);
422  EditBone *pbone, *parbone = (EditBone *)value.data;
423 
424  if (parbone == NULL) {
425  if (ebone->parent && !(ebone->parent->flag & BONE_ROOTSEL)) {
426  ebone->parent->flag &= ~BONE_TIPSEL;
427  }
428 
429  ebone->parent = NULL;
430  ebone->flag &= ~BONE_CONNECTED;
431  }
432  else {
433  /* within same armature */
434  if (value.owner_id != ptr->owner_id) {
435  return;
436  }
437 
438  /* make sure this is a valid child */
439  if (parbone == ebone) {
440  return;
441  }
442 
443  for (pbone = parbone->parent; pbone; pbone = pbone->parent) {
444  if (pbone == ebone) {
445  return;
446  }
447  }
448 
449  ebone->parent = parbone;
450  rna_EditBone_connected_check(ebone);
451  }
452 }
453 
454 static void rna_EditBone_matrix_get(PointerRNA *ptr, float *values)
455 {
456  EditBone *ebone = (EditBone *)(ptr->data);
457  ED_armature_ebone_to_mat4(ebone, (float(*)[4])values);
458 }
459 
460 static void rna_EditBone_matrix_set(PointerRNA *ptr, const float *values)
461 {
462  EditBone *ebone = (EditBone *)(ptr->data);
463  ED_armature_ebone_from_mat4(ebone, (float(*)[4])values);
464 }
465 
466 static float rna_EditBone_length_get(PointerRNA *ptr)
467 {
468  EditBone *ebone = (EditBone *)(ptr->data);
469  return len_v3v3(ebone->head, ebone->tail);
470 }
471 
472 static void rna_EditBone_length_set(PointerRNA *ptr, float length)
473 {
474  EditBone *ebone = (EditBone *)(ptr->data);
475  float delta[3];
476 
477  sub_v3_v3v3(delta, ebone->tail, ebone->head);
478  if (normalize_v3(delta) == 0.0f) {
479  /* Zero length means directional information is lost. Choose arbitrary direction to avoid
480  * getting stuck. */
481  delta[2] = 1.0f;
482  }
483 
484  madd_v3_v3v3fl(ebone->tail, ebone->head, delta, length);
485 }
486 
487 static void rna_Bone_bbone_handle_update(Main *bmain, Scene *scene, PointerRNA *ptr)
488 {
489  bArmature *arm = (bArmature *)ptr->owner_id;
490  Bone *bone = (Bone *)ptr->data;
491 
492  /* Update all users of this armature after changing B-Bone handles. */
493  for (Object *obt = bmain->objects.first; obt; obt = obt->id.next) {
494  if (obt->data == arm && obt->pose) {
495  bPoseChannel *pchan = BKE_pose_channel_find_name(obt->pose, bone->name);
496 
497  if (pchan && pchan->bone == bone) {
498  BKE_pchan_rebuild_bbone_handles(obt->pose, pchan);
500  }
501  }
502  }
503 
504  rna_Armature_dependency_update(bmain, scene, ptr);
505 }
506 
507 static PointerRNA rna_EditBone_bbone_prev_get(PointerRNA *ptr)
508 {
509  EditBone *data = (EditBone *)(ptr->data);
510  return rna_pointer_inherit_refine(ptr, &RNA_EditBone, data->bbone_prev);
511 }
512 
513 static void rna_EditBone_bbone_prev_set(PointerRNA *ptr,
514  PointerRNA value,
515  struct ReportList *UNUSED(reports))
516 {
517  EditBone *ebone = (EditBone *)(ptr->data);
518  EditBone *hbone = (EditBone *)value.data;
519 
520  /* Within the same armature? */
521  if (hbone == NULL || value.owner_id == ptr->owner_id) {
522  ebone->bbone_prev = hbone;
523  }
524 }
525 
526 static void rna_Bone_bbone_prev_set(PointerRNA *ptr,
527  PointerRNA value,
528  struct ReportList *UNUSED(reports))
529 {
530  Bone *bone = (Bone *)ptr->data;
531  Bone *hbone = (Bone *)value.data;
532 
533  /* Within the same armature? */
534  if (hbone == NULL || value.owner_id == ptr->owner_id) {
535  bone->bbone_prev = hbone;
536  }
537 }
538 
539 static PointerRNA rna_EditBone_bbone_next_get(PointerRNA *ptr)
540 {
541  EditBone *data = (EditBone *)(ptr->data);
542  return rna_pointer_inherit_refine(ptr, &RNA_EditBone, data->bbone_next);
543 }
544 
545 static void rna_EditBone_bbone_next_set(PointerRNA *ptr,
546  PointerRNA value,
547  struct ReportList *UNUSED(reports))
548 {
549  EditBone *ebone = (EditBone *)(ptr->data);
550  EditBone *hbone = (EditBone *)value.data;
551 
552  /* Within the same armature? */
553  if (hbone == NULL || value.owner_id == ptr->owner_id) {
554  ebone->bbone_next = hbone;
555  }
556 }
557 
558 static void rna_Bone_bbone_next_set(PointerRNA *ptr,
559  PointerRNA value,
560  struct ReportList *UNUSED(reports))
561 {
562  Bone *bone = (Bone *)ptr->data;
563  Bone *hbone = (Bone *)value.data;
564 
565  /* Within the same armature? */
566  if (hbone == NULL || value.owner_id == ptr->owner_id) {
567  bone->bbone_next = hbone;
568  }
569 }
570 
571 static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, PointerRNA *ptr)
572 {
573  bArmature *arm = (bArmature *)ptr->owner_id;
574  EditBone *ebone = (EditBone *)ptr->data;
575  EditBone *child;
576 
577  /* update our parent */
578  if (ebone->parent && ebone->flag & BONE_CONNECTED) {
579  copy_v3_v3(ebone->parent->tail, ebone->head);
580  }
581 
582  /* update our children if necessary */
583  for (child = arm->edbo->first; child; child = child->next) {
584  if (child->parent == ebone && (child->flag & BONE_CONNECTED)) {
585  copy_v3_v3(child->head, ebone->tail);
586  }
587  }
588 
589  if (arm->flag & ARM_MIRROR_EDIT) {
591  }
592 
593  rna_Armature_update_data(bmain, scene, ptr);
594 }
595 
596 static void rna_Armature_bones_next(CollectionPropertyIterator *iter)
597 {
598  ListBaseIterator *internal = &iter->internal.listbase;
599  Bone *bone = (Bone *)internal->link;
600 
601  if (bone->childbase.first) {
602  internal->link = (Link *)bone->childbase.first;
603  }
604  else if (bone->next) {
605  internal->link = (Link *)bone->next;
606  }
607  else {
608  internal->link = NULL;
609 
610  do {
611  bone = bone->parent;
612  if (bone && bone->next) {
613  internal->link = (Link *)bone->next;
614  break;
615  }
616  } while (bone);
617  }
618 
619  iter->valid = (internal->link != NULL);
620 }
621 
622 /* not essential, but much faster than the default lookup function */
623 static int rna_Armature_bones_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
624 {
625  bArmature *arm = (bArmature *)ptr->data;
626  Bone *bone = BKE_armature_find_bone_name(arm, key);
627  if (bone) {
628  RNA_pointer_create(ptr->owner_id, &RNA_Bone, bone, r_ptr);
629  return true;
630  }
631  else {
632  return false;
633  }
634 }
635 
636 static bool rna_Armature_is_editmode_get(PointerRNA *ptr)
637 {
638  bArmature *arm = (bArmature *)ptr->owner_id;
639  return (arm->edbo != NULL);
640 }
641 
642 static void rna_Armature_transform(bArmature *arm, float mat[16])
643 {
644  ED_armature_transform(arm, (const float(*)[4])mat, true);
645 }
646 
647 #else
648 
649 void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editbone)
650 {
651  /* NOTE: The pose-mode values get applied over the top of the edit-mode ones. */
652 
653 # define RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone) \
654  { \
655  if (is_posebone) { \
656  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); \
657  } \
658  else if (is_editbone) { \
659  RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update"); \
660  } \
661  else { \
662  RNA_def_property_update(prop, 0, "rna_Armature_update_data"); \
663  } \
664  } \
665  ((void)0)
666 
667  PropertyRNA *prop;
668 
669  /* Roll In/Out */
670  prop = RNA_def_property(srna, "bbone_rollin", PROP_FLOAT, PROP_ANGLE);
671  RNA_def_property_float_sdna(prop, NULL, "roll1");
672  RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, 2);
674  prop, "Roll In", "Roll offset for the start of the B-Bone, adjusts twist");
675  RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
676 
677  prop = RNA_def_property(srna, "bbone_rollout", PROP_FLOAT, PROP_ANGLE);
678  RNA_def_property_float_sdna(prop, NULL, "roll2");
679  RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, 2);
681  prop, "Roll Out", "Roll offset for the end of the B-Bone, adjusts twist");
682  RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
683 
684  if (is_posebone == false) {
685  prop = RNA_def_property(srna, "use_endroll_as_inroll", PROP_BOOLEAN, PROP_NONE);
687  prop, "Inherit End Roll", "Add Roll Out of the Start Handle bone to the Roll In value");
690  RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
691  }
692 
693  /* Curve X/Y Offsets */
694  prop = RNA_def_property(srna, "bbone_curveinx", PROP_FLOAT, PROP_NONE);
695  RNA_def_property_float_sdna(prop, NULL, "curve_in_x");
696  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
698  prop, "In X", "X-axis handle offset for start of the B-Bone's curve, adjusts curvature");
699  RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
700 
701  prop = RNA_def_property(srna, "bbone_curveinz", PROP_FLOAT, PROP_NONE);
702  RNA_def_property_float_sdna(prop, NULL, "curve_in_z");
703  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
705  prop, "In Z", "Z-axis handle offset for start of the B-Bone's curve, adjusts curvature");
706  RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
707 
708  prop = RNA_def_property(srna, "bbone_curveoutx", PROP_FLOAT, PROP_NONE);
709  RNA_def_property_float_sdna(prop, NULL, "curve_out_x");
710  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
712  prop, "Out X", "X-axis handle offset for end of the B-Bone's curve, adjusts curvature");
713  RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
714 
715  prop = RNA_def_property(srna, "bbone_curveoutz", PROP_FLOAT, PROP_NONE);
716  RNA_def_property_float_sdna(prop, NULL, "curve_out_z");
717  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
719  prop, "Out Z", "Z-axis handle offset for end of the B-Bone's curve, adjusts curvature");
720  RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
721 
722  /* Ease In/Out */
723  prop = RNA_def_property(srna, "bbone_easein", PROP_FLOAT, PROP_NONE);
724  RNA_def_property_float_sdna(prop, NULL, "ease1");
725  RNA_def_property_ui_range(prop, -5.0f, 5.0f, 1, 3);
726  RNA_def_property_float_default(prop, 1.0f);
727  RNA_def_property_ui_text(prop, "Ease In", "Length of first Bezier Handle (for B-Bones only)");
728  RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
729 
730  prop = RNA_def_property(srna, "bbone_easeout", PROP_FLOAT, PROP_NONE);
731  RNA_def_property_float_sdna(prop, NULL, "ease2");
732  RNA_def_property_ui_range(prop, -5.0f, 5.0f, 1, 3);
733  RNA_def_property_float_default(prop, 1.0f);
734  RNA_def_property_ui_text(prop, "Ease Out", "Length of second Bezier Handle (for B-Bones only)");
735  RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
736 
737  if (is_posebone == false) {
738  prop = RNA_def_property(srna, "use_scale_easing", PROP_BOOLEAN, PROP_NONE);
740  prop, "Scale Easing", "Multiply the final easing values by the Scale In/Out Y factors");
742  RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
743  }
744 
745  /* Scale In/Out */
746  prop = RNA_def_property(srna, "bbone_scalein", PROP_FLOAT, PROP_XYZ);
747  RNA_def_property_float_sdna(prop, NULL, "scale_in");
748  RNA_def_property_array(prop, 3);
750  RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3);
753  prop,
754  "Scale In",
755  "Scale factors for the start of the B-Bone, adjusts thickness (for tapering effects)");
756  RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
757 
758  prop = RNA_def_property(srna, "bbone_scaleout", PROP_FLOAT, PROP_XYZ);
759  RNA_def_property_float_sdna(prop, NULL, "scale_out");
760  RNA_def_property_array(prop, 3);
762  RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3);
765  prop,
766  "Scale Out",
767  "Scale factors for the end of the B-Bone, adjusts thickness (for tapering effects)");
768  RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
769 
770 # undef RNA_DEF_CURVEBONE_UPDATE
771 }
772 
773 static void rna_def_bone_common(StructRNA *srna, int editbone)
774 {
775  static const EnumPropertyItem prop_bbone_handle_type[] = {
777  "AUTO",
778  0,
779  "Automatic",
780  "Use connected parent and children to compute the handle"},
782  "ABSOLUTE",
783  0,
784  "Absolute",
785  "Use the position of the specified bone to compute the handle"},
787  "RELATIVE",
788  0,
789  "Relative",
790  "Use the offset of the specified bone from rest pose to compute the handle"},
792  "TANGENT",
793  0,
794  "Tangent",
795  "Use the orientation of the specified bone to compute the handle, ignoring the location"},
796  {0, NULL, 0, NULL, NULL},
797  };
798 
799  static const EnumPropertyItem prop_inherit_scale_mode[] = {
800  {BONE_INHERIT_SCALE_FULL, "FULL", 0, "Full", "Inherit all effects of parent scaling"},
802  "FIX_SHEAR",
803  0,
804  "Fix Shear",
805  "Inherit scaling, but remove shearing of the child in the rest orientation"},
807  "ALIGNED",
808  0,
809  "Aligned",
810  "Rotate non-uniform parent scaling to align with the child, applying parent X "
811  "scale to child X axis, and so forth"},
813  "AVERAGE",
814  0,
815  "Average",
816  "Inherit uniform scaling representing the overall change in the volume of the parent"},
817  {BONE_INHERIT_SCALE_NONE, "NONE", 0, "None", "Completely ignore parent scaling"},
819  "NONE_LEGACY",
820  0,
821  "None (Legacy)",
822  "Ignore parent scaling without compensating for parent shear. "
823  "Replicates the effect of disabling the original Inherit Scale checkbox"},
824  {0, NULL, 0, NULL, NULL},
825  };
826 
827  PropertyRNA *prop;
828 
829  /* strings */
830  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
831  RNA_def_property_string_sdna(prop, NULL, "name");
832  RNA_def_property_ui_text(prop, "Name", "");
833  RNA_def_struct_name_property(srna, prop);
834  if (editbone) {
835  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_EditBone_name_set");
836  }
837  else {
838  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Bone_name_set");
839  }
840  RNA_def_property_update(prop, 0, "rna_Bone_update_renamed");
841 
843 
844  /* flags */
845  prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
846  RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
847  RNA_def_property_array(prop, 32);
848  if (editbone) {
849  RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_layer_set");
850  }
851  else {
852  RNA_def_property_boolean_funcs(prop, NULL, "rna_Bone_layer_set");
853  }
854  RNA_def_property_ui_text(prop, "Layers", "Layers bone exists in");
855  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
856 
857  prop = RNA_def_property(srna, "use_connect", PROP_BOOLEAN, PROP_NONE);
859  if (editbone) {
860  RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_connected_set");
861  }
862  else {
864  }
866  prop, "Connected", "When bone has a parent, bone's head is stuck to the parent's tail");
867  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
868 
869  prop = RNA_def_property(srna, "use_inherit_rotation", PROP_BOOLEAN, PROP_NONE);
872  prop, "Inherit Rotation", "Bone inherits rotation or scale from parent bone");
873  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
874 
875  prop = RNA_def_property(srna, "use_envelope_multiply", PROP_BOOLEAN, PROP_NONE);
878  prop,
879  "Multiply Vertex Group with Envelope",
880  "When deforming bone, multiply effects of Vertex Group weights with Envelope influence");
881  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
882 
883  prop = RNA_def_property(srna, "use_deform", PROP_BOOLEAN, PROP_NONE);
885  RNA_def_property_ui_text(prop, "Deform", "Enable Bone to deform geometry");
886  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
887 
888  prop = RNA_def_property(srna, "inherit_scale", PROP_ENUM, PROP_NONE);
890  prop, "Inherit Scale", "Specifies how the bone inherits scaling from the parent bone");
891  RNA_def_property_enum_sdna(prop, NULL, "inherit_scale_mode");
892  RNA_def_property_enum_items(prop, prop_inherit_scale_mode);
893  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
894 
895  /* TODO: remove the compatibility stub. */
896  prop = RNA_def_property(srna, "use_inherit_scale", PROP_BOOLEAN, PROP_NONE);
898  prop, "Inherit Scale", "DEPRECATED: Bone inherits scaling from parent bone");
899  if (editbone) {
901  prop, "rna_EditBone_use_inherit_scale_get", "rna_EditBone_use_inherit_scale_set");
902  }
903  else {
905  prop, "rna_Bone_use_inherit_scale_get", "rna_Bone_use_inherit_scale_set");
906  }
907  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
908 
909  prop = RNA_def_property(srna, "use_local_location", PROP_BOOLEAN, PROP_NONE);
910  RNA_def_property_ui_text(prop, "Local Location", "Bone location is set in local space");
912  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
913 
914  prop = RNA_def_property(srna, "use_relative_parent", PROP_BOOLEAN, PROP_NONE);
916  prop, "Relative Parenting", "Object children will use relative transform, like deform");
918  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
919 
920  prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
923  prop,
924  "Display Wire",
925  "Bone is always displayed in wireframe regardless of viewport shading mode "
926  "(useful for non-obstructive custom bone shapes)");
927  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
928 
929  /* XXX: use_cyclic_offset is deprecated in 2.5. May/may not return */
930  prop = RNA_def_property(srna, "use_cyclic_offset", PROP_BOOLEAN, PROP_NONE);
933  prop,
934  "Cyclic Offset",
935  "When bone doesn't have a parent, it receives cyclic offset effects (Deprecated)");
936  // "When bone doesn't have a parent, it receives cyclic offset effects");
937  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
938 
939  prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
941  RNA_def_property_ui_text(prop, "Selectable", "Bone is able to be selected");
942  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
943 
944  /* Number values */
945  /* envelope deform settings */
946  prop = RNA_def_property(srna, "envelope_distance", PROP_FLOAT, PROP_DISTANCE);
947  if (editbone) {
948  RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
949  }
950  else {
951  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
952  }
953  RNA_def_property_float_sdna(prop, NULL, "dist");
954  RNA_def_property_range(prop, 0.0f, 1000.0f);
956  prop, "Envelope Deform Distance", "Bone deformation distance (for Envelope deform only)");
957 
958  prop = RNA_def_property(srna, "envelope_weight", PROP_FLOAT, PROP_NONE);
959  RNA_def_property_float_sdna(prop, NULL, "weight");
960  RNA_def_property_range(prop, 0.0f, 1000.0f);
962  prop, "Envelope Deform Weight", "Bone deformation weight (for Envelope deform only)");
963  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
964 
965  prop = RNA_def_property(srna, "head_radius", PROP_FLOAT, PROP_DISTANCE);
966  if (editbone) {
967  RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
968  }
969  else {
970  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
971  }
972  RNA_def_property_float_sdna(prop, NULL, "rad_head");
973  /* XXX range is 0 to limit, where limit = 10000.0f * MAX2(1.0, view3d->grid); */
974  // RNA_def_property_range(prop, 0, 1000);
975  RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
977  prop, "Envelope Head Radius", "Radius of head of bone (for Envelope deform only)");
978 
979  prop = RNA_def_property(srna, "tail_radius", PROP_FLOAT, PROP_DISTANCE);
980  if (editbone) {
981  RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
982  }
983  else {
984  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
985  }
986  RNA_def_property_float_sdna(prop, NULL, "rad_tail");
987  /* XXX range is 0 to limit, where limit = 10000.0f * MAX2(1.0, view3d->grid); */
988  // RNA_def_property_range(prop, 0, 1000);
989  RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
991  prop, "Envelope Tail Radius", "Radius of tail of bone (for Envelope deform only)");
992 
993  /* b-bones deform settings */
994  prop = RNA_def_property(srna, "bbone_segments", PROP_INT, PROP_NONE);
995  if (editbone) {
996  RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
997  }
998  else {
999  RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
1000  }
1001  RNA_def_property_int_sdna(prop, NULL, "segments");
1002  RNA_def_property_range(prop, 1, 32);
1004  prop, "B-Bone Segments", "Number of subdivisions of bone (for B-Bones only)");
1005 
1006  prop = RNA_def_property(srna, "bbone_x", PROP_FLOAT, PROP_NONE);
1007  if (editbone) {
1008  RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1009  }
1010  else {
1011  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1012  }
1013  RNA_def_property_float_sdna(prop, NULL, "xwidth");
1015  RNA_def_property_ui_text(prop, "B-Bone Display X Width", "B-Bone X size");
1016 
1017  prop = RNA_def_property(srna, "bbone_z", PROP_FLOAT, PROP_NONE);
1018  if (editbone) {
1019  RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1020  }
1021  else {
1022  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1023  }
1024  RNA_def_property_float_sdna(prop, NULL, "zwidth");
1026  RNA_def_property_ui_text(prop, "B-Bone Display Z Width", "B-Bone Z size");
1027 
1028  /* B-Bone Start Handle settings. */
1029  prop = RNA_def_property(srna, "bbone_handle_type_start", PROP_ENUM, PROP_NONE);
1030  RNA_def_property_enum_sdna(prop, NULL, "bbone_prev_type");
1031  RNA_def_property_enum_items(prop, prop_bbone_handle_type);
1034  prop, "B-Bone Start Handle Type", "Selects how the start handle of the B-Bone is computed");
1035  RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
1036 
1037  prop = RNA_def_property(srna, "bbone_custom_handle_start", PROP_POINTER, PROP_NONE);
1038  RNA_def_property_pointer_sdna(prop, NULL, "bbone_prev");
1039  RNA_def_property_struct_type(prop, editbone ? "EditBone" : "Bone");
1040  if (editbone) {
1042  prop, "rna_EditBone_bbone_prev_get", "rna_EditBone_bbone_prev_set", NULL, NULL);
1043  RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
1044  }
1045  else {
1046  RNA_def_property_pointer_funcs(prop, NULL, "rna_Bone_bbone_prev_set", NULL, NULL);
1047  RNA_def_property_update(prop, 0, "rna_Bone_bbone_handle_update");
1048  }
1052  prop, "B-Bone Start Handle", "Bone that serves as the start handle for the B-Bone curve");
1053 
1054  prop = RNA_def_property(srna, "bbone_handle_use_scale_start", PROP_BOOLEAN, PROP_NONE);
1056  prop,
1057  "Start Handle Scale",
1058  "Multiply B-Bone Scale In channels by the local scale values of the start handle. "
1059  "This is done after the Scale Easing option and isn't affected by it");
1060  RNA_def_property_boolean_sdna(prop, NULL, "bbone_prev_flag", BBONE_HANDLE_SCALE_X);
1061  RNA_def_property_array(prop, 3);
1062  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1063 
1064  prop = RNA_def_property(srna, "bbone_handle_use_ease_start", PROP_BOOLEAN, PROP_NONE);
1066  prop,
1067  "Start Handle Ease",
1068  "Multiply the B-Bone Ease In channel by the local Y scale value of the start handle. "
1069  "This is done after the Scale Easing option and isn't affected by it");
1070  RNA_def_property_boolean_sdna(prop, NULL, "bbone_prev_flag", BBONE_HANDLE_SCALE_EASE);
1071  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1072 
1073  /* B-Bone End Handle settings. */
1074  prop = RNA_def_property(srna, "bbone_handle_type_end", PROP_ENUM, PROP_NONE);
1075  RNA_def_property_enum_sdna(prop, NULL, "bbone_next_type");
1076  RNA_def_property_enum_items(prop, prop_bbone_handle_type);
1079  prop, "B-Bone End Handle Type", "Selects how the end handle of the B-Bone is computed");
1080  RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
1081 
1082  prop = RNA_def_property(srna, "bbone_custom_handle_end", PROP_POINTER, PROP_NONE);
1083  RNA_def_property_pointer_sdna(prop, NULL, "bbone_next");
1084  RNA_def_property_struct_type(prop, editbone ? "EditBone" : "Bone");
1085  if (editbone) {
1087  prop, "rna_EditBone_bbone_next_get", "rna_EditBone_bbone_next_set", NULL, NULL);
1088  RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
1089  }
1090  else {
1091  RNA_def_property_pointer_funcs(prop, NULL, "rna_Bone_bbone_next_set", NULL, NULL);
1092  RNA_def_property_update(prop, 0, "rna_Bone_bbone_handle_update");
1093  }
1097  prop, "B-Bone End Handle", "Bone that serves as the end handle for the B-Bone curve");
1098 
1099  prop = RNA_def_property(srna, "bbone_handle_use_scale_end", PROP_BOOLEAN, PROP_NONE);
1101  prop,
1102  "End Handle Scale",
1103  "Multiply B-Bone Scale Out channels by the local scale values of the end handle. "
1104  "This is done after the Scale Easing option and isn't affected by it");
1105  RNA_def_property_boolean_sdna(prop, NULL, "bbone_next_flag", BBONE_HANDLE_SCALE_X);
1106  RNA_def_property_array(prop, 3);
1107  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1108 
1109  prop = RNA_def_property(srna, "bbone_handle_use_ease_end", PROP_BOOLEAN, PROP_NONE);
1111  prop,
1112  "End Handle Ease",
1113  "Multiply the B-Bone Ease Out channel by the local Y scale value of the end handle. "
1114  "This is done after the Scale Easing option and isn't affected by it");
1115  RNA_def_property_boolean_sdna(prop, NULL, "bbone_next_flag", BBONE_HANDLE_SCALE_EASE);
1116  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1117 
1119 }
1120 
1121 /* err... bones should not be directly edited (only editbones should be...) */
1122 static void rna_def_bone(BlenderRNA *brna)
1123 {
1124  StructRNA *srna;
1125  PropertyRNA *prop;
1126 
1127  srna = RNA_def_struct(brna, "Bone", NULL);
1128  RNA_def_struct_ui_text(srna, "Bone", "Bone in an Armature data-block");
1129  RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
1130  RNA_def_struct_path_func(srna, "rna_Bone_path");
1131  RNA_def_struct_idprops_func(srna, "rna_Bone_idprops");
1132 
1133  /* pointers/collections */
1134  /* parent (pointer) */
1135  prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
1136  RNA_def_property_struct_type(prop, "Bone");
1137  RNA_def_property_pointer_sdna(prop, NULL, "parent");
1139  RNA_def_property_ui_text(prop, "Parent", "Parent bone (in same Armature)");
1140  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1141 
1142  /* children (collection) */
1143  prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
1144  RNA_def_property_collection_sdna(prop, NULL, "childbase", NULL);
1145  RNA_def_property_struct_type(prop, "Bone");
1147  RNA_def_property_ui_text(prop, "Children", "Bones which are children of this bone");
1148 
1149  rna_def_bone_common(srna, 0);
1150  rna_def_bone_curved_common(srna, false, false);
1151 
1153 
1154  /* XXX should we define this in PoseChannel wrapping code instead?
1155  * But PoseChannels directly get some of their flags from here... */
1156  prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
1159  prop,
1160  "Hide",
1161  "Bone is not visible when it is not in Edit Mode (i.e. in Object or Pose Modes)");
1162  RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
1163  RNA_def_property_update(prop, 0, "rna_Bone_hide_update");
1164 
1165  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1167  RNA_def_property_ui_text(prop, "Select", "");
1169  prop,
1170  PROP_ANIMATABLE); /* XXX: review whether this could be used for interesting effects... */
1171  RNA_def_property_update(prop, 0, "rna_Bone_select_update");
1172 
1173  prop = RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
1175  RNA_def_property_ui_text(prop, "Select Head", "");
1177  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1178 
1179  prop = RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
1181  RNA_def_property_ui_text(prop, "Select Tail", "");
1183  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1184 
1185  /* XXX better matrix descriptions possible (Arystan) */
1186  prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
1187  RNA_def_property_float_sdna(prop, NULL, "bone_mat");
1190  RNA_def_property_ui_text(prop, "Bone Matrix", "3x3 bone matrix");
1191 
1192  prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
1193  RNA_def_property_float_sdna(prop, NULL, "arm_mat");
1197  prop, "Bone Armature-Relative Matrix", "4x4 bone matrix relative to armature");
1198 
1199  prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
1200  RNA_def_property_float_sdna(prop, NULL, "tail");
1201  RNA_def_property_array(prop, 3);
1204  prop, "Tail", "Location of tail end of the bone relative to its parent");
1205  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
1206 
1207  prop = RNA_def_property(srna, "tail_local", PROP_FLOAT, PROP_TRANSLATION);
1208  RNA_def_property_float_sdna(prop, NULL, "arm_tail");
1209  RNA_def_property_array(prop, 3);
1212  prop, "Armature-Relative Tail", "Location of tail end of the bone relative to armature");
1213  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
1214 
1215  prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
1216  RNA_def_property_float_sdna(prop, NULL, "head");
1217  RNA_def_property_array(prop, 3);
1220  prop, "Head", "Location of head end of the bone relative to its parent");
1221  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
1222 
1223  prop = RNA_def_property(srna, "head_local", PROP_FLOAT, PROP_TRANSLATION);
1224  RNA_def_property_float_sdna(prop, NULL, "arm_head");
1225  RNA_def_property_array(prop, 3);
1228  prop, "Armature-Relative Head", "Location of head end of the bone relative to armature");
1229  RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
1230 
1231  prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_DISTANCE);
1232  RNA_def_property_float_sdna(prop, NULL, "length");
1234  RNA_def_property_ui_text(prop, "Length", "Length of the bone");
1235 
1237 
1238  RNA_api_bone(srna);
1239 }
1240 
1241 static void rna_def_edit_bone(BlenderRNA *brna)
1242 {
1243  StructRNA *srna;
1244  PropertyRNA *prop;
1245 
1246  srna = RNA_def_struct(brna, "EditBone", NULL);
1247  RNA_def_struct_sdna(srna, "EditBone");
1248  RNA_def_struct_idprops_func(srna, "rna_EditBone_idprops");
1249  RNA_def_struct_ui_text(srna, "Edit Bone", "Edit mode bone in an armature data-block");
1250  RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
1251 
1252  RNA_define_verify_sdna(0); /* not in sdna */
1253 
1254  prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
1255  RNA_def_property_struct_type(prop, "EditBone");
1257  prop, "rna_EditBone_parent_get", "rna_EditBone_parent_set", NULL, NULL);
1259  RNA_def_property_ui_text(prop, "Parent", "Parent edit bone (in same Armature)");
1260  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1261 
1262  prop = RNA_def_property(srna, "roll", PROP_FLOAT, PROP_ANGLE);
1263  RNA_def_property_float_sdna(prop, NULL, "roll");
1264  RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, 2);
1265  RNA_def_property_ui_text(prop, "Roll", "Bone rotation around head-tail axis");
1267  RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1268 
1269  prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
1270  RNA_def_property_float_sdna(prop, NULL, "head");
1272  RNA_def_property_array(prop, 3);
1273  RNA_def_property_ui_text(prop, "Head", "Location of head end of the bone");
1275  RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1276 
1277  prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
1278  RNA_def_property_float_sdna(prop, NULL, "tail");
1280  RNA_def_property_array(prop, 3);
1281  RNA_def_property_ui_text(prop, "Tail", "Location of tail end of the bone");
1283  RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1284 
1285  prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_DISTANCE);
1286  RNA_def_property_float_funcs(prop, "rna_EditBone_length_get", "rna_EditBone_length_set", NULL);
1287  RNA_def_property_range(prop, 0, FLT_MAX);
1289  RNA_def_property_ui_text(prop, "Length", "Length of the bone. Changing moves the tail end");
1291  RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1292 
1293  rna_def_bone_common(srna, 1);
1294  rna_def_bone_curved_common(srna, false, true);
1295 
1296  prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
1298  RNA_def_property_ui_text(prop, "Hide", "Bone is not visible when in Edit Mode");
1300  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1301 
1302  prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
1304  RNA_def_property_ui_text(prop, "Lock", "Bone is not able to be transformed when in Edit Mode");
1306  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1307 
1308  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1310  RNA_def_property_ui_text(prop, "Select", "");
1312  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1313 
1314  prop = RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
1316  RNA_def_property_ui_text(prop, "Head Select", "");
1318  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1319 
1320  prop = RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
1322  RNA_def_property_ui_text(prop, "Tail Select", "");
1324  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1325 
1326  /* calculated and read only, not actual data access */
1327  prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
1328  // RNA_def_property_float_sdna(prop, NULL, ""); /* Doesn't access any real data. */
1330  // RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1331  RNA_def_property_flag(prop, PROP_THICK_WRAP); /* no reference to original data */
1333  prop,
1334  "Edit Bone Matrix",
1335  "Matrix combining location and rotation of the bone (head position, direction and roll), "
1336  "in armature space (does not include/support bone's length/size)");
1337  RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", "rna_EditBone_matrix_set", NULL);
1338 
1340 
1342 }
1343 
1344 /* armature.bones.* */
1346 {
1347  StructRNA *srna;
1348  PropertyRNA *prop;
1349 
1350  /* FunctionRNA *func; */
1351  /* PropertyRNA *parm; */
1352 
1353  RNA_def_property_srna(cprop, "ArmatureBones");
1354  srna = RNA_def_struct(brna, "ArmatureBones", NULL);
1355  RNA_def_struct_sdna(srna, "bArmature");
1356  RNA_def_struct_ui_text(srna, "Armature Bones", "Collection of armature bones");
1357 
1358  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1359  RNA_def_property_struct_type(prop, "Bone");
1360  RNA_def_property_pointer_sdna(prop, NULL, "act_bone");
1362  RNA_def_property_ui_text(prop, "Active Bone", "Armature's active bone");
1363  RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_bone_set", NULL, NULL);
1364 
1365  /* TODO: redraw. */
1366  /* RNA_def_property_collection_active(prop, prop_act); */
1367 }
1368 
1369 /* armature.bones.* */
1371 {
1372  StructRNA *srna;
1373  PropertyRNA *prop;
1374 
1375  FunctionRNA *func;
1376  PropertyRNA *parm;
1377 
1378  RNA_def_property_srna(cprop, "ArmatureEditBones");
1379  srna = RNA_def_struct(brna, "ArmatureEditBones", NULL);
1380  RNA_def_struct_sdna(srna, "bArmature");
1381  RNA_def_struct_ui_text(srna, "Armature EditBones", "Collection of armature edit bones");
1382 
1383  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1384  RNA_def_property_struct_type(prop, "EditBone");
1385  RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
1387  RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
1388  // RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update");
1389  RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL, NULL);
1390 
1391  /* TODO: redraw. */
1392  /* RNA_def_property_collection_active(prop, prop_act); */
1393 
1394  /* add target */
1395  func = RNA_def_function(srna, "new", "rna_Armature_edit_bone_new");
1397  RNA_def_function_ui_description(func, "Add a new bone");
1398  parm = RNA_def_string(func, "name", "Object", 0, "", "New name for the bone");
1400  /* return type */
1401  parm = RNA_def_pointer(func, "bone", "EditBone", "", "Newly created edit bone");
1402  RNA_def_function_return(func, parm);
1403 
1404  /* remove target */
1405  func = RNA_def_function(srna, "remove", "rna_Armature_edit_bone_remove");
1407  RNA_def_function_ui_description(func, "Remove an existing bone from the armature");
1408  /* Target to remove. */
1409  parm = RNA_def_pointer(func, "bone", "EditBone", "", "EditBone to remove");
1412 }
1413 
1414 static void rna_def_armature(BlenderRNA *brna)
1415 {
1416  StructRNA *srna;
1417  PropertyRNA *prop;
1418 
1419  FunctionRNA *func;
1420  PropertyRNA *parm;
1421 
1422  static const EnumPropertyItem prop_drawtype_items[] = {
1423  {ARM_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape (default)"},
1424  {ARM_LINE, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"},
1425  {ARM_B_BONE,
1426  "BBONE",
1427  0,
1428  "B-Bone",
1429  "Display bones as boxes, showing subdivision and B-Splines"},
1430  {ARM_ENVELOPE,
1431  "ENVELOPE",
1432  0,
1433  "Envelope",
1434  "Display bones as extruded spheres, showing deformation influence volume"},
1435  {ARM_WIRE,
1436  "WIRE",
1437  0,
1438  "Wire",
1439  "Display bones as thin wires, showing subdivision and B-Splines"},
1440  {0, NULL, 0, NULL, NULL},
1441  };
1442  static const EnumPropertyItem prop_pose_position_items[] = {
1443  {0, "POSE", 0, "Pose Position", "Show armature in posed state"},
1444  {ARM_RESTPOS,
1445  "REST",
1446  0,
1447  "Rest Position",
1448  "Show Armature in binding pose state (no posing possible)"},
1449  {0, NULL, 0, NULL, NULL},
1450  };
1451 
1452  srna = RNA_def_struct(brna, "Armature", "ID");
1454  srna,
1455  "Armature",
1456  "Armature data-block containing a hierarchy of bones, usually used for rigging characters");
1457  RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA);
1458  RNA_def_struct_sdna(srna, "bArmature");
1459 
1460  func = RNA_def_function(srna, "transform", "rna_Armature_transform");
1461  RNA_def_function_ui_description(func, "Transform armature bones by a matrix");
1462  parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
1464 
1465  /* Animation Data */
1467 
1469 
1470  /* Collections */
1471  prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
1472  RNA_def_property_collection_sdna(prop, NULL, "bonebase", NULL);
1474  NULL,
1475  "rna_Armature_bones_next",
1476  NULL,
1477  NULL,
1478  NULL,
1479  NULL,
1480  "rna_Armature_bones_lookup_string",
1481  NULL);
1482  RNA_def_property_struct_type(prop, "Bone");
1483  RNA_def_property_ui_text(prop, "Bones", "");
1484  rna_def_armature_bones(brna, prop);
1485 
1486  prop = RNA_def_property(srna, "edit_bones", PROP_COLLECTION, PROP_NONE);
1487  RNA_def_property_collection_sdna(prop, NULL, "edbo", NULL);
1488  RNA_def_property_struct_type(prop, "EditBone");
1489  RNA_def_property_ui_text(prop, "Edit Bones", "");
1490  rna_def_armature_edit_bones(brna, prop);
1491 
1492  /* Enum values */
1493  prop = RNA_def_property(srna, "pose_position", PROP_ENUM, PROP_NONE);
1495  RNA_def_property_enum_items(prop, prop_pose_position_items);
1497  prop, "Pose Position", "Show armature in binding pose or final posed state");
1498  RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1500 
1501  prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
1502  RNA_def_property_enum_sdna(prop, NULL, "drawtype");
1503  RNA_def_property_enum_items(prop, prop_drawtype_items);
1504  RNA_def_property_ui_text(prop, "Display Type", "");
1505  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1507 
1508  /* Boolean values */
1509  /* layer */
1510  prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1511  RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
1512  RNA_def_property_array(prop, 32);
1513  RNA_def_property_ui_text(prop, "Visible Layers", "Armature layer visibility");
1514  RNA_def_property_boolean_funcs(prop, NULL, "rna_Armature_layer_set");
1515  RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Armature_update_layers");
1517 
1518  /* layer protection */
1519  prop = RNA_def_property(srna, "layers_protected", PROP_BOOLEAN, PROP_LAYER);
1520  RNA_def_property_boolean_sdna(prop, NULL, "layer_protected", 1);
1521  RNA_def_property_array(prop, 32);
1523  "Layer Proxy Protection",
1524  "Protected layers in Proxy Instances are restored to Proxy settings "
1525  "on file reload and undo");
1526  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1527 
1528  /* flag */
1529  prop = RNA_def_property(srna, "show_axes", PROP_BOOLEAN, PROP_NONE);
1531  RNA_def_property_ui_text(prop, "Display Axes", "Display bone axes");
1532  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1534 
1535  prop = RNA_def_property(srna, "axes_position", PROP_FLOAT, PROP_FACTOR);
1536  RNA_def_property_float_sdna(prop, NULL, "axes_position");
1537  RNA_def_property_range(prop, 0.0, 1.0);
1538  RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 1);
1540  "Axes Position",
1541  "The position for the axes on the bone. Increasing the value moves it "
1542  "closer to the tip; decreasing moves it closer to the root");
1543  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1544 
1545  prop = RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
1547  RNA_def_property_ui_text(prop, "Display Names", "Display bone names");
1548  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1550 
1551  prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
1554  prop, "X-Axis Mirror", "Apply changes to matching bone on opposite side of X-Axis");
1555  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1557 
1558  prop = RNA_def_property(srna, "show_bone_custom_shapes", PROP_BOOLEAN, PROP_NONE);
1561  prop, "Display Custom Bone Shapes", "Display bones with their custom shapes");
1562  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1563 
1564  prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE);
1566  RNA_def_property_ui_text(prop, "Display Bone Group Colors", "Display bone group colors");
1567  RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1568 
1569  prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
1570  RNA_def_property_boolean_funcs(prop, "rna_Armature_is_editmode_get", NULL);
1572  RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
1573 
1575 }
1576 
1578 {
1579  rna_def_armature(brna);
1580  rna_def_bone(brna);
1581  rna_def_edit_bone(brna);
1582 }
1583 
1584 #endif
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_find_name(const struct bPose *pose, const char *name)
struct Bone * BKE_armature_find_bone_name(struct bArmature *arm, const char *name)
Definition: armature.c:594
void BKE_armature_refresh_layer_used(struct Depsgraph *depsgraph, struct bArmature *arm)
Definition: armature.c:675
void BKE_pchan_rebuild_bbone_handles(struct bPose *pose, struct bPoseChannel *pchan)
Definition: armature.c:2345
#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
#define BLI_assert(a)
Definition: BLI_assert.h:46
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#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 float normalize_v3(float r[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
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_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
#define UNUSED(x)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_COPY_ON_WRITE
Definition: DNA_ID.h:834
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
@ ID_AR
Definition: DNA_ID_enums.h:66
@ ID_OB
Definition: DNA_ID_enums.h:47
@ BBONE_HANDLE_AUTO
@ BBONE_HANDLE_TANGENT
@ BBONE_HANDLE_ABSOLUTE
@ BBONE_HANDLE_RELATIVE
@ BONE_ROOTSEL
@ BONE_DRAWWIRE
@ BONE_SELECTED
@ BONE_NO_CYCLICOFFSET
@ BONE_UNSELECTABLE
@ BONE_HIDDEN_A
@ BONE_EDITMODE_LOCKED
@ BONE_NO_LOCAL_LOCATION
@ BONE_MULT_VG_ENV
@ BONE_HIDDEN_P
@ BONE_TIPSEL
@ BONE_NO_DEFORM
@ BONE_CONNECTED
@ BONE_RELATIVE_PARENTING
@ BONE_HINGE
@ ARM_NO_CUSTOM
@ ARM_HAS_VIZ_DEPS
@ ARM_COL_CUSTOM
@ ARM_DRAWNAMES
@ ARM_MIRROR_EDIT
@ ARM_DRAWAXES
@ ARM_RESTPOS
@ ARM_OCTA
@ ARM_LINE
@ ARM_B_BONE
@ ARM_ENVELOPE
@ ARM_WIRE
@ BBONE_ADD_PARENT_END_ROLL
@ BBONE_SCALE_EASING
@ BBONE_HANDLE_SCALE_EASE
@ BBONE_HANDLE_SCALE_X
@ BONE_INHERIT_SCALE_FULL
@ BONE_INHERIT_SCALE_NONE
@ BONE_INHERIT_SCALE_FIX_SHEAR
@ BONE_INHERIT_SCALE_NONE_LEGACY
@ BONE_INHERIT_SCALE_ALIGNED
@ BONE_INHERIT_SCALE_AVERAGE
Object is a sort of wrapper for general info.
#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
@ 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_NO_COMPARISON
Definition: RNA_types.h:320
@ 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_MATRIX
Definition: RNA_types.h:158
@ PROP_XYZ
Definition: RNA_types.h:162
@ PROP_DISTANCE
Definition: RNA_types.h:149
@ PROP_LAYER_MEMBER
Definition: RNA_types.h:171
@ PROP_ANGLE
Definition: RNA_types.h:145
@ PROP_NONE
Definition: RNA_types.h:126
@ PROP_FACTOR
Definition: RNA_types.h:144
@ PROP_TRANSLATION
Definition: RNA_types.h:154
@ PROP_LAYER
Definition: RNA_types.h:170
#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 ND_POSE
Definition: WM_types.h:407
#define NC_OBJECT
Definition: WM_types.h:329
#define ND_ANIMCHAN
Definition: WM_types.h:444
EditBone * ED_armature_ebone_add(bArmature *arm, const char *name)
Definition: armature_add.c:51
void ED_armature_transform(bArmature *arm, const float mat[4][4], const bool do_props)
Definition: armature_edit.c:90
void ED_armature_bone_rename(Main *bmain, bArmature *arm, const char *oldnamep, const char *newnamep)
void ED_armature_ebone_transform_mirror_update(bArmature *arm, EditBone *ebo, bool check_select)
void ED_armature_ebone_to_mat4(EditBone *ebone, float r_mat[4][4])
void ED_armature_ebone_remove(bArmature *arm, EditBone *exBone)
void ED_armature_ebone_from_mat4(EditBone *ebone, const float mat[4][4])
return(oflags[bm->toolflag_index].f &oflag) !=0
Scene scene
#define GS(x)
Definition: iris.c:225
T length(const vec_base< T, Size > &a)
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
Definition: rna_access.c:186
void rna_def_animdata_common(StructRNA *srna)
void RNA_def_armature(BlenderRNA *brna)
static void rna_def_bone(BlenderRNA *brna)
#define RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone)
static void rna_def_bone_common(StructRNA *srna, int editbone)
Definition: rna_armature.c:773
static void rna_def_edit_bone(BlenderRNA *brna)
static void rna_def_armature(BlenderRNA *brna)
static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop)
void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editbone)
Definition: rna_armature.c:649
static void rna_def_armature_bones(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_api_armature_edit_bone(StructRNA *srna)
void RNA_api_bone(StructRNA *srna)
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
void RNA_def_property_float_default(PropertyRNA *prop, float value)
Definition: rna_define.c:2022
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4312
PropertyRNA * RNA_def_float_matrix(StructOrFunctionRNA *cont_, const char *identifier, int rows, int columns, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3954
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3126
void RNA_define_verify_sdna(bool verify)
Definition: rna_define.c:737
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1645
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2695
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
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
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
const int rna_matrix_dimsize_3x3[]
Definition: rna_define.c:1594
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_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
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
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
struct Bone * parent
struct Bone * bbone_prev
char name[64]
struct Bone * bbone_next
IDProperty * prop
struct Bone * next
ListBase childbase
ListBaseIterator listbase
Definition: RNA_types.h:409
union CollectionPropertyIterator::@1147 internal
char name[64]
Definition: BKE_armature.h:43
struct EditBone * next
Definition: BKE_armature.h:33
float tail[3]
Definition: BKE_armature.h:54
struct EditBone * bbone_next
Definition: BKE_armature.h:90
struct EditBone * parent
Definition: BKE_armature.h:41
struct IDProperty * prop
Definition: BKE_armature.h:35
struct EditBone * bbone_prev
Definition: BKE_armature.h:89
float head[3]
Definition: BKE_armature.h:53
Definition: DNA_ID.h:368
char name[66]
Definition: DNA_ID.h:378
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
ListBase objects
Definition: BKE_main.h:170
void * data
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
struct EditBone * act_edbone
unsigned int layer
ListBase * edbo
struct Bone * bone
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480