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.
This commit is contained in:
Sergey Sharybin 2018-06-06 10:23:45 +02:00
parent 180e8f8bfb
commit 1a0cb28ae2
6 changed files with 39 additions and 25 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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,