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