Animation: Convert armature RNA from C to C++

Transform `rna_armature.c` and `rna_armature.cc` to C++.

- `UNUSED(x)` -> `/*x*/`
- Explicit casts for ID and void pointers
- Explicit casts for 0 enum values

No functional changes.
This commit is contained in:
Sybren A. Stüvel
2023-06-20 16:06:13 +02:00
parent 897bd3f431
commit 2014084d29
4 changed files with 167 additions and 162 deletions

View File

@@ -18,7 +18,7 @@ set(DEFSRC
rna_action.c
rna_animation.c
rna_animviz.c
rna_armature.c
rna_armature.cc
rna_asset.c
rna_attribute.c
rna_boid.c
@@ -101,7 +101,7 @@ endif()
set(APISRC
rna_action_api.c
rna_animation_api.c
rna_armature_api.c
rna_armature_api.cc
rna_camera_api.c
rna_curve_api.cc
rna_fcurve_api.c

View File

@@ -4551,7 +4551,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_action.c", "rna_action_api.c", RNA_def_action},
{"rna_animation.c", "rna_animation_api.c", RNA_def_animation},
{"rna_animviz.c", NULL, RNA_def_animviz},
{"rna_armature.c", "rna_armature_api.c", RNA_def_armature},
{"rna_armature.cc", "rna_armature_api.cc", RNA_def_armature},
{"rna_attribute.c", NULL, RNA_def_attribute},
{"rna_asset.c", NULL, RNA_def_asset},
{"rna_boid.c", NULL, RNA_def_boid},

View File

@@ -40,23 +40,23 @@
# include "DEG_depsgraph.h"
# include "DEG_depsgraph_build.h"
static void rna_Armature_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
static void rna_Armature_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
{
ID *id = ptr->owner_id;
DEG_id_tag_update(id, ID_RECALC_COPY_ON_WRITE);
}
static void rna_Armature_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
static void rna_Armature_update_data(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
{
ID *id = ptr->owner_id;
DEG_id_tag_update(id, 0);
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
// WM_main_add_notifier(NC_OBJECT|ND_POSE, NULL);
// WM_main_add_notifier(NC_OBJECT|ND_POSE, nullptr);
}
static void rna_Armature_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
static void rna_Armature_dependency_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
{
ID *id = ptr->owner_id;
@@ -68,12 +68,12 @@ static void rna_Armature_dependency_update(Main *bmain, Scene *UNUSED(scene), Po
static void rna_Armature_act_bone_set(PointerRNA *ptr,
PointerRNA value,
struct ReportList *UNUSED(reports))
struct ReportList * /*reports*/)
{
bArmature *arm = (bArmature *)ptr->data;
if (value.owner_id == NULL && value.data == NULL) {
arm->act_bone = NULL;
if (value.owner_id == nullptr && value.data == nullptr) {
arm->act_bone = nullptr;
}
else {
if (value.owner_id != &arm->id) {
@@ -85,26 +85,26 @@ static void rna_Armature_act_bone_set(PointerRNA *ptr,
}
}
arm->act_bone = value.data;
arm->act_bone = static_cast<Bone *>(value.data);
arm->act_bone->flag |= BONE_SELECTED;
}
}
static void rna_Armature_act_edit_bone_set(PointerRNA *ptr,
PointerRNA value,
struct ReportList *UNUSED(reports))
struct ReportList * /*reports*/)
{
bArmature *arm = (bArmature *)ptr->data;
if (value.owner_id == NULL && value.data == NULL) {
arm->act_edbone = NULL;
if (value.owner_id == nullptr && value.data == nullptr) {
arm->act_edbone = nullptr;
}
else {
if (value.owner_id != &arm->id) {
/* raise an error! */
}
else {
arm->act_edbone = value.data;
arm->act_edbone = static_cast<EditBone *>(value.data);
((EditBone *)arm->act_edbone)->flag |= BONE_SELECTED;
}
}
@@ -112,12 +112,12 @@ static void rna_Armature_act_edit_bone_set(PointerRNA *ptr,
static EditBone *rna_Armature_edit_bone_new(bArmature *arm, ReportList *reports, const char *name)
{
if (arm->edbo == NULL) {
if (arm->edbo == nullptr) {
BKE_reportf(reports,
RPT_ERROR,
"Armature '%s' not in edit mode, cannot add an editbone",
arm->id.name + 2);
return NULL;
return nullptr;
}
return ED_armature_ebone_add(arm, name);
}
@@ -126,8 +126,8 @@ static void rna_Armature_edit_bone_remove(bArmature *arm,
ReportList *reports,
PointerRNA *ebone_ptr)
{
EditBone *ebone = ebone_ptr->data;
if (arm->edbo == NULL) {
EditBone *ebone = static_cast<EditBone *>(ebone_ptr->data);
if (arm->edbo == nullptr) {
BKE_reportf(reports,
RPT_ERROR,
"Armature '%s' not in edit mode, cannot remove an editbone",
@@ -148,7 +148,7 @@ static void rna_Armature_edit_bone_remove(bArmature *arm,
RNA_POINTER_INVALIDATE(ebone_ptr);
}
static void rna_Armature_update_layers(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
static void rna_Armature_update_layers(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
{
bArmature *arm = (bArmature *)ptr->owner_id;
@@ -156,7 +156,7 @@ static void rna_Armature_update_layers(Main *UNUSED(bmain), Scene *UNUSED(scene)
WM_main_add_notifier(NC_GEOM | ND_DATA, arm);
}
static void rna_Armature_redraw_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
static void rna_Armature_redraw_data(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
{
ID *id = ptr->owner_id;
@@ -165,7 +165,7 @@ static void rna_Armature_redraw_data(Main *UNUSED(bmain), Scene *UNUSED(scene),
}
/* Unselect bones when hidden */
static void rna_Bone_hide_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
static void rna_Bone_hide_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
{
bArmature *arm = (bArmature *)ptr->owner_id;
Bone *bone = (Bone *)ptr->data;
@@ -179,7 +179,7 @@ static void rna_Bone_hide_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poin
}
/* called whenever a bone is renamed */
static void rna_Bone_update_renamed(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
static void rna_Bone_update_renamed(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
{
ID *id = ptr->owner_id;
@@ -190,7 +190,7 @@ static void rna_Bone_update_renamed(Main *UNUSED(bmain), Scene *UNUSED(scene), P
WM_main_add_notifier(NC_ANIMATION | ND_ANIMCHAN, id);
}
static void rna_Bone_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
static void rna_Bone_select_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
{
ID *id = ptr->owner_id;
@@ -250,13 +250,13 @@ static char *rna_Bone_path(const PointerRNA *ptr)
static IDProperty **rna_Bone_idprops(PointerRNA *ptr)
{
Bone *bone = ptr->data;
Bone *bone = static_cast<Bone *>(ptr->data);
return &bone->prop;
}
static IDProperty **rna_EditBone_idprops(PointerRNA *ptr)
{
EditBone *ebone = ptr->data;
EditBone *ebone = static_cast<EditBone *>(ptr->data);
return &ebone->prop;
}
@@ -291,7 +291,7 @@ static void rna_Bone_layer_set(PointerRNA *ptr, const bool *values)
Bone *bone = (Bone *)ptr->data;
rna_bone_layer_set(&bone->layer, values);
BKE_armature_refresh_layer_used(NULL, arm);
BKE_armature_refresh_layer_used(nullptr, arm);
}
/* TODO: remove the deprecation stubs. */
@@ -427,17 +427,17 @@ static PointerRNA rna_EditBone_parent_get(PointerRNA *ptr)
static void rna_EditBone_parent_set(PointerRNA *ptr,
PointerRNA value,
struct ReportList *UNUSED(reports))
struct ReportList * /*reports*/)
{
EditBone *ebone = (EditBone *)(ptr->data);
EditBone *pbone, *parbone = (EditBone *)value.data;
if (parbone == NULL) {
if (parbone == nullptr) {
if (ebone->parent && !(ebone->parent->flag & BONE_ROOTSEL)) {
ebone->parent->flag &= ~BONE_TIPSEL;
}
ebone->parent = NULL;
ebone->parent = nullptr;
ebone->flag &= ~BONE_CONNECTED;
}
else {
@@ -501,7 +501,9 @@ static void rna_Bone_bbone_handle_update(Main *bmain, Scene *scene, PointerRNA *
Bone *bone = (Bone *)ptr->data;
/* Update all users of this armature after changing B-Bone handles. */
for (Object *obt = bmain->objects.first; obt; obt = obt->id.next) {
for (Object *obt = static_cast<Object *>(bmain->objects.first); obt;
obt = static_cast<Object *>(obt->id.next))
{
if (obt->data == arm && obt->pose) {
bPoseChannel *pchan = BKE_pose_channel_find_name(obt->pose, bone->name);
@@ -523,26 +525,26 @@ static PointerRNA rna_EditBone_bbone_prev_get(PointerRNA *ptr)
static void rna_EditBone_bbone_prev_set(PointerRNA *ptr,
PointerRNA value,
struct ReportList *UNUSED(reports))
struct ReportList * /*reports*/)
{
EditBone *ebone = (EditBone *)(ptr->data);
EditBone *hbone = (EditBone *)value.data;
/* Within the same armature? */
if (hbone == NULL || value.owner_id == ptr->owner_id) {
if (hbone == nullptr || value.owner_id == ptr->owner_id) {
ebone->bbone_prev = hbone;
}
}
static void rna_Bone_bbone_prev_set(PointerRNA *ptr,
PointerRNA value,
struct ReportList *UNUSED(reports))
struct ReportList * /*reports*/)
{
Bone *bone = (Bone *)ptr->data;
Bone *hbone = (Bone *)value.data;
/* Within the same armature? */
if (hbone == NULL || value.owner_id == ptr->owner_id) {
if (hbone == nullptr || value.owner_id == ptr->owner_id) {
bone->bbone_prev = hbone;
}
}
@@ -555,26 +557,26 @@ static PointerRNA rna_EditBone_bbone_next_get(PointerRNA *ptr)
static void rna_EditBone_bbone_next_set(PointerRNA *ptr,
PointerRNA value,
struct ReportList *UNUSED(reports))
struct ReportList * /*reports*/)
{
EditBone *ebone = (EditBone *)(ptr->data);
EditBone *hbone = (EditBone *)value.data;
/* Within the same armature? */
if (hbone == NULL || value.owner_id == ptr->owner_id) {
if (hbone == nullptr || value.owner_id == ptr->owner_id) {
ebone->bbone_next = hbone;
}
}
static void rna_Bone_bbone_next_set(PointerRNA *ptr,
PointerRNA value,
struct ReportList *UNUSED(reports))
struct ReportList * /*reports*/)
{
Bone *bone = (Bone *)ptr->data;
Bone *hbone = (Bone *)value.data;
/* Within the same armature? */
if (hbone == NULL || value.owner_id == ptr->owner_id) {
if (hbone == nullptr || value.owner_id == ptr->owner_id) {
bone->bbone_next = hbone;
}
}
@@ -591,7 +593,7 @@ static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, Po
}
/* update our children if necessary */
for (child = arm->edbo->first; child; child = child->next) {
for (child = static_cast<EditBone *>(arm->edbo->first); child; child = child->next) {
if (child->parent == ebone && (child->flag & BONE_CONNECTED)) {
copy_v3_v3(child->head, ebone->tail);
}
@@ -616,7 +618,7 @@ static void rna_Armature_bones_next(CollectionPropertyIterator *iter)
internal->link = (Link *)bone->next;
}
else {
internal->link = NULL;
internal->link = nullptr;
do {
bone = bone->parent;
@@ -627,7 +629,7 @@ static void rna_Armature_bones_next(CollectionPropertyIterator *iter)
} while (bone);
}
iter->valid = (internal->link != NULL);
iter->valid = (internal->link != nullptr);
}
/* not essential, but much faster than the default lookup function */
@@ -647,7 +649,7 @@ static int rna_Armature_bones_lookup_string(PointerRNA *ptr, const char *key, Po
static bool rna_Armature_is_editmode_get(PointerRNA *ptr)
{
bArmature *arm = (bArmature *)ptr->owner_id;
return (arm->edbo != NULL);
return (arm->edbo != nullptr);
}
static void rna_Armature_transform(bArmature *arm, float mat[16])
@@ -703,14 +705,14 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editb
/* Roll In/Out */
prop = RNA_def_property(srna, "bbone_rollin", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "roll1");
RNA_def_property_float_sdna(prop, nullptr, "roll1");
RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, 2);
RNA_def_property_ui_text(
prop, "Roll In", "Roll offset for the start of the B-Bone, adjusts twist");
RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
prop = RNA_def_property(srna, "bbone_rollout", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "roll2");
RNA_def_property_float_sdna(prop, nullptr, "roll2");
RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, 2);
RNA_def_property_ui_text(
prop, "Roll Out", "Roll offset for the end of the B-Bone, adjusts twist");
@@ -720,35 +722,35 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editb
prop = RNA_def_property(srna, "use_endroll_as_inroll", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(
prop, "Inherit End Roll", "Add Roll Out of the Start Handle bone to the Roll In value");
RNA_def_property_boolean_sdna(prop, NULL, "bbone_flag", BBONE_ADD_PARENT_END_ROLL);
RNA_def_property_boolean_sdna(prop, nullptr, "bbone_flag", BBONE_ADD_PARENT_END_ROLL);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
}
/* Curve X/Y Offsets */
prop = RNA_def_property(srna, "bbone_curveinx", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "curve_in_x");
RNA_def_property_float_sdna(prop, nullptr, "curve_in_x");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_ui_text(
prop, "In X", "X-axis handle offset for start of the B-Bone's curve, adjusts curvature");
RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
prop = RNA_def_property(srna, "bbone_curveinz", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "curve_in_z");
RNA_def_property_float_sdna(prop, nullptr, "curve_in_z");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_ui_text(
prop, "In Z", "Z-axis handle offset for start of the B-Bone's curve, adjusts curvature");
RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
prop = RNA_def_property(srna, "bbone_curveoutx", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "curve_out_x");
RNA_def_property_float_sdna(prop, nullptr, "curve_out_x");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_ui_text(
prop, "Out X", "X-axis handle offset for end of the B-Bone's curve, adjusts curvature");
RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
prop = RNA_def_property(srna, "bbone_curveoutz", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "curve_out_z");
RNA_def_property_float_sdna(prop, nullptr, "curve_out_z");
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_ui_text(
prop, "Out Z", "Z-axis handle offset for end of the B-Bone's curve, adjusts curvature");
@@ -756,7 +758,7 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editb
/* Ease In/Out */
prop = RNA_def_property(srna, "bbone_easein", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ease1");
RNA_def_property_float_sdna(prop, nullptr, "ease1");
RNA_def_property_ui_range(prop, -5.0f, 5.0f, 1, 3);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_ui_text(prop, "Ease In", "Length of first Bezier Handle (for B-Bones only)");
@@ -764,7 +766,7 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editb
RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
prop = RNA_def_property(srna, "bbone_easeout", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ease2");
RNA_def_property_float_sdna(prop, nullptr, "ease2");
RNA_def_property_ui_range(prop, -5.0f, 5.0f, 1, 3);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_ui_text(prop, "Ease Out", "Length of second Bezier Handle (for B-Bones only)");
@@ -775,13 +777,13 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editb
prop = RNA_def_property(srna, "use_scale_easing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(
prop, "Scale Easing", "Multiply the final easing values by the Scale In/Out Y factors");
RNA_def_property_boolean_sdna(prop, NULL, "bbone_flag", BBONE_SCALE_EASING);
RNA_def_property_boolean_sdna(prop, nullptr, "bbone_flag", BBONE_SCALE_EASING);
RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
}
/* Scale In/Out */
prop = RNA_def_property(srna, "bbone_scalein", PROP_FLOAT, PROP_XYZ);
RNA_def_property_float_sdna(prop, NULL, "scale_in");
RNA_def_property_float_sdna(prop, nullptr, "scale_in");
RNA_def_property_array(prop, 3);
RNA_def_property_flag(prop, PROP_PROPORTIONAL);
RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3);
@@ -793,7 +795,7 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editb
RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone);
prop = RNA_def_property(srna, "bbone_scaleout", PROP_FLOAT, PROP_XYZ);
RNA_def_property_float_sdna(prop, NULL, "scale_out");
RNA_def_property_float_sdna(prop, nullptr, "scale_out");
RNA_def_property_array(prop, 3);
RNA_def_property_flag(prop, PROP_PROPORTIONAL);
RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3);
@@ -830,7 +832,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
0,
"Tangent",
"Use the orientation of the specified bone to compute the handle, ignoring the location"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
static const EnumPropertyItem prop_inherit_scale_mode[] = {
@@ -858,21 +860,21 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
"None (Legacy)",
"Ignore parent scaling without compensating for parent shear. "
"Replicates the effect of disabling the original Inherit Scale checkbox"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
PropertyRNA *prop;
/* strings */
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_property_string_sdna(prop, nullptr, "name");
RNA_def_property_ui_text(prop, "Name", "");
RNA_def_struct_name_property(srna, prop);
if (editbone) {
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_EditBone_name_set");
RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_EditBone_name_set");
}
else {
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Bone_name_set");
RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_Bone_name_set");
}
RNA_def_property_update(prop, 0, "rna_Bone_update_renamed");
@@ -880,21 +882,21 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
/* flags */
prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
RNA_def_property_boolean_sdna(prop, nullptr, "layer", 1);
RNA_def_property_array(prop, 32);
if (editbone) {
RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_layer_set");
RNA_def_property_boolean_funcs(prop, nullptr, "rna_EditBone_layer_set");
}
else {
RNA_def_property_boolean_funcs(prop, NULL, "rna_Bone_layer_set");
RNA_def_property_boolean_funcs(prop, nullptr, "rna_Bone_layer_set");
}
RNA_def_property_ui_text(prop, "Layers", "Layers bone exists in");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
prop = RNA_def_property(srna, "use_connect", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_CONNECTED);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_CONNECTED);
if (editbone) {
RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_connected_set");
RNA_def_property_boolean_funcs(prop, nullptr, "rna_EditBone_connected_set");
}
else {
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -904,13 +906,13 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
prop = RNA_def_property(srna, "use_inherit_rotation", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_HINGE);
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", BONE_HINGE);
RNA_def_property_ui_text(
prop, "Inherit Rotation", "Bone inherits rotation or scale from parent bone");
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
prop = RNA_def_property(srna, "use_envelope_multiply", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_MULT_VG_ENV);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_MULT_VG_ENV);
RNA_def_property_ui_text(
prop,
"Multiply Vertex Group with Envelope",
@@ -918,14 +920,14 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
prop = RNA_def_property(srna, "use_deform", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_DEFORM);
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", BONE_NO_DEFORM);
RNA_def_property_ui_text(prop, "Deform", "Enable Bone to deform geometry");
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
prop = RNA_def_property(srna, "inherit_scale", PROP_ENUM, PROP_NONE);
RNA_def_property_ui_text(
prop, "Inherit Scale", "Specifies how the bone inherits scaling from the parent bone");
RNA_def_property_enum_sdna(prop, NULL, "inherit_scale_mode");
RNA_def_property_enum_sdna(prop, nullptr, "inherit_scale_mode");
RNA_def_property_enum_items(prop, prop_inherit_scale_mode);
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
@@ -945,17 +947,17 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
prop = RNA_def_property(srna, "use_local_location", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(prop, "Local Location", "Bone location is set in local space");
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_LOCAL_LOCATION);
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", BONE_NO_LOCAL_LOCATION);
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
prop = RNA_def_property(srna, "use_relative_parent", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_ui_text(
prop, "Relative Parenting", "Object children will use relative transform, like deform");
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_RELATIVE_PARENTING);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_RELATIVE_PARENTING);
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_DRAWWIRE);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_DRAWWIRE);
RNA_def_property_ui_text(
prop,
"Display Wire",
@@ -965,7 +967,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
/* XXX: use_cyclic_offset is deprecated in 2.5. May/may not return */
prop = RNA_def_property(srna, "use_cyclic_offset", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_CYCLICOFFSET);
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", BONE_NO_CYCLICOFFSET);
RNA_def_property_ui_text(
prop,
"Cyclic Offset",
@@ -974,7 +976,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_UNSELECTABLE);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_UNSELECTABLE);
RNA_def_property_ui_text(prop, "Selectable", "Bone is able to be selected");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
@@ -987,13 +989,13 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
else {
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
}
RNA_def_property_float_sdna(prop, NULL, "dist");
RNA_def_property_float_sdna(prop, nullptr, "dist");
RNA_def_property_range(prop, 0.0f, 1000.0f);
RNA_def_property_ui_text(
prop, "Envelope Deform Distance", "Bone deformation distance (for Envelope deform only)");
prop = RNA_def_property(srna, "envelope_weight", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "weight");
RNA_def_property_float_sdna(prop, nullptr, "weight");
RNA_def_property_range(prop, 0.0f, 1000.0f);
RNA_def_property_ui_text(
prop, "Envelope Deform Weight", "Bone deformation weight (for Envelope deform only)");
@@ -1006,7 +1008,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
else {
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
}
RNA_def_property_float_sdna(prop, NULL, "rad_head");
RNA_def_property_float_sdna(prop, nullptr, "rad_head");
/* XXX range is 0 to limit, where limit = 10000.0f * MAX2(1.0, view3d->grid); */
// RNA_def_property_range(prop, 0, 1000);
RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
@@ -1020,7 +1022,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
else {
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
}
RNA_def_property_float_sdna(prop, NULL, "rad_tail");
RNA_def_property_float_sdna(prop, nullptr, "rad_tail");
/* XXX range is 0 to limit, where limit = 10000.0f * MAX2(1.0, view3d->grid); */
// RNA_def_property_range(prop, 0, 1000);
RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
@@ -1035,7 +1037,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
else {
RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
}
RNA_def_property_int_sdna(prop, NULL, "segments");
RNA_def_property_int_sdna(prop, nullptr, "segments");
RNA_def_property_range(prop, 1, 32);
RNA_def_property_ui_text(
prop, "B-Bone Segments", "Number of subdivisions of bone (for B-Bones only)");
@@ -1047,7 +1049,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
else {
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
}
RNA_def_property_float_sdna(prop, NULL, "xwidth");
RNA_def_property_float_sdna(prop, nullptr, "xwidth");
RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 1, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_ui_text(prop, "B-Bone Display X Width", "B-Bone X size");
@@ -1058,13 +1060,13 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
else {
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
}
RNA_def_property_float_sdna(prop, NULL, "zwidth");
RNA_def_property_float_sdna(prop, nullptr, "zwidth");
RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 1, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_ui_text(prop, "B-Bone Display Z Width", "B-Bone Z size");
/* B-Bone Start Handle settings. */
prop = RNA_def_property(srna, "bbone_handle_type_start", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "bbone_prev_type");
RNA_def_property_enum_sdna(prop, nullptr, "bbone_prev_type");
RNA_def_property_enum_items(prop, prop_bbone_handle_type);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(
@@ -1072,15 +1074,15 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
prop = RNA_def_property(srna, "bbone_custom_handle_start", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "bbone_prev");
RNA_def_property_pointer_sdna(prop, nullptr, "bbone_prev");
RNA_def_property_struct_type(prop, editbone ? "EditBone" : "Bone");
if (editbone) {
RNA_def_property_pointer_funcs(
prop, "rna_EditBone_bbone_prev_get", "rna_EditBone_bbone_prev_set", NULL, NULL);
prop, "rna_EditBone_bbone_prev_get", "rna_EditBone_bbone_prev_set", nullptr, nullptr);
RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
}
else {
RNA_def_property_pointer_funcs(prop, NULL, "rna_Bone_bbone_prev_set", NULL, NULL);
RNA_def_property_pointer_funcs(prop, nullptr, "rna_Bone_bbone_prev_set", nullptr, nullptr);
RNA_def_property_update(prop, 0, "rna_Bone_bbone_handle_update");
}
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP);
@@ -1094,7 +1096,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
"Start Handle Scale",
"Multiply B-Bone Scale In channels by the local scale values of the start handle. "
"This is done after the Scale Easing option and isn't affected by it");
RNA_def_property_boolean_sdna(prop, NULL, "bbone_prev_flag", BBONE_HANDLE_SCALE_X);
RNA_def_property_boolean_sdna(prop, nullptr, "bbone_prev_flag", BBONE_HANDLE_SCALE_X);
RNA_def_property_array(prop, 3);
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
@@ -1104,12 +1106,12 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
"Start Handle Ease",
"Multiply the B-Bone Ease In channel by the local Y scale value of the start handle. "
"This is done after the Scale Easing option and isn't affected by it");
RNA_def_property_boolean_sdna(prop, NULL, "bbone_prev_flag", BBONE_HANDLE_SCALE_EASE);
RNA_def_property_boolean_sdna(prop, nullptr, "bbone_prev_flag", BBONE_HANDLE_SCALE_EASE);
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
/* B-Bone End Handle settings. */
prop = RNA_def_property(srna, "bbone_handle_type_end", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "bbone_next_type");
RNA_def_property_enum_sdna(prop, nullptr, "bbone_next_type");
RNA_def_property_enum_items(prop, prop_bbone_handle_type);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(
@@ -1117,15 +1119,15 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
prop = RNA_def_property(srna, "bbone_custom_handle_end", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "bbone_next");
RNA_def_property_pointer_sdna(prop, nullptr, "bbone_next");
RNA_def_property_struct_type(prop, editbone ? "EditBone" : "Bone");
if (editbone) {
RNA_def_property_pointer_funcs(
prop, "rna_EditBone_bbone_next_get", "rna_EditBone_bbone_next_set", NULL, NULL);
prop, "rna_EditBone_bbone_next_get", "rna_EditBone_bbone_next_set", nullptr, nullptr);
RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
}
else {
RNA_def_property_pointer_funcs(prop, NULL, "rna_Bone_bbone_next_set", NULL, NULL);
RNA_def_property_pointer_funcs(prop, nullptr, "rna_Bone_bbone_next_set", nullptr, nullptr);
RNA_def_property_update(prop, 0, "rna_Bone_bbone_handle_update");
}
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP);
@@ -1139,7 +1141,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
"End Handle Scale",
"Multiply B-Bone Scale Out channels by the local scale values of the end handle. "
"This is done after the Scale Easing option and isn't affected by it");
RNA_def_property_boolean_sdna(prop, NULL, "bbone_next_flag", BBONE_HANDLE_SCALE_X);
RNA_def_property_boolean_sdna(prop, nullptr, "bbone_next_flag", BBONE_HANDLE_SCALE_X);
RNA_def_property_array(prop, 3);
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
@@ -1149,7 +1151,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
"End Handle Ease",
"Multiply the B-Bone Ease Out channel by the local Y scale value of the end handle. "
"This is done after the Scale Easing option and isn't affected by it");
RNA_def_property_boolean_sdna(prop, NULL, "bbone_next_flag", BBONE_HANDLE_SCALE_EASE);
RNA_def_property_boolean_sdna(prop, nullptr, "bbone_next_flag", BBONE_HANDLE_SCALE_EASE);
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
RNA_define_lib_overridable(false);
@@ -1161,7 +1163,7 @@ static void rna_def_bone(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "Bone", NULL);
srna = RNA_def_struct(brna, "Bone", nullptr);
RNA_def_struct_ui_text(srna, "Bone", "Bone in an Armature data-block");
RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
RNA_def_struct_path_func(srna, "rna_Bone_path");
@@ -1171,14 +1173,14 @@ static void rna_def_bone(BlenderRNA *brna)
/* parent (pointer) */
prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Bone");
RNA_def_property_pointer_sdna(prop, NULL, "parent");
RNA_def_property_pointer_sdna(prop, nullptr, "parent");
RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
RNA_def_property_ui_text(prop, "Parent", "Parent bone (in same Armature)");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
/* children (collection) */
prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "childbase", NULL);
RNA_def_property_collection_sdna(prop, nullptr, "childbase", nullptr);
RNA_def_property_struct_type(prop, "Bone");
RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
RNA_def_property_ui_text(prop, "Children", "Bones which are children of this bone");
@@ -1191,7 +1193,7 @@ static void rna_def_bone(BlenderRNA *brna)
/* XXX should we define this in PoseChannel wrapping code instead?
* But PoseChannels directly get some of their flags from here... */
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_HIDDEN_P);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_HIDDEN_P);
RNA_def_property_ui_text(
prop,
"Hide",
@@ -1200,7 +1202,7 @@ static void rna_def_bone(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Bone_hide_update");
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_SELECTED);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_SELECTED);
RNA_def_property_ui_text(prop, "Select", "");
RNA_def_property_clear_flag(
prop,
@@ -1208,33 +1210,33 @@ static void rna_def_bone(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Bone_select_update");
prop = RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ROOTSEL);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_ROOTSEL);
RNA_def_property_ui_text(prop, "Select Head", "");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
prop = RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_TIPSEL);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_TIPSEL);
RNA_def_property_ui_text(prop, "Select Tail", "");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
/* XXX better matrix descriptions possible (Arystan) */
prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_float_sdna(prop, NULL, "bone_mat");
RNA_def_property_float_sdna(prop, nullptr, "bone_mat");
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Bone Matrix", "3x3 bone matrix");
prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_float_sdna(prop, NULL, "arm_mat");
RNA_def_property_float_sdna(prop, nullptr, "arm_mat");
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
prop, "Bone Armature-Relative Matrix", "4x4 bone matrix relative to armature");
prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_float_sdna(prop, NULL, "tail");
RNA_def_property_float_sdna(prop, nullptr, "tail");
RNA_def_property_array(prop, 3);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
@@ -1242,7 +1244,7 @@ static void rna_def_bone(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
prop = RNA_def_property(srna, "tail_local", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_float_sdna(prop, NULL, "arm_tail");
RNA_def_property_float_sdna(prop, nullptr, "arm_tail");
RNA_def_property_array(prop, 3);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
@@ -1250,7 +1252,7 @@ static void rna_def_bone(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_float_sdna(prop, NULL, "head");
RNA_def_property_float_sdna(prop, nullptr, "head");
RNA_def_property_array(prop, 3);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
@@ -1258,7 +1260,7 @@ static void rna_def_bone(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
prop = RNA_def_property(srna, "head_local", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_float_sdna(prop, NULL, "arm_head");
RNA_def_property_float_sdna(prop, nullptr, "arm_head");
RNA_def_property_array(prop, 3);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(
@@ -1266,7 +1268,7 @@ static void rna_def_bone(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "length");
RNA_def_property_float_sdna(prop, nullptr, "length");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Length", "Length of the bone");
@@ -1280,7 +1282,7 @@ static void rna_def_edit_bone(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "EditBone", NULL);
srna = RNA_def_struct(brna, "EditBone", nullptr);
RNA_def_struct_sdna(srna, "EditBone");
RNA_def_struct_idprops_func(srna, "rna_EditBone_idprops");
RNA_def_struct_ui_text(srna, "Edit Bone", "Edit mode bone in an armature data-block");
@@ -1291,20 +1293,20 @@ static void rna_def_edit_bone(BlenderRNA *brna)
prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "EditBone");
RNA_def_property_pointer_funcs(
prop, "rna_EditBone_parent_get", "rna_EditBone_parent_set", NULL, NULL);
prop, "rna_EditBone_parent_get", "rna_EditBone_parent_set", nullptr, nullptr);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Parent", "Parent edit bone (in same Armature)");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
prop = RNA_def_property(srna, "roll", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "roll");
RNA_def_property_float_sdna(prop, nullptr, "roll");
RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, 2);
RNA_def_property_ui_text(prop, "Roll", "Bone rotation around head-tail axis");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_float_sdna(prop, NULL, "head");
RNA_def_property_float_sdna(prop, nullptr, "head");
RNA_def_property_ui_range(prop, 0, FLT_MAX, 10, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Head", "Location of head end of the bone");
@@ -1312,7 +1314,7 @@ static void rna_def_edit_bone(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_float_sdna(prop, NULL, "tail");
RNA_def_property_float_sdna(prop, nullptr, "tail");
RNA_def_property_ui_range(prop, 0, FLT_MAX, 10, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Tail", "Location of tail end of the bone");
@@ -1320,7 +1322,8 @@ static void rna_def_edit_bone(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_funcs(prop, "rna_EditBone_length_get", "rna_EditBone_length_set", NULL);
RNA_def_property_float_funcs(
prop, "rna_EditBone_length_get", "rna_EditBone_length_set", nullptr);
RNA_def_property_range(prop, 0, FLT_MAX);
RNA_def_property_ui_range(prop, 0, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_ui_text(prop, "Length", "Length of the bone. Changing moves the tail end");
@@ -1331,38 +1334,38 @@ static void rna_def_edit_bone(BlenderRNA *brna)
rna_def_bone_curved_common(srna, false, true);
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_HIDDEN_A);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_HIDDEN_A);
RNA_def_property_ui_text(prop, "Hide", "Bone is not visible when in Edit Mode");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_EDITMODE_LOCKED);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_EDITMODE_LOCKED);
RNA_def_property_ui_text(prop, "Lock", "Bone is not able to be transformed when in Edit Mode");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_SELECTED);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_SELECTED);
RNA_def_property_ui_text(prop, "Select", "");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
prop = RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ROOTSEL);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_ROOTSEL);
RNA_def_property_ui_text(prop, "Head Select", "");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
prop = RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_TIPSEL);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", BONE_TIPSEL);
RNA_def_property_ui_text(prop, "Tail Select", "");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
/* calculated and read only, not actual data access */
prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
// RNA_def_property_float_sdna(prop, NULL, ""); /* Doesn't access any real data. */
// RNA_def_property_float_sdna(prop, nullptr, ""); /* Doesn't access any real data. */
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
// RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_flag(prop, PROP_THICK_WRAP); /* no reference to original data */
@@ -1371,7 +1374,8 @@ static void rna_def_edit_bone(BlenderRNA *brna)
"Edit Bone Matrix",
"Matrix combining location and rotation of the bone (head position, direction and roll), "
"in armature space (does not include/support bone's length/size)");
RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", "rna_EditBone_matrix_set", NULL);
RNA_def_property_float_funcs(
prop, "rna_EditBone_matrix_get", "rna_EditBone_matrix_set", nullptr);
RNA_api_armature_edit_bone(srna);
@@ -1388,16 +1392,16 @@ static void rna_def_armature_bones(BlenderRNA *brna, PropertyRNA *cprop)
/* PropertyRNA *parm; */
RNA_def_property_srna(cprop, "ArmatureBones");
srna = RNA_def_struct(brna, "ArmatureBones", NULL);
srna = RNA_def_struct(brna, "ArmatureBones", nullptr);
RNA_def_struct_sdna(srna, "bArmature");
RNA_def_struct_ui_text(srna, "Armature Bones", "Collection of armature bones");
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Bone");
RNA_def_property_pointer_sdna(prop, NULL, "act_bone");
RNA_def_property_pointer_sdna(prop, nullptr, "act_bone");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active Bone", "Armature's active bone");
RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_bone_set", NULL, NULL);
RNA_def_property_pointer_funcs(prop, nullptr, "rna_Armature_act_bone_set", nullptr, nullptr);
RNA_def_property_update(prop, 0, "rna_Armature_update");
/* TODO: redraw. */
@@ -1414,17 +1418,18 @@ static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop)
PropertyRNA *parm;
RNA_def_property_srna(cprop, "ArmatureEditBones");
srna = RNA_def_struct(brna, "ArmatureEditBones", NULL);
srna = RNA_def_struct(brna, "ArmatureEditBones", nullptr);
RNA_def_struct_sdna(srna, "bArmature");
RNA_def_struct_ui_text(srna, "Armature EditBones", "Collection of armature edit bones");
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "EditBone");
RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
RNA_def_property_pointer_sdna(prop, nullptr, "act_edbone");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
RNA_def_property_update(prop, 0, "rna_Armature_update");
RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL, NULL);
RNA_def_property_pointer_funcs(
prop, nullptr, "rna_Armature_act_edit_bone_set", nullptr, nullptr);
/* TODO: redraw. */
/* RNA_def_property_collection_active(prop, prop_act); */
@@ -1434,7 +1439,7 @@ static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Add a new bone");
parm = RNA_def_string(func, "name", "Object", 0, "", "New name for the bone");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
/* return type */
parm = RNA_def_pointer(func, "bone", "EditBone", "", "Newly created edit bone");
RNA_def_function_return(func, parm);
@@ -1446,7 +1451,7 @@ static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop)
/* Target to remove. */
parm = RNA_def_pointer(func, "bone", "EditBone", "", "EditBone to remove");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, ParameterFlag(0));
}
static void rna_def_armature(BlenderRNA *brna)
@@ -1475,7 +1480,7 @@ static void rna_def_armature(BlenderRNA *brna)
0,
"Wire",
"Display bones as thin wires, showing subdivision and B-Splines"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
static const EnumPropertyItem prop_pose_position_items[] = {
{0, "POSE", 0, "Pose Position", "Show armature in posed state"},
@@ -1484,12 +1489,12 @@ static void rna_def_armature(BlenderRNA *brna)
0,
"Rest Position",
"Show Armature in binding pose state (no posing possible)"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
static const EnumPropertyItem prop_relation_lines_items[] = {
{0, "TAIL", 0, "Tail", "Draw the relationship line from the parent tail to the child head"},
{1, "HEAD", 0, "Head", "Draw the relationship line from the parent head to the child head"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
srna = RNA_def_struct(brna, "Armature", "ID");
@@ -1502,8 +1507,8 @@ static void rna_def_armature(BlenderRNA *brna)
func = RNA_def_function(srna, "transform", "rna_Armature_transform");
RNA_def_function_ui_description(func, "Transform armature bones by a matrix");
parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_float_matrix(func, "matrix", 4, 4, nullptr, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
/* Animation Data */
rna_def_animdata_common(srna);
@@ -1512,29 +1517,29 @@ static void rna_def_armature(BlenderRNA *brna)
/* Collections */
prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "bonebase", NULL);
RNA_def_property_collection_sdna(prop, nullptr, "bonebase", nullptr);
RNA_def_property_collection_funcs(prop,
NULL,
nullptr,
"rna_Armature_bones_next",
NULL,
NULL,
NULL,
NULL,
nullptr,
nullptr,
nullptr,
nullptr,
"rna_Armature_bones_lookup_string",
NULL);
nullptr);
RNA_def_property_struct_type(prop, "Bone");
RNA_def_property_ui_text(prop, "Bones", "");
rna_def_armature_bones(brna, prop);
prop = RNA_def_property(srna, "edit_bones", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "edbo", NULL);
RNA_def_property_collection_sdna(prop, nullptr, "edbo", nullptr);
RNA_def_property_struct_type(prop, "EditBone");
RNA_def_property_ui_text(prop, "Edit Bones", "");
rna_def_armature_edit_bones(brna, prop);
/* Enum values */
prop = RNA_def_property(srna, "pose_position", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
RNA_def_property_enum_items(prop, prop_pose_position_items);
RNA_def_property_ui_text(
prop, "Pose Position", "Show armature in binding pose or final posed state");
@@ -1542,7 +1547,7 @@ static void rna_def_armature(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "drawtype");
RNA_def_property_enum_sdna(prop, nullptr, "drawtype");
RNA_def_property_enum_items(prop, prop_drawtype_items);
RNA_def_property_ui_text(prop, "Display Type", "");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
@@ -1551,16 +1556,16 @@ static void rna_def_armature(BlenderRNA *brna)
/* Boolean values */
/* layer */
prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
RNA_def_property_boolean_sdna(prop, nullptr, "layer", 1);
RNA_def_property_array(prop, 32);
RNA_def_property_ui_text(prop, "Visible Layers", "Armature layer visibility");
RNA_def_property_boolean_funcs(prop, NULL, "rna_Armature_layer_set");
RNA_def_property_boolean_funcs(prop, nullptr, "rna_Armature_layer_set");
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Armature_update_layers");
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
/* layer protection */
prop = RNA_def_property(srna, "layers_protected", PROP_BOOLEAN, PROP_LAYER);
RNA_def_property_boolean_sdna(prop, NULL, "layer_protected", 1);
RNA_def_property_boolean_sdna(prop, nullptr, "layer_protected", 1);
RNA_def_property_array(prop, 32);
RNA_def_property_ui_text(prop,
"Layer Override Protection",
@@ -1570,13 +1575,13 @@ static void rna_def_armature(BlenderRNA *brna)
/* flag */
prop = RNA_def_property(srna, "show_axes", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DRAWAXES);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", ARM_DRAWAXES);
RNA_def_property_ui_text(prop, "Display Axes", "Display bone axes");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
prop = RNA_def_property(srna, "axes_position", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "axes_position");
RNA_def_property_float_sdna(prop, nullptr, "axes_position");
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 1);
RNA_def_property_ui_text(prop,
@@ -1596,35 +1601,35 @@ static void rna_def_armature(BlenderRNA *brna)
RNA_def_property_enum_funcs(prop,
"rna_Armature_relation_line_position_get",
"rna_Armature_relation_line_position_set",
/*item function*/ NULL);
/*item function*/ nullptr);
RNA_define_verify_sdna(true); /* Restore default. */
prop = RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DRAWNAMES);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", ARM_DRAWNAMES);
RNA_def_property_ui_text(prop, "Display Names", "Display bone names");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_MIRROR_EDIT);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", ARM_MIRROR_EDIT);
RNA_def_property_ui_text(
prop, "X-Axis Mirror", "Apply changes to matching bone on opposite side of X-Axis");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
prop = RNA_def_property(srna, "show_bone_custom_shapes", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ARM_NO_CUSTOM);
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", ARM_NO_CUSTOM);
RNA_def_property_ui_text(
prop, "Display Custom Bone Shapes", "Display bones with their custom shapes");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_COL_CUSTOM);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", ARM_COL_CUSTOM);
RNA_def_property_ui_text(prop, "Display Bone Group Colors", "Display bone group colors");
RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_funcs(prop, "rna_Armature_is_editmode_get", NULL);
RNA_def_property_boolean_funcs(prop, "rna_Armature_is_editmode_get", nullptr);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");

