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:
Diffstat (limited to 'source/blender/editors/interface/interface_context_menu.c')
-rw-r--r--source/blender/editors/interface/interface_context_menu.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c
index 3e76cd1cde4..870c3a2a13f 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -38,6 +38,7 @@
#include "BKE_idprop.h"
#include "BKE_screen.h"
+#include "ED_asset.h"
#include "ED_keyframing.h"
#include "ED_screen.h"
@@ -952,6 +953,22 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
}
}
+ /* If the button reprents an id, it can set the "id" context pointer. */
+ if (ED_asset_can_make_single_from_context(C)) {
+ ID *id = CTX_data_pointer_get_type(C, "id", &RNA_ID).data;
+
+ /* Gray out items depending on if data-block is an asset. Preferably this could be done via
+ * operator poll, but that doesn't work since the operator also works with "selected_ids",
+ * which isn't cheap to check. */
+ uiLayout *sub = uiLayoutColumn(layout, true);
+ uiLayoutSetEnabled(sub, !id->asset_data);
+ uiItemO(sub, NULL, ICON_NONE, "ASSET_OT_mark");
+ sub = uiLayoutColumn(layout, true);
+ uiLayoutSetEnabled(sub, id->asset_data);
+ uiItemO(sub, NULL, ICON_NONE, "ASSET_OT_clear");
+ uiItemS(layout);
+ }
+
/* Pointer properties and string properties with
* prop_search support jumping to target object/bone. */
if (but->rnapoin.data && but->rnaprop) {