Tool System: split UI label from tool identifiers
Prepare for exposing tool registration to the Python API. - Generated tools can use their own prefix so naming collisions won't happen between hard coded & generated tools. - Add-on authors can use the add-on name as a prefix. Currently the names match, renaming will happen next.
This commit is contained in:
@@ -54,7 +54,7 @@ struct bToolRef *WM_toolsystem_ref_find(struct WorkSpace *workspace, const bTool
|
||||
bool WM_toolsystem_ref_ensure(
|
||||
struct WorkSpace *workspace, const bToolKey *tkey,
|
||||
struct bToolRef **r_tref);
|
||||
struct bToolRef *WM_toolsystem_ref_set_by_name(
|
||||
struct bToolRef *WM_toolsystem_ref_set_by_id(
|
||||
struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey,
|
||||
const char *name, bool cycle);
|
||||
|
||||
|
@@ -69,7 +69,7 @@ wmKeyMapItem *WM_keymap_add_panel(wmKeyMap *keymap, const char *idname, int type
|
||||
/* tool wrapper for WM_keymap_add_item */
|
||||
wmKeyMapItem *WM_keymap_add_tool(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
|
||||
{
|
||||
wmKeyMapItem *kmi = WM_keymap_add_item(keymap, "WM_OT_tool_set_by_name", type, val, modifier, keymodifier);
|
||||
wmKeyMapItem *kmi = WM_keymap_add_item(keymap, "WM_OT_tool_set_by_id", type, val, modifier, keymodifier);
|
||||
RNA_string_set(kmi->ptr, "name", idname);
|
||||
return kmi;
|
||||
}
|
||||
@@ -169,7 +169,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
|
||||
if (STRPREFIX(opname, "WM_OT") ||
|
||||
STRPREFIX(opname, "ED_OT_undo"))
|
||||
{
|
||||
if (STREQ(opname, "WM_OT_tool_set_by_name")) {
|
||||
if (STREQ(opname, "WM_OT_tool_set_by_id")) {
|
||||
km = WM_keymap_guess_from_context(C);
|
||||
}
|
||||
|
||||
|
@@ -728,11 +728,11 @@ static void toolsystem_refresh_screen_from_active_tool(
|
||||
}
|
||||
}
|
||||
|
||||
bToolRef *WM_toolsystem_ref_set_by_name(
|
||||
bToolRef *WM_toolsystem_ref_set_by_id(
|
||||
bContext *C, WorkSpace *workspace, const bToolKey *tkey,
|
||||
const char *name, bool cycle)
|
||||
{
|
||||
wmOperatorType *ot = WM_operatortype_find("WM_OT_tool_set_by_name", false);
|
||||
wmOperatorType *ot = WM_operatortype_find("WM_OT_tool_set_by_id", false);
|
||||
/* On startup, Python operatores are not yet loaded. */
|
||||
if (ot == NULL) {
|
||||
return NULL;
|
||||
@@ -775,7 +775,7 @@ static void toolsystem_reinit_with_toolref(
|
||||
.space_type = tref->space_type,
|
||||
.mode = tref->mode,
|
||||
};
|
||||
WM_toolsystem_ref_set_by_name(C, workspace, &tkey, tref->idname, false);
|
||||
WM_toolsystem_ref_set_by_id(C, workspace, &tkey, tref->idname, false);
|
||||
}
|
||||
|
||||
static const char *toolsystem_default_tool(const bToolKey *tkey)
|
||||
|
Reference in New Issue
Block a user