[Bf-blender-cvs] [6bac7c35e8b] blender2.8: Merge branch 'master' into blender2.8
Sergey Sharybin
noreply at git.blender.org
Thu Feb 22 10:48:26 CET 2018
Commit: 6bac7c35e8bbed490d5db1af7758516eca0e919c
Author: Sergey Sharybin
Date: Thu Feb 22 10:47:40 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB6bac7c35e8bbed490d5db1af7758516eca0e919c
Merge branch 'master' into blender2.8
===================================================================
===================================================================
diff --cc source/blender/depsgraph/intern/depsgraph_build.cc
index 377f2d3b4c5,1b270e71d64..c7f53b51374
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@@ -32,16 -32,11 +32,12 @@@
#include "MEM_guardedalloc.h"
- // #define DEBUG_TIME
-
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
+#include "BLI_listbase.h"
- #ifdef DEBUG_TIME
- # include "PIL_time.h"
- # include "PIL_time_utildefines.h"
- #endif
+ #include "PIL_time.h"
+ #include "PIL_time_utildefines.h"
extern "C" {
#include "DNA_cachefile_types.h"
@@@ -194,28 -188,20 +190,29 @@@ void DEG_add_special_eval_flag(Depsgrap
/* ******************** */
/* Graph Building API's */
-/* Build depsgraph for the given scene, and dump results in given
+/* Build depsgraph for the given scene layer, and dump results in given
* graph container.
*/
-/* XXX: assume that this is called from outside, given the current scene as
- * the "main" scene.
- */
-void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene)
+void DEG_graph_build_from_view_layer(Depsgraph *graph,
+ Main *bmain,
+ Scene *scene,
+ ViewLayer *view_layer)
{
- #ifdef DEBUG_TIME
- TIMEIT_START(DEG_graph_build_from_view_layer);
- #endif
+ double start_time;
+ if (G.debug & G_DEBUG_DEPSGRAPH_BUILD) {
+ start_time = PIL_check_seconds_timer();
+ }
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
+ BLI_assert(BLI_findindex(&scene->view_layers, view_layer) != -1);
+
+ /* TODO(sergey): This is a bit tricky, but ensures that all the data
+ * is evaluated properly when depsgraph is becoming "visible".
+ *
+ * This now could happen for both visible scene is changed and extra
+ * dependency graph was created for render engine.
+ */
+ const bool need_on_visible_update = (deg_graph->id_nodes.size() == 0);
/* 1) Generate all the nodes in the graph first */
DEG::DepsgraphNodeBuilder node_builder(bmain, deg_graph);
@@@ -257,16 -237,10 +254,17 @@@
}
#endif
- #ifdef DEBUG_TIME
- TIMEIT_END(DEG_graph_build_from_view_layer);
- #endif
-
+ /* Relations are up to date. */
+ deg_graph->need_update = false;
+
+ if (need_on_visible_update) {
+ DEG_graph_on_visible_update(bmain, graph);
+ }
++
+ if (G.debug & G_DEBUG_DEPSGRAPH_BUILD) {
+ printf("Depsgraph built in %f seconds.\n",
+ PIL_check_seconds_timer() - start_time);
+ }
}
/* Tag graph relations for update. */
@@@ -287,23 -280,34 +285,23 @@@ void DEG_graph_relations_update(Depsgra
/* Graph is up to date, nothing to do. */
return;
}
-
- /* Clear all previous nodes and operations. */
- graph->clear_all_nodes();
- graph->operations.clear();
- BLI_gset_clear(graph->entry_tags, NULL);
-
- /* Build new nodes and relations. */
- DEG_graph_build_from_scene(reinterpret_cast< ::Depsgraph * >(graph),
- bmain,
- scene);
-
- graph->need_update = false;
-}
-
-/* Rebuild dependency graph only for a given scene. */
-void DEG_scene_relations_rebuild(Main *bmain, Scene *scene)
-{
- if (scene->depsgraph != NULL) {
- DEG_graph_tag_relations_update(scene->depsgraph);
- }
- DEG_scene_relations_update(bmain, scene);
+ DEG_graph_build_from_view_layer(graph, bmain, scene, view_layer);
}
-void DEG_scene_graph_free(Scene *scene)
+/* Tag all relations for update. */
+void DEG_relations_tag_update(Main *bmain)
{
- DEG_DEBUG_PRINTF("%s: Tagging relations for update.\n", __func__);
- if (scene->depsgraph) {
- DEG_graph_free(scene->depsgraph);
- scene->depsgraph = NULL;
++ DEG_DEBUG_PRINTF(TAG, "%s: Tagging relations for update.\n", __func__);
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scene) {
+ LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
+ Depsgraph *depsgraph =
+ (Depsgraph *)BKE_scene_get_depsgraph(scene,
+ view_layer,
+ false);
+ if (depsgraph != NULL) {
+ DEG_graph_tag_relations_update(depsgraph);
+ }
+ }
}
}
@@@ -340,43 -345,40 +338,39 @@@ void DEG_add_forcefield_relations(DepsN
int skip_forcefield,
const char *name)
{
- ListBase *effectors = pdInitEffectors(scene, object, NULL, effector_weights, false);
+ ListBase *effectors = pdInitEffectors(NULL, scene, object, NULL, effector_weights, false);
-
- if (effectors) {
- for (EffectorCache *eff = (EffectorCache*)effectors->first; eff; eff = eff->next) {
- if (eff->ob != object && eff->pd->forcefield != skip_forcefield) {
- DEG_add_object_relation(handle, eff->ob, DEG_OB_COMP_TRANSFORM, name);
-
- if (eff->psys) {
- DEG_add_object_relation(handle, eff->ob, DEG_OB_COMP_EVAL_PARTICLES, name);
-
- /* TODO: remove this when/if EVAL_PARTICLES is sufficient
- * for up to date particles.
- */
- DEG_add_object_relation(handle, eff->ob, DEG_OB_COMP_GEOMETRY, name);
- }
-
- if (eff->pd->forcefield == PFIELD_SMOKEFLOW && eff->pd->f_source) {
- DEG_add_object_relation(handle,
- eff->pd->f_source,
- DEG_OB_COMP_TRANSFORM,
- "Smoke Force Domain");
- DEG_add_object_relation(handle,
- eff->pd->f_source,
- DEG_OB_COMP_GEOMETRY,
- "Smoke Force Domain");
- }
-
- if (add_absorption && (eff->pd->flag & PFIELD_VISIBILITY)) {
- DEG_add_collision_relations(handle,
- scene,
- object,
- NULL,
- eModifierType_Collision,
- NULL,
- true,
- "Force Absorption");
- }
+ if (effectors == NULL) {
+ return;
+ }
+ for (EffectorCache *eff = (EffectorCache*)effectors->first; eff; eff = eff->next) {
+ if (eff->ob != object && eff->pd->forcefield != skip_forcefield) {
+ DEG_add_object_relation(handle, eff->ob, DEG_OB_COMP_TRANSFORM, name);
+ if (eff->psys) {
+ DEG_add_object_relation(handle, eff->ob, DEG_OB_COMP_EVAL_PARTICLES, name);
+ /* TODO: remove this when/if EVAL_PARTICLES is sufficient
+ * for up to date particles.
+ */
+ DEG_add_object_relation(handle, eff->ob, DEG_OB_COMP_GEOMETRY, name);
+ }
+ if (eff->pd->forcefield == PFIELD_SMOKEFLOW && eff->pd->f_source) {
+ DEG_add_object_relation(handle,
+ eff->pd->f_source,
+ DEG_OB_COMP_TRANSFORM,
+ "Smoke Force Domain");
+ DEG_add_object_relation(handle,
+ eff->pd->f_source,
+ DEG_OB_COMP_GEOMETRY,
+ "Smoke Force Domain");
+ }
+ if (add_absorption && (eff->pd->flag & PFIELD_VISIBILITY)) {
+ DEG_add_collision_relations(handle,
+ scene,
+ object,
+ NULL,
- eff->ob->lay,
+ eModifierType_Collision,
+ NULL,
+ true,
+ "Force Absorption");
}
}
}
diff --cc source/blender/depsgraph/intern/depsgraph_intern.h
index 256b52a78f3,2ac97c53db7..e310608b25e
--- a/source/blender/depsgraph/intern/depsgraph_intern.h
+++ b/source/blender/depsgraph/intern/depsgraph_intern.h
@@@ -106,24 -105,15 +106,23 @@@ DepsNodeFactory *deg_type_get_factory(c
/* Editors Integration -------------------------------------------------- */
-void deg_editors_id_update(struct Main *bmain, struct ID *id);
+void deg_editors_id_update(const DEGEditorUpdateContext *update_ctx,
+ struct ID *id);
-void deg_editors_scene_update(struct Main *bmain, struct Scene *scene, bool updated);
+void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx,
+ bool updated);
- #define DEG_DEBUG_PRINTF(...) \
- do { \
- if (G.debug & G_DEBUG_DEPSGRAPH_BUILD) { \
- fprintf(stderr, __VA_ARGS__); \
- fflush(stderr); \
- } \
+ #define DEG_DEBUG_PRINTF(type, ...) \
+ do { \
+ if (G.debug & G_DEBUG_DEPSGRAPH_ ## type) { \
+ fprintf(stderr, __VA_ARGS__); \
+ } \
} while (0)
+#define DEG_ERROR_PRINTF(...) \
+ do { \
+ fprintf(stderr, __VA_ARGS__); \
+ fflush(stderr); \
+ } while (0)
+
} // namespace DEG
diff --cc source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index b4e1c2f4e1a,4033e1325e6..8be8a4b31ba
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@@ -228,34 -244,12 +228,34 @@@ void flush_editors_id_update(Main *bmai
if (id_node->done != ID_STATE_MODIFIED) {
continue;
}
+ DEG_id_type_tag(bmain, GS(id_node->id_orig->name));
/* TODO(sergey): Do we need to pass original or evaluated ID here? */
- ID *id = id_node->id;
- deg_editors_id_update(bmain, id);
- lib_id_recalc_tag(bmain, id);
- /* TODO(sergey): For until we've got proper data nodes in the graph. */
- lib_id_recalc_data_tag(bmain, id);
+ ID *id_orig = id_node->id_orig;
+ ID *id_cow = id_node->id_cow;
+ /* Copy tag from original data to CoW storage.
+ * This is because DEG_id_tag_update() sets tags on original
+ * data.
+ */
+ id_cow->recalc |= (id_orig->recalc & ID_RECALC_ALL);
+ /* Gather recalc flags from all changed components. */
+ GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, id_node->components)
+ {
+ if (comp_node->done != COMPONE
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list