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
path: root/source
diff options
context:
space:
mode:
authorSebastián Barschkis <sebbas@sebbas.org>2021-02-04 14:06:56 +0300
committerSebastián Barschkis <sebbas@sebbas.org>2021-02-04 17:09:12 +0300
commitbd973dbc44ad061f2e9fca45ea496c7049c9e9a4 (patch)
treecc80df62b989cb36668e56659fb74974e3caf978 /source
parent4ef8033116df0a0d2945d7cf0b15cc7a8d3ea421 (diff)
LibOverride: Only show relevant operators in outliner menu
No need to show certain operators when they have no functionality. For example, when adding a library override from the outliner menu, there should only be an option to add one (i.e. reset, delete, resync operators not relevant for objects without library override). Reviewed By: mont29 Differential Revision: https://developer.blender.org/D10301
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 2a2803c58dd..f1ac226d7be 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -1789,21 +1789,44 @@ static bool outliner_id_operation_item_poll(bContext *C,
const int enum_value)
{
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
+ TreeElement *te = get_target_element(space_outliner);
+ TreeStoreElem *tselem = TREESTORE(te);
+ if (!TSE_IS_REAL_ID(tselem)) {
+ return false;
+ }
+
+ Object *ob = NULL;
+ if (GS(tselem->id->name) == ID_OB) {
+ ob = (Object *)tselem->id;
+ }
switch (enum_value) {
case OUTLINER_IDOP_MARK_ASSET:
case OUTLINER_IDOP_CLEAR_ASSET:
return U.experimental.use_asset_browser;
case OUTLINER_IDOP_OVERRIDE_LIBRARY_CREATE:
+ if (ID_IS_OVERRIDABLE_LIBRARY(tselem->id)) {
+ return true;
+ }
+ return false;
case OUTLINER_IDOP_OVERRIDE_LIBRARY_CREATE_HIERARCHY:
- return true;
+ if (ID_IS_OVERRIDABLE_LIBRARY(tselem->id) || (ID_IS_LINKED(tselem->id))) {
+ return true;
+ }
+ return false;
+ case OUTLINER_IDOP_OVERRIDE_LIBRARY_PROXY_CONVERT:
+ if (ob != NULL && ob->proxy != NULL) {
+ return true;
+ }
+ return false;
case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET:
case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET_HIERARCHY:
- return true;
case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESYNC_HIERARCHY:
- return true;
case OUTLINER_IDOP_OVERRIDE_LIBRARY_DELETE_HIERARCHY:
- return true;
+ if (ID_IS_OVERRIDE_LIBRARY_REAL(tselem->id)) {
+ return true;
+ }
+ return false;
case OUTLINER_IDOP_SINGLE:
if (!space_outliner || ELEM(space_outliner->outlinevis, SO_SCENES, SO_VIEW_LAYER)) {
return true;