Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/screen/screen_edit.c')
-rw-r--r--source/blender/editors/screen/screen_edit.c239
1 files changed, 116 insertions, 123 deletions
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index d19d017a637..a3f97a7c5ce 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1,5 +1,5 @@
/**
- * $Id:
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -28,10 +28,7 @@
#include "MEM_guardedalloc.h"
-#include "DNA_vec_types.h"
#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_texture_types.h"
#include "DNA_userdef_types.h"
#include "BLI_blenlib.h"
@@ -52,6 +49,7 @@
#include "WM_types.h"
#include "ED_image.h"
+#include "ED_view3d.h"
#include "ED_screen.h"
#include "ED_screen_types.h"
@@ -1234,11 +1232,17 @@ void ED_screen_set_subwinactive(wmWindow *win, wmEvent *event)
int ED_screen_area_active(const bContext *C)
{
+ wmWindow *win= CTX_wm_window(C);
bScreen *sc= CTX_wm_screen(C);
ScrArea *sa= CTX_wm_area(C);
- if(sc && sa) {
+ if(win && sc && sa) {
+ AZone *az= is_in_area_actionzone(sa, win->eventstate->x, win->eventstate->y);
ARegion *ar;
+
+ if (az && az->type == AZONE_REGION)
+ return 1;
+
for(ar= sa->regionbase.first; ar; ar= ar->next)
if(ar->swinid == sc->subwinactive)
return 1;
@@ -1390,6 +1394,9 @@ void ED_screen_set_scene(bContext *C, Scene *scene)
while(sl) {
if(sl->spacetype==SPACE_VIEW3D) {
View3D *v3d= (View3D*) sl;
+
+ BKE_screen_view3d_sync(v3d, scene);
+
if (!v3d->camera || !object_in_scene(v3d->camera, scene)) {
v3d->camera= scene_find_camera(sc->scene);
// XXX if (sc==curscreen) handle_view3d_lock();
@@ -1441,8 +1448,76 @@ void ED_screen_delete_scene(bContext *C, Scene *scene)
unlink_scene(bmain, scene, newscene);
}
+int ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
+{
+ wmWindow *win= CTX_wm_window(C);
+ bScreen *screen= CTX_wm_screen(C);
+ ScrArea *newsa= NULL;
+
+ if(!sa || sa->full==0) {
+ newsa= ED_screen_full_toggle(C, win, sa);
+ }
+
+ if(!newsa) {
+ if (sa->full) {
+ /* if this has been called from the temporary info header generated in
+ * temp fullscreen layouts, find the correct fullscreen area to change
+ * to create a new space inside */
+ for (newsa = screen->areabase.first; newsa; newsa=newsa->next) {
+ if (!(sa->flag & AREA_TEMP_INFO))
+ break;
+ }
+ } else
+ newsa= sa;
+ }
+
+ ED_area_newspace(C, newsa, type);
+
+ return 1;
+}
+
+void ED_screen_full_prevspace(bContext *C, ScrArea *sa)
+{
+ wmWindow *win= CTX_wm_window(C);
+
+ ED_area_prevspace(C, sa);
+
+ if(sa->full)
+ ED_screen_full_toggle(C, win, sa);
+}
+
+/* restore a screen / area back to default operation, after temp fullscreen modes */
+void ED_screen_full_restore(bContext *C, ScrArea *sa)
+{
+ wmWindow *win= CTX_wm_window(C);
+ SpaceLink *sl = sa->spacedata.first;
+
+ /* if fullscreen area has a secondary space (such as a file browser or fullscreen render
+ * overlaid on top of a existing setup) then return to the previous space */
+
+ if (sl->next) {
+ /* specific checks for space types */
+ if (sl->spacetype == SPACE_IMAGE) {
+ SpaceImage *sima= sa->spacedata.first;
+ if (sima->flag & SI_PREVSPACE)
+ sima->flag &= ~SI_PREVSPACE;
+ if (sima->flag & SI_FULLWINDOW) {
+ sima->flag &= ~SI_FULLWINDOW;
+ ED_screen_full_prevspace(C, sa);
+ }
+ } else if (sl->spacetype == SPACE_FILE) {
+ ED_screen_full_prevspace(C, sa);
+ } else
+ ED_screen_full_toggle(C, win, sa);
+ }
+ /* otherwise just tile the area again */
+ else {
+ ED_screen_full_toggle(C, win, sa);
+ }
+}
+
/* this function toggles: if area is full then the parent will be restored */
-ScrArea *ed_screen_fullarea(bContext *C, wmWindow *win, ScrArea *sa)
+ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
{
bScreen *sc, *oldscreen;
ARegion *ar;
@@ -1454,45 +1529,45 @@ ScrArea *ed_screen_fullarea(bContext *C, wmWindow *win, ScrArea *sa)
for(ar=sa->regionbase.first; ar; ar=ar->next)
uiFreeBlocks(C, &ar->uiblocks);
}
-
+
if(sa && sa->full) {
short fulltype;
-
+
sc= sa->full; /* the old screen to restore */
oldscreen= win->screen; /* the one disappearing */
-
+
fulltype = sc->full;
-
+
/* refuse to go out of SCREENAUTOPLAY as long as G_FLAGS_AUTOPLAY
is set */
-
+
if (fulltype != SCREENAUTOPLAY || (G.flags & G_FILE_AUTOPLAY) == 0) {
ScrArea *old;
-
+
sc->full= 0;
-
+
/* find old area */
- for(old= sc->areabase.first; old; old= old->next)
+ for(old= sc->areabase.first; old; old= old->next)
if(old->full) break;
if(old==NULL) {
if (G.f & G_DEBUG)
- printf("something wrong in areafullscreen\n");
+ printf("something wrong in areafullscreen\n");
return NULL;
}
- // old feature described below (ton)
- // in autoplay screens the headers are disabled by
+ // old feature described below (ton)
+ // in autoplay screens the headers are disabled by
// default. So use the old headertype instead
-
+
area_copy_data(old, sa, 1); /* 1 = swap spacelist */
if (sa->flag & AREA_TEMP_INFO) sa->flag &= ~AREA_TEMP_INFO;
old->full= NULL;
-
+
/* animtimer back */
sc->animtimer= oldscreen->animtimer;
oldscreen->animtimer= NULL;
-
+
ED_screen_set(C, sc);
-
+
free_screen(oldscreen);
free_libblock(&CTX_data_main(C)->screen, oldscreen);
}
@@ -1500,7 +1575,7 @@ ScrArea *ed_screen_fullarea(bContext *C, wmWindow *win, ScrArea *sa)
else {
ScrArea *newa;
char newname[20];
-
+
oldscreen= win->screen;
/* nothing wrong with having only 1 area, as far as I can see...
@@ -1508,20 +1583,20 @@ ScrArea *ed_screen_fullarea(bContext *C, wmWindow *win, ScrArea *sa)
if(oldscreen->areabase.first==oldscreen->areabase.last)
return NULL;
*/
-
+
oldscreen->full = SCREENFULL;
BLI_snprintf(newname, sizeof(newname), "%s-%s", oldscreen->id.name+2, "temp");
sc= ED_screen_add(win, oldscreen->scene, newname);
sc->full = SCREENFULL; // XXX
-
+
/* timer */
sc->animtimer= oldscreen->animtimer;
oldscreen->animtimer= NULL;
-
+
/* returns the top small area */
newa= area_split(win, sc, (ScrArea *)sc->areabase.first, 'h', 0.99f);
ED_area_newspace(C, newa, SPACE_INFO);
-
+
/* use random area when we have no active one, e.g. when the
mouse is outside of the window and we open a file browser */
if(!sa)
@@ -1535,7 +1610,7 @@ ScrArea *ed_screen_fullarea(bContext *C, wmWindow *win, ScrArea *sa)
sa->full= oldscreen;
newa->full= oldscreen;
newa->next->full= oldscreen; // XXX
-
+
ED_screen_set(C, sc);
}
@@ -1547,74 +1622,6 @@ ScrArea *ed_screen_fullarea(bContext *C, wmWindow *win, ScrArea *sa)
return sc->areabase.first;
}
-int ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
-{
- wmWindow *win= CTX_wm_window(C);
- bScreen *screen= CTX_wm_screen(C);
- ScrArea *newsa= NULL;
-
- if(!sa || sa->full==0) {
- newsa= ed_screen_fullarea(C, win, sa);
- }
-
- if(!newsa) {
- if (sa->full) {
- /* if this has been called from the temporary info header generated in
- * temp fullscreen layouts, find the correct fullscreen area to change
- * to create a new space inside */
- for (newsa = screen->areabase.first; newsa; newsa=newsa->next) {
- if (!(sa->flag & AREA_TEMP_INFO))
- break;
- }
- } else
- newsa= sa;
- }
-
- ED_area_newspace(C, newsa, type);
-
- return 1;
-}
-
-void ED_screen_full_prevspace(bContext *C, ScrArea *sa)
-{
- wmWindow *win= CTX_wm_window(C);
-
- ED_area_prevspace(C, sa);
-
- if(sa->full)
- ed_screen_fullarea(C, win, sa);
-}
-
-/* restore a screen / area back to default operation, after temp fullscreen modes */
-void ED_screen_full_restore(bContext *C, ScrArea *sa)
-{
- wmWindow *win= CTX_wm_window(C);
- SpaceLink *sl = sa->spacedata.first;
-
- /* if fullscreen area has a secondary space (such as as file browser or fullscreen render
- * overlaid on top of a existing setup) then return to the previous space */
-
- if (sl->next) {
- /* specific checks for space types */
- if (sl->spacetype == SPACE_IMAGE) {
- SpaceImage *sima= sa->spacedata.first;
- if (sima->flag & SI_PREVSPACE)
- sima->flag &= ~SI_PREVSPACE;
- if (sima->flag & SI_FULLWINDOW) {
- sima->flag &= ~SI_FULLWINDOW;
- ED_screen_full_prevspace(C, sa);
- }
- } else if (sl->spacetype == SPACE_FILE) {
- ED_screen_full_prevspace(C, sa);
- } else
- ed_screen_fullarea(C, win, sa);
- }
- /* otherwise just tile the area again */
- else {
- ed_screen_fullarea(C, win, sa);
- }
-}
-
/* update frame rate info for viewport drawing */
void ED_refresh_viewport_fps(bContext *C)
{
@@ -1644,7 +1651,7 @@ void ED_refresh_viewport_fps(bContext *C)
/* redraws: uses defines from stime->redraws
* enable: 1 - forward on, -1 - backwards on, 0 - off
*/
-void ED_screen_animation_timer(bContext *C, int redraws, int sync, int enable)
+void ED_screen_animation_timer(bContext *C, int redraws, int refresh, int sync, int enable)
{
bScreen *screen= CTX_wm_screen(C);
wmWindowManager *wm= CTX_wm_manager(C);
@@ -1662,6 +1669,7 @@ void ED_screen_animation_timer(bContext *C, int redraws, int sync, int enable)
sad->ar= CTX_wm_region(C);
sad->sfra = scene->r.cfra;
sad->redraws= redraws;
+ sad->refresh= refresh;
sad->flag |= (enable < 0)? ANIMPLAY_FLAG_REVERSE: 0;
sad->flag |= (sync == 0)? ANIMPLAY_FLAG_NO_SYNC: (sync == 1)? ANIMPLAY_FLAG_SYNC: 0;
screen->animtimer->customdata= sad;
@@ -1695,13 +1703,14 @@ static ARegion *time_top_left_3dwindow(bScreen *screen)
return aret;
}
-void ED_screen_animation_timer_update(bScreen *screen, int redraws)
+void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh)
{
if(screen && screen->animtimer) {
wmTimer *wt= screen->animtimer;
ScreenAnimData *sad= wt->customdata;
sad->redraws= redraws;
+ sad->refresh= refresh;
sad->ar= NULL;
if(redraws & TIME_REGION)
sad->ar= time_top_left_3dwindow(screen);
@@ -1715,36 +1724,23 @@ void ED_update_for_newframe(const bContext *C, int mute)
Scene *scene= CTX_data_scene(C);
#ifdef DURIAN_CAMERA_SWITCH
- void *camera= scene_find_camera_switch(scene);
+ void *camera= scene_camera_switch_find(scene);
if(camera && scene->camera != camera) {
-
- if(camera && scene->camera && (camera != scene->camera)) {
- bScreen *sc;
- /* are there cameras in the views that are not in the scene? */
- for(sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa= sc->areabase.first;
- while(sa) {
- SpaceLink *sl= sa->spacedata.first;
- while(sl) {
- if(sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D*) sl;
- if (v3d->scenelock) {
- v3d->camera= camera;
- }
- }
- sl= sl->next;
- }
- sa= sa->next;
- }
- }
- }
-
+ bScreen *sc;
scene->camera= camera;
+ /* are there cameras in the views that are not in the scene? */
+ for(sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) {
+ BKE_screen_view3d_scene_sync(sc);
+ }
}
#endif
//extern void audiostream_scrub(unsigned int frame); /* seqaudio.c */
+ /* update animated image textures for gpu, etc,
+ * call before scene_update_for_newframe so modifiers with textuers dont lag 1 frame */
+ ED_image_update_frame(C);
+
/* this function applies the changes too */
/* XXX future: do all windows */
scene_update_for_newframe(scene, BKE_screen_visible_layers(screen, scene)); /* BKE_scene.h */
@@ -1762,9 +1758,6 @@ void ED_update_for_newframe(const bContext *C, int mute)
if(scene->use_nodes && scene->nodetree)
ntreeCompositTagAnimated(scene->nodetree);
- /* update animated image textures for gpu, etc */
- ED_image_update_frame(C);
-
/* update animated texture nodes */
{
Tex *tex;