Geometry Nodes: Show node tool name in redo panel

Depends on the "relative_asset_identifier" property format.
If that is changed in the future, this callback can be adjusted.

See #101778
This commit is contained in:
Hans Goudey
2023-09-11 13:02:42 -04:00
parent 9da88301ef
commit ee1ee584de

View File

@@ -438,6 +438,16 @@ static void run_node_group_ui(bContext *C, wmOperator *op)
}
}
static std::string run_node_group_get_name(wmOperatorType * /*ot*/, PointerRNA *ptr)
{
int len;
char *name_c = RNA_string_get_alloc(ptr, "relative_asset_identifier", nullptr, 0, &len);
StringRef ref(name_c, len);
std::string name = ref.drop_prefix(ref.find_last_of('/') + 1);
MEM_freeN(name_c);
return name;
}
void GEOMETRY_OT_execute_node_group(wmOperatorType *ot)
{
ot->name = "Run Node Group";
@@ -449,6 +459,7 @@ void GEOMETRY_OT_execute_node_group(wmOperatorType *ot)
ot->exec = run_node_group_exec;
ot->get_description = run_node_group_get_description;
ot->ui = run_node_group_ui;
ot->get_name = run_node_group_get_name;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;