Commit: ced2f3f30e8ce2baad5ec9f427803c40011f6642 Author: Sergey Sharybin Date: Thu Nov 30 11:59:28 2017 +0100 Branches: blender2.8 https://developer.blender.org/rBced2f3f30e8ce2baad5ec9f427803c40011f6642
Merge branch 'master' into blender2.8 =================================================================== =================================================================== diff --cc source/blender/depsgraph/DEG_depsgraph.h index b95fea24053,9349b189e7b..6bcbff4950b --- a/source/blender/depsgraph/DEG_depsgraph.h +++ b/source/blender/depsgraph/DEG_depsgraph.h @@@ -139,52 -107,24 +139,51 @@@ void DEG_graph_on_visible_update(struc /* Update all dependency graphs when visible scenes/layers changes. */ void DEG_on_visible_update(struct Main *bmain, const bool do_time); -/* Tag node(s) associated with changed data for later updates */ -void DEG_graph_id_tag_update(struct Main *bmain, - Depsgraph *graph, - struct ID *id); -void DEG_graph_data_tag_update(Depsgraph *graph, const struct PointerRNA *ptr); -void DEG_graph_property_tag_update(Depsgraph *graph, const struct PointerRNA *ptr, const struct PropertyRNA *prop); - /* Tag given ID for an update in all the dependency graphs. */ -void DEG_id_tag_update(struct ID *id, short flag); -void DEG_id_tag_update_ex(struct Main *bmain, - struct ID *id, - short flag); +enum { + /* Object transformation changed, corresponds to OB_RECALC_OB. */ + DEG_TAG_TRANSFORM = (1 << 0), + + /* Object geoemtry changed, corresponds to OB_RECALC_DATA. */ + DEG_TAG_GEOMETRY = (1 << 1), + + /* Time changed and animation is to be re-evaluated, OB_RECALC_TIME. */ + DEG_TAG_TIME = (1 << 2), + + /* Particle system changed. */ + DEG_TAG_PSYSC_REDO = (1 << 3), + DEG_TAG_PSYS_RESET = (1 << 4), + DEG_TAG_PSYS_TYPE = (1 << 5), + DEG_TAG_PSYS_CHILD = (1 << 6), + DEG_TAG_PSYS_PHYS = (1 << 7), + DEG_TAG_PSYS = ((1 << 3) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7)), + + /* Update copy on write component without flushing down the road. */ + DEG_TAG_COPY_ON_WRITE = (1 << 8), + + /* Tag shading components for update. + * Only parameters of material changed). + */ + DEG_TAG_SHADING_UPDATE = (1 << 9), + DEG_TAG_SELECT_UPDATE = (1 << 10), + DEG_TAG_BASE_FLAGS_UPDATE = (1 << 11), + + /* Only inform editors about the change. Don't modify datablock itself. */ + DEG_TAG_EDITORS_UPDATE = (1 << 12), +}; +void DEG_id_tag_update(struct ID *id, int flag); +void DEG_id_tag_update_ex(struct Main *bmain, struct ID *id, int flag); + +void DEG_graph_id_tag_update(struct Main *bmain, + struct Depsgraph *depsgraph, + struct ID *id, + int flag); - /* Tag given ID type for update. - * - * Used by all sort of render engines to quickly check if - * IDs of a given type need to be checked for update. + /* Mark a particular datablock type as having changing. This does + * not cause any updates but is used by external render engines to detect if for + * example a datablock was removed. */ -void DEG_id_type_tag(struct Main *bmain, short idtype); +void DEG_id_type_tag(struct Main *bmain, short id_type); void DEG_ids_clear_recalc(struct Main *bmain); diff --cc source/blender/depsgraph/intern/depsgraph_tag.cc index 89e90e70a68,3d63e570eb8..c2711eb3f15 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@@ -454,74 -241,20 +454,74 @@@ void deg_id_tag_update(Main *bmain, ID } } } +} -#ifdef DEPSGRAPH_USE_LEGACY_TAGGING - /* Special handling from the legacy depsgraph. - * TODO(sergey): Need to get rid of those once all the areas - * are re-formulated in terms of franular nodes. - */ - depsgraph_legacy_handle_update_tag(bmain, id, flag); -#endif +void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph) +{ + /* Make sure objects are up to date. */ + foreach (DEG::IDDepsNode *id_node, graph->id_nodes) { + const ID_Type id_type = GS(id_node->id_orig->name); + /* TODO(sergey): Special exception for now. */ + if (id_type == ID_MSK) { + deg_graph_id_tag_update(bmain, graph, id_node->id_orig, 0); + } + if (id_type != ID_OB) { + /* Ignore non-object nodes on visibility changes. */ + continue; + } + int flag = 0; + /* We only tag components which needs an update. Tagging everything is + * not a good idea because that might reset particles cache (or any + * other type of cache). + * + * TODO(sergey): Need to generalize this somehow. + */ + if (id_type == ID_OB) { + flag |= OB_RECALC_OB | OB_RECALC_DATA | DEG_TAG_COPY_ON_WRITE; + } + deg_graph_id_tag_update(bmain, graph, id_node->id_orig, flag); + } + /* Make sure collection properties are up to date. */ + for (Scene *scene_iter = graph->scene; scene_iter != NULL; scene_iter = scene_iter->set) { + IDDepsNode *scene_id_node = graph->find_id_node(&scene_iter->id); + BLI_assert(scene_id_node != NULL); + scene_id_node->tag_update(graph); + } +} + +} /* namespace */ + +} // namespace DEG + +/* Tag given ID for an update in all the dependency graphs. */ +void DEG_id_tag_update(ID *id, int flag) +{ + DEG_id_tag_update_ex(G.main, id, flag); +} + +void DEG_id_tag_update_ex(Main *bmain, ID *id, int flag) +{ + if (id == NULL) { + /* Ideally should not happen, but old depsgraph allowed this. */ + return; + } + DEG_DEBUG_PRINTF("%s: id=%s flag=%d\n", __func__, id->name, flag); + DEG::deg_id_tag_update(bmain, id, flag); +} + +void DEG_graph_id_tag_update(struct Main *bmain, + struct Depsgraph *depsgraph, + struct ID *id, + int flag) +{ + DEG::Depsgraph *graph = (DEG::Depsgraph *)depsgraph; + DEG::deg_graph_id_tag_update(bmain, graph, id, flag); } - /* Tag given ID type for update. */ + /* Mark a particular datablock type as having changing. */ -void DEG_id_type_tag(Main *bmain, short idtype) +void DEG_id_type_tag(Main *bmain, short id_type) { - if (idtype == ID_NT) { + if (id_type == ID_NT) { /* Stupid workaround so parent datablocks of nested nodetree get looped * over when we loop over tagged datablock types. */ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs