Hotkeys: decimal point for Object Mode, but in Outliner

The hotkey customization window confuses me. I suspect that there’s a way to make hotkeys mode-sensitive or cursor-sensitive, but I haven’t grokked it yet at all. For one thing, all the “wm_*” text, where is that documented??

One thing I’d like to change is to have “.” (decimal point) operate in Object Mode much as it operates in Edit mode, iow, “Zoom To Selected” WHILE THE CURSOR IS OVER THE OUTLINER. Is that possible?

A script could be written to do that, for sure, but question then becomes - what to do when there are multiple 3D views? Zoom all of them? There isn’t a thing like “active” 3D view.

As to “where is that documented”:

  • Blender Python API docs - all the operators and properties are (at least) listed there, most are even documented, somewhat :face_with_hand_over_mouth:
  • In preferences, Interface, enable “Python Tooltips” - that would show data paths in UI tooltips
  • Many properties, when right-clicked, provide an option “Copy Data Path” - useful for copy/pasting property paths

If you mean like a quad view, yes, zooming them all would be fine, and in fact is what I’d prefer.

Hah, ironic in that I just asked how to suppress the Python tooltips in another post…

Put this into a view_selected_global.py file in your add-ons directory:

bl_info = {
    "name": "View Selected Global",
    "author": "Stan_Pancakes",
    "version": (1, 0, 0),
    "description": "",
    "blender": (2, 80, 0),
    "location": "",
    "warning": "",
    "category": "Interface",
}

import bpy

def all_view3d_contexts(context):
    for window in context.window_manager.windows:
        screen = window.screen
        for area in screen.areas:
            if area.type == 'VIEW_3D':
                for region in area.regions:
                    if region.type == 'WINDOW':
                        override = context.copy()
                        override['window'] = window
                        override['screen'] = screen
                        override['area'] = area
                        override['region'] = region
                        yield override

class ViewSelectedGlobal(bpy.types.Operator):
    bl_idname = "wm.view_selected_global"
    bl_label = "View Selected (Global)"
    
    def execute(self, context):
        for override in all_view3d_contexts(context):
            bpy.ops.view3d.view_selected(override, 'EXEC_DEFAULT', False, use_all_regions = True)
        return {'FINISHED'}

def register():
    bpy.utils.register_class(ViewSelectedGlobal)
    
def unregister():
    bpy.utils.unregister_class(ViewSelectedGlobal)

then start Blender, activate this new add-on (View Selected Global), and assign a hotkey in Outliner for wm.view_selected_global

1 Like

WOW! Above and beyond, man! Thank you for your exertions.

++++++++++++++++++++++++
Back on my production machine: haven’t been able to get it to function yet. See image:

But I did get this (path?) error when installing:

??? Seems like a LOT of slashes…

1 Like

In a related question (Viewing)…

  1. In EDIT mode, 2) in the 3D viewport, 3)>>when<< nothing is selected,

does the numpad “.” have any (default) function? Naturally, when something IS selected, it functions as “focus” aka “Frame Selected”.

BUT, ymmv, pour moi, I’d like it if when nothing is selected, for the “View Selected” hotkey to work as “View All” works. Otherwise, I’d like it to continue to work as it does now.

(LW users will recognize this as the “if nothing is selected everything is selected” paradigm from LW.)

Is the Python API powerful enough to make this distinction?

Not sure about the error, perhaps try putting the file into the user’s addons directory, not in Program Files?

As for the Frame Selected / Frame All combo, it’s possible in principle, but needs a lot of boilerplate to cover all the modes (and for some of them there isn’t even an API to just check if something is selected, and manual traversal would be required, ugh).

1 Like

Thanks man: your efforts are appreciated.

“Manual”, but programmatic, correct??

Yes, “programmatic” :slight_smile:

I’m searching for this directory, but haven’t located it yet: does it have a specific name, or just any folder?

Does Blender not like it when scripts are in the “add-on search path”? (I’d think that’s where one would logically put them.)

Just in case the warning is advisory, rather than fatal, I looked for “view” and “global”, in the hotkey editor but didn’t find it.

OK, I think I got the script into B (I think the warning above is just advisory), but when I attempt to assign it to a key, WITHOUT, granted, the “wm.” prefix, it doesn’t apparently work, and if I DO add “wm.” at the front, it adds “WM_OT_” to the name:

Which was a bit of a surprise. (And I still don’t know what “wm.” is, although it may have been pointed out to me already. It’s all a lot to take in.)

wm.view_selected_global, not wm.view_select_global :slight_smile:

1 Like

Got it to work!

Admittedly, I had scrubbed Blender entirely off my hd after it became unresponsive to mouse input, but your script is working now, and I’m already loving it.

I’m going to autopsy your script to see if I can get TAB in the Outliner to switch between Obj/Edit modes (in all open 3dViews), which is my most common UI error. AFAIK there’s no default function for TAB in the Outliner so there shouldn’t be any ‘collisions’.

Thanks man, very VERY helpful.

You’re welcome :slight_smile:

For mode switching you don’t actually have to dissect the script. Just assign the hotkey, in Outliner, to a object.mode_set operator, select ‘Edit Mode’ in dropdown and tick ‘Toggle’.

:flushed: :flushed: :flushed: :flushed:
OMG, it’s the Holy Grail. I >>CANNOT<< tell you the number of times I’ve hit TAB, thinking my Mode had changed, but it hadn’t because my cursor was over the g.d. Outliner.

I really need to devote some time to the keymap editor, --and a dozen other things. But as I’ve said before, things like “object.mode_set” scare me off.

Many thanks.

Now that my euphoria has faded: this works, but not so much if the Orange Triangle line is highlighted SOMETIMES it works if the Orange tri is highlighted, usually in fact, but sometimes it does not. It always works if the green triangle is highlighted.

You can’t switch to edit mode if your active object doesn’t support edit mode (e.g. a camera). I’m guessing that’s what’s happening.