2.5 - Assorted animation code cleanups
authorJoshua Leung <aligorith@gmail.com>
Fri, 8 May 2009 10:50:32 +0000 (10:50 +0000)
committerJoshua Leung <aligorith@gmail.com>
Fri, 8 May 2009 10:50:32 +0000 (10:50 +0000)
* Replaced a few duplicated enums that were also defined for some RNA properties already with the RNA ones.

* Start of cleanup of markers code in preparation for getting the rest of the editing code involving markers working again

source/blender/editors/animation/anim_markers.c
source/blender/editors/animation/keyframes_edit.c
source/blender/editors/space_action/action_edit.c
source/blender/editors/space_graph/graph_edit.c
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/rna_curve.c
source/blender/makesrna/intern/rna_fcurve.c

index 58e3aa8e172a4bed06695413dd89f962727e9b24..97904dcdddfceba8f031f6b1d9addecfc09bb180 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_action_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_space_types.h"
@@ -96,12 +97,13 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
        ypixels= v2d->mask.ymax-v2d->mask.ymin;
        UI_view2d_getscale(v2d, &xscale, &yscale);
        
-       glScalef(1.0/xscale, 1.0, 1.0);
+       glScalef(1.0f/xscale, 1.0f, 1.0f);
        
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);                      
        
        /* vertical line - dotted */
+       // NOTE: currently only used for sequencer 
        if (flag & DRAW_MARKERS_LINES) {
                setlinestyle(3);
                
@@ -111,8 +113,8 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
                        glColor4ub(0, 0, 0, 96);
                
                glBegin(GL_LINES);
-                       glVertex2f((xpos*xscale)+0.5, 12);
-                       glVertex2f((xpos*xscale)+0.5, 34*yscale); /* a bit lazy but we know it cant be greater then 34 strips high*/
+                       glVertex2f((xpos*xscale)+0.5f, 12.0f);
+                       glVertex2f((xpos*xscale)+0.5f, 34.0f*yscale); /* a bit lazy but we know it cant be greater then 34 strips high */
                glEnd();
                
                setlinestyle(0);
@@ -129,7 +131,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
                ICON_MARKER;
        }
        
-       UI_icon_draw(xpos*xscale-5.0, 16.0, icon_id);
+       UI_icon_draw(xpos*xscale-5.0f, 16.0f, icon_id);
        
        glBlendFunc(GL_ONE, GL_ZERO);
        glDisable(GL_BLEND);
@@ -138,25 +140,26 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
        if (marker->name && marker->name[0]) {
                float x, y;
                
-               if(marker->flag & SELECT) {
+               if (marker->flag & SELECT) {
                        UI_ThemeColor(TH_TEXT_HI);
-                       x= xpos*xscale+4.0;
-                       y= (ypixels<=39.0)?(ypixels-10.0):29.0;
+                       x= xpos*xscale + 4.0f;
+                       y= (ypixels <= 39.0f)? (ypixels-10.0f) : 29.0f;
                }
                else {
                        UI_ThemeColor(TH_TEXT);
                        if((marker->frame <= cfra) && (marker->frame+5 > cfra)) {
-                               x= xpos*xscale+4.0;
-                               y= (ypixels<=39.0)?(ypixels-10.0):29.0;
+                               x= xpos*xscale + 4.0f;
+                               y= (ypixels <= 39.0f)? (ypixels - 10.0f) : 29.0f;
                        }
                        else {
-                               x= xpos*xscale+4.0;
-                               y= 17.0;
+                               x= xpos*xscale + 4.0f;
+                               y= 17.0f;
                        }
                }
                UI_DrawString(x, y, marker->name);
        }
-       glScalef(xscale, 1.0, 1.0);
+       
+       glScalef(xscale, 1.0f, 1.0f);
 }
 
 /* Draw Scene-Markers in time window */
@@ -166,17 +169,19 @@ void draw_markers_time(const bContext *C, int flag)
        View2D *v2d= UI_view2d_fromcontext(C);
        TimeMarker *marker;
        
