diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-03-26 12:47:41 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-03-26 13:05:18 +0300 |
commit | 14e013758d69f6d69683f6631b822b9f9a4a7643 (patch) | |
tree | 5d38c7d6a76fceeb566826876a8a7585efd7bae4 /source/blender/depsgraph/intern | |
parent | 40f8ddf8297a062968fc6a1523aa210d69c22626 (diff) |
Depsgraph: Standardize parameters nodes
Makes it possible to handle them the same from drivers
relations builder.
Solves missing operations errors printed when opening
autumn character.
Diffstat (limited to 'source/blender/depsgraph/intern')
3 files changed, 57 insertions, 20 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index f0d0656f254..0cc1c2aa211 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -1027,6 +1027,7 @@ void DepsgraphNodeBuilder::build_world(World *world) function_bind(BKE_world_eval, _1, world_cow)); /* Animation. */ build_animdata(&world->id); + build_parameters(&world->id); /* World's nodetree. */ build_nodetree(world->nodetree); } @@ -1196,6 +1197,7 @@ void DepsgraphNodeBuilder::build_particle_settings( get_cow_datablock(particle_settings); /* Animation data. */ build_animdata(&particle_settings->id); + build_parameters(&particle_settings->id); /* Parameters change. */ OperationNode *op_node; op_node = add_operation_node(&particle_settings->id, @@ -1229,6 +1231,7 @@ void DepsgraphNodeBuilder::build_shapekeys(Key *key) return; } build_animdata(&key->id); + build_parameters(&key->id); /* This is an exit operation for the entire key datablock, is what is used * as dependency for modifiers evaluation. */ add_operation_node( @@ -1394,8 +1397,7 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock( obdata, NodeType::GEOMETRY, OperationCode::GEOMETRY_EVAL_DONE); op_node->set_as_exit(); /* Parameters for driver sources. */ - add_operation_node( - obdata, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL); + build_parameters(obdata); /* Batch cache. */ add_operation_node(obdata, NodeType::BATCH_CACHE, @@ -1411,6 +1413,7 @@ void DepsgraphNodeBuilder::build_armature(bArmature *armature) return; } build_animdata(&armature->id); + build_parameters(&armature->id); /* Make sure pose is up-to-date with armature updates. */ add_operation_node( &armature->id, NodeType::PARAMETERS, OperationCode::ARMATURE_EVAL); @@ -1421,11 +1424,8 @@ void DepsgraphNodeBuilder::build_camera(Camera *camera) if (built_map_.checkIsBuiltAndTag(camera)) { return; } - OperationNode *op_node; build_animdata(&camera->id); - op_node = add_operation_node( - &camera->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL); - op_node->set_as_exit(); + build_parameters(&camera->id); } void DepsgraphNodeBuilder::build_light(Light *lamp) @@ -1433,16 +1433,8 @@ void DepsgraphNodeBuilder::build_light(Light *lamp) if (built_map_.checkIsBuiltAndTag(lamp)) { return; } - OperationNode *op_node; build_animdata(&lamp->id); - op_node = add_operation_node( - &lamp->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL); - /* NOTE: We mark this node as both entry and exit. This way we have a - * node to link all dependencies for shading (which includes relation to the - * light object, and incldues relation from node tree) without adding a - * dedicated component type. */ - op_node->set_as_entry(); - op_node->set_as_exit(); + build_parameters(&lamp->id); /* light's nodetree */ build_nodetree(lamp->nodetree); } @@ -1459,10 +1451,7 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree) add_id_node(&ntree->id); bNodeTree *ntree_cow = get_cow_datablock(ntree); /* General parameters. */ - OperationNode *op_node; - op_node = add_operation_node( - &ntree->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL); - op_node->set_as_exit(); + build_parameters(&ntree->id); /* Animation, */ build_animdata(&ntree->id); /* Shading update. */ @@ -1540,6 +1529,7 @@ void DepsgraphNodeBuilder::build_material(Material *material) material_cow)); /* Material animation. */ build_animdata(&material->id); + build_parameters(&material->id); /* Material's nodetree. */ build_nodetree(material->nodetree); } @@ -1552,6 +1542,7 @@ void DepsgraphNodeBuilder::build_texture(Tex *texture) } /* Texture itself. */ build_animdata(&texture->id); + build_parameters(&texture->id); /* Texture's nodetree. */ build_nodetree(texture->nodetree); /* Special cases for different IDs which texture uses. */ @@ -1569,6 +1560,7 @@ void DepsgraphNodeBuilder::build_image(Image *image) { if (built_map_.checkIsBuiltAndTag(image)) { return; } + build_parameters(&image->id); add_operation_node(&image->id, NodeType::GENERIC_DATABLOCK, OperationCode::GENERIC_DATABLOCK_UPDATE); @@ -1600,6 +1592,7 @@ void DepsgraphNodeBuilder::build_gpencil(bGPdata *gpd) /* The main reason Grease Pencil is included here is because the animation * (and drivers) need to be hosted somewhere. */ build_animdata(gpd_id); + build_parameters(gpd_id); } void DepsgraphNodeBuilder::build_cachefile(CacheFile *cache_file) @@ -1610,6 +1603,7 @@ void DepsgraphNodeBuilder::build_cachefile(CacheFile *cache_file) ID *cache_file_id = &cache_file->id; /* Animation, */ build_animdata(cache_file_id); + build_parameters(cache_file_id); /* Cache evaluation itself. */ add_operation_node( cache_file_id, NodeType::CACHE, OperationCode::FILE_CACHE_UPDATE); @@ -1624,6 +1618,7 @@ void DepsgraphNodeBuilder::build_mask(Mask *mask) Mask *mask_cow = get_cow_datablock(mask); /* F-Curve based animation. */ build_animdata(mask_id); + build_parameters(mask_id); /* Animation based on mask's shapes. */ add_operation_node(mask_id, NodeType::ANIMATION, @@ -1645,6 +1640,7 @@ void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) MovieClip *clip_cow = (MovieClip *)ensure_cow_id(clip_id); /* Animation. */ build_animdata(clip_id); + build_parameters(clip_id); /* Movie clip evaluation. */ add_operation_node(clip_id, NodeType::PARAMETERS, @@ -1666,6 +1662,7 @@ void DepsgraphNodeBuilder::build_lightprobe(LightProbe *probe) add_operation_node( &probe->id, NodeType::PARAMETERS, OperationCode::LIGHT_PROBE_EVAL); build_animdata(&probe->id); + build_parameters(&probe->id); } void DepsgraphNodeBuilder::build_speaker(Speaker *speaker) @@ -1677,6 +1674,7 @@ void DepsgraphNodeBuilder::build_speaker(Speaker *speaker) add_operation_node( &speaker->id, NodeType::PARAMETERS, OperationCode::SPEAKER_EVAL); build_animdata(&speaker->id); + build_parameters(&speaker->id); } /* **** ID traversal callbacks functions **** */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 49f1f93ed6c..444502b9538 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -492,6 +492,9 @@ void DepsgraphRelationBuilder::build_id(ID *id) case ID_TE: build_texture((Tex *)id); break; + case ID_IM: + build_image((Image *)id); + break; case ID_WO: build_world((World *)id); break; @@ -1686,6 +1689,7 @@ void DepsgraphRelationBuilder::build_world(World *world) } /* animation */ build_animdata(&world->id); + build_parameters(&world->id); /* world's nodetree */ if (world->nodetree != NULL) { build_nodetree(world->nodetree); @@ -1959,6 +1963,7 @@ void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part) } /* Animation data relations. */ build_animdata(&part->id); + build_parameters(&part->id); OperationKey particle_settings_init_key(&part->id, NodeType::PARTICLE_SETTINGS, OperationCode::PARTICLE_SETTINGS_INIT); @@ -2035,14 +2040,19 @@ void DepsgraphRelationBuilder::build_shapekeys(Key *key) } /* Attach animdata to geometry. */ build_animdata(&key->id); + build_parameters(&key->id); /* Connect all blocks properties to the final result evaluation. */ ComponentKey geometry_key(&key->id, NodeType::GEOMETRY); + OperationKey parameters_eval_key(&key->id, + NodeType::PARAMETERS, + OperationCode::PARAMETERS_EVAL); LISTBASE_FOREACH (KeyBlock *, key_block, &key->block) { OperationKey key_block_key(&key->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL, key_block->name); add_relation(key_block_key, geometry_key, "Key Block Properties"); + add_relation(key_block_key, parameters_eval_key, "Key Block Properties"); } } @@ -2243,6 +2253,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata) } /* Animation. */ build_animdata(obdata); + build_parameters(obdata); /* ShapeKeys. */ Key *key = BKE_key_from_id(obdata); if (key != NULL) { @@ -2347,6 +2358,7 @@ void DepsgraphRelationBuilder::build_armature(bArmature *armature) return; } build_animdata(&armature->id); + build_parameters(&armature->id); } void DepsgraphRelationBuilder::build_camera(Camera *camera) @@ -2354,6 +2366,7 @@ void DepsgraphRelationBuilder::build_camera(Camera *camera) if (built_map_.checkIsBuiltAndTag(camera)) { return; } + build_parameters(&camera->id); if (camera->dof_ob != NULL) { ComponentKey camera_parameters_key(&camera->id, NodeType::PARAMETERS); ComponentKey dof_ob_key(&camera->dof_ob->id, NodeType::TRANSFORM); @@ -2367,6 +2380,7 @@ void DepsgraphRelationBuilder::build_light(Light *lamp) if (built_map_.checkIsBuiltAndTag(lamp)) { return; } + build_parameters(&lamp->id); /* light's nodetree */ if (lamp->nodetree != NULL) { build_nodetree(lamp->nodetree); @@ -2386,6 +2400,7 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) return; } build_animdata(&ntree->id); + build_parameters(&ntree->id); ComponentKey shading_key(&ntree->id, NodeType::SHADING); /* nodetree's nodes... */ LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) { @@ -2401,7 +2416,7 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) build_texture((Tex *)bnode->id); } else if (id_type == ID_IM) { - /* nothing for now. */ + build_image((Image *)bnode->id); } else if (id_type == ID_OB) { build_object(NULL, (Object *)id); @@ -2455,6 +2470,7 @@ void DepsgraphRelationBuilder::build_material(Material *material) } /* animation */ build_animdata(&material->id); + build_parameters(&material->id); /* material's nodetree */ if (material->nodetree != NULL) { build_nodetree(material->nodetree); @@ -2477,8 +2493,15 @@ void DepsgraphRelationBuilder::build_texture(Tex *texture) } /* texture itself */ build_animdata(&texture->id); + build_parameters(&texture->id); /* texture's nodetree */ build_nodetree(texture->nodetree); + /* Special cases for different IDs which texture uses. */ + if (texture->type == TEX_IMAGE) { + if (texture->ima != NULL) { + build_image(texture->ima); + } + } build_nested_nodetree(&texture->id, texture->nodetree); if (check_id_has_anim_component(&texture->id)) { ComponentKey animation_key(&texture->id, NodeType::ANIMATION); @@ -2488,6 +2511,14 @@ void DepsgraphRelationBuilder::build_texture(Tex *texture) } } +void DepsgraphRelationBuilder::build_image(Image *image) +{ + if (built_map_.checkIsBuiltAndTag(image)) { + return; + } + build_parameters(&image->id); +} + void DepsgraphRelationBuilder::build_compositor(Scene *scene) { /* For now, just a plain wrapper? */ @@ -2501,6 +2532,7 @@ void DepsgraphRelationBuilder::build_gpencil(bGPdata *gpd) } /* animation */ build_animdata(&gpd->id); + build_parameters(&gpd->id); // TODO: parent object (when that feature is implemented) } @@ -2512,6 +2544,7 @@ void DepsgraphRelationBuilder::build_cachefile(CacheFile *cache_file) } /* Animation. */ build_animdata(&cache_file->id); + build_parameters(&cache_file->id); if (check_id_has_anim_component(&cache_file->id)) { ComponentKey animation_key(&cache_file->id, NodeType::ANIMATION); ComponentKey datablock_key(&cache_file->id, @@ -2528,6 +2561,7 @@ void DepsgraphRelationBuilder::build_mask(Mask *mask) ID *mask_id = &mask->id; /* F-Curve animation. */ build_animdata(mask_id); + build_parameters(mask_id); /* Own mask animation. */ OperationKey mask_animation_key(mask_id, NodeType::ANIMATION, @@ -2546,6 +2580,7 @@ void DepsgraphRelationBuilder::build_movieclip(MovieClip *clip) } /* Animation. */ build_animdata(&clip->id); + build_parameters(&clip->id); } void DepsgraphRelationBuilder::build_lightprobe(LightProbe *probe) @@ -2554,6 +2589,7 @@ void DepsgraphRelationBuilder::build_lightprobe(LightProbe *probe) return; } build_animdata(&probe->id); + build_parameters(&probe->id); } void DepsgraphRelationBuilder::build_speaker(Speaker *speaker) @@ -2562,6 +2598,7 @@ void DepsgraphRelationBuilder::build_speaker(Speaker *speaker) return; } build_animdata(&speaker->id); + build_parameters(&speaker->id); } void DepsgraphRelationBuilder::build_copy_on_write_relations() diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index aa94e05dc28..0a0f0e99865 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -52,6 +52,7 @@ struct EffectorWeights; struct FCurve; struct GHash; struct ID; +struct Image; struct Key; struct LayerCollection; struct Light; @@ -278,6 +279,7 @@ public: void build_nodetree(bNodeTree *ntree); void build_material(Material *ma); void build_texture(Tex *tex); + void build_image(Image *image); void build_compositor(Scene *scene); void build_gpencil(bGPdata *gpd); void build_cachefile(CacheFile *cache_file); |