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:
2019-03-15 12:45:41 +11:00
parent 388ff003e2
commit 3400fe3ece
14 changed files with 340 additions and 212 deletions

View File

@@ -1486,14 +1486,14 @@ class WM_OT_owner_disable(Operator):
class WM_OT_tool_set_by_name(Operator):
class WM_OT_tool_set_by_id(Operator):
"""Set the tool by name (for keymaps)"""
bl_idname = "wm.tool_set_by_name"
bl_idname = "wm.tool_set_by_id"
bl_label = "Set Tool By Name"
name: StringProperty(
name="Text",
description="Display name of the tool",
name="Identifier",
description="Identifier of the tool",
)
cycle: BoolProperty(
name="Cycle",
@@ -1518,8 +1518,8 @@ class WM_OT_tool_set_by_name(Operator):
def execute(self, context):
from bl_ui.space_toolsystem_common import (
activate_by_name,
activate_by_name_or_cycle,
activate_by_id,
activate_by_id_or_cycle,
)
if self.properties.is_property_set("space_type"):
@@ -1527,7 +1527,7 @@ class WM_OT_tool_set_by_name(Operator):
else:
space_type = context.space_data.type
fn = activate_by_name_or_cycle if self.cycle else activate_by_name
fn = activate_by_id_or_cycle if self.cycle else activate_by_id
if fn(context, space_type, self.name):
return {'FINISHED'}
else:
@@ -1800,7 +1800,7 @@ classes = (
WM_OT_owner_disable,
WM_OT_owner_enable,
WM_OT_url_open,
WM_OT_tool_set_by_name,
WM_OT_tool_set_by_id,
WM_OT_toolbar,
WM_MT_splash,
)