Cleanup: 2.8-new G.main in RNA code.

Again, essentially validating them, and adding assert check if needed.
This commit is contained in:
2018-06-22 12:50:26 +02:00
parent 646412004b
commit 88158e4116
4 changed files with 13 additions and 12 deletions

View File

@@ -1485,7 +1485,8 @@ void rna_ViewLayer_name_set(PointerRNA *ptr, const char *value)
{
Scene *scene = (Scene *)ptr->id.data;
ViewLayer *view_layer = (ViewLayer *)ptr->data;
BKE_view_layer_rename(G.main, scene, view_layer, value);
BLI_assert(BKE_id_is_in_gobal_main(&scene->id));
BKE_view_layer_rename(G_MAIN, scene, view_layer, value);
}
static void rna_SceneRenderView_name_set(PointerRNA *ptr, const char *value)
@@ -1541,7 +1542,7 @@ static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value
ts->selectmode = flag;
/* Update select mode in all the workspaces in mesh edit mode. */
wmWindowManager *wm = G.main->wm.first;
wmWindowManager *wm = G_MAIN->wm.first;
for (wmWindow *win = wm->windows.first; win; win = win->next) {
ViewLayer *view_layer = WM_window_get_active_view_layer(win);

View File

@@ -82,7 +82,7 @@ static void rna_Screen_redraw_update(Main *UNUSED(bmain), Scene *UNUSED(scene),
static int rna_Screen_is_animation_playing_get(PointerRNA *UNUSED(ptr))
{
/* can be NULL on file load, T42619 */
wmWindowManager *wm = G.main->wm.first;
wmWindowManager *wm = G_MAIN->wm.first;
return wm ? (ED_screen_animation_playing(wm) != NULL) : 0;
}
@@ -95,7 +95,7 @@ static int rna_region_alignment_get(PointerRNA *ptr)
static void rna_Screen_layout_name_get(PointerRNA *ptr, char *value)
{
const bScreen *screen = ptr->data;
const WorkSpaceLayout *layout = BKE_workspace_layout_find_global(G.main, screen, NULL);
const WorkSpaceLayout *layout = BKE_workspace_layout_find_global(G_MAIN, screen, NULL);
if (layout) {
const char *name = BKE_workspace_layout_name_get(layout);
@@ -109,7 +109,7 @@ static void rna_Screen_layout_name_get(PointerRNA *ptr, char *value)
static int rna_Screen_layout_name_length(PointerRNA *ptr)
{
const bScreen *screen = ptr->data;
const WorkSpaceLayout *layout = BKE_workspace_layout_find_global(G.main, screen, NULL);
const WorkSpaceLayout *layout = BKE_workspace_layout_find_global(G_MAIN, screen, NULL);
if (layout) {
const char *name = BKE_workspace_layout_name_get(layout);

View File

@@ -495,7 +495,7 @@ static void rna_SpaceView3D_lock_camera_and_layers_set(PointerRNA *ptr, int valu
v3d->scenelock = value;
if (value) {
Scene *scene = ED_screen_scene_find(sc, G.main->wm.first);
Scene *scene = ED_screen_scene_find(sc, G_MAIN->wm.first);
int bit;
v3d->lay = scene->lay;
@@ -517,7 +517,7 @@ static View3DCursor *rna_View3D_Cursor_get_from_scene_or_localview(PointerRNA *p
{
View3D *v3d = (View3D *)(ptr->data);
bScreen *screen = ptr->id.data;
Scene *scene = ED_screen_scene_find(screen, G.main->wm.first);
Scene *scene = ED_screen_scene_find(screen, G_MAIN->wm.first);
return ED_view3d_cursor3d_get(scene, v3d);
}
@@ -549,7 +549,7 @@ static float rna_View3DOverlay_GridScaleUnit_get(PointerRNA *ptr)
{
View3D *v3d = (View3D *)(ptr->data);
bScreen *screen = ptr->id.data;
Scene *scene = ED_screen_scene_find(screen, G.main->wm.first);
Scene *scene = ED_screen_scene_find(screen, G_MAIN->wm.first);
return ED_view3d_grid_scale(scene, v3d, NULL);
}
@@ -680,7 +680,7 @@ static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *value
static int rna_3DViewShading_type_get(PointerRNA *ptr)
{
bScreen *screen = ptr->id.data;
Scene *scene = WM_windows_scene_get_from_screen(G.main->wm.first, screen);
Scene *scene = WM_windows_scene_get_from_screen(G_MAIN->wm.first, screen);
RenderEngineType *type = RE_engines_find(scene->r.engine);
View3D *v3d = (View3D *)ptr->data;
@@ -967,7 +967,7 @@ static int rna_SpaceImageEditor_show_uvedit_get(PointerRNA *ptr)
{
SpaceImage *sima = (SpaceImage *)(ptr->data);
bScreen *sc = (bScreen *)ptr->id.data;
wmWindow *win = ED_screen_window_find(sc, G.main->wm.first);
wmWindow *win = ED_screen_window_find(sc, G_MAIN->wm.first);
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
return ED_space_image_show_uvedit(sima, obedit);
@@ -977,7 +977,7 @@ static int rna_SpaceImageEditor_show_maskedit_get(PointerRNA *ptr)
{
SpaceImage *sima = (SpaceImage *)(ptr->data);
bScreen *sc = (bScreen *)ptr->id.data;
wmWindow *win = ED_screen_window_find(sc, G.main->wm.first);
wmWindow *win = ED_screen_window_find(sc, G_MAIN->wm.first);
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
return ED_space_image_check_show_maskedit(sima, view_layer);
}

View File

@@ -261,7 +261,7 @@ static wmManipulator *rna_ManipulatorProperties_find_operator(PointerRNA *ptr)
#endif
/* We could try workaruond this lookup, but not trivial. */
for (bScreen *screen = G.main->screen.first; screen; screen = screen->id.next) {
for (bScreen *screen = G_MAIN->screen.first; screen; screen = screen->id.next) {
IDProperty *properties = ptr->data;
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {