diff --git a/source/blender/editors/interface/interface.cc b/source/blender/editors/interface/interface.cc index 6da7576d513..73da3b65ecd 100644 --- a/source/blender/editors/interface/interface.cc +++ b/source/blender/editors/interface/interface.cc @@ -6515,6 +6515,8 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...) va_list args; uiStringInfo *si; + PointerRNA *opptr = UI_but_operator_ptr_get(but); + const EnumPropertyItem *items = nullptr, *item = nullptr; int totitems; bool free_items = false; @@ -6593,10 +6595,13 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...) } else if (but->optype) { if (type == BUT_GET_RNA_LABEL) { - tmp = BLI_strdup(WM_operatortype_name(but->optype, but->opptr)); + tmp = BLI_strdup(WM_operatortype_name(but->optype, opptr)); } else { - tmp = WM_operatortype_description(C, but->optype, but->opptr); + bContextStore *previous_ctx = CTX_store_get(C); + CTX_store_set(C, but->context); + tmp = WM_operatortype_description(C, but->optype, opptr); + CTX_store_set(C, previous_ctx); } } else if (ELEM(but->type, UI_BTYPE_MENU, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER)) { @@ -6679,7 +6684,6 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...) int(ui_but_value_get(but)); } else if (but->optype) { - PointerRNA *opptr = UI_but_operator_ptr_get(but); wmOperatorType *ot = but->optype; /* So the context is passed to `itemf` functions. */ diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc index 0e3e6f0ece9..05b481035ba 100644 --- a/source/blender/editors/space_node/node_add.cc +++ b/source/blender/editors/space_node/node_add.cc @@ -456,6 +456,22 @@ static int node_add_group_asset_invoke(bContext *C, wmOperator *op, const wmEven return OPERATOR_FINISHED; } +static char *node_add_group_asset_get_description(struct bContext *C, + struct wmOperatorType * /*op*/, + struct PointerRNA * /*values*/) +{ + bool is_valid; + const AssetHandle handle = CTX_wm_asset_handle(C, &is_valid); + if (!is_valid) { + return nullptr; + } + const AssetMetaData &asset_data = *ED_asset_handle_get_metadata(&handle); + if (!asset_data.description) { + return nullptr; + } + return BLI_strdup(asset_data.description); +} + void NODE_OT_add_group_asset(wmOperatorType *ot) { ot->name = "Add Node Group Asset"; @@ -464,6 +480,7 @@ void NODE_OT_add_group_asset(wmOperatorType *ot) ot->invoke = node_add_group_asset_invoke; ot->poll = node_add_group_poll; + ot->get_description = node_add_group_asset_get_description; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; }