diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-01-16 16:57:33 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-01-21 12:44:23 +0300 |
commit | 9f66062da73e954f7c00acd9d5d5ead9ac1e8863 (patch) | |
tree | 9f758a0bd7d751ac10de259798e46302bc0f3b6d /source/blender/depsgraph/intern/builder | |
parent | 1982d110f4ec364a5deddbf262d78c4bcf5224e1 (diff) |
Fix T72213: F-Curve animation does not update FreeStyle properties
FreeStyle line styles were not part of the dependency graph, and
blacklisted from the Copy-on-Write system. As a result, animated
FreeStyle properties would not be updated by the animation system,
resulting in T72213. There was an explicit call to run the animation
system on the original datablocks, but that was (for good reasons)
removed in D5394.
This commit adds the FreeStyleLineStyle datablocks to the dependency
graph and allows them to be handled by the CoW system. As a result
- the UI now updates properly when properties are animated, and
- animated property values are actually used when rendering.
This commit includes @Sergey's patch P1222, which unifies two bits of
code that did the same thing: check whether datablock type is covered by
copy-on-write.
Reviewed By: sergey, brecht
Differential Revision: https://developer.blender.org/D6609
Diffstat (limited to 'source/blender/depsgraph/intern/builder')
6 files changed, 66 insertions, 8 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index d0e40d49527..b260df6fa06 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -47,6 +47,7 @@ extern "C" { #include "DNA_gpencil_types.h" #include "DNA_key_types.h" #include "DNA_light_types.h" +#include "DNA_linestyle_types.h" #include "DNA_material_types.h" #include "DNA_mask_types.h" #include "DNA_mesh_types.h" @@ -432,6 +433,9 @@ void DepsgraphNodeBuilder::build_id(ID *id) case ID_MSK: build_mask((Mask *)id); break; + case ID_LS: + build_freestyle_linestyle((FreestyleLineStyle *)id); + break; case ID_MC: build_movieclip((MovieClip *)id); break; @@ -1557,6 +1561,18 @@ void DepsgraphNodeBuilder::build_mask(Mask *mask) } } +void DepsgraphNodeBuilder::build_freestyle_linestyle(FreestyleLineStyle *linestyle) +{ + if (built_map_.checkIsBuiltAndTag(linestyle)) { + return; + } + + ID *linestyle_id = &linestyle->id; + build_parameters(linestyle_id); + build_animdata(linestyle_id); + build_nodetree(linestyle->nodetree); +} + void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) { if (built_map_.checkIsBuiltAndTag(clip)) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 865f60432c1..7cb74ea8bc5 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -35,6 +35,8 @@ struct CacheFile; struct Camera; struct Collection; struct FCurve; +struct FreestyleLineSet; +struct FreestyleLineStyle; struct GHash; struct ID; struct Image; @@ -201,6 +203,8 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { virtual void build_nodetree(bNodeTree *ntree); virtual void build_material(Material *ma); virtual void build_materials(Material **materials, int num_materials); + virtual void build_freestyle_lineset(FreestyleLineSet *fls); + virtual void build_freestyle_linestyle(FreestyleLineStyle *linestyle); virtual void build_texture(Tex *tex); virtual void build_image(Image *image); virtual void build_world(World *world); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc index 88ebf1c9b50..82a65c3129b 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc @@ -37,6 +37,7 @@ extern "C" { #include "DNA_freestyle_types.h" #include "DNA_layer_types.h" +#include "DNA_linestyle_types.h" #include "DNA_node_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -74,6 +75,16 @@ void DepsgraphNodeBuilder::build_layer_collections(ListBase *lb) } } +void DepsgraphNodeBuilder::build_freestyle_lineset(FreestyleLineSet *fls) +{ + if (fls->group != NULL) { + build_collection(NULL, fls->group); + } + if (fls->linestyle != NULL) { + build_freestyle_linestyle(fls->linestyle); + } +} + void DepsgraphNodeBuilder::build_view_layer(Scene *scene, ViewLayer *view_layer, eDepsNode_LinkedState_Type linked_state) @@ -140,11 +151,9 @@ void DepsgraphNodeBuilder::build_view_layer(Scene *scene, if (view_layer->mat_override != NULL) { build_material(view_layer->mat_override); } - /* Freestyle collections. */ + /* Freestyle linesets. */ LISTBASE_FOREACH (FreestyleLineSet *, fls, &view_layer->freestyle_config.linesets) { - if (fls->group != NULL) { - build_collection(NULL, fls->group); - } + build_freestyle_lineset(fls); } /* Sequencer. */ if (linked_state == DEG_ID_LINKED_DIRECTLY) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 3e0ab9684da..7d7a183ee75 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -47,6 +47,7 @@ extern "C" { #include "DNA_gpencil_types.h" #include "DNA_key_types.h" #include "DNA_light_types.h" +#include "DNA_linestyle_types.h" #include "DNA_material_types.h" #include "DNA_mask_types.h" #include "DNA_mesh_types.h" @@ -536,6 +537,9 @@ void DepsgraphRelationBuilder::build_id(ID *id) case ID_MSK: build_mask((Mask *)id); break; + case ID_LS: + build_freestyle_linestyle((FreestyleLineStyle *)id); + break; case ID_MC: build_movieclip((MovieClip *)id); break; @@ -2429,6 +2433,18 @@ void DepsgraphRelationBuilder::build_mask(Mask *mask) } } +void DepsgraphRelationBuilder::build_freestyle_linestyle(FreestyleLineStyle *linestyle) +{ + if (built_map_.checkIsBuiltAndTag(linestyle)) { + return; + } + + ID *linestyle_id = &linestyle->id; + build_parameters(linestyle_id); + build_animdata(linestyle_id); + build_nodetree(linestyle->nodetree); +} + void DepsgraphRelationBuilder::build_movieclip(MovieClip *clip) { if (built_map_.checkIsBuiltAndTag(clip)) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index c6a0014577f..81bc82c036a 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -51,6 +51,8 @@ struct Camera; struct Collection; struct EffectorWeights; struct FCurve; +struct FreestyleLineSet; +struct FreestyleLineStyle; struct ID; struct Image; struct Key; @@ -264,6 +266,8 @@ class DepsgraphRelationBuilder : public DepsgraphBuilder { virtual void build_nodetree(bNodeTree *ntree); virtual void build_material(Material *ma); virtual void build_materials(Material **materials, int num_materials); + virtual void build_freestyle_lineset(FreestyleLineSet *fls); + virtual void build_freestyle_linestyle(FreestyleLineStyle *linestyle); virtual void build_texture(Tex *tex); virtual void build_image(Image *image); virtual void build_gpencil(bGPdata *gpd); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc index 4c55e4a137a..e81ed8b410c 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc @@ -35,6 +35,7 @@ #include "BLI_blenlib.h" extern "C" { +#include "DNA_linestyle_types.h" #include "DNA_node_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -75,6 +76,16 @@ void DepsgraphRelationBuilder::build_layer_collections(ListBase *lb) } } +void DepsgraphRelationBuilder::build_freestyle_lineset(FreestyleLineSet *fls) +{ + if (fls->group != NULL) { + build_collection(NULL, NULL, fls->group); + } + if (fls->linestyle != NULL) { + build_freestyle_linestyle(fls->linestyle); + } +} + void DepsgraphRelationBuilder::build_view_layer(Scene *scene, ViewLayer *view_layer, eDepsNode_LinkedState_Type linked_state) @@ -120,11 +131,9 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, if (view_layer->mat_override != NULL) { build_material(view_layer->mat_override); } - /* Freestyle collections. */ + /* Freestyle linesets. */ LISTBASE_FOREACH (FreestyleLineSet *, fls, &view_layer->freestyle_config.linesets) { - if (fls->group != NULL) { - build_collection(NULL, NULL, fls->group); - } + build_freestyle_lineset(fls); } /* Scene parameters, compositor and such. */ build_scene_compositor(scene); |