2.5 - Action Editor / Animation Stuff:
[blender-staging.git] / source / blender / editors / animation / anim_deps.c
index 36457e13f5be0e393f10bed355aaddca4b770b63..fbd9f5ecdb7a944ddd508865ece4c3c8b2905a03 100644 (file)
@@ -35,6 +35,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_space_types.h"
+#include "DNA_texture_types.h"
 #include "DNA_view3d_types.h"
 #include "DNA_windowmanager_types.h"
 
 
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
+#include "BKE_global.h"
+#include "BKE_scene.h"
+#include "BKE_main.h"
+#include "BKE_node.h"
 #include "BKE_utildefines.h"
 
 #include "RNA_access.h"
 
 /* ***************** depsgraph calls and anim updates ************* */
 
-/* generic update flush, reads from context Screen (layers) and scene */
-/* this is for compliancy, later it can do all windows etc */
-void ED_anim_dag_flush_update(bContext *C)
+static unsigned int screen_view3d_layers(bScreen *screen)
 {
-       Scene *scene= CTX_data_scene(C);
-       bScreen *screen= CTX_wm_screen(C);
-       int layer= scene->lay;  /* as minimum this */
-       
        if(screen) {
+               unsigned int layer= screen->scene->lay; /* as minimum this */
                ScrArea *sa;
-
+               
                /* get all used view3d layers */
                for(sa= screen->areabase.first; sa; sa= sa->next) {
                        if(sa->spacetype==SPACE_VIEW3D)
                                layer |= ((View3D *)sa->spacedata.first)->lay;
                }
+               return layer;
        }
+       return 0;
+}
+
+/* generic update flush, reads from context Screen (layers) and scene */
+/* this is for compliancy, later it can do all windows etc */
+void ED_anim_dag_flush_update(const bContext *C)
+{
+       Scene *scene= CTX_data_scene(C);
+       bScreen *screen= CTX_wm_screen(C);
        
-       DAG_scene_flush_update(scene, layer, 0);
+       DAG_scene_flush_update(scene, screen_view3d_layers(screen), 0);
+}
+
+
+/* results in fully updated anim system */
+/* in future sound should be on WM level, only 1 sound can play! */
+void ED_update_for_newframe(bContext *C, int mute)
+{
+       bScreen *screen= CTX_wm_screen(C);
+       Scene *scene= screen->scene;
+       
+       //extern void audiostream_scrub(unsigned int frame);    /* seqaudio.c */
+       
+       /* this function applies the changes too */
+       /* XXX future: do all windows */
+       scene_update_for_newframe(scene, screen_view3d_layers(screen)); /* BKE_scene.h */
+       
+       //if ( (CFRA>1) && (!mute) && (G.scene->audio.flag & AUDIO_SCRUB)) 
+       //      audiostream_scrub( CFRA );
+       
+       /* 3d window, preview */
+       //BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
+       
+       /* all movie/sequence images */
+       //BIF_image_update_frame();
+       
+       /* composite */
+       if(scene->use_nodes && scene->nodetree)
+               ntreeCompositTagAnimated(scene->nodetree);
+       
+       /* update animated texture nodes */
+       {
+               Tex *tex;
+               for(tex= G.main->tex.first; tex; tex= tex->id.next)
+                       if( tex->use_nodes && tex->nodetree ) {
+                               ntreeTexTagAnimated( tex->nodetree );
+                       }
+       }
 }