Depsgraph: Object data separation, lamp

This commit is contained in:
Sergey Sharybin 2018-06-06 10:47:54 +02:00
parent 1a0cb28ae2
commit ca7de1ff22
4 changed files with 27 additions and 29 deletions

View File

@ -569,7 +569,7 @@ void DepsgraphNodeBuilder::build_object_data(Object *object)
}
break;
case OB_LAMP:
build_lamp(object);
build_object_data_lamp(object);
break;
case OB_CAMERA:
build_camera(object);
@ -588,6 +588,12 @@ void DepsgraphNodeBuilder::build_object_data(Object *object)
}
}
void DepsgraphNodeBuilder::build_object_data_lamp(Object *object)
{
Lamp *lamp = (Lamp *)object->data;
build_lamp(lamp);
}
void DepsgraphNodeBuilder::build_object_data_lightprobe(Object *object)
{
LightProbe *probe = (LightProbe *)object->data;
@ -1176,11 +1182,8 @@ void DepsgraphNodeBuilder::build_camera(Object *object)
DEG_OPCODE_PARAMETERS_EVAL);
}
/* Lamps */
void DepsgraphNodeBuilder::build_lamp(Object *object)
void DepsgraphNodeBuilder::build_lamp(Lamp *lamp)
{
/* Object data. */
Lamp *lamp = (Lamp *)object->data;
if (built_map_.checkIsBuiltAndTag(lamp)) {
return;
}

View File

@ -45,12 +45,13 @@ struct Image;
struct FCurve;
struct Collection;
struct Key;
struct Lamp;
struct LayerCollection;
struct LightProbe;
struct Main;
struct Material;
struct Mask;
struct MTex;
struct LightProbe;
struct MovieClip;
struct bNodeTree;
struct Object;
@ -166,6 +167,7 @@ struct DepsgraphNodeBuilder {
Object *object,
eDepsNode_LinkedState_Type linked_state);
void build_object_data(Object *object);
void build_object_data_lamp(Object *object);
void build_object_data_lightprobe(Object *object);
void build_object_transform(Object *object);
void build_object_constraints(Object *object);
@ -189,7 +191,7 @@ struct DepsgraphNodeBuilder {
void build_shapekeys(Key *key);
void build_obdata_geom(Object *object);
void build_camera(Object *object);
void build_lamp(Object *object);
void build_lamp(Lamp *lamp);
void build_nodetree(bNodeTree *ntree);
void build_material(Material *ma);
void build_texture(Tex *tex);

View File

@ -609,7 +609,7 @@ void DepsgraphRelationBuilder::build_object_data(Object *object)
}
break;
case OB_LAMP:
build_lamp(object);
build_object_data_lamp(object);
break;
case OB_CAMERA:
build_camera(object);
@ -627,6 +627,15 @@ void DepsgraphRelationBuilder::build_object_data(Object *object)
}
}
void DepsgraphRelationBuilder::build_object_data_lamp(Object *object)
{
Lamp *lamp = (Lamp *)object->data;
build_lamp(lamp);
ComponentKey object_parameters_key(&object->id, DEG_NODE_TYPE_PARAMETERS);
ComponentKey lamp_parameters_key(&lamp->id, DEG_NODE_TYPE_PARAMETERS);
add_relation(lamp_parameters_key, object_parameters_key, "Lamp -> Object");
}
void DepsgraphRelationBuilder::build_object_data_lightprobe(Object *object)
{
LightProbe *probe = (LightProbe *)object->data;
@ -1873,37 +1882,19 @@ void DepsgraphRelationBuilder::build_camera(Object *object)
}
/* Lamps */
void DepsgraphRelationBuilder::build_lamp(Object *object)
void DepsgraphRelationBuilder::build_lamp(Lamp *lamp)
{
Lamp *lamp = (Lamp *)object->data;
if (built_map_.checkIsBuiltAndTag(lamp)) {
return;
}
ComponentKey object_parameters_key(&object->id, DEG_NODE_TYPE_PARAMETERS);
ComponentKey lamp_parameters_key(&lamp->id, DEG_NODE_TYPE_PARAMETERS);
add_relation(lamp_parameters_key, object_parameters_key,
"Lamp -> Object");
/* lamp's nodetree */
if (lamp->nodetree != NULL) {
build_nodetree(lamp->nodetree);
ComponentKey lamp_parameters_key(&lamp->id, DEG_NODE_TYPE_PARAMETERS);
ComponentKey nodetree_key(&lamp->nodetree->id, DEG_NODE_TYPE_SHADING);
add_relation(nodetree_key, lamp_parameters_key, "NTree->Lamp Parameters");
build_nested_nodetree(&lamp->id, lamp->nodetree);
}
/* Make sure copy on write of lamp data is always properly updated for
* visible lamps.
*/
OperationKey ob_copy_on_write_key(&object->id,
DEG_NODE_TYPE_COPY_ON_WRITE,
DEG_OPCODE_COPY_ON_WRITE);
OperationKey lamp_copy_on_write_key(&lamp->id,
DEG_NODE_TYPE_COPY_ON_WRITE,
DEG_OPCODE_COPY_ON_WRITE);
add_relation(lamp_copy_on_write_key, ob_copy_on_write_key, "Eval Order");
}
void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)

View File

@ -57,6 +57,7 @@ struct ID;
struct FCurve;
struct Collection;
struct Key;
struct Lamp;
struct LayerCollection;
struct LightProbe;
struct Main;
@ -202,6 +203,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_lamp(Object *object);
void build_object_data_lightprobe(Object *object);
void build_object_parent(Object *object);
void build_constraints(ID *id,
@ -244,7 +246,7 @@ struct DepsgraphRelationBuilder
void build_shapekeys(ID *obdata, Key *key);
void build_obdata_geom(Object *object);
void build_camera(Object *object);
void build_lamp(Object *object);
void build_lamp(Lamp *lamp);
void build_nodetree(bNodeTree *ntree);
void build_material(Material *ma);
void build_texture(Tex *tex);