RNA: reuse axis enum

This commit is contained in:
Campbell Barton 2015-11-18 12:23:05 +11:00
parent a374ff16b5
commit 3555ef184b
Notes: blender-bot 2023-02-14 09:43:37 +01:00
Referenced by issue #46804, Crash when using Triangulate modifier on a specific mesh.
Referenced by issue #46805, scale along z axis ignore normal constraint via python
4 changed files with 8 additions and 35 deletions

View File

@ -1617,13 +1617,6 @@ static void rna_def_constraint_transform(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
static EnumPropertyItem axis_map_items[] = {
{0, "X", 0, "X", ""},
{1, "Y", 0, "Y", ""},
{2, "Z", 0, "Z", ""},
{0, NULL, 0, NULL, NULL}
};
srna = RNA_def_struct(brna, "TransformConstraint", "Constraint");
RNA_def_struct_ui_text(srna, "Transformation Constraint", "Map transformations of the target to the object");
RNA_def_struct_sdna_from(srna, "bTransformConstraint", "data");
@ -1653,19 +1646,19 @@ static void rna_def_constraint_transform(BlenderRNA *brna)
prop = RNA_def_property(srna, "map_to_x_from", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "map[0]");
RNA_def_property_enum_items(prop, axis_map_items);
RNA_def_property_enum_items(prop, object_axis_unsigned_items);
RNA_def_property_ui_text(prop, "Map To X From", "The source axis constrained object's X axis uses");
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
prop = RNA_def_property(srna, "map_to_y_from", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "map[1]");
RNA_def_property_enum_items(prop, axis_map_items);
RNA_def_property_enum_items(prop, object_axis_unsigned_items);
RNA_def_property_ui_text(prop, "Map To Y From", "The source axis constrained object's Y axis uses");
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
prop = RNA_def_property(srna, "map_to_z_from", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "map[2]");
RNA_def_property_enum_items(prop, axis_map_items);
RNA_def_property_enum_items(prop, object_axis_unsigned_items);
RNA_def_property_ui_text(prop, "Map To Z From", "The source axis constrained object's Z axis uses");
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");

View File

@ -3355,13 +3355,6 @@ static void rna_def_modifier_uvwarp(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
static EnumPropertyItem uvwarp_axis[] = {
{0, "X", 0, "X", ""},
{1, "Y", 0, "Y", ""},
{2, "Z", 0, "Z", ""},
{0, NULL, 0, NULL, NULL}
};
srna = RNA_def_struct(brna, "UVWarpModifier", "Modifier");
RNA_def_struct_ui_text(srna, "UVWarp Modifier", "Add target position to uv coordinates");
RNA_def_struct_sdna(srna, "UVWarpModifierData");
@ -3369,13 +3362,13 @@ static void rna_def_modifier_uvwarp(BlenderRNA *brna)
prop = RNA_def_property(srna, "axis_u", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "axis_u");
RNA_def_property_enum_items(prop, uvwarp_axis);
RNA_def_property_enum_items(prop, object_axis_unsigned_items);
RNA_def_property_ui_text(prop, "U-Axis", "Pole axis for rotation");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "axis_v", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "axis_v");
RNA_def_property_enum_items(prop, uvwarp_axis);
RNA_def_property_enum_items(prop, object_axis_unsigned_items);
RNA_def_property_ui_text(prop, "V-Axis", "Pole axis for rotation");
RNA_def_property_update(prop, 0, "rna_Modifier_update");

View File

@ -34,6 +34,7 @@
#include "DNA_smoke_types.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "rna_internal.h"
@ -1169,13 +1170,6 @@ static void rna_def_field(BlenderRNA *brna)
{6, "ROLL", 0, "Roll", ""},
{0, NULL, 0, NULL, NULL}
};
static EnumPropertyItem guide_kink_axis_items[] = {
{0, "X", 0, "X", ""},
{1, "Y", 0, "Y", ""},
{2, "Z", 0, "Z", ""},
{0, NULL, 0, NULL, NULL}
};
srna = RNA_def_struct(brna, "FieldSettings", NULL);
RNA_def_struct_sdna(srna, "PartDeflect");
@ -1456,7 +1450,7 @@ static void rna_def_field(BlenderRNA *brna)
prop = RNA_def_property(srna, "guide_kink_axis", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "kink_axis");
RNA_def_property_enum_items(prop, guide_kink_axis_items);
RNA_def_property_enum_items(prop, object_axis_unsigned_items);
RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");

View File

@ -1997,13 +1997,6 @@ static void rna_def_particle_settings(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
static EnumPropertyItem kink_axis_items[] = {
{0, "X", 0, "X", ""},
{1, "Y", 0, "Y", ""},
{2, "Z", 0, "Z", ""},
{0, NULL, 0, NULL, NULL}
};
static EnumPropertyItem bb_align_items[] = {
{PART_BB_X, "X", 0, "X", ""},
{PART_BB_Y, "Y", 0, "Y", ""},
@ -2421,7 +2414,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
prop = RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, kink_axis_items);
RNA_def_property_enum_items(prop, object_axis_unsigned_items);
RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");