diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-06-09 19:04:05 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-06-09 19:06:10 +0300 |
commit | ebb2c1511b193b042e104b488432c3f4f97db69a (patch) | |
tree | 745999242b65c5475f8aaa67be9fde7c0344f032 /source | |
parent | dadb99074c54236e9712b7cfe7bce9488eabc578 (diff) |
Fix missing updates when changing probe's clipping
Probes were completely out of depsgraph, so tagging them could not work at all.
For now using some placeholder operations just to ensure order of updates.
Diffstat (limited to 'source')
5 files changed, 70 insertions, 3 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index a95b498280a..c2328d71141 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -62,6 +62,7 @@ extern "C" { #include "DNA_node_types.h" #include "DNA_particle_types.h" #include "DNA_object_types.h" +#include "DNA_probe_types.h" #include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" #include "DNA_texture_types.h" @@ -384,6 +385,10 @@ void DepsgraphNodeBuilder::build_object(Scene *scene, Object *ob) build_camera(ob); break; + case OB_PROBE: + build_probe(ob); + break; + default: { ID *obdata = (ID *)ob->data; @@ -1100,10 +1105,35 @@ void DepsgraphNodeBuilder::build_mask(Mask *mask) build_animdata(mask_id); } -void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) { +void DepsgraphNodeBuilder::build_movieclip(MovieClip *clip) +{ ID *clip_id = &clip->id; add_id_node(clip_id); build_animdata(clip_id); } +void DepsgraphNodeBuilder::build_probe(Object *object) +{ + Probe *probe = (Probe *)object->data; + ID *probe_id = &probe->id; + if (probe_id->tag & LIB_TAG_DOIT) { + return; + } + probe_id->tag |= LIB_TAG_DOIT; + /* Placeholder so we can add relations and tag ID node for update. */ + add_operation_node(probe_id, + DEG_NODE_TYPE_PARAMETERS, + NULL, + DEG_OPCODE_PLACEHOLDER, + "Probe Eval"); + + add_operation_node(&object->id, + DEG_NODE_TYPE_PARAMETERS, + NULL, + DEG_OPCODE_PLACEHOLDER, + "Probe Eval"); + + build_animdata(probe_id); +} + } // namespace DEG diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 83a4dfda8a5..63657cce60b 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -49,6 +49,7 @@ struct MTex; struct MovieClip; struct bNodeTree; struct Object; +struct Probe; struct bPoseChannel; struct bConstraint; struct Scene; @@ -156,6 +157,7 @@ struct DepsgraphNodeBuilder { void build_cachefile(CacheFile *cache_file); void build_mask(Mask *mask); void build_movieclip(MovieClip *clip); + void build_probe(Object *object); struct LayerCollectionState { int index; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 69f04b20cd8..77b9c4b8749 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -61,6 +61,7 @@ extern "C" { #include "DNA_movieclip_types.h" #include "DNA_node_types.h" #include "DNA_particle_types.h" +#include "DNA_probe_types.h" #include "DNA_object_types.h" #include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" @@ -533,6 +534,10 @@ void DepsgraphRelationBuilder::build_object(Main *bmain, Scene *scene, Object *o case OB_CAMERA: /* Camera */ build_camera(ob); break; + + case OB_PROBE: + build_probe(ob); + break; } Key *key = BKE_key_from_object(ob); @@ -1736,4 +1741,25 @@ void DepsgraphRelationBuilder::build_movieclip(MovieClip *clip) build_animdata(&clip->id); } +void DepsgraphRelationBuilder::build_probe(Object *object) +{ + Probe *probe = (Probe *)object->data; + ID *probe_id = &probe->id; + if (probe_id->tag & LIB_TAG_DOIT) { + return; + } + probe_id->tag |= LIB_TAG_DOIT; + build_animdata(&probe->id); + + OperationKey probe_key(probe_id, + DEG_NODE_TYPE_PARAMETERS, + DEG_OPCODE_PLACEHOLDER, + "Probe Eval"); + OperationKey object_key(&object->id, + DEG_NODE_TYPE_PARAMETERS, + DEG_OPCODE_PLACEHOLDER, + "Probe Eval"); + add_relation(probe_key, object_key, "Probe Update"); +} + } // namespace DEG diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index edca1905873..fba6c8f51b5 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -227,6 +227,7 @@ struct DepsgraphRelationBuilder void build_cachefile(CacheFile *cache_file); void build_mask(Mask *mask); void build_movieclip(MovieClip *clip); + void build_probe(Object *object); void add_collision_relations(const OperationKey &key, Scene *scene, Object *ob, Group *group, bool dupli, const char *name); void add_forcefield_relations(const OperationKey &key, Scene *scene, Object *ob, ParticleSystem *psys, EffectorWeights *eff, bool add_absorption, const char *name); diff --git a/source/blender/makesrna/intern/rna_probe.c b/source/blender/makesrna/intern/rna_probe.c index 9f8f14d4312..9121ea53106 100644 --- a/source/blender/makesrna/intern/rna_probe.c +++ b/source/blender/makesrna/intern/rna_probe.c @@ -40,10 +40,18 @@ #include "MEM_guardedalloc.h" #include "BKE_main.h" +#include "DEG_depsgraph.h" + +#include "DNA_object_types.h" #include "WM_api.h" #include "WM_types.h" +static void rna_Probe_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + DEG_id_tag_update(ptr->id.data, OB_RECALC_DATA); +} + #else static EnumPropertyItem probe_type_items[] = { @@ -72,14 +80,14 @@ static void rna_def_probe(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 999999.0f); RNA_def_property_ui_text(prop, "Probe Clip Start", "Probe clip start, below which objects will not appear in reflections"); - RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL); + RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_Probe_recalc"); prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "clipend"); RNA_def_property_range(prop, 0.0f, 999999.0f); RNA_def_property_ui_text(prop, "Probe Clip End", "Probe clip end, beyond which objects will not appear in reflections"); - RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL); + RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_Probe_recalc"); prop = RNA_def_property(srna, "influence_distance", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "distinf"); |