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

Sergey Sharybin noreply at git.blender.org
Thu Nov 9 11:01:08 CET 2017


Commit: c99481b6320a77e4793c812403f7d37dfc2d5ced
Author: Sergey Sharybin
Date:   Thu Nov 9 10:59:15 2017 +0100
Branches: blender2.8
https://developer.blender.org/rBc99481b6320a77e4793c812403f7d37dfc2d5ced

Merge branch 'master' into blender2.8

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



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

diff --cc source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 0c1a3d21f84,7ac94141f39..58c9b6f10ca
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@@ -128,7 -126,7 +127,7 @@@ static void modifier_walk(void *user_da
  {
  	BuilderWalkUserData *data = (BuilderWalkUserData *)user_data;
  	if (*obpoin) {
- 		data->builder->build_object(data->scene, *obpoin, DEG_ID_LINKED_INDIRECTLY);
 -		data->builder->build_object(NULL, *obpoin);
++		data->builder->build_object(*obpoin, DEG_ID_LINKED_INDIRECTLY);
  	}
  }
  
@@@ -141,7 -139,7 +140,7 @@@ void constraint_walk(bConstraint * /*co
  	if (*idpoin) {
  		ID *id = *idpoin;
  		if (GS(id->name) == ID_OB) {
- 			data->builder->build_object(data->scene, (Object *)id, DEG_ID_LINKED_INDIRECTLY);
 -			data->builder->build_object(NULL, (Object *)id);
++			data->builder->build_object((Object *)id, DEG_ID_LINKED_INDIRECTLY);
  		}
  	}
  }
@@@ -159,53 -151,20 +158,54 @@@ void free_copy_on_write_datablock(void 
  
  /* **** General purpose functions **** */
  
- DepsgraphNodeBuilder::DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph) :
-     m_bmain(bmain),
-     m_graph(graph),
-     m_cow_id_hash(NULL)
+ DepsgraphNodeBuilder::DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph)
+     : bmain_(bmain),
+       graph_(graph),
 -      scene_(NULL)
++      scene_(NULL),
++      cow_id_hash_(NULL)
  {
  }
  
  DepsgraphNodeBuilder::~DepsgraphNodeBuilder()
  {
- 	if (m_cow_id_hash != NULL) {
- 		BLI_ghash_free(m_cow_id_hash, NULL, free_copy_on_write_datablock);
++	if (cow_id_hash_ != NULL) {
++		BLI_ghash_free(cow_id_hash_, NULL, free_copy_on_write_datablock);
 +	}
 +}
 +
 +IDDepsNode *DepsgraphNodeBuilder::add_id_node(ID *id, bool do_tag)
 +{
 +	if (!DEG_depsgraph_use_copy_on_write()) {
- 		return m_graph->add_id_node(id);
++		return graph_->add_id_node(id);
 +	}
 +	IDDepsNode *id_node = NULL;
- 	ID *id_cow = (ID *)BLI_ghash_lookup(m_cow_id_hash, id);
++	ID *id_cow = (ID *)BLI_ghash_lookup(cow_id_hash_, id);
 +	if (id_cow != NULL) {
 +		/* TODO(sergey): Is it possible to lookup and pop element from GHash
 +		 * at the same time?
 +		 */
- 		BLI_ghash_remove(m_cow_id_hash, id, NULL, NULL);
++		BLI_ghash_remove(cow_id_hash_, id, NULL, NULL);
 +	}
- 	id_node = m_graph->add_id_node(id, do_tag, id_cow);
++	id_node = graph_->add_id_node(id, do_tag, id_cow);
 +	/* Currently all ID nodes are supposed to have copy-on-write logic.
 +	 *
 +	 * NOTE: Zero number of components indicates that ID node was just created.
 +	 */
 +	if (BLI_ghash_size(id_node->components) == 0) {
 +		ComponentDepsNode *comp_cow =
 +		        id_node->add_component(DEG_NODE_TYPE_COPY_ON_WRITE);
 +		OperationDepsNode *op_cow = comp_cow->add_operation(
- 		    function_bind(deg_evaluate_copy_on_write, _1, m_graph, id_node),
- 		    DEG_OPCODE_COPY_ON_WRITE,
- 		    "", -1);
- 		m_graph->operations.push_back(op_cow);
++		        function_bind(deg_evaluate_copy_on_write, _1, graph_, id_node),
++		        DEG_OPCODE_COPY_ON_WRITE,
++		        "", -1);
++		graph_->operations.push_back(op_cow);
 +	}
 +	return id_node;
  }
  
 -IDDepsNode *DepsgraphNodeBuilder::add_id_node(ID *id)
 +IDDepsNode *DepsgraphNodeBuilder::find_id_node(ID *id)
  {
- 	return m_graph->find_id_node(id);
 -	return graph_->add_id_node(id, id->name);
++	return graph_->find_id_node(id);
  }
  
  TimeSourceDepsNode *DepsgraphNodeBuilder::add_time_source()
