[Bf-blender-cvs] [cc8f1040982] blender2.8: Tag depsgraph update when hide and hide_select are changed
Dalai Felinto
noreply at git.blender.org
Fri Apr 21 14:45:22 CEST 2017
Commit: cc8f1040982b6747815f94999136971af6c5a0f2
Author: Dalai Felinto
Date: Fri Apr 21 14:31:38 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBcc8f1040982b6747815f94999136971af6c5a0f2
Tag depsgraph update when hide and hide_select are changed
We were not updating depsgraph when collection just "became" selectable,
but although this doesn't change object selection, it change its
selectability.
===================================================================
M source/blender/editors/space_outliner/outliner_draw.c
M source/blender/makesrna/intern/rna_scene.c
===================================================================
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 82fdee675b9..1755370a5d6 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -245,10 +245,9 @@ static void restrictbutton_gp_layer_flag_cb(bContext *C, void *UNUSED(poin), voi
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
-static void restrictbutton_collection_hide_cb(bContext *C, void *poin, void *UNUSED(poin2))
+static void restrictbutton_collection_flag_cb(bContext *C, void *poin, void *UNUSED(poin2))
{
Scene *scene = poin;
-
/* hide and deselect bases that are directly influenced by this LayerCollection */
/* TODO(sergey): Use proper flag for tagging here. */
DAG_id_tag_update(&scene->id, 0);
@@ -256,20 +255,6 @@ static void restrictbutton_collection_hide_cb(bContext *C, void *poin, void *UNU
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, NULL);
}
-static void restrictbutton_collection_hide_select_cb(bContext *C, void *poin, void *poin2)
-{
- Scene *scene = poin;
- LayerCollection *collection = poin2;
-
- if ((collection->flag & COLLECTION_SELECTABLE) == 0) {
- /* deselect bases that are directly influenced by this LayerCollection */
- /* TODO(sergey): Use proper flag for tagging here. */
- DAG_id_tag_update(&scene->id, 0);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
- }
- WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, NULL);
-}
-
static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void *UNUSED(poin2))
{
ID *id = (ID *)poin;
@@ -579,14 +564,14 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
UI_UNIT_Y, &collection->flag, 0, 0, 0, 0,
TIP_("Restrict/Allow 3D View visibility of objects in the collection"));
- UI_but_func_set(bt, restrictbutton_collection_hide_cb, scene, collection);
+ UI_but_func_set(bt, restrictbutton_collection_flag_cb, scene, collection);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE_N, COLLECTION_SELECTABLE, 0, ICON_RESTRICT_SELECT_OFF,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X,
UI_UNIT_Y, &collection->flag, 0, 0, 0, 0,
TIP_("Restrict/Allow 3D View selection of objects in the collection"));
- UI_but_func_set(bt, restrictbutton_collection_hide_select_cb, scene, collection);
+ UI_but_func_set(bt, restrictbutton_collection_flag_cb, scene, collection);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
UI_block_emboss_set(block, UI_EMBOSS);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 7f1b291d6f4..1691637ec03 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2634,30 +2634,14 @@ static int rna_LayerCollection_move_into(ID *id, LayerCollection *lc_src, Main *
return 1;
}
-static void rna_LayerCollection_hide_update(bContext *C, PointerRNA *UNUSED(ptr))
+static void rna_LayerCollection_flag_update(bContext *C, PointerRNA *UNUSED(ptr))
{
Scene *scene = CTX_data_scene(C);
-
- /* hide and deselect bases that are directly influenced by this LayerCollection */
/* TODO(sergey): Use proper flag for tagging here. */
DAG_id_tag_update(&scene->id, 0);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
-static void rna_LayerCollection_hide_select_update(bContext *C, PointerRNA *ptr)
-{
- LayerCollection *lc = ptr->data;
-
- if ((lc->flag & COLLECTION_SELECTABLE) == 0) {
- Scene *scene = CTX_data_scene(C);
-
- /* deselect bases that are directly influenced by this LayerCollection */
- /* TODO(sergey): Use proper flag for tagging here. */
- DAG_id_tag_update(&scene->id, 0);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
- }
-}
-
static int rna_LayerCollections_active_collection_index_get(PointerRNA *ptr)
{
SceneLayer *sl = (SceneLayer *)ptr->data;
@@ -6248,14 +6232,14 @@ static void rna_def_layer_collection(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
RNA_def_property_ui_text(prop, "Hide", "Restrict visiblity");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_hide_update");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_flag_update");
prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", COLLECTION_SELECTABLE);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1);
RNA_def_property_ui_text(prop, "Hide Selectable", "Restrict selection");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_hide_select_update");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_flag_update");
/* TODO_LAYER_OVERRIDE */
}
More information about the Bf-blender-cvs
mailing list