2
$\begingroup$

Question:
How to add shortcut to a button or create a new shortcut in User Preferences in Blender 2.8 ?
Problem:

I'm trying to assign Shift + F3 to switch the window space type, to what previously was Node Editor, now "Shader Editor".
Tried:

  1. RMB click over the Shader Editor icon in the drop down menu at the top left corner of the window. No add shortcut link there.
  2. Main Menu, Edit > Preferences > Input , Add New, rename to Cycle Space Type Set (following the naming convention of other shortcuts related to space types), Setting the shortcut to Shift+F3, RNA shows Disabled, the value is OperatorProperties and cannot find a way to change it.
$\endgroup$
2
$\begingroup$

It looks to me that it still needs to be implemented as is literally missing from the options even if you want to modify the existing one.

But for now you could do a quick addon, install it and use it as a shortcut.

if you use this script then the operator name is object.shading_workspace

don't know if there is a simpler way.

bl_info = {
    "name": "Shading Workspace",
    "author": "Your Name Here",
    "version": (1, 0),
    "blender": (2, 80, 0),
    "location": "",
    "description": "Shading Workspace",
    "warning": "",
    "wiki_url": "",
    "category": "",
}


import bpy


def main(context):
   for ob in context.scene.objects:
       print(ob)


class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.shading_workspace"
    bl_label = "Shading Workspace"

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        main(context)

        # this is the line you need
        bpy.context.window.workspace = bpy.data.workspaces["Shading"]

        return {'FINISHED'}


def register():
    bpy.utils.register_class(SimpleOperator)


def unregister():
    bpy.utils.unregister_class(SimpleOperator)


if __name__ == "__main__":
    register()

    # test call
    bpy.ops.object.shading_workspace()
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.