@@@ -316,35 -275,9 +316,35 @@@ OperationDepsNode *DepsgraphNodeBuilder
  	return find_operation_node(id, comp_type, "", opcode, name, name_tag);
  }
  
 +ID *DepsgraphNodeBuilder::get_cow_id(const ID *id_orig) const
 +{
- 	return m_graph->get_cow_id(id_orig);
++	return graph_->get_cow_id(id_orig);
 +}
 +
 +ID *DepsgraphNodeBuilder::ensure_cow_id(ID *id_orig)
 +{
 +	if (id_orig->tag & LIB_TAG_COPY_ON_WRITE) {
 +		/* ID is already remapped to copy-on-write. */
 +		return id_orig;
 +	}
 +	IDDepsNode *id_node = add_id_node(id_orig, false);
 +	return id_node->id_cow;
 +}
 +
 +ID *DepsgraphNodeBuilder::expand_cow_id(IDDepsNode *id_node)
 +{
- 	return deg_expand_copy_on_write_datablock(m_graph, id_node, this, true);
++	return deg_expand_copy_on_write_datablock(graph_, id_node, this, true);
 +}
 +
 +ID *DepsgraphNodeBuilder::expand_cow_id(ID *id_orig)
 +{
 +	IDDepsNode *id_node = add_id_node(id_orig);
 +	return expand_cow_id(id_node);
 +}
 +
  /* **** Build functions for entity nodes **** */
  
