From c4fda6f7d076ffed5a55634031e623838a3d6192 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 7 Jan 2016 20:22:49 +1100 Subject: Cleanup: use generic xyz axis enums --- source/blender/editors/object/object_lattice.c | 2 +- source/blender/makesrna/RNA_enum_types.h | 4 ++- source/blender/makesrna/intern/rna_constraint.c | 6 ++-- source/blender/makesrna/intern/rna_modifier.c | 36 +++++++++++------------ source/blender/makesrna/intern/rna_nodetree.c | 8 +---- source/blender/makesrna/intern/rna_object.c | 8 ----- source/blender/makesrna/intern/rna_object_force.c | 2 +- source/blender/makesrna/intern/rna_particle.c | 2 +- 8 files changed, 27 insertions(+), 41 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 23c2bfff482..41bb4325fbd 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 0576820e08f..0efdb3d839a 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 7da6488ceba..0b5d0f3d41d 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 bf35752dcf6..75030b83f80 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 984ecbe96ac..0bec03c5ce1 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 81b1e4ac4be..031ea89cff6 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 76785e1a852..ed765f1b5c6 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 f779d67e1f4..27ceaabd5dd 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"); -- cgit v1.2.3