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.
This commit is contained in:
Sergey Sharybin
2019-09-20 16:16:51 +02:00
parent e7507c16e8
commit c0855f77c0
4 changed files with 49 additions and 20 deletions

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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);