diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-12-14 16:46:49 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-12-15 13:56:48 +0300 |
commit | 1f5106de610b115b87ab6121d7871d447ca48cd2 (patch) | |
tree | d929ef94556eac6063c24983cc6b89f52075701c /source/blender/makesrna/intern/rna_object.c | |
parent | 7402b8ec74b4f74371d92816d22869ec9bd95da4 (diff) |
Group collection viewport/render options and remove collection visibility
Users can change the group collection visibility in the outliner
when looking at groups.
Regular collections on the other hand don't have any special visibility control,
if you need a collection to be invisible during render, either don't link it
into the view layer used for F12, or disable it.
This includes:
* Updated unittests - update your lib/tests/layers folder.
* Subversion bump - branches be aware of that.
Note:
Although we are using eval_ctx to determine the visibility of a group collection
when rendering, the depsgraph is still using the same depsgraph for the viewport
and the render engine, so at the moment the render visibility is ignored.
Following next is a workaround for this separately to tag the groups before and
after rendering to tackle that.
Diffstat (limited to 'source/blender/makesrna/intern/rna_object.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 9301ed63adb..786598b0731 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -229,6 +229,12 @@ static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA DEG_id_type_tag(bmain, ID_OB); } +static int rna_Object_is_visible_get(PointerRNA *ptr) +{ + Object *ob = ptr->id.data; + return BKE_object_is_visible(ob); +} + static void rna_Object_collection_properties_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { Object *ob = ptr->data; @@ -2786,27 +2792,14 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Rigid Body Constraint", "Constraint constraining rigid bodies"); /* restrict */ - prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW); - RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport"); - RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update"); - - prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT); - RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport"); - RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER); RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability"); RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update"); - /* Keep it in sync with BKE_object_is_visible. */ prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "base_flag", BASE_VISIBLED); + 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"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); |