code cleanup: de-duplicate enum.
authorCampbell Barton <ideasman42@gmail.com>
Fri, 5 Oct 2012 15:48:39 +0000 (15:48 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 5 Oct 2012 15:48:39 +0000 (15:48 +0000)
source/blender/editors/object/object_add.c
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/rna_object.c

index f6a7a6d6f179a9c29906577f76226ad30e671b7a..43a32cd662ea376d4f8645031280bed1ade891f0 100644 (file)
@@ -139,19 +139,6 @@ static EnumPropertyItem field_type_items[] = {
        {0, NULL, 0, NULL, NULL}
 };
 
-/* Copy from rna_object.c */
-static EnumPropertyItem empty_drawtype_items[] = {
-       {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
-       {OB_ARROWS, "ARROWS", 0, "Arrows", ""},
-       {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
-       {OB_CIRCLE, "CIRCLE", 0, "Circle", ""},
-       {OB_CUBE, "CUBE", 0, "Cube", ""},
-       {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
-       {OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
-       {OB_EMPTY_IMAGE, "IMAGE", 0, "Image", ""},
-       {0, NULL, 0, NULL, NULL}
-};
-
 /************************** Exported *****************************/
 
 void ED_object_location_from_view(bContext *C, float loc[3])
@@ -731,7 +718,7 @@ void OBJECT_OT_empty_add(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* properties */
-       ot->prop = RNA_def_enum(ot->srna, "type", empty_drawtype_items, 0, "Type", "");
+       ot->prop = RNA_def_enum(ot->srna, "type", object_empty_drawtype_items, 0, "Type", "");
 
        ED_object_add_generic_props(ot, FALSE);
 }
index b651d4d5e5c6bc3584b2bb29da877cf1745b266a..0f9a00de7b633d306503aee20c33561d16e5199e 100644 (file)
@@ -38,6 +38,7 @@ extern EnumPropertyItem DummyRNA_NULL_items[];
 extern EnumPropertyItem DummyRNA_DEFAULT_items[];
 
 extern EnumPropertyItem object_mode_items[];
+extern EnumPropertyItem object_empty_drawtype_items[];
 extern EnumPropertyItem metaelem_type_items[];
 
 extern EnumPropertyItem proportional_falloff_items[];
index 758b433b1cb974147436ba26ec3a705bfc8fdde1..0b8afef03649ff4ffcf15ea543f6b754ac854e09 100644 (file)
@@ -69,6 +69,19 @@ EnumPropertyItem object_mode_items[] = {
        {0, NULL, 0, NULL, NULL}
 };
 
+EnumPropertyItem object_empty_drawtype_items[] = {
+       {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
+       {OB_ARROWS, "ARROWS", 0, "Arrows", ""},
+       {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
+       {OB_CIRCLE, "CIRCLE", 0, "Circle", ""},
+       {OB_CUBE, "CUBE", 0, "Cube", ""},
+       {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
+       {OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
+       {OB_EMPTY_IMAGE, "IMAGE", 0, "Image", ""},
+       {0, NULL, 0, NULL, NULL}
+};
+
+
 static EnumPropertyItem parent_type_items[] = {
        {PAROBJECT, "OBJECT", 0, "Object", "The object is parented to an object"},
        {PARCURVE, "CURVE", 0, "Curve", "The object is parented to a curve"},
@@ -80,7 +93,7 @@ static EnumPropertyItem parent_type_items[] = {
        {PARBONE, "BONE", 0, "Bone", "The object is parented to a bone"},
        {0, NULL, 0, NULL, NULL}
 };
-       
+
 static EnumPropertyItem collision_bounds_items[] = {
        {OB_BOUND_BOX, "BOX", 0, "Box", ""},
        {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""},
@@ -1874,18 +1887,6 @@ static void rna_def_object(BlenderRNA *brna)
 {
        StructRNA *srna;
        PropertyRNA *prop;
-
-       static EnumPropertyItem empty_drawtype_items[] = {
-               {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
-               {OB_ARROWS, "ARROWS", 0, "Arrows", ""},
-               {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
-               {OB_CIRCLE, "CIRCLE", 0, "Circle", ""},
-               {OB_CUBE, "CUBE", 0, "Cube", ""},
-               {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
-               {OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
-               {OB_EMPTY_IMAGE, "IMAGE", 0, "Image", ""},
-               {0, NULL, 0, NULL, NULL}
-       };
        
        static EnumPropertyItem track_items[] = {
                {OB_POSX, "POS_X", 0, "+X", ""},
@@ -2267,7 +2268,7 @@ static void rna_def_object(BlenderRNA *brna)
        /* empty */
        prop = RNA_def_property(srna, "empty_draw_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "empty_drawtype");
-       RNA_def_property_enum_items(prop, empty_drawtype_items);
+       RNA_def_property_enum_items(prop, object_empty_drawtype_items);
        RNA_def_property_ui_text(prop, "Empty Display Type", "Viewport display style for empties");
        RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);