-       if(markers == NULL)
+       if (markers == NULL)
                return;
        
        /* unselected markers are drawn at the first time */
        for (marker= markers->first; marker; marker= marker->next) {
-               if (!(marker->flag & SELECT)) draw_marker(v2d, marker, CTX_data_scene(C)->r.cfra, flag);
+               if ((marker->flag & SELECT) == 0) 
+                       draw_marker(v2d, marker, CTX_data_scene(C)->r.cfra, flag);
        }
        
        /* selected markers are drawn later */
        for (marker= markers->first; marker; marker= marker->next) {
-               if (marker->flag & SELECT) draw_marker(v2d, marker, CTX_data_scene(C)->r.cfra, flag);
+               if (marker->flag & SELECT) 
+                       draw_marker(v2d, marker, CTX_data_scene(C)->r.cfra, flag);
        }
 }
 
@@ -191,13 +196,14 @@ static int ed_marker_add(bContext *C, wmOperator *op)
        TimeMarker *marker;
        int frame= CTX_data_scene(C)->r.cfra;
        
-       if(markers == NULL)
+       if (markers == NULL)
                return OPERATOR_CANCELLED;
        
        /* two markers can't be at the same place */
-       for(marker= markers->first; marker; marker= marker->next)
-               if(marker->frame == frame) 
+       for (marker= markers->first; marker; marker= marker->next) {
+               if (marker->frame == frame) 
                        return OPERATOR_CANCELLED;
+       }
        
        /* deselect all */
        for(marker= markers->first; marker; marker= marker->next)
@@ -298,9 +304,13 @@ static void ed_marker_move_exit(bContext *C, wmOperator *op)
 {
        MarkerMove *mm= op->customdata;
        
+       /* free data */
        MEM_freeN(mm->oldframe);
        MEM_freeN(op->customdata);
        op->customdata= NULL;
+       
+       /* clear custom header prints */
+       ED_area_headerprint(CTX_wm_area(C), NULL);
 }
 
 static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt)
@@ -365,7 +375,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
                case ESCKEY:
                        ed_marker_move_cancel(C, op);
                        return OPERATOR_CANCELLED;
-
+               
                case LEFTMOUSE:
                case MIDDLEMOUSE:
                case RIGHTMOUSE:
@@ -377,7 +387,6 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
                        
                        break;
                case MOUSEMOVE:
-       
                        dx= v2d->mask.xmax-v2d->mask.xmin;
                        dx= (v2d->cur.xmax-v2d->cur.xmin)/dx;
                        
