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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-18 20:18:02 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-20 13:35:25 +0300
commit5e968a996a5397a14d00c49e67c74b993859a1d6 (patch)
tree3ba545b2085c16e5ed33ce868003915f07e3454b /source/blender/makesrna
parent0619f960c2999873ed2e9a24a1f5d77eac03e64d (diff)
Objects: restore per object restrict view/render/select.
Note this is now separate from H key hiding, and meant for more persistent ways to define which objects are relevant to the viewport or render. This avoids some cases where you'd have to create collection specifically to hide objects for viewport/render.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_group.c6
-rw-r--r--source/blender/makesrna/intern/rna_object.c20
2 files changed, 21 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c
index de6c6883977..7266c7578c8 100644
--- a/source/blender/makesrna/intern/rna_group.c
+++ b/source/blender/makesrna/intern/rna_group.c
@@ -260,21 +260,21 @@ void RNA_def_collections(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_SELECT);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1);
- RNA_def_property_ui_text(prop, "Restrict Select", "Disable collection object selection in the 3D viewport");
+ RNA_def_property_ui_text(prop, "Restrict Select", "Disable collection for viewport selection");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_VIEW);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
- RNA_def_property_ui_text(prop, "Restrict Viewport", "Hide collection objects in the 3D viewport");
+ RNA_def_property_ui_text(prop, "Restrict Viewport", "Disable collection in viewport");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_RENDER);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
- RNA_def_property_ui_text(prop, "Restrict Render", "Hide collection objects in renders");
+ RNA_def_property_ui_text(prop, "Restrict Render", "Disable collection in renders");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
}
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index a9b87ea0703..73a2b293c22 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -46,6 +46,7 @@
#include "BKE_paint.h"
#include "BKE_editlattice.h"
#include "BKE_editmesh.h"
+#include "BKE_layer.h"
#include "BKE_object_deform.h"
#include "BKE_object_facemap.h"
@@ -219,9 +220,12 @@ static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA
rna_Object_internal_update(bmain, scene, ptr);
}
-static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- DEG_id_type_tag(bmain, ID_OB);
+ Object *ob = ptr->id.data;
+ BKE_main_collection_sync(bmain);
+ DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
}
static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16])
@@ -2293,6 +2297,18 @@ 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_viewport", 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");