9
$\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$
  • 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 May 28 '13 at 10:59
10
$\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$
  • $\begingroup$ I knew about the hover trick, but I couldn't find the "View Selected" operator in the view menu. $\endgroup$ – Daniel says Reinstate Monica May 28 '13 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 May 28 '13 at 19:00

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.