Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2017-12-21 18:29:14 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-12-21 18:43:24 +0300
commitb89f2276e502da6480b4ceeb414b0e6b79e4edfe (patch)
tree77d5756979af9137e645fcdfc3fff5dc36702b4a /source/blender/makesrna/intern/rna_object.c
parent103dd660573bb77b8917387bb2773a96de56fb38 (diff)
Implement duplicator viewport/render visibility options
This allows a duplicator (as known as dupli parent) to be in a visible collection so its duplicated objects are visible, however while being invisible for the final render. An object that is a particle emitter is also considered a duplicator. Many thanks for the reviewers for the extense feedback. Reviewers: sergey, campbellbarton Differential Revision: https://developer.blender.org/D2966
Diffstat (limited to 'source/blender/makesrna/intern/rna_object.c')
-rw-r--r--source/blender/makesrna/intern/rna_object.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 786598b0731..b83b793b431 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -232,7 +232,13 @@ static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA
static int rna_Object_is_visible_get(PointerRNA *ptr)
{
Object *ob = ptr->id.data;
- return BKE_object_is_visible(ob);
+ /* The duplicators final visibility is not evaluated by depsgraph, so it's
+ * in ob->base_flag & VISIBLED. Instead we need to take into account whether
+ * we are rendering or not, and the ob->duplicator_visibility_flag.
+ * However for this assessor we don't know if we are rendering, so we just
+ * ignore the duplicator visibility
+ */
+ return BKE_object_is_visible(ob, OB_VISIBILITY_CHECK_UNKNOWN_RENDER_MODE);
}
static void rna_Object_collection_properties_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
@@ -2798,6 +2804,14 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
+ prop = RNA_def_property(srna, "show_duplicator_for_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_RENDER);
+ RNA_def_property_ui_text(prop, "Render Duplicator", "Make duplicator visible when rendering");
+
+ prop = RNA_def_property(srna, "show_duplicator_for_viewport", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_VIEWPORT);
+ RNA_def_property_ui_text(prop, "Show Duplicator", "Make duplicator visible in the viewport");
+
prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_funcs(prop, "rna_Object_is_visible_get", NULL);
RNA_def_property_ui_text(prop, "Visible", "Visible to camera rays, set only on objects evaluated by depsgraph");