Commit: 08fe885d06a011e2d1613be7e3a41b56a8b0e880 Author: Campbell Barton Date: Fri Jan 19 21:44:03 2018 +1100 Branches: blender2.8 https://developer.blender.org/rB08fe885d06a011e2d1613be7e3a41b56a8b0e880
Merge branch 'master' into blender2.8 =================================================================== =================================================================== diff --cc source/blender/blenkernel/intern/group.c index 8295fafba56,6dc8cc5aff1..ca6d92efa80 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@@ -369,45 -367,12 +369,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.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) { ++ BLI_LISTBASE_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/depsgraph/intern/builder/deg_builder_nodes.cc index 3502ca69414,8d20a671202..ddae761cea0 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@@ -428,40 -304,34 +428,40 @@@ void DepsgraphNodeBuilder::build_group( return; } group_id->tag |= LIB_TAG_DOIT; - - BLI_LISTBASE_FOREACH (GroupObject *, go, &group->gobject) { - build_object(base, go->ob); + /* Build group objects. */ - LINKLIST_FOREACH(Base *, base, &group->view_layer->object_bases) { ++ BLI_LISTBASE_FOREACH (Base *, base, &group->view_layer->object_bases) { + build_object(NULL, base->object, DEG_ID_LINKED_INDIRECTLY); } + /* Operation to evaluate the whole view layer. + * + * NOTE: We re-use DONE opcode even though the function does everything. + * This way we wouldn't need to worry about possible relations from DONE, + * regardless whether it's a group or scene or something else. + */ + add_id_node(group_id); + Group *group_cow = get_cow_datablock(group); + add_operation_node(group_id, + DEG_NODE_TYPE_LAYER_COLLECTIONS, + function_bind(BKE_group_eval_view_layers, + _1, + group_cow), + DEG_OPCODE_VIEW_LAYER_DONE); } -void DepsgraphNodeBuilder::build_object(Base *base, Object *object) +void DepsgraphNodeBuilder::build_object(Base *base, + Object *object, + eDepsNode_LinkedState_Type linked_state) { - const bool has_object = (object->id.tag & LIB_TAG_DOIT); - IDDepsNode *id_node = (has_object) - ? graph_->find_id_node(&object->id) - : add_id_node(&object->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 (object->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 (object->id.tag & LIB_TAG_DOIT) { + IDDepsNode *id_node = find_id_node(&object->id); + /* We need to build some extra stuff if object becomes linked + * directly. + */ + if (id_node->linked_state == DEG_ID_LINKED_INDIRECTLY) { + build_object_flags(base, object, linked_state); + } + id_node->linked_state = max(id_node->linked_state, linked_state); return; } object->id.tag |= LIB_TAG_DOIT; @@@ -815,10 -627,11 +815,10 @@@ void DepsgraphNodeBuilder::build_rigidb sim_node->owner->entry_operation = sim_node; sim_node->owner->exit_operation = sim_node; - /* objects - simulation participants */ if (rbw->group) { - LINKLIST_FOREACH (Base *, base, &rbw->group->view_layer->object_bases) { - BLI_LISTBASE_FOREACH (GroupObject *, go, &rbw->group->gobject) { - Object *object = go->ob; ++ BLI_LISTBASE_FOREACH (Base *, base, &rbw->group->view_layer->object_bases) { + Object *object = base->object; if (!object || (object->type != OB_MESH)) continue; @@@ -870,24 -674,15 +870,24 @@@ void DepsgraphNodeBuilder::build_partic DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT); /* particle systems */ - LINKLIST_FOREACH (ParticleSystem *, psys, &object->particlesystem) { + BLI_LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) { ParticleSettings *part = psys->part; - /* particle settings */ - // XXX: what if this is used more than once! - build_animdata(&part->id); + /* Build particle settings operations. + * + * NOTE: The call itself ensures settings are only build once. + */ + build_particle_settings(part); + + /* Update on particle settings change. */ + add_operation_node(psys_comp, + function_bind(BKE_particle_system_settings_eval, + _1, + psys), + DEG_OPCODE_PARTICLE_SETTINGS_EVAL, + psys->name); - /* this particle system */ - // TODO: for now, this will just be a placeholder "ubereval" node + /* Particle system evaluation. */ add_operation_node(psys_comp, NULL, DEG_OPCODE_PARTICLE_SYSTEM_EVAL, @@@ -1206,32 -945,24 +1206,32 @@@ void DepsgraphNodeBuilder::build_lamp(O void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree) { - if (!ntree) + if (ntree == NULL) { return; - + } /* nodetree itself */ ID *ntree_id = &ntree->id; - OperationDepsNode *op_node; - + add_id_node(ntree_id); + bNodeTree *ntree_cow = get_cow_datablock(ntree); + /* Animation, */ build_animdata(ntree_id); - - /* Parameters for drivers. */ - op_node = add_operation_node(ntree_id, - DEG_NODE_TYPE_PARAMETERS, - NULL, - DEG_OPCODE_PARAMETERS_EVAL); - op_node->set_as_exit(); - + /* Shading update. */ + add_operation_node(ntree_id, + DEG_NODE_TYPE_SHADING, + NULL, + DEG_OPCODE_MATERIAL_UPDATE); + /* NOTE: We really pass original and CoW node trees here, this is how the + * callback works. Ideally we need to find a better way for that. + */ + add_operation_node(ntree_id, + DEG_NODE_TYPE_SHADING_PARAMETERS, + function_bind(BKE_nodetree_shading_params_eval, + _1, + ntree_cow, + ntree), + DEG_OPCODE_MATERIAL_UPDATE); /* nodetree's nodes... */ - LINKLIST_FOREACH (bNode *, bnode, &ntree->nodes) { + BLI_LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) { ID *id = bnode->id; if (id == NULL) { continue; diff --cc source/blender/depsgraph/intern/builder/deg_builder_nodes_layer_collection.cc index 79316e47022,00000000000..137a79e7276 mode 100644,000000..100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer_collection.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer_collection.cc @@@ -1,126 -1,0 +1,126 @@@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2013 Blender Foundation. + * All rights reserved. + * + * Original Author: Joshua Leung + * Contributor(s): Based on original depsgraph.c code - Blender Foundation (2005-2013) + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/depsgraph/intern/builder/deg_builder_nodes_layer_collection.cc + * \ingroup depsgraph + * + * Methods for constructing depsgraph's nodes + */ + +#include "intern/builder/deg_builder_nodes.h" + +#include <stdio.h> +#include <stdlib.h> + +#include "MEM_guardedalloc.h" + +extern "C" { +#include "BLI_utildefines.h" +#include "BLI_listbase.h" +#include "BLI_string.h" + +#include "BKE_layer.h" + +#include "DNA_scene_types.h" + +#include "DEG_depsgraph.h" +#include "DEG_depsgraph @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs