Merge branch 'master' into blender2.8
[blender.git] / release / scripts / startup / bl_operators / wm.py
index 53735ed3ece8b923082fb980ddb3de6580b9cd59..92ac18e0f6f0e7531c01b04b0fb3d64aca74a149 100644 (file)
 # <pep8 compliant>
 
 import bpy
-from bpy.types import Operator
+from bpy.types import (
+    Menu,
+    Operator,
+    OperatorFileListElement
+)
 from bpy.props import (
     BoolProperty,
     EnumProperty,
     FloatProperty,
     IntProperty,
     StringProperty,
+    CollectionProperty,
 )
 
 from bpy.app.translations import pgettext_tip as tip_
@@ -55,6 +60,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:
@@ -149,12 +163,12 @@ class BRUSH_OT_active_index_set(Operator):
     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",
     )
@@ -186,8 +200,8 @@ class WM_OT_context_set_boolean(Operator):
     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,
@@ -202,13 +216,13 @@ class WM_OT_context_set_int(Operator):  # same as enum
     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
 
@@ -219,8 +233,8 @@ class WM_OT_context_scale_float(Operator):
     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,
@@ -247,13 +261,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,
@@ -290,13 +304,13 @@ class WM_OT_context_set_float(Operator):  # same as enum
     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
 
@@ -307,8 +321,8 @@ class WM_OT_context_set_string(Operator):  # same as enum
     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,
@@ -323,8 +337,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,
@@ -339,8 +353,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,
@@ -360,7 +374,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
@@ -379,13 +393,13 @@ class WM_OT_context_toggle_enum(Operator):
     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,
@@ -418,9 +432,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
@@ -454,9 +468,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
@@ -511,8 +525,8 @@ class WM_OT_context_cycle_array(Operator):
     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
@@ -536,7 +550,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
@@ -562,7 +577,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
@@ -589,12 +605,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,
@@ -633,8 +650,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,
@@ -684,10 +701,10 @@ class WM_OT_context_collection_boolean_set(Operator):
     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", ""),
@@ -743,22 +760,22 @@ class WM_OT_context_modal_mouse(Operator):
     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
@@ -820,12 +837,12 @@ class WM_OT_context_modal_mouse(Operator):
         elif 'LEFTMOUSE' == event_type:
             item = next(iter(self._values.keys()))
             self._values_clear()
-            context.area.header_text_set()
+            context.area.header_text_set(None)
             return operator_value_undo_return(item)
 
         elif event_type in {'RIGHTMOUSE', 'ESC'}:
             self._values_restore()
-            context.area.header_text_set()
+            context.area.header_text_set(None)
             return {'CANCELLED'}
 
         return {'RUNNING_MODAL'}
@@ -851,7 +868,7 @@ class WM_OT_url_open(Operator):
     bl_label = ""
     bl_options = {'INTERNAL'}
 
-    url = StringProperty(
+    url: StringProperty(
         name="URL",
         description="URL to open",
     )
@@ -868,7 +885,7 @@ class WM_OT_path_open(Operator):
     bl_label = ""
     bl_options = {'INTERNAL'}
 
-    filepath = StringProperty(
+    filepath: StringProperty(
         subtype='FILE_PATH',
         options={'SKIP_SAVE'},
     )
@@ -983,7 +1000,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):
@@ -1037,7 +1054,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:
@@ -1089,6 +1106,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"
@@ -1096,15 +1118,16 @@ class WM_OT_properties_edit(Operator):
     # 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",
     )
 
@@ -1154,6 +1177,9 @@ class WM_OT_properties_edit(Operator):
         # 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]
@@ -1281,7 +1307,9 @@ class WM_OT_properties_edit(Operator):
         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