View File

@@ -57,7 +57,7 @@ static void rna_Bone_convert_local_to_pose(Bone *bone,
if (is_zero_m4(parent_pose_mat) || is_zero_m4(parent_arm_mat)) {
/* No parent case. */
BKE_bone_parent_transform_calc_from_matrices(
bone->flag, bone->inherit_scale_mode, bone_arm_mat, NULL, NULL, &bpt);
bone->flag, bone->inherit_scale_mode, bone_arm_mat, nullptr, nullptr, &bpt);
}
else {
invert_m4_m4(offs_bone, parent_arm_mat);
@@ -107,8 +107,8 @@ void RNA_api_armature_edit_bone(StructRNA *srna)
"Align the bone to a local-space roll so the Z axis "
"points in the direction of the vector given");
parm = RNA_def_float_vector(
func, "vector", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
func, "vector", 3, nullptr, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
}
void RNA_api_bone(StructRNA *srna)
@@ -121,14 +121,14 @@ void RNA_api_bone(StructRNA *srna)
parm = RNA_def_float_vector_xyz(func,
"point",
3,
NULL,
nullptr,
-FLT_MAX,
FLT_MAX,
"Point",
"Position in 3d space to evaluate",
-FLT_MAX,
FLT_MAX);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
/* return value */
parm = RNA_def_float(
func, "factor", 0, -FLT_MAX, FLT_MAX, "Factor", "Envelope factor", -FLT_MAX, FLT_MAX);
@@ -148,11 +148,11 @@ void RNA_api_bone(StructRNA *srna)
parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
RNA_def_property_ui_text(parm, "", "The matrix to transform");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
parm = RNA_def_property(func, "matrix_local", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
RNA_def_property_ui_text(parm, "", "The custom rest matrix of this bone (Bone.matrix_local)");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
parm = RNA_def_property(func, "parent_matrix", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
RNA_def_property_ui_text(
@@ -173,7 +173,7 @@ void RNA_api_bone(StructRNA *srna)
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
parm = RNA_def_property(func, "roll", PROP_FLOAT, PROP_NONE);
RNA_def_property_ui_text(parm, "", "The roll of the bone");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
parm = RNA_def_property(func, "result_matrix", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_3x3);
RNA_def_property_ui_text(parm, "", "The resulting orientation matrix");