diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-01-11 17:43:57 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-01-11 17:45:00 +0300 |
commit | a08f687b91a2a7880889f7970bcefd10e92b0966 (patch) | |
tree | cd443f02eed38b293693bc2dcea29a6762eaf0b9 /source/blender | |
parent | 656b9a46b356d304a688d8661c1958c57b454828 (diff) |
Fix poll and name of collection link/unlink operators
Reported via IRC by Pablo Vazquez (venomgfx).
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_collections.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c index fb89c1818ac..3cf7a1ed2dc 100644 --- a/source/blender/editors/space_outliner/outliner_collections.c +++ b/source/blender/editors/space_outliner/outliner_collections.c @@ -93,12 +93,14 @@ static CollectionOverride *outliner_override_active(bContext *UNUSED(C)) static int collections_editor_poll(bContext *C) { - ScrArea *sa = CTX_wm_area(C); - if ((sa) && (sa->spacetype == SPACE_OUTLINER)) { - SpaceOops *so = CTX_wm_space_outliner(C); - return (so->outlinevis == SO_COLLECTIONS); - } - return 0; + SpaceOops *so = CTX_wm_space_outliner(C); + return (so != NULL) && (so->outlinevis == SO_COLLECTIONS); +} + +static int view_layer_editor_poll(bContext *C) +{ + SpaceOops *so = CTX_wm_space_outliner(C); + return (so != NULL) && (so->outlinevis == SO_ACT_LAYER); } /* -------------------------------------------------------------------- */ @@ -241,13 +243,14 @@ void OUTLINER_OT_collection_link(wmOperatorType *ot) PropertyRNA *prop; /* identifiers */ - ot->name = "Add Collection"; + ot->name = "Link Collection"; ot->idname = "OUTLINER_OT_collection_link"; ot->description = "Link a new collection to the active layer"; /* api callbacks */ ot->exec = collection_link_exec; ot->invoke = collection_link_invoke; + ot->poll = view_layer_editor_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -264,6 +267,10 @@ void OUTLINER_OT_collection_link(wmOperatorType *ot) */ static int collection_unlink_poll(bContext *C) { + if (view_layer_editor_poll(C) == 0) { + return 0; + } + LayerCollection *lc = outliner_collection_active(C); if (lc == NULL) { @@ -303,7 +310,7 @@ static int collection_unlink_exec(bContext *C, wmOperator *op) void OUTLINER_OT_collection_unlink(wmOperatorType *ot) { /* identifiers */ - ot->name = "Add Collection"; + ot->name = "Unlink Collection"; ot->idname = "OUTLINER_OT_collection_unlink"; ot->description = "Unlink collection from the active layer"; |