Depsgraph: Cleanup, use explicit NULL pointer checks

This commit is contained in:
Sergey Sharybin 2017-11-29 17:55:28 +01:00
parent 1136dee232
commit 5b5939c6e6
2 changed files with 24 additions and 50 deletions

View File

@ -65,71 +65,55 @@ namespace DEG {
void DepsgraphNodeBuilder::build_scene(Scene *scene)
{
/* scene ID block */
/* Scene ID block. */
add_id_node(&scene->id);
/* timesource */
add_time_source();
/* build subgraph for set, and link this in... */
// XXX: depending on how this goes, that scene itself could probably store its
// own little partial depsgraph?
if (scene->set) {
if (scene->set != NULL) {
build_scene(scene->set);
}
/* Setup currently building context. */
scene_ = scene;
/* scene objects */
LINKLIST_FOREACH (Base *, base, &scene->base) {
Object *object = base->object;
build_object(base, object);
}
/* rigidbody */
if (scene->rigidbody_world) {
/* Rigidbody. */
if (scene->rigidbody_world != NULL) {
build_rigidbody(scene);
}
/* scene's animation and drivers */
if (scene->adt) {
/* Scene's animation and drivers. */
if (scene->adt != NULL) {
build_animdata(&scene->id);
}
/* world */
if (scene->world) {
/* World. */
if (scene->world != NULL) {
build_world(scene->world);
}
/* compo nodes */
if (scene->nodetree) {
/* Compositor nodes. */
if (scene->nodetree != NULL) {
build_compositor(scene);
}
/* sequencer */
// XXX...
/* grease pencil */
if (scene->gpd) {
/* Grease pencil. */
if (scene->gpd != NULL) {
build_gpencil(scene->gpd);
}
/* Cache file. */
LINKLIST_FOREACH (CacheFile *, cachefile, &bmain_->cachefiles) {
build_cachefile(cachefile);
}
/* Masks. */
LINKLIST_FOREACH (Mask *, mask, &bmain_->mask) {
build_mask(mask);
}
/* Movie clips. */
LINKLIST_FOREACH (MovieClip *, clip, &bmain_->movieclip) {
build_movieclip(clip);
}
/* Parameters evaluation for scene relations mainly. */
add_operation_node(&scene->id,
DEG_NODE_TYPE_PARAMETERS,

View File

@ -69,54 +69,44 @@ namespace DEG {
void DepsgraphRelationBuilder::build_scene(Scene *scene)
{
if (scene->set) {
if (scene->set != NULL) {
build_scene(scene->set);
}
/* Setup currently building context. */
scene_ = scene;
/* scene objects */
/* Scene objects. */
LINKLIST_FOREACH (Base *, base, &scene->base) {
Object *object = base->object;
build_object(object);
}
/* rigidbody */
if (scene->rigidbody_world) {
/* Rigidbody. */
if (scene->rigidbody_world != NULL) {
build_rigidbody(scene);
}
/* scene's animation and drivers */
if (scene->adt) {
/* Scene's animation and drivers. */
if (scene->adt != NULL) {
build_animdata(&scene->id);
}
/* world */
if (scene->world) {
/* World. */
if (scene->world != NULL) {
build_world(scene->world);
}
/* compo nodes */
if (scene->nodetree) {
/* Compositor nodes. */
if (scene->nodetree != NULL) {
build_compositor(scene);
}
/* grease pencil */
if (scene->gpd) {
/* Grease pencil. */
if (scene->gpd != NULL) {
build_gpencil(scene->gpd);
}
/* Masks. */
LINKLIST_FOREACH (Mask *, mask, &bmain_->mask) {
build_mask(mask);
}
/* Movie clips. */
LINKLIST_FOREACH (MovieClip *, clip, &bmain_->movieclip) {
build_movieclip(clip);
}
for (Depsgraph::OperationNodes::const_iterator it_op = graph_->operations.begin();
it_op != graph_->operations.end();
++it_op)