diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2018-04-21 20:30:56 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2018-04-21 20:47:27 +0300 |
commit | 9a35ad752e845129aa756778e7f502a5057b92bf (patch) | |
tree | 4204481b02f643ecf572cd5c9e6e2df8418471f4 /source/blender/editors/space_clip/space_clip.c | |
parent | 9ba84342fb6835dd3add1f12c698654d3d79a90e (diff) |
Cleanup: Get rid of context in editor 'new' callback
Requiring context means we can't easily create new editors to replace deprecated
ones in versioning code.
Think it's reasonable to give editors access to scene and area data for their
initial setup though. They mostly need it for setting "the view", as in,
scrolling values.
Also did minor cleanup in top-bar creation function.
Diffstat (limited to 'source/blender/editors/space_clip/space_clip.c')
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index ba9684411b3..f043280e43c 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -75,12 +75,8 @@ #include "clip_intern.h" /* own include */ -static void init_preview_region(const bContext *C, ARegion *ar) +static void init_preview_region(const Scene *scene, const ScrArea *sa, const SpaceClip *sc, ARegion *ar) { - Scene *scene = CTX_data_scene(C); - ScrArea *sa = CTX_wm_area(C); - SpaceClip *sc = CTX_wm_space_clip(C); - ar->regiontype = RGN_TYPE_PREVIEW; ar->alignment = RGN_ALIGN_TOP; ar->flag |= RGN_FLAG_HIDDEN; @@ -138,15 +134,17 @@ static void init_preview_region(const bContext *C, ARegion *ar) static void reinit_preview_region(const bContext *C, ARegion *ar) { + Scene *scene = CTX_data_scene(C); + ScrArea *sa = CTX_wm_area(C); SpaceClip *sc = CTX_wm_space_clip(C); if (sc->view == SC_VIEW_DOPESHEET) { if ((ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) == 0) - init_preview_region(C, ar); + init_preview_region(scene, sa, sc, ar); } else { if (ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) - init_preview_region(C, ar); + init_preview_region(scene, sa, sc, ar); } } @@ -168,7 +166,7 @@ static ARegion *ED_clip_has_preview_region(const bContext *C, ScrArea *sa) arnew = MEM_callocN(sizeof(ARegion), "clip preview region"); BLI_insertlinkbefore(&sa->regionbase, ar, arnew); - init_preview_region(C, arnew); + init_preview_region(CTX_data_scene(C), sa, CTX_wm_space_clip(C), arnew); return arnew; } @@ -228,7 +226,7 @@ static void clip_scopes_check_gpencil_change(ScrArea *sa) /* ******************** default callbacks for clip space ***************** */ -static SpaceLink *clip_new(const bContext *C) +static SpaceLink *clip_new(const ScrArea *sa, const Scene *scene) { ARegion *ar; SpaceClip *sc; @@ -286,7 +284,7 @@ static SpaceLink *clip_new(const bContext *C) ar = MEM_callocN(sizeof(ARegion), "preview for clip"); BLI_addtail(&sc->regionbase, ar); - init_preview_region(C, ar); + init_preview_region(scene, sa, sc, ar); /* main region */ ar = MEM_callocN(sizeof(ARegion), "main region for clip"); |