Changeset View
Changeset View
Standalone View
Standalone View
source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
| Show First 20 Lines • Show All 545 Lines • ▼ Show 20 Lines | void DepsgraphNodeBuilder::build_object(int base_index, | ||||
| Object *object, | Object *object, | ||||
| eDepsNode_LinkedState_Type linked_state, | eDepsNode_LinkedState_Type linked_state, | ||||
| bool is_visible) | bool is_visible) | ||||
| { | { | ||||
| if (object->proxy != nullptr) { | if (object->proxy != nullptr) { | ||||
| object->proxy->proxy_from = object; | object->proxy->proxy_from = object; | ||||
| } | } | ||||
| const bool has_object = built_map_.checkIsBuiltAndTag(object); | const bool has_object = built_map_.checkIsBuiltAndTag(object); | ||||
| /* Skip rest of components if the ID node was already there. */ | |||||
| /* When there is already object in the dependency graph accumulate visibility an linked state | |||||
| * flags. Only do it on the object itself (apart from very special cases) and leave dealing with | |||||
| * visibility of dependnecies to the visibility flush step which happens at the end of the build | |||||
| * process. */ | |||||
| if (has_object) { | if (has_object) { | ||||
| IDNode *id_node = find_id_node(&object->id); | IDNode *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) { | if (id_node->linked_state == DEG_ID_LINKED_INDIRECTLY) { | ||||
| build_object_flags(base_index, object, linked_state); | build_object_flags(base_index, object, linked_state); | ||||
| } | } | ||||
| id_node->linked_state = max(id_node->linked_state, linked_state); | id_node->linked_state = max(id_node->linked_state, linked_state); | ||||
| if (id_node->linked_state == DEG_ID_LINKED_DIRECTLY) { | |||||
| id_node->is_directly_visible |= is_visible; | id_node->is_directly_visible |= is_visible; | ||||
| } | |||||
| id_node->has_base |= (base_index != -1); | id_node->has_base |= (base_index != -1); | ||||
| /* There is no relation path which will connect current object with all the ones which come | |||||
| * via the instanced collection, so build the collection again. Note that it will do check | |||||
| * whether visibility update is needed on its own. */ | |||||
| build_object_instance_collection(object, is_visible); | |||||
| return; | return; | ||||
| } | } | ||||
| /* Create ID node for object and begin init. */ | /* Create ID node for object and begin init. */ | ||||
| IDNode *id_node = add_id_node(&object->id); | IDNode *id_node = add_id_node(&object->id); | ||||
| Object *object_cow = get_cow_datablock(object); | Object *object_cow = get_cow_datablock(object); | ||||
| id_node->linked_state = linked_state; | id_node->linked_state = linked_state; | ||||
| /* NOTE: Scene is nullptr when building dependency graph for render pipeline. | /* NOTE: Scene is nullptr when building dependency graph for render pipeline. | ||||
| * Probably need to assign that to something non-nullptr, but then the logic here will still be | * Probably need to assign that to something non-nullptr, but then the logic here will still be | ||||
| * somewhat weird. */ | * somewhat weird. */ | ||||
| if (scene_ != nullptr && object == scene_->camera) { | if (scene_ != nullptr && object == scene_->camera) { | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | void DepsgraphNodeBuilder::build_object(int base_index, | ||||
| if (object->particlesystem.first != nullptr) { | if (object->particlesystem.first != nullptr) { | ||||
| build_particle_systems(object, is_visible); | build_particle_systems(object, is_visible); | ||||
| } | } | ||||
| /* Proxy object to copy from. */ | /* Proxy object to copy from. */ | ||||
| build_object_proxy_from(object, is_visible); | build_object_proxy_from(object, is_visible); | ||||
| build_object_proxy_group(object, is_visible); | build_object_proxy_group(object, is_visible); | ||||
| /* Object dupligroup. */ | /* Object dupligroup. */ | ||||
| if (object->instance_collection != nullptr) { | if (object->instance_collection != nullptr) { | ||||
| const bool is_current_parent_collection_visible = is_parent_collection_visible_; | build_object_instance_collection(object, is_visible); | ||||
| is_parent_collection_visible_ = is_visible; | |||||
| build_collection(nullptr, object->instance_collection); | |||||
| is_parent_collection_visible_ = is_current_parent_collection_visible; | |||||
| OperationNode *op_node = add_operation_node( | OperationNode *op_node = add_operation_node( | ||||
| &object->id, NodeType::DUPLI, OperationCode::DUPLI); | &object->id, NodeType::DUPLI, OperationCode::DUPLI); | ||||
| op_node->flag |= OperationFlag::DEPSOP_FLAG_PINNED; | op_node->flag |= OperationFlag::DEPSOP_FLAG_PINNED; | ||||
| } | } | ||||
| /* Synchronization back to original object. */ | /* Synchronization back to original object. */ | ||||
| add_operation_node(&object->id, | add_operation_node(&object->id, | ||||
| NodeType::SYNCHRONIZATION, | NodeType::SYNCHRONIZATION, | ||||
| OperationCode::SYNCHRONIZE_TO_ORIGINAL, | OperationCode::SYNCHRONIZE_TO_ORIGINAL, | ||||
| Show All 34 Lines | |||||
| void DepsgraphNodeBuilder::build_object_proxy_group(Object *object, bool is_visible) | void DepsgraphNodeBuilder::build_object_proxy_group(Object *object, bool is_visible) | ||||
| { | { | ||||
| if (object->proxy_group == nullptr) { | if (object->proxy_group == nullptr) { | ||||
| return; | return; | ||||
| } | } | ||||
| build_object(-1, object->proxy_group, DEG_ID_LINKED_INDIRECTLY, is_visible); | build_object(-1, object->proxy_group, DEG_ID_LINKED_INDIRECTLY, is_visible); | ||||
| } | } | ||||
| void DepsgraphNodeBuilder::build_object_instance_collection(Object *object, bool is_object_visible) | |||||
| { | |||||
| if (object->instance_collection == nullptr) { | |||||
| return; | |||||
| } | |||||
| const bool is_current_parent_collection_visible = is_parent_collection_visible_; | |||||
| is_parent_collection_visible_ = is_object_visible; | |||||
| build_collection(nullptr, object->instance_collection); | |||||
| is_parent_collection_visible_ = is_current_parent_collection_visible; | |||||
| } | |||||
| void DepsgraphNodeBuilder::build_object_data(Object *object, bool is_object_visible) | void DepsgraphNodeBuilder::build_object_data(Object *object, bool is_object_visible) | ||||
| { | { | ||||
| if (object->data == nullptr) { | if (object->data == nullptr) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* type-specific data. */ | /* type-specific data. */ | ||||
| switch (object->type) { | switch (object->type) { | ||||
| case OB_MESH: | case OB_MESH: | ||||
| ▲ Show 20 Lines • Show All 1,086 Lines • Show Last 20 Lines | |||||