diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_depsgraph.h | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_screen.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 75 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 21 |
4 files changed, 91 insertions, 24 deletions
diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h index e242ead3b87..17a4749f704 100644 --- a/source/blender/blenkernel/BKE_depsgraph.h +++ b/source/blender/blenkernel/BKE_depsgraph.h @@ -96,19 +96,24 @@ void draw_all_deps(void); /* ********** API *************** */ /* Note that the DAG never executes changes in Objects, only sets flags in Objects */ + /* (re)-create dependency graph for scene */ void DAG_scene_sort(struct Scene *sce); /* flag all objects that need recalc because they're animated */ void DAG_scene_update_flags(struct Scene *sce, unsigned int lay); - /* flag all objects that need recalc because they're animated, influencing this object only */ -void DAG_object_update_flags(struct Scene *sce, struct Object *ob, unsigned int lay); - /* flushes all recalc flags in objects down the dependency tree */ void DAG_scene_flush_update(struct Scene *sce, unsigned int lay, int time); + + /* flag all IDs that need recalc because they're animated, influencing + this ID only. only for objects currently */ +void DAG_id_update_flags(struct ID *id); /* flushes all recalc flags for this object down the dependency tree, - but not the DAG only supports objects and object data currently */ + but note the DAG only supports objects and object data currently */ void DAG_id_flush_update(struct ID *id, short flag); + /* when setting manual RECALC flags, call this afterwards */ +void DAG_ids_flush_update(int time); + /* (re)-create dependency graph for armature pose */ void DAG_pose_sort(struct Object *ob); #endif diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 4fcb7c881be..ee04d4f47bc 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -230,11 +230,11 @@ void BKE_spacedata_copyfirst(ListBase *lb1, ListBase *lb2); /* area/regions */ struct ARegion *BKE_area_region_copy(struct SpaceType *st, struct ARegion *ar); void BKE_area_region_free(struct SpaceType *st, struct ARegion *ar); +void BKE_screen_area_free(struct ScrArea *sa); -void BKE_screen_area_free(struct ScrArea *sa); - +/* screen */ void free_screen(struct bScreen *sc); - +unsigned int BKE_screen_visible_layers(struct bScreen *screen); #endif diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 6a14762e0ed..58f3db50d0f 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -78,6 +78,7 @@ #include "BKE_pointcache.h" #include "BKE_utildefines.h" #include "BKE_scene.h" +#include "BKE_screen.h" #include "MEM_guardedalloc.h" @@ -2142,30 +2143,58 @@ void DAG_scene_update_flags(Scene *scene, unsigned int lay) } -void DAG_id_flush_update(ID *id, short flag) +static void dag_current_scene_layers(Main *bmain, Scene **sce, unsigned int *lay) { - Main *bmain= G.main; wmWindowManager *wm; wmWindow *win; - Scene *sce; - Object *obt, *ob= NULL; - short idtype; /* only one scene supported currently, making more scenes work correctly requires changes beyond just the dependency graph */ + *sce= NULL; + *lay= 0; + if((wm= bmain->wm.first)) { - /* if we have a windowmanager, use sce from first window */ + /* if we have a windowmanager, look into windows */ for(win=wm->windows.first; win; win=win->next) { - sce= (win->screen)? win->screen->scene: NULL; - - if(sce) - break; + if(win->screen) { + if(!*sce) *sce= win->screen->scene; + *lay |= BKE_screen_visible_layers(win->screen); + } } } - else + else { /* if not, use the first sce */ - sce= bmain->scene.first; + *sce= bmain->scene.first; + if(*sce) *lay= (*sce)->lay; + + /* XXX for background mode, we should get the scen + from somewhere, for the -S option, but it's in + the context, how to get it here? */ + } +} + +void DAG_ids_flush_update(int time) +{ + Main *bmain= G.main; + Scene *sce; + unsigned int lay; + + dag_current_scene_layers(bmain, &sce, &lay); + + if(sce) + DAG_scene_flush_update(sce, lay, time); +} + +void DAG_id_flush_update(ID *id, short flag) +{ + Main *bmain= G.main; + Scene *sce; + Object *obt, *ob= NULL; + short idtype; + unsigned int lay; + + dag_current_scene_layers(bmain, &sce, &lay); if(!id || !sce || !sce->theDag) return; @@ -2213,10 +2242,7 @@ void DAG_id_flush_update(ID *id, short flag) } /* flush to other objects that depend on this one */ -// XXX if(G.curscreen) -// DAG_scene_flush_update(sce, dag_screen_view3d_layers(), 0); -// else - DAG_scene_flush_update(sce, sce->lay, 0); + DAG_scene_flush_update(sce, lay, 0); } /* recursively descends tree, each node only checked once */ @@ -2251,10 +2277,25 @@ static int parent_check_node(DagNode *node, int curtime) /* all nodes that influence this object get tagged, for calculating the exact position of this object at a given timeframe */ -void DAG_object_update_flags(Scene *sce, Object *ob, unsigned int lay) +void DAG_id_update_flags(ID *id) { + Main *bmain= G.main; + Scene *sce; DagNode *node; DagAdjList *itA; + Object *ob; + unsigned int lay; + + dag_current_scene_layers(bmain, &sce, &lay); + + if(!id || !sce || !sce->theDag) + return; + + /* objects only currently */ + if(GS(id->name) != ID_OB) + return; + + ob= (Object*)id; /* tag nodes unchecked */ for(node = sce->theDag->DagNode.first; node; node= node->next) diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index cc740d7fb3d..661d0da1550 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -33,8 +33,10 @@ #include "MEM_guardedalloc.h" +#include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" +#include "DNA_view3d_types.h" #include "BLI_blenlib.h" @@ -321,4 +323,23 @@ void free_screen(bScreen *sc) BLI_freelistN(&sc->areabase); } +/* for depsgraph */ +unsigned int BKE_screen_visible_layers(bScreen *screen) +{ + ScrArea *sa; + unsigned int layer= 0; + + if(!screen) + return layer; + + /* 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; + + if(!layer) + return screen->scene->lay; + + return layer; +} |