Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Sat, 14 Jul 2018 08:22:15 +0000 (10:22 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 14 Jul 2018 08:27:07 +0000 (10:27 +0200)
1  2 
release/scripts/modules/bpy_extras/keyconfig_utils.py
release/scripts/modules/bpy_extras/keyconfig_utils_experimental.py
release/scripts/startup/bl_operators/wm.py

index 7e5e1fb855cd056703041349cf2880051b0787fa,0ff6595eca9cb92012bc9bb01fa99d2fc92a2f4c..6859e327b6674854351574bc3da0adb57499828b
@@@ -99,6 -99,7 +99,6 @@@ KM_HIERARCHY = 
          ('SequencerCommon', 'SEQUENCE_EDITOR', 'WINDOW', []),
          ('SequencerPreview', 'SEQUENCE_EDITOR', 'WINDOW', []),
      ]),
 -    ('Logic Editor', 'LOGIC_EDITOR', 'WINDOW', []),
  
      ('File Browser', 'FILE_BROWSER', 'WINDOW', [
          ('File Browser Main', 'FILE_BROWSER', 'WINDOW', []),
@@@ -295,8 -296,10 +295,10 @@@ def _kmistr(kmi, is_modal)
      return "".join(s)
  
  
- def keyconfig_export(wm, kc, filepath):
+ def keyconfig_export(
+         wm, kc, filepath, *,
+         all_keymaps=False,
+ ):
      f = open(filepath, "w")
  
      f.write("import bpy\n")
          keymaps = []
      edited_kc = FakeKeyConfig()
      for km in wm.keyconfigs.user.keymaps:
-         if km.is_user_modified:
+         if all_keymaps or km.is_user_modified:
              edited_kc.keymaps.append(km)
      # merge edited keymaps with non-default keyconfig, if it exists
      if kc != wm.keyconfigs.default:
@@@ -405,11 -408,3 +407,11 @@@ def keyconfig_test(kc)
          if testEntry(kc, entry):
              result = True
      return result
 +
 +
 +# Note, we may eventually replace existing logic with this
 +# so key configs are always data.
 +from .keyconfig_utils_experimental import (
 +    keyconfig_export_as_data,
 +    keyconfig_import_from_data,
 +)
index a0ea87d1c93be030ae89db0d816263822c442ce4,0000000000000000000000000000000000000000..6e7b0205a65d5ed44565d2b8ab9fdc35f662526b
mode 100644,000000..100644
--- /dev/null
@@@ -1,244 -1,0 +1,244 @@@
- def keyconfig_export_as_data(wm, kc, filepath):
 +# ##### BEGIN GPL LICENSE BLOCK #####
 +#
 +#  This program is free software; you can redistribute it and/or
 +#  modify it under the terms of the GNU General Public License
 +#  as published by the Free Software Foundation; either version 2
 +#  of the License, or (at your option) any later version.
 +#
 +#  This program is distributed in the hope that it will be useful,
 +#  but WITHOUT ANY WARRANTY; without even the implied warranty of
 +#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +#  GNU General Public License for more details.
 +#
 +#  You should have received a copy of the GNU General Public License
 +#  along with this program; if not, write to the Free Software Foundation,
 +#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 +#
 +# ##### END GPL LICENSE BLOCK #####
 +
 +# <pep8 compliant>
 +
 +__all__ = (
 +    "keyconfig_export_as_data",
 +    "keyconfig_import_from_data",
 +)
 +
 +
 +def indent(levels):
 +    return levels * "    "
 +
 +
 +def round_float_32(f):
 +    from struct import pack, unpack
 +    return unpack("f", pack("f", f))[0]
 +
 +
 +def repr_f32(f):
 +    f_round = round_float_32(f)
 +    f_str = repr(f)
 +    f_str_frac = f_str.partition(".")[2]
 +    if not f_str_frac:
 +        return f_str
 +    for i in range(1, len(f_str_frac)):
 +        f_test = round(f, i)
 +        f_test_round = round_float_32(f_test)
 +        if f_test_round == f_round:
 +            return "%.*f" % (i, f_test)
 +    return f_str
 +
 +
 +def kmi_args_as_data(kmi):
 +    s = [
 +        f"\"type\": '{kmi.type}'",
 +        f"\"value\": '{kmi.value}'"
 +    ]
 +
 +    if kmi.any:
 +        s.append("\"any\": True")
 +    else:
 +        if kmi.shift:
 +            s.append("\"shift\": True")
 +        if kmi.ctrl:
 +            s.append("\"ctrl\": True")
 +        if kmi.alt:
 +            s.append("\"alt\": True")
 +        if kmi.oskey:
 +            s.append("\"oskey\": True")
 +    if kmi.key_modifier and kmi.key_modifier != 'NONE':
 +        s.append(f"\"key_modifier\": '{kmi.key_modifier}'")
 +
 +    return "{" + ", ".join(s) + "}"
 +
 +
 +def _kmi_properties_to_lines_recursive(level, properties, lines):
 +    from bpy.types import OperatorProperties
 +
 +    def string_value(value):
 +        if isinstance(value, (str, bool, int)):
 +            return repr(value)
 +        elif isinstance(value, float):
 +            return repr_f32(value)
 +        elif getattr(value, '__len__', False):
 +            return repr(tuple(value))
 +        raise Exception(f"Export key configuration: can't write {value!r}")
 +
 +    for pname in properties.bl_rna.properties.keys():
 +        if pname != "rna_type":
 +            value = getattr(properties, pname)
 +            if isinstance(value, OperatorProperties):
 +                lines_test = []
 +                _kmi_properties_to_lines_recursive(level + 2, value, lines_test)
 +                if lines_test:
 +                    lines.append(f"{indent(level)}(\n")
 +                    lines.append(f"{indent(level + 1)}\"{pname}\",\n")
 +                    lines.append(f"{indent(level + 1)}" "[\n")
 +                    lines.extend(lines_test)
 +                    lines.append(f"{indent(level + 1)}" "],\n")
 +                    lines.append(f"{indent(level)}" "),\n")
 +                del lines_test
 +            elif properties.is_property_set(pname):
 +                value = string_value(value)
 +                lines.append((f"{indent(level)}(\"{pname}\", {value:s}),\n"))
 +
 +
 +def _kmi_properties_to_lines(level, kmi_props, lines):
 +    if kmi_props is None:
 +        return
 +
 +    lines_test = [f"{indent(level)}\"properties\": " "[\n"]
 +    _kmi_properties_to_lines_recursive(level + 1, kmi_props, lines_test)
 +    if len(lines_test) > 1:
 +        lines_test.append(f"{indent(level)}" "],\n")
 +        lines.extend(lines_test)
 +
 +
 +def _kmi_attrs_or_none(level, kmi):
 +    lines = []
 +    _kmi_properties_to_lines(level + 1, kmi.properties, lines)
 +    if kmi.active is False:
 +        lines.append(f"{indent(level)}\"active\":" "False,\n")
 +    if not lines:
 +        return None
 +    return "".join(lines)
 +
 +
-         if km.is_user_modified:
++def keyconfig_export_as_data(wm, kc, filepath, *, all_keymaps=False):
 +    # Alternate foramt
 +
 +    # Generate a list of keymaps to export:
 +    #
 +    # First add all user_modified keymaps (found in keyconfigs.user.keymaps list),
 +    # then add all remaining keymaps from the currently active custom keyconfig.
 +    #
 +    # This will create a final list of keymaps that can be used as a "diff" against
 +    # the default blender keyconfig, recreating the current setup from a fresh blender
 +    # without needing to export keymaps which haven't been edited.
 +
 +    from .keyconfig_utils import keyconfig_merge
 +
 +    class FakeKeyConfig:
 +        keymaps = []
 +    edited_kc = FakeKeyConfig()
 +    for km in wm.keyconfigs.user.keymaps:
++        if all_keymaps or km.is_user_modified:
 +            edited_kc.keymaps.append(km)
 +    # merge edited keymaps with non-default keyconfig, if it exists
 +    if kc != wm.keyconfigs.default:
 +        export_keymaps = keyconfig_merge(edited_kc, kc)
 +    else:
 +        export_keymaps = keyconfig_merge(edited_kc, edited_kc)
 +
 +    with open(filepath, "w") as fh:
 +        fw = fh.write
 +        fw("keyconfig_data = [\n")
 +
 +        for km, kc_x in export_keymaps:
 +            km = km.active()
 +            fw(f"{indent(1)}" "(\n")
 +            fw(f"{indent(2)}" f"\"{km.name:s}\",\n")
 +            fw(f"{indent(2)}" "{")
 +            fw(f"\"space_type\": '{km.space_type:s}'")
 +            fw(f", \"region_type\": '{km.region_type:s}'")
 +            # We can detect from the kind of items.
 +            if km.is_modal:
 +                fw(", \"modal\": True")
 +            fw("},\n")
 +            fw(f"{indent(2)}" "{\n")
 +            is_modal = km.is_modal
 +            fw(f"{indent(3)}" "\"items\": [\n")
 +            for kmi in km.keymap_items:
 +                if is_modal:
 +                    kmi_id = kmi.propvalue
 +                else:
 +                    kmi_id = kmi.idname
 +
 +                fw(f"{indent(4)}" "(")
 +                kmi_args = kmi_args_as_data(kmi)
 +                kmi_data = _kmi_attrs_or_none(5, kmi)
 +                if kmi_data is not None:
 +                    fw("\n" f"{indent(5)}")
 +                fw(f"\"{kmi_id:s}\"")
 +                if kmi_data is None:
 +                    fw(f", ")
 +                else:
 +                    fw(",\n" f"{indent(5)}")
 +
 +                fw(kmi_args)
 +                if kmi_data is None:
 +                    fw(", None),\n")
 +                else:
 +                    fw(",\n")
 +                    fw(f"{indent(5)}" "{\n")
 +                    fw(kmi_data)
 +                    fw(f"{indent(5)}" "}\n")
 +                    fw(f"{indent(4)}" "),\n")
 +
 +            fw(f"{indent(3)}" "],\n")
 +            fw(f"{indent(2)}" "},\n")
 +            fw(f"{indent(1)}" "),\n")
 +        fw("]\n")
 +        fw("\n\n")
 +        fw("if __name__ == \"__main__\":\n")
 +        fw("    import os\n")
 +        fw("    from bpy_extras.keyconfig_utils import keyconfig_import_from_data\n")
 +        fw("    keyconfig_import_from_data(os.path.splitext(os.path.basename(__file__))[0], keyconfig_data)\n")
 +
 +
 +def keyconfig_import_from_data(name, keyconfig_data):
 +    # Load data in the format defined above.
 +    #
 +    # Runs at load time, keep this fast!
 +
 +    def kmi_props_setattr(kmi_props, attr, value):
 +        if type(value) is list:
 +            kmi_subprop = getattr(kmi_props, attr)
 +            for subattr, subvalue in value:
 +                kmi_props_setattr(kmi_subprop, subattr, subvalue)
 +            return
 +
 +        try:
 +            setattr(kmi_props, attr, value)
 +        except AttributeError:
 +            print(f"Warning: property '{attr}' not found in keymap item '{kmi_props.__class__.__name__}'")
 +        except Exception as ex:
 +            print(f"Warning: {ex!r}")
 +
 +    import bpy
 +    wm = bpy.context.window_manager
 +    kc = wm.keyconfigs.new(name)
 +    del name
 +
 +    for (km_name, km_args, km_content) in keyconfig_data:
 +        km = kc.keymaps.new(km_name, **km_args)
 +        is_modal = km_args.get("modal", False)
 +        new_fn = getattr(km.keymap_items, "new_modal" if is_modal else "new")
 +        for (kmi_idname, kmi_args, kmi_data) in km_content["items"]:
 +            kmi = new_fn(kmi_idname, **kmi_args)
 +            if kmi_data is not None:
 +                if not kmi_data.get("active", True):
 +                    kmi.active = False
 +                kmi_props_data = kmi_data.get("properties", None)
 +                if kmi_props_data is not None:
 +                    kmi_props = kmi.properties
 +                    for attr, value in kmi_props_data:
 +                        kmi_props_setattr(kmi_props, attr, value)
index fe3679733236634f1af7f9f0bec43fc57ab62077,edca3a521eeb3de09eb6f05981ac5c0d3cfcc6ce..cfbc96696d6029f9f58f72b3709566fe94800901
  # <pep8 compliant>
  
  import bpy
 -from bpy.types import Operator
 +from bpy.types import (
 +    Operator,
 +    OperatorFileListElement
 +)
  from bpy.props import (
      BoolProperty,
      EnumProperty,
      FloatProperty,
      IntProperty,
      StringProperty,
 +    CollectionProperty,
  )
  
  from bpy.app.translations import pgettext_tip as tip_
@@@ -59,15 -55,6 +59,15 @@@ rna_relative_prop = BoolProperty
      default=False,
  )
  
 +rna_space_type_prop = EnumProperty(
 +    name="Type",
 +    items=tuple(
 +        (e.identifier, e.name, "", e. value)
 +        for e in bpy.types.Space.bl_rna.properties["type"].enum_items
 +    ),
 +    default='EMPTY',
 +)
 +
  
  def context_path_validate(context, data_path):
      try:
@@@ -162,12 -149,12 +162,12 @@@ class BRUSH_OT_active_index_set(Operato
      bl_idname = "brush.active_index_set"
      bl_label = "Set Brush Number"
  
 -    mode = StringProperty(
 +    mode: StringProperty(
          name="Mode",
          description="Paint mode to set brush for",
          maxlen=1024,
      )
 -    index = IntProperty(
 +    index: IntProperty(
          name="Number",
          description="Brush number",
      )
@@@ -199,8 -186,8 +199,8 @@@ class WM_OT_context_set_boolean(Operato
      bl_label = "Context Set Boolean"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path_prop
 -    value = BoolProperty(
 +    data_path: rna_path_prop
 +    value: BoolProperty(
          name="Value",
          description="Assignment value",
          default=True,
@@@ -215,13 -202,13 +215,13 @@@ class WM_OT_context_set_int(Operator)
      bl_label = "Context Set"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path_prop
 -    value = IntProperty(
 +    data_path: rna_path_prop
 +    value: IntProperty(
          name="Value",
          description="Assign value",
          default=0,
      )
 -    relative = rna_relative_prop
 +    relative: rna_relative_prop
  
      execute = execute_context_assign
  
@@@ -232,8 -219,8 +232,8 @@@ class WM_OT_context_scale_float(Operato
      bl_label = "Context Scale Float"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path_prop
 -    value = FloatProperty(
 +    data_path: rna_path_prop
 +    value: FloatProperty(
          name="Value",
          description="Assign value",
          default=1.0,
@@@ -260,13 -247,13 +260,13 @@@ class WM_OT_context_scale_int(Operator)
      bl_label = "Context Scale Int"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path_prop
 -    value = FloatProperty(
 +    data_path: rna_path_prop
 +    value: FloatProperty(
          name="Value",
          description="Assign value",
          default=1.0,
      )
 -    always_step = BoolProperty(
 +    always_step: BoolProperty(
          name="Always Step",
          description="Always adjust the value by a minimum of 1 when 'value' is not 1.0",
          default=True,
@@@ -303,13 -290,13 +303,13 @@@ class WM_OT_context_set_float(Operator)
      bl_label = "Context Set Float"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path_prop
 -    value = FloatProperty(
 +    data_path: rna_path_prop
 +    value: FloatProperty(
          name="Value",
          description="Assignment value",
          default=0.0,
      )
 -    relative = rna_relative_prop
 +    relative: rna_relative_prop
  
      execute = execute_context_assign
  
@@@ -320,8 -307,8 +320,8 @@@ class WM_OT_context_set_string(Operator
      bl_label = "Context Set String"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path_prop
 -    value = StringProperty(
 +    data_path: rna_path_prop
 +    value: StringProperty(
          name="Value",
          description="Assign value",
          maxlen=1024,
@@@ -336,8 -323,8 +336,8 @@@ class WM_OT_context_set_enum(Operator)
      bl_label = "Context Set Enum"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path_prop
 -    value = StringProperty(
 +    data_path: rna_path_prop
 +    value: StringProperty(
          name="Value",
          description="Assignment value (as a string)",
          maxlen=1024,
@@@ -352,8 -339,8 +352,8 @@@ class WM_OT_context_set_value(Operator)
      bl_label = "Context Set Value"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path_prop
 -    value = StringProperty(
 +    data_path: rna_path_prop
 +    value: StringProperty(
          name="Value",
          description="Assignment value (as a string)",
          maxlen=1024,
@@@ -373,7 -360,7 +373,7 @@@ class WM_OT_context_toggle(Operator)
      bl_label = "Context Toggle"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path_prop
 +    data_path: rna_path_prop
  
      def execute(self, context):
          data_path = self.data_path
@@@ -392,13 -379,13 +392,13 @@@ class WM_OT_context_toggle_enum(Operato
      bl_label = "Context Toggle Values"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path_prop
 -    value_1 = StringProperty(
 +    data_path: rna_path_prop
 +    value_1: StringProperty(
          name="Value",
          description="Toggle enum",
          maxlen=1024,
      )
 -    value_2 = StringProperty(
 +    value_2: StringProperty(
          name="Value",
          description="Toggle enum",
          maxlen=1024,
@@@ -431,9 -418,9 +431,9 @@@ class WM_OT_context_cycle_int(Operator)
      bl_label = "Context Int Cycle"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path_prop
 -    reverse = rna_reverse_prop
 -    wrap = rna_wrap_prop
 +    data_path: rna_path_prop
 +    reverse: rna_reverse_prop
 +    wrap: rna_wrap_prop
  
      def execute(self, context):
          data_path = self.data_path
@@@ -467,9 -454,9 +467,9 @@@ class WM_OT_context_cycle_enum(Operator
      bl_label = "Context Enum Cycle"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path_prop
 -    reverse = rna_reverse_prop
 -    wrap = rna_wrap_prop
 +    data_path: rna_path_prop
 +    reverse: rna_reverse_prop
 +    wrap: rna_wrap_prop
  
      def execute(self, context):
          data_path = self.data_path
@@@ -524,8 -511,8 +524,8 @@@ class WM_OT_context_cycle_array(Operato
      bl_label = "Context Array Cycle"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path_prop
 -    reverse = rna_reverse_prop
 +    data_path: rna_path_prop
 +    reverse: rna_reverse_prop
  
      def execute(self, context):
          data_path = self.data_path
@@@ -549,8 -536,7 +549,8 @@@ class WM_OT_context_menu_enum(Operator)
      bl_idname = "wm.context_menu_enum"
      bl_label = "Context Enum Menu"
      bl_options = {'UNDO', 'INTERNAL'}
 -    data_path = rna_path_prop
 +
 +    data_path: rna_path_prop
  
      def execute(self, context):
          data_path = self.data_path
@@@ -576,8 -562,7 +576,8 @@@ class WM_OT_context_pie_enum(Operator)
      bl_idname = "wm.context_pie_enum"
      bl_label = "Context Enum Pie"
      bl_options = {'UNDO', 'INTERNAL'}
 -    data_path = rna_path_prop
 +
 +    data_path: rna_path_prop
  
      def invoke(self, context, event):
          wm = context.window_manager
@@@ -604,13 -589,12 +604,13 @@@ class WM_OT_operator_pie_enum(Operator)
      bl_idname = "wm.operator_pie_enum"
      bl_label = "Operator Enum Pie"
      bl_options = {'UNDO', 'INTERNAL'}
 -    data_path = StringProperty(
 +
 +    data_path: StringProperty(
          name="Operator",
          description="Operator name (in python as string)",
          maxlen=1024,
      )
 -    prop_string = StringProperty(
 +    prop_string: StringProperty(
          name="Property",
          description="Property name (as a string)",
          maxlen=1024,
@@@ -649,8 -633,8 +649,8 @@@ class WM_OT_context_set_id(Operator)
      bl_label = "Set Library ID"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path_prop
 -    value = StringProperty(
 +    data_path: rna_path_prop
 +    value: StringProperty(
          name="Value",
          description="Assign value",
          maxlen=1024,
@@@ -700,10 -684,10 +700,10 @@@ class WM_OT_context_collection_boolean_
      bl_label = "Context Collection Boolean Set"
      bl_options = {'UNDO', 'REGISTER', 'INTERNAL'}
  
 -    data_path_iter = data_path_iter
 -    data_path_item = data_path_item
 +    data_path_iter: data_path_iter
 +    data_path_item: data_path_item
  
 -    type = EnumProperty(
 +    type: EnumProperty(
          name="Type",
          items=(('TOGGLE', "Toggle", ""),
                 ('ENABLE', "Enable", ""),
@@@ -759,22 -743,22 +759,22 @@@ class WM_OT_context_modal_mouse(Operato
      bl_label = "Context Modal Mouse"
      bl_options = {'GRAB_CURSOR', 'BLOCKING', 'UNDO', 'INTERNAL'}
  
 -    data_path_iter = data_path_iter
 -    data_path_item = data_path_item
 -    header_text = StringProperty(
 +    data_path_iter: data_path_iter
 +    data_path_item: data_path_item
 +    header_text: StringProperty(
          name="Header Text",
          description="Text to display in header during scale",
      )
  
 -    input_scale = FloatProperty(
 +    input_scale: FloatProperty(
          description="Scale the mouse movement by this value before applying the delta",
          default=0.01,
      )
 -    invert = BoolProperty(
 +    invert: BoolProperty(
          description="Invert the mouse input",
          default=False,
      )
 -    initial_x = IntProperty(options={'HIDDEN'})
 +    initial_x: IntProperty(options={'HIDDEN'})
  
      def _values_store(self, context):
          data_path_iter = self.data_path_iter
@@@ -867,7 -851,7 +867,7 @@@ class WM_OT_url_open(Operator)
      bl_label = ""
      bl_options = {'INTERNAL'}
  
 -    url = StringProperty(
 +    url: StringProperty(
          name="URL",
          description="URL to open",
      )
@@@ -884,7 -868,7 +884,7 @@@ class WM_OT_path_open(Operator)
      bl_label = ""
      bl_options = {'INTERNAL'}
  
 -    filepath = StringProperty(
 +    filepath: StringProperty(
          subtype='FILE_PATH',
          options={'SKIP_SAVE'},
      )
@@@ -999,7 -983,7 +999,7 @@@ class WM_OT_doc_view_manual(Operator)
      bl_idname = "wm.doc_view_manual"
      bl_label = "View Manual"
  
 -    doc_id = doc_id
 +    doc_id: doc_id
  
      @staticmethod
      def _find_reference(rna_id, url_mapping, verbose=True):
@@@ -1053,7 -1037,7 +1053,7 @@@ class WM_OT_doc_view(Operator)
      bl_idname = "wm.doc_view"
      bl_label = "View Documentation"
  
 -    doc_id = doc_id
 +    doc_id: doc_id
      if bpy.app.version_cycle == "release":
          _prefix = ("https://docs.blender.org/api/blender_python_api_current")
      else:
@@@ -1105,11 -1089,6 +1105,11 @@@ rna_use_soft_limits = BoolProperty
      name="Use Soft Limits",
  )
  
 +rna_is_overridable_static = BoolProperty(
 +    name="Is Statically Overridable",
 +    default=False,
 +)
 +
  
  class WM_OT_properties_edit(Operator):
      bl_idname = "wm.properties_edit"
      # register only because invoke_props_popup requires.
      bl_options = {'REGISTER', 'INTERNAL'}
  
 -    data_path = rna_path
 -    property = rna_property
 -    value = rna_value
 -    min = rna_min
 -    max = rna_max
 -    use_soft_limits = rna_use_soft_limits
 -    soft_min = rna_min
 -    soft_max = rna_max
 -    description = StringProperty(
 +    data_path: rna_path
 +    property: rna_property
 +    value: rna_value
 +    min: rna_min
 +    max: rna_max
 +    use_soft_limits: rna_use_soft_limits
 +    is_overridable_static: rna_is_overridable_static
 +    soft_min: rna_min
 +    soft_max: rna_max
 +    description: StringProperty(
          name="Tooltip",
      )
  
          # print(exec_str)
          exec(exec_str)
  
 +        exec_str = "item.property_overridable_static_set('[\"%s\"]', %s)" % (prop, self.is_overridable_static)
 +        exec(exec_str)
 +
          rna_idprop_ui_prop_update(item, prop)
  
          self._last_prop[:] = [prop]
          row.prop(self, "min")
          row.prop(self, "max")
  
 -        layout.prop(self, "use_soft_limits")
 +        row = layout.row()
 +        row.prop(self, "use_soft_limits")
 +        row.prop(self, "is_overridable_static")
  
          row = layout.row(align=True)
          row.enabled = self.use_soft_limits
@@@ -1322,7 -1295,7 +1322,7 @@@ class WM_OT_properties_add(Operator)
      bl_label = "Add Property"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path
 +    data_path: rna_path
  
      def execute(self, context):
          from rna_prop_ui import (
@@@ -1365,7 -1338,7 +1365,7 @@@ class WM_OT_properties_context_change(O
      bl_label = ""
      bl_options = {'INTERNAL'}
  
 -    context = StringProperty(
 +    context: StringProperty(
          name="Context",
          maxlen=64,
      )
@@@ -1381,8 -1354,8 +1381,8 @@@ class WM_OT_properties_remove(Operator)
      bl_label = "Remove Property"
      bl_options = {'UNDO', 'INTERNAL'}
  
 -    data_path = rna_path
 -    property = rna_property
 +    data_path: rna_path
 +    property: rna_property
  
      def execute(self, context):
          from rna_prop_ui import (
@@@ -1403,7 -1376,7 +1403,7 @@@ class WM_OT_keyconfig_activate(Operator
      bl_idname = "wm.keyconfig_activate"
      bl_label = "Activate Keyconfig"
  
 -    filepath = StringProperty(
 +    filepath: StringProperty(
          subtype='FILE_PATH',
      )
  
@@@ -1438,7 -1411,7 +1438,7 @@@ class WM_OT_appconfig_activate(Operator
      bl_idname = "wm.appconfig_activate"
      bl_label = "Activate Application Configuration"
  
 -    filepath = StringProperty(
 +    filepath: StringProperty(
          subtype='FILE_PATH',
      )
  
@@@ -1463,7 -1436,7 +1463,7 @@@ class WM_OT_sysinfo(Operator)
      bl_idname = "wm.sysinfo"
      bl_label = "Save System Info"
  
 -    filepath = StringProperty(
 +    filepath: StringProperty(
          subtype='FILE_PATH',
          options={'SKIP_SAVE'},
      )
@@@ -1519,6 -1492,54 +1519,6 @@@ class WM_OT_copy_prev_settings(Operator
          return {'CANCELLED'}
  
  
 -class WM_OT_blenderplayer_start(Operator):
 -    """Launch the blender-player with the current blend-file"""
 -    bl_idname = "wm.blenderplayer_start"
 -    bl_label = "Start Game In Player"
 -
 -    def execute(self, context):
 -        import os
 -        import sys
 -        import subprocess
 -
 -        gs = context.scene.game_settings
 -
 -        # these remain the same every execution
 -        blender_bin_path = bpy.app.binary_path
 -        blender_bin_dir = os.path.dirname(blender_bin_path)
 -        ext = os.path.splitext(blender_bin_path)[-1]
 -        player_path = os.path.join(blender_bin_dir, "blenderplayer" + ext)
 -        # done static vars
 -
 -        if sys.platform == "darwin":
 -            player_path = os.path.join(blender_bin_dir, "../../../blenderplayer.app/Contents/MacOS/blenderplayer")
 -
 -        if not os.path.exists(player_path):
 -            self.report({'ERROR'}, "Player path: %r not found" % player_path)
 -            return {'CANCELLED'}
 -
 -        filepath = bpy.data.filepath + '~' if bpy.data.is_saved else os.path.join(bpy.app.tempdir, "game.blend")
 -        bpy.ops.wm.save_as_mainfile('EXEC_DEFAULT', filepath=filepath, copy=True)
 -
 -        # start the command line call with the player path
 -        args = [player_path]
 -
 -        # handle some UI options as command line arguments
 -        args.extend([
 -            "-g", "show_framerate", "=", "%d" % gs.show_framerate_profile,
 -            "-g", "show_profile", "=", "%d" % gs.show_framerate_profile,
 -            "-g", "show_properties", "=", "%d" % gs.show_debug_properties,
 -            "-g", "ignore_deprecation_warnings", "=", "%d" % (not gs.use_deprecation_warnings),
 -        ])
 -
 -        # finish the call with the path to the blend file
 -        args.append(filepath)
 -
 -        subprocess.call(args)
 -        os.remove(filepath)
 -        return {'FINISHED'}
 -
 -
  class WM_OT_keyconfig_test(Operator):
      """Test key-config for conflicts"""
      bl_idname = "wm.keyconfig_test"
@@@ -1541,26 -1562,26 +1541,26 @@@ class WM_OT_keyconfig_import(Operator)
      bl_idname = "wm.keyconfig_import"
      bl_label = "Import Key Configuration..."
  
 -    filepath = StringProperty(
 +    filepath: StringProperty(
          subtype='FILE_PATH',
          default="keymap.py",
      )
 -    filter_folder = BoolProperty(
 +    filter_folder: BoolProperty(
          name="Filter folders",
          default=True,
          options={'HIDDEN'},
      )
 -    filter_text = BoolProperty(
 +    filter_text: BoolProperty(
          name="Filter text",
          default=True,
          options={'HIDDEN'},
      )
 -    filter_python = BoolProperty(
 +    filter_python: BoolProperty(
          name="Filter python",
          default=True,
          options={'HIDDEN'},
      )
 -    keep_original = BoolProperty(
 +    keep_original: BoolProperty(
          name="Keep original",
          description="Keep original file after copying to configuration folder",
          default=True,
@@@ -1608,21 -1629,26 +1608,26 @@@ class WM_OT_keyconfig_export(Operator)
      bl_idname = "wm.keyconfig_export"
      bl_label = "Export Key Configuration..."
  
 -    all = BoolProperty(
++    all: BoolProperty(
+         name="All Keymaps",
+         default=False,
+         description="Write all keymaps (not just user modified)",
+     )
 -    filepath = StringProperty(
 +    filepath: StringProperty(
          subtype='FILE_PATH',
          default="keymap.py",
      )
 -    filter_folder = BoolProperty(
 +    filter_folder: BoolProperty(
          name="Filter folders",
          default=True,
          options={'HIDDEN'},
      )
 -    filter_text = BoolProperty(
 +    filter_text: BoolProperty(
          name="Filter text",
          default=True,
          options={'HIDDEN'},
      )
 -    filter_python = BoolProperty(
 +    filter_python: BoolProperty(
          name="Filter python",
          default=True,
          options={'HIDDEN'},
  
          wm = context.window_manager
  
 -        keyconfig_utils.keyconfig_export(
 +        keyconfig_utils.keyconfig_export_as_data(
              wm,
              wm.keyconfigs.active,
              self.filepath,
+             all_keymaps=self.all,
          )
  
          return {'FINISHED'}
@@@ -1658,7 -1685,7 +1664,7 @@@ class WM_OT_keymap_restore(Operator)
      bl_idname = "wm.keymap_restore"
      bl_label = "Restore Key Map(s)"
  
 -    all = BoolProperty(
 +    all: BoolProperty(
          name="All Keymaps",
          description="Restore all keymaps to default",
      )
@@@ -1681,7 -1708,7 +1687,7 @@@ class WM_OT_keyitem_restore(Operator)
      bl_idname = "wm.keyitem_restore"
      bl_label = "Restore Key Map Item"
  
 -    item_id = IntProperty(
 +    item_id: IntProperty(
          name="Item Identifier",
          description="Identifier of the item to remove",
      )
@@@ -1728,7 -1755,7 +1734,7 @@@ class WM_OT_keyitem_remove(Operator)
      bl_idname = "wm.keyitem_remove"
      bl_label = "Remove Key Map Item"
  
 -    item_id = IntProperty(
 +    item_id: IntProperty(
          name="Item Identifier",
          description="Identifier of the item to remove",
      )
@@@ -1796,7 -1823,7 +1802,7 @@@ class WM_OT_addon_enable(Operator)
      bl_idname = "wm.addon_enable"
      bl_label = "Enable Add-on"
  
 -    module = StringProperty(
 +    module: StringProperty(
          name="Module",
          description="Module name of the add-on to enable",
      )
@@@ -1842,7 -1869,7 +1848,7 @@@ class WM_OT_addon_disable(Operator)
      bl_idname = "wm.addon_disable"
      bl_label = "Disable Add-on"
  
 -    module = StringProperty(
 +    module: StringProperty(
          name="Module",
          description="Module name of the add-on to disable",
      )
          return {'FINISHED'}
  
  
 +class WM_OT_owner_enable(Operator):
 +    """Enable workspace owner ID"""
 +    bl_idname = "wm.owner_enable"
 +    bl_label = "Enable Add-on"
 +
 +    owner_id: StringProperty(
 +        name="UI Tag",
 +    )
 +
 +    def execute(self, context):
 +        workspace = context.workspace
 +        workspace.owner_ids.new(self.owner_id)
 +        return {'FINISHED'}
 +
 +
 +class WM_OT_owner_disable(Operator):
 +    """Enable workspace owner ID"""
 +    bl_idname = "wm.owner_disable"
 +    bl_label = "Disable UI Tag"
 +
 +    owner_id: StringProperty(
 +        name="UI Tag",
 +    )
 +
 +    def execute(self, context):
 +        workspace = context.workspace
 +        owner_id = workspace.owner_ids[self.owner_id]
 +        workspace.owner_ids.remove(owner_id)
 +        return {'FINISHED'}
 +
 +
  class WM_OT_theme_install(Operator):
      """Load and apply a Blender XML theme file"""
      bl_idname = "wm.theme_install"
      bl_label = "Install Theme..."
  
 -    overwrite = BoolProperty(
 +    overwrite: BoolProperty(
          name="Overwrite",
          description="Remove existing theme file if exists",
          default=True,
      )
 -    filepath = StringProperty(
 +    filepath: StringProperty(
          subtype='FILE_PATH',
      )
 -    filter_folder = BoolProperty(
 +    filter_folder: BoolProperty(
          name="Filter folders",
          default=True,
          options={'HIDDEN'},
      )
 -    filter_glob = StringProperty(
 +    filter_glob: StringProperty(
          default="*.xml",
          options={'HIDDEN'},
      )
@@@ -1979,31 -1975,31 +1985,31 @@@ class WM_OT_addon_install(Operator)
      bl_idname = "wm.addon_install"
      bl_label = "Install Add-on from File..."
  
 -    overwrite = BoolProperty(
 +    overwrite: BoolProperty(
          name="Overwrite",
          description="Remove existing add-ons with the same ID",
          default=True,
      )
 -    target = EnumProperty(
 +    target: EnumProperty(
          name="Target Path",
          items=(('DEFAULT', "Default", ""),
                 ('PREFS', "User Prefs", "")),
      )
  
 -    filepath = StringProperty(
 +    filepath: StringProperty(
          subtype='FILE_PATH',
      )
 -    filter_folder = BoolProperty(
 +    filter_folder: BoolProperty(
          name="Filter folders",
          default=True,
          options={'HIDDEN'},
      )
 -    filter_python = BoolProperty(
 +    filter_python: BoolProperty(
          name="Filter python",
          default=True,
          options={'HIDDEN'},
      )
 -    filter_glob = StringProperty(
 +    filter_glob: StringProperty(
          default="*.py;*.zip",
          options={'HIDDEN'},
      )
@@@ -2133,7 -2129,7 +2139,7 @@@ class WM_OT_addon_remove(Operator)
      bl_idname = "wm.addon_remove"
      bl_label = "Remove Add-on"
  
 -    module = StringProperty(
 +    module: StringProperty(
          name="Module",
          description="Module name of the add-on to remove",
      )
@@@ -2193,7 -2189,7 +2199,7 @@@ class WM_OT_addon_expand(Operator)
      bl_label = ""
      bl_options = {'INTERNAL'}
  
 -    module = StringProperty(
 +    module: StringProperty(
          name="Module",
          description="Module name of the add-on to expand",
      )
@@@ -2217,7 -2213,7 +2223,7 @@@ class WM_OT_addon_userpref_show(Operato
      bl_label = ""
      bl_options = {'INTERNAL'}
  
 -    module = StringProperty(
 +    module: StringProperty(
          name="Module",
          description="Module name of the add-on to expand",
      )
@@@ -2248,21 -2244,21 +2254,21 @@@ class WM_OT_app_template_install(Operat
      bl_idname = "wm.app_template_install"
      bl_label = "Install Template from File..."
  
 -    overwrite = BoolProperty(
 +    overwrite: BoolProperty(
          name="Overwrite",
          description="Remove existing template with the same ID",
          default=True,
      )
  
 -    filepath = StringProperty(
 +    filepath: StringProperty(
          subtype='FILE_PATH',
      )
 -    filter_folder = BoolProperty(
 +    filter_folder: BoolProperty(
          name="Filter folders",
          default=True,
          options={'HIDDEN'},
      )
 -    filter_glob = StringProperty(
 +    filter_glob: StringProperty(
          default="*.zip",
          options={'HIDDEN'},
      )
          return {'RUNNING_MODAL'}
  
  
 +class WM_OT_tool_set_by_name(Operator):
 +    """Set the tool by name (for keymaps)"""
 +    bl_idname = "wm.tool_set_by_name"
 +    bl_label = "Set Tool By Name"
 +
 +    name: StringProperty(
 +        name="Text",
 +        description="Display name of the tool",
 +    )
 +    cycle: BoolProperty(
 +        name="Cycle",
 +        description="Cycle through tools in this group",
 +        default=False,
 +        options={'SKIP_SAVE'},
 +    )
 +
 +    space_type: rna_space_type_prop
 +
 +    def execute(self, context):
 +        from bl_ui.space_toolsystem_common import (
 +            activate_by_name,
 +            activate_by_name_or_cycle,
 +        )
 +
 +        if self.properties.is_property_set("space_type"):
 +            space_type = self.space_type
 +        else:
 +            space_type = context.space_data.type
 +
 +        fn = activate_by_name_or_cycle if self.cycle else activate_by_name
 +        if fn(context, space_type, self.name):
 +            return {'FINISHED'}
 +        else:
 +            self.report({'WARNING'}, f"Tool {self.name!r} not found.")
 +            return {'CANCELLED'}
 +
 +
 +class WM_OT_toolbar(Operator):
 +    bl_idname = "wm.toolbar"
 +    bl_label = "Toolbar"
 +
 +    def execute(self, context):
 +        from bl_ui.space_toolsystem_common import (
 +            ToolSelectPanelHelper,
 +            keymap_from_context,
 +        )
 +        space_type = context.space_data.type
 +
 +        cls = ToolSelectPanelHelper._tool_class_from_space_type(space_type)
 +        if cls is None:
 +            self.report({'WARNING'}, f"Toolbar not found for {space_type!r}")
 +            return {'CANCELLED'}
 +
 +        wm = context.window_manager
 +        keymap = keymap_from_context(context, space_type)
 +
 +        def draw_menu(popover, context):
 +            layout = popover.layout
 +
 +            layout.operator_context = 'INVOKE_DEFAULT'
 +            layout.operator("wm.search_menu", text="Search Commands...", icon='VIEWZOOM')
 +
 +            cls.draw_cls(layout, context, detect_layout=False, scale_y=1.0)
 +
 +        wm.popover(draw_menu, ui_units_x=8, keymap=keymap)
 +        return {'FINISHED'}
 +
 +
 +# Studio Light operations
 +class WM_OT_studiolight_install(Operator):
 +    """Install a user defined studio light"""
 +    bl_idname = "wm.studiolight_install"
 +    bl_label = "Install Custom Studio Light"
 +
 +    files: CollectionProperty(
 +        name="File Path",
 +        type=OperatorFileListElement,
 +    )
 +    directory: StringProperty(
 +        subtype='DIR_PATH',
 +    )
 +    filter_folder: BoolProperty(
 +        name="Filter folders",
 +        default=True,
 +        options={'HIDDEN'},
 +    )
 +    filter_glob: StringProperty(
 +        default="*.png;*.jpg;*.hdr;*.exr",
 +        options={'HIDDEN'},
 +    )
 +    orientation: EnumProperty(
 +        items=(
 +            ("MATCAP", "MatCap", ""),
 +            ("WORLD", "World", ""),
 +            ("CAMERA", "Camera", ""),
 +        )
 +    )
 +
 +    def execute(self, context):
 +        import traceback
 +        import shutil
 +        import pathlib
 +        userpref = context.user_preferences
 +
 +        filepaths = [pathlib.Path(self.directory, e.name) for e in self.files]
 +        path_studiolights = bpy.utils.user_resource('DATAFILES')
 +
 +        if not path_studiolights:
 +            self.report({'ERROR'}, "Failed to get Studio Light path")
 +            return {'CANCELLED'}
 +
 +        path_studiolights = pathlib.Path(path_studiolights, "studiolights", self.orientation.lower())
 +        if not path_studiolights.exists():
 +            try:
 +                path_studiolights.mkdir(parents=True, exist_ok=True)
 +            except:
 +                traceback.print_exc()
 +
 +        for filepath in filepaths:
 +            shutil.copy(str(filepath), str(path_studiolights))
 +            userpref.studio_lights.new(str(path_studiolights.joinpath(filepath.name)), self.orientation)
 +
 +        # print message
 +        msg = (
 +            tip_("StudioLight Installed %r into %r") %
 +            (", ".join(str(x.name) for x in self.files), str(path_studiolights))
 +        )
 +        print(msg)
 +        self.report({'INFO'}, msg)
 +        return {'FINISHED'}
 +
 +    def invoke(self, context, event):
 +        wm = context.window_manager
 +        wm.fileselect_add(self)
 +        return {'RUNNING_MODAL'}
 +
 +
 +class WM_OT_studiolight_uninstall(Operator):
 +    bl_idname = 'wm.studiolight_uninstall'
 +    bl_label = "Uninstall Studio Light"
 +    index: bpy.props.IntProperty()
 +
 +    def _remove_path(self, path):
 +        if path.exists():
 +            path.unlink()
 +
 +    def execute(self, context):
 +        import pathlib
 +        userpref = context.user_preferences
 +        for studio_light in userpref.studio_lights:
 +            if studio_light.index == self.index:
 +                self._remove_path(pathlib.Path(studio_light.path))
 +                self._remove_path(pathlib.Path(studio_light.path_irr_cache))
 +                self._remove_path(pathlib.Path(studio_light.path_sh_cache))
 +                userpref.studio_lights.remove(studio_light)
 +                return {'FINISHED'}
 +        return {'CANCELLED'}
 +
 +
 +class WM_OT_studiolight_userpref_show(Operator):
 +    """Show light user preferences"""
 +    bl_idname = "wm.studiolight_userpref_show"
 +    bl_label = ""
 +    bl_options = {'INTERNAL'}
 +
 +    def execute(self, context):
 +        context.user_preferences.active_section = 'LIGHTS'
 +        bpy.ops.screen.userpref_show('INVOKE_DEFAULT')
 +        return {'FINISHED'}
 +
 +
  classes = (
      BRUSH_OT_active_index_set,
      WM_OT_addon_disable,
      WM_OT_app_template_install,
      WM_OT_appconfig_activate,
      WM_OT_appconfig_default,
 -    WM_OT_blenderplayer_start,
      WM_OT_context_collection_boolean_set,
      WM_OT_context_cycle_array,
      WM_OT_context_cycle_enum,
      WM_OT_properties_remove,
      WM_OT_sysinfo,
      WM_OT_theme_install,
 +    WM_OT_owner_disable,
 +    WM_OT_owner_enable,
      WM_OT_url_open,
 +    WM_OT_studiolight_install,
 +    WM_OT_studiolight_uninstall,
 +    WM_OT_studiolight_userpref_show,
 +    WM_OT_tool_set_by_name,
 +    WM_OT_toolbar,
  )