diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-12-18 20:18:00 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-12-21 18:05:48 +0300 |
commit | 0edd93effbc1c0adf7aa9c5647ef69845496f669 (patch) | |
tree | 66cf32ac697824226fa8de790b0d70ada5ce42b5 /source/blender/makesrna | |
parent | adec52a8a843a5224e1e59a1dfdcff4986d7dc18 (diff) |
Fix inconsistent/broken Cycles object visibility for instances.
Object visibility is now handled by the depsgraph iterator, but this API
was incomplete as it made no distinction for visibility of the object itself,
particles and generated instances.
The depsgraph iterator API now includes information about which part of the
object is visible, and this is used by Cycles to replace the old custom logic.
Cycles and EEVEE visibility should now be consistent, which unfortunately does
means some subtle compatibility breakage for both.
Fixes T58956, T58202, T59284.
Differential Revision: https://developer.blender.org/D4109
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_depsgraph.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index 1103e5c1f92..d03dfc65ef4 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -46,6 +46,7 @@ #include "BLI_math.h" #include "BKE_anim.h" +#include "BKE_object.h" #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_debug.h" @@ -79,6 +80,22 @@ static PointerRNA rna_DepsgraphObjectInstance_instance_object_get(PointerRNA *pt return rna_pointer_inherit_refine(ptr, &RNA_Object, instance_object); } +static bool rna_DepsgraphObjectInstance_show_self_get(PointerRNA *ptr) +{ + BLI_Iterator *iterator = ptr->data; + DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data; + int ob_visibility = BKE_object_visibility(iterator->current, deg_iter->eval_mode); + return (ob_visibility & OB_VISIBLE_SELF) != 0; +} + +static bool rna_DepsgraphObjectInstance_show_particles_get(PointerRNA *ptr) +{ + BLI_Iterator *iterator = ptr->data; + DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data; + int ob_visibility = BKE_object_visibility(iterator->current, deg_iter->eval_mode); + return (ob_visibility & OB_VISIBLE_PARTICLES) != 0; +} + static PointerRNA rna_DepsgraphObjectInstance_parent_get(PointerRNA *ptr) { BLI_Iterator *iterator = ptr->data; @@ -444,9 +461,19 @@ static void rna_def_depsgraph_instance(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); RNA_def_property_pointer_funcs(prop, "rna_DepsgraphObjectInstance_object_get", NULL, NULL, NULL); + prop = RNA_def_property(srna, "show_self", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Show Self", "The object geometry itself should be visible in the render"); + RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_show_self_get", NULL); + + prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Show Particles", "Particles part of the object should be visible in the render"); + RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_show_particles_get", NULL); + prop = RNA_def_property(srna, "is_instance", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Is Instance", "Denotes whether the object is coming from dupli-list"); + RNA_def_property_ui_text(prop, "Is Instance", "Denotes if the object is generated by another object"); RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_is_instance_get", NULL); prop = RNA_def_property(srna, "instance_object", PROP_POINTER, PROP_NONE); @@ -457,7 +484,7 @@ static void rna_def_depsgraph_instance(BlenderRNA *brna) prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_ui_text(prop, "Parent", "Evaluated parent object of the duplication list"); + RNA_def_property_ui_text(prop, "Parent", "If the object is an instance, the parent object that generated it"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); RNA_def_property_pointer_funcs(prop, "rna_DepsgraphObjectInstance_parent_get", NULL, NULL, NULL); @@ -476,7 +503,7 @@ static void rna_def_depsgraph_instance(BlenderRNA *brna) prop = RNA_def_property(srna, "random_id", PROP_INT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Dupli random id", "Random id for this dupli object"); + RNA_def_property_ui_text(prop, "Dupli random id", "Random id for this instance, typically for randomized shading"); RNA_def_property_int_funcs(prop, "rna_DepsgraphObjectInstance_random_id_get", NULL, NULL); prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX); |