@@ -1295,7 +1323,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 (
@@ -1338,7 +1366,7 @@ class WM_OT_properties_context_change(Operator):
     bl_label = ""
     bl_options = {'INTERNAL'}
 
-    context = StringProperty(
+    context: StringProperty(
         name="Context",
         maxlen=64,
     )
@@ -1354,8 +1382,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 (
@@ -1376,7 +1404,7 @@ class WM_OT_keyconfig_activate(Operator):
     bl_idname = "wm.keyconfig_activate"
     bl_label = "Activate Keyconfig"
 
-    filepath = StringProperty(
+    filepath: StringProperty(
         subtype='FILE_PATH',
     )
 
@@ -1411,7 +1439,7 @@ class WM_OT_appconfig_activate(Operator):
     bl_idname = "wm.appconfig_activate"
     bl_label = "Activate Application Configuration"
 
-    filepath = StringProperty(
+    filepath: StringProperty(
         subtype='FILE_PATH',
     )
 
@@ -1436,7 +1464,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'},
     )
@@ -1463,80 +1491,49 @@ class WM_OT_copy_prev_settings(Operator):
     bl_idname = "wm.copy_prev_settings"
     bl_label = "Copy Previous Settings"
 
-    def execute(self, context):
-        import os
-        import shutil
+    @staticmethod
+    def previous_version():
         ver = bpy.app.version
         ver_old = ((ver[0] * 100) + ver[1]) - 1
-        path_src = bpy.utils.resource_path('USER', ver_old // 100, ver_old % 100)
-        path_dst = bpy.utils.resource_path('USER')
-
-        if os.path.isdir(path_dst):
-            self.report({'ERROR'}, "Target path %r exists" % path_dst)
-        elif not os.path.isdir(path_src):
-            self.report({'ERROR'}, "Source path %r does not exist" % path_src)
-        else:
-            shutil.copytree(path_src, path_dst, symlinks=True)
-
-            # reload recent-files.txt
-            bpy.ops.wm.read_history()
-
-            # don't loose users work if they open the splash later.
-            if bpy.data.is_saved is bpy.data.is_dirty is False:
-                bpy.ops.wm.read_homefile()
-            else:
-                self.report({'INFO'}, "Reload Start-Up file to restore settings")
-
-            return {'FINISHED'}
-
-        return {'CANCELLED'}
+        return ver_old // 100, ver_old % 100
 
+    @staticmethod
+    def _old_path():
+        ver = bpy.app.version
+        ver_old = ((ver[0] * 100) + ver[1]) - 1
+        return bpy.utils.resource_path('USER', ver_old // 100, ver_old % 100)
 
-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"
+    @staticmethod
+    def _new_path():
+        return bpy.utils.resource_path('USER')
 
-    def execute(self, context):
+    @classmethod
+    def poll(cls, 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
+        old = cls._old_path()
+        new = cls._new_path()
+        if os.path.isdir(old) and not os.path.isdir(new):
+            return True
 
-        if sys.platform == "darwin":
-            player_path = os.path.join(blender_bin_dir, "../../../blenderplayer.app/Contents/MacOS/blenderplayer")
+        old_userpref = os.path.join(old, "config", "userpref.blend")
+        new_userpref = os.path.join(new, "config", "userpref.blend")
+        return os.path.isfile(old_userpref) and not os.path.isfile(new_userpref)
 
-        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)
+    def execute(self, context):
+        import shutil
 
-        # start the command line call with the player path
-        args = [player_path]
+        shutil.copytree(self._old_path(), self._new_path(), symlinks=True)
 
-        # 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),
-        ])
+        # reload recent-files.txt
+        bpy.ops.wm.read_history()
 
-        # finish the call with the path to the blend file
-        args.append(filepath)
+        # don't loose users work if they open the splash later.
+        if bpy.data.is_saved is bpy.data.is_dirty is False:
+            bpy.ops.wm.read_homefile()
+        else:
+            self.report({'INFO'}, "Reload Start-Up file to restore settings")
 
-        subprocess.call(args)
-        os.remove(filepath)
         return {'FINISHED'}
 
 
@@ -1562,26 +1559,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,
@@ -1629,26 +1626,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'},
@@ -1665,7 +1662,7 @@ class WM_OT_keyconfig_export(Operator):
 
         wm = context.window_manager
 
-        keyconfig_utils.keyconfig_export(
+        keyconfig_utils.keyconfig_export_as_data(
             wm,
             wm.keyconfigs.active,
             self.filepath,
@@ -1685,7 +1682,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",
     )
@@ -1708,7 +1705,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",
     )
@@ -1755,7 +1752,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",
     )
@@ -1823,7 +1820,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",
     )
@@ -1869,7 +1866,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",
     )
@@ -1893,25 +1890,56 @@ class WM_OT_addon_disable(Operator):
         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'},
     )
