4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2008 Blender Foundation.
21 * All rights reserved.
24 * Contributor(s): Blender Foundation, Joshua Leung
26 * ***** END GPL LICENSE BLOCK *****
32 #include "MEM_guardedalloc.h"
34 #include "DNA_action_types.h"
35 #include "DNA_scene_types.h"
36 #include "DNA_screen_types.h"
37 #include "DNA_space_types.h"
38 #include "DNA_texture_types.h"
39 #include "DNA_view3d_types.h"
40 #include "DNA_windowmanager_types.h"
42 #include "BLI_blenlib.h"
44 #include "BKE_context.h"
45 #include "BKE_depsgraph.h"
46 #include "BKE_global.h"
47 #include "BKE_scene.h"
50 #include "BKE_utildefines.h"
52 #include "RNA_access.h"
53 #include "RNA_define.h"
56 /* ***************** depsgraph calls and anim updates ************* */
58 static unsigned int screen_view3d_layers(bScreen *screen)
61 unsigned int layer= screen->scene->lay; /* as minimum this */
64 /* get all used view3d layers */
65 for(sa= screen->areabase.first; sa; sa= sa->next) {
66 if(sa->spacetype==SPACE_VIEW3D)
67 layer |= ((View3D *)sa->spacedata.first)->lay;
74 /* generic update flush, reads from context Screen (layers) and scene */
75 /* this is for compliancy, later it can do all windows etc */
76 void ED_anim_dag_flush_update(bContext *C)
78 Scene *scene= CTX_data_scene(C);
79 bScreen *screen= CTX_wm_screen(C);
81 DAG_scene_flush_update(scene, screen_view3d_layers(screen), 0);
85 /* results in fully updated anim system */
86 /* in future sound should be on WM level, only 1 sound can play! */
87 void ED_update_for_newframe(bContext *C, int mute)
89 bScreen *screen= CTX_wm_screen(C);
90 Scene *scene= screen->scene;
92 //extern void audiostream_scrub(unsigned int frame); /* seqaudio.c */
94 /* this function applies the changes too */
95 /* XXX future: do all windows */
96 scene_update_for_newframe(scene, screen_view3d_layers(screen)); /* BKE_scene.h */
98 //if ( (CFRA>1) && (!mute) && (G.scene->audio.flag & AUDIO_SCRUB))
99 // audiostream_scrub( CFRA );
101 /* 3d window, preview */
102 //BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
104 /* all movie/sequence images */
105 //BIF_image_update_frame();
108 if(scene->use_nodes && scene->nodetree)
109 ntreeCompositTagAnimated(scene->nodetree);
111 /* update animated texture nodes */
114 for(tex= G.main->tex.first; tex; tex= tex->id.next)
115 if( tex->use_nodes && tex->nodetree ) {
116 ntreeTexTagAnimated( tex->nodetree );