11
$\begingroup$

Whenever I hit Numpad. (align view to selection), it doesn't show up in the info panel. Is there an operator for this, so that I can use it in scripting?

$\endgroup$
1
  • 2
    $\begingroup$ This could be phrased as a more general question since it applies to any menu item you want to know the python command to. $\endgroup$
    – ideasman42
    Commented May 28, 2013 at 10:59

1 Answer 1

11
$\begingroup$

The operator name is bpy.ops.view3d.view_selected(). See my answer here for additional information on this and also how to quickly reach the online manual and the API reference. Here are the accompanying docs for the operator.

Hover over a button and you should see a short description etc.. This can be useful for getting operator names.

You can go to the 3d view header and go to View > Align View > View Selected and check the operator name there.

enter image description here

Copy To Clipboard

While your mouse is over the menu item you can press Ctrl + C and the Python command gets copied to the clipboard to save you retyping it.

Log Everything

Some operators are excluded from the report window because typically you don't want setting the cursor (for example) to be logged, however this can be overridden by either...

  • Starting blender with the command line argument --debug-wm
  • Running this in the python console bpy.app.debug_wm = True

Then output of all operators executed will be logged in the info space and the console.

$\endgroup$
2
  • $\begingroup$ I knew about the hover trick, but I couldn't find the "View Selected" operator in the view menu. $\endgroup$
    – Daniel
    Commented May 28, 2013 at 15:35
  • 1
    $\begingroup$ You can also search in the Input tab of the user preferences if it has a hotkey $\endgroup$
    – Greg Zaal
    Commented May 28, 2013 at 19:00

You must log in to answer this question.

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