1
$\begingroup$

There are 14? property tabs that allow you to enter into such things as the Material properties, modifiers properties etc.

My question, is it possible to create a custom hotkey or script that can select that window (instead of clicking it)? I mainly use Materials, Modifiers. I would like to set a hotkey to access these faster when an object is selected.

enter image description here

Creating a custom hotkey just opens this menu, not really what I'm after.

Let's pretend I press 1 on the keyboard, Materials Property would open up. Or if I called via a pie menu through an operator. Hope the explains what I'm after.

$\endgroup$
2
  • $\begingroup$ I have no real solution for that, the only thing I'm wondering is, do you really need specifically this tab? Because personally, most of the time I use the Shader Editor for everything material related, so I just have a window with the Shader Editor opened and saved this configuration as my default startup file. $\endgroup$ Commented Feb 21 at 12:44
  • 1
    $\begingroup$ Natively I don't think there is, but you could probably write a Python script for this relatively easily $\endgroup$ Commented Feb 21 at 12:46

1 Answer 1

0
$\begingroup$

You can copy paste this into Blender's text editor and save it as a .py file and install it as an add-on to have an operator that switches all Properties editors to some tab:

import bpy

bl_info = {
    "name": "Properties Tab Switch",
    "author": "Martynas Žiemys",
    "version": (1, 0),
    "blender": (4, 0, 2),
    "location": "Search -> Properties Tab Switch",
    "description": "Properties Tab Switch",
    "warning": "",
    "doc_url": "",
    "category": "UI",
}

class PropertiesTabSwitch(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "wm.properties_tab_switch"
    bl_label = "Properties Tab Switch"
    bl_options = {'REGISTER', 'UNDO'}
    
    tab : bpy.props.StringProperty(
        name="Tab",
        default='MATERIAL')
        # ('TOOL', 'RENDER', 'OUTPUT', 'VIEW_LAYER', 'SCENE', 'WORLD', 'OBJECT', 'MODIFIER', 'PARTICLES', 'PHYSICS', 'CONSTRAINT', 'DATA', 'MATERIAL', 'TEXTURE')
#    @classmethod
#    def poll(cls, context):
#        return True

    def execute(self, context):
        for area in context.screen.areas: 
            if area.type=='PROPERTIES':
                try:
                    area.spaces[0].context = self.tab
                except:
                    self.report({'WARNING'}, "Cannot switch to " + self.tab + " tab")
        return {'FINISHED'}


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


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


if __name__ == "__main__":
    register()

Once it's enabled, you can add a hot-key calling the operator in the Preferences( F4 -> P ), Keymap tab:

enter image description here

The operator you want to add is called wm.properties_tab_switch. You probably want to add it the whole window:

enter image description here

Then you can change the property called "Tab" to whatever you want ('TOOL', 'RENDER', 'OUTPUT', 'VIEW_LAYER', 'SCENE', 'WORLD', 'OBJECT', 'MODIFIER', 'PARTICLES', 'PHYSICS', 'CONSTRAINT', 'DATA', 'MATERIAL', 'TEXTURE')

You can add as many hotkeys for different tabs as you want.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .