[Bf-blender-cvs] [c4fda6f] master: Cleanup: use generic xyz axis enums

Campbell Barton noreply at git.blender.org
Thu Jan 7 10:30:11 CET 2016


Commit: c4fda6f7d076ffed5a55634031e623838a3d6192
Author: Campbell Barton
Date:   Thu Jan 7 20:22:49 2016 +1100
Branches: master
https://developer.blender.org/rBc4fda6f7d076ffed5a55634031e623838a3d6192

Cleanup: use generic xyz axis enums

===================================================================

M	source/blender/editors/object/object_lattice.c
M	source/blender/makesrna/RNA_enum_types.h
M	source/blender/makesrna/intern/rna_constraint.c
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/makesrna/intern/rna_object.c
M	source/blender/makesrna/intern/rna_object_force.c
M	source/blender/makesrna/intern/rna_particle.c

===================================================================

diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index 23c2bff..41bb432 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -308,7 +308,7 @@ void LATTICE_OT_select_mirror(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* props */
-	RNA_def_enum(ot->srna, "axis", rna_enum_object_axis_unsigned_items, 0, "Axis", "");
+	RNA_def_enum(ot->srna, "axis", rna_enum_axis_xyz_items, 0, "Axis", "");
 
 	RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
 }
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 0576820..0efdb3d 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -113,6 +113,9 @@ extern EnumPropertyItem rna_enum_brush_image_tool_items[];
 
 extern EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[];
 
+extern EnumPropertyItem rna_enum_axis_xy_items[];
+extern EnumPropertyItem rna_enum_axis_xyz_items[];
+
 extern EnumPropertyItem rna_enum_symmetrize_direction_items[];
 
 extern EnumPropertyItem rna_enum_texture_type_items[];
@@ -130,7 +133,6 @@ extern EnumPropertyItem rna_enum_rigidbody_object_shape_items[];
 extern EnumPropertyItem rna_enum_rigidbody_constraint_type_items[];
 
 extern EnumPropertyItem rna_enum_object_axis_items[];
-extern EnumPropertyItem rna_enum_object_axis_unsigned_items[];
 
 extern EnumPropertyItem rna_enum_controller_type_items[];
 
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 7da6488..0b5d0f3 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -1645,19 +1645,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, rna_enum_object_axis_unsigned_items);
+	RNA_def_property_enum_items(prop, rna_enum_axis_xyz_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, rna_enum_object_axis_unsigned_items);
+	RNA_def_property_enum_items(prop, rna_enum_axis_xyz_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, rna_enum_object_axis_unsigned_items);
+	RNA_def_property_enum_items(prop, rna_enum_axis_xyz_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");
 
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index bf35752..75030b8 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -255,6 +255,18 @@ EnumPropertyItem rna_enum_dt_layers_select_dst_items[] = {
 	{0, NULL, 0, NULL, NULL}
 };
 
+EnumPropertyItem rna_enum_axis_xy_items[] = {
+	{0, "X", 0, "X", ""},
+	{1, "Y", 0, "Y", ""},
+	{0, NULL, 0, NULL, NULL}
+};
+
+EnumPropertyItem rna_enum_axis_xyz_items[] = {
+	{0, "X", 0, "X", ""},
+	{1, "Y", 0, "Y", ""},
+	{2, "Z", 0, "Z", ""},
+	{0, NULL, 0, NULL, NULL}
+};
 
 #ifdef RNA_RUNTIME
 
@@ -1557,7 +1569,7 @@ static void rna_def_modifier_decimate(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "symmetry_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "symmetry_axis");
-	RNA_def_property_enum_items(prop, rna_enum_object_axis_unsigned_items);
+	RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
 	RNA_def_property_ui_text(prop, "Axis", "Axis of symmetry");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
@@ -2544,13 +2556,6 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem particleinstance_axis[] = {
-		{0, "X", 0, "X", ""},
-		{1, "Y", 0, "Y", ""},
-		{2, "Z", 0, "Z", ""},
-		{0, NULL, 0, NULL, NULL}
-	};
-
 	srna = RNA_def_struct(brna, "ParticleInstanceModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "ParticleInstance Modifier", "Particle system instancing modifier");
 	RNA_def_struct_sdna(srna, "ParticleInstanceModifierData");
@@ -2571,7 +2576,7 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "axis");
-	RNA_def_property_enum_items(prop, particleinstance_axis);
+	RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
 	RNA_def_property_ui_text(prop, "Axis", "Pole axis for rotation");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
@@ -3284,13 +3289,6 @@ static void rna_def_modifier_solidify(BlenderRNA *brna)
 
 static void rna_def_modifier_screw(BlenderRNA *brna)
 {
-	static EnumPropertyItem axis_items[] = {
-		{0, "X", 0, "X Axis", ""},
-		{1, "Y", 0, "Y Axis", ""},
-		{2, "Z", 0, "Z Axis", ""},
-		{0, NULL, 0, NULL, NULL}
-	};
-
 	StructRNA *srna;
 	PropertyRNA *prop;
 
@@ -3325,7 +3323,7 @@ static void rna_def_modifier_screw(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
 	prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
-	RNA_def_property_enum_items(prop, axis_items);
+	RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
 	RNA_def_property_ui_text(prop, "Axis", "Screw axis");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
@@ -3390,13 +3388,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, rna_enum_object_axis_unsigned_items);
+	RNA_def_property_enum_items(prop, rna_enum_axis_xyz_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, rna_enum_object_axis_unsigned_items);
+	RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
 	RNA_def_property_ui_text(prop, "V-Axis", "Pole axis for rotation");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 984ecbe..0bec03c 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -5224,15 +5224,9 @@ static void def_cmp_splitviewer(StructRNA *srna)
 {
 	PropertyRNA *prop;
 	
-	static EnumPropertyItem axis_items[] = {
-		{0, "X",  0, "X",     ""},
-		{1, "Y",  0, "Y",     ""},
-		{0, NULL, 0, NULL, NULL}
-	};
-	
 	prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "custom2");
-	RNA_def_property_enum_items(prop, axis_items);
+	RNA_def_property_enum_items(prop, rna_enum_axis_xy_items);
 	RNA_def_property_ui_text(prop, "Axis", "");
 	RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 81b1e4a..031ea89 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -167,14 +167,6 @@ EnumPropertyItem rna_enum_object_axis_items[] = {
 	{0, NULL, 0, NULL, NULL}
 };
 
-/* for general use (not just object) */
-EnumPropertyItem rna_enum_object_axis_unsigned_items[] = {
-	{0, "X", 0, "X", ""},
-	{1, "Y", 0, "Y", ""},
-	{2, "Z", 0, "Z", ""},
-	{0, NULL, 0, NULL, NULL}
-};
-
 #ifdef RNA_RUNTIME
 
 #include "BLI_math.h"
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 76785e1..ed765f1 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -1450,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, rna_enum_object_axis_unsigned_items);
+	RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
 	RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index f779d67..27ceaab 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -2411,7 +2411,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, rna_enum_object_axis_unsigned_items);
+	RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
 	RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");




More information about the Bf-blender-cvs mailing list