@@ -1975,31 +2003,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'},
     )
@@ -2129,7 +2157,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",
     )
@@ -2175,7 +2203,7 @@ class WM_OT_addon_remove(Operator):
     # lame confirmation check
     def draw(self, context):
         self.layout.label(text="Remove Add-on: %r?" % self.module)
-        path, isdir = WM_OT_addon_remove.path_from_addon(self.module)
+        path, _isdir = WM_OT_addon_remove.path_from_addon(self.module)
         self.layout.label(text="Path: %r" % path)
 
     def invoke(self, context, event):
@@ -2189,7 +2217,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",
     )
@@ -2213,7 +2241,7 @@ class WM_OT_addon_userpref_show(Operator):
     bl_label = ""
     bl_options = {'INTERNAL'}
 
-    module = StringProperty(
+    module: StringProperty(
         name="Module",
         description="Module name of the add-on to expand",
     )
@@ -2244,21 +2272,21 @@ class WM_OT_app_template_install(Operator):
     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'},
     )
@@ -2337,6 +2365,338 @@ class WM_OT_app_template_install(Operator):
         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:s} not found for space {space_type!r:s}.")
+            return {'CANCELLED'}
+
+
+class WM_OT_toolbar(Operator):
+    bl_idname = "wm.toolbar"
+    bl_label = "Toolbar"
+
+    @classmethod
+    def poll(cls, context):
+        return context.space_data is not None
+
+    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_REGION_WIN'
+            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:
+                if studio_light.path:
+                    self._remove_path(pathlib.Path(studio_light.path))
+                if studio_light.path_irr_cache:
+                    self._remove_path(pathlib.Path(studio_light.path_irr_cache))
+                if studio_light.path_sh_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'}
+
+
+class WM_MT_splash(Menu):
+    bl_label = "Splash"
+
+    def draw_setup(self, context):
+        layout = self.layout
+        layout.operator_context = 'EXEC_DEFAULT'
+
+        layout.label(text="Quick Setup")
+
+        split = layout.split(factor=0.25)
+        split.label()
+        split = split.split(factor=2.0 / 3.0)
+
+        col = split.column()
+
+        sub = col.column(align=True)
+        sub.label(text="Input and Shortcuts:")
+        text = bpy.path.display_name(context.window_manager.keyconfigs.active.name)
+        if not text:
+            text = "Blender (default)"
+        sub.menu("USERPREF_MT_appconfigs", text=text)
+
+        col.separator()
+
+        sub = col.column(align=True)
+        sub.label(text="Theme:")
+        label = bpy.types.USERPREF_MT_interface_theme_presets.bl_label
+        if label == "Presets":
+            label = "Blender Dark"
+        sub.menu("USERPREF_MT_interface_theme_presets", text=label)
+
+        # We need to make switching to a language easier first
+        #sub = col.column(align=False)
+        # sub.label(text="Language:")
+        #userpref = context.user_preferences
+        #sub.prop(userpref.system, "language", text="")
+
+        col.label()
+
+        layout.label()
+
+        row = layout.row()
+
+        sub = row.row()
+        if bpy.types.WM_OT_copy_prev_settings.poll(context):
+            old_version = bpy.types.WM_OT_copy_prev_settings.previous_version()
+            sub.operator("wm.copy_prev_settings", text="Load %d.%d Settings" % old_version)
+            sub.operator("wm.save_userpref", text="Save New Settings")
+        else:
+            sub.label()
+            sub.label()
+            sub.operator("wm.save_userpref", text="Next")
+
+        layout.separator()
+
+    def draw(self, context):
+        # Draw setup screen if no user preferences have been saved yet.
+        import os
+
+        user_path = bpy.utils.resource_path('USER')
+        userdef_path = os.path.join(user_path, "config", "userpref.blend")
+
+        if not os.path.isfile(userdef_path):
+            self.draw_setup(context)
+            return
+
+        # Pass
+        layout = self.layout
+        layout.operator_context = 'EXEC_DEFAULT'
+        layout.emboss = 'PULLDOWN_MENU'
+
+        split = layout.split()
+
+        # Templates
+        col1 = split.column()
+        col1.label(text="New File")
+
+        bpy.types.TOPBAR_MT_file_new.draw_ex(col1, context, use_splash=True)
+
+        # Recent
+        col2 = split.column()
+        col2_title = col2.row()
+
+        found_recent = col2.template_recent_files()
+
+        if found_recent:
+            col2_title.label(text="Recent Files")
+        else:
+            # Links if no recent files
+            col2_title.label(text="Getting Started")
+
+            col2.operator(
+                "wm.url_open", text="Manual", icon='URL'
+            ).url = "https://docs.blender.org/manual/en/dev/"
+            col2.operator(
+                "wm.url_open", text="Release Notes", icon='URL',
+            ).url = "https://www.blender.org/download/releases/%d-%d/" % bpy.app.version[:2]
+            col2.operator(
+                "wm.url_open", text="Blender Website", icon='URL',
+            ).url = "https://www.blender.org"
+            col2.operator(
+                "wm.url_open", text="Credits", icon='URL',
+            ).url = "https://www.blender.org/about/credits/"
+
+        layout.separator()
+
+        split = layout.split()
+
+        col1 = split.column()
+        sub = col1.row()
+        sub.operator_context = 'INVOKE_DEFAULT'
+        sub.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER')
+        col1.operator("wm.recover_last_session", icon='RECOVER_LAST')
+
+        col2 = split.column()
+        if found_recent:
+            col2.operator(
+                "wm.url_open", text="Release Notes", icon='URL',
+            ).url = "https://www.blender.org/download/releases/%d-%d/" % bpy.app.version[:2]
+            col2.operator(
+                "wm.url_open", text="Development Fund", icon='URL'
+            ).url = "https://fund.blender.org"
+        else:
+            col2.operator(
+                "wm.url_open", text="Development Fund", icon='URL'
+            ).url = "https://fund.blender.org"
+            col2.operator(
+                "wm.url_open", text="Donate", icon='URL'
+            ).url = "https://www.blender.org/foundation/donation-payment/"
+
+        layout.separator()
+
+
+class WM_OT_drop_blend_file(Operator):
+    bl_idname = "wm.drop_blend_file"
+    bl_label = "Handle dropped .blend file"
+    bl_options = {'INTERNAL'}
+
+    filepath: StringProperty()
+
+    def invoke(self, context, event):
+        context.window_manager.popup_menu(self.draw_menu, title=bpy.path.basename(self.filepath), icon='QUESTION')
+        return {"FINISHED"}
+
+    def draw_menu(self, menu, context):
+        layout = menu.layout
+
+        col = layout.column()
+        col.operator_context = 'EXEC_DEFAULT'
+        col.operator("wm.open_mainfile", text="Open", icon='FILE_FOLDER').filepath = self.filepath
+
+        layout.separator()
+        col = layout.column()
+        col.operator_context = 'INVOKE_DEFAULT'
+        col.operator("wm.link", text="Link...", icon='LINK_BLEND').filepath = self.filepath
+        col.operator("wm.append", text="Append...", icon='APPEND_BLEND').filepath = self.filepath
+
 classes = (
     BRUSH_OT_active_index_set,
     WM_OT_addon_disable,
@@ -2349,7 +2709,6 @@ classes = (
     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,
@@ -2371,6 +2730,7 @@ classes = (
     WM_OT_copy_prev_settings,
     WM_OT_doc_view,
     WM_OT_doc_view_manual,
+    WM_OT_drop_blend_file,
     WM_OT_keyconfig_activate,
     WM_OT_keyconfig_export,
     WM_OT_keyconfig_import,
@@ -2389,5 +2749,13 @@ classes = (
     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,
+    WM_MT_splash,
 )