diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-02-28 17:26:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-02-28 17:31:07 +0300 |
commit | d937d06c02f62c11385c1c1f58d963fec03365d9 (patch) | |
tree | c9a7052205b4cbcc4c9219ed2e9838cc5414c56c /source/blender/windowmanager/manipulators | |
parent | 80d1d9629e1d4dd12aca580e3844a24f5d160356 (diff) |
WorkSpace: UI filtering for add-ons
Allows for each workspace to have it's own add-ons on display.
Filtering for: Panels, Menus, Keymaps & Manipulators.
Automatically applies to add-ons at the moment.
Access from workspace, toggled off by default
once enabled, add-ons can be white-listed.
See D3076
Diffstat (limited to 'source/blender/windowmanager/manipulators')
-rw-r--r-- | source/blender/windowmanager/manipulators/WM_manipulator_types.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_types.h b/source/blender/windowmanager/manipulators/WM_manipulator_types.h index 6d83f411db1..8a5580582d7 100644 --- a/source/blender/windowmanager/manipulators/WM_manipulator_types.h +++ b/source/blender/windowmanager/manipulators/WM_manipulator_types.h @@ -341,6 +341,7 @@ typedef struct wmManipulatorGroupTypeRef { typedef struct wmManipulatorGroupType { const char *idname; /* MAX_NAME */ const char *name; /* manipulator-group name - displayed in UI (keymap editor) */ + char owner_id[64]; /* MAX_NAME */ /* poll if manipulator-map should be visible */ wmManipulatorGroupFnPoll poll; diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c index 591e76dc37d..31861df1db2 100644 --- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c +++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c @@ -44,6 +44,7 @@ #include "BKE_context.h" #include "BKE_main.h" #include "BKE_report.h" +#include "BKE_workspace.h" #include "RNA_access.h" #include "RNA_define.h" @@ -203,6 +204,13 @@ void wm_manipulatorgroup_ensure_initialized(wmManipulatorGroup *mgroup, const bC bool WM_manipulator_group_type_poll(const bContext *C, const struct wmManipulatorGroupType *wgt) { + /* If we're tagged, only use compatible. */ + if (wgt->owner_id[0] != '\0') { + const WorkSpace *workspace = CTX_wm_workspace(C); + if (BKE_workspace_owner_id_check(workspace, wgt->owner_id) == false) { + return false; + } + } /* Check for poll function, if manipulator-group belongs to an operator, also check if the operator is running. */ return (!wgt->poll || wgt->poll(C, (wmManipulatorGroupType *)wgt)); } |