diff options
Diffstat (limited to 'source/blender/blenkernel/intern/screen.c')
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 68 |
1 files changed, 64 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index b2296151cf7..a6ac4551f4a 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -39,6 +39,8 @@ #include "MEM_guardedalloc.h" +#include "GPU_compositing.h" + #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" @@ -46,6 +48,7 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "BLI_rect.h" #include "BKE_idprop.h" #include "BKE_screen.h" @@ -137,7 +140,7 @@ void BKE_spacetype_register(SpaceType *st) BLI_addtail(&spacetypes, st); } -int BKE_spacetype_exists(int spaceid) +bool BKE_spacetype_exists(int spaceid) { return BKE_spacetype_from_id(spaceid) != NULL; } @@ -402,16 +405,34 @@ ARegion *BKE_area_find_region_active_win(ScrArea *sa) return NULL; } -/* note, using this function is generally a last resort, you really want to be +/** + * \note, ideally we can get the area from the context, + * there are a few places however where this isn't practical. + */ +ScrArea *BKE_screen_find_area_from_space(struct bScreen *sc, SpaceLink *sl) +{ + ScrArea *sa; + + for (sa = sc->areabase.first; sa; sa = sa->next) { + if (BLI_findindex(&sa->spacedata, sl) != -1) { + break; + } + } + + return sa; +} + +/** + * \note Using this function is generally a last resort, you really want to be * using the context when you can - campbell - * -1 for any type */ + */ ScrArea *BKE_screen_find_big_area(bScreen *sc, const int spacetype, const short min) { ScrArea *sa, *big = NULL; int size, maxsize = 0; for (sa = sc->areabase.first; sa; sa = sa->next) { - if ((spacetype == -1) || sa->spacetype == spacetype) { + if ((spacetype == SPACE_TYPE_ANY) || (sa->spacetype == spacetype)) { if (min <= sa->winx && min <= sa->winy) { size = sa->winx * sa->winy; if (size > maxsize) { @@ -425,6 +446,22 @@ ScrArea *BKE_screen_find_big_area(bScreen *sc, const int spacetype, const short return big; } +ScrArea *BKE_screen_find_area_xy(bScreen *sc, const int spacetype, int x, int y) +{ + ScrArea *sa, *sa_found = NULL; + + for (sa = sc->areabase.first; sa; sa = sa->next) { + if (BLI_rcti_isect_pt(&sa->totrct, x, y)) { + if ((spacetype == SPACE_TYPE_ANY) || (sa->spacetype == spacetype)) { + sa_found = sa; + } + break; + } + } + return sa_found; +} + + /** * Utility function to get the active layer to use when adding new objects. */ @@ -563,3 +600,26 @@ float BKE_screen_view3d_zoom_from_fac(float zoomfac) { return ((sqrtf(4.0f * zoomfac) - (float)M_SQRT2) * 50.0f); } + +void BKE_screen_gpu_fx_validate(GPUFXSettings *fx_settings) +{ + /* currently we use DOF from the camera _only_, + * so we never allocate this, only copy from the Camera */ +#if 0 + if ((fx_settings->dof == NULL) && + (fx_settings->fx_flag & GPU_FX_FLAG_DOF)) + { + GPUDOFSettings *fx_dof; + fx_dof = fx_settings->dof = MEM_callocN(sizeof(GPUDOFSettings), __func__); + } +#endif + + if ((fx_settings->ssao == NULL) && + (fx_settings->fx_flag & GPU_FX_FLAG_SSAO)) + { + GPUSSAOSettings *fx_ssao; + fx_ssao = fx_settings->ssao = MEM_callocN(sizeof(GPUSSAOSettings), __func__); + + GPU_fx_compositor_init_ssao_settings(fx_ssao); + } +} |