diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-06-06 11:23:45 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-06-06 13:36:51 +0300 |
commit | 1a0cb28ae2c0734ad8d8438eb1db5b14a4c71291 (patch) | |
tree | d16620e42f7ceab70982de611d8d365b72f69f6f /source | |
parent | 180e8f8bfbb8b1f4d2328d93c55563e616942a06 (diff) |
Depsgraph: Object data separation, light probes
This is a beginning of series of commits which will clearly separate
building IDs which are used as object data from object building.
The goal is to be able to always build whatever ID. Required to make
driver targets to work reliably with copy-on-write concept.
Diffstat (limited to 'source')
6 files changed, 39 insertions, 25 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 73bacbc6192..3753606862e 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -575,7 +575,7 @@ void DepsgraphNodeBuilder::build_object_data(Object *object) build_camera(object); break; case OB_LIGHTPROBE: - build_lightprobe(object); + build_object_data_lightprobe(object); break; default: { @@ -588,6 +588,16 @@ void DepsgraphNodeBuilder::build_object_data(Object *object) } } +void DepsgraphNodeBuilder::build_object_data_lightprobe(Object *object) +{ + LightProbe *probe = (LightProbe *)object->data; + build_lightprobe(probe); + add_operation_node(&object->id, + DEG_NODE_TYPE_PARAMETERS, + NULL, + DEG_OPCODE_LIGHT_PROBE_EVAL); +} + void DepsgraphNodeBuilder::build_object_transform(Object *object) { OperationDepsNode *op_node; @@ -1388,9 +1398,8 @@ void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) DEG_OPCODE_MOVIECLIP_EVAL); } -void DepsgraphNodeBuilder::build_lightprobe(Object *object) +void DepsgraphNodeBuilder::build_lightprobe(LightProbe *probe) { - LightProbe *probe = (LightProbe *)object->data; if (built_map_.checkIsBuiltAndTag(probe)) { return; } @@ -1398,13 +1407,7 @@ void DepsgraphNodeBuilder::build_lightprobe(Object *object) add_operation_node(&probe->id, DEG_NODE_TYPE_PARAMETERS, NULL, - DEG_OPCODE_PLACEHOLDER, - "LightProbe Eval"); - add_operation_node(&object->id, - DEG_NODE_TYPE_PARAMETERS, - NULL, - DEG_OPCODE_PLACEHOLDER, - "LightProbe Eval"); + DEG_OPCODE_LIGHT_PROBE_EVAL); build_animdata(&probe->id); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index b7c5a33f2c0..bb9cb2bd134 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -50,6 +50,7 @@ struct Main; struct Material; struct Mask; struct MTex; +struct LightProbe; struct MovieClip; struct bNodeTree; struct Object; @@ -165,6 +166,7 @@ struct DepsgraphNodeBuilder { Object *object, eDepsNode_LinkedState_Type linked_state); void build_object_data(Object *object); + void build_object_data_lightprobe(Object *object); void build_object_transform(Object *object); void build_object_constraints(Object *object); void build_pose_constraints(Object *object, bPoseChannel *pchan, int pchan_index); @@ -198,7 +200,7 @@ struct DepsgraphNodeBuilder { void build_cachefile(CacheFile *cache_file); void build_mask(Mask *mask); void build_movieclip(MovieClip *clip); - void build_lightprobe(Object *object); + void build_lightprobe(LightProbe *probe); protected: struct SavedEntryTag { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index e0df724818d..8e826cd01df 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -615,7 +615,7 @@ void DepsgraphRelationBuilder::build_object_data(Object *object) build_camera(object); break; case OB_LIGHTPROBE: - build_lightprobe(object); + build_object_data_lightprobe(object); break; } Key *key = BKE_key_from_object(object); @@ -627,6 +627,19 @@ void DepsgraphRelationBuilder::build_object_data(Object *object) } } +void DepsgraphRelationBuilder::build_object_data_lightprobe(Object *object) +{ + LightProbe *probe = (LightProbe *)object->data; + build_lightprobe(probe); + OperationKey probe_key(&probe->id, + DEG_NODE_TYPE_PARAMETERS, + DEG_OPCODE_LIGHT_PROBE_EVAL); + OperationKey object_key(&object->id, + DEG_NODE_TYPE_PARAMETERS, + DEG_OPCODE_LIGHT_PROBE_EVAL); + add_relation(probe_key, object_key, "LightProbe Update"); +} + void DepsgraphRelationBuilder::build_object_parent(Object *object) { /* XXX: for now, need to use the component key (not just direct to the parent op), @@ -2045,23 +2058,12 @@ void DepsgraphRelationBuilder::build_movieclip(MovieClip *clip) build_animdata(&clip->id); } -void DepsgraphRelationBuilder::build_lightprobe(Object *object) +void DepsgraphRelationBuilder::build_lightprobe(LightProbe *probe) { - LightProbe *probe = (LightProbe *)object->data; if (built_map_.checkIsBuiltAndTag(probe)) { return; } build_animdata(&probe->id); - - OperationKey probe_key(&probe->id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_PLACEHOLDER, - "LightProbe Eval"); - OperationKey object_key(&object->id, - DEG_NODE_TYPE_PARAMETERS, - DEG_OPCODE_PLACEHOLDER, - "LightProbe Eval"); - add_relation(probe_key, object_key, "LightProbe Update"); } void DepsgraphRelationBuilder::build_copy_on_write_relations() diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index dbfaff4dc18..0211f5dba68 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -58,6 +58,7 @@ struct FCurve; struct Collection; struct Key; struct LayerCollection; +struct LightProbe; struct Main; struct Mask; struct Material; @@ -201,6 +202,7 @@ struct DepsgraphRelationBuilder void build_object(Base *base, Object *object); void build_object_flags(Base *base, Object *object); void build_object_data(Object *object); + void build_object_data_lightprobe(Object *object); void build_object_parent(Object *object); void build_constraints(ID *id, eDepsNode_Type component_type, @@ -251,7 +253,7 @@ struct DepsgraphRelationBuilder void build_cachefile(CacheFile *cache_file); void build_mask(Mask *mask); void build_movieclip(MovieClip *clip); - void build_lightprobe(Object *object); + void build_lightprobe(LightProbe *probe); void build_nested_datablock(ID *owner, ID *id); void build_nested_nodetree(ID *owner, bNodeTree *ntree); diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc index 19cc82a6b10..79d29f72b8d 100644 --- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc +++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cc @@ -138,6 +138,8 @@ const char *operationCodeAsString(eDepsOperation_Code opcode) STRINGIFY_OPCODE(GEOMETRY_UBEREVAL); STRINGIFY_OPCODE(GEOMETRY_CLOTH_MODIFIER); STRINGIFY_OPCODE(GEOMETRY_SHAPEKEY); + /* Object data. */ + STRINGIFY_OPCODE(LIGHT_PROBE_EVAL); /* Pose. */ STRINGIFY_OPCODE(POSE_INIT); STRINGIFY_OPCODE(POSE_INIT_IK); diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h index 14cd62e6cec..18bc0bd0501 100644 --- a/source/blender/depsgraph/intern/depsgraph_types.h +++ b/source/blender/depsgraph/intern/depsgraph_types.h @@ -205,6 +205,9 @@ typedef enum eDepsOperation_Code { DEG_OPCODE_GEOMETRY_CLOTH_MODIFIER, DEG_OPCODE_GEOMETRY_SHAPEKEY, + /* Object data. ------------------------------------- */ + DEG_OPCODE_LIGHT_PROBE_EVAL, + /* Pose. -------------------------------------------- */ /* Init pose, clear flags, etc. */ DEG_OPCODE_POSE_INIT, |