[Bf-blender-cvs] [f4140f2c813] blender2.8: Merge branch 'master' into blender2.8

Sergey Sharybin noreply at git.blender.org
Fri Dec 15 10:45:58 CET 2017


Commit: f4140f2c8138ec07ba06376c4d0d70d40fca6fad
Author: Sergey Sharybin
Date:   Fri Dec 15 10:45:20 2017 +0100
Branches: blender2.8
https://developer.blender.org/rBf4140f2c8138ec07ba06376c4d0d70d40fca6fad

Merge branch 'master' into blender2.8

===================================================================



===================================================================

diff --cc source/blender/blenkernel/intern/group.c
index 0394c813a14,6dc8cc5aff1..5b55433c1b9
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@@ -372,45 -367,12 +372,45 @@@ void BKE_group_handle_recalc_and_update
  #endif
  	{
  		/* only do existing tags, as set by regular depsgraph */
 -		for (go = group->gobject.first; go; go = go->next) {
 -			if (go->ob) {
 -				if (go->ob->recalc) {
 -					BKE_object_handle_update(eval_ctx, scene, go->ob);
 -				}
 +		FOREACH_GROUP_OBJECT(group, object)
 +		{
- 			if (object->id.tag & LIB_TAG_ID_RECALC_ALL) {
++			if (object->id.recalc & ID_RECALC_ALL) {
 +				BKE_object_handle_update(eval_ctx, scene, object);
  			}
  		}
 +		FOREACH_GROUP_OBJECT_END
  	}
  }
 +
 +/* ******** Dependency graph evaluation ******** */
 +
 +static void group_eval_layer_collections(
 +        const struct EvaluationContext *eval_ctx,
 +        Group *group,
 +        ListBase *layer_collections,
 +        LayerCollection *parent_layer_collection)
 +{
 +	LINKLIST_FOREACH (LayerCollection *, layer_collection, layer_collections) {
 +		/* Evaluate layer collection itself. */
 +		BKE_layer_eval_layer_collection(eval_ctx,
 +		                                layer_collection,
 +		                                parent_layer_collection);
 +		/* Evaluate nested collections. */
 +		group_eval_layer_collections(eval_ctx,
 +		                             group,
 +		                             &layer_collection->layer_collections,
 +		                             layer_collection);
 +	}
 +}
 +
 +void BKE_group_eval_view_layers(const struct EvaluationContext *eval_ctx,
 +                                Group *group)
 +{
 +	DEBUG_PRINT("%s on %s (%p)\n", __func__, group->id.name, group);
 +	BKE_layer_eval_layer_collection_pre(eval_ctx, &group->id, group->view_layer);
 +	group_eval_layer_collections(eval_ctx,
 +	                             group,
 +	                             &group->view_layer->layer_collections,
 +	                             NULL);
 +	BKE_layer_eval_layer_collection_post(eval_ctx, group->view_layer);
 +}
diff --cc source/blender/blenkernel/intern/object.c
index 717d395fc68,c6b4e3fb0c7..66c87ac7a5c
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@@ -2699,12 -2621,7 +2699,12 @@@ void BKE_object_handle_update_ex(const 
                                   RigidBodyWorld *rbw,
                                   const bool do_proxy_update)
  {
 -	if ((ob->recalc & OB_RECALC_ALL) == 0) {
 +	const ID *object_data = ob->data;
- 	const bool recalc_object = (ob->id.tag & LIB_TAG_ID_RECALC) != 0;
++	const bool recalc_object = (ob->id.recalc & ID_RECALC) != 0;
 +	const bool recalc_data =
- 	        (object_data != NULL) ? ((object_data->tag & LIB_TAG_ID_RECALC_ALL) != 0)
++	        (object_data != NULL) ? ((object_data->recalc & ID_RECALC_ALL) != 0)
 +	                              : 0;
 +	if (!recalc_object && ! recalc_data) {
  		object_handle_update_proxy(eval_ctx, scene, ob, do_proxy_update);
  		return;
  	}
@@@ -2742,7 -2659,7 +2742,7 @@@
  		BKE_object_handle_data_update(eval_ctx, scene, ob);
  	}
  
- 	ob->id.tag &= ~LIB_TAG_ID_RECALC_ALL;
 -	ob->recalc &= ~OB_RECALC_ALL;
++	ob->id.recalc &= ID_RECALC_ALL;
  
  	object_handle_update_proxy(eval_ctx, scene, ob, do_proxy_update);
  }
@@@ -3724,8 -3655,7 +3724,8 @@@ bool BKE_object_modifier_update_subfram
  	}
  
  	/* was originally OB_RECALC_ALL - TODO - which flags are really needed??? */
 -	ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
 +	/* TODO(sergey): What about animation? */
- 	ob->id.tag |= LIB_TAG_ID_RECALC_ALL;
++	ob->id.recalc |= ID_RECALC_ALL;
  	BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, frame, ADT_RECALC_ANIM);
  	if (update_mesh) {
  		/* ignore cache clear during subframe updates
diff --cc source/blender/blenloader/intern/versioning_legacy.c
index 156a6e3d1c0,ad37679800b..39ece4fd143
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@@ -1871,7 -1944,7 +1871,7 @@@ void blo_do_versions_pre250(FileData *f
  					BKE_pose_tag_recalc(main, ob->pose);
  
  				/* cannot call stuff now (pointers!), done in setup_app_data */
- 				ob->id.tag |= LIB_TAG_ID_RECALC_ALL;
 -				ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
++				ob->id.recalc |= ID_RECALC_ALL;
  
  				/* new generic xray option */
  				arm = blo_do_versions_newlibadr(fd, lib, ob->data);
diff --cc source/blender/depsgraph/intern/builder/deg_builder.cc
index 20a93673350,26f729a16d7..1e906d454ac
--- a/source/blender/depsgraph/intern/builder/deg_builder.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder.cc
@@@ -43,25 -50,126 +43,25 @@@
  
  namespace DEG {
  
 -static bool check_object_needs_evaluation(Object *object)
 -{
 -	if (object->recalc & OB_RECALC_ALL) {
 -		/* Object is tagged for update anyway, no need to re-tag it. */
 -		return false;
 -	}
 -	if (object->type == OB_MESH) {
 -		return object->derivedFinal == NULL;
 -	}
 -	else if (ELEM(object->type,
 -	              OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE))
 -	{
 -		return object->curve_cache == NULL;
 -	}
 -	return false;
 -}
 -
 -void deg_graph_build_flush_layers(Depsgraph *graph)
 -{
 -	BLI_Stack *stack = BLI_stack_new(sizeof(OperationDepsNode *),
 -	                                 "DEG flush layers stack");
 -	foreach (OperationDepsNode *node, graph->operations) {
 -		IDDepsNode *id_node = node->owner->owner;
 -		node->done = 0;
 -		node->num_links_pending = 0;
 -		foreach (DepsRelation *rel, node->outlinks) {
 -			if ((rel->from->type == DEG_NODE_TYPE_OPERATION) &&
 -			    (rel->flag & DEPSREL_FLAG_CYCLIC) == 0)
 -			{
 -				++node->num_links_pending;
 -			}
 -		}
 -		if (node->num_links_pending == 0) {
 -			BLI_stack_push(stack, &node);
 -			node->done = 1;
 -		}
 -		node->owner->layers = id_node->layers;
 -		id_node->id->tag |= LIB_TAG_DOIT;
 -	}
 -	while (!BLI_stack_is_empty(stack)) {
 -		OperationDepsNode *node;
 -		BLI_stack_pop(stack, &node);
 -		/* Flush layers to parents. */
 -		foreach (DepsRelation *rel, node->inlinks) {
 -			if (rel->from->type == DEG_NODE_TYPE_OPERATION) {
 -				OperationDepsNode *from = (OperationDepsNode *)rel->from;
 -				from->owner->layers |= node->owner->layers;
 -			}
 -		}
 -		/* Schedule parent nodes. */
 -		foreach (DepsRelation *rel, node->inlinks) {
 -			if (rel->from->type == DEG_NODE_TYPE_OPERATION) {
 -				OperationDepsNode *from = (OperationDepsNode *)rel->from;
 -				if ((rel->flag & DEPSREL_FLAG_CYCLIC) == 0) {
 -					BLI_assert(from->num_links_pending > 0);
 -					--from->num_links_pending;
 -				}
 -				if (from->num_links_pending == 0 && from->done == 0) {
 -					BLI_stack_push(stack, &from);
 -					from->done = 1;
 -				}
 -			}
 -		}
 -	}
 -	BLI_stack_free(stack);
 -}
 -
 -void deg_graph_build_finalize(Depsgraph *graph)
 +void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
  {
 -	/* STEP 1: Make sure new invisible dependencies are ready for use.
 -	 *
 -	 * TODO(sergey): This might do a bit of extra tagging, but it's kinda nice
 -	 * to do it ahead of a time and don't spend time on flushing updates on
 -	 * every frame change.
 -	 */
 -	GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, graph->id_hash)
 -	{
 -		if (id_node->layers == 0) {
 -			ID *id = id_node->id;
 -			if (GS(id->name) == ID_OB) {
 -				Object *object = (Object *)id;
 -				if (check_object_needs_evaluation(object)) {
 -					id_node->tag_update(graph);
 -				}
 -			}
 -		}
 -	}
 -	GHASH_FOREACH_END();
 -	/* STEP 2: Flush visibility layers from children to parent. */
 -	deg_graph_build_flush_layers(graph);
 -	/* STEP 3: Re-tag IDs for update if it was tagged before the relations
 +	const bool use_copy_on_write = DEG_depsgraph_use_copy_on_write();
 +	/* Re-tag IDs for update if it was tagged before the relations
  	 * update tag.
  	 */
 -	GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, graph->id_hash)
 -	{
 -		GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp, id_node->components)
 -		{
 -			id_node->layers |= comp->layers;
 +	foreach (IDDepsNode *id_node, graph->id_nodes) {
 +		ID *id = id_node->id_orig;
 +		id_node->finalize_build(graph);
- 		if ((id->tag & LIB_TAG_ID_RECALC_ALL)) {
++		if ((id->recalc & ID_RECALC_ALL)) {
 +			id_node->tag_update(graph);
  		}
 -		GHASH_FOREACH_END();
 -
 -		if ((id_node->layers & graph->layers) != 0 || graph->layers == 0) {
 -			ID *id = id_node->id;
 -			if ((id->recalc & ID_RECALC_ALL) &&
 -			    (id->tag & LIB_TAG_DOIT))
 -			{
 -				id_node->tag_update(graph);
 -				id->tag &= ~LIB_TAG_DOIT;
 -			}
 -			else if (GS(id->name) == ID_OB) {
 -				Object *object = (Object *)id;
 -				if (object->recalc & OB_RECALC_ALL) {
 -					id_node->tag_update(graph);
 -					id->tag &= ~LIB_TAG_DOIT;
 -				}
 -			}
 +		/* TODO(sergey): This is not ideal at all, since this forces
 +		 * re-evaluaiton of the whole tree.
 +		 */
 +		if (use_copy_on_write) {
 +			DEG_id_tag_update_ex(bmain, id_node->id_orig, DEG_TAG_COPY_ON_WRITE);
  		}
 -		id_node->finalize_build();
  	}
 -	GHASH_FOREACH_END();
  }
  
  }  // namespace DEG
diff --cc source/blender/depsgraph/intern/depsgraph.cc
index 4fea8b49706,dd7284eb629..1227db4c1bb
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@@ -354,7 -312,7 +354,7 @@@ DepsRelation *Depsgraph::add_new_relati
  	if (comp_node->type == DEG_NODE_TYPE_GEOMETRY) {
  		IDDepsNode *id_to = to->owner->owner;
  		IDDepsNode *id_from = from->owner->owner;
- 		if (id_to != id_from && (id_to->id_orig->tag & LIB_TAG_ID_RECALC_ALL)) {
 -		if (id_to != id_from && (id_to->id->recalc & ID_RECALC_ALL)) {
++		if (id_to != id_from && (id_to->id_orig->recalc & ID_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;
diff --cc source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index fecc9a75a14,107bbda1030..c285efd5819
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@@ -66,155 -60,39 +66,155 @@@ enum 
  	COMPONENT_STATE_DONE      = 2,
  };
  
 +typedef std

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list