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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-09-14 16:26:34 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-09-14 16:26:34 +0400
commit8d3955c28d4f3db7026dc7f1a33a421a727f89d3 (patch)
tree502e22a0c45d7c22aea386740f31d7b2e55134c2 /source/blender/blenkernel
parent75d4a836b8427f1d71f41d037390352bffeafee4 (diff)
Depsgraph:
* Move function to compute visible screen layers to BKE. * Use this now in the depsgraph, was still using this all layers to flush. Still missing a way to get the current scene in background mode.. * Also two more function to not require a scene pointer anymore: * DAG_object_update_flags is now DAG_id_update_flags. * DAG_ids_flush_update is now available next to DAG_scene_flush_update.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_depsgraph.h13
-rw-r--r--source/blender/blenkernel/BKE_screen.h6
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c75
-rw-r--r--source/blender/blenkernel/intern/screen.c21
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;
+}