diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-20 17:16:51 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-25 15:40:06 +0300 |
commit | c0855f77c0768ee60fdeb40c1a8636ce080876c2 (patch) | |
tree | c409204bd34b36d3d2b7b879db88c23b7efc48e8 | |
parent | e7507c16e857f18e5fe9d5e908109377acf8576d (diff) |
Depsgraph: Move proxy group and from building to own function
Currently no functional changes, but allows to make it more clear to
implement depsgraph construction from a given subset of scene.
4 files changed, 49 insertions, 20 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index d3bd61cc7c3..7dfc863b847 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -609,12 +609,8 @@ void DepsgraphNodeBuilder::build_object(int base_index, build_particle_systems(object, is_visible); } /* Proxy object to copy from. */ - if (object->proxy_from != NULL) { - build_object(-1, object->proxy_from, DEG_ID_LINKED_INDIRECTLY, is_visible); - } - if (object->proxy_group != NULL) { - build_object(-1, object->proxy_group, DEG_ID_LINKED_INDIRECTLY, is_visible); - } + build_object_proxy_from(object, is_visible); + build_object_proxy_group(object, is_visible); /* Object dupligroup. */ if (object->instance_collection != NULL) { const bool is_current_parent_collection_visible = is_parent_collection_visible_; @@ -653,6 +649,22 @@ void DepsgraphNodeBuilder::build_object_flags(int base_index, is_from_set)); } +void DepsgraphNodeBuilder::build_object_proxy_from(Object *object, bool is_visible) +{ + if (object->proxy_from == NULL) { + return; + } + build_object(-1, object->proxy_from, DEG_ID_LINKED_INDIRECTLY, is_visible); +} + +void DepsgraphNodeBuilder::build_object_proxy_group(Object *object, bool is_visible) +{ + if (object->proxy_group == NULL) { + return; + } + build_object(-1, object->proxy_group, DEG_ID_LINKED_INDIRECTLY, is_visible); +} + void DepsgraphNodeBuilder::build_object_data(Object *object, bool is_object_visible) { if (object->data == NULL) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index be92653888a..8763936b865 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -160,6 +160,8 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { Object *object, eDepsNode_LinkedState_Type linked_state, bool is_visible); + void build_object_proxy_from(Object *object, bool is_object_visible); + void build_object_proxy_group(Object *object, bool is_object_visible); void build_object_flags(int base_index, Object *object, eDepsNode_LinkedState_Type linked_state); void build_object_data(Object *object, bool is_object_visible); void build_object_data_camera(Object *object); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 61e9b83273b..f1e7278ffdb 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -657,20 +657,8 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) build_particle_systems(object); } /* Proxy object to copy from. */ - if (object->proxy_from != NULL) { - /* Object is linked here (comes from the library). */ - build_object(NULL, object->proxy_from); - ComponentKey ob_transform_key(&object->proxy_from->id, NodeType::TRANSFORM); - ComponentKey proxy_transform_key(&object->id, NodeType::TRANSFORM); - add_relation(ob_transform_key, proxy_transform_key, "Proxy Transform"); - } - if (object->proxy_group != NULL && object->proxy_group != object->proxy) { - /* Object is local here (local in .blend file, users interacts with it). */ - build_object(NULL, object->proxy_group); - OperationKey proxy_group_eval_key( - &object->proxy_group->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_EVAL); - add_relation(proxy_group_eval_key, transform_eval_key, "Proxy Group Transform"); - } + build_object_proxy_from(object); + build_object_proxy_group(object); /* Object dupligroup. */ if (object->instance_collection != NULL) { build_collection(NULL, object, object->instance_collection); @@ -685,6 +673,31 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) build_parameters(&object->id); } +void DepsgraphRelationBuilder::build_object_proxy_from(Object *object) +{ + if (object->proxy_from == NULL) { + return; + } + /* Object is linked here (comes from the library). */ + build_object(NULL, object->proxy_from); + ComponentKey ob_transform_key(&object->proxy_from->id, NodeType::TRANSFORM); + ComponentKey proxy_transform_key(&object->id, NodeType::TRANSFORM); + add_relation(ob_transform_key, proxy_transform_key, "Proxy Transform"); +} + +void DepsgraphRelationBuilder::build_object_proxy_group(Object *object) +{ + if (object->proxy_group == NULL || object->proxy_group == object->proxy) { + return; + } + /* Object is local here (local in .blend file, users interacts with it). */ + build_object(NULL, object->proxy_group); + OperationKey proxy_group_eval_key( + &object->proxy_group->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_EVAL); + OperationKey transform_eval_key(&object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_EVAL); + add_relation(proxy_group_eval_key, transform_eval_key, "Proxy Group Transform"); +} + void DepsgraphRelationBuilder::build_object_flags(Base *base, Object *object) { if (base == NULL) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index e58ef989ac9..36eb10a456b 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -205,6 +205,8 @@ class DepsgraphRelationBuilder : public DepsgraphBuilder { Object *object, Collection *collection); void build_object(Base *base, Object *object); + void build_object_proxy_from(Object *object); + void build_object_proxy_group(Object *object); void build_object_flags(Base *base, Object *object); void build_object_data(Object *object); void build_object_data_camera(Object *object); |