Depsgraph: build ids referenced by sockets

This commit is contained in:
Jacques Lucke 2020-07-22 19:12:44 +02:00
parent e0400d0a1c
commit e77644982c
4 changed files with 38 additions and 4 deletions

View File

@ -1466,6 +1466,18 @@ void DepsgraphNodeBuilder::build_light(Light *lamp)
function_bind(BKE_light_eval, _1, lamp_cow));
}
void DepsgraphNodeBuilder::build_nodetree_socket(bNodeSocket *socket)
{
build_idproperties(socket->prop);
if (socket->type == SOCK_OBJECT) {
build_id((ID *)((bNodeSocketValueObject *)socket->default_value)->value);
}
else if (socket->type == SOCK_IMAGE) {
build_id((ID *)((bNodeSocketValueImage *)socket->default_value)->value);
}
}
void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree)
{
if (ntree == nullptr) {
@ -1494,10 +1506,10 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree)
LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) {
build_idproperties(bnode->prop);
LISTBASE_FOREACH (bNodeSocket *, socket, &bnode->inputs) {
build_idproperties(socket->prop);
build_nodetree_socket(socket);
}
LISTBASE_FOREACH (bNodeSocket *, socket, &bnode->outputs) {
build_idproperties(socket->prop);
build_nodetree_socket(socket);
}
ID *id = bnode->id;

View File

@ -31,6 +31,7 @@
#include "DEG_depsgraph.h"
struct bNodeSocket;
struct CacheFile;
struct Camera;
struct Collection;
@ -211,6 +212,7 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder {
virtual void build_camera(Camera *camera);
virtual void build_light(Light *lamp);
virtual void build_nodetree(bNodeTree *ntree);
virtual void build_nodetree_socket(bNodeSocket *socket);
virtual void build_material(Material *ma);
virtual void build_materials(Material **materials, int num_materials);
virtual void build_freestyle_lineset(FreestyleLineSet *fls);

View File

@ -2275,6 +2275,24 @@ void DepsgraphRelationBuilder::build_light(Light *lamp)
add_relation(lamp_parameters_key, shading_key, "Light Shading Parameters");
}
void DepsgraphRelationBuilder::build_nodetree_socket(bNodeTree *ntree, bNodeSocket *socket)
{
build_idproperties(socket->prop);
if (socket->type == SOCK_OBJECT) {
Object *object = ((bNodeSocketValueObject *)socket->default_value)->value;
if (object != nullptr) {
build_object(object);
}
}
else if (socket->type == SOCK_IMAGE) {
Image *image = ((bNodeSocketValueImage *)socket->default_value)->value;
if (image != nullptr) {
build_image(image);
}
}
}
void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
{
if (ntree == nullptr) {
@ -2291,10 +2309,10 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) {
build_idproperties(bnode->prop);
LISTBASE_FOREACH (bNodeSocket *, socket, &bnode->inputs) {
build_idproperties(socket->prop);
build_nodetree_socket(ntree, socket);
}
LISTBASE_FOREACH (bNodeSocket *, socket, &bnode->outputs) {
build_idproperties(socket->prop);
build_nodetree_socket(ntree, socket);
}
ID *id = bnode->id;

View File

@ -46,6 +46,7 @@
#include "intern/node/deg_node_operation.h"
struct Base;
struct bNodeSocket;
struct CacheFile;
struct Camera;
struct Collection;
@ -275,6 +276,7 @@ class DepsgraphRelationBuilder : public DepsgraphBuilder {
virtual void build_camera(Camera *camera);
virtual void build_light(Light *lamp);
virtual void build_nodetree(bNodeTree *ntree);
virtual void build_nodetree_socket(bNodeTree *ntree, bNodeSocket *socket);
virtual void build_material(Material *ma);
virtual void build_materials(Material **materials, int num_materials);
virtual void build_freestyle_lineset(FreestyleLineSet *fls);