- void DepsgraphNodeBuilder::begin_build(Main *bmain) {
+ void DepsgraphNodeBuilder::begin_build() {
  	/* LIB_TAG_DOIT is used to indicate whether node for given ID was already
  	 * created or not. This flag is being set in add_id_node(), so functions
  	 * shouldn't bother with setting it, they only might query this flag when
@@@ -361,32 -294,9 +361,32 @@@
  		}
  	}
  	FOREACH_NODETREE_END;
 +
 +	if (DEG_depsgraph_use_copy_on_write()) {
 +		/* Store existing copy-on-write versions of datablock, so we can re-use
 +		 * them for new ID nodes.
 +		 */
- 		m_cow_id_hash = BLI_ghash_ptr_new("Depsgraph id hash");
- 		foreach (IDDepsNode *id_node, m_graph->id_nodes) {
++		cow_id_hash_ = BLI_ghash_ptr_new("Depsgraph id hash");
++		foreach (IDDepsNode *id_node, graph_->id_nodes) {
 +			if (GS(id_node->id_orig->name) != ID_SCE) {
 +				continue;
 +			}
 +			if (deg_copy_on_write_is_expanded(id_node->id_cow)) {
- 				BLI_ghash_insert(m_cow_id_hash,
++				BLI_ghash_insert(cow_id_hash_,
 +				                 id_node->id_orig,
 +				                 id_node->id_cow);
 +				id_node->id_cow = NULL;
 +			}
 +		}
 +	}
 +
 +	/* Make sure graph has no nodes left from previous state. */
- 	m_graph->clear_all_nodes();
- 	m_graph->operations.clear();
- 	BLI_gset_clear(m_graph->entry_tags, NULL);
++	graph_->clear_all_nodes();
++	graph_->operations.clear();
++	BLI_gset_clear(graph_->entry_tags, NULL);
  }
  
- void DepsgraphNodeBuilder::build_group(Scene *scene, Group *group)
 -void DepsgraphNodeBuilder::build_group(Base *base, Group *group)
++void DepsgraphNodeBuilder::build_group(Group *group)
  {
  	ID *group_id = &group->id;
  	if (group_id->tag & LIB_TAG_DOIT) {
@@@ -395,18 -305,32 +395,17 @@@
  	group_id->tag |= LIB_TAG_DOIT;
  
  	LINKLIST_FOREACH (GroupObject *, go, &group->gobject) {
- 		build_object(scene, go->ob, DEG_ID_LINKED_INDIRECTLY);
 -		build_object(base, go->ob);
++		build_object(go->ob, DEG_ID_LINKED_INDIRECTLY);
  	}
  }
  
- void DepsgraphNodeBuilder::build_object(Scene *scene,
-                                         Object *ob,
 -void DepsgraphNodeBuilder::build_object(Base *base, Object *ob)
++void DepsgraphNodeBuilder::build_object(Object *ob,
 +                                        eDepsNode_LinkedState_Type linked_state)
  {
 -	const bool has_object = (ob->id.tag & LIB_TAG_DOIT);
 -	IDDepsNode *id_node = (has_object)
 -	        ? graph_->find_id_node(&ob->id)
 -	        : add_id_node(&ob->id);
 -	/* Update node layers.
 -	 * Do it for both new and existing ID nodes. This is so because several
 -	 * bases might be sharing same object.
 -	 */
 -	if (base != NULL) {
 -		id_node->layers |= base->lay;
 -	}
 -	if (ob->type == OB_CAMERA) {
 -		/* Camera should always be updated, it used directly by viewport.
 -		 *
 -		 * TODO(sergey): Make it only for active scene camera.
 -		 */
 -		id_node->layers |= (unsigned int)(-1);
 -	}
  	/* Skip rest of components if the ID node was already there. */
 -	if (has_object) {
 +	if (ob->id.tag & LIB_TAG_DOIT) {
 +		IDDepsNode *id_node = find_id_node(&ob->id);
 +		id_node->linked_state = std::max(id_node->linked_state, linked_state);
  		return;
  	}
  	ob->id.tag |= LIB_TAG_DOIT;
@@@ -418,10 -337,10 +417,10 @@@
  	ob->customdata_mask = 0;
  
  	/* Standard components. */
- 	build_object_transform(scene, ob);
+ 	build_object_transform(ob);
  
  	if (ob->parent != NULL) {
- 		build_object(scene, ob->parent, linked_state);
 -		build_object(NULL, ob->parent);
++		build_object(ob->parent, linked_state);
  	}
  	if (ob->modifiers.first != NULL) {
  		BuilderWalkUserData data;
@@@ -511,20 -424,18 +508,20 @@@
  	/* Object that this is a proxy for. */
  	if (ob->proxy) {
  		ob->proxy->proxy_from = ob;
- 		build_object(scene, ob->proxy, DEG_ID_LINKED_INDIRECTLY);
 -		build_object(base, ob->proxy);
++		build_object(ob->proxy, DEG_ID_LINKED_INDIRECTLY);
  	}
  
  	/* Object dupligroup. */
  	if (ob->dup_group != NULL) {
- 		build_group(scene, ob->dup_group);
 -		build_group(base, ob->dup_group);
++		build_group(ob->dup_group);
  	}
  }
  
- void DepsgraphNodeBuilder::build_object_transform(Scene *scene, Object *ob)
+ void DepsgraphNodeBuilder::build_object_transform(Object *ob)
  {
  	OperationDepsNode *op_node;
- 	Scene *scene_cow = get_cow_datablock(scene);
++	Scene *scene_cow = get_cow_datablock(scene_);
 +	Object *ob_cow = get_cow_datablock(ob);
  
  	/* local transforms (from transform channels - loc/rot/scale + deltas) */
  	op_node = add_operation_node(&ob->id, DEG_NODE_TYPE_TRANSFORM,
@@@ -544,15 -451,19 +541,15 @@@
  	}
  
  	/* object constraints */
 -	if (ob->constraints.first) {
 +	if (ob->constraints.first != NULL) {
- 		build_object_constraints(scene, ob);
+ 		build_object_constraints(ob);
  	}
  
 -	/* Temporary uber-update node, which does everything.
 -	 * It is for the being we're porting old dependencies into the new system.
 -	 * We'll get rid of this node as soon as all the granular update functions
 -	 * are filled in.
 -	 *
 -	 * TODO(sergey): Get rid of this node.
 -	 */
 +	/* Rest of transformation update. */
  	add_operation_node(&ob->id, DEG_NODE_TYPE_TRANSFORM,
 -	                   function_bind(BKE_object_eval_uber_transform, _1, scene_, ob),
 +	                   function_bind(BKE_object_eval_uber_transform,
 +	                                 _1,
 +	                                 scene_cow, ob_cow),
  	                   DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL);
  
  	/* object transform is done */
@@@ -583,9 -494,7 +580,9 @@@ void DepsgraphNodeBuilder::build_object
  {
  	/* create node for constraint stack */
  	add_operation_node(&ob->id, DEG_NODE_TYPE_TRANSFORM,
 -	                   function_bind(BKE_object_eval_constraints, _1, scene_, ob),
 +	                   function_bind(BKE_object_eval_c

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list