Cleanup: Return std::string from operator name and description callbacks
With the end goal of simplifying ownership and memory management, and allowing the use of `get_name` in contexts without statically allocated strings, use `std::string` for the return values of these two operator type callbacks instead of `const char *` and `char *`. In the meantime things get uglier in some places. I'd expect `std::string` to be used more in the future elsewhere in Blender though. Pull Request: https://projects.blender.org/blender/blender/pulls/110823
This commit is contained in:
parent
6fa4519b98
commit
f0467b4615
|
@ -2118,7 +2118,8 @@ static int insert_key_menu_invoke(bContext *C, wmOperator *op, const wmEvent * /
|
||||||
* to assign shortcuts to arbitrarily named keying sets. See #89560.
|
* to assign shortcuts to arbitrarily named keying sets. See #89560.
|
||||||
* These menu items perform the key-frame insertion (not this operator)
|
* These menu items perform the key-frame insertion (not this operator)
|
||||||
* hence the #OPERATOR_INTERFACE return. */
|
* hence the #OPERATOR_INTERFACE return. */
|
||||||
uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(op->type, op->ptr), ICON_NONE);
|
uiPopupMenu *pup = UI_popup_menu_begin(
|
||||||
|
C, WM_operatortype_name(op->type, op->ptr).c_str(), ICON_NONE);
|
||||||
uiLayout *layout = UI_popup_menu_layout(pup);
|
uiLayout *layout = UI_popup_menu_layout(pup);
|
||||||
|
|
||||||
/* Even though `ANIM_OT_keyframe_insert_menu` can show a menu in one line,
|
/* Even though `ANIM_OT_keyframe_insert_menu` can show a menu in one line,
|
||||||
|
|
|
@ -432,15 +432,15 @@ static int pose_clear_paths_exec(bContext *C, wmOperator *op)
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *pose_clear_paths_description(bContext * /*C*/,
|
static std::string pose_clear_paths_description(bContext * /*C*/,
|
||||||
wmOperatorType * /*ot*/,
|
wmOperatorType * /*ot*/,
|
||||||
PointerRNA *ptr)
|
PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
const bool only_selected = RNA_boolean_get(ptr, "only_selected");
|
const bool only_selected = RNA_boolean_get(ptr, "only_selected");
|
||||||
if (only_selected) {
|
if (only_selected) {
|
||||||
return BLI_strdup(TIP_("Clear motion paths of selected bones"));
|
return TIP_("Clear motion paths of selected bones");
|
||||||
}
|
}
|
||||||
return BLI_strdup(TIP_("Clear motion paths of all bones"));
|
return TIP_("Clear motion paths of all bones");
|
||||||
}
|
}
|
||||||
|
|
||||||
void POSE_OT_paths_clear(wmOperatorType *ot)
|
void POSE_OT_paths_clear(wmOperatorType *ot)
|
||||||
|
|
|
@ -352,18 +352,17 @@ static bool asset_clear_poll(bContext *C)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *asset_clear_get_description(bContext * /*C*/,
|
static std::string asset_clear_get_description(bContext * /*C*/,
|
||||||
wmOperatorType * /*op*/,
|
wmOperatorType * /*op*/,
|
||||||
PointerRNA *values)
|
PointerRNA *values)
|
||||||
{
|
{
|
||||||
const bool set_fake_user = RNA_boolean_get(values, "set_fake_user");
|
const bool set_fake_user = RNA_boolean_get(values, "set_fake_user");
|
||||||
if (!set_fake_user) {
|
if (!set_fake_user) {
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
return TIP_(
|
||||||
return BLI_strdup(
|
"Delete all asset metadata, turning the selected asset data-blocks back into normal "
|
||||||
TIP_("Delete all asset metadata, turning the selected asset data-blocks back into normal "
|
"data-blocks, and set Fake User to ensure the data-blocks will still be saved");
|
||||||
"data-blocks, and set Fake User to ensure the data-blocks will still be saved"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ASSET_OT_clear(wmOperatorType *ot)
|
static void ASSET_OT_clear(wmOperatorType *ot)
|
||||||
|
|
|
@ -370,17 +370,18 @@ static int run_node_group_invoke(bContext *C, wmOperator *op, const wmEvent * /*
|
||||||
return run_node_group_exec(C, op);
|
return run_node_group_exec(C, op);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *run_node_group_get_description(bContext *C, wmOperatorType * /*ot*/, PointerRNA *ptr)
|
static std::string run_node_group_get_description(bContext *C,
|
||||||
|
wmOperatorType * /*ot*/,
|
||||||
|
PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
const asset_system::AssetRepresentation *asset = get_asset(*C, *ptr, nullptr);
|
const asset_system::AssetRepresentation *asset = get_asset(*C, *ptr, nullptr);
|
||||||
if (!asset) {
|
if (!asset) {
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
const char *description = asset->get_metadata().description;
|
if (!asset->get_metadata().description) {
|
||||||
if (!description) {
|
return "";
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
return BLI_strdup(description);
|
return asset->get_metadata().description;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_attribute_search_or_value_buttons(uiLayout *layout,
|
static void add_attribute_search_or_value_buttons(uiLayout *layout,
|
||||||
|
|
|
@ -108,5 +108,5 @@ void ED_select_pick_params_from_operator(PointerRNA *ptr, SelectPick_Params *par
|
||||||
* Get-name callback for #wmOperatorType.get_name, this is mainly useful so the selection
|
* Get-name callback for #wmOperatorType.get_name, this is mainly useful so the selection
|
||||||
* action is shown in the status-bar.
|
* action is shown in the status-bar.
|
||||||
*/
|
*/
|
||||||
const char *ED_select_pick_get_name(wmOperatorType *ot, PointerRNA *ptr);
|
std::string ED_select_pick_get_name(wmOperatorType *ot, PointerRNA *ptr);
|
||||||
const char *ED_select_circle_get_name(wmOperatorType *ot, PointerRNA *ptr);
|
std::string ED_select_circle_get_name(wmOperatorType *ot, PointerRNA *ptr);
|
||||||
|
|
|
@ -4811,9 +4811,11 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block,
|
||||||
short height,
|
short height,
|
||||||
const char *tip)
|
const char *tip)
|
||||||
{
|
{
|
||||||
|
std::string operator_name;
|
||||||
if (!str) {
|
if (!str) {
|
||||||
if (ot && ot->srna) {
|
if (ot && ot->srna) {
|
||||||
str = WM_operatortype_name(ot, nullptr);
|
operator_name = WM_operatortype_name(ot, nullptr);
|
||||||
|
str = operator_name.c_str();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
str = "";
|
str = "";
|
||||||
|
@ -6661,12 +6663,12 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
|
||||||
}
|
}
|
||||||
else if (but->optype) {
|
else if (but->optype) {
|
||||||
if (type == BUT_GET_RNA_LABEL) {
|
if (type == BUT_GET_RNA_LABEL) {
|
||||||
tmp = BLI_strdup(WM_operatortype_name(but->optype, opptr));
|
tmp = BLI_strdup(WM_operatortype_name(but->optype, opptr).c_str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bContextStore *previous_ctx = CTX_store_get(C);
|
bContextStore *previous_ctx = CTX_store_get(C);
|
||||||
CTX_store_set(C, but->context);
|
CTX_store_set(C, but->context);
|
||||||
tmp = WM_operatortype_description(C, but->optype, opptr);
|
tmp = BLI_strdup(WM_operatortype_description(C, but->optype, opptr).c_str());
|
||||||
CTX_store_set(C, previous_ctx);
|
CTX_store_set(C, previous_ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6693,10 +6695,10 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
|
||||||
wmOperatorType *ot = UI_but_operatortype_get_from_enum_menu(but, nullptr);
|
wmOperatorType *ot = UI_but_operatortype_get_from_enum_menu(but, nullptr);
|
||||||
if (ot) {
|
if (ot) {
|
||||||
if (type == BUT_GET_RNA_LABEL) {
|
if (type == BUT_GET_RNA_LABEL) {
|
||||||
tmp = BLI_strdup(WM_operatortype_name(ot, nullptr));
|
tmp = BLI_strdup(WM_operatortype_name(ot, nullptr).c_str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tmp = WM_operatortype_description(C, ot, nullptr);
|
tmp = BLI_strdup(WM_operatortype_description(C, ot, nullptr).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6833,10 +6835,10 @@ void UI_but_extra_icon_string_info_get(bContext *C, uiButExtraOpIcon *extra_icon
|
||||||
|
|
||||||
switch (si->type) {
|
switch (si->type) {
|
||||||
case BUT_GET_LABEL:
|
case BUT_GET_LABEL:
|
||||||
tmp = BLI_strdup(WM_operatortype_name(optype, opptr));
|
tmp = BLI_strdup(WM_operatortype_name(optype, opptr).c_str());
|
||||||
break;
|
break;
|
||||||
case BUT_GET_TIP:
|
case BUT_GET_TIP:
|
||||||
tmp = WM_operatortype_description(C, optype, opptr);
|
tmp = BLI_strdup(WM_operatortype_description(C, optype, opptr).c_str());
|
||||||
break;
|
break;
|
||||||
case BUT_GET_OP_KEYMAP: {
|
case BUT_GET_OP_KEYMAP: {
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
|
|
@ -423,7 +423,7 @@ static void ui_but_user_menu_add(bContext *C, uiBut *but, bUserMenu *um)
|
||||||
}
|
}
|
||||||
else if ((ot = UI_but_operatortype_get_from_enum_menu(but, &prop))) {
|
else if ((ot = UI_but_operatortype_get_from_enum_menu(but, &prop))) {
|
||||||
ED_screen_user_menu_item_add_operator(&um->items,
|
ED_screen_user_menu_item_add_operator(&um->items,
|
||||||
WM_operatortype_name(ot, nullptr),
|
WM_operatortype_name(ot, nullptr).c_str(),
|
||||||
ot,
|
ot,
|
||||||
nullptr,
|
nullptr,
|
||||||
RNA_property_identifier(prop),
|
RNA_property_identifier(prop),
|
||||||
|
|
|
@ -1219,9 +1219,11 @@ static uiBut *uiItemFullO_ptr_ex(uiLayout *layout,
|
||||||
/* Take care to fill 'r_opptr' whatever happens. */
|
/* Take care to fill 'r_opptr' whatever happens. */
|
||||||
uiBlock *block = layout->root->block;
|
uiBlock *block = layout->root->block;
|
||||||
|
|
||||||
|
std::string operator_name;
|
||||||
if (!name) {
|
if (!name) {
|
||||||
if (ot && ot->srna && (flag & UI_ITEM_R_ICON_ONLY) == 0) {
|
if (ot && ot->srna && (flag & UI_ITEM_R_ICON_ONLY) == 0) {
|
||||||
name = WM_operatortype_name(ot, nullptr);
|
operator_name = WM_operatortype_name(ot, nullptr);
|
||||||
|
name = operator_name.c_str();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
name = "";
|
name = "";
|
||||||
|
@ -3608,8 +3610,10 @@ void uiItemMenuEnumFullO_ptr(uiLayout *layout,
|
||||||
/* Caller must check */
|
/* Caller must check */
|
||||||
BLI_assert(ot->srna != nullptr);
|
BLI_assert(ot->srna != nullptr);
|
||||||
|
|
||||||
|
std::string operator_name;
|
||||||
if (name == nullptr) {
|
if (name == nullptr) {
|
||||||
name = WM_operatortype_name(ot, nullptr);
|
operator_name = WM_operatortype_name(ot, nullptr);
|
||||||
|
name = operator_name.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layout->root->type == UI_LAYOUT_MENU && !icon) {
|
if (layout->root->type == UI_LAYOUT_MENU && !icon) {
|
||||||
|
|
|
@ -104,7 +104,7 @@ static bool hud_panel_operator_redo_poll(const bContext *C, PanelType * /*pt*/)
|
||||||
static void hud_panel_operator_redo_draw_header(const bContext *C, Panel *panel)
|
static void hud_panel_operator_redo_draw_header(const bContext *C, Panel *panel)
|
||||||
{
|
{
|
||||||
wmOperator *op = WM_operator_last_redo(C);
|
wmOperator *op = WM_operator_last_redo(C);
|
||||||
STRNCPY(panel->drawname, WM_operatortype_name(op->type, op->ptr));
|
STRNCPY(panel->drawname, WM_operatortype_name(op->type, op->ptr).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hud_panel_operator_redo_draw(const bContext *C, Panel *panel)
|
static void hud_panel_operator_redo_draw(const bContext *C, Panel *panel)
|
||||||
|
|
|
@ -1052,20 +1052,19 @@ static uiTooltipData *ui_tooltip_data_from_gizmo(bContext *C, wmGizmo *gz)
|
||||||
nullptr;
|
nullptr;
|
||||||
if (gzop != nullptr) {
|
if (gzop != nullptr) {
|
||||||
/* Description */
|
/* Description */
|
||||||
char *info = WM_operatortype_description_or_name(C, gzop->type, &gzop->ptr);
|
std::string info = WM_operatortype_description_or_name(C, gzop->type, &gzop->ptr);
|
||||||
|
|
||||||
if (info != nullptr) {
|
if (!info.empty()) {
|
||||||
char *text = info;
|
const char *text = info.c_str();
|
||||||
|
|
||||||
if (gzop_actions[i].prefix != nullptr) {
|
if (gzop_actions[i].prefix != nullptr) {
|
||||||
text = BLI_sprintfN("%s: %s", gzop_actions[i].prefix, info);
|
text = BLI_sprintfN("%s: %s", gzop_actions[i].prefix, info.c_str());
|
||||||
MEM_freeN(info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text != nullptr) {
|
if (text != nullptr) {
|
||||||
uiTooltipField *field = text_field_add(
|
uiTooltipField *field = text_field_add(
|
||||||
data, uiTooltipFormat::Style::Header, uiTooltipFormat::ColorID::Value, true);
|
data, uiTooltipFormat::Style::Header, uiTooltipFormat::ColorID::Value, true);
|
||||||
field->text = text;
|
field->text = BLI_strdup(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ static bool menu_items_from_ui_create_item_from_button(MenuSearch_Data *data,
|
||||||
MenuSearch_Item *item = nullptr;
|
MenuSearch_Item *item = nullptr;
|
||||||
|
|
||||||
/* Use override if the name is empty, this can happen with popovers. */
|
/* Use override if the name is empty, this can happen with popovers. */
|
||||||
const char *drawstr_override = nullptr;
|
std::string drawstr_override = nullptr;
|
||||||
const char *drawstr_sep = (but->flag & UI_BUT_HAS_SEP_CHAR) ?
|
const char *drawstr_sep = (but->flag & UI_BUT_HAS_SEP_CHAR) ?
|
||||||
strrchr(but->drawstr, UI_SEP_CHAR) :
|
strrchr(but->drawstr, UI_SEP_CHAR) :
|
||||||
nullptr;
|
nullptr;
|
||||||
|
@ -237,7 +237,7 @@ static bool menu_items_from_ui_create_item_from_button(MenuSearch_Data *data,
|
||||||
|
|
||||||
if (item != nullptr) {
|
if (item != nullptr) {
|
||||||
/* Handle shared settings. */
|
/* Handle shared settings. */
|
||||||
if (drawstr_override != nullptr) {
|
if (!drawstr_override.empty()) {
|
||||||
const char *drawstr_suffix = drawstr_sep ? drawstr_sep : "";
|
const char *drawstr_suffix = drawstr_sep ? drawstr_sep : "";
|
||||||
std::string drawstr = std::string("(") + drawstr_override + ")" + drawstr_suffix;
|
std::string drawstr = std::string("(") + drawstr_override + ")" + drawstr_suffix;
|
||||||
item->drawstr = strdup_memarena(memarena, drawstr.c_str());
|
item->drawstr = strdup_memarena(memarena, drawstr.c_str());
|
||||||
|
|
|
@ -2718,7 +2718,7 @@ static eAutoPropButsReturn template_operator_property_buts_draw_single(
|
||||||
UI_block_lock_clear(block);
|
UI_block_lock_clear(block);
|
||||||
|
|
||||||
if (layout_flags & UI_TEMPLATE_OP_PROPS_SHOW_TITLE) {
|
if (layout_flags & UI_TEMPLATE_OP_PROPS_SHOW_TITLE) {
|
||||||
uiItemL(layout, WM_operatortype_name(op->type, op->ptr), ICON_NONE);
|
uiItemL(layout, WM_operatortype_name(op->type, op->ptr).c_str(), ICON_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* menu */
|
/* menu */
|
||||||
|
|
|
@ -1395,9 +1395,9 @@ static int edbm_select_mode_invoke(bContext *C, wmOperator *op, const wmEvent *e
|
||||||
return edbm_select_mode_exec(C, op);
|
return edbm_select_mode_exec(C, op);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *edbm_select_mode_get_description(bContext * /*C*/,
|
static std::string edbm_select_mode_get_description(bContext * /*C*/,
|
||||||
wmOperatorType * /*op*/,
|
wmOperatorType * /*op*/,
|
||||||
PointerRNA *values)
|
PointerRNA *values)
|
||||||
{
|
{
|
||||||
const int type = RNA_enum_get(values, "type");
|
const int type = RNA_enum_get(values, "type");
|
||||||
|
|
||||||
|
@ -1412,19 +1412,18 @@ static char *edbm_select_mode_get_description(bContext * /*C*/,
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SCE_SELECT_VERTEX:
|
case SCE_SELECT_VERTEX:
|
||||||
return BLI_strdup(TIP_(
|
return TIP_(
|
||||||
"Vertex select - Shift-Click for multiple modes, Ctrl-Click contracts selection"));
|
"Vertex select - Shift-Click for multiple modes, Ctrl-Click contracts selection");
|
||||||
case SCE_SELECT_EDGE:
|
case SCE_SELECT_EDGE:
|
||||||
return BLI_strdup(
|
return TIP_(
|
||||||
TIP_("Edge select - Shift-Click for multiple modes, "
|
"Edge select - Shift-Click for multiple modes, "
|
||||||
"Ctrl-Click expands/contracts selection depending on the current mode"));
|
"Ctrl-Click expands/contracts selection depending on the current mode");
|
||||||
case SCE_SELECT_FACE:
|
case SCE_SELECT_FACE:
|
||||||
return BLI_strdup(
|
return TIP_("Face select - Shift-Click for multiple modes, Ctrl-Click expands selection");
|
||||||
TIP_("Face select - Shift-Click for multiple modes, Ctrl-Click expands selection"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void MESH_OT_select_mode(wmOperatorType *ot)
|
void MESH_OT_select_mode(wmOperatorType *ot)
|
||||||
|
|
|
@ -640,18 +640,18 @@ static bool data_transfer_poll_property(const bContext * /*C*/,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *data_transfer_get_description(bContext * /*C*/,
|
static std::string data_transfer_get_description(bContext * /*C*/,
|
||||||
wmOperatorType * /*ot*/,
|
wmOperatorType * /*ot*/,
|
||||||
PointerRNA *ptr)
|
PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
const bool reverse_transfer = RNA_boolean_get(ptr, "use_reverse_transfer");
|
const bool reverse_transfer = RNA_boolean_get(ptr, "use_reverse_transfer");
|
||||||
|
|
||||||
if (reverse_transfer) {
|
if (reverse_transfer) {
|
||||||
return BLI_strdup(TIP_(
|
return TIP_(
|
||||||
"Transfer data layer(s) (weights, edge sharp, etc.) from selected meshes to active one"));
|
"Transfer data layer(s) (weights, edge sharp, etc.) from selected meshes to active one");
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBJECT_OT_data_transfer(wmOperatorType *ot)
|
void OBJECT_OT_data_transfer(wmOperatorType *ot)
|
||||||
|
|
|
@ -1513,15 +1513,15 @@ static int object_clear_paths_exec(bContext *C, wmOperator *op)
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *object_clear_paths_description(bContext * /*C*/,
|
static std::string object_clear_paths_description(bContext * /*C*/,
|
||||||
wmOperatorType * /*ot*/,
|
wmOperatorType * /*ot*/,
|
||||||
PointerRNA *ptr)
|
PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
const bool only_selected = RNA_boolean_get(ptr, "only_selected");
|
const bool only_selected = RNA_boolean_get(ptr, "only_selected");
|
||||||
if (only_selected) {
|
if (only_selected) {
|
||||||
return BLI_strdup(TIP_("Clear motion paths of selected objects"));
|
return TIP_("Clear motion paths of selected objects");
|
||||||
}
|
}
|
||||||
return BLI_strdup(TIP_("Clear motion paths of all objects"));
|
return TIP_("Clear motion paths of all objects");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBJECT_OT_paths_clear(wmOperatorType *ot)
|
void OBJECT_OT_paths_clear(wmOperatorType *ot)
|
||||||
|
|
|
@ -1878,17 +1878,16 @@ static int modifier_apply_as_shapekey_invoke(bContext *C, wmOperator *op, const
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *modifier_apply_as_shapekey_get_description(bContext * /*C*/,
|
static std::string modifier_apply_as_shapekey_get_description(bContext * /*C*/,
|
||||||
wmOperatorType * /*op*/,
|
wmOperatorType * /*op*/,
|
||||||
PointerRNA *values)
|
PointerRNA *values)
|
||||||
{
|
{
|
||||||
bool keep = RNA_boolean_get(values, "keep_modifier");
|
bool keep = RNA_boolean_get(values, "keep_modifier");
|
||||||
|
|
||||||
if (keep) {
|
if (keep) {
|
||||||
return BLI_strdup(TIP_("Apply modifier as a new shapekey and keep it in the stack"));
|
return TIP_("Apply modifier as a new shapekey and keep it in the stack");
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBJECT_OT_modifier_apply_as_shapekey(wmOperatorType *ot)
|
void OBJECT_OT_modifier_apply_as_shapekey(wmOperatorType *ot)
|
||||||
|
|
|
@ -339,18 +339,16 @@ static bool shape_key_remove_poll_property(const bContext * /*C*/,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *shape_key_remove_get_description(bContext * /*C*/,
|
static std::string shape_key_remove_get_description(bContext * /*C*/,
|
||||||
wmOperatorType * /*ot*/,
|
wmOperatorType * /*ot*/,
|
||||||
PointerRNA *ptr)
|
PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
const bool do_apply_mix = RNA_boolean_get(ptr, "apply_mix");
|
const bool do_apply_mix = RNA_boolean_get(ptr, "apply_mix");
|
||||||
|
|
||||||
if (do_apply_mix) {
|
if (do_apply_mix) {
|
||||||
return BLI_strdup(
|
return TIP_("Apply current visible shape to the object data, and delete all shape keys");
|
||||||
TIP_("Apply current visible shape to the object data, and delete all shape keys"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void OBJECT_OT_shape_key_remove(wmOperatorType *ot)
|
void OBJECT_OT_shape_key_remove(wmOperatorType *ot)
|
||||||
|
|
|
@ -2965,9 +2965,9 @@ static int vertex_group_lock_exec(bContext *C, wmOperator *op)
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *vertex_group_lock_description(bContext * /*C*/,
|
static std::string vertex_group_lock_description(bContext * /*C*/,
|
||||||
wmOperatorType * /*op*/,
|
wmOperatorType * /*op*/,
|
||||||
PointerRNA *params)
|
PointerRNA *params)
|
||||||
{
|
{
|
||||||
int action = RNA_enum_get(params, "action");
|
int action = RNA_enum_get(params, "action");
|
||||||
int mask = RNA_enum_get(params, "mask");
|
int mask = RNA_enum_get(params, "mask");
|
||||||
|
@ -2978,51 +2978,49 @@ static char *vertex_group_lock_description(bContext * /*C*/,
|
||||||
case VGROUP_LOCK:
|
case VGROUP_LOCK:
|
||||||
switch (mask) {
|
switch (mask) {
|
||||||
case VGROUP_MASK_ALL:
|
case VGROUP_MASK_ALL:
|
||||||
return BLI_strdup(TIP_("Lock all vertex groups of the active object"));
|
return TIP_("Lock all vertex groups of the active object");
|
||||||
case VGROUP_MASK_SELECTED:
|
case VGROUP_MASK_SELECTED:
|
||||||
return BLI_strdup(TIP_("Lock selected vertex groups of the active object"));
|
return TIP_("Lock selected vertex groups of the active object");
|
||||||
case VGROUP_MASK_UNSELECTED:
|
case VGROUP_MASK_UNSELECTED:
|
||||||
return BLI_strdup(TIP_("Lock unselected vertex groups of the active object"));
|
return TIP_("Lock unselected vertex groups of the active object");
|
||||||
case VGROUP_MASK_INVERT_UNSELECTED:
|
case VGROUP_MASK_INVERT_UNSELECTED:
|
||||||
return BLI_strdup(
|
return TIP_("Lock selected and unlock unselected vertex groups of the active object");
|
||||||
TIP_("Lock selected and unlock unselected vertex groups of the active object"));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VGROUP_UNLOCK:
|
case VGROUP_UNLOCK:
|
||||||
switch (mask) {
|
switch (mask) {
|
||||||
case VGROUP_MASK_ALL:
|
case VGROUP_MASK_ALL:
|
||||||
return BLI_strdup(TIP_("Unlock all vertex groups of the active object"));
|
return TIP_("Unlock all vertex groups of the active object");
|
||||||
case VGROUP_MASK_SELECTED:
|
case VGROUP_MASK_SELECTED:
|
||||||
return BLI_strdup(TIP_("Unlock selected vertex groups of the active object"));
|
return TIP_("Unlock selected vertex groups of the active object");
|
||||||
case VGROUP_MASK_UNSELECTED:
|
case VGROUP_MASK_UNSELECTED:
|
||||||
return BLI_strdup(TIP_("Unlock unselected vertex groups of the active object"));
|
return TIP_("Unlock unselected vertex groups of the active object");
|
||||||
case VGROUP_MASK_INVERT_UNSELECTED:
|
case VGROUP_MASK_INVERT_UNSELECTED:
|
||||||
return BLI_strdup(
|
return TIP_("Unlock selected and lock unselected vertex groups of the active object");
|
||||||
TIP_("Unlock selected and lock unselected vertex groups of the active object"));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VGROUP_TOGGLE:
|
case VGROUP_TOGGLE:
|
||||||
switch (mask) {
|
switch (mask) {
|
||||||
case VGROUP_MASK_ALL:
|
case VGROUP_MASK_ALL:
|
||||||
return BLI_strdup(TIP_("Toggle locks of all vertex groups of the active object"));
|
return TIP_("Toggle locks of all vertex groups of the active object");
|
||||||
case VGROUP_MASK_SELECTED:
|
case VGROUP_MASK_SELECTED:
|
||||||
return BLI_strdup(TIP_("Toggle locks of selected vertex groups of the active object"));
|
return TIP_("Toggle locks of selected vertex groups of the active object");
|
||||||
case VGROUP_MASK_UNSELECTED:
|
case VGROUP_MASK_UNSELECTED:
|
||||||
return BLI_strdup(TIP_("Toggle locks of unselected vertex groups of the active object"));
|
return TIP_("Toggle locks of unselected vertex groups of the active object");
|
||||||
case VGROUP_MASK_INVERT_UNSELECTED:
|
case VGROUP_MASK_INVERT_UNSELECTED:
|
||||||
return BLI_strdup(TIP_(
|
return TIP_(
|
||||||
"Toggle locks of all and invert unselected vertex groups of the active object"));
|
"Toggle locks of all and invert unselected vertex groups of the active object");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VGROUP_INVERT:
|
case VGROUP_INVERT:
|
||||||
switch (mask) {
|
switch (mask) {
|
||||||
case VGROUP_MASK_ALL:
|
case VGROUP_MASK_ALL:
|
||||||
return BLI_strdup(TIP_("Invert locks of all vertex groups of the active object"));
|
return TIP_("Invert locks of all vertex groups of the active object");
|
||||||
case VGROUP_MASK_SELECTED:
|
case VGROUP_MASK_SELECTED:
|
||||||
case VGROUP_MASK_INVERT_UNSELECTED:
|
case VGROUP_MASK_INVERT_UNSELECTED:
|
||||||
return BLI_strdup(TIP_("Invert locks of selected vertex groups of the active object"));
|
return TIP_("Invert locks of selected vertex groups of the active object");
|
||||||
case VGROUP_MASK_UNSELECTED:
|
case VGROUP_MASK_UNSELECTED:
|
||||||
return BLI_strdup(TIP_("Invert locks of unselected vertex groups of the active object"));
|
return TIP_("Invert locks of unselected vertex groups of the active object");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1302,21 +1302,21 @@ static int screen_opengl_render_exec(bContext *C, wmOperator *op)
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *screen_opengl_render_description(bContext * /*C*/,
|
static std::string screen_opengl_render_description(bContext * /*C*/,
|
||||||
wmOperatorType * /*ot*/,
|
wmOperatorType * /*ot*/,
|
||||||
PointerRNA *ptr)
|
PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
if (!RNA_boolean_get(ptr, "animation")) {
|
if (!RNA_boolean_get(ptr, "animation")) {
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RNA_boolean_get(ptr, "render_keyed_only")) {
|
if (RNA_boolean_get(ptr, "render_keyed_only")) {
|
||||||
return BLI_strdup(TIP_(
|
return TIP_(
|
||||||
"Render the viewport for the animation range of this scene, but only render keyframes of "
|
"Render the viewport for the animation range of this scene, but only render keyframes of "
|
||||||
"selected objects"));
|
"selected objects");
|
||||||
}
|
}
|
||||||
|
|
||||||
return BLI_strdup(TIP_("Render the viewport for the animation range of this scene"));
|
return TIP_("Render the viewport for the animation range of this scene");
|
||||||
}
|
}
|
||||||
|
|
||||||
void RENDER_OT_opengl(wmOperatorType *ot)
|
void RENDER_OT_opengl(wmOperatorType *ot)
|
||||||
|
|
|
@ -3704,7 +3704,7 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(op->type, op->ptr), ICON_NONE);
|
uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(op->type, op->ptr).c_str(), ICON_NONE);
|
||||||
uiLayout *layout = UI_popup_menu_layout(pup);
|
uiLayout *layout = UI_popup_menu_layout(pup);
|
||||||
|
|
||||||
/* Vertical Split */
|
/* Vertical Split */
|
||||||
|
@ -3889,7 +3889,7 @@ static int repeat_history_invoke(bContext *C, wmOperator *op, const wmEvent * /*
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(op->type, op->ptr), ICON_NONE);
|
uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(op->type, op->ptr).c_str(), ICON_NONE);
|
||||||
uiLayout *layout = UI_popup_menu_layout(pup);
|
uiLayout *layout = UI_popup_menu_layout(pup);
|
||||||
|
|
||||||
wmOperator *lastop;
|
wmOperator *lastop;
|
||||||
|
@ -3899,7 +3899,7 @@ static int repeat_history_invoke(bContext *C, wmOperator *op, const wmEvent * /*
|
||||||
{
|
{
|
||||||
if ((lastop->type->flag & OPTYPE_REGISTER) && WM_operator_repeat_check(C, lastop)) {
|
if ((lastop->type->flag & OPTYPE_REGISTER) && WM_operator_repeat_check(C, lastop)) {
|
||||||
uiItemIntO(layout,
|
uiItemIntO(layout,
|
||||||
WM_operatortype_name(lastop->type, lastop->ptr),
|
WM_operatortype_name(lastop->type, lastop->ptr).c_str(),
|
||||||
ICON_NONE,
|
ICON_NONE,
|
||||||
op->type->idname,
|
op->type->idname,
|
||||||
"index",
|
"index",
|
||||||
|
|
|
@ -362,7 +362,8 @@ static int weight_sample_group_invoke(bContext *C, wmOperator *op, const wmEvent
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(op->type, op->ptr), ICON_NONE);
|
uiPopupMenu *pup = UI_popup_menu_begin(
|
||||||
|
C, WM_operatortype_name(op->type, op->ptr).c_str(), ICON_NONE);
|
||||||
uiLayout *layout = UI_popup_menu_layout(pup);
|
uiLayout *layout = UI_popup_menu_layout(pup);
|
||||||
wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_vertex_group_set_active", false);
|
wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_vertex_group_set_active", false);
|
||||||
wmOperatorCallContext opcontext = WM_OP_EXEC_DEFAULT;
|
wmOperatorCallContext opcontext = WM_OP_EXEC_DEFAULT;
|
||||||
|
|
|
@ -418,7 +418,7 @@ static int sculpt_color_filter_invoke(bContext *C, wmOperator *op, const wmEvent
|
||||||
return OPERATOR_RUNNING_MODAL;
|
return OPERATOR_RUNNING_MODAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *sculpt_color_filter_get_name(wmOperatorType * /*ot*/, PointerRNA *ptr)
|
static std::string sculpt_color_filter_get_name(wmOperatorType * /*ot*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
PropertyRNA *prop = RNA_struct_find_property(ptr, "type");
|
PropertyRNA *prop = RNA_struct_find_property(ptr, "type");
|
||||||
const int value = RNA_property_enum_get(ptr, prop);
|
const int value = RNA_property_enum_get(ptr, prop);
|
||||||
|
|
|
@ -682,7 +682,9 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *actkeys_paste_description(bContext * /*C*/, wmOperatorType * /*op*/, PointerRNA *ptr)
|
static std::string actkeys_paste_description(bContext * /*C*/,
|
||||||
|
wmOperatorType * /*op*/,
|
||||||
|
PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
/* Custom description if the 'flipped' option is used. */
|
/* Custom description if the 'flipped' option is used. */
|
||||||
if (RNA_boolean_get(ptr, "flipped")) {
|
if (RNA_boolean_get(ptr, "flipped")) {
|
||||||
|
@ -690,7 +692,7 @@ static char *actkeys_paste_description(bContext * /*C*/, wmOperatorType * /*op*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use the default description in the other cases. */
|
/* Use the default description in the other cases. */
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACTION_OT_paste(wmOperatorType *ot)
|
void ACTION_OT_paste(wmOperatorType *ot)
|
||||||
|
|
|
@ -390,26 +390,26 @@ static int track_markers_modal(bContext *C, wmOperator * /*op*/, const wmEvent *
|
||||||
return OPERATOR_PASS_THROUGH;
|
return OPERATOR_PASS_THROUGH;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *track_markers_desc(bContext * /*C*/, wmOperatorType * /*op*/, PointerRNA *ptr)
|
static std::string track_markers_desc(bContext * /*C*/, wmOperatorType * /*op*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
const bool backwards = RNA_boolean_get(ptr, "backwards");
|
const bool backwards = RNA_boolean_get(ptr, "backwards");
|
||||||
const bool sequence = RNA_boolean_get(ptr, "sequence");
|
const bool sequence = RNA_boolean_get(ptr, "sequence");
|
||||||
|
|
||||||
if (backwards && sequence) {
|
if (backwards && sequence) {
|
||||||
return BLI_strdup(TIP_("Track the selected markers backward for the entire clip"));
|
return TIP_("Track the selected markers backward for the entire clip");
|
||||||
}
|
}
|
||||||
if (backwards && !sequence) {
|
if (backwards && !sequence) {
|
||||||
return BLI_strdup(TIP_("Track the selected markers backward by one frame"));
|
return TIP_("Track the selected markers backward by one frame");
|
||||||
}
|
}
|
||||||
if (!backwards && sequence) {
|
if (!backwards && sequence) {
|
||||||
return BLI_strdup(TIP_("Track the selected markers forward for the entire clip"));
|
return TIP_("Track the selected markers forward for the entire clip");
|
||||||
}
|
}
|
||||||
if (!backwards && !sequence) {
|
if (!backwards && !sequence) {
|
||||||
return BLI_strdup(TIP_("Track the selected markers forward by one frame"));
|
return TIP_("Track the selected markers forward by one frame");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use default description. */
|
/* Use default description. */
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLIP_OT_track_markers(wmOperatorType *ot)
|
void CLIP_OT_track_markers(wmOperatorType *ot)
|
||||||
|
|
|
@ -1849,13 +1849,13 @@ static int file_external_operation_exec(bContext *C, wmOperator *op)
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *file_external_operation_description(bContext * /*C*/,
|
static std::string file_external_operation_description(bContext * /*C*/,
|
||||||
wmOperatorType * /*ot*/,
|
wmOperatorType * /*ot*/,
|
||||||
PointerRNA *ptr)
|
PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
const char *description = "";
|
const char *description = "";
|
||||||
RNA_enum_description(file_external_operation, RNA_enum_get(ptr, "operation"), &description);
|
RNA_enum_description(file_external_operation, RNA_enum_get(ptr, "operation"), &description);
|
||||||
return BLI_strdup(description);
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FILE_OT_external_operation(wmOperatorType *ot)
|
void FILE_OT_external_operation(wmOperatorType *ot)
|
||||||
|
|
|
@ -56,7 +56,7 @@ static void file_panel_operator_header(const bContext *C, Panel *panel)
|
||||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||||
wmOperator *op = sfile->op;
|
wmOperator *op = sfile->op;
|
||||||
|
|
||||||
STRNCPY(panel->drawname, WM_operatortype_name(op->type, op->ptr));
|
STRNCPY(panel->drawname, WM_operatortype_name(op->type, op->ptr).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void file_panel_operator(const bContext *C, Panel *panel)
|
static void file_panel_operator(const bContext *C, Panel *panel)
|
||||||
|
|
|
@ -172,7 +172,7 @@ static FileSelectParams *fileselect_ensure_updated_file_params(SpaceFile *sfile)
|
||||||
const bool is_relative_path = (RNA_struct_find_property(op->ptr, "relative_path") != nullptr);
|
const bool is_relative_path = (RNA_struct_find_property(op->ptr, "relative_path") != nullptr);
|
||||||
|
|
||||||
BLI_strncpy_utf8(
|
BLI_strncpy_utf8(
|
||||||
params->title, WM_operatortype_name(op->type, op->ptr), sizeof(params->title));
|
params->title, WM_operatortype_name(op->type, op->ptr).c_str(), sizeof(params->title));
|
||||||
|
|
||||||
if ((prop = RNA_struct_find_property(op->ptr, "filemode"))) {
|
if ((prop = RNA_struct_find_property(op->ptr, "filemode"))) {
|
||||||
params->type = RNA_property_int_get(op->ptr, prop);
|
params->type = RNA_property_int_get(op->ptr, prop);
|
||||||
|
|
|
@ -603,17 +603,17 @@ static int graphkeys_paste_exec(bContext *C, wmOperator *op)
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *graphkeys_paste_description(bContext * /*C*/,
|
static std::string graphkeys_paste_description(bContext * /*C*/,
|
||||||
wmOperatorType * /*op*/,
|
wmOperatorType * /*op*/,
|
||||||
PointerRNA *ptr)
|
PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
/* Custom description if the 'flipped' option is used. */
|
/* Custom description if the 'flipped' option is used. */
|
||||||
if (RNA_boolean_get(ptr, "flipped")) {
|
if (RNA_boolean_get(ptr, "flipped")) {
|
||||||
return BLI_strdup(TIP_("Paste keyframes from mirrored bones if they exist"));
|
return TIP_("Paste keyframes from mirrored bones if they exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use the default description in the other cases. */
|
/* Use the default description in the other cases. */
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void GRAPH_OT_paste(wmOperatorType *ot)
|
void GRAPH_OT_paste(wmOperatorType *ot)
|
||||||
|
|
|
@ -539,16 +539,16 @@ static bool decimate_poll_property(const bContext * /*C*/, wmOperator *op, const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *decimate_desc(bContext * /*C*/, wmOperatorType * /*op*/, PointerRNA *ptr)
|
static std::string decimate_desc(bContext * /*C*/, wmOperatorType * /*op*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (RNA_enum_get(ptr, "mode") == DECIM_ERROR) {
|
if (RNA_enum_get(ptr, "mode") == DECIM_ERROR) {
|
||||||
return BLI_strdup(
|
return TIP_(
|
||||||
TIP_("Decimate F-Curves by specifying how much they can deviate from the original curve"));
|
"Decimate F-Curves by specifying how much they can deviate from the original curve");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use default description. */
|
/* Use default description. */
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const EnumPropertyItem decimate_mode_items[] = {
|
static const EnumPropertyItem decimate_mode_items[] = {
|
||||||
|
|
|
@ -454,19 +454,19 @@ static int node_add_group_asset_invoke(bContext *C, wmOperator *op, const wmEven
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *node_add_group_asset_get_description(bContext *C,
|
static std::string node_add_group_asset_get_description(bContext *C,
|
||||||
wmOperatorType * /*op*/,
|
wmOperatorType * /*op*/,
|
||||||
PointerRNA * /*values*/)
|
PointerRNA * /*values*/)
|
||||||
{
|
{
|
||||||
const asset_system::AssetRepresentation *asset = CTX_wm_asset(C);
|
const asset_system::AssetRepresentation *asset = CTX_wm_asset(C);
|
||||||
if (!asset) {
|
if (!asset) {
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
const AssetMetaData &asset_data = asset->get_metadata();
|
const AssetMetaData &asset_data = asset->get_metadata();
|
||||||
if (!asset_data.description) {
|
if (!asset_data.description) {
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
return BLI_strdup(DATA_(asset_data.description));
|
return TIP_(asset_data.description);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NODE_OT_add_group_asset(wmOperatorType *ot)
|
void NODE_OT_add_group_asset(wmOperatorType *ot)
|
||||||
|
|
|
@ -3611,7 +3611,7 @@ void OUTLINER_OT_data_operation(wmOperatorType *ot)
|
||||||
static int outliner_operator_menu(bContext *C, const char *opname)
|
static int outliner_operator_menu(bContext *C, const char *opname)
|
||||||
{
|
{
|
||||||
wmOperatorType *ot = WM_operatortype_find(opname, false);
|
wmOperatorType *ot = WM_operatortype_find(opname, false);
|
||||||
uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(ot, nullptr), ICON_NONE);
|
uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(ot, nullptr).c_str(), ICON_NONE);
|
||||||
uiLayout *layout = UI_popup_menu_layout(pup);
|
uiLayout *layout = UI_popup_menu_layout(pup);
|
||||||
|
|
||||||
/* set this so the default execution context is the same as submenus */
|
/* set this so the default execution context is the same as submenus */
|
||||||
|
|
|
@ -1482,55 +1482,55 @@ static int sequencer_add_effect_strip_invoke(bContext *C,
|
||||||
return sequencer_add_effect_strip_exec(C, op);
|
return sequencer_add_effect_strip_exec(C, op);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *sequencer_add_effect_strip_desc(bContext * /*C*/,
|
static std::string sequencer_add_effect_strip_desc(bContext * /*C*/,
|
||||||
wmOperatorType * /*op*/,
|
wmOperatorType * /*op*/,
|
||||||
PointerRNA *ptr)
|
PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
const int type = RNA_enum_get(ptr, "type");
|
const int type = RNA_enum_get(ptr, "type");
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SEQ_TYPE_CROSS:
|
case SEQ_TYPE_CROSS:
|
||||||
return BLI_strdup(TIP_("Add a crossfade transition to the sequencer"));
|
return TIP_("Add a crossfade transition to the sequencer");
|
||||||
case SEQ_TYPE_ADD:
|
case SEQ_TYPE_ADD:
|
||||||
return BLI_strdup(TIP_("Add an add effect strip to the sequencer"));
|
return TIP_("Add an add effect strip to the sequencer");
|
||||||
case SEQ_TYPE_SUB:
|
case SEQ_TYPE_SUB:
|
||||||
return BLI_strdup(TIP_("Add a subtract effect strip to the sequencer"));
|
return TIP_("Add a subtract effect strip to the sequencer");
|
||||||
case SEQ_TYPE_ALPHAOVER:
|
case SEQ_TYPE_ALPHAOVER:
|
||||||
return BLI_strdup(TIP_("Add an alpha over effect strip to the sequencer"));
|
return TIP_("Add an alpha over effect strip to the sequencer");
|
||||||
case SEQ_TYPE_ALPHAUNDER:
|
case SEQ_TYPE_ALPHAUNDER:
|
||||||
return BLI_strdup(TIP_("Add an alpha under effect strip to the sequencer"));
|
return TIP_("Add an alpha under effect strip to the sequencer");
|
||||||
case SEQ_TYPE_GAMCROSS:
|
case SEQ_TYPE_GAMCROSS:
|
||||||
return BLI_strdup(TIP_("Add a gamma cross transition to the sequencer"));
|
return TIP_("Add a gamma cross transition to the sequencer");
|
||||||
case SEQ_TYPE_MUL:
|
case SEQ_TYPE_MUL:
|
||||||
return BLI_strdup(TIP_("Add a multiply effect strip to the sequencer"));
|
return TIP_("Add a multiply effect strip to the sequencer");
|
||||||
case SEQ_TYPE_OVERDROP:
|
case SEQ_TYPE_OVERDROP:
|
||||||
return BLI_strdup(TIP_("Add an alpha over drop effect strip to the sequencer"));
|
return TIP_("Add an alpha over drop effect strip to the sequencer");
|
||||||
case SEQ_TYPE_WIPE:
|
case SEQ_TYPE_WIPE:
|
||||||
return BLI_strdup(TIP_("Add a wipe transition to the sequencer"));
|
return TIP_("Add a wipe transition to the sequencer");
|
||||||
case SEQ_TYPE_GLOW:
|
case SEQ_TYPE_GLOW:
|
||||||
return BLI_strdup(TIP_("Add a glow effect strip to the sequencer"));
|
return TIP_("Add a glow effect strip to the sequencer");
|
||||||
case SEQ_TYPE_TRANSFORM:
|
case SEQ_TYPE_TRANSFORM:
|
||||||
return BLI_strdup(TIP_("Add a transform effect strip to the sequencer"));
|
return TIP_("Add a transform effect strip to the sequencer");
|
||||||
case SEQ_TYPE_COLOR:
|
case SEQ_TYPE_COLOR:
|
||||||
return BLI_strdup(TIP_("Add a color strip to the sequencer"));
|
return TIP_("Add a color strip to the sequencer");
|
||||||
case SEQ_TYPE_SPEED:
|
case SEQ_TYPE_SPEED:
|
||||||
return BLI_strdup(TIP_("Add a speed effect strip to the sequencer"));
|
return TIP_("Add a speed effect strip to the sequencer");
|
||||||
case SEQ_TYPE_MULTICAM:
|
case SEQ_TYPE_MULTICAM:
|
||||||
return BLI_strdup(TIP_("Add a multicam selector effect strip to the sequencer"));
|
return TIP_("Add a multicam selector effect strip to the sequencer");
|
||||||
case SEQ_TYPE_ADJUSTMENT:
|
case SEQ_TYPE_ADJUSTMENT:
|
||||||
return BLI_strdup(TIP_("Add an adjustment layer effect strip to the sequencer"));
|
return TIP_("Add an adjustment layer effect strip to the sequencer");
|
||||||
case SEQ_TYPE_GAUSSIAN_BLUR:
|
case SEQ_TYPE_GAUSSIAN_BLUR:
|
||||||
return BLI_strdup(TIP_("Add a gaussian blur effect strip to the sequencer"));
|
return TIP_("Add a gaussian blur effect strip to the sequencer");
|
||||||
case SEQ_TYPE_TEXT:
|
case SEQ_TYPE_TEXT:
|
||||||
return BLI_strdup(TIP_("Add a text strip to the sequencer"));
|
return TIP_("Add a text strip to the sequencer");
|
||||||
case SEQ_TYPE_COLORMIX:
|
case SEQ_TYPE_COLORMIX:
|
||||||
return BLI_strdup(TIP_("Add a color mix effect strip to the sequencer"));
|
return TIP_("Add a color mix effect strip to the sequencer");
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use default description. */
|
/* Use default description. */
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void SEQUENCER_OT_effect_strip_add(wmOperatorType *ot)
|
void SEQUENCER_OT_effect_strip_add(wmOperatorType *ot)
|
||||||
|
|
|
@ -160,7 +160,7 @@ void ED_select_pick_params_from_operator(PointerRNA *ptr, SelectPick_Params *par
|
||||||
/** \name Operator Naming Callbacks
|
/** \name Operator Naming Callbacks
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
const char *ED_select_pick_get_name(wmOperatorType * /*ot*/, PointerRNA *ptr)
|
std::string ED_select_pick_get_name(wmOperatorType * /*ot*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
SelectPick_Params params = {eSelectOp(0)};
|
SelectPick_Params params = {eSelectOp(0)};
|
||||||
ED_select_pick_params_from_operator(ptr, ¶ms);
|
ED_select_pick_params_from_operator(ptr, ¶ms);
|
||||||
|
@ -180,7 +180,7 @@ const char *ED_select_pick_get_name(wmOperatorType * /*ot*/, PointerRNA *ptr)
|
||||||
return CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Select");
|
return CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Select");
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *ED_select_circle_get_name(wmOperatorType * /*ot*/, PointerRNA *ptr)
|
std::string ED_select_circle_get_name(wmOperatorType * /*ot*/, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
/* Matches options in #WM_operator_properties_select_operation_simple */
|
/* Matches options in #WM_operator_properties_select_operation_simple */
|
||||||
const eSelectOp sel_op = eSelectOp(RNA_enum_get(ptr, "mode"));
|
const eSelectOp sel_op = eSelectOp(RNA_enum_get(ptr, "mode"));
|
||||||
|
|
|
@ -1267,14 +1267,14 @@ static void rna_wmKeyMapItem_name_get(PointerRNA *ptr, char *value)
|
||||||
{
|
{
|
||||||
wmKeyMapItem *kmi = static_cast<wmKeyMapItem *>(ptr->data);
|
wmKeyMapItem *kmi = static_cast<wmKeyMapItem *>(ptr->data);
|
||||||
wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
|
wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
|
||||||
strcpy(value, ot ? WM_operatortype_name(ot, kmi->ptr) : kmi->idname);
|
strcpy(value, ot ? WM_operatortype_name(ot, kmi->ptr).c_str() : kmi->idname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rna_wmKeyMapItem_name_length(PointerRNA *ptr)
|
static int rna_wmKeyMapItem_name_length(PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
wmKeyMapItem *kmi = static_cast<wmKeyMapItem *>(ptr->data);
|
wmKeyMapItem *kmi = static_cast<wmKeyMapItem *>(ptr->data);
|
||||||
wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
|
wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
|
||||||
return strlen(ot ? WM_operatortype_name(ot, kmi->ptr) : kmi->idname);
|
return strlen(ot ? WM_operatortype_name(ot, kmi->ptr).c_str() : kmi->idname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool rna_KeyMapItem_userdefined_get(PointerRNA *ptr)
|
static bool rna_KeyMapItem_userdefined_get(PointerRNA *ptr)
|
||||||
|
@ -1465,7 +1465,9 @@ static void rna_operator_cancel_cb(bContext *C, wmOperator *op)
|
||||||
RNA_parameter_list_free(&list);
|
RNA_parameter_list_free(&list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *rna_operator_description_cb(bContext *C, wmOperatorType *ot, PointerRNA *prop_ptr)
|
static std::string rna_operator_description_cb(bContext *C,
|
||||||
|
wmOperatorType *ot,
|
||||||
|
PointerRNA *prop_ptr)
|
||||||
{
|
{
|
||||||
extern FunctionRNA rna_Operator_description_func;
|
extern FunctionRNA rna_Operator_description_func;
|
||||||
|
|
||||||
|
@ -1486,11 +1488,11 @@ static char *rna_operator_description_cb(bContext *C, wmOperatorType *ot, Pointe
|
||||||
RNA_parameter_get_lookup(&list, "result", &ret);
|
RNA_parameter_get_lookup(&list, "result", &ret);
|
||||||
result = (char *)ret;
|
result = (char *)ret;
|
||||||
|
|
||||||
if (result && result[0]) {
|
if (result) {
|
||||||
result = BLI_strdup(result);
|
result = result;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = nullptr;
|
result = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_parameter_list_free(&list);
|
RNA_parameter_list_free(&list);
|
||||||
|
|
|
@ -355,7 +355,7 @@ static void rna_XrActionMapItem_op_name_get(PointerRNA *ptr, char *value)
|
||||||
if (ami->op_properties_ptr) {
|
if (ami->op_properties_ptr) {
|
||||||
wmOperatorType *ot = WM_operatortype_find(ami->op, 1);
|
wmOperatorType *ot = WM_operatortype_find(ami->op, 1);
|
||||||
if (ot) {
|
if (ot) {
|
||||||
strcpy(value, WM_operatortype_name(ot, ami->op_properties_ptr));
|
strcpy(value, WM_operatortype_name(ot, ami->op_properties_ptr).c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ static int rna_XrActionMapItem_op_name_length(PointerRNA *ptr)
|
||||||
if (ami->op_properties_ptr) {
|
if (ami->op_properties_ptr) {
|
||||||
wmOperatorType *ot = WM_operatortype_find(ami->op, 1);
|
wmOperatorType *ot = WM_operatortype_find(ami->op, 1);
|
||||||
if (ot) {
|
if (ot) {
|
||||||
return strlen(WM_operatortype_name(ot, ami->op_properties_ptr));
|
return strlen(WM_operatortype_name(ot, ami->op_properties_ptr).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return strlen(ami->op);
|
return strlen(ami->op);
|
||||||
|
|
|
@ -24,6 +24,7 @@ set(INC
|
||||||
../../../intern/clog
|
../../../intern/clog
|
||||||
../../../intern/ghost
|
../../../intern/ghost
|
||||||
../../../intern/memutil
|
../../../intern/memutil
|
||||||
|
../../../extern/fmtlib/include
|
||||||
../bmesh
|
../bmesh
|
||||||
|
|
||||||
# RNA_prototypes.h
|
# RNA_prototypes.h
|
||||||
|
|
|
@ -1112,12 +1112,14 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname,
|
||||||
int flag);
|
int flag);
|
||||||
wmOperatorTypeMacro *WM_operatortype_macro_define(wmOperatorType *ot, const char *idname);
|
wmOperatorTypeMacro *WM_operatortype_macro_define(wmOperatorType *ot, const char *idname);
|
||||||
|
|
||||||
const char *WM_operatortype_name(wmOperatorType *ot, PointerRNA *properties);
|
std::string WM_operatortype_name(wmOperatorType *ot, PointerRNA *properties);
|
||||||
char *WM_operatortype_description(bContext *C, wmOperatorType *ot, PointerRNA *properties);
|
std::string WM_operatortype_description(bContext *C, wmOperatorType *ot, PointerRNA *properties);
|
||||||
/**
|
/**
|
||||||
* Use when we want a label, preferring the description.
|
* Use when we want a label, preferring the description.
|
||||||
*/
|
*/
|
||||||
char *WM_operatortype_description_or_name(bContext *C, wmOperatorType *ot, PointerRNA *properties);
|
std::string WM_operatortype_description_or_name(bContext *C,
|
||||||
|
wmOperatorType *ot,
|
||||||
|
PointerRNA *properties);
|
||||||
|
|
||||||
/* `wm_operator_utils.cc` */
|
/* `wm_operator_utils.cc` */
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,8 @@ struct wmEvent;
|
||||||
struct wmOperator;
|
struct wmOperator;
|
||||||
struct wmWindowManager;
|
struct wmWindowManager;
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "BLI_compiler_attrs.h"
|
#include "BLI_compiler_attrs.h"
|
||||||
#include "BLI_utildefines.h"
|
#include "BLI_utildefines.h"
|
||||||
#include "DNA_listBase.h"
|
#include "DNA_listBase.h"
|
||||||
|
@ -984,14 +986,14 @@ struct wmOperatorType {
|
||||||
* The returned string does not need to be freed.
|
* The returned string does not need to be freed.
|
||||||
* The returned string is expected to be translated if needed.
|
* The returned string is expected to be translated if needed.
|
||||||
*/
|
*/
|
||||||
const char *(*get_name)(wmOperatorType *, PointerRNA *);
|
std::string (*get_name)(wmOperatorType *, PointerRNA *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a different description to use in the user interface, based on property values.
|
* Return a different description to use in the user interface, based on property values.
|
||||||
* The returned string must be freed by the caller, unless NULL.
|
* The returned string must be freed by the caller, unless NULL.
|
||||||
* The returned string is expected to be translated if needed.
|
* The returned string is expected to be translated if needed.
|
||||||
*/
|
*/
|
||||||
char *(*get_description)(bContext *C, wmOperatorType *, PointerRNA *);
|
std::string (*get_description)(bContext *C, wmOperatorType *, PointerRNA *);
|
||||||
|
|
||||||
/** rna for properties */
|
/** rna for properties */
|
||||||
StructRNA *srna;
|
StructRNA *srna;
|
||||||
|
|
|
@ -355,7 +355,7 @@ static char *dropbox_tooltip(bContext *C, wmDrag *drag, const int xy[2], wmDropB
|
||||||
tooltip = drop->tooltip(C, drag, xy, drop);
|
tooltip = drop->tooltip(C, drag, xy, drop);
|
||||||
}
|
}
|
||||||
if (!tooltip) {
|
if (!tooltip) {
|
||||||
tooltip = BLI_strdup(WM_operatortype_name(drop->ot, drop->ptr));
|
tooltip = BLI_strdup(WM_operatortype_name(drop->ot, drop->ptr).c_str());
|
||||||
}
|
}
|
||||||
/* XXX Doing translation here might not be ideal, but later we have no more
|
/* XXX Doing translation here might not be ideal, but later we have no more
|
||||||
* access to ot (and hence op context)... */
|
* access to ot (and hence op context)... */
|
||||||
|
|
|
@ -6248,7 +6248,8 @@ void WM_window_cursor_keymap_status_refresh(bContext *C, wmWindow *win)
|
||||||
}
|
}
|
||||||
if (kmi) {
|
if (kmi) {
|
||||||
wmOperatorType *ot = WM_operatortype_find(kmi->idname, false);
|
wmOperatorType *ot = WM_operatortype_find(kmi->idname, false);
|
||||||
const char *name = (ot) ? WM_operatortype_name(ot, kmi->ptr) : kmi->idname;
|
const std::string operator_name = WM_operatortype_name(ot, kmi->ptr);
|
||||||
|
const char *name = (ot) ? operator_name.c_str() : kmi->idname;
|
||||||
STRNCPY(cd->text[button_index][type_index], name);
|
STRNCPY(cd->text[button_index][type_index], name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
# include <shlobj.h>
|
# include <shlobj.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include "MEM_CacheLimiterC-Api.h"
|
#include "MEM_CacheLimiterC-Api.h"
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
|
@ -2873,12 +2875,12 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
|
||||||
return wm_open_mainfile__open(C, op);
|
return wm_open_mainfile__open(C, op);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *wm_open_mainfile_description(bContext * /*C*/,
|
static std::string wm_open_mainfile_description(bContext * /*C*/,
|
||||||
wmOperatorType * /*op*/,
|
wmOperatorType * /*op*/,
|
||||||
PointerRNA *params)
|
PointerRNA *params)
|
||||||
{
|
{
|
||||||
if (!RNA_struct_property_is_set(params, "filepath")) {
|
if (!RNA_struct_property_is_set(params, "filepath")) {
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
char filepath[FILE_MAX];
|
char filepath[FILE_MAX];
|
||||||
|
@ -2886,7 +2888,7 @@ static char *wm_open_mainfile_description(bContext * /*C*/,
|
||||||
|
|
||||||
BLI_stat_t stats;
|
BLI_stat_t stats;
|
||||||
if (BLI_stat(filepath, &stats) == -1) {
|
if (BLI_stat(filepath, &stats) == -1) {
|
||||||
return BLI_sprintfN("%s\n\n%s", filepath, TIP_("File Not Found"));
|
return fmt::format("{}\n\n{}", filepath, TIP_("File Not Found"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Date. */
|
/* Date. */
|
||||||
|
@ -2903,13 +2905,13 @@ static char *wm_open_mainfile_description(bContext * /*C*/,
|
||||||
char size_str[FILELIST_DIRENTRY_SIZE_LEN];
|
char size_str[FILELIST_DIRENTRY_SIZE_LEN];
|
||||||
BLI_filelist_entry_size_to_string(nullptr, uint64_t(stats.st_size), false, size_str);
|
BLI_filelist_entry_size_to_string(nullptr, uint64_t(stats.st_size), false, size_str);
|
||||||
|
|
||||||
return BLI_sprintfN("%s\n\n%s: %s %s\n%s: %s",
|
return fmt::format("{}\n\n{}: {} {}\n{}: {}",
|
||||||
filepath,
|
filepath,
|
||||||
TIP_("Modified"),
|
TIP_("Modified"),
|
||||||
date_st,
|
date_st,
|
||||||
time_st,
|
time_st,
|
||||||
TIP_("Size"),
|
TIP_("Size"),
|
||||||
size_str);
|
size_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* currently fits in a pointer */
|
/* currently fits in a pointer */
|
||||||
|
@ -3362,23 +3364,23 @@ static bool wm_save_mainfile_check(bContext * /*C*/, wmOperator *op)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *wm_save_as_mainfile_get_name(wmOperatorType *ot, PointerRNA *ptr)
|
static std::string wm_save_as_mainfile_get_name(wmOperatorType *ot, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
if (RNA_boolean_get(ptr, "copy")) {
|
if (RNA_boolean_get(ptr, "copy")) {
|
||||||
return CTX_IFACE_(ot->translation_context, "Save Copy");
|
return CTX_IFACE_(ot->translation_context, "Save Copy");
|
||||||
}
|
}
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *wm_save_as_mainfile_get_description(bContext * /*C*/,
|
static std::string wm_save_as_mainfile_get_description(bContext * /*C*/,
|
||||||
wmOperatorType * /*ot*/,
|
wmOperatorType * /*ot*/,
|
||||||
PointerRNA *ptr)
|
PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
if (RNA_boolean_get(ptr, "copy")) {
|
if (RNA_boolean_get(ptr, "copy")) {
|
||||||
return BLI_strdup(TIP_(
|
return BLI_strdup(TIP_(
|
||||||
"Save the current file in the desired location but do not make the saved file active"));
|
"Save the current file in the desired location but do not make the saved file active"));
|
||||||
}
|
}
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void WM_OT_save_as_mainfile(wmOperatorType *ot)
|
void WM_OT_save_as_mainfile(wmOperatorType *ot)
|
||||||
|
@ -3458,16 +3460,16 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *wm_save_mainfile_get_description(bContext * /*C*/,
|
static std::string wm_save_mainfile_get_description(bContext * /*C*/,
|
||||||
wmOperatorType * /*ot*/,
|
wmOperatorType * /*ot*/,
|
||||||
PointerRNA *ptr)
|
PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
if (RNA_boolean_get(ptr, "incremental")) {
|
if (RNA_boolean_get(ptr, "incremental")) {
|
||||||
return BLI_strdup(
|
return TIP_(
|
||||||
TIP_("Save the current Blender file with a numerically incremented name that does not "
|
"Save the current Blender file with a numerically incremented name that does not "
|
||||||
"overwrite any existing files"));
|
"overwrite any existing files");
|
||||||
}
|
}
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void WM_OT_save_mainfile(wmOperatorType *ot)
|
void WM_OT_save_mainfile(wmOperatorType *ot)
|
||||||
|
|
|
@ -573,44 +573,41 @@ static void wm_operatortype_free_macro(wmOperatorType *ot)
|
||||||
BLI_freelistN(&ot->macro);
|
BLI_freelistN(&ot->macro);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *WM_operatortype_name(wmOperatorType *ot, PointerRNA *properties)
|
std::string WM_operatortype_name(wmOperatorType *ot, PointerRNA *properties)
|
||||||
{
|
{
|
||||||
const char *name = nullptr;
|
std::string name;
|
||||||
|
|
||||||
if (ot->get_name && properties) {
|
if (ot->get_name && properties) {
|
||||||
name = ot->get_name(ot, properties);
|
name = ot->get_name(ot, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (name && name[0]) ? name : RNA_struct_ui_name(ot->srna);
|
return name.empty() ? std::string(RNA_struct_ui_name(ot->srna)) : name;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *WM_operatortype_description(bContext *C, wmOperatorType *ot, PointerRNA *properties)
|
std::string WM_operatortype_description(bContext *C, wmOperatorType *ot, PointerRNA *properties)
|
||||||
{
|
{
|
||||||
if (ot->get_description && properties) {
|
if (ot->get_description && properties) {
|
||||||
char *description = ot->get_description(C, ot, properties);
|
std::string description = ot->get_description(C, ot, properties);
|
||||||
|
if (!description.empty()) {
|
||||||
if (description) {
|
return description;
|
||||||
if (description[0]) {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
MEM_freeN(description);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *info = RNA_struct_ui_description(ot->srna);
|
const char *info = RNA_struct_ui_description(ot->srna);
|
||||||
if (info && info[0]) {
|
if (info && info[0]) {
|
||||||
return BLI_strdup(info);
|
return info;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
char *WM_operatortype_description_or_name(bContext *C, wmOperatorType *ot, PointerRNA *properties)
|
std::string WM_operatortype_description_or_name(bContext *C,
|
||||||
|
wmOperatorType *ot,
|
||||||
|
PointerRNA *properties)
|
||||||
{
|
{
|
||||||
char *text = WM_operatortype_description(C, ot, properties);
|
std::string text = WM_operatortype_description(C, ot, properties);
|
||||||
if (text == nullptr) {
|
if (text.empty()) {
|
||||||
const char *text_orig = WM_operatortype_name(ot, properties);
|
const std::string text_orig = WM_operatortype_name(ot, properties);
|
||||||
if (text_orig != nullptr) {
|
if (!text_orig.empty()) {
|
||||||
text = BLI_strdup(text_orig);
|
text = BLI_strdup(text_orig.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
|
|
|
@ -1048,7 +1048,8 @@ int WM_menu_invoke_ex(bContext *C, wmOperator *op, wmOperatorCallContext opconte
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(op->type, op->ptr), ICON_NONE);
|
uiPopupMenu *pup = UI_popup_menu_begin(
|
||||||
|
C, WM_operatortype_name(op->type, op->ptr).c_str(), ICON_NONE);
|
||||||
uiLayout *layout = UI_popup_menu_layout(pup);
|
uiLayout *layout = UI_popup_menu_layout(pup);
|
||||||
/* set this so the default execution context is the same as submenus */
|
/* set this so the default execution context is the same as submenus */
|
||||||
uiLayoutSetOperatorContext(layout, opcontext);
|
uiLayoutSetOperatorContext(layout, opcontext);
|
||||||
|
@ -1883,7 +1884,7 @@ static int wm_call_menu_exec(bContext *C, wmOperator *op)
|
||||||
return UI_popup_menu_invoke(C, idname, op->reports);
|
return UI_popup_menu_invoke(C, idname, op->reports);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *wm_call_menu_get_name(wmOperatorType *ot, PointerRNA *ptr)
|
static std::string wm_call_menu_get_name(wmOperatorType *ot, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
char idname[BKE_ST_MAXNAME];
|
char idname[BKE_ST_MAXNAME];
|
||||||
RNA_string_get(ptr, "name", idname);
|
RNA_string_get(ptr, "name", idname);
|
||||||
|
@ -1962,7 +1963,7 @@ static int wm_call_panel_exec(bContext *C, wmOperator *op)
|
||||||
return UI_popover_panel_invoke(C, idname, keep_open, op->reports);
|
return UI_popover_panel_invoke(C, idname, keep_open, op->reports);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *wm_call_panel_get_name(wmOperatorType *ot, PointerRNA *ptr)
|
static std::string wm_call_panel_get_name(wmOperatorType *ot, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
char idname[BKE_ST_MAXNAME];
|
char idname[BKE_ST_MAXNAME];
|
||||||
RNA_string_get(ptr, "name", idname);
|
RNA_string_get(ptr, "name", idname);
|
||||||
|
|
Loading…
Reference in New Issue