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/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_depsgraph.h11
-rw-r--r--source/blender/blenkernel/BKE_main.h2
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c163
-rw-r--r--source/blender/blenkernel/intern/mesh.c4
-rw-r--r--source/blender/blenkernel/intern/particle.c4
-rw-r--r--source/blender/blenkernel/intern/pointcache.c2
-rw-r--r--source/blender/blenkernel/intern/scene.c2
-rw-r--r--source/blender/blenkernel/intern/text.c2
8 files changed, 95 insertions, 95 deletions
diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h
index 5b2dca5299c..e612d00f936 100644
--- a/source/blender/blenkernel/BKE_depsgraph.h
+++ b/source/blender/blenkernel/BKE_depsgraph.h
@@ -110,15 +110,14 @@ void DAG_scene_flush_update(struct Main *bmain, struct Scene *sce, unsigned int
/* tag objects for update on file load */
void DAG_on_load_update(struct Main *bmain);
- /* 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 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(struct Main *bmain, int time);
+ /* tag datablock to get updated for the next redraw */
+void DAG_id_tag_update(struct ID *id, short flag);
+ /* flush all tagged updates */
+void DAG_ids_flush_tagged(struct Main *bmain);
+
/* (re)-create dependency graph for armature pose */
void DAG_pose_sort(struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index 1a53f488841..533679cead1 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -81,6 +81,8 @@ typedef struct Main {
ListBase particle;
ListBase wm;
ListBase gpencil;
+
+ char id_tag_update[256];
} Main;
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 65a58b02377..97a27405db3 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -52,6 +52,7 @@
#include "BKE_global.h"
#include "BKE_group.h"
#include "BKE_key.h"
+#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_mball.h"
#include "BKE_modifier.h"
@@ -2290,26 +2291,21 @@ static void dag_id_flush_update__isDependentTexture(void *userData, Object *UNUS
}
}
-void DAG_id_flush_update(ID *id, short flag)
+static void dag_id_flush_update(Scene *sce, ID *id)
{
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;
+ /* here we flush a few things before actual scene wide flush, mostly
+ due to only objects and not other datablocks being in the depsgraph */
/* set flags & pointcache for object */
if(GS(id->name) == ID_OB) {
ob= (Object*)id;
- ob->recalc |= (flag & OB_RECALC_ALL);
BKE_ptcache_object_reset(sce, ob, PTCACHE_RESET_DEPSGRAPH);
- if(flag & OB_RECALC_DATA) {
+ if(ob->recalc & OB_RECALC_DATA) {
/* all users of this ob->data should be checked */
id= ob->data;
@@ -2374,23 +2370,90 @@ void DAG_id_flush_update(ID *id, short flag)
/* set flags based on particle settings */
if(idtype == ID_PA) {
ParticleSystem *psys;
- for(obt=bmain->object.first; obt; obt= obt->id.next) {
- for(psys=obt->particlesystem.first; psys; psys=psys->next) {
- if(&psys->part->id == id) {
+ for(obt=bmain->object.first; obt; obt= obt->id.next)
+ for(psys=obt->particlesystem.first; psys; psys=psys->next)
+ if(&psys->part->id == id)
BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH);
- obt->recalc |= (flag & OB_RECALC_ALL);
- psys->recalc |= (flag & PSYS_RECALC);
- }
- }
- }
}
/* update editors */
dag_editors_update(bmain, id);
}
+}
+
+void DAG_ids_flush_tagged(Main *bmain)
+{
+ ListBase *lbarray[MAX_LIBARRAY];
+ Scene *sce;
+ unsigned int lay;
+ int a, have_tag = 0;
+
+ dag_current_scene_layers(bmain, &sce, &lay);
+
+ if(!sce || !sce->theDag)
+ return;
+
+ /* loop over all ID types */
+ a = set_listbasepointers(bmain, lbarray);
+
+ while(a--) {
+ ListBase *lb = lbarray[a];
+ ID *id = lb->first;
+
+ /* we tag based on first ID type character to avoid
+ looping over all ID's in case there are no tags */
+ if(id && bmain->id_tag_update[id->name[0]]) {
+ for(; id; id=id->next) {
+ if(id->flag & LIB_ID_RECALC) {
+ dag_id_flush_update(sce, id);
+ id->flag &= ~LIB_ID_RECALC;
+ }
+ }
+
+ have_tag = 1;
+ }
+ }
- /* flush to other objects that depend on this one */
- DAG_scene_flush_update(bmain, sce, lay, 0);
+ if(have_tag) {
+ /* clear tags */
+ memset(bmain->id_tag_update, 0, sizeof(bmain->id_tag_update));
+
+ /* flush changes to other objects */
+ DAG_scene_flush_update(bmain, sce, lay, 0);
+ }
+}
+
+void DAG_id_tag_update(ID *id, short flag)
+{
+ Main *bmain= G.main;
+
+ /* tag ID for update */
+ id->flag |= LIB_ID_RECALC;
+ bmain->id_tag_update[id->name[0]] = 1;
+
+ /* flag is for objects and particle systems */
+ if(flag) {
+ Object *ob;
+ ParticleSystem *psys;
+ short idtype = GS(id->name);
+
+ if(idtype == ID_OB) {
+ /* only quick tag */
+ ob = (Object*)id;
+ ob->recalc |= (flag & OB_RECALC_ALL);
+ }
+ else if(idtype == ID_PA) {
+ /* this is weak still, should be done delayed as well */
+ for(ob=bmain->object.first; ob; ob=ob->id.next) {
+ for(psys=ob->particlesystem.first; psys; psys=psys->next) {
+ if(&psys->part->id == id) {
+ ob->recalc |= (flag & OB_RECALC_ALL);
+ psys->recalc |= (flag & PSYS_RECALC);
+ }
+ }
+ }
+ }
+ }
}
/* recursively descends tree, each node only checked once */
@@ -2423,68 +2486,6 @@ static int parent_check_node(DagNode *node, int curtime)
return DAG_WHITE;
}
-/* all nodes that influence this object get tagged, for calculating the exact
- position of this object at a given timeframe */
-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)
- node->color = DAG_WHITE;
-
- node= dag_find_node(sce->theDag, ob);
-
- /* object not in scene? then handle group exception. needs to be dagged once too */
- if(node==NULL) {
- Group *group= NULL;
- while( (group = find_group(ob, group)) ) {
- GroupObject *go;
- /* primitive; tag all... this call helps building groups for particles */
- for(go= group->gobject.first; go; go= go->next)
- go->ob->recalc= OB_RECALC_ALL;
- }
- }
- else {
-
- node->color = DAG_GRAY;
-
- sce->theDag->time++;
- node= sce->theDag->DagNode.first;
- for(itA = node->child; itA; itA= itA->next) {
- if(itA->node->type==ID_OB && itA->node->lasttime!=sce->theDag->time)
- itA->node->color= parent_check_node(itA->node, sce->theDag->time);
- }
-
- /* set recalcs and flushes */
- DAG_scene_update_flags(bmain, sce, lay);
-
- /* now we clear recalcs, unless color is set */
- for(node = sce->theDag->DagNode.first; node; node= node->next) {
- if(node->type==ID_OB && node->color==DAG_WHITE) {
- Object *ob= node->ob;
- ob->recalc= 0;
- }
- }
- }
-}
-
/* ******************* DAG FOR ARMATURE POSE ***************** */
/* we assume its an armature with pose */
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index eb413187544..7a72207ff69 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -1222,8 +1222,6 @@ void mesh_set_smooth_flag(Object *meshOb, int enableSmooth)
mf->flag &= ~ME_SMOOTH;
}
}
-
-// XXX do this in caller DAG_id_flush_update(&me->id, OB_RECALC_DATA);
}
void mesh_calc_normals(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float **faceNors_r)
@@ -1483,8 +1481,6 @@ void mesh_pmv_revert(Mesh *me)
me->pv->edge_map= NULL;
MEM_freeN(me->pv->vert_map);
me->pv->vert_map= NULL;
-
-// XXX do this in caller DAG_id_flush_update(&me->id, OB_RECALC_DATA);
}
}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 9c2efe395dc..6fec4775769 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3425,7 +3425,7 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
psys->cfra=bsystem_time(scene,ob,scene->r.cfra+1,0.0);
DAG_scene_sort(G.main, scene);
- DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
return md;
}
@@ -3462,7 +3462,7 @@ void object_remove_particle_system(Scene *scene, Object *ob)
ob->mode &= ~OB_MODE_PARTICLE_EDIT;
DAG_scene_sort(G.main, scene);
- DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
static void default_particle_settings(ParticleSettings *part)
{
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index f7af3c68814..cd45a39f2c9 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2313,7 +2313,7 @@ void BKE_ptcache_set_continue_physics(Main *bmain, Scene *scene, int enable)
if(CONTINUE_PHYSICS == 0) {
for(ob=bmain->object.first; ob; ob=ob->id.next)
if(BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED))
- DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
}
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index edbace71c6d..9bbadbacb37 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -968,6 +968,8 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
/* this is called in main loop, doing tagged updates before redraw */
void scene_update_tagged(Main *bmain, Scene *scene)
{
+ DAG_ids_flush_tagged(bmain);
+
scene->physics_settings.quick_cache_step= 0;
/* update all objects: drivers, matrices, displists, etc. flags set
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index f6833596883..6e0289e907b 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -521,7 +521,7 @@ void unlink_text(Main *bmain, Text *text)
}
if(update)
- DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
/* pynodes */