diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-08-28 15:54:27 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-08-28 15:55:21 +0300 |
commit | b024ccd61992e33c62485a80c903a0f284d42dc5 (patch) | |
tree | 8f27687cdced8b217ca97ddc99b50c18a1ceecfb /source | |
parent | c53b1e2a93e17eb353d0dfa1472d501fd023d05f (diff) |
Fix T45929: OpenSubdiv was doing extra object recalc tags
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 4 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph.cc | 14 |
3 files changed, 17 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 1e286b345ca..0d74c3507b4 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1143,9 +1143,12 @@ void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel if ((rel & DAG_RL_DATA_DATA) != 0) { if (fob1->type == ID_OB) { if ((fob1->eval_flags & DAG_EVAL_NEED_CPU) == 0) { - Object *object = fob1->ob; - /* Make sure object has all the data on CPU. */ - object->recalc |= OB_RECALC_DATA; + Object *ob2 = fob2->ob; + if (ob2->recalc & OB_RECALC_ALL) { + /* Make sure object has all the data on CPU. */ + Object *ob1 = fob1->ob; + ob1->recalc |= OB_RECALC_DATA; + } fob1->eval_flags |= DAG_EVAL_NEED_CPU; } } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index cccdbff4c9a..f114856e175 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1587,7 +1587,9 @@ static void scene_free_unused_opensubdiv_cache(Scene *scene) if (md != NULL && md->type == eModifierType_Subsurf) { SubsurfModifierData *smd = (SubsurfModifierData *) md; bool object_in_editmode = object->mode == OB_MODE_EDIT; - if (!smd->use_opensubdiv) { + if (!smd->use_opensubdiv || + DAG_get_eval_flags_for_object(scene, object) & DAG_EVAL_NEED_CPU) + { if (smd->mCache != NULL) { ccgSubSurf_free_osd_mesh(smd->mCache); } diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index a2c17b0fc8c..d9d94d6d47e 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -356,13 +356,15 @@ DepsRelation *Depsgraph::add_new_relation(OperationDepsNode *from, DepsRelation *rel = OBJECT_GUARDED_NEW(DepsRelation, from, to, type, description); /* TODO(sergey): Find a better place for this. */ #ifdef WITH_OPENSUBDIV - if (type == DEPSREL_TYPE_GEOMETRY_EVAL) { + ComponentDepsNode *comp_node = from->owner; + if (comp_node->type == DEPSNODE_TYPE_GEOMETRY) { IDDepsNode *id_to = to->owner->owner; - IDDepsNode *id_from = to->owner->owner; - if (id_to != id_from) { - if ((id_to->eval_flags & DAG_EVAL_NEED_CPU) == 0) { - id_to->tag_update(this); - id_to->eval_flags |= DAG_EVAL_NEED_CPU; + IDDepsNode *id_from = from->owner->owner; + Object *object_to = (Object *)id_to->id; + if (id_to != id_from && (object_to->recalc & OB_RECALC_ALL)) { + if ((id_from->eval_flags & DAG_EVAL_NEED_CPU) == 0) { + id_from->tag_update(this); + id_from->eval_flags |= DAG_EVAL_NEED_CPU; } } } |