Blender V4.5
rna_armature.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10
12
13#include "BLT_translation.hh"
14
15#include "RNA_define.hh"
16
17#include "rna_internal.hh"
18
19#include "DNA_armature_types.h"
20
21#include "ED_anim_api.hh"
22
23#include "WM_api.hh"
24#include "WM_types.hh"
25
26/* Bone Collection Color Sets */
28 {0, "DEFAULT", 0, "Default Colors", ""},
29 {1, "THEME01", ICON_COLORSET_01_VEC, "01 - Theme Color Set", ""},
30 {2, "THEME02", ICON_COLORSET_02_VEC, "02 - Theme Color Set", ""},
31 {3, "THEME03", ICON_COLORSET_03_VEC, "03 - Theme Color Set", ""},
32 {4, "THEME04", ICON_COLORSET_04_VEC, "04 - Theme Color Set", ""},
33 {5, "THEME05", ICON_COLORSET_05_VEC, "05 - Theme Color Set", ""},
34 {6, "THEME06", ICON_COLORSET_06_VEC, "06 - Theme Color Set", ""},
35 {7, "THEME07", ICON_COLORSET_07_VEC, "07 - Theme Color Set", ""},
36 {8, "THEME08", ICON_COLORSET_08_VEC, "08 - Theme Color Set", ""},
37 {9, "THEME09", ICON_COLORSET_09_VEC, "09 - Theme Color Set", ""},
38 {10, "THEME10", ICON_COLORSET_10_VEC, "10 - Theme Color Set", ""},
39 {11, "THEME11", ICON_COLORSET_11_VEC, "11 - Theme Color Set", ""},
40 {12, "THEME12", ICON_COLORSET_12_VEC, "12 - Theme Color Set", ""},
41 {13, "THEME13", ICON_COLORSET_13_VEC, "13 - Theme Color Set", ""},
42 {14, "THEME14", ICON_COLORSET_14_VEC, "14 - Theme Color Set", ""},
43 {15, "THEME15", ICON_COLORSET_15_VEC, "15 - Theme Color Set", ""},
44 {16, "THEME16", ICON_COLORSET_16_VEC, "16 - Theme Color Set", ""},
45 {17, "THEME17", ICON_COLORSET_17_VEC, "17 - Theme Color Set", ""},
46 {18, "THEME18", ICON_COLORSET_18_VEC, "18 - Theme Color Set", ""},
47 {19, "THEME19", ICON_COLORSET_19_VEC, "19 - Theme Color Set", ""},
48 {20, "THEME20", ICON_COLORSET_20_VEC, "20 - Theme Color Set", ""},
49 {-1, "CUSTOM", 0, "Custom Color Set", ""},
50 {0, nullptr, 0, nullptr, nullptr},
51};
52#ifdef RNA_RUNTIME
53constexpr int COLOR_SETS_MAX_THEMED_INDEX = 20;
54#endif
55
56#ifdef RNA_RUNTIME
57
58# include <fmt/format.h>
59
60# include "BLI_math_vector.h"
61# include "BLI_string.h"
62# include "BLI_string_utf8.h"
63
64# include "BKE_action.hh"
65# include "BKE_context.hh"
66# include "BKE_global.hh"
67# include "BKE_idprop.hh"
68# include "BKE_lib_id.hh"
69# include "BKE_main.hh"
70# include "BKE_report.hh"
71
72# include "BKE_armature.hh"
73# include "ED_armature.hh"
74
76
77# include "DEG_depsgraph.hh"
78# include "DEG_depsgraph_build.hh"
79
80# ifndef NDEBUG
81# include "ANIM_armature_iter.hh"
82# endif
83
84static void rna_Armature_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
85{
86 ID *id = ptr->owner_id;
87
89}
90
91static void rna_Armature_update_data(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
92{
93 ID *id = ptr->owner_id;
94
95 DEG_id_tag_update(id, 0);
97 // WM_main_add_notifier(NC_OBJECT|ND_POSE, nullptr);
98}
99
100static void rna_Armature_dependency_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
101{
102 ID *id = ptr->owner_id;
103
105
106 DEG_id_tag_update(id, 0);
108}
109
110static void rna_Armature_act_bone_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
111{
112 bArmature *arm = (bArmature *)ptr->data;
113
114 if (value.owner_id == nullptr && value.data == nullptr) {
115 arm->act_bone = nullptr;
116 }
117 else {
118 if (value.owner_id != &arm->id) {
119 Object *ob = (Object *)value.owner_id;
120
121 if (GS(ob->id.name) != ID_OB || (ob->data != arm)) {
122 printf("ERROR: armature set active bone - new active doesn't come from this armature\n");
123 return;
124 }
125 }
126
127 arm->act_bone = static_cast<Bone *>(value.data);
128 arm->act_bone->flag |= BONE_SELECTED;
129 }
130}
131
132static void rna_Armature_act_edit_bone_set(PointerRNA *ptr,
133 PointerRNA value,
134 ReportList * /*reports*/)
135{
136 bArmature *arm = (bArmature *)ptr->data;
137
138 if (value.owner_id == nullptr && value.data == nullptr) {
139 arm->act_edbone = nullptr;
140 }
141 else {
142 if (value.owner_id != &arm->id) {
143 /* raise an error! */
144 }
145 else {
146 arm->act_edbone = static_cast<EditBone *>(value.data);
147 ((EditBone *)arm->act_edbone)->flag |= BONE_SELECTED;
148 }
149 }
150}
151
152static EditBone *rna_Armature_edit_bone_new(bArmature *arm, ReportList *reports, const char *name)
153{
154 if (arm->edbo == nullptr) {
156 RPT_ERROR,
157 "Armature '%s' not in edit mode, cannot add an editbone",
158 arm->id.name + 2);
159 return nullptr;
160 }
161 return ED_armature_ebone_add(arm, name);
162}
163
164static void rna_Armature_edit_bone_remove(bArmature *arm,
166 PointerRNA *ebone_ptr)
167{
168 EditBone *ebone = static_cast<EditBone *>(ebone_ptr->data);
169 if (arm->edbo == nullptr) {
171 RPT_ERROR,
172 "Armature '%s' not in edit mode, cannot remove an editbone",
173 arm->id.name + 2);
174 return;
175 }
176
177 if (BLI_findindex(arm->edbo, ebone) == -1) {
179 RPT_ERROR,
180 "Armature '%s' does not contain bone '%s'",
181 arm->id.name + 2,
182 ebone->name);
183 return;
184 }
185
186 ED_armature_ebone_remove(arm, ebone);
187 ebone_ptr->invalidate();
188}
189
190static void rna_iterator_bone_collections_all_begin(CollectionPropertyIterator *iter,
192{
193 bArmature *arm = (bArmature *)ptr->data;
195 ptr,
196 arm->collection_array,
197 sizeof(BoneCollection *),
199 false,
200 nullptr);
201}
202static int rna_iterator_bone_collections_all_length(PointerRNA *ptr)
203{
204 bArmature *arm = (bArmature *)ptr->data;
205 return arm->collection_array_num;
206}
207
208static void rna_iterator_bone_collections_roots_begin(CollectionPropertyIterator *iter,
210{
211 bArmature *arm = (bArmature *)ptr->data;
213 ptr,
214 arm->collection_array,
215 sizeof(BoneCollection *),
217 false,
218 nullptr);
219}
220static int rna_iterator_bone_collections_roots_length(PointerRNA *ptr)
221{
222 bArmature *arm = (bArmature *)ptr->data;
223 return arm->collection_root_count;
224}
225
226static void rna_BoneCollections_active_set(PointerRNA *ptr,
227 PointerRNA value,
228 struct ReportList * /*reports*/)
229{
230 bArmature *arm = (bArmature *)ptr->data;
231 BoneCollection *bcoll = (BoneCollection *)value.data;
233}
234
235static void rna_iterator_bone_collection_children_begin(CollectionPropertyIterator *iter,
237{
238 bArmature *arm = (bArmature *)ptr->owner_id;
239 const BoneCollection *bcoll = (BoneCollection *)ptr->data;
241 ptr,
242 arm->collection_array + bcoll->child_index,
243 sizeof(BoneCollection *),
244 bcoll->child_count,
245 false,
246 nullptr);
247}
248static int rna_iterator_bone_collection_children_length(PointerRNA *ptr)
249{
250 const BoneCollection *bcoll = (BoneCollection *)ptr->data;
251 return bcoll->child_count;
252}
253
254static PointerRNA rna_BoneCollection_parent_get(PointerRNA *ptr)
255{
256 bArmature *arm = (bArmature *)ptr->owner_id;
257 const BoneCollection *bcoll = (BoneCollection *)ptr->data;
258
259 /* Note that this performs two scans of the array. This might look bad, but as
260 * long as `Object.children` still loops in Python over all of
261 * `bpy.data.objects`, this should also be acceptable. */
262 using namespace blender::animrig;
263 const int bcoll_index = armature_bonecoll_find_index(arm, bcoll);
264 const int parent_index = armature_bonecoll_find_parent_index(arm, bcoll_index);
265
266 if (parent_index < 0) {
267 return PointerRNA_NULL;
268 }
269
270 BoneCollection *parent = arm->collection_array[parent_index];
271 return RNA_pointer_create_discrete(&arm->id, &RNA_BoneCollection, parent);
272}
273
274static void rna_BoneCollection_parent_set(PointerRNA *ptr,
275 PointerRNA value,
276 struct ReportList *reports)
277{
278 using namespace blender::animrig;
279
281 BoneCollection *to_parent = (BoneCollection *)value.data;
282
283 bArmature *armature = (bArmature *)ptr->owner_id;
284
285 const int from_bcoll_index = armature_bonecoll_find_index(armature, self);
286 const int from_parent_index = armature_bonecoll_find_parent_index(armature, from_bcoll_index);
287 const int to_parent_index = armature_bonecoll_find_index(armature, to_parent);
288
289 if (to_parent_index >= 0) {
290 /* No need to check for parenthood cycles when the bone collection is turned into a root. */
291 if (to_parent_index == from_bcoll_index ||
292 armature_bonecoll_is_descendant_of(armature, from_bcoll_index, to_parent_index))
293 {
294 BKE_report(reports, RPT_ERROR, "Cannot make a bone collection a descendant of itself");
295 return;
296 }
297 }
298
300 armature, from_bcoll_index, -1, from_parent_index, to_parent_index);
301
303}
304
305static int rna_BoneCollections_active_index_get(PointerRNA *ptr)
306{
307 bArmature *arm = (bArmature *)ptr->data;
308 return arm->runtime.active_collection_index;
309}
310
311static void rna_BoneCollections_active_index_set(PointerRNA *ptr, const int bone_collection_index)
312{
313 bArmature *arm = (bArmature *)ptr->data;
314 ANIM_armature_bonecoll_active_index_set(arm, bone_collection_index);
315
317}
318
319static void rna_BoneCollections_active_index_range(
320 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
321{
322 bArmature *arm = (bArmature *)ptr->data;
323
324 /* TODO: Figure out what this function actually is used for, as we may want to protect the first
325 * collection (i.e. the default collection that should remain first). */
326 *min = 0;
327 *max = max_ii(0, arm->collection_array_num - 1);
328}
329
330static BoneCollection *rna_BoneCollections_new(bArmature *armature,
332 const char *name,
333 BoneCollection *parent)
334{
335 if (parent == nullptr) {
336 BoneCollection *bcoll = ANIM_armature_bonecoll_new(armature, name);
338 return bcoll;
339 }
340
341 const int32_t parent_index = blender::animrig::armature_bonecoll_find_index(armature, parent);
342 if (parent_index < 0) {
344 RPT_ERROR,
345 "Bone collection '%s' not found in Armature '%s'",
346 parent->name,
347 armature->id.name + 2);
348 return nullptr;
349 }
350
351 BoneCollection *bcoll = ANIM_armature_bonecoll_new(armature, name, parent_index);
353 return bcoll;
354}
355
356static void rna_BoneCollections_active_name_set(PointerRNA *ptr, const char *name)
357{
358 bArmature *arm = (bArmature *)ptr->data;
360}
361
362static void rna_BoneCollections_move(bArmature *arm, ReportList *reports, int from, int to)
363{
364 const int count = arm->collection_array_num;
365 if (from < 0 || from >= count || to < 0 || to >= count ||
366 (from != to && !ANIM_armature_bonecoll_move_to_index(arm, from, to)))
367 {
368 BKE_reportf(reports, RPT_ERROR, "Cannot move collection from index '%d' to '%d'", from, to);
369 }
370
372}
373
374static void rna_BoneCollection_name_set(PointerRNA *ptr, const char *name)
375{
376 bArmature *arm = (bArmature *)ptr->owner_id;
377 BoneCollection *bcoll = (BoneCollection *)ptr->data;
378
379 ANIM_armature_bonecoll_name_set(arm, bcoll, name);
380}
381
382static void rna_BoneCollection_is_visible_set(PointerRNA *ptr, const bool is_visible)
383{
384 bArmature *arm = (bArmature *)ptr->owner_id;
385 BoneCollection *bcoll = (BoneCollection *)ptr->data;
386
387 ANIM_armature_bonecoll_is_visible_set(arm, bcoll, is_visible);
388}
389
390static bool rna_BoneCollection_is_visible_effectively_get(PointerRNA *ptr)
391{
392 const bArmature *arm = (bArmature *)ptr->owner_id;
393 const BoneCollection *bcoll = (BoneCollection *)ptr->data;
395}
396
397static void rna_BoneCollection_is_solo_set(PointerRNA *ptr, const bool is_solo)
398{
399 bArmature *arm = (bArmature *)ptr->owner_id;
400 BoneCollection *bcoll = (BoneCollection *)ptr->data;
401
402 ANIM_armature_bonecoll_solo_set(arm, bcoll, is_solo);
403}
404
405static void rna_BoneCollection_is_expanded_set(PointerRNA *ptr, const bool is_expanded)
406{
407 BoneCollection *bcoll = (BoneCollection *)ptr->data;
408 ANIM_armature_bonecoll_is_expanded_set(bcoll, is_expanded);
409}
410
411static std::optional<std::string> rna_BoneCollection_path(const PointerRNA *ptr)
412{
413 const BoneCollection *bcoll = (const BoneCollection *)ptr->data;
414 char name_esc[sizeof(bcoll->name) * 2];
415 BLI_str_escape(name_esc, bcoll->name, sizeof(name_esc));
416 return fmt::format("collections_all[\"{}\"]", name_esc);
417}
418
419static IDProperty **rna_BoneCollection_idprops(PointerRNA *ptr)
420{
421 BoneCollection *bcoll = static_cast<BoneCollection *>(ptr->data);
422 return &bcoll->prop;
423}
424
425static void rna_BoneCollectionMemberships_clear(Bone *bone)
426{
429}
430
431static bool rna_BoneCollection_is_editable_get(PointerRNA *ptr)
432{
433 bArmature *arm = reinterpret_cast<bArmature *>(ptr->owner_id);
434 BoneCollection *bcoll = static_cast<BoneCollection *>(ptr->data);
435 return ANIM_armature_bonecoll_is_editable(arm, bcoll);
436}
437
438static int rna_BoneCollection_index_get(PointerRNA *ptr)
439{
440 bArmature *arm = reinterpret_cast<bArmature *>(ptr->owner_id);
441 BoneCollection *bcoll = static_cast<BoneCollection *>(ptr->data);
443}
444
445static int rna_BoneCollection_child_number_get(PointerRNA *ptr)
446{
447 bArmature *arm = reinterpret_cast<bArmature *>(ptr->owner_id);
448 BoneCollection *bcoll = static_cast<BoneCollection *>(ptr->data);
450}
451static void rna_BoneCollection_child_number_set(PointerRNA *ptr, const int new_child_number)
452{
453 bArmature *arm = reinterpret_cast<bArmature *>(ptr->owner_id);
454 BoneCollection *bcoll = static_cast<BoneCollection *>(ptr->data);
455 blender::animrig::armature_bonecoll_child_number_set(arm, bcoll, new_child_number);
457}
458
459/* BoneCollection.bones iterator functions. */
460
461static void rna_BoneCollection_bones_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
462{
463 bArmature *arm = (bArmature *)ptr->owner_id;
464 if (arm->edbo) {
465 iter->valid = false;
466 BKE_reportf(nullptr, RPT_WARNING, "`Collection.bones` is not available in armature edit mode");
467 return;
468 }
469
470 BoneCollection *bcoll = (BoneCollection *)ptr->data;
471 rna_iterator_listbase_begin(iter, ptr, &bcoll->bones, nullptr);
472}
473
474static PointerRNA rna_BoneCollection_bones_get(CollectionPropertyIterator *iter)
475{
476 ListBaseIterator *lb_iter = &iter->internal.listbase;
477 BoneCollectionMember *member = (BoneCollectionMember *)lb_iter->link;
478 return RNA_pointer_create_with_parent(iter->parent, &RNA_Bone, member->bone);
479}
480
481/* Bone.collections iterator functions. */
482
483static void rna_Bone_collections_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
484{
485 Bone *bone = (Bone *)ptr->data;
486 ListBase /*BoneCollectionReference*/ bone_collection_refs = bone->runtime.collections;
487 rna_iterator_listbase_begin(iter, ptr, &bone_collection_refs, nullptr);
488}
489
490static PointerRNA rna_Bone_collections_get(CollectionPropertyIterator *iter)
491{
492 ListBaseIterator *lb_iter = &iter->internal.listbase;
494 return RNA_pointer_create_with_parent(iter->parent, &RNA_BoneCollection, bcoll_ref->bcoll);
495}
496
497/* EditBone.collections iterator functions. */
498
499static void rna_EditBone_collections_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
500{
501 EditBone *ebone = (EditBone *)ptr->data;
502 ListBase /*BoneCollectionReference*/ bone_collection_refs = ebone->bone_collections;
503 rna_iterator_listbase_begin(iter, ptr, &bone_collection_refs, nullptr);
504}
505
506/* Armature.collections library override support. */
507static bool rna_Armature_collections_override_apply(Main *bmain,
509{
510 PointerRNA *ptr_src = &rnaapply_ctx.ptr_src;
511 PointerRNA *ptr_dst = &rnaapply_ctx.ptr_dst;
512 PropertyRNA *prop_dst = rnaapply_ctx.prop_dst;
513 PointerRNA *ptr_item_dst = &rnaapply_ctx.ptr_item_dst;
514 PointerRNA *ptr_item_src = &rnaapply_ctx.ptr_item_src;
516
517 switch (opop->operation) {
519 /* This is the case this function was written for: adding new bone collections. It will be
520 * handled below this switch. */
521 break;
523 /* NOTE(@sybren): These are stored by Blender when overridable properties are changed on the
524 * root collections, However, these are *also* created on the `armature.collections_all`
525 * property, which is actually where these per-collection overrides are handled.
526 * This doesn't seem to be proper behavior, but I also don't want to spam the console about
527 * this as this is not something a user could fix. */
528 return false;
529 default:
530 /* Any other operation is simply not supported, and also not expected to exist. */
531 printf("Unsupported RNA override operation on armature collections, ignoring\n");
532 return false;
533 }
534
535 const bArmature *arm_src = (bArmature *)ptr_src->owner_id;
536 bArmature *arm_dst = (bArmature *)ptr_dst->owner_id;
537 BoneCollection *bcoll_anchor = static_cast<BoneCollection *>(ptr_item_dst->data);
538 BoneCollection *bcoll_src = static_cast<BoneCollection *>(ptr_item_src->data);
540 arm_dst, arm_src, bcoll_anchor, bcoll_src);
541
542 if (!ID_IS_LINKED(&arm_dst->id)) {
543 /* Mark this bone collection as local override, so that certain operations can be allowed. */
545 }
546
547 RNA_property_update_main(bmain, nullptr, ptr_dst, prop_dst);
548 return true;
549}
550
551static std::optional<std::string> rna_BoneColor_path_posebone(const PointerRNA *ptr)
552{
553 /* Find the bPoseChan that owns this BoneColor. */
554 const uint8_t *bcolor_ptr = static_cast<const uint8_t *>(ptr->data);
555 const uint8_t *bone_ptr = bcolor_ptr - offsetof(bPoseChannel, color);
556 const bPoseChannel *bone = reinterpret_cast<const bPoseChannel *>(bone_ptr);
557
558# ifndef NDEBUG
559 /* Sanity check that the above pointer magic actually worked. */
560 BLI_assert(GS(ptr->owner_id->name) == ID_OB);
561 const Object *ob = reinterpret_cast<const Object *>(ptr->owner_id);
562 bool found = false;
563 LISTBASE_FOREACH (bPoseChannel *, checkBone, &ob->pose->chanbase) {
564 if (&checkBone->color == ptr->data) {
565 BLI_assert_msg(checkBone == bone,
566 "pointer magic to find the pose bone failed (found the wrong bone)");
567 found = true;
568 break;
569 }
570 }
571 BLI_assert_msg(found, "pointer magic to find the pose bone failed (did not find the bone)");
572# endif
573
574 char name_esc[sizeof(bone->name) * 2];
575 BLI_str_escape(name_esc, bone->name, sizeof(name_esc));
576 return fmt::format("pose.bones[\"{}\"].color", name_esc);
577}
578
579static std::optional<std::string> rna_BoneColor_path_bone(const PointerRNA *ptr)
580{
581 /* Find the Bone that owns this BoneColor. */
582 const uint8_t *bcolor_ptr = static_cast<const uint8_t *>(ptr->data);
583 const uint8_t *bone_ptr = bcolor_ptr - offsetof(Bone, color);
584 const Bone *bone = reinterpret_cast<const Bone *>(bone_ptr);
585
586# ifndef NDEBUG
587 /* Sanity check that the above pointer magic actually worked. */
588 BLI_assert(GS(ptr->owner_id->name) == ID_AR);
589 const bArmature *arm = reinterpret_cast<const bArmature *>(ptr->owner_id);
590
591 bool found = false;
592 blender::animrig::ANIM_armature_foreach_bone(&arm->bonebase, [&](const Bone *checkBone) {
593 if (&checkBone->color == ptr->data) {
594 BLI_assert_msg(checkBone == bone,
595 "pointer magic to find the pose bone failed (found the wrong bone)");
596 found = true;
597 }
598 });
599 BLI_assert_msg(found, "pointer magic to find the pose bone failed (did not find the bone)");
600# endif
601
602 char name_esc[sizeof(bone->name) * 2];
603 BLI_str_escape(name_esc, bone->name, sizeof(name_esc));
604 return fmt::format("bones[\"{}\"].color", name_esc);
605}
606
607static std::optional<std::string> rna_BoneColor_path_editbone(const PointerRNA *ptr)
608{
609 /* Find the Bone that owns this BoneColor. */
610 const uint8_t *bcolor_ptr = static_cast<const uint8_t *>(ptr->data);
611 const uint8_t *bone_ptr = bcolor_ptr - offsetof(EditBone, color);
612 const EditBone *bone = reinterpret_cast<const EditBone *>(bone_ptr);
613
614# ifndef NDEBUG
615 /* Sanity check that the above pointer magic actually worked. */
616 BLI_assert(GS(ptr->owner_id->name) == ID_AR);
617 const bArmature *arm = reinterpret_cast<const bArmature *>(ptr->owner_id);
618
619 bool found = false;
620 LISTBASE_FOREACH (const EditBone *, checkBone, arm->edbo) {
621 if (&checkBone->color == ptr->data) {
622 BLI_assert_msg(checkBone == bone,
623 "pointer magic to find the pose bone failed (found the wrong bone)");
624 found = true;
625 break;
626 }
627 }
628 BLI_assert_msg(found, "pointer magic to find the pose bone failed (did not find the bone)");
629# endif
630
631 char name_esc[sizeof(bone->name) * 2];
632 BLI_str_escape(name_esc, bone->name, sizeof(name_esc));
633 return fmt::format("bones[\"{}\"].color", name_esc);
634}
635
636static std::optional<std::string> rna_BoneColor_path(const PointerRNA *ptr)
637{
638 const ID *owner = ptr->owner_id;
639 BLI_assert_msg(owner, "expecting all bone colors to have an owner");
640
641 switch (GS(owner->name)) {
642 case ID_OB:
643 return rna_BoneColor_path_posebone(ptr);
644 case ID_AR: {
645 const bArmature *arm = reinterpret_cast<const bArmature *>(owner);
646 if (arm->edbo == nullptr) {
647 return rna_BoneColor_path_bone(ptr);
648 }
649 return rna_BoneColor_path_editbone(ptr);
650 }
651 default:
652 BLI_assert_msg(false, "expected object or armature");
653 return std::nullopt;
654 }
655}
656
657void rna_BoneColor_palette_index_set(PointerRNA *ptr, const int new_palette_index)
658{
659 if (new_palette_index < -1 || new_palette_index > COLOR_SETS_MAX_THEMED_INDEX) {
660 BKE_reportf(nullptr, RPT_ERROR, "Invalid color palette index: %d", new_palette_index);
661 return;
662 }
663
664 BoneColor *bcolor = static_cast<BoneColor *>(ptr->data);
665 bcolor->palette_index = new_palette_index;
666
667 ID *id = ptr->owner_id;
670}
671
672bool rna_BoneColor_is_custom_get(PointerRNA *ptr)
673{
674 BoneColor *bcolor = static_cast<BoneColor *>(ptr->data);
675 return bcolor->palette_index < 0;
676}
677
678static void rna_BoneColor_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
679{
680 /* Ugly hack to trigger the setting of the SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC flag on the
681 * animation editors, which in turn calls ANIM_sync_animchannels_to_data(C) with the right
682 * context.
683 *
684 * Without this, changes to the bone colors are not reflected on the bActionGroup colors.
685 */
687}
688
689static void rna_Armature_redraw_data(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
690{
691 ID *id = ptr->owner_id;
692
696}
697
698/* Unselect bones when hidden or not selectable. */
699static void rna_EditBone_hide_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
700{
701 bArmature *arm = (bArmature *)ptr->owner_id;
702 EditBone *ebone = static_cast<EditBone *>(ptr->data);
703
704 if (ebone->flag & (BONE_HIDDEN_A | BONE_UNSELECTABLE)) {
706 }
707
710}
711
712/* Unselect bones when hidden or not selectable. */
713static void rna_Bone_hide_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
714{
715 bArmature *arm = (bArmature *)ptr->owner_id;
716 Bone *bone = (Bone *)ptr->data;
717
718 if (bone->flag & (BONE_HIDDEN_P | BONE_UNSELECTABLE)) {
720 }
721
724}
725
726/* called whenever a bone is renamed */
727static void rna_Bone_update_renamed(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
728{
729 ID *id = ptr->owner_id;
730
731 /* Redraw Outliner / Dope-sheet. */
733
734 /* update animation channels */
736}
737
738static void rna_Bone_select_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
739{
740 ID *id = ptr->owner_id;
741
742 /* 1) special updates for cases where rigs try to hook into armature drawing stuff
743 * e.g. Mask Modifier - 'Armature' option
744 * 2) tag armature for copy-on-evaluation, so that selection status (set by addons)
745 * will update properly, like standard tools do already
746 */
747 if (id) {
748 if (GS(id->name) == ID_AR) {
749 bArmature *arm = (bArmature *)id;
750
751 if (arm->flag & ARM_HAS_VIZ_DEPS) {
753 }
754
756 }
757 else if (GS(id->name) == ID_OB) {
758 Object *ob = (Object *)id;
759 bArmature *arm = (bArmature *)ob->data;
760
761 if (arm->flag & ARM_HAS_VIZ_DEPS) {
763 }
764
766 }
767 }
768
770
771 /* spaces that show animation data of the selected bone need updating */
773}
774
775static std::optional<std::string> rna_Bone_path(const PointerRNA *ptr)
776{
777 const ID *id = ptr->owner_id;
778 const Bone *bone = (const Bone *)ptr->data;
779 char name_esc[sizeof(bone->name) * 2];
780
781 BLI_str_escape(name_esc, bone->name, sizeof(name_esc));
782
783 /* special exception for trying to get the path where ID-block is Object
784 * - this will be assumed to be from a Pose Bone...
785 */
786 if (id) {
787 if (GS(id->name) == ID_OB) {
788 return fmt::format("pose.bones[\"{}\"].bone", name_esc);
789 }
790 }
791
792 /* from armature... */
793 return fmt::format("bones[\"{}\"]", name_esc);
794}
795
796static IDProperty **rna_Bone_idprops(PointerRNA *ptr)
797{
798 Bone *bone = static_cast<Bone *>(ptr->data);
799 return &bone->prop;
800}
801
802static std::optional<std::string> rna_EditBone_path(const PointerRNA *ptr)
803{
804 EditBone *ebone = static_cast<EditBone *>(ptr->data);
805 char name_esc[sizeof(ebone->name) * 2];
806
807 BLI_str_escape(name_esc, ebone->name, sizeof(name_esc));
808 return fmt::format("edit_bones[\"{}\"]", name_esc);
809}
810
811static IDProperty **rna_EditBone_idprops(PointerRNA *ptr)
812{
813 EditBone *ebone = static_cast<EditBone *>(ptr->data);
814 return &ebone->prop;
815}
816
817static void rna_EditBone_name_set(PointerRNA *ptr, const char *value)
818{
819 bArmature *arm = (bArmature *)ptr->owner_id;
820 EditBone *ebone = (EditBone *)ptr->data;
821 char oldname[sizeof(ebone->name)], newname[sizeof(ebone->name)];
822
823 /* need to be on the stack */
824 STRNCPY_UTF8(newname, value);
825 STRNCPY(oldname, ebone->name);
826
828 ED_armature_bone_rename(G_MAIN, arm, oldname, newname);
829}
830
831static void rna_Bone_name_set(PointerRNA *ptr, const char *value)
832{
833 bArmature *arm = (bArmature *)ptr->owner_id;
834 Bone *bone = (Bone *)ptr->data;
835 char oldname[sizeof(bone->name)], newname[sizeof(bone->name)];
836
837 /* need to be on the stack */
838 STRNCPY_UTF8(newname, value);
839 STRNCPY(oldname, bone->name);
840
842 ED_armature_bone_rename(G_MAIN, arm, oldname, newname);
843}
844
845static void rna_EditBone_connected_check(EditBone *ebone)
846{
847 if (ebone->parent) {
848 if (ebone->flag & BONE_CONNECTED) {
849 /* Attach this bone to its parent */
850 copy_v3_v3(ebone->head, ebone->parent->tail);
851
852 if (ebone->flag & BONE_ROOTSEL) {
853 ebone->parent->flag |= BONE_TIPSEL;
854 }
855 }
856 else if (!(ebone->parent->flag & BONE_ROOTSEL)) {
857 ebone->parent->flag &= ~BONE_TIPSEL;
858 }
859 }
860}
861
862static void rna_EditBone_connected_set(PointerRNA *ptr, bool value)
863{
864 EditBone *ebone = (EditBone *)(ptr->data);
865
866 if (value) {
867 ebone->flag |= BONE_CONNECTED;
868 }
869 else {
870 ebone->flag &= ~BONE_CONNECTED;
871 }
872
873 rna_EditBone_connected_check(ebone);
874}
875
876static PointerRNA rna_EditBone_parent_get(PointerRNA *ptr)
877{
878 EditBone *data = (EditBone *)(ptr->data);
879 return RNA_pointer_create_with_parent(*ptr, &RNA_EditBone, data->parent);
880}
881
882static void rna_EditBone_parent_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
883{
884 EditBone *ebone = (EditBone *)(ptr->data);
885 EditBone *pbone, *parbone = (EditBone *)value.data;
886
887 if (parbone == nullptr) {
888 if (ebone->parent && !(ebone->parent->flag & BONE_ROOTSEL)) {
889 ebone->parent->flag &= ~BONE_TIPSEL;
890 }
891
892 ebone->parent = nullptr;
893 ebone->flag &= ~BONE_CONNECTED;
894 }
895 else {
896 /* within same armature */
897 if (value.owner_id != ptr->owner_id) {
898 return;
899 }
900
901 /* make sure this is a valid child */
902 if (parbone == ebone) {
903 return;
904 }
905
906 for (pbone = parbone->parent; pbone; pbone = pbone->parent) {
907 if (pbone == ebone) {
908 return;
909 }
910 }
911
912 ebone->parent = parbone;
913 rna_EditBone_connected_check(ebone);
914 }
915}
916
917static void rna_EditBone_matrix_get(PointerRNA *ptr, float *values)
918{
919 EditBone *ebone = (EditBone *)(ptr->data);
920 ED_armature_ebone_to_mat4(ebone, (float(*)[4])values);
921}
922
923static void rna_EditBone_matrix_set(PointerRNA *ptr, const float *values)
924{
925 EditBone *ebone = (EditBone *)(ptr->data);
926 ED_armature_ebone_from_mat4(ebone, (float(*)[4])values);
927}
928
929static float rna_EditBone_length_get(PointerRNA *ptr)
930{
931 EditBone *ebone = (EditBone *)(ptr->data);
932 return len_v3v3(ebone->head, ebone->tail);
933}
934
935static void rna_EditBone_length_set(PointerRNA *ptr, float length)
936{
937 EditBone *ebone = (EditBone *)(ptr->data);
938 float delta[3];
939
940 sub_v3_v3v3(delta, ebone->tail, ebone->head);
941 if (normalize_v3(delta) == 0.0f) {
942 /* Zero length means directional information is lost. Choose arbitrary direction to avoid
943 * getting stuck. */
944 delta[2] = 1.0f;
945 }
946
947 madd_v3_v3v3fl(ebone->tail, ebone->head, delta, length);
948}
949
950static void rna_Bone_bbone_handle_update(Main *bmain, Scene *scene, PointerRNA *ptr)
951{
952 bArmature *arm = (bArmature *)ptr->owner_id;
953 Bone *bone = (Bone *)ptr->data;
954
955 /* Update all users of this armature after changing B-Bone handles. */
956 for (Object *obt = static_cast<Object *>(bmain->objects.first); obt;
957 obt = static_cast<Object *>(obt->id.next))
958 {
959 if (obt->data == arm && obt->pose) {
960 bPoseChannel *pchan = BKE_pose_channel_find_name(obt->pose, bone->name);
961
962 if (pchan && pchan->bone == bone) {
963 BKE_pchan_rebuild_bbone_handles(obt->pose, pchan);
965 }
966 }
967 }
968
969 rna_Armature_dependency_update(bmain, scene, ptr);
970}
971
972static PointerRNA rna_EditBone_bbone_prev_get(PointerRNA *ptr)
973{
974 EditBone *data = (EditBone *)(ptr->data);
975 return RNA_pointer_create_with_parent(*ptr, &RNA_EditBone, data->bbone_prev);
976}
977
978static void rna_EditBone_bbone_prev_set(PointerRNA *ptr,
979 PointerRNA value,
980 ReportList * /*reports*/)
981{
982 EditBone *ebone = (EditBone *)(ptr->data);
983 EditBone *hbone = (EditBone *)value.data;
984
985 /* Within the same armature? */
986 if (hbone == nullptr || value.owner_id == ptr->owner_id) {
987 ebone->bbone_prev = hbone;
988 }
989}
990
991static void rna_Bone_bbone_prev_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
992{
993 Bone *bone = (Bone *)ptr->data;
994 Bone *hbone = (Bone *)value.data;
995
996 /* Within the same armature? */
997 if (hbone == nullptr || value.owner_id == ptr->owner_id) {
998 bone->bbone_prev = hbone;
999 }
1000}
1001
1002static PointerRNA rna_EditBone_bbone_next_get(PointerRNA *ptr)
1003{
1004 EditBone *data = (EditBone *)(ptr->data);
1005 return RNA_pointer_create_with_parent(*ptr, &RNA_EditBone, data->bbone_next);
1006}
1007
1008static void rna_EditBone_bbone_next_set(PointerRNA *ptr,
1009 PointerRNA value,
1010 ReportList * /*reports*/)
1011{
1012 EditBone *ebone = (EditBone *)(ptr->data);
1013 EditBone *hbone = (EditBone *)value.data;
1014
1015 /* Within the same armature? */
1016 if (hbone == nullptr || value.owner_id == ptr->owner_id) {
1017 ebone->bbone_next = hbone;
1018 }
1019}
1020
1021static void rna_Bone_bbone_next_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
1022{
1023 Bone *bone = (Bone *)ptr->data;
1024 Bone *hbone = (Bone *)value.data;
1025
1026 /* Within the same armature? */
1027 if (hbone == nullptr || value.owner_id == ptr->owner_id) {
1028 bone->bbone_next = hbone;
1029 }
1030}
1031
1032static PointerRNA rna_EditBone_color_get(PointerRNA *ptr)
1033{
1034 EditBone *data = (EditBone *)(ptr->data);
1035 return RNA_pointer_create_with_parent(*ptr, &RNA_BoneColor, &data->color);
1036}
1037
1038static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1039{
1040 bArmature *arm = (bArmature *)ptr->owner_id;
1041 EditBone *ebone = (EditBone *)ptr->data;
1042 EditBone *child;
1043
1044 /* update our parent */
1045 if (ebone->parent && ebone->flag & BONE_CONNECTED) {
1046 copy_v3_v3(ebone->parent->tail, ebone->head);
1047 ebone->parent->rad_tail = ebone->rad_head;
1048 }
1049
1050 /* update our children if necessary */
1051 for (child = static_cast<EditBone *>(arm->edbo->first); child; child = child->next) {
1052 if (child->parent == ebone && (child->flag & BONE_CONNECTED)) {
1053 copy_v3_v3(child->head, ebone->tail);
1054 child->rad_head = ebone->rad_tail;
1055 }
1056 }
1057
1058 if (arm->flag & ARM_MIRROR_EDIT) {
1060 }
1061
1062 rna_Armature_update_data(bmain, scene, ptr);
1063}
1064
1065static void rna_Armature_bones_next(CollectionPropertyIterator *iter)
1066{
1068 Bone *bone = (Bone *)internal->link;
1069
1070 if (bone->childbase.first) {
1071 internal->link = (Link *)bone->childbase.first;
1072 }
1073 else if (bone->next) {
1074 internal->link = (Link *)bone->next;
1075 }
1076 else {
1077 internal->link = nullptr;
1078
1079 do {
1080 bone = bone->parent;
1081 if (bone && bone->next) {
1082 internal->link = (Link *)bone->next;
1083 break;
1084 }
1085 } while (bone);
1086 }
1087
1088 iter->valid = (internal->link != nullptr);
1089}
1090
1091/* not essential, but much faster than the default lookup function */
1092static bool rna_Armature_bones_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
1093{
1094 bArmature *arm = (bArmature *)ptr->data;
1095 Bone *bone = BKE_armature_find_bone_name(arm, key);
1096 if (bone) {
1097 rna_pointer_create_with_ancestors(*ptr, &RNA_Bone, bone, *r_ptr);
1098 return true;
1099 }
1100 else {
1101 return false;
1102 }
1103}
1104
1105static bool rna_Armature_is_editmode_get(PointerRNA *ptr)
1106{
1107 bArmature *arm = (bArmature *)ptr->owner_id;
1108 return (arm->edbo != nullptr);
1109}
1110
1111static void rna_Armature_transform(bArmature *arm, const float mat[16])
1112{
1113 ED_armature_transform(arm, (const float(*)[4])mat, true);
1114}
1115
1116static int rna_Armature_relation_line_position_get(PointerRNA *ptr)
1117{
1118 bArmature *arm = (bArmature *)ptr->data;
1119 /* Translate the bitflag to an EnumPropertyItem prop_relation_lines_items item ID. */
1120 return (arm->flag & ARM_DRAW_RELATION_FROM_HEAD) ? 1 : 0;
1121}
1122
1123static void rna_Armature_relation_line_position_set(PointerRNA *ptr, const int value)
1124{
1125 bArmature *arm = (bArmature *)ptr->data;
1126
1127 /* Translate the EnumPropertyItem prop_relation_lines_items item ID to a bitflag */
1128 switch (value) {
1129 case 0:
1131 break;
1132 case 1:
1134 break;
1135 default:
1136 return;
1137 }
1138}
1139
1140#else
1141
1143{
1144 StructRNA *srna;
1145 PropertyRNA *prop;
1146
1147 srna = RNA_def_struct(brna, "BoneColor", nullptr);
1148 RNA_def_struct_ui_text(srna, "BoneColor", "Theme color or custom color of a bone");
1149 RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
1150 RNA_def_struct_path_func(srna, "rna_BoneColor_path");
1151
1152 prop = RNA_def_property(srna, "palette", PROP_ENUM, PROP_NONE);
1153 RNA_def_property_enum_sdna(prop, nullptr, "palette_index");
1155 RNA_def_property_enum_funcs(prop, nullptr, "rna_BoneColor_palette_index_set", nullptr);
1158 RNA_def_property_ui_text(prop, "Color Set", "Color palette to use");
1159 RNA_def_property_update(prop, 0, "rna_BoneColor_update");
1160
1161 prop = RNA_def_property(srna, "is_custom", PROP_BOOLEAN, PROP_NONE);
1162 RNA_def_property_boolean_funcs(prop, "rna_BoneColor_is_custom_get", nullptr);
1165 prop,
1166 "Use Custom Color",
1167 "A color palette is user-defined, instead of using a theme-defined one");
1168
1169 prop = RNA_def_property(srna, "custom", PROP_POINTER, PROP_NONE);
1171 RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
1175 prop, "Custom", "The custom bone colors, used when palette is 'CUSTOM'");
1176 RNA_def_property_update(prop, 0, "rna_BoneColor_update");
1177}
1178
1179void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editbone)
1180{
1181 /* NOTE: The pose-mode values get applied over the top of the edit-mode ones. */
1182
1183# define RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone) \
1184 { \
1185 if (is_posebone) { \
1186 RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); \
1187 } \
1188 else if (is_editbone) { \
1189 RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update"); \
1190 } \
1191 else { \
1192 RNA_def_property_update(prop, 0, "rna_Armature_update_data"); \
1193 } \
1194 } \
1195 ((void)0)
1196
1197 PropertyRNA *prop;
1198
1199 /* Roll In/Out */
1200 prop = RNA_def_property(srna, "bbone_rollin", PROP_FLOAT, PROP_ANGLE);
1201 RNA_def_property_float_sdna(prop, nullptr, "roll1");
1202 RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, 2);
1204 prop, "Roll In", "Roll offset for the start of the B-Bone, adjusts twist");
1205 RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
1206
1207 prop = RNA_def_property(srna, "bbone_rollout", PROP_FLOAT, PROP_ANGLE);
1208 RNA_def_property_float_sdna(prop, nullptr, "roll2");
1209 RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, 2);
1211 prop, "Roll Out", "Roll offset for the end of the B-Bone, adjusts twist");
1212 RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
1213
1214 if (is_posebone == false) {
1215 prop = RNA_def_property(srna, "use_endroll_as_inroll", PROP_BOOLEAN, PROP_NONE);
1217 prop, "Inherit End Roll", "Add Roll Out of the Start Handle bone to the Roll In value");
1218 RNA_def_property_boolean_sdna(prop, nullptr, "bbone_flag", BBONE_ADD_PARENT_END_ROLL);
1220 RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
1221 }
1222
1223 /* Curve X/Y Offsets */
1224 prop = RNA_def_property(srna, "bbone_curveinx", PROP_FLOAT, PROP_NONE);
1225 RNA_def_property_float_sdna(prop, nullptr, "curve_in_x");
1228 prop, "In X", "X-axis handle offset for start of the B-Bone's curve, adjusts curvature");
1229 RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
1230
1231 prop = RNA_def_property(srna, "bbone_curveinz", PROP_FLOAT, PROP_NONE);
1232 RNA_def_property_float_sdna(prop, nullptr, "curve_in_z");
1235 prop, "In Z", "Z-axis handle offset for start of the B-Bone's curve, adjusts curvature");
1236 RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
1237
1238 prop = RNA_def_property(srna, "bbone_curveoutx", PROP_FLOAT, PROP_NONE);
1239 RNA_def_property_float_sdna(prop, nullptr, "curve_out_x");
1242 prop, "Out X", "X-axis handle offset for end of the B-Bone's curve, adjusts curvature");
1243 RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
1244
1245 prop = RNA_def_property(srna, "bbone_curveoutz", PROP_FLOAT, PROP_NONE);
1246 RNA_def_property_float_sdna(prop, nullptr, "curve_out_z");
1249 prop, "Out Z", "Z-axis handle offset for end of the B-Bone's curve, adjusts curvature");
1250 RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
1251
1252 /* Ease In/Out */
1253 prop = RNA_def_property(srna, "bbone_easein", PROP_FLOAT, PROP_NONE);
1254 RNA_def_property_float_sdna(prop, nullptr, "ease1");
1255 RNA_def_property_ui_range(prop, -5.0f, 5.0f, 1, 3);
1256 RNA_def_property_float_default(prop, is_posebone ? 0.0f : 1.0f);
1257 RNA_def_property_ui_text(prop, "Ease In", "Length of first Bézier Handle (for B-Bones only)");
1259 RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
1260
1261 prop = RNA_def_property(srna, "bbone_easeout", PROP_FLOAT, PROP_NONE);
1262 RNA_def_property_float_sdna(prop, nullptr, "ease2");
1263 RNA_def_property_ui_range(prop, -5.0f, 5.0f, 1, 3);
1264 RNA_def_property_float_default(prop, is_posebone ? 0.0f : 1.0f);
1265 RNA_def_property_ui_text(prop, "Ease Out", "Length of second Bézier Handle (for B-Bones only)");
1267 RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
1268
1269 if (is_posebone == false) {
1270 prop = RNA_def_property(srna, "use_scale_easing", PROP_BOOLEAN, PROP_NONE);
1272 prop, "Scale Easing", "Multiply the final easing values by the Scale In/Out Y factors");
1273 RNA_def_property_boolean_sdna(prop, nullptr, "bbone_flag", BBONE_SCALE_EASING);
1274 RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
1275 }
1276
1277 /* Scale In/Out */
1278 prop = RNA_def_property(srna, "bbone_scalein", PROP_FLOAT, PROP_XYZ);
1279 RNA_def_property_float_sdna(prop, nullptr, "scale_in");
1280 RNA_def_property_array(prop, 3);
1282 RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3);
1285 prop,
1286 "Scale In",
1287 "Scale factors for the start of the B-Bone, adjusts thickness (for tapering effects)");
1288 RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
1289
1290 prop = RNA_def_property(srna, "bbone_scaleout", PROP_FLOAT, PROP_XYZ);
1291 RNA_def_property_float_sdna(prop, nullptr, "scale_out");
1292 RNA_def_property_array(prop, 3);
1294 RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3);
1297 prop,
1298 "Scale Out",
1299 "Scale factors for the end of the B-Bone, adjusts thickness (for tapering effects)");
1300 RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
1301
1302# undef RNA_DEF_CURVEBONE_UPDATE
1303}
1304
1305static void rna_def_bone_common(StructRNA *srna, int editbone)
1306{
1307 static const EnumPropertyItem prop_bbone_handle_type[] = {
1309 "AUTO",
1310 0,
1311 "Automatic",
1312 "Use connected parent and children to compute the handle"},
1314 "ABSOLUTE",
1315 0,
1316 "Absolute",
1317 "Use the position of the specified bone to compute the handle"},
1319 "RELATIVE",
1320 0,
1321 "Relative",
1322 "Use the offset of the specified bone from rest pose to compute the handle"},
1324 "TANGENT",
1325 0,
1326 "Tangent",
1327 "Use the orientation of the specified bone to compute the handle, ignoring the location"},
1328 {0, nullptr, 0, nullptr, nullptr},
1329 };
1330
1331 static const EnumPropertyItem prop_bbone_mapping_mode[] = {
1333 "STRAIGHT",
1334 0,
1335 "Straight",
1336 "Fast mapping that is good for most situations, but ignores the rest pose "
1337 "curvature of the B-Bone"},
1339 "CURVED",
1340 0,
1341 "Curved",
1342 "Slower mapping that gives better deformation for B-Bones that are sharply "
1343 "curved in rest pose"},
1344 {0, nullptr, 0, nullptr, nullptr},
1345 };
1346
1347 static const EnumPropertyItem prop_inherit_scale_mode[] = {
1348 {BONE_INHERIT_SCALE_FULL, "FULL", 0, "Full", "Inherit all effects of parent scaling"},
1350 "FIX_SHEAR",
1351 0,
1352 "Fix Shear",
1353 "Inherit scaling, but remove shearing of the child in the rest orientation"},
1355 "ALIGNED",
1356 0,
1357 "Aligned",
1358 "Rotate non-uniform parent scaling to align with the child, applying parent X "
1359 "scale to child X axis, and so forth"},
1361 "AVERAGE",
1362 0,
1363 "Average",
1364 "Inherit uniform scaling representing the overall change in the volume of the parent"},
1365 {BONE_INHERIT_SCALE_NONE, "NONE", 0, "None", "Completely ignore parent scaling"},
1367 "NONE_LEGACY",
1368 0,
1369 "None (Legacy)",
1370 "Ignore parent scaling without compensating for parent shear. "
1371 "Replicates the effect of disabling the original Inherit Scale checkbox."},
1372 {0, nullptr, 0, nullptr, nullptr},
1373 };
1374
1375 static const EnumPropertyItem prop_drawtype_items[] = {
1377 "ARMATURE_DEFINED",
1378 0,
1379 "Armature Defined",
1380 "Use display mode from armature (default)"},
1381 {ARM_DRAW_TYPE_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape"},
1382 {ARM_DRAW_TYPE_STICK, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"},
1384 "BBONE",
1385 0,
1386 "B-Bone",
1387 "Display bones as boxes, showing subdivision and B-Splines"},
1389 "ENVELOPE",
1390 0,
1391 "Envelope",
1392 "Display bones as extruded spheres, showing deformation influence volume"},
1394 "WIRE",
1395 0,
1396 "Wire",
1397 "Display bones as thin wires, showing subdivision and B-Splines"},
1398 {0, nullptr, 0, nullptr, nullptr},
1399 };
1400
1401 PropertyRNA *prop;
1402
1403 /* strings */
1404 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1405 RNA_def_property_string_sdna(prop, nullptr, "name");
1406 RNA_def_property_ui_text(prop, "Name", "");
1407 RNA_def_struct_name_property(srna, prop);
1408 if (editbone) {
1409 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_EditBone_name_set");
1410 }
1411 else {
1412 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_Bone_name_set");
1413 }
1414 RNA_def_property_update(prop, 0, "rna_Bone_update_renamed");
1415
1417
1418 prop = RNA_def_property(srna, "color", PROP_POINTER, PROP_NONE);
1419 RNA_def_property_struct_type(prop, "BoneColor");
1421 if (editbone) {
1422 RNA_def_property_pointer_funcs(prop, "rna_EditBone_color_get", nullptr, nullptr, nullptr);
1423 }
1424
1425 prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
1426 RNA_def_property_enum_sdna(prop, nullptr, "drawtype");
1427 RNA_def_property_enum_items(prop, prop_drawtype_items);
1428 RNA_def_property_ui_text(prop, "Display Type", "");
1429 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1431
1432 /* flags */
1433 prop = RNA_def_property(srna, "use_connect", PROP_BOOLEAN, PROP_NONE);
1434 RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_CONNECTED);
1435 if (editbone) {
1436 RNA_def_property_boolean_funcs(prop, nullptr, "rna_EditBone_connected_set");
1437 }
1438 else {
1440 }
1442 prop, "Connected", "When bone has a parent, bone's head is stuck to the parent's tail");
1443 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1444
1445 prop = RNA_def_property(srna, "use_inherit_rotation", PROP_BOOLEAN, PROP_NONE);
1446 RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", BONE_HINGE);
1448 prop, "Inherit Rotation", "Bone inherits rotation or scale from parent bone");
1449 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1450
1451 prop = RNA_def_property(srna, "use_envelope_multiply", PROP_BOOLEAN, PROP_NONE);
1452 RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_MULT_VG_ENV);
1454 prop,
1455 "Multiply Vertex Group with Envelope",
1456 "When deforming bone, multiply effects of Vertex Group weights with Envelope influence");
1457 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1458
1459 prop = RNA_def_property(srna, "use_deform", PROP_BOOLEAN, PROP_NONE);
1461 RNA_def_property_ui_text(prop, "Deform", "Enable Bone to deform geometry");
1462 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1463
1464 prop = RNA_def_property(srna, "inherit_scale", PROP_ENUM, PROP_NONE);
1466 prop, "Inherit Scale", "Specifies how the bone inherits scaling from the parent bone");
1467 RNA_def_property_enum_sdna(prop, nullptr, "inherit_scale_mode");
1468 RNA_def_property_enum_items(prop, prop_inherit_scale_mode);
1469 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1470
1471 prop = RNA_def_property(srna, "use_local_location", PROP_BOOLEAN, PROP_NONE);
1472 RNA_def_property_ui_text(prop, "Local Location", "Bone location is set in local space");
1474 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1475
1476 prop = RNA_def_property(srna, "use_relative_parent", PROP_BOOLEAN, PROP_NONE);
1478 prop, "Relative Parenting", "Object children will use relative transform, like deform");
1480 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1481
1482 prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
1483 RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_DRAWWIRE);
1485 prop,
1486 "Display Wire",
1487 "Bone is always displayed in wireframe regardless of viewport shading mode "
1488 "(useful for non-obstructive custom bone shapes)");
1489 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1490
1491 /* XXX: use_cyclic_offset is deprecated in 2.5. May/may not return */
1492 prop = RNA_def_property(srna, "use_cyclic_offset", PROP_BOOLEAN, PROP_NONE);
1495 prop,
1496 "Cyclic Offset",
1497 "When bone doesn't have a parent, it receives cyclic offset effects (Deprecated)");
1498 // "When bone doesn't have a parent, it receives cyclic offset effects");
1499 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1500
1501 prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
1502 RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_UNSELECTABLE);
1503 RNA_def_property_ui_text(prop, "Selectable", "Bone is able to be selected");
1504 if (editbone) {
1505 RNA_def_property_update(prop, 0, "rna_EditBone_hide_update");
1506 }
1507 else {
1508 RNA_def_property_update(prop, 0, "rna_Bone_hide_update");
1509 }
1510
1511 /* Number values */
1512 /* envelope deform settings */
1513 prop = RNA_def_property(srna, "envelope_distance", PROP_FLOAT, PROP_DISTANCE);
1514 if (editbone) {
1515 RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1516 }
1517 else {
1518 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1519 }
1520 RNA_def_property_float_sdna(prop, nullptr, "dist");
1521 RNA_def_property_range(prop, 0.0f, 1000.0f);
1523 prop, "Envelope Deform Distance", "Bone deformation distance (for Envelope deform only)");
1524
1525 prop = RNA_def_property(srna, "envelope_weight", PROP_FLOAT, PROP_NONE);
1526 RNA_def_property_float_sdna(prop, nullptr, "weight");
1527 RNA_def_property_range(prop, 0.0f, 1000.0f);
1529 prop, "Envelope Deform Weight", "Bone deformation weight (for Envelope deform only)");
1530 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1531
1532 prop = RNA_def_property(srna, "head_radius", PROP_FLOAT, PROP_DISTANCE);
1533 if (editbone) {
1534 RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1535 }
1536 else {
1537 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1538 }
1539 RNA_def_property_float_sdna(prop, nullptr, "rad_head");
1540 /* XXX: range is 0 to limit, where `limit = 10000.0f * std::max(1.0, view3d->grid)`. */
1541 // RNA_def_property_range(prop, 0, 1000);
1542 RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
1544 prop, "Envelope Head Radius", "Radius of head of bone (for Envelope deform only)");
1545
1546 prop = RNA_def_property(srna, "tail_radius", PROP_FLOAT, PROP_DISTANCE);
1547 if (editbone) {
1548 RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1549 }
1550 else {
1551 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1552 }
1553 RNA_def_property_float_sdna(prop, nullptr, "rad_tail");
1554 /* XXX range is 0 to limit, where limit = `10000.0f * std::max(1.0, view3d->grid)`. */
1555 // RNA_def_property_range(prop, 0, 1000);
1556 RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
1558 prop, "Envelope Tail Radius", "Radius of tail of bone (for Envelope deform only)");
1559
1560 /* b-bones deform settings */
1561 prop = RNA_def_property(srna, "bbone_segments", PROP_INT, PROP_NONE);
1562 if (editbone) {
1563 RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1564 }
1565 else {
1566 RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
1567 }
1568 RNA_def_property_int_sdna(prop, nullptr, "segments");
1569 RNA_def_property_range(prop, 1, 32);
1571 prop, "B-Bone Segments", "Number of subdivisions of bone (for B-Bones only)");
1572
1573 prop = RNA_def_property(srna, "bbone_mapping_mode", PROP_ENUM, PROP_NONE);
1574 RNA_def_property_enum_sdna(prop, nullptr, "bbone_mapping_mode");
1575 RNA_def_property_enum_items(prop, prop_bbone_mapping_mode);
1578 prop,
1579 "B-Bone Vertex Mapping Mode",
1580 "Selects how the vertices are mapped to B-Bone segments based on their position");
1581 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1582
1583 prop = RNA_def_property(srna, "bbone_x", PROP_FLOAT, PROP_NONE);
1584 if (editbone) {
1585 RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1586 }
1587 else {
1588 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1589 }
1590 RNA_def_property_float_sdna(prop, nullptr, "xwidth");
1592 RNA_def_property_ui_text(prop, "B-Bone Display X Width", "B-Bone X size");
1593
1594 prop = RNA_def_property(srna, "bbone_z", PROP_FLOAT, PROP_NONE);
1595 if (editbone) {
1596 RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1597 }
1598 else {
1599 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1600 }
1601 RNA_def_property_float_sdna(prop, nullptr, "zwidth");
1603 RNA_def_property_ui_text(prop, "B-Bone Display Z Width", "B-Bone Z size");
1604
1605 /* B-Bone Start Handle settings. */
1606 prop = RNA_def_property(srna, "bbone_handle_type_start", PROP_ENUM, PROP_NONE);
1607 RNA_def_property_enum_sdna(prop, nullptr, "bbone_prev_type");
1608 RNA_def_property_enum_items(prop, prop_bbone_handle_type);
1611 prop, "B-Bone Start Handle Type", "Selects how the start handle of the B-Bone is computed");
1612 RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
1613
1614 prop = RNA_def_property(srna, "bbone_custom_handle_start", PROP_POINTER, PROP_NONE);
1615 RNA_def_property_pointer_sdna(prop, nullptr, "bbone_prev");
1616 RNA_def_property_struct_type(prop, editbone ? "EditBone" : "Bone");
1617 if (editbone) {
1619 prop, "rna_EditBone_bbone_prev_get", "rna_EditBone_bbone_prev_set", nullptr, nullptr);
1620 RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
1621 }
1622 else {
1623 RNA_def_property_pointer_funcs(prop, nullptr, "rna_Bone_bbone_prev_set", nullptr, nullptr);
1624 RNA_def_property_update(prop, 0, "rna_Bone_bbone_handle_update");
1625 }
1629 prop, "B-Bone Start Handle", "Bone that serves as the start handle for the B-Bone curve");
1630
1631 prop = RNA_def_property(srna, "bbone_handle_use_scale_start", PROP_BOOLEAN, PROP_NONE);
1633 prop,
1634 "Start Handle Scale",
1635 "Multiply B-Bone Scale In channels by the local scale values of the start handle. "
1636 "This is done after the Scale Easing option and isn't affected by it.");
1638 prop, nullptr, "bbone_prev_flag", BBONE_HANDLE_SCALE_X, 3);
1639 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1640
1641 prop = RNA_def_property(srna, "bbone_handle_use_ease_start", PROP_BOOLEAN, PROP_NONE);
1643 prop,
1644 "Start Handle Ease",
1645 "Multiply the B-Bone Ease In channel by the local Y scale value of the start handle. "
1646 "This is done after the Scale Easing option and isn't affected by it.");
1647 RNA_def_property_boolean_sdna(prop, nullptr, "bbone_prev_flag", BBONE_HANDLE_SCALE_EASE);
1648 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1649
1650 /* B-Bone End Handle settings. */
1651 prop = RNA_def_property(srna, "bbone_handle_type_end", PROP_ENUM, PROP_NONE);
1652 RNA_def_property_enum_sdna(prop, nullptr, "bbone_next_type");
1653 RNA_def_property_enum_items(prop, prop_bbone_handle_type);
1656 prop, "B-Bone End Handle Type", "Selects how the end handle of the B-Bone is computed");
1657 RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
1658
1659 prop = RNA_def_property(srna, "bbone_custom_handle_end", PROP_POINTER, PROP_NONE);
1660 RNA_def_property_pointer_sdna(prop, nullptr, "bbone_next");
1661 RNA_def_property_struct_type(prop, editbone ? "EditBone" : "Bone");
1662 if (editbone) {
1664 prop, "rna_EditBone_bbone_next_get", "rna_EditBone_bbone_next_set", nullptr, nullptr);
1665 RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
1666 }
1667 else {
1668 RNA_def_property_pointer_funcs(prop, nullptr, "rna_Bone_bbone_next_set", nullptr, nullptr);
1669 RNA_def_property_update(prop, 0, "rna_Bone_bbone_handle_update");
1670 }
1674 prop, "B-Bone End Handle", "Bone that serves as the end handle for the B-Bone curve");
1675
1676 prop = RNA_def_property(srna, "bbone_handle_use_scale_end", PROP_BOOLEAN, PROP_NONE);
1678 prop,
1679 "End Handle Scale",
1680 "Multiply B-Bone Scale Out channels by the local scale values of the end handle. "
1681 "This is done after the Scale Easing option and isn't affected by it.");
1683 prop, nullptr, "bbone_next_flag", BBONE_HANDLE_SCALE_X, 3);
1684 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1685
1686 prop = RNA_def_property(srna, "bbone_handle_use_ease_end", PROP_BOOLEAN, PROP_NONE);
1688 prop,
1689 "End Handle Ease",
1690 "Multiply the B-Bone Ease Out channel by the local Y scale value of the end handle. "
1691 "This is done after the Scale Easing option and isn't affected by it.");
1692 RNA_def_property_boolean_sdna(prop, nullptr, "bbone_next_flag", BBONE_HANDLE_SCALE_EASE);
1693 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
1694
1696}
1697
1700{
1701 StructRNA *srna;
1702 FunctionRNA *func;
1703
1704 RNA_def_property_srna(cprop, "BoneCollectionMemberships");
1705 srna = RNA_def_struct(brna, "BoneCollectionMemberships", nullptr);
1706 RNA_def_struct_sdna(srna, "Bone");
1708 srna, "Bone Collection Memberships", "The Bone Collections that contain this Bone");
1709
1710 /* Bone.collections.clear(...) */
1711 func = RNA_def_function(srna, "clear", "rna_BoneCollectionMemberships_clear");
1712 RNA_def_function_ui_description(func, "Remove this bone from all bone collections");
1713}
1714
1715/* Err... bones should not be directly edited (only edit-bones should be...). */
1716static void rna_def_bone(BlenderRNA *brna)
1717{
1718 StructRNA *srna;
1719 PropertyRNA *prop;
1720
1721 srna = RNA_def_struct(brna, "Bone", nullptr);
1722 RNA_def_struct_ui_text(srna, "Bone", "Bone in an Armature data-block");
1723 RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
1724 RNA_def_struct_path_func(srna, "rna_Bone_path");
1725 RNA_def_struct_idprops_func(srna, "rna_Bone_idprops");
1726
1727 /* pointers/collections */
1728 /* parent (pointer) */
1729 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
1730 RNA_def_property_struct_type(prop, "Bone");
1731 RNA_def_property_pointer_sdna(prop, nullptr, "parent");
1733 RNA_def_property_ui_text(prop, "Parent", "Parent bone (in same Armature)");
1734 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1735
1736 /* children (collection) */
1737 prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
1738 RNA_def_property_collection_sdna(prop, nullptr, "childbase", nullptr);
1739 RNA_def_property_struct_type(prop, "Bone");
1741 RNA_def_property_ui_text(prop, "Children", "Bones which are children of this bone");
1742
1743 prop = RNA_def_property(srna, "collections", PROP_COLLECTION, PROP_NONE);
1744 RNA_def_property_struct_type(prop, "BoneCollection");
1746 "rna_Bone_collections_begin",
1747 "rna_iterator_listbase_next",
1748 "rna_iterator_listbase_end",
1749 "rna_Bone_collections_get",
1750 nullptr,
1751 nullptr,
1752 nullptr,
1753 nullptr);
1755 RNA_def_property_ui_text(prop, "Collections", "Bone Collections that contain this bone");
1757
1758 rna_def_bone_common(srna, 0);
1759 rna_def_bone_curved_common(srna, false, false);
1760
1762
1763 /* XXX should we define this in PoseChannel wrapping code instead?
1764 * But PoseChannels directly get some of their flags from here... */
1765 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
1766 RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_HIDDEN_P);
1768 prop,
1769 "Hide",
1770 "Bone is not visible when it is not in Edit Mode (i.e. in Object or Pose Modes)");
1771 RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
1772 RNA_def_property_update(prop, 0, "rna_Bone_hide_update");
1773
1774 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1775 RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_SELECTED);
1776 RNA_def_property_ui_text(prop, "Select", "");
1778 prop,
1779 PROP_ANIMATABLE); /* XXX: review whether this could be used for interesting effects... */
1780 RNA_def_property_update(prop, 0, "rna_Bone_select_update");
1781
1782 prop = RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
1783 RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_ROOTSEL);
1784 RNA_def_property_ui_text(prop, "Select Head", "");
1786 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1787
1788 prop = RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
1789 RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_TIPSEL);
1790 RNA_def_property_ui_text(prop, "Select Tail", "");
1792 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1793
1794 /* XXX better matrix descriptions possible (Arystan) */
1795 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
1796 RNA_def_property_float_sdna(prop, nullptr, "bone_mat");
1800 prop, "Bone Matrix", "3" BLI_STR_UTF8_MULTIPLICATION_SIGN "3 bone matrix");
1801
1802 prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
1803 RNA_def_property_float_sdna(prop, nullptr, "arm_mat");
1807 "Bone Armature-Relative Matrix",
1809 "4 bone matrix relative to armature");
1810
1811 prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
1812 RNA_def_property_float_sdna(prop, nullptr, "tail");
1813 RNA_def_property_array(prop, 3);
1816 prop, "Tail", "Location of tail end of the bone relative to its parent");
1818
1819 prop = RNA_def_property(srna, "tail_local", PROP_FLOAT, PROP_TRANSLATION);
1820 RNA_def_property_float_sdna(prop, nullptr, "arm_tail");
1821 RNA_def_property_array(prop, 3);
1824 prop, "Armature-Relative Tail", "Location of tail end of the bone relative to armature");
1826
1827 prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
1828 RNA_def_property_float_sdna(prop, nullptr, "head");
1829 RNA_def_property_array(prop, 3);
1832 prop, "Head", "Location of head end of the bone relative to its parent");
1834
1835 prop = RNA_def_property(srna, "head_local", PROP_FLOAT, PROP_TRANSLATION);
1836 RNA_def_property_float_sdna(prop, nullptr, "arm_head");
1837 RNA_def_property_array(prop, 3);
1840 prop, "Armature-Relative Head", "Location of head end of the bone relative to armature");
1842
1843 prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_DISTANCE);
1844 RNA_def_property_float_sdna(prop, nullptr, "length");
1846 RNA_def_property_ui_text(prop, "Length", "Length of the bone");
1847
1849
1850 RNA_api_bone(srna);
1851}
1852
1854{
1855 StructRNA *srna;
1856 PropertyRNA *prop;
1857
1858 srna = RNA_def_struct(brna, "EditBone", nullptr);
1859 RNA_def_struct_sdna(srna, "EditBone");
1860 RNA_def_struct_path_func(srna, "rna_EditBone_path");
1861 RNA_def_struct_idprops_func(srna, "rna_EditBone_idprops");
1862 RNA_def_struct_ui_text(srna, "Edit Bone", "Edit mode bone in an armature data-block");
1863 RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
1864
1865 prop = RNA_def_property(srna, "collections", PROP_COLLECTION, PROP_NONE);
1866 RNA_def_property_struct_type(prop, "BoneCollection");
1868 "rna_EditBone_collections_begin",
1869 "rna_iterator_listbase_next",
1870 "rna_iterator_listbase_end",
1871 "rna_Bone_collections_get",
1872 nullptr,
1873 nullptr,
1874 nullptr,
1875 nullptr);
1878 RNA_def_property_ui_text(prop, "Collections", "Bone Collections that contain this bone");
1879
1880 RNA_define_verify_sdna(false); /* not in sdna */
1881
1882 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
1883 RNA_def_property_struct_type(prop, "EditBone");
1885 prop, "rna_EditBone_parent_get", "rna_EditBone_parent_set", nullptr, nullptr);
1887 RNA_def_property_ui_text(prop, "Parent", "Parent edit bone (in same Armature)");
1888 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1889
1890 prop = RNA_def_property(srna, "roll", PROP_FLOAT, PROP_ANGLE);
1891 RNA_def_property_float_sdna(prop, nullptr, "roll");
1892 RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, 2);
1893 RNA_def_property_ui_text(prop, "Roll", "Bone rotation around head-tail axis");
1895 RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1896
1897 prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
1898 RNA_def_property_float_sdna(prop, nullptr, "head");
1900 RNA_def_property_array(prop, 3);
1901 RNA_def_property_ui_text(prop, "Head", "Location of head end of the bone");
1903 RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1904
1905 prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
1906 RNA_def_property_float_sdna(prop, nullptr, "tail");
1908 RNA_def_property_array(prop, 3);
1909 RNA_def_property_ui_text(prop, "Tail", "Location of tail end of the bone");
1911 RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1912
1913 prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_DISTANCE);
1915 prop, "rna_EditBone_length_get", "rna_EditBone_length_set", nullptr);
1918 RNA_def_property_ui_text(prop, "Length", "Length of the bone. Changing moves the tail end.");
1920 RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
1921
1922 rna_def_bone_common(srna, 1);
1923 rna_def_bone_curved_common(srna, false, true);
1924
1925 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
1926 RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_HIDDEN_A);
1927 RNA_def_property_ui_text(prop, "Hide", "Bone is not visible when in Edit Mode");
1929 RNA_def_property_update(prop, 0, "rna_EditBone_hide_update");
1930
1931 prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
1933 RNA_def_property_ui_text(prop, "Lock", "Bone is not able to be transformed when in Edit Mode");
1935 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1936
1937 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1938 RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_SELECTED);
1939 RNA_def_property_ui_text(prop, "Select", "");
1941 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1942
1943 prop = RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
1944 RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_ROOTSEL);
1945 RNA_def_property_ui_text(prop, "Head Select", "");
1947 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1948
1949 prop = RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
1950 RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_TIPSEL);
1951 RNA_def_property_ui_text(prop, "Tail Select", "");
1953 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
1954
1955 /* calculated and read only, not actual data access */
1956 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
1957 // RNA_def_property_float_sdna(prop, nullptr, ""); /* Doesn't access any real data. */
1959 // RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1960 RNA_def_property_flag(prop, PROP_THICK_WRAP); /* no reference to original data */
1962 prop,
1963 "Edit Bone Matrix",
1964 "Matrix combining location and rotation of the bone (head position, direction and roll), "
1965 "in armature space (does not include/support bone's length/size)");
1967 prop, "rna_EditBone_matrix_get", "rna_EditBone_matrix_set", nullptr);
1968
1970
1972}
1973
1974/* `armature.bones.*`. */
1976{
1977 StructRNA *srna;
1978 PropertyRNA *prop;
1979
1980 // FunctionRNA *func;
1981 // PropertyRNA *parm;
1982
1983 RNA_def_property_srna(cprop, "ArmatureBones");
1984 srna = RNA_def_struct(brna, "ArmatureBones", nullptr);
1985 RNA_def_struct_sdna(srna, "bArmature");
1986 RNA_def_struct_ui_text(srna, "Armature Bones", "Collection of armature bones");
1987
1988 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1989 RNA_def_property_struct_type(prop, "Bone");
1990 RNA_def_property_pointer_sdna(prop, nullptr, "act_bone");
1992 RNA_def_property_ui_text(prop, "Active Bone", "Armature's active bone");
1993 RNA_def_property_pointer_funcs(prop, nullptr, "rna_Armature_act_bone_set", nullptr, nullptr);
1994 RNA_def_property_update(prop, 0, "rna_Armature_update");
1995
1996 /* TODO: redraw. */
1997 // RNA_def_property_collection_active(prop, prop_act);
1998}
1999
2000/* `armature.bones.*`. */
2002{
2003 StructRNA *srna;
2004 PropertyRNA *prop;
2005
2006 FunctionRNA *func;
2007 PropertyRNA *parm;
2008
2009 RNA_def_property_srna(cprop, "ArmatureEditBones");
2010 srna = RNA_def_struct(brna, "ArmatureEditBones", nullptr);
2011 RNA_def_struct_sdna(srna, "bArmature");
2012 RNA_def_struct_ui_text(srna, "Armature EditBones", "Collection of armature edit bones");
2013
2014 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2015 RNA_def_property_struct_type(prop, "EditBone");
2016 RNA_def_property_pointer_sdna(prop, nullptr, "act_edbone");
2018 RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
2019 RNA_def_property_update(prop, 0, "rna_Armature_update");
2021 prop, nullptr, "rna_Armature_act_edit_bone_set", nullptr, nullptr);
2022
2023 /* TODO: redraw. */
2024 // RNA_def_property_collection_active(prop, prop_act);
2025
2026 /* add target */
2027 func = RNA_def_function(srna, "new", "rna_Armature_edit_bone_new");
2029 RNA_def_function_ui_description(func, "Add a new bone");
2030 parm = RNA_def_string(func, "name", "Object", 0, "", "New name for the bone");
2032 /* return type */
2033 parm = RNA_def_pointer(func, "bone", "EditBone", "", "Newly created edit bone");
2034 RNA_def_function_return(func, parm);
2035
2036 /* remove target */
2037 func = RNA_def_function(srna, "remove", "rna_Armature_edit_bone_remove");
2039 RNA_def_function_ui_description(func, "Remove an existing bone from the armature");
2040 /* Target to remove. */
2041 parm = RNA_def_pointer(func, "bone", "EditBone", "", "EditBone to remove");
2044}
2045
2048{
2049 StructRNA *srna;
2050 PropertyRNA *prop;
2051
2052 FunctionRNA *func;
2053 PropertyRNA *parm;
2054
2055 RNA_def_property_srna(cprop, "BoneCollections");
2056 srna = RNA_def_struct(brna, "BoneCollections", nullptr);
2057 RNA_def_struct_sdna(srna, "bArmature");
2059 srna, "Armature Bone Collections", "The Bone Collections of this Armature");
2060
2061 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2062 RNA_def_property_struct_type(prop, "BoneCollection");
2063 RNA_def_property_pointer_sdna(prop, nullptr, "runtime.active_collection");
2067 prop, nullptr, "rna_BoneCollections_active_set", nullptr, nullptr);
2068 RNA_def_property_ui_text(prop, "Active Collection", "Armature's active bone collection");
2070
2071 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
2072 RNA_def_property_int_sdna(prop, nullptr, "runtime.active_collection_index");
2076 prop,
2077 "Active Collection Index",
2078 "The index of the Armature's active bone collection; -1 when there "
2079 "is no active collection. Note that this is indexing the underlying array of bone "
2080 "collections, which may not be in the order you expect. Root collections are listed first, "
2081 "and siblings are always sequential. Apart from that, bone collections can be in any order, "
2082 "and thus incrementing or decrementing this index can make the active bone collection jump "
2083 "around in unexpected ways. For a more predictable interface, use ``active`` or "
2084 "``active_name``.");
2086 "rna_BoneCollections_active_index_get",
2087 "rna_BoneCollections_active_index_set",
2088 "rna_BoneCollections_active_index_range");
2090
2091 prop = RNA_def_property(srna, "active_name", PROP_STRING, PROP_NONE);
2092 RNA_def_property_string_sdna(prop, nullptr, "active_collection_name");
2093 /* TODO: For some reason the overrides system doesn't register a new operation when this property
2094 * changes. Needs further investigation to figure out why & fix it. */
2097 "Active Collection Name",
2098 "The name of the Armature's active bone collection; empty when there "
2099 "is no active collection");
2100 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_BoneCollections_active_name_set");
2102
2103 prop = RNA_def_property(srna, "is_solo_active", PROP_BOOLEAN, PROP_NONE);
2106 prop,
2107 "Solo Active",
2108 "Read-only flag that indicates there is at least one bone collection marked as 'solo'");
2110
2111 /* Armature.collections.new(...) */
2112 func = RNA_def_function(srna, "new", "rna_BoneCollections_new");
2113 RNA_def_function_ui_description(func, "Add a new empty bone collection to the armature");
2115 parm = RNA_def_string(func,
2116 "name",
2117 nullptr,
2118 0,
2119 "Name",
2120 "Name of the new collection. Blender will ensure it is unique within the "
2121 "collections of the Armature.");
2123 parm = RNA_def_pointer(
2124 func,
2125 "parent",
2126 "BoneCollection",
2127 "Parent Collection",
2128 "If not None, the new bone collection becomes a child of this collection");
2129 /* Return value. */
2130 parm = RNA_def_pointer(
2131 func, "bonecollection", "BoneCollection", "", "Newly created bone collection");
2132 RNA_def_function_return(func, parm);
2133
2134 /* Armature.collections.remove(...) */
2135 func = RNA_def_function(srna, "remove", "ANIM_armature_bonecoll_remove");
2137 func,
2138 "Remove the bone collection from the armature. If this bone collection has any children, "
2139 "they will be reassigned to their grandparent; in other words, the children will take the "
2140 "place of the removed bone collection.");
2141 parm = RNA_def_pointer(func,
2142 "bone_collection",
2143 "BoneCollection",
2144 "Bone Collection",
2145 "The bone collection to remove");
2147
2148 /* Armature.collections.move(...) */
2149 func = RNA_def_function(srna, "move", "rna_BoneCollections_move");
2151 "Move a bone collection to a different position in the "
2152 "collection list. This can only be used to reorder siblings, "
2153 "and not to change parent-child relationships.");
2155 parm = RNA_def_int(
2156 func, "from_index", -1, INT_MIN, INT_MAX, "From Index", "Index to move", 0, 10000);
2158 parm = RNA_def_int(func, "to_index", -1, INT_MIN, INT_MAX, "To Index", "Target index", 0, 10000);
2160}
2161
2163{
2164 StructRNA *srna;
2165 PropertyRNA *prop;
2166
2167 FunctionRNA *func;
2168 PropertyRNA *parm;
2169
2170 static const EnumPropertyItem prop_drawtype_items[] = {
2172 "OCTAHEDRAL",
2173 0,
2174 "Octahedral",
2175 "Display bones as octahedral shape (default)"},
2176 {ARM_DRAW_TYPE_STICK, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"},
2178 "BBONE",
2179 0,
2180 "B-Bone",
2181 "Display bones as boxes, showing subdivision and B-Splines"},
2183 "ENVELOPE",
2184 0,
2185 "Envelope",
2186 "Display bones as extruded spheres, showing deformation influence volume"},
2188 "WIRE",
2189 0,
2190 "Wire",
2191 "Display bones as thin wires, showing subdivision and B-Splines"},
2192 {0, nullptr, 0, nullptr, nullptr},
2193 };
2194
2195 static const EnumPropertyItem prop_pose_position_items[] = {
2196 {0, "POSE", 0, "Pose Position", "Show armature in posed state"},
2197 {ARM_RESTPOS,
2198 "REST",
2199 0,
2200 "Rest Position",
2201 "Show Armature in binding pose state (no posing possible)"},
2202 {0, nullptr, 0, nullptr, nullptr},
2203 };
2204 static const EnumPropertyItem prop_relation_lines_items[] = {
2205 {0, "TAIL", 0, "Tail", "Draw the relationship line from the parent tail to the child head"},
2206 {1, "HEAD", 0, "Head", "Draw the relationship line from the parent head to the child head"},
2207 {0, nullptr, 0, nullptr, nullptr},
2208 };
2209
2210 srna = RNA_def_struct(brna, "Armature", "ID");
2212 srna,
2213 "Armature",
2214 "Armature data-block containing a hierarchy of bones, usually used for rigging characters");
2215 RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA);
2216 RNA_def_struct_sdna(srna, "bArmature");
2217
2218 func = RNA_def_function(srna, "transform", "rna_Armature_transform");
2219 RNA_def_function_ui_description(func, "Transform armature bones by a matrix");
2220 parm = RNA_def_float_matrix(func, "matrix", 4, 4, nullptr, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
2222
2223 /* Animation Data */
2225
2227
2228 /* Collection Properties */
2229 prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
2230 RNA_def_property_collection_sdna(prop, nullptr, "bonebase", nullptr);
2232 nullptr,
2233 "rna_Armature_bones_next",
2234 nullptr,
2235 nullptr,
2236 nullptr,
2237 nullptr,
2238 "rna_Armature_bones_lookup_string",
2239 nullptr);
2240 RNA_def_property_struct_type(prop, "Bone");
2241 RNA_def_property_ui_text(prop, "Bones", "");
2242 rna_def_armature_bones(brna, prop);
2243
2244 prop = RNA_def_property(srna, "edit_bones", PROP_COLLECTION, PROP_NONE);
2245 RNA_def_property_collection_sdna(prop, nullptr, "edbo", nullptr);
2246 RNA_def_property_struct_type(prop, "EditBone");
2247 RNA_def_property_ui_text(prop, "Edit Bones", "");
2248 rna_def_armature_edit_bones(brna, prop);
2249
2250 /* Bone Collection properties. */
2251 prop = RNA_def_property(srna, "collections", PROP_COLLECTION, PROP_NONE);
2252 RNA_def_property_struct_type(prop, "BoneCollection");
2254 "rna_iterator_bone_collections_roots_begin",
2255 "rna_iterator_array_next",
2256 "rna_iterator_array_end",
2257 "rna_iterator_array_dereference_get",
2258 "rna_iterator_bone_collections_roots_length",
2259 nullptr, /* TODO */
2260 nullptr, /* TODO */
2261 nullptr);
2262 RNA_def_property_ui_text(prop, "Bone Collections (Roots)", "");
2265 prop, nullptr, nullptr, "rna_Armature_collections_override_apply");
2268 rna_def_armature_collections(brna, prop);
2269
2270 prop = RNA_def_property(srna, "collections_all", PROP_COLLECTION, PROP_NONE);
2271 RNA_def_property_struct_type(prop, "BoneCollection");
2273 "rna_iterator_bone_collections_all_begin",
2274 "rna_iterator_array_next",
2275 "rna_iterator_array_end",
2276 "rna_iterator_array_dereference_get",
2277 "rna_iterator_bone_collections_all_length",
2278 nullptr, /* TODO */
2279 nullptr, /* TODO */
2280 nullptr);
2282 prop, "Bone Collections (All)", "List of all bone collections of the armature");
2284 /* Overrides on `armature.collections_all` are only there to override specific properties, like
2285 * is_visible.
2286 *
2287 * New Bone collections are added as overrides via the `armature.collections` (the roots)
2288 * property. It's up to its 'apply' function to also copy the children of a
2289 * library-override-added root. */
2291
2292 /* Enum values */
2293 prop = RNA_def_property(srna, "pose_position", PROP_ENUM, PROP_NONE);
2294 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
2295 RNA_def_property_enum_items(prop, prop_pose_position_items);
2297 prop, "Pose Position", "Show armature in binding pose or final posed state");
2298 RNA_def_property_update(prop, 0, "rna_Armature_update_data");
2300
2301 prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
2302 RNA_def_property_enum_sdna(prop, nullptr, "drawtype");
2303 RNA_def_property_enum_items(prop, prop_drawtype_items);
2304 RNA_def_property_ui_text(prop, "Display Type", "");
2305 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
2307
2308 /* flag */
2309 prop = RNA_def_property(srna, "show_axes", PROP_BOOLEAN, PROP_NONE);
2310 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ARM_DRAWAXES);
2311 RNA_def_property_ui_text(prop, "Display Axes", "Display bone axes");
2312 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
2314
2315 prop = RNA_def_property(srna, "axes_position", PROP_FLOAT, PROP_FACTOR);
2316 RNA_def_property_float_sdna(prop, nullptr, "axes_position");
2317 RNA_def_property_range(prop, 0.0, 1.0);
2318 RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 1);
2320 "Axes Position",
2321 "The position for the axes on the bone. Increasing the value moves it "
2322 "closer to the tip; decreasing moves it closer to the root.");
2323 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
2324
2325 RNA_define_verify_sdna(false); /* This property does not live in DNA. */
2326 prop = RNA_def_property(srna, "relation_line_position", PROP_ENUM, PROP_NONE);
2327 RNA_def_property_enum_items(prop, prop_relation_lines_items);
2329 "Relation Line Position",
2330 "The start position of the relation lines from parent to child bones");
2331 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
2334 "rna_Armature_relation_line_position_get",
2335 "rna_Armature_relation_line_position_set",
2336 nullptr);
2337 RNA_define_verify_sdna(true); /* Restore default. */
2338
2339 prop = RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
2340 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ARM_DRAWNAMES);
2341 RNA_def_property_ui_text(prop, "Display Names", "Display bone names");
2342 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
2344
2345 prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
2346 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ARM_MIRROR_EDIT);
2348 prop, "X-Axis Mirror", "Apply changes to matching bone on opposite side of X-Axis");
2349 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
2351
2352 prop = RNA_def_property(srna, "show_bone_custom_shapes", PROP_BOOLEAN, PROP_NONE);
2355 prop, "Display Custom Bone Shapes", "Display bones with their custom shapes");
2356 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
2357
2358 prop = RNA_def_property(srna, "show_bone_colors", PROP_BOOLEAN, PROP_NONE);
2359 RNA_def_property_boolean_sdna(prop, nullptr, "flag", ARM_COL_CUSTOM);
2360 RNA_def_property_ui_text(prop, "Display Bone Colors", "Display bone colors");
2361 RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
2362
2363 prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
2364 RNA_def_property_boolean_funcs(prop, "rna_Armature_is_editmode_get", nullptr);
2366 RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
2367
2369}
2370
2372{
2373 StructRNA *srna;
2374 PropertyRNA *prop;
2375
2376 srna = RNA_def_struct(brna, "BoneCollection", nullptr);
2377 RNA_def_struct_ui_text(srna, "BoneCollection", "Bone collection in an Armature data-block");
2378 RNA_def_struct_path_func(srna, "rna_BoneCollection_path");
2379 RNA_def_struct_idprops_func(srna, "rna_BoneCollection_idprops");
2380
2381 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2382 RNA_def_property_string_sdna(prop, nullptr, "name");
2383 RNA_def_property_ui_text(prop, "Name", "Unique within the Armature");
2384 RNA_def_struct_name_property(srna, prop);
2385 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_BoneCollection_name_set");
2387
2388 prop = RNA_def_property(srna, "is_expanded", PROP_BOOLEAN, PROP_NONE);
2391 prop, "Expanded", "This bone collection is expanded in the bone collections tree view");
2394 RNA_def_property_boolean_funcs(prop, nullptr, "rna_BoneCollection_is_expanded_set");
2396
2397 prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
2400 prop, "Visible", "Bones in this collection will be visible in pose/object mode");
2403 RNA_def_property_boolean_funcs(prop, nullptr, "rna_BoneCollection_is_visible_set");
2405
2406 prop = RNA_def_property(srna, "is_visible_ancestors", PROP_BOOLEAN, PROP_NONE);
2409 "Ancestors Effectively Visible",
2410 "True when all of the ancestors of this bone collection are marked as "
2411 "visible; always True for root bone collections");
2413
2414 prop = RNA_def_property(srna, "is_visible_effectively", PROP_BOOLEAN, PROP_NONE);
2415 RNA_def_property_boolean_funcs(prop, "rna_BoneCollection_is_visible_effectively_get", nullptr);
2417 prop,
2418 "Effective Visibility",
2419 "Whether this bone collection is effectively visible in the viewport. This is True when "
2420 "this bone collection and all of its ancestors are visible, or when it is marked as "
2421 "'solo'.");
2423
2424 prop = RNA_def_property(srna, "is_solo", PROP_BOOLEAN, PROP_NONE);
2425 RNA_def_property_boolean_sdna(prop, nullptr, "flags", BONE_COLLECTION_SOLO);
2427 prop, "Solo", "Show only this bone collection, and others also marked as 'solo'");
2430 RNA_def_property_boolean_funcs(prop, nullptr, "rna_BoneCollection_is_solo_set");
2432
2433 prop = RNA_def_property(srna, "is_local_override", PROP_BOOLEAN, PROP_NONE);
2436 prop,
2437 "Is Local Override",
2438 "This collection was added via a library override in the current blend file");
2440
2441 prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
2442 RNA_def_property_boolean_funcs(prop, "rna_BoneCollection_is_editable_get", nullptr);
2444 "Is Editable",
2445 "This collection is owned by a local Armature, or was added via a "
2446 "library override in the current blend file");
2448
2449 prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
2450 RNA_def_property_struct_type(prop, "Bone");
2452 "rna_BoneCollection_bones_begin",
2453 "rna_iterator_listbase_next",
2454 "rna_iterator_listbase_end",
2455 "rna_BoneCollection_bones_get",
2456 nullptr,
2457 nullptr,
2458 nullptr,
2459 nullptr);
2463 "Bones",
2464 "Bones assigned to this bone collection. In armature edit mode this "
2465 "will always return an empty list of bones, as the bone collection "
2466 "memberships are only synchronized when exiting edit mode.");
2467
2468 prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
2469 RNA_def_property_struct_type(prop, "BoneCollection");
2471 "rna_iterator_bone_collection_children_begin",
2472 "rna_iterator_array_next",
2473 "rna_iterator_array_end",
2474 "rna_iterator_array_dereference_get",
2475 "rna_iterator_bone_collection_children_length",
2476 nullptr, /* TODO */
2477 nullptr, /* TODO */
2478 nullptr);
2481
2482 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
2483 RNA_def_property_struct_type(prop, "BoneCollection");
2487 prop, "rna_BoneCollection_parent_get", "rna_BoneCollection_parent_set", nullptr, nullptr);
2489 "Parent",
2490 "Parent bone collection. Note that accessing this requires a scan of "
2491 "all the bone collections to find the parent.");
2492
2493 prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
2494 RNA_def_property_int_funcs(prop, "rna_BoneCollection_index_get", nullptr, nullptr);
2498 prop,
2499 "Index",
2500 "Index of this bone collection in the armature.collections_all array. Note that finding "
2501 "this index requires a scan of all the bone collections, so do access this with care.");
2502
2503 prop = RNA_def_property(srna, "child_number", PROP_INT, PROP_NONE);
2506 prop, "rna_BoneCollection_child_number_get", "rna_BoneCollection_child_number_set", nullptr);
2508 prop,
2509 "Child Number",
2510 "Index of this collection into its parent's list of children. Note that finding "
2511 "this index requires a scan of all the bone collections, so do access this with care.");
2512
2514}
2515
2517{
2518 rna_def_bonecolor(brna);
2520 rna_def_armature(brna);
2521 rna_def_bone(brna);
2522 rna_def_edit_bone(brna);
2523}
2524
2525#endif
Iterators for armatures.
C++ functions to deal with Armature collections (i.e. the successor of bone layers).
void ANIM_armature_bonecoll_active_set(bArmature *armature, BoneCollection *bcoll)
bool ANIM_armature_bonecoll_is_editable(const bArmature *armature, const BoneCollection *bcoll)
BoneCollection * ANIM_armature_bonecoll_insert_copy_after(bArmature *armature_dst, const bArmature *armature_src, const BoneCollection *anchor_in_dst, const BoneCollection *bcoll_to_copy)
void ANIM_armature_bonecoll_is_expanded_set(BoneCollection *bcoll, bool is_expanded)
void ANIM_armature_bonecoll_active_name_set(bArmature *armature, const char *name)
void ANIM_armature_bonecoll_unassign_all(Bone *bone)
bool ANIM_armature_bonecoll_move_to_index(bArmature *armature, int from_index, int to_index)
bool ANIM_armature_bonecoll_is_visible_effectively(const bArmature *armature, const BoneCollection *bcoll)
void ANIM_armature_bonecoll_name_set(bArmature *armature, BoneCollection *bcoll, const char *name)
void ANIM_armature_bonecoll_solo_set(bArmature *armature, BoneCollection *bcoll, bool is_solo)
BoneCollection * ANIM_armature_bonecoll_new(bArmature *armature, const char *name, int parent_index=-1)
void ANIM_armature_bonecoll_is_visible_set(bArmature *armature, BoneCollection *bcoll, bool is_visible)
void ANIM_armature_bonecoll_active_index_set(bArmature *armature, int bone_collection_index)
Blender kernel action and pose functionality.
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
void BKE_pchan_rebuild_bbone_handles(bPose *pose, bPoseChannel *pchan)
Definition armature.cc:2860
Bone * BKE_armature_find_bone_name(bArmature *arm, const char *name)
Definition armature.cc:812
#define G_MAIN
bool BKE_id_is_in_global_main(ID *id)
Definition lib_id.cc:2480
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:126
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:586
#define LISTBASE_FOREACH(type, var, list)
MINLINE int max_ii(int a, int b)
#define M_PI
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
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)
MINLINE float normalize_v3(float n[3])
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:688
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
#define BLI_STR_UTF8_MULTIPLICATION_SIGN
#define BLT_I18NCONTEXT_ID_ARMATURE
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1026
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:982
@ LIBOVERRIDE_OP_REPLACE
Definition DNA_ID.h:220
@ LIBOVERRIDE_OP_INSERT_AFTER
Definition DNA_ID.h:230
@ ID_AR
@ ID_OB
@ BONE_COLLECTION_VISIBLE
@ BONE_COLLECTION_ANCESTORS_VISIBLE
@ BONE_COLLECTION_SOLO
@ BONE_COLLECTION_EXPANDED
@ BONE_COLLECTION_OVERRIDE_LIBRARY_LOCAL
@ BBONE_MAPPING_STRAIGHT
@ BBONE_MAPPING_CURVED
@ 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_DRAW_RELATION_FROM_HEAD
@ ARM_NO_CUSTOM
@ ARM_HAS_VIZ_DEPS
@ ARM_COL_CUSTOM
@ ARM_DRAWNAMES
@ ARM_BCOLL_SOLO_ACTIVE
@ ARM_MIRROR_EDIT
@ ARM_DRAWAXES
@ ARM_RESTPOS
@ ARM_DRAW_TYPE_ENVELOPE
@ ARM_DRAW_TYPE_STICK
@ ARM_DRAW_TYPE_B_BONE
@ ARM_DRAW_TYPE_WIRE
@ ARM_DRAW_TYPE_ARMATURE_DEFINED
@ ARM_DRAW_TYPE_OCTA
@ 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
ParameterFlag
Definition RNA_types.hh:510
@ PARM_RNAPTR
Definition RNA_types.hh:513
@ PARM_REQUIRED
Definition RNA_types.hh:511
@ FUNC_USE_REPORTS
Definition RNA_types.hh:805
@ PROP_FLOAT
Definition RNA_types.hh:152
@ PROP_BOOLEAN
Definition RNA_types.hh:150
@ PROP_ENUM
Definition RNA_types.hh:154
@ PROP_INT
Definition RNA_types.hh:151
@ PROP_STRING
Definition RNA_types.hh:153
@ PROP_POINTER
Definition RNA_types.hh:155
@ PROP_COLLECTION
Definition RNA_types.hh:156
#define RNA_TRANSLATION_PREC_DEFAULT
Definition RNA_types.hh:212
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:469
@ PROPOVERRIDE_NO_COMPARISON
Definition RNA_types.hh:477
@ PROPOVERRIDE_IGNORE
Definition RNA_types.hh:489
@ PROPOVERRIDE_LIBRARY_INSERTION
Definition RNA_types.hh:494
PropertyFlag
Definition RNA_types.hh:286
@ PROP_THICK_WRAP
Definition RNA_types.hh:397
@ PROP_ANIMATABLE
Definition RNA_types.hh:305
@ PROP_PROPORTIONAL
Definition RNA_types.hh:335
@ PROP_EDITABLE
Definition RNA_types.hh:292
@ PROP_LIB_EXCEPTION
Definition RNA_types.hh:298
@ PROP_NEVER_NULL
Definition RNA_types.hh:351
@ PROP_PTR_NO_OWNERSHIP
Definition RNA_types.hh:369
@ PROP_MATRIX
Definition RNA_types.hh:253
@ PROP_XYZ
Definition RNA_types.hh:257
@ PROP_DISTANCE
Definition RNA_types.hh:244
@ PROP_ANGLE
Definition RNA_types.hh:240
@ PROP_NONE
Definition RNA_types.hh:221
@ PROP_FACTOR
Definition RNA_types.hh:239
@ PROP_TRANSLATION
Definition RNA_types.hh:249
#define NC_GEOM
Definition WM_types.hh:390
#define ND_DATA
Definition WM_types.hh:506
#define NC_ANIMATION
Definition WM_types.hh:385
#define ND_POSE
Definition WM_types.hh:455
ReportList * reports
Definition WM_types.hh:1025
#define ND_BONE_COLLECTION
Definition WM_types.hh:471
#define NA_RENAME
Definition WM_types.hh:585
#define ND_BONE_SELECT
Definition WM_types.hh:457
#define NC_OBJECT
Definition WM_types.hh:376
#define ND_ANIMCHAN
Definition WM_types.hh:493
#define NC_SPACE
Definition WM_types.hh:389
#define ND_SPACE_OUTLINER
Definition WM_types.hh:524
EditBone * ED_armature_ebone_add(bArmature *arm, const char *name)
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])
BMesh const char void * data
PyObject * self
#define offsetof(t, d)
#define printf(...)
float length(VecOp< float, D >) RET
#define ID_IS_LINKED(_id)
#define GS(a)
int count
static void ANIM_armature_foreach_bone(ListBase *bones, CB callback)
int armature_bonecoll_child_number_find(const bArmature *armature, const ::BoneCollection *bcoll)
int armature_bonecoll_find_index(const bArmature *armature, const ::BoneCollection *bcoll)
bool armature_bonecoll_is_descendant_of(const bArmature *armature, int potential_parent_index, int potential_descendant_index)
int armature_bonecoll_find_parent_index(const bArmature *armature, int bcoll_index)
int armature_bonecoll_child_number_set(bArmature *armature, ::BoneCollection *bcoll, int new_child_number)
int armature_bonecoll_move_to_parent(bArmature *armature, int from_bcoll_index, int to_child_num, int from_parent_index, int to_parent_index)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, int itemsize, int length, bool free_ptr, IteratorSkipFunc skip)
const PointerRNA PointerRNA_NULL
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, ListBase *lb, IteratorSkipFunc skip)
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
void rna_pointer_create_with_ancestors(const PointerRNA &parent, StructRNA *type, void *data, PointerRNA &r_ptr)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
void rna_def_animdata_common(StructRNA *srna)
static void rna_def_armature_collections(BlenderRNA *brna, PropertyRNA *cprop)
static void rna_def_bone_collection_memberships(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_def_armature(BlenderRNA *brna)
static void rna_def_bone(BlenderRNA *brna)
static void rna_def_bonecollection(BlenderRNA *brna)
const EnumPropertyItem rna_enum_color_palettes_items[]
#define RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone)
static void rna_def_bone_common(StructRNA *srna, int editbone)
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)
static void rna_def_armature_bones(BlenderRNA *brna, PropertyRNA *cprop)
static void rna_def_bonecolor(BlenderRNA *brna)
void RNA_api_armature_edit_bone(StructRNA *srna)
void RNA_api_bone(StructRNA *srna)
void RNA_api_bonecollection(StructRNA *srna)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_define_lib_overridable(const bool make_overridable)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_property_float_default(PropertyRNA *prop, float value)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_define_verify_sdna(bool verify)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
PropertyRNA * RNA_def_float_matrix(StructOrFunctionRNA *cont_, const char *identifier, const int rows, const int columns, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
const float rna_default_scale_3d[3]
void RNA_def_property_boolean_bitset_array_sdna(PropertyRNA *prop, const char *structname, const char *propname, const int64_t booleanbit, const int length)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
const int rna_matrix_dimsize_4x4[]
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
const int rna_matrix_dimsize_3x3[]
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
#define min(a, b)
Definition sort.cc:36
#define FLT_MAX
Definition stdcycles.h:14
struct IDProperty * prop
char name[64]
IDProperty * prop
union CollectionPropertyIterator::@251313231040372062304153161337117373343066046335 internal
ListBaseIterator listbase
Definition RNA_types.hh:572
char name[64]
float tail[3]
IDProperty * prop
EditBone * parent
EditBone * next
EditBone * bbone_prev
float rad_tail
EditBone * bbone_next
float rad_head
float head[3]
Definition DNA_ID.h:404
char name[66]
Definition DNA_ID.h:415
void * first
struct bPose * pose
ID * owner_id
Definition RNA_types.hh:51
void invalidate()
Definition RNA_types.hh:110
void * data
Definition RNA_types.hh:53
IDOverrideLibraryPropertyOperation * liboverride_operation
struct BoneCollection ** collection_array
ListBase * edbo
struct Bone * bone
ListBase chanbase
max
Definition text_draw.cc:251
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4227