Rename any instance of scene layer or render layer in code with view layer
[blender.git] / source / blender / makesrna / intern / rna_space.c
index bf583654fc67f928ff09c852d0598924e53b0c1b..3a496d13429a448ee85293d711b924b4e948decd 100644 (file)
@@ -61,7 +61,7 @@
 #include "RNA_enum_types.h"
 
 
 #include "RNA_enum_types.h"
 
 
-EnumPropertyItem rna_enum_space_type_items[] = {
+const EnumPropertyItem rna_enum_space_type_items[] = {
        /* empty must be here for python, is skipped for UI */
        {SPACE_EMPTY, "EMPTY", ICON_NONE, "Empty", ""},
        {SPACE_VIEW3D, "VIEW_3D", ICON_VIEW3D, "3D View", "3D viewport"},
        /* empty must be here for python, is skipped for UI */
        {SPACE_EMPTY, "EMPTY", ICON_NONE, "Empty", ""},
        {SPACE_VIEW3D, "VIEW_3D", ICON_VIEW3D, "3D View", "3D viewport"},
@@ -96,7 +96,7 @@ EnumPropertyItem rna_enum_space_type_items[] = {
 #define V3D_S3D_CAMERA_VIEWS       {STEREO_MONO_ID, "MONO", ICON_RESTRICT_RENDER_OFF, "Views", ""},
 #endif
 
 #define V3D_S3D_CAMERA_VIEWS       {STEREO_MONO_ID, "MONO", ICON_RESTRICT_RENDER_OFF, "Views", ""},
 #endif
 
-static EnumPropertyItem stereo3d_camera_items[] = {
+static const EnumPropertyItem stereo3d_camera_items[] = {
        V3D_S3D_CAMERA_LEFT
        V3D_S3D_CAMERA_RIGHT
        V3D_S3D_CAMERA_S3D
        V3D_S3D_CAMERA_LEFT
        V3D_S3D_CAMERA_RIGHT
        V3D_S3D_CAMERA_S3D
@@ -104,7 +104,7 @@ static EnumPropertyItem stereo3d_camera_items[] = {
 };
 
 #ifdef RNA_RUNTIME
 };
 
 #ifdef RNA_RUNTIME
-static EnumPropertyItem multiview_camera_items[] = {
+static const EnumPropertyItem multiview_camera_items[] = {
        V3D_S3D_CAMERA_VIEWS
        V3D_S3D_CAMERA_S3D
        {0, NULL, 0, NULL, NULL}
        V3D_S3D_CAMERA_VIEWS
        V3D_S3D_CAMERA_S3D
        {0, NULL, 0, NULL, NULL}
@@ -117,14 +117,14 @@ static EnumPropertyItem multiview_camera_items[] = {
 #undef V3D_S3D_CAMERA_VIEWS
 
 #ifndef RNA_RUNTIME
 #undef V3D_S3D_CAMERA_VIEWS
 
 #ifndef RNA_RUNTIME
-static EnumPropertyItem stereo3d_eye_items[] = {
+static const EnumPropertyItem stereo3d_eye_items[] = {
     {STEREO_LEFT_ID, "LEFT_EYE", ICON_NONE, "Left Eye"},
     {STEREO_RIGHT_ID, "RIGHT_EYE", ICON_NONE, "Right Eye"},
     {0, NULL, 0, NULL, NULL}
 };
 #endif
 
     {STEREO_LEFT_ID, "LEFT_EYE", ICON_NONE, "Left Eye"},
     {STEREO_RIGHT_ID, "RIGHT_EYE", ICON_NONE, "Right Eye"},
     {0, NULL, 0, NULL, NULL}
 };
 #endif
 
-static EnumPropertyItem pivot_items_full[] = {
+static const EnumPropertyItem pivot_items_full[] = {
        {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
                     "Pivot around bounding box center of selected object(s)"},
        {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"},
        {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
                     "Pivot around bounding box center of selected object(s)"},
        {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"},
@@ -136,7 +136,7 @@ static EnumPropertyItem pivot_items_full[] = {
        {0, NULL, 0, NULL, NULL}
 };
 
        {0, NULL, 0, NULL, NULL}
 };
 
-static EnumPropertyItem draw_channels_items[] = {
+static const EnumPropertyItem draw_channels_items[] = {
        {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
                       "Draw image with RGB colors and alpha transparency"},
        {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
        {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
                       "Draw image with RGB colors and alpha transparency"},
        {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
@@ -149,7 +149,7 @@ static EnumPropertyItem draw_channels_items[] = {
        {0, NULL, 0, NULL, NULL}
 };
 
        {0, NULL, 0, NULL, NULL}
 };
 
-static EnumPropertyItem transform_orientation_items[] = {
+static const EnumPropertyItem transform_orientation_items[] = {
        {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", "Align the transformation axes to world space"},
        {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", "Align the transformation axes to the selected objects' local space"},
        {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal",
        {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", "Align the transformation axes to world space"},
        {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", "Align the transformation axes to the selected objects' local space"},
        {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal",
@@ -162,7 +162,7 @@ static EnumPropertyItem transform_orientation_items[] = {
 };
 
 #ifndef RNA_RUNTIME
 };
 
 #ifndef RNA_RUNTIME
-static EnumPropertyItem autosnap_items[] = {
+static const EnumPropertyItem autosnap_items[] = {
        {SACTSNAP_OFF, "NONE", 0, "No Auto-Snap", ""},
        /* {-1, "", 0, "", ""}, */
        {SACTSNAP_STEP, "STEP", 0, "Frame Step", "Snap to 1.0 frame intervals"},
        {SACTSNAP_OFF, "NONE", 0, "No Auto-Snap", ""},
        /* {-1, "", 0, "", ""}, */
        {SACTSNAP_STEP, "STEP", 0, "Frame Step", "Snap to 1.0 frame intervals"},
@@ -176,7 +176,7 @@ static EnumPropertyItem autosnap_items[] = {
 };
 #endif
 
 };
 #endif
 
-EnumPropertyItem rna_enum_viewport_shade_items[] = {
+const EnumPropertyItem rna_enum_viewport_shade_items[] = {
        {OB_BOUNDBOX, "BOUNDBOX", ICON_BBOX, "Bounding Box", "Display the object's local bounding boxes only"},
        {OB_WIRE, "WIREFRAME", ICON_WIRE, "Wireframe", "Display the object as wire edges"},
        {OB_SOLID, "SOLID", ICON_SOLID, "Solid", "Display the object solid, lit with default OpenGL lights"},
        {OB_BOUNDBOX, "BOUNDBOX", ICON_BBOX, "Bounding Box", "Display the object's local bounding boxes only"},
        {OB_WIRE, "WIREFRAME", ICON_WIRE, "Wireframe", "Display the object as wire edges"},
        {OB_SOLID, "SOLID", ICON_SOLID, "Solid", "Display the object solid, lit with default OpenGL lights"},
@@ -187,17 +187,17 @@ EnumPropertyItem rna_enum_viewport_shade_items[] = {
 };
 
 
 };
 
 
-EnumPropertyItem rna_enum_clip_editor_mode_items[] = {
+const EnumPropertyItem rna_enum_clip_editor_mode_items[] = {
        {SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
        {SC_MODE_MASKEDIT, "MASK", ICON_MOD_MASK, "Mask", "Show mask editing tools"},
        {0, NULL, 0, NULL, NULL}
 };
 
 /* Actually populated dynamically trough a function, but helps for context-less access (e.g. doc, i18n...). */
        {SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
        {SC_MODE_MASKEDIT, "MASK", ICON_MOD_MASK, "Mask", "Show mask editing tools"},
        {0, NULL, 0, NULL, NULL}
 };
 
 /* Actually populated dynamically trough a function, but helps for context-less access (e.g. doc, i18n...). */
-static EnumPropertyItem buttons_context_items[] = {
+static const EnumPropertyItem buttons_context_items[] = {
        {BCONTEXT_SCENE, "SCENE", ICON_SCENE_DATA, "Scene", "Scene"},
        {BCONTEXT_RENDER, "RENDER", ICON_SCENE, "Render", "Render"},
        {BCONTEXT_SCENE, "SCENE", ICON_SCENE_DATA, "Scene", "Scene"},
        {BCONTEXT_RENDER, "RENDER", ICON_SCENE, "Render", "Render"},
-       {BCONTEXT_RENDER_LAYER, "RENDER_LAYER", ICON_RENDERLAYERS, "Render Layers", "Render layers"},
+       {BCONTEXT_VIEW_LAYER, "VIEW_LAYER", ICON_RENDERLAYERS, "View Layers", "View layers"},
        {BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"},
        {BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"},
        {BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraints", "Object constraints"},
        {BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"},
        {BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"},
        {BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraints", "Object constraints"},
@@ -210,11 +210,12 @@ static EnumPropertyItem buttons_context_items[] = {
        {BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particle"},
        {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"},
        {BCONTEXT_COLLECTION, "COLLECTION", ICON_COLLAPSEMENU, "Collection", "Collection"},
        {BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particle"},
        {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"},
        {BCONTEXT_COLLECTION, "COLLECTION", ICON_COLLAPSEMENU, "Collection", "Collection"},
+       {BCONTEXT_WORKSPACE, "WORKSPACE", ICON_RENDER_RESULT, "Workspace", "Workspace"},
        {0, NULL, 0, NULL, NULL}
 };
 
 /* Actually populated dynamically trough a function, but helps for context-less access (e.g. doc, i18n...). */
        {0, NULL, 0, NULL, NULL}
 };
 
 /* Actually populated dynamically trough a function, but helps for context-less access (e.g. doc, i18n...). */
-static EnumPropertyItem buttons_texture_context_items[] = {
+static const EnumPropertyItem buttons_texture_context_items[] = {
        {SB_TEXC_MATERIAL, "MATERIAL", ICON_MATERIAL, "", "Show material textures"},
        {SB_TEXC_WORLD, "WORLD", ICON_WORLD, "", "Show world textures"},
        {SB_TEXC_LAMP, "LAMP", ICON_LAMP, "", "Show lamp textures"},
        {SB_TEXC_MATERIAL, "MATERIAL", ICON_MATERIAL, "", "Show material textures"},
        {SB_TEXC_WORLD, "WORLD", ICON_WORLD, "", "Show world textures"},
        {SB_TEXC_LAMP, "LAMP", ICON_LAMP, "", "Show lamp textures"},
@@ -225,7 +226,7 @@ static EnumPropertyItem buttons_texture_context_items[] = {
 };
 
 
 };
 
 
-static EnumPropertyItem fileselectparams_recursion_level_items[] = {
+static const EnumPropertyItem fileselectparams_recursion_level_items[] = {
        {0, "NONE",  0, "None", "Only list current directory's content, with no recursion"},
        {1, "BLEND", 0, "Blend File", "List .blend files' content"},
        {2, "ALL_1", 0, "One Level", "List all sub-directories' content, one level of recursion"},
        {0, "NONE",  0, "None", "Only list current directory's content, with no recursion"},
        {1, "BLEND", 0, "Blend File", "List .blend files' content"},
        {2, "ALL_1", 0, "One Level", "List all sub-directories' content, one level of recursion"},
@@ -234,7 +235,7 @@ static EnumPropertyItem fileselectparams_recursion_level_items[] = {
        {0, NULL, 0, NULL, NULL}
 };
 
        {0, NULL, 0, NULL, NULL}
 };
 
-EnumPropertyItem rna_enum_file_sort_items[] = {
+const EnumPropertyItem rna_enum_file_sort_items[] = {
        {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically", "Sort the file list alphabetically"},
        {FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension", "Sort the file list by extension/type"},
        {FILE_SORT_TIME, "FILE_SORT_TIME", ICON_SORTTIME, "Sort by time", "Sort files by modification time"},
        {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically", "Sort the file list alphabetically"},
        {FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension", "Sort the file list by extension/type"},
        {FILE_SORT_TIME, "FILE_SORT_TIME", ICON_SORTTIME, "Sort by time", "Sort files by modification time"},
@@ -443,7 +444,8 @@ static PointerRNA rna_View3D_current_orientation_get(PointerRNA *ptr)
        return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, orientation);
 }
 
        return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, orientation);
 }
 
-EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+const EnumPropertyItem *rna_TransformOrientation_itemf(
+        bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
 {
        WorkSpace *workspace;
        ListBase *transform_orientations;
 {
        WorkSpace *workspace;
        ListBase *transform_orientations;
@@ -551,7 +553,7 @@ static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values)
 {
        View3D *v3d = (View3D *)(ptr->data);
 
 {
        View3D *v3d = (View3D *)(ptr->data);
 
-       v3d->lay = ED_view3d_scene_layer_set(v3d->lay, values, &v3d->layact);
+       v3d->lay = ED_view3d_view_layer_set(v3d->lay, values, &v3d->layact);
 }
 
 static int rna_SpaceView3D_active_layer_get(PointerRNA *ptr)
 }
 
 static int rna_SpaceView3D_active_layer_get(PointerRNA *ptr)
@@ -726,8 +728,14 @@ static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *value
 
 static int rna_SpaceView3D_viewport_shade_get(PointerRNA *ptr)
 {
 
 static int rna_SpaceView3D_viewport_shade_get(PointerRNA *ptr)
 {
-       Scene *scene = WM_windows_scene_get_from_screen(G.main->wm.first, ptr->id.data);
-       RenderEngineType *type = RE_engines_find(scene->r.engine);
+       bScreen *screen = ptr->id.data;
+
+       Scene *scene = WM_windows_scene_get_from_screen(G.main->wm.first, screen);
+       WorkSpace *workspace = WM_windows_workspace_get_from_screen(G.main->wm.first, screen);
+
+       ViewRender *view_render = BKE_viewrender_get(scene, workspace);
+       RenderEngineType *type = RE_engines_find(view_render->engine_id);
+
        View3D *v3d = (View3D *)ptr->data;
        int drawtype = v3d->drawtype;
 
        View3D *v3d = (View3D *)ptr->data;
        int drawtype = v3d->drawtype;
 
@@ -746,12 +754,14 @@ static void rna_SpaceView3D_viewport_shade_set(PointerRNA *ptr, int value)
        v3d->drawtype = value;
 }
 
        v3d->drawtype = value;
 }
 
-static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *C, PointerRNA *UNUSED(ptr),
+static const EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *C, PointerRNA *UNUSED(ptr),
                                                               PropertyRNA *UNUSED(prop), bool *r_free)
 {
        wmWindow *win = CTX_wm_window(C);
        Scene *scene = WM_window_get_active_scene(win);
                                                               PropertyRNA *UNUSED(prop), bool *r_free)
 {
        wmWindow *win = CTX_wm_window(C);
        Scene *scene = WM_window_get_active_scene(win);
-       RenderEngineType *type = RE_engines_find(scene->r.engine);
+       WorkSpace *workspace = WM_window_get_active_workspace(win);
+       ViewRender *view_render = BKE_viewrender_get(scene, workspace);
+       RenderEngineType *type = RE_engines_find(view_render->engine_id);
 
        EnumPropertyItem *item = NULL;
        int totitem = 0;
 
        EnumPropertyItem *item = NULL;
        int totitem = 0;
@@ -771,7 +781,7 @@ static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *C, Point
        return item;
 }
 
        return item;
 }
 
-static EnumPropertyItem *rna_SpaceView3D_stereo3d_camera_itemf(bContext *C, PointerRNA *UNUSED(ptr),
+static const EnumPropertyItem *rna_SpaceView3D_stereo3d_camera_itemf(bContext *C, PointerRNA *UNUSED(ptr),
                                                                PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
 {
        Scene *scene = CTX_data_scene(C);
                                                                PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
 {
        Scene *scene = CTX_data_scene(C);
@@ -852,9 +862,9 @@ static int rna_SpaceImageEditor_show_maskedit_get(PointerRNA *ptr)
        SpaceImage *sima = (SpaceImage *)(ptr->data);
        bScreen *sc = (bScreen *)ptr->id.data;
        Scene *scene = ED_screen_scene_find(sc, G.main->wm.first);
        SpaceImage *sima = (SpaceImage *)(ptr->data);
        bScreen *sc = (bScreen *)ptr->id.data;
        Scene *scene = ED_screen_scene_find(sc, G.main->wm.first);
-       SceneLayer *sl = BKE_scene_layer_context_active_PLACEHOLDER(scene);
+       ViewLayer *view_layer = BKE_view_layer_context_active_PLACEHOLDER(scene);
 
 
-       return ED_space_image_check_show_maskedit(sl, sima);
+       return ED_space_image_check_show_maskedit(view_layer, sima);
 }
 
 static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value)
 }
 
 static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value)
@@ -873,7 +883,7 @@ static void rna_SpaceImageEditor_mask_set(PointerRNA *ptr, PointerRNA value)
        ED_space_image_set_mask(NULL, sima, (Mask *)value.data);
 }
 
        ED_space_image_set_mask(NULL, sima, (Mask *)value.data);
 }
 
-static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+static const EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUSED(C), PointerRNA *ptr,
                                                                   PropertyRNA *UNUSED(prop), bool *r_free)
 {
        SpaceImage *sima = (SpaceImage *)ptr->data;
                                                                   PropertyRNA *UNUSED(prop), bool *r_free)
 {
        SpaceImage *sima = (SpaceImage *)ptr->data;
@@ -995,10 +1005,10 @@ static void rna_SpaceImageEditor_scopes_update(struct bContext *C, struct Pointe
        ED_space_image_release_buffer(sima, ibuf, lock);
 }
 
        ED_space_image_release_buffer(sima, ibuf, lock);
 }
 
-static EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+static const EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf(bContext *UNUSED(C), PointerRNA *ptr,
                                                           PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
 {
                                                           PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
 {
-       static EnumPropertyItem pivot_items[] = {
+       static const EnumPropertyItem pivot_items[] = {
                {V3D_AROUND_CENTER_BOUNDS, "CENTER", ICON_ROTATE, "Bounding Box Center", ""},
                {V3D_AROUND_CENTER_MEAN, "MEDIAN", ICON_ROTATECENTER, "Median Point", ""},
                {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
                {V3D_AROUND_CENTER_BOUNDS, "CENTER", ICON_ROTATE, "Bounding Box Center", ""},
                {V3D_AROUND_CENTER_MEAN, "MEDIAN", ICON_ROTATECENTER, "Median Point", ""},
                {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
@@ -1098,7 +1108,7 @@ static void rna_SpaceProperties_context_set(PointerRNA *ptr, int value)
        sbuts->mainbuser = value;
 }
 
        sbuts->mainbuser = value;
 }
 
-static EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+static const EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSED(C), PointerRNA *ptr,
                                                            PropertyRNA *UNUSED(prop), bool *r_free)
 {
        SpaceButs *sbuts = (SpaceButs *)(ptr->data);
                                                            PropertyRNA *UNUSED(prop), bool *r_free)
 {
        SpaceButs *sbuts = (SpaceButs *)(ptr->data);
@@ -1109,22 +1119,26 @@ static EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSED(C),
                RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_RENDER);
        }
 
                RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_RENDER);
        }
 
-       if (sbuts->pathflag & (1 << BCONTEXT_RENDER_LAYER)) {
-               RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_RENDER_LAYER);
+       if (sbuts->pathflag & (1 << BCONTEXT_VIEW_LAYER)) {
+               RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_VIEW_LAYER);
        }
 
        if (sbuts->pathflag & (1 << BCONTEXT_SCENE)) {
                RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_SCENE);
        }
 
        }
 
        if (sbuts->pathflag & (1 << BCONTEXT_SCENE)) {
                RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_SCENE);
        }
 
-       if (sbuts->pathflag & (1 << BCONTEXT_COLLECTION)) {
-               RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_COLLECTION);
-       }
-
        if (sbuts->pathflag & (1 << BCONTEXT_WORLD)) {
                RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_WORLD);
        }
 
        if (sbuts->pathflag & (1 << BCONTEXT_WORLD)) {
                RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_WORLD);
        }
 
+       if (sbuts->pathflag & (1 << BCONTEXT_WORKSPACE)) {
+               RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_WORKSPACE);
+       }
+
+       if (sbuts->pathflag & (1 << BCONTEXT_COLLECTION)) {
+               RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_COLLECTION);
+       }
+
        if (sbuts->pathflag & (1 << BCONTEXT_OBJECT)) {
                RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_OBJECT);
        }
        if (sbuts->pathflag & (1 << BCONTEXT_OBJECT)) {
                RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_OBJECT);
        }
@@ -1189,7 +1203,7 @@ static void rna_SpaceProperties_align_set(PointerRNA *ptr, int value)
        sbuts->re_align = 1;
 }
 
        sbuts->re_align = 1;
 }
 
-static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *UNUSED(ptr),
+static const EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *UNUSED(ptr),
                                                                    PropertyRNA *UNUSED(prop), bool *r_free)
 {
        EnumPropertyItem *item = NULL;
                                                                    PropertyRNA *UNUSED(prop), bool *r_free)
 {
        EnumPropertyItem *item = NULL;
@@ -1309,9 +1323,9 @@ static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, PointerRNA valu
 static void rna_SpaceDopeSheetEditor_action_update(bContext *C, PointerRNA *ptr)
 {
        SpaceAction *saction = (SpaceAction *)(ptr->data);
 static void rna_SpaceDopeSheetEditor_action_update(bContext *C, PointerRNA *ptr)
 {
        SpaceAction *saction = (SpaceAction *)(ptr->data);
-       SceneLayer *sl = CTX_data_scene_layer(C);
+       ViewLayer *view_layer = CTX_data_view_layer(C);
        Main *bmain = CTX_data_main(C);
        Main *bmain = CTX_data_main(C);
-       Object *obact = OBACT_NEW(sl);
+       Object *obact = OBACT(view_layer);
 
        /* we must set this action to be the one used by active object (if not pinned) */
        if (obact /* && saction->pin == 0*/) {
 
        /* we must set this action to be the one used by active object (if not pinned) */
        if (obact /* && saction->pin == 0*/) {
@@ -1386,8 +1400,8 @@ static void rna_SpaceDopeSheetEditor_action_update(bContext *C, PointerRNA *ptr)
 static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr)
 {
        SpaceAction *saction = (SpaceAction *)(ptr->data);
 static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr)
 {
        SpaceAction *saction = (SpaceAction *)(ptr->data);
-       SceneLayer *sl = CTX_data_scene_layer(C);
-       Object *obact = OBACT_NEW(sl);
+       ViewLayer *view_layer = CTX_data_view_layer(C);
+       Object *obact = OBACT(view_layer);
 
        /* special exceptions for ShapeKey Editor mode */
        if (saction->mode == SACTCONT_SHAPEKEY) {
 
        /* special exceptions for ShapeKey Editor mode */
        if (saction->mode == SACTCONT_SHAPEKEY) {
@@ -1449,59 +1463,6 @@ static void rna_Sequencer_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(sc
        ED_area_tag_refresh(sa);
 }
 
        ED_area_tag_refresh(sa);
 }
 
-static float rna_BackgroundImage_opacity_get(PointerRNA *ptr)
-{
-       BGpic *bgpic = (BGpic *)ptr->data;
-       return 1.0f - bgpic->blend;
-}
-
-static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value)
-{
-       BGpic *bgpic = (BGpic *)ptr->data;
-       bgpic->blend = 1.0f - value;
-}
-
-/* radius internally (expose as a distance value) */
-static float rna_BackgroundImage_size_get(PointerRNA *ptr)
-{
-       BGpic *bgpic = ptr->data;
-       return bgpic->size * 2.0f;
-}
-
-static void rna_BackgroundImage_size_set(PointerRNA *ptr, float value)
-{
-       BGpic *bgpic = ptr->data;
-       bgpic->size = value * 0.5f;
-}
-
-static BGpic *rna_BackgroundImage_new(View3D *v3d)
-{
-       BGpic *bgpic = ED_view3D_background_image_new(v3d);
-
-       WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, v3d);
-
-       return bgpic;
-}
-
-static void rna_BackgroundImage_remove(View3D *v3d, ReportList *reports, PointerRNA *bgpic_ptr)
-{
-       BGpic *bgpic = bgpic_ptr->data;
-       if (BLI_findindex(&v3d->bgpicbase, bgpic) == -1) {
-               BKE_report(reports, RPT_ERROR, "Background image cannot be removed");
-       }
-
-       ED_view3D_background_image_remove(v3d, bgpic);
-       RNA_POINTER_INVALIDATE(bgpic_ptr);
-
-       WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, v3d);
-}
-
-static void rna_BackgroundImage_clear(View3D *v3d)
-{
-       ED_view3D_background_image_clear(v3d);
-       WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, v3d);
-}
-
 /* Space Node Editor */
 
 static void rna_SpaceNodeEditor_node_tree_set(PointerRNA *ptr, const PointerRNA value)
 /* Space Node Editor */
 
 static void rna_SpaceNodeEditor_node_tree_set(PointerRNA *ptr, const PointerRNA value)
@@ -1542,7 +1503,7 @@ static int rna_SpaceNodeEditor_tree_type_poll(void *Cv, bNodeTreeType *type)
        else
                return true;
 }
        else
                return true;
 }
-static EnumPropertyItem *rna_SpaceNodeEditor_tree_type_itemf(bContext *C, PointerRNA *UNUSED(ptr),
+static const EnumPropertyItem *rna_SpaceNodeEditor_tree_type_itemf(bContext *C, PointerRNA *UNUSED(ptr),
                                                              PropertyRNA *UNUSED(prop), bool *r_free)
 {
        return rna_node_tree_type_itemf(C, rna_SpaceNodeEditor_tree_type_poll, r_free);
                                                              PropertyRNA *UNUSED(prop), bool *r_free)
 {
        return rna_node_tree_type_itemf(C, rna_SpaceNodeEditor_tree_type_poll, r_free);
@@ -1644,7 +1605,7 @@ static int rna_FileSelectParams_use_lib_get(PointerRNA *ptr)
        return params && (params->type == FILE_LOADLIB);
 }
 
        return params && (params->type == FILE_LOADLIB);
 }
 
-static EnumPropertyItem *rna_FileSelectParams_recursion_level_itemf(
+static const EnumPropertyItem *rna_FileSelectParams_recursion_level_itemf(
         bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
 {
        FileSelectParams *params = ptr->data;
         bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
 {
        FileSelectParams *params = ptr->data;
@@ -1933,7 +1894,7 @@ static void rna_FileBrowser_FSMenuRecent_active_range(PointerRNA *ptr, int *min,
 
 #else
 
 
 #else
 
-static EnumPropertyItem dt_uv_items[] = {
+static const EnumPropertyItem dt_uv_items[] = {
        {SI_UVDT_OUTLINE, "OUTLINE", 0, "Outline", "Draw white edges with black outline"},
        {SI_UVDT_DASH, "DASH", 0, "Dash", "Draw dashed black-white edges"},
        {SI_UVDT_BLACK, "BLACK", 0, "Black", "Draw black edges"},
        {SI_UVDT_OUTLINE, "OUTLINE", 0, "Outline", "Draw white edges with black outline"},
        {SI_UVDT_DASH, "DASH", 0, "Dash", "Draw dashed black-white edges"},
        {SI_UVDT_BLACK, "BLACK", 0, "Black", "Draw black edges"},
@@ -1969,7 +1930,7 @@ static void rna_def_space_mask_info(StructRNA *srna, int noteflag, const char *m
 {
        PropertyRNA *prop;
 
 {
        PropertyRNA *prop;
 
-       static EnumPropertyItem overlay_mode_items[] = {
+       static const EnumPropertyItem overlay_mode_items[] = {
                {MASK_OVERLAY_ALPHACHANNEL, "ALPHACHANNEL", ICON_NONE, "Alpha Channel", "Show alpha channel of the mask"},
                {MASK_OVERLAY_COMBINED,     "COMBINED",     ICON_NONE, "Combined",      "Combine space background image with the mask"},
                {0, NULL, 0, NULL, NULL}
                {MASK_OVERLAY_ALPHACHANNEL, "ALPHACHANNEL", ICON_NONE, "Alpha Channel", "Show alpha channel of the mask"},
                {MASK_OVERLAY_COMBINED,     "COMBINED",     ICON_NONE, "Combined",      "Combine space background image with the mask"},
                {0, NULL, 0, NULL, NULL}
@@ -2011,7 +1972,7 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
        StructRNA *srna;
        PropertyRNA *prop;
 
-       static EnumPropertyItem sticky_mode_items[] = {
+       static const EnumPropertyItem sticky_mode_items[] = {
                {SI_STICKY_DISABLE, "DISABLED", ICON_STICKY_UVS_DISABLE, "Disabled", "Sticky vertex selection disabled"},
                {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "Shared Location",
                                "Select UVs that are at the same location and share a mesh vertex"},
                {SI_STICKY_DISABLE, "DISABLED", ICON_STICKY_UVS_DISABLE, "Disabled", "Sticky vertex selection disabled"},
                {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "Shared Location",
                                "Select UVs that are at the same location and share a mesh vertex"},
@@ -2020,13 +1981,13 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem dt_uvstretch_items[] = {
+       static const EnumPropertyItem dt_uvstretch_items[] = {
                {SI_UVDT_STRETCH_ANGLE, "ANGLE", 0, "Angle", "Angular distortion between UV and 3D angles"},
                {SI_UVDT_STRETCH_AREA, "AREA", 0, "Area", "Area distortion between UV and 3D faces"},
                {0, NULL, 0, NULL, NULL}
        };
 
                {SI_UVDT_STRETCH_ANGLE, "ANGLE", 0, "Angle", "Angular distortion between UV and 3D angles"},
                {SI_UVDT_STRETCH_AREA, "AREA", 0, "Area", "Area distortion between UV and 3D faces"},
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem other_uv_filter_items[] = {
+       static const EnumPropertyItem other_uv_filter_items[] = {
                {SI_FILTER_ALL, "ALL", 0, "All", "No filter, show all islands from other objects"},
                {SI_FILTER_SAME_IMAGE, "SAME_IMAGE", ICON_IMAGE_DATA, "Same Image",
                 "Only show others' UV islands whose active image matches image of the active face"},
                {SI_FILTER_ALL, "ALL", 0, "All", "No filter, show all islands from other objects"},
                {SI_FILTER_SAME_IMAGE, "SAME_IMAGE", ICON_IMAGE_DATA, "Same Image",
                 "Only show others' UV islands whose active image matches image of the active face"},
@@ -2134,7 +2095,7 @@ static void rna_def_space_outliner(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
        StructRNA *srna;
        PropertyRNA *prop;
 
-       static EnumPropertyItem display_mode_items[] = {
+       static const EnumPropertyItem display_mode_items[] = {
                {SO_ALL_SCENES, "ALL_SCENES", 0, "All Scenes", "Display data-blocks in all scenes"},
                {SO_CUR_SCENE, "CURRENT_SCENE", 0, "Current Scene", "Display data-blocks in current scene"},
                {SO_VISIBLE, "VISIBLE_LAYERS", 0, "Visible Layers", "Display data-blocks in visible layers"},
                {SO_ALL_SCENES, "ALL_SCENES", 0, "All Scenes", "Display data-blocks in all scenes"},
                {SO_CUR_SCENE, "CURRENT_SCENE", 0, "Current Scene", "Display data-blocks in current scene"},
                {SO_VISIBLE, "VISIBLE_LAYERS", 0, "Visible Layers", "Display data-blocks in visible layers"},
@@ -2149,7 +2110,7 @@ static void rna_def_space_outliner(BlenderRNA *brna)
                {SO_USERDEF, "USER_PREFERENCES", 0, "User Preferences", "Display user preference data"},
                {SO_ID_ORPHANS, "ORPHAN_DATA", 0, "Orphan Data",
                                "Display data-blocks which are unused and/or will be lost when the file is reloaded"},
                {SO_USERDEF, "USER_PREFERENCES", 0, "User Preferences", "Display user preference data"},
                {SO_ID_ORPHANS, "ORPHAN_DATA", 0, "Orphan Data",
                                "Display data-blocks which are unused and/or will be lost when the file is reloaded"},
-               {SO_ACT_LAYER, "ACT_LAYER", 0, "Active Render Layer", "Display the collections of the active render layer"},
+               {SO_ACT_LAYER, "ACT_LAYER", 0, "Active View Layer", "Display the collections of the active view layer"},
                {SO_COLLECTIONS, "MASTER_COLLECTION", 0, "Master Collection Tree", "Display all collections based on the "
                                 "master collection hierarchy"},
                {0, NULL, 0, NULL, NULL}
                {SO_COLLECTIONS, "MASTER_COLLECTION", 0, "Master Collection Tree", "Display all collections based on the "
                                 "master collection hierarchy"},
                {0, NULL, 0, NULL, NULL}
@@ -2192,200 +2153,12 @@ static void rna_def_space_outliner(BlenderRNA *brna)
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
 }
 
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
 }
 
-static void rna_def_background_image(BlenderRNA *brna)
-{
-       StructRNA *srna;
-       PropertyRNA *prop;
-
-       /* note: combinations work but don't flip so arnt that useful */
-       static EnumPropertyItem bgpic_axis_items[] = {
-               {0, "", 0, N_("X Axis"), ""},
-               {(1 << RV3D_VIEW_LEFT), "LEFT", 0, "Left", "Show background image while looking to the left"},
-               {(1 << RV3D_VIEW_RIGHT), "RIGHT", 0, "Right", "Show background image while looking to the right"},
-               /*{(1<<RV3D_VIEW_LEFT)|(1<<RV3D_VIEW_RIGHT), "LEFT_RIGHT", 0, "Left/Right", ""},*/
-               {0, "", 0, N_("Y Axis"), ""},
-               {(1 << RV3D_VIEW_BACK), "BACK", 0, "Back", "Show background image in back view"},
-               {(1 << RV3D_VIEW_FRONT), "FRONT", 0, "Front", "Show background image in front view"},
-               /*{(1<<RV3D_VIEW_BACK)|(1<<RV3D_VIEW_FRONT), "BACK_FRONT", 0, "Back/Front", ""},*/
-               {0, "", 0, N_("Z Axis"), ""},
-               {(1 << RV3D_VIEW_BOTTOM), "BOTTOM", 0, "Bottom", "Show background image in bottom view"},
-               {(1 << RV3D_VIEW_TOP), "TOP", 0, "Top", "Show background image in top view"},
-               /*{(1<<RV3D_VIEW_BOTTOM)|(1<<RV3D_VIEW_TOP), "BOTTOM_TOP", 0, "Top/Bottom", ""},*/
-               {0, "", 0, N_("Other"), ""},
-               {0, "ALL", 0, "All Views", "Show background image in all views"},
-               {(1 << RV3D_VIEW_CAMERA), "CAMERA", 0, "Camera", "Show background image in camera view"},
-               {0, NULL, 0, NULL, NULL}
-       };
-
-       static EnumPropertyItem bgpic_source_items[] = {
-               {V3D_BGPIC_IMAGE, "IMAGE", 0, "Image", ""},
-               {V3D_BGPIC_MOVIE, "MOVIE_CLIP", 0, "Movie Clip", ""},
-               {0, NULL, 0, NULL, NULL}
-       };
-
-       static const EnumPropertyItem bgpic_camera_frame_items[] = {
-               {0, "STRETCH", 0, "Stretch", ""},
-               {V3D_BGPIC_CAMERA_ASPECT, "FIT", 0, "Fit", ""},
-               {V3D_BGPIC_CAMERA_ASPECT | V3D_BGPIC_CAMERA_CROP, "CROP", 0, "Crop", ""},
-               {0, NULL, 0, NULL, NULL}
-       };
-
-       static const EnumPropertyItem bgpic_draw_depth_items[] = {
-               {0, "BACK", 0, "Back", ""},
-               {V3D_BGPIC_FOREGROUND, "FRONT", 0, "Front", ""},
-               {0, NULL, 0, NULL, NULL}
-       };
-
-       srna = RNA_def_struct(brna, "BackgroundImage", NULL);
-       RNA_def_struct_sdna(srna, "BGpic");
-       RNA_def_struct_ui_text(srna, "Background Image", "Image and settings for display in the 3D View background");
-
-       prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_sdna(prop, NULL, "source");
-       RNA_def_property_enum_items(prop, bgpic_source_items);
-       RNA_def_property_ui_text(prop, "Background Source", "Data source used for background");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
-       RNA_def_property_pointer_sdna(prop, NULL, "ima");
-       RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
-       RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
-       RNA_def_property_pointer_sdna(prop, NULL, "clip");
-       RNA_def_property_ui_text(prop, "MovieClip", "Movie clip displayed and edited in this space");
-       RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
-       RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "iuser");
-       RNA_def_property_ui_text(prop, "Image User",
-                                "Parameters defining which layer, pass and frame of the image is displayed");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
-       RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_struct_type(prop, "MovieClipUser");
-       RNA_def_property_pointer_sdna(prop, NULL, "cuser");
-       RNA_def_property_ui_text(prop, "Clip User", "Parameters defining which frame of the movie clip is displayed");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
-       RNA_def_property_float_sdna(prop, NULL, "xof");
-       RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally from the world origin");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
-       RNA_def_property_float_sdna(prop, NULL, "yof");
-       RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically from the world origin");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_DISTANCE);
-       RNA_def_property_float_sdna(prop, NULL, "size");
-       RNA_def_property_float_funcs(prop, "rna_BackgroundImage_size_get", "rna_BackgroundImage_size_set", NULL);
-       RNA_def_property_ui_text(prop, "Size", "Size of the background image (ortho view only)");
-       RNA_def_property_range(prop, 0.0, FLT_MAX);
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
-       RNA_def_property_float_sdna(prop, NULL, "rotation");
-       RNA_def_property_ui_text(prop, "Rotation", "Rotation for the background image (ortho view only)");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_FLIP_X);
-       RNA_def_property_ui_text(prop, "Flip Horizontally", "Flip the background image horizontally");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "use_flip_y", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_FLIP_Y);
-       RNA_def_property_ui_text(prop, "Flip Vertically", "Flip the background image vertically");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_NONE);
-       RNA_def_property_float_sdna(prop, NULL, "blend");
-       RNA_def_property_float_funcs(prop, "rna_BackgroundImage_opacity_get", "rna_BackgroundImage_opacity_set", NULL);
-       RNA_def_property_ui_text(prop, "Opacity", "Image opacity to blend the image against the background color");
-       RNA_def_property_range(prop, 0.0, 1.0);
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "view_axis", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_sdna(prop, NULL, "view");
-       RNA_def_property_enum_items(prop, bgpic_axis_items);
-       RNA_def_property_ui_text(prop, "Image Axis", "The axis to display the image on");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_EXPANDED);
-       RNA_def_property_ui_text(prop, "Show Expanded", "Show the expanded in the user interface");
-       RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
-
-       prop = RNA_def_property(srna, "use_camera_clip", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_CAMERACLIP);
-       RNA_def_property_ui_text(prop, "Camera Clip", "Use movie clip from active scene camera");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "show_background_image", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", V3D_BGPIC_DISABLED);
-       RNA_def_property_ui_text(prop, "Show Background Image", "Show this image as background");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       prop = RNA_def_property(srna, "show_on_foreground", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_FOREGROUND);
-       RNA_def_property_ui_text(prop, "Show On Foreground", "Show this image in front of objects in viewport");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       /* expose 1 flag as a enum of 2 items */
-       prop = RNA_def_property(srna, "draw_depth", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
-       RNA_def_property_enum_items(prop, bgpic_draw_depth_items);
-       RNA_def_property_ui_text(prop, "Depth", "Draw under or over everything");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-       /* expose 2 flags as a enum of 3 items */
-       prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
-       RNA_def_property_enum_items(prop, bgpic_camera_frame_items);
-       RNA_def_property_ui_text(prop, "Frame Method", "How the image fits in the camera frame");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-}
-
-static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop)
-{
-       StructRNA *srna;
-       FunctionRNA *func;
-       PropertyRNA *parm;
-
-       RNA_def_property_srna(cprop, "BackgroundImages");
-       srna = RNA_def_struct(brna, "BackgroundImages", NULL);
-       RNA_def_struct_sdna(srna, "View3D");
-       RNA_def_struct_ui_text(srna, "Background Images", "Collection of background images");
-
-       func = RNA_def_function(srna, "new", "rna_BackgroundImage_new");
-       RNA_def_function_ui_description(func, "Add new background image");
-       parm = RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background");
-       RNA_def_function_return(func, parm);
-
-       func = RNA_def_function(srna, "remove", "rna_BackgroundImage_remove");
-       RNA_def_function_ui_description(func, "Remove background image");
-       RNA_def_function_flag(func, FUNC_USE_REPORTS);
-       parm = RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background");
-       RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
-       RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
-       func = RNA_def_function(srna, "clear", "rna_BackgroundImage_clear");
-       RNA_def_function_ui_description(func, "Remove all background images");
-}
-
-
 static void rna_def_space_view3d(BlenderRNA *brna)
 {
        StructRNA *srna;
        PropertyRNA *prop;
 
 static void rna_def_space_view3d(BlenderRNA *brna)
 {
        StructRNA *srna;
        PropertyRNA *prop;
 
-       static EnumPropertyItem manipulators_items[] = {
+       static const EnumPropertyItem manipulators_items[] = {
                {V3D_MANIP_TRANSLATE, "TRANSLATE", ICON_MAN_TRANS, "Translate",
                                      "Use the manipulator for movement transformations"},
                {V3D_MANIP_ROTATE, "ROTATE", ICON_MAN_ROT, "Rotate",
                {V3D_MANIP_TRANSLATE, "TRANSLATE", ICON_MAN_TRANS, "Translate",
                                      "Use the manipulator for movement transformations"},
                {V3D_MANIP_ROTATE, "ROTATE", ICON_MAN_ROT, "Rotate",
@@ -2395,14 +2168,14 @@ static void rna_def_space_view3d(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem rv3d_persp_items[] = {
+       static const EnumPropertyItem rv3d_persp_items[] = {
                {RV3D_PERSP, "PERSP", 0, "Perspective", ""},
                {RV3D_ORTHO, "ORTHO", 0, "Orthographic", ""},
                {RV3D_CAMOB, "CAMERA", 0, "Camera", ""},
                {0, NULL, 0, NULL, NULL}
        };
 
                {RV3D_PERSP, "PERSP", 0, "Perspective", ""},
                {RV3D_ORTHO, "ORTHO", 0, "Orthographic", ""},
                {RV3D_CAMOB, "CAMERA", 0, "Camera", ""},
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem bundle_drawtype_items[] = {
+       static const EnumPropertyItem bundle_drawtype_items[] = {
                {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
                {OB_ARROWS, "ARROWS", 0, "Arrows", ""},
                {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
                {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
                {OB_ARROWS, "ARROWS", 0, "Arrows", ""},
                {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
@@ -2413,7 +2186,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem view3d_matcap_items[] = {
+       static const EnumPropertyItem view3d_matcap_items[] = {
                {ICON_MATCAP_01, "01", ICON_MATCAP_01, "", ""},
                {ICON_MATCAP_02, "02", ICON_MATCAP_02, "", ""},
                {ICON_MATCAP_03, "03", ICON_MATCAP_03, "", ""},
                {ICON_MATCAP_01, "01", ICON_MATCAP_01, "", ""},
                {ICON_MATCAP_02, "02", ICON_MATCAP_02, "", ""},
                {ICON_MATCAP_03, "03", ICON_MATCAP_03, "", ""},
@@ -2655,19 +2428,6 @@ static void rna_def_space_view3d(BlenderRNA *brna)
        RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
        RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
-       prop = RNA_def_property(srna, "background_images", PROP_COLLECTION, PROP_NONE);
-       RNA_def_property_collection_sdna(prop, NULL, "bgpicbase", NULL);
-       RNA_def_property_struct_type(prop, "BackgroundImage");
-       RNA_def_property_ui_text(prop, "Background Images", "List of background images");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-       rna_def_backgroundImages(brna, prop);
-
-       prop = RNA_def_property(srna, "show_background_images", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DISPBGPICS);
-       RNA_def_property_ui_text(prop, "Display Background Images",
-                                "Display reference images behind objects in the 3D View");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
        prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "around");
        RNA_def_property_enum_items(prop, pivot_items_full);
        prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "around");
        RNA_def_property_enum_items(prop, pivot_items_full);
@@ -2947,7 +2707,7 @@ static void rna_def_space_buttons(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
        StructRNA *srna;
        PropertyRNA *prop;
 
-       static EnumPropertyItem align_items[] = {
+       static const EnumPropertyItem align_items[] = {
                {BUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
                {BUT_VERTICAL, "VERTICAL", 0, "Vertical", ""},
                {0, NULL, 0, NULL, NULL}
                {BUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
                {BUT_VERTICAL, "VERTICAL", 0, "Vertical", ""},
                {0, NULL, 0, NULL, NULL}
@@ -3000,7 +2760,7 @@ static void rna_def_space_buttons(BlenderRNA *brna)
 
 static void rna_def_space_image(BlenderRNA *brna)
 {
 
 static void rna_def_space_image(BlenderRNA *brna)
 {
-       static EnumPropertyItem image_space_mode_items[] = {
+       static const EnumPropertyItem image_space_mode_items[] = {
                {SI_MODE_VIEW, "VIEW", ICON_FILE_IMAGE, "View", "View the image and UV edit in mesh editmode"},
                {SI_MODE_PAINT, "PAINT", ICON_TPAINT_HLT, "Paint", "2D image painting mode"},
                {SI_MODE_MASK, "MASK", ICON_MOD_MASK, "Mask", "Mask editing"},
                {SI_MODE_VIEW, "VIEW", ICON_FILE_IMAGE, "View", "View the image and UV edit in mesh editmode"},
                {SI_MODE_PAINT, "PAINT", ICON_TPAINT_HLT, "Paint", "2D image painting mode"},
                {SI_MODE_MASK, "MASK", ICON_MOD_MASK, "Mask", "Mask editing"},
@@ -3153,14 +2913,14 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
        StructRNA *srna;
        PropertyRNA *prop;
 
-       static EnumPropertyItem view_type_items[] = {
+       static const EnumPropertyItem view_type_items[] = {
                {SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
                {SEQ_VIEW_PREVIEW,  "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
                {SEQ_VIEW_SEQUENCE_PREVIEW,  "SEQUENCER_PREVIEW", ICON_SEQ_SPLITVIEW, "Sequencer and Image Preview", ""},
                {0, NULL, 0, NULL, NULL}
        };
 
                {SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
                {SEQ_VIEW_PREVIEW,  "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
                {SEQ_VIEW_SEQUENCE_PREVIEW,  "SEQUENCER_PREVIEW", ICON_SEQ_SPLITVIEW, "Sequencer and Image Preview", ""},
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem display_mode_items[] = {
+       static const EnumPropertyItem display_mode_items[] = {
                {SEQ_DRAW_IMG_IMBUF, "IMAGE", ICON_SEQ_PREVIEW, "Image Preview", ""},
                {SEQ_DRAW_IMG_WAVEFORM, "WAVEFORM", ICON_SEQ_LUMA_WAVEFORM, "Luma Waveform", ""},
                {SEQ_DRAW_IMG_VECTORSCOPE, "VECTOR_SCOPE", ICON_SEQ_CHROMA_SCOPE, "Chroma Vectorscope", ""},
                {SEQ_DRAW_IMG_IMBUF, "IMAGE", ICON_SEQ_PREVIEW, "Image Preview", ""},
                {SEQ_DRAW_IMG_WAVEFORM, "WAVEFORM", ICON_SEQ_LUMA_WAVEFORM, "Luma Waveform", ""},
                {SEQ_DRAW_IMG_VECTORSCOPE, "VECTOR_SCOPE", ICON_SEQ_CHROMA_SCOPE, "Chroma Vectorscope", ""},
@@ -3168,7 +2928,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem proxy_render_size_items[] = {
+       static const EnumPropertyItem proxy_render_size_items[] = {
                {SEQ_PROXY_RENDER_SIZE_NONE, "NONE", 0, "No display", ""},
                {SEQ_PROXY_RENDER_SIZE_SCENE, "SCENE", 0, "Scene render size", ""},
                {SEQ_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "Proxy size 25%", ""},
                {SEQ_PROXY_RENDER_SIZE_NONE, "NONE", 0, "No display", ""},
                {SEQ_PROXY_RENDER_SIZE_SCENE, "SCENE", 0, "Scene render size", ""},
                {SEQ_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "Proxy size 25%", ""},
@@ -3179,21 +2939,21 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem overlay_type_items[] = {
+       static const EnumPropertyItem overlay_type_items[] = {
                {SEQ_DRAW_OVERLAY_RECT, "RECTANGLE", 0, "Rectangle", "Show rectangle area overlay"},
                {SEQ_DRAW_OVERLAY_REFERENCE, "REFERENCE", 0, "Reference", "Show reference frame only"},
                {SEQ_DRAW_OVERLAY_CURRENT, "CURRENT", 0, "Current", "Show current frame only"},
                {0, NULL, 0, NULL, NULL}
        };
 
                {SEQ_DRAW_OVERLAY_RECT, "RECTANGLE", 0, "Rectangle", "Show rectangle area overlay"},
                {SEQ_DRAW_OVERLAY_REFERENCE, "REFERENCE", 0, "Reference", "Show reference frame only"},
                {SEQ_DRAW_OVERLAY_CURRENT, "CURRENT", 0, "Current", "Show current frame only"},
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem preview_channels_items[] = {
+       static const EnumPropertyItem preview_channels_items[] = {
                {SEQ_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
                                "Draw image with RGB colors and alpha transparency"},
                {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
                {0, NULL, 0, NULL, NULL}
        };
 
                {SEQ_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
                                "Draw image with RGB colors and alpha transparency"},
                {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem waveform_type_draw_items[] = {
+       static const EnumPropertyItem waveform_type_draw_items[] = {
                {SEQ_NO_WAVEFORMS, "NO_WAVEFORMS", 0, "Waveforms Off",
                 "No waveforms drawn for any sound strips"},
                {SEQ_ALL_WAVEFORMS, "ALL_WAVEFORMS", 0, "Waveforms On",
                {SEQ_NO_WAVEFORMS, "NO_WAVEFORMS", 0, "Waveforms Off",
                 "No waveforms drawn for any sound strips"},
                {SEQ_ALL_WAVEFORMS, "ALL_WAVEFORMS", 0, "Waveforms On",
@@ -3545,7 +3305,7 @@ static void rna_def_space_graph(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
        StructRNA *srna;
        PropertyRNA *prop;
 
-       static EnumPropertyItem mode_items[] = {
+       static const EnumPropertyItem mode_items[] = {
                {SIPO_MODE_ANIMATION, "FCURVES", ICON_IPO, "F-Curve",
                 "Edit animation/keyframes displayed as 2D curves"},
                {SIPO_MODE_DRIVERS, "DRIVERS", ICON_DRIVER, "Drivers", "Edit drivers"},
                {SIPO_MODE_ANIMATION, "FCURVES", ICON_IPO, "F-Curve",
                 "Edit animation/keyframes displayed as 2D curves"},
                {SIPO_MODE_DRIVERS, "DRIVERS", ICON_DRIVER, "Drivers", "Edit drivers"},
@@ -3553,7 +3313,7 @@ static void rna_def_space_graph(BlenderRNA *brna)
        };
 
        /* this is basically the same as the one for the 3D-View, but with some entries omitted */
        };
 
        /* this is basically the same as the one for the 3D-View, but with some entries omitted */
-       static EnumPropertyItem gpivot_items[] = {
+       static const EnumPropertyItem gpivot_items[] = {
                {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""},
                {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
                {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Centers", ""},
                {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""},
                {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
                {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Centers", ""},
@@ -3801,7 +3561,7 @@ static void rna_def_space_time(BlenderRNA *brna)
 
 static void rna_def_console_line(BlenderRNA *brna)
 {
 
 static void rna_def_console_line(BlenderRNA *brna)
 {
-       static EnumPropertyItem console_line_type_items[] = {
+       static const EnumPropertyItem console_line_type_items[] = {
                {CONSOLE_LINE_OUTPUT, "OUTPUT", 0, "Output", ""},
                {CONSOLE_LINE_INPUT, "INPUT", 0, "Input", ""},
                {CONSOLE_LINE_INFO, "INFO", 0, "Info", ""},
                {CONSOLE_LINE_OUTPUT, "OUTPUT", 0, "Output", ""},
                {CONSOLE_LINE_INPUT, "INPUT", 0, "Input", ""},
                {CONSOLE_LINE_INFO, "INFO", 0, "Info", ""},
@@ -3880,14 +3640,14 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
        StructRNA *srna;
        PropertyRNA *prop;
 
-       static EnumPropertyItem file_display_items[] = {
+       static const EnumPropertyItem file_display_items[] = {
                {FILE_SHORTDISPLAY, "LIST_SHORT", ICON_SHORTDISPLAY, "Short List", "Display files as short list"},
                {FILE_LONGDISPLAY,  "LIST_LONG", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"},
                {FILE_IMGDISPLAY, "THUMBNAIL", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"},
                {0, NULL, 0, NULL, NULL}
        };
 
                {FILE_SHORTDISPLAY, "LIST_SHORT", ICON_SHORTDISPLAY, "Short List", "Display files as short list"},
                {FILE_LONGDISPLAY,  "LIST_LONG", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"},
                {FILE_IMGDISPLAY, "THUMBNAIL", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"},
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem display_size_items[] = {
+       static const EnumPropertyItem display_size_items[] = {
            {32,    "TINY",     0,      "Tiny", ""},
            {64,    "SMALL",    0,      "Small", ""},
            {128,   "NORMAL",   0,      "Normal", ""},
            {32,    "TINY",     0,      "Tiny", ""},
            {64,    "SMALL",    0,      "Small", ""},
            {128,   "NORMAL",   0,      "Normal", ""},
@@ -3895,7 +3655,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
            {0, NULL, 0, NULL, NULL}
        };
 
            {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem file_filter_idtypes_items[] = {
+       static const EnumPropertyItem file_filter_idtypes_items[] = {
                {FILTER_ID_AC, "ACTION", ICON_ANIM_DATA, "Actions", "Show/hide Action data-blocks"},
                {FILTER_ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armatures", "Show/hide Armature data-blocks"},
                {FILTER_ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brushes", "Show/hide Brushes data-blocks"},
                {FILTER_ID_AC, "ACTION", ICON_ANIM_DATA, "Actions", "Show/hide Action data-blocks"},
                {FILTER_ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armatures", "Show/hide Armature data-blocks"},
                {FILTER_ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brushes", "Show/hide Brushes data-blocks"},
@@ -3932,7 +3692,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem file_filter_idcategories_items[] = {
+       static const EnumPropertyItem file_filter_idcategories_items[] = {
            {FILTER_ID_SCE,
             "SCENE", ICON_SCENE_DATA, "Scenes", "Show/hide scenes"},
            {FILTER_ID_AC,
            {FILTER_ID_SCE,
             "SCENE", ICON_SCENE_DATA, "Scenes", "Show/hide scenes"},
            {FILTER_ID_AC,
@@ -4256,7 +4016,7 @@ static void rna_def_space_info(BlenderRNA *brna)
 
 static void rna_def_space_userpref(BlenderRNA *brna)
 {
 
 static void rna_def_space_userpref(BlenderRNA *brna)
 {
-       static EnumPropertyItem filter_type_items[] = {
+       static const EnumPropertyItem filter_type_items[] = {
            {0,     "NAME",     0,      "Name",        "Filter based on the operator name"},
            {1,     "KEY",      0,      "Key-Binding", "Filter based on key bindings"},
            {0, NULL, 0, NULL, NULL}};
            {0,     "NAME",     0,      "Name",        "Filter based on the operator name"},
            {1,     "KEY",      0,      "Key-Binding", "Filter based on key bindings"},
            {0, NULL, 0, NULL, NULL}};
@@ -4340,7 +4100,7 @@ static void rna_def_space_node(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
        StructRNA *srna;
        PropertyRNA *prop;
 
-       static EnumPropertyItem texture_id_type_items[] = {
+       static const EnumPropertyItem texture_id_type_items[] = {
                {SNODE_TEX_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit texture nodes from Object"},
                {SNODE_TEX_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit texture nodes from World"},
                {SNODE_TEX_BRUSH, "BRUSH", ICON_BRUSH_DATA, "Brush", "Edit texture nodes from Brush"},
                {SNODE_TEX_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit texture nodes from Object"},
                {SNODE_TEX_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit texture nodes from World"},
                {SNODE_TEX_BRUSH, "BRUSH", ICON_BRUSH_DATA, "Brush", "Edit texture nodes from Brush"},
@@ -4350,7 +4110,7 @@ static void rna_def_space_node(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem shader_type_items[] = {
+       static const EnumPropertyItem shader_type_items[] = {
                {SNODE_SHADER_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit shader nodes from Object"},
                {SNODE_SHADER_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit shader nodes from World"},
 #ifdef WITH_FREESTYLE
                {SNODE_SHADER_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit shader nodes from Object"},
                {SNODE_SHADER_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit shader nodes from World"},
 #ifdef WITH_FREESTYLE
@@ -4359,7 +4119,7 @@ static void rna_def_space_node(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem backdrop_channels_items[] = {
+       static const EnumPropertyItem backdrop_channels_items[] = {
                {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
                                  "Draw image with RGB colors and alpha transparency"},
                {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
                {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
                                  "Draw image with RGB colors and alpha transparency"},
                {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
@@ -4370,13 +4130,13 @@ static void rna_def_space_node(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem insert_ofs_dir_items[] = {
+       static const EnumPropertyItem insert_ofs_dir_items[] = {
            {SNODE_INSERTOFS_DIR_RIGHT, "RIGHT", 0, "Right"},
            {SNODE_INSERTOFS_DIR_LEFT, "LEFT", 0, "Left"},
            {0, NULL, 0, NULL, NULL}
        };
 
            {SNODE_INSERTOFS_DIR_RIGHT, "RIGHT", 0, "Right"},
            {SNODE_INSERTOFS_DIR_LEFT, "LEFT", 0, "Left"},
            {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem dummy_items[] = {
+       static const EnumPropertyItem dummy_items[] = {
                {0, "DUMMY", 0, "", ""},
                {0, NULL, 0, NULL, NULL}};
 
                {0, "DUMMY", 0, "", ""},
                {0, NULL, 0, NULL, NULL}};
 
@@ -4571,20 +4331,20 @@ static void rna_def_space_clip(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
        StructRNA *srna;
        PropertyRNA *prop;
 
-       static EnumPropertyItem view_items[] = {
+       static const EnumPropertyItem view_items[] = {
                {SC_VIEW_CLIP, "CLIP", ICON_SEQUENCE, "Clip", "Show editing clip preview"},
                {SC_VIEW_GRAPH, "GRAPH", ICON_IPO, "Graph", "Show graph view for active element"},
                {SC_VIEW_DOPESHEET, "DOPESHEET", ICON_ACTION, "Dopesheet", "Dopesheet view for tracking data"},
                {0, NULL, 0, NULL, NULL}
        };
 
                {SC_VIEW_CLIP, "CLIP", ICON_SEQUENCE, "Clip", "Show editing clip preview"},
                {SC_VIEW_GRAPH, "GRAPH", ICON_IPO, "Graph", "Show graph view for active element"},
                {SC_VIEW_DOPESHEET, "DOPESHEET", ICON_ACTION, "Dopesheet", "Dopesheet view for tracking data"},
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem gpencil_source_items[] = {
+       static const EnumPropertyItem gpencil_source_items[] = {
                {SC_GPENCIL_SRC_CLIP, "CLIP", 0, "Clip", "Show grease pencil data-block which belongs to movie clip"},
                {SC_GPENCIL_SRC_TRACK, "TRACK", 0, "Track", "Show grease pencil data-block which belongs to active track"},
                {0, NULL, 0, NULL, NULL}
        };
 
                {SC_GPENCIL_SRC_CLIP, "CLIP", 0, "Clip", "Show grease pencil data-block which belongs to movie clip"},
                {SC_GPENCIL_SRC_TRACK, "TRACK", 0, "Track", "Show grease pencil data-block which belongs to active track"},
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem pivot_items[] = {
+       static const EnumPropertyItem pivot_items[] = {
                {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
                             "Pivot around bounding box center of selected object(s)"},
                {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", "Pivot around the 2D cursor"},
                {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
                             "Pivot around bounding box center of selected object(s)"},
                {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", "Pivot around the 2D cursor"},
@@ -4838,7 +4598,6 @@ void RNA_def_space(BlenderRNA *brna)
        rna_def_filemenu_entry(brna);
        rna_def_space_filebrowser(brna);
        rna_def_space_outliner(brna);
        rna_def_filemenu_entry(brna);
        rna_def_space_filebrowser(brna);
        rna_def_space_outliner(brna);
-       rna_def_background_image(brna);
        rna_def_space_view3d(brna);
        rna_def_space_buttons(brna);
        rna_def_space_dopesheet(brna);
        rna_def_space_view3d(brna);
        rna_def_space_buttons(brna);
        rna_def_space_dopesheet(brna);