@@ -415,12 +424,11 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
                                                        sprintf(str, "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs));
                                        }
                                        else if (mm->slink->spacetype == SPACE_ACTION) {
-#if 0                                          
-XXX                                            if (saction->flag & SACTION_DRAWTIME)
+                                               SpaceAction *saction= (SpaceAction *)mm->slink;
+                                               if (saction->flag & SACTION_DRAWTIME)
                                                        sprintf(str, "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs));
                                                else
                                                        sprintf(str, "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs));
-#endif                                 
                                        }
                                        else {
                                                sprintf(str, "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs));
@@ -435,21 +443,20 @@ XXX                                               if (saction->flag & SACTION_DRAWTIME)
                                                else 
                                                        sprintf(str, "Marker offset %.2f ", FRA2TIME(offs));
                                        }
-#if 0                                  
-XXX                                    else if (mm->slink->spacetype == SPACE_ACTION) {
+                                       else if (mm->slink->spacetype == SPACE_ACTION) {
+                                               SpaceAction *saction= (SpaceAction *)mm->slink;
                                                if (saction->flag & SACTION_DRAWTIME)
                                                        sprintf(str, "Marker offset %.2f ", FRA2TIME(offs));
                                                else
                                                        sprintf(str, "Marker offset %.2f ", (double)(offs));
                                        }
-#endif                                 
                                        else {
                                                sprintf(str, "Marker offset %.2f ", (double)(offs));
                                        }
                                }
                                
                                WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
-                               // headerprint(str); XXX
+                               ED_area_headerprint(CTX_wm_area(C), str);
                        }
        }
 
@@ -511,19 +518,23 @@ static void ed_marker_duplicate_apply(bContext *C, wmOperator *op)
        ListBase *markers= context_get_markers(C);
        TimeMarker *marker, *newmarker;
        
-       if(markers == NULL) return;
+       if (markers == NULL) 
+               return;
 
        /* go through the list of markers, duplicate selected markers and add duplicated copies
-       * to the begining of the list (unselect original markers) */
-       for(marker= markers->first; marker; marker= marker->next) {
-               if(marker->flag & SELECT){
+        * to the begining of the list (unselect original markers) 
+        */
+       for (marker= markers->first; marker; marker= marker->next) {
+               if (marker->flag & SELECT) {
                        /* unselect selected marker */
                        marker->flag &= ~SELECT;
+                       
                        /* create and set up new marker */
                        newmarker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
                        newmarker->flag= SELECT;
                        newmarker->frame= marker->frame;
                        BLI_strncpy(newmarker->name, marker->name, sizeof(marker->name));
+                       
                        /* new marker is added to the begining of list */
                        BLI_addhead(markers, newmarker);
                }
@@ -572,12 +583,13 @@ static void select_timeline_marker_frame(ListBase *markers, int frame, unsigned
        TimeMarker *marker;
        int select=0;
        
-       for(marker= markers->first; marker; marker= marker->next) {
+       for (marker= markers->first; marker; marker= marker->next) {
                /* if Shift is not set, then deselect Markers */
-               if(!shift) marker->flag &= ~SELECT;
+               if (!shift) marker->flag &= ~SELECT;
+               
                /* this way a not-shift select will allways give 1 selected marker */
-               if((marker->frame == frame) && (!select)) {
-                       if(marker->flag & SELECT) 
+               if ((marker->frame == frame) && (!select)) {
+                       if (marker->flag & SELECT) 
                                marker->flag &= ~SELECT;
                        else
                                marker->flag |= SELECT;
@@ -586,20 +598,20 @@ static void select_timeline_marker_frame(ListBase *markers, int frame, unsigned
        }
 }
 
-int find_nearest_marker_time(ListBase *markers, float dx)
+int find_nearest_marker_time (ListBase *markers, float dx)
 {
        TimeMarker *marker, *nearest= NULL;
        float dist, min_dist= 1000000;
        
-       for(marker= markers->first; marker; marker= marker->next) {
+       for (marker= markers->first; marker; marker= marker->next) {
                dist = ABS((float)marker->frame - dx);
-               if(dist < min_dist){
+               if (dist < min_dist) {
                        min_dist= dist;
                        nearest= marker;
                }
        }
        
-       if(nearest) return nearest->frame;
+       if (nearest) return nearest->frame;
        else return (int)floor(dx); /* hrmf? */
 }
 
index bef44448829c038f973613f8356bd8e84bbb5911..1aadeb7969f6152a81eff9c17770ccdaea89c1b1 100644 (file)
@@ -427,7 +427,7 @@ static short snap_bezier_horizontal(BeztEditData *bed, BezTriple *bezt)
        return 0;       
 }
 
-// calchandles_ipocurve
+
 BeztEditFunc ANIM_editkeyframes_snap(short type)
 {
        /* eEditKeyframes_Snap */
index 9e679a5b722abd425873159ae04ae078163e8285..a486e9067aec6392c80be2d5c019e470e6ef78ba 100644 (file)
@@ -60,6 +60,7 @@
 
 #include "RNA_access.h"
 #include "RNA_define.h"
+#include "RNA_enum_types.h"
 
 #include "BKE_action.h"
 #include "BKE_depsgraph.h"
@@ -872,14 +873,6 @@ void ACT_OT_keyframes_extrapolation_type_set (wmOperatorType *ot)
 
 /* ******************** Set Interpolation-Type Operator *********************** */
 
-/* defines for set ipo-type for selected keyframes tool */
-EnumPropertyItem prop_actkeys_ipo_types[] = {
-       {BEZT_IPO_CONST, "CONSTANT", "Constant Interpolation", ""},
-       {BEZT_IPO_LIN, "LINEAR", "Linear Interpolation", ""},
-       {BEZT_IPO_BEZ, "BEZIER", "Bezier Interpolation", ""},
-       {0, NULL, NULL, NULL}
-};
-
 /* this function is responsible for setting interpolation mode for keyframes */
 static void setipo_action_keys(bAnimContext *ac, short mode) 
 {
@@ -945,21 +938,11 @@ void ACT_OT_keyframes_interpolation_type (wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* id-props */
-       RNA_def_enum(ot->srna, "type", prop_actkeys_ipo_types, 0, "Type", "");
+       RNA_def_enum(ot->srna, "type", beztriple_interpolation_mode_items, 0, "Type", "");
 }
 
 /* ******************** Set Handle-Type Operator *********************** */
 
-/* defines for set handle-type for selected keyframes tool */
-EnumPropertyItem prop_actkeys_handletype_types[] = {
-       {HD_AUTO, "AUTO", "Auto Handles", ""},
-       {HD_VECT, "VECTOR", "Vector Handles", ""},
-       {HD_FREE, "FREE", "Free Handles", ""},
-       {HD_ALIGN, "ALIGN", "Aligned Handles", ""},
-//     {-1, "TOGGLE", "Toggle between Free and Aligned Handles", ""},
-       {0, NULL, NULL, NULL}
-};
-
 /* this function is responsible for setting handle-type of selected keyframes */
 static void sethandles_action_keys(bAnimContext *ac, short mode) 
 {
@@ -1043,7 +1026,7 @@ void ACT_OT_keyframes_handle_type_set (wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* id-props */
-       RNA_def_enum(ot->srna, "type", prop_actkeys_handletype_types, 0, "Type", "");
+       RNA_def_enum(ot->srna, "type", beztriple_handle_type_items, 0, "Type", "");
 }
 
 /* ************************************************************************** */
index 52301ac1b0f7c9a4ffb4547cfd84d5d63c70a658..4c7d855009af2e948febe56738ce153c99e7d13f 100644 (file)
@@ -60,6 +60,7 @@
 
 #include "RNA_access.h"
 #include "RNA_define.h"
+#include "RNA_enum_types.h"
 
 #include "BKE_action.h"
 #include "BKE_depsgraph.h"
@@ -1070,14 +1071,6 @@ void GRAPHEDIT_OT_keyframes_extrapolation_type (wmOperatorType *ot)
 
 /* ******************** Set Interpolation-Type Operator *********************** */
 
-/* defines for set ipo-type for selected keyframes tool */
-EnumPropertyItem prop_graphkeys_ipo_types[] = {
-       {BEZT_IPO_CONST, "CONSTANT", "Constant Interpolation", ""},
-       {BEZT_IPO_LIN, "LINEAR", "Linear Interpolation", ""},
-       {BEZT_IPO_BEZ, "BEZIER", "Bezier Interpolation", ""},
-       {0, NULL, NULL, NULL}
-};
-
 /* this function is responsible for setting interpolation mode for keyframes */
 static void setipo_graph_keys(bAnimContext *ac, short mode) 
 {
@@ -1141,21 +1134,11 @@ void GRAPHEDIT_OT_keyframes_interpolation_type (wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* id-props */
-       RNA_def_enum(ot->srna, "type", prop_graphkeys_ipo_types, 0, "Type", "");
+       RNA_def_enum(ot->srna, "type", beztriple_interpolation_mode_items, 0, "Type", "");
 }
 
 /* ******************** Set Handle-Type Operator *********************** */
 
-/* defines for set handle-type for selected keyframes tool */
-EnumPropertyItem prop_graphkeys_handletype_types[] = {
-       {HD_AUTO, "AUTO", "Auto Handles", ""},
-       {HD_VECT, "VECTOR", "Vector Handles", ""},
-       {HD_FREE, "FREE", "Free Handles", ""},
-       {HD_ALIGN, "ALIGN", "Aligned Handles", ""},
-//     {-1, "TOGGLE", "Toggle between Free and Aligned Handles", ""},
-       {0, NULL, NULL, NULL}
-};
-
 /* this function is responsible for setting handle-type of selected keyframes */
 static void sethandles_graph_keys(bAnimContext *ac, short mode) 
 {
@@ -1238,7 +1221,7 @@ void GRAPHEDIT_OT_keyframes_handletype (wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* id-props */
-       RNA_def_enum(ot->srna, "type", prop_graphkeys_handletype_types, 0, "Type", "");
+       RNA_def_enum(ot->srna, "type", beztriple_handle_type_items, 0, "Type", "");
 }
 
 /* ************************************************************************** */
@@ -1638,19 +1621,6 @@ void GRAPHEDIT_OT_keyframes_smooth (wmOperatorType *ot)
 
 /* ******************** Add F-Curve Modifier Operator *********************** */
 
-/* F-Modifier types - duplicate of existing codes...  */
-       // XXX how can we have this list from the RNA definitions instead?
-EnumPropertyItem prop_fmodifier_types[] = {
-       {FMODIFIER_TYPE_GENERATOR, "GENERATOR", "Generator", ""},
-       {FMODIFIER_TYPE_ENVELOPE, "ENVELOPE", "Envelope", ""},
-       {FMODIFIER_TYPE_CYCLES, "CYCLES", "Cycles", ""},
-       {FMODIFIER_TYPE_NOISE, "NOISE", "Noise", ""},
-       {FMODIFIER_TYPE_FILTER, "FILTER", "Filter", ""},
-       {FMODIFIER_TYPE_PYTHON, "PYTHON", "Python", ""},
-       {FMODIFIER_TYPE_LIMITS, "LIMITS", "Limits", ""},
-       {0, NULL, NULL, NULL}
-};
-
 static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
 {
        bAnimContext ac;
@@ -1709,7 +1679,7 @@ void GRAPHEDIT_OT_fmodifier_add (wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
        /* id-props */
-       RNA_def_enum(ot->srna, "type", prop_fmodifier_types, 0, "Type", "");
+       RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, "Type", "");
 }
 
 /* ************************************************************************** */
index 065c1eba606e185f9ffa2c7b4f64d436a626e4de..2262c73a9afba96971ef9f6e1abad6f8bc4b25c7 100644 (file)
@@ -34,6 +34,11 @@ extern EnumPropertyItem space_type_items[];
 extern EnumPropertyItem region_type_items[];
 extern EnumPropertyItem modifier_type_items[];
 
+extern EnumPropertyItem beztriple_handle_type_items[];
+extern EnumPropertyItem beztriple_interpolation_mode_items[];
+
+extern EnumPropertyItem fmodifier_type_items[];
+
 #endif /* RNA_ENUM_TYPES */
 
 
index dd1c620fe4504b33097f2eba3768147fabe6fc80..719c6cb3c893be94b3f8979115bcb2ab47974a04 100644 (file)
 #include "DNA_curve_types.h"
 #include "DNA_material_types.h"
 
+EnumPropertyItem beztriple_handle_type_items[] = {
+               {HD_FREE, "FREE", "Free", ""},
+               {HD_AUTO, "AUTO", "Auto", ""},
+               {HD_VECT, "VECTOR", "Vector", ""},
+               {HD_ALIGN, "ALIGNED", "Aligned", ""},
+               {HD_AUTO_ANIM, "AUTO_CLAMPED", "Auto Clamped", ""},
+               {0, NULL, NULL, NULL}};
+EnumPropertyItem beztriple_interpolation_mode_items[] = {
+               {BEZT_IPO_CONST, "CONSTANT", "Constant", ""},
+               {BEZT_IPO_LIN, "LINEAR", "Linear", ""},
+               {BEZT_IPO_BEZ, "BEZIER", "Bezier", ""},
+               {0, NULL, NULL, NULL}};
+
 #ifdef RNA_RUNTIME
 
 static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values)
@@ -160,18 +173,6 @@ static void rna_def_beztriple(BlenderRNA *brna)
 {
        StructRNA *srna;
        PropertyRNA *prop;
-       static EnumPropertyItem prop_handle_type_items[] = {
-               {HD_FREE, "FREE", "Free", ""},
-               {HD_AUTO, "AUTO", "Auto", ""},
-               {HD_VECT, "VECTOR", "Vector", ""},
-               {HD_ALIGN, "ALIGNED", "Aligned", ""},
-               {HD_AUTO_ANIM, "AUTO_CLAMPED", "Auto Clamped", ""},
-               {0, NULL, NULL, NULL}};
-       static EnumPropertyItem prop_mode_interpolation_items[] = {
-               {BEZT_IPO_CONST, "CONSTANT", "Constant", ""},
-               {BEZT_IPO_LIN, "LINEAR", "Linear", ""},
-               {BEZT_IPO_BEZ, "BEZIER", "Bezier", ""},
-               {0, NULL, NULL, NULL}};
 
        srna= RNA_def_struct(brna, "BezierCurvePoint", NULL);
        RNA_def_struct_sdna(srna, "BezTriple");
@@ -197,18 +198,18 @@ static void rna_def_beztriple(BlenderRNA *brna)
        /* Enums */
        prop= RNA_def_property(srna, "handle1_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "h1");
-       RNA_def_property_enum_items(prop, prop_handle_type_items);
+       RNA_def_property_enum_items(prop, beztriple_handle_type_items);
        RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle types");
 
        prop= RNA_def_property(srna, "handle2_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "h2");
-       RNA_def_property_enum_items(prop, prop_handle_type_items);
+       RNA_def_property_enum_items(prop, beztriple_handle_type_items);
        RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle types");
 
        prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "ipo");
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-       RNA_def_property_enum_items(prop, prop_mode_interpolation_items);
+       RNA_def_property_enum_items(prop, beztriple_interpolation_mode_items);
        RNA_def_property_ui_text(prop, "Interpolation", "(For F-Curves Only) Interpolation to use for segment of curve starting from current BezTriple.");
 
        /* Vector values */
index 6c58c52153505c8830323e3cc8eb64163fd407d0..d57e302263e4d4e74cbb02b464aa2b4bee24c53a 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
+EnumPropertyItem fmodifier_type_items[] = {
+       {FMODIFIER_TYPE_NULL, "NULL", "Invalid", ""},
+       {FMODIFIER_TYPE_GENERATOR, "GENERATOR", "Generator", ""},
+       {FMODIFIER_TYPE_ENVELOPE, "ENVELOPE", "Envelope", ""},
+       {FMODIFIER_TYPE_CYCLES, "CYCLES", "Cycles", ""},
+       {FMODIFIER_TYPE_NOISE, "NOISE", "Noise", ""},
+       {FMODIFIER_TYPE_FILTER, "FILTER", "Filter", ""},
+       {FMODIFIER_TYPE_PYTHON, "PYTHON", "Python", ""},
+       {FMODIFIER_TYPE_LIMITS, "LIMITS", "Limits", ""},
+       {0, NULL, NULL, NULL}};
+
 #ifdef RNA_RUNTIME
 
 float FModGenFunc_amplitude_get(PointerRNA *ptr)
@@ -457,18 +468,6 @@ void rna_def_fmodifier(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
        
-       static EnumPropertyItem prop_type_items[] = {
-               {FMODIFIER_TYPE_NULL, "NULL", "Invalid", ""},
-               {FMODIFIER_TYPE_GENERATOR, "GENERATOR", "Generator", ""},
-               {FMODIFIER_TYPE_ENVELOPE, "ENVELOPE", "Envelope", ""},
-               {FMODIFIER_TYPE_CYCLES, "CYCLES", "Cycles", ""},
-               {FMODIFIER_TYPE_NOISE, "NOISE", "Noise", ""},
-               {FMODIFIER_TYPE_FILTER, "FILTER", "Filter", ""},
-               {FMODIFIER_TYPE_PYTHON, "PYTHON", "Python", ""},
-               {FMODIFIER_TYPE_LIMITS, "LIMITS", "Limits", ""},
-               {0, NULL, NULL, NULL}};
-               
-               
        /* base struct definition */
        srna= RNA_def_struct(brna, "FModifier", NULL);
        RNA_def_struct_refine_func(srna, "rna_FModifierType_refine");
@@ -484,7 +483,7 @@ void rna_def_fmodifier(BlenderRNA *brna)
        /* type */
        prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-       RNA_def_property_enum_items(prop, prop_type_items);
+       RNA_def_property_enum_items(prop, fmodifier_type_items);
        RNA_def_property_ui_text(prop, "Type", "F-Curve Modifier Type");
        
        /* settings */