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.
This commit is contained in:
Sergey Sharybin
2017-06-09 18:04:05 +02:00
parent dadb99074c
commit ebb2c1511b
5 changed files with 70 additions and 3 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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

View File

@@ -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);

View File

@@ -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");