Depsgraph: Add missing nodes and relations for speaker

This commit is contained in:
Sergey Sharybin
2018-06-25 11:53:38 +02:00
parent c448c0a67f
commit 7a4d5b78ea
6 changed files with 66 additions and 0 deletions

View File

@@ -65,6 +65,7 @@ extern "C" {
#include "DNA_lightprobe_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
#include "DNA_speaker_types.h"
#include "DNA_texture_types.h"
#include "DNA_world_types.h"
@@ -431,6 +432,9 @@ void DepsgraphNodeBuilder::build_id(ID *id) {
case ID_LT:
build_object_data_geometry_datablock(id);
break;
case ID_SPK:
build_speaker((Speaker *)id);
break;
default:
fprintf(stderr, "Unhandled ID %s\n", id->name);
BLI_assert(!"Should never happen");
@@ -615,6 +619,9 @@ void DepsgraphNodeBuilder::build_object_data(Object *object)
case OB_LIGHTPROBE:
build_object_data_lightprobe(object);
break;
case OB_SPEAKER:
build_object_data_speaker(object);
break;
default:
{
ID *obdata = (ID *)object->data;
@@ -648,6 +655,16 @@ void DepsgraphNodeBuilder::build_object_data_lightprobe(Object *object)
DEG_OPCODE_LIGHT_PROBE_EVAL);
}
void DepsgraphNodeBuilder::build_object_data_speaker(Object *object)
{
Speaker *speaker = (Speaker *)object->data;
build_speaker(speaker);
add_operation_node(&object->id,
DEG_NODE_TYPE_PARAMETERS,
NULL,
DEG_OPCODE_SPEAKER_EVAL);
}
void DepsgraphNodeBuilder::build_object_transform(Object *object)
{
OperationDepsNode *op_node;
@@ -1464,6 +1481,19 @@ void DepsgraphNodeBuilder::build_lightprobe(LightProbe *probe)
build_animdata(&probe->id);
}
void DepsgraphNodeBuilder::build_speaker(Speaker *speaker)
{
if (built_map_.checkIsBuiltAndTag(speaker)) {
return;
}
/* Placeholder so we can add relations and tag ID node for update. */
add_operation_node(&speaker->id,
DEG_NODE_TYPE_PARAMETERS,
NULL,
DEG_OPCODE_SPEAKER_EVAL);
build_animdata(&speaker->id);
}
/* **** ID traversal callbacks functions **** */
void DepsgraphNodeBuilder::modifier_walk(void *user_data,

View File

@@ -62,6 +62,7 @@ struct Probe;
struct bPoseChannel;
struct bConstraint;
struct Scene;
struct Speaker;
struct Tex;
struct World;
@@ -175,6 +176,7 @@ struct DepsgraphNodeBuilder {
void build_object_data_geometry_datablock(ID *obdata);
void build_object_data_lamp(Object *object);
void build_object_data_lightprobe(Object *object);
void build_object_data_speaker(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);
@@ -209,6 +211,7 @@ struct DepsgraphNodeBuilder {
void build_mask(Mask *mask);
void build_movieclip(MovieClip *clip);
void build_lightprobe(LightProbe *probe);
void build_speaker(Speaker *speaker);
protected:
struct SavedEntryTag {

View File

@@ -65,6 +65,7 @@ extern "C" {
#include "DNA_object_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
#include "DNA_speaker_types.h"
#include "DNA_texture_types.h"
#include "DNA_world_types.h"
#include "DNA_object_force_types.h"
@@ -440,6 +441,9 @@ void DepsgraphRelationBuilder::build_id(ID *id)
case ID_LT:
build_object_data_geometry_datablock(id);
break;
case ID_SPK:
build_speaker((Speaker *)id);
break;
default:
fprintf(stderr, "Unhandled ID %s\n", id->name);
BLI_assert(!"Should never happen");
@@ -660,6 +664,9 @@ void DepsgraphRelationBuilder::build_object_data(Object *object)
case OB_LIGHTPROBE:
build_object_data_lightprobe(object);
break;
case OB_SPEAKER:
build_object_data_speaker(object);
break;
}
Key *key = BKE_key_from_object(object);
if (key != NULL) {
@@ -701,6 +708,19 @@ void DepsgraphRelationBuilder::build_object_data_lightprobe(Object *object)
add_relation(probe_key, object_key, "LightProbe Update");
}
void DepsgraphRelationBuilder::build_object_data_speaker(Object *object)
{
Speaker *speaker = (Speaker *)object->data;
build_speaker(speaker);
OperationKey probe_key(&speaker->id,
DEG_NODE_TYPE_PARAMETERS,
DEG_OPCODE_SPEAKER_EVAL);
OperationKey object_key(&object->id,
DEG_NODE_TYPE_PARAMETERS,
DEG_OPCODE_SPEAKER_EVAL);
add_relation(probe_key, object_key, "Speaker Update");
}
void DepsgraphRelationBuilder::build_object_parent(Object *object)
{
/* XXX: for now, need to use the component key (not just direct to the parent op),
@@ -2122,6 +2142,14 @@ void DepsgraphRelationBuilder::build_lightprobe(LightProbe *probe)
build_animdata(&probe->id);
}
void DepsgraphRelationBuilder::build_speaker(Speaker *speaker)
{
if (built_map_.checkIsBuiltAndTag(speaker)) {
return;
}
build_animdata(&speaker->id);
}
void DepsgraphRelationBuilder::build_copy_on_write_relations()
{
foreach (IDDepsNode *id_node, graph_->id_nodes) {

View File

@@ -75,6 +75,7 @@ struct bConstraint;
struct ParticleSystem;
struct ParticleSettings;
struct Scene;
struct Speaker;
struct ViewLayer;
struct Tex;
struct World;
@@ -212,6 +213,7 @@ struct DepsgraphRelationBuilder
void build_object_data_geometry_datablock(ID *obdata);
void build_object_data_lamp(Object *object);
void build_object_data_lightprobe(Object *object);
void build_object_data_speaker(Object *object);
void build_object_parent(Object *object);
void build_constraints(ID *id,
eDepsNode_Type component_type,
@@ -263,6 +265,7 @@ struct DepsgraphRelationBuilder
void build_mask(Mask *mask);
void build_movieclip(MovieClip *clip);
void build_lightprobe(LightProbe *probe);
void build_speaker(Speaker *speaker);
void build_nested_datablock(ID *owner, ID *id);
void build_nested_nodetree(ID *owner, bNodeTree *ntree);

View File

@@ -141,6 +141,7 @@ const char *operationCodeAsString(eDepsOperation_Code opcode)
STRINGIFY_OPCODE(GEOMETRY_SHAPEKEY);
/* Object data. */
STRINGIFY_OPCODE(LIGHT_PROBE_EVAL);
STRINGIFY_OPCODE(SPEAKER_EVAL);
/* Pose. */
STRINGIFY_OPCODE(POSE_INIT);
STRINGIFY_OPCODE(POSE_INIT_IK);

View File

@@ -211,6 +211,7 @@ typedef enum eDepsOperation_Code {
/* Object data. ------------------------------------- */
DEG_OPCODE_LIGHT_PROBE_EVAL,
DEG_OPCODE_SPEAKER_EVAL,
/* Pose. -------------------------------------------- */
/* Init pose, clear flags, etc. */