Post #2222: I wrote this a while back to make a single hotkey frame selected objects if sele
π Metadata
- Author: fjg3d
- Date: 2019-04-27 18:46:11
- Type:
question - Quality Score: 7/10
- Replies (2): post_02224, post_02226
π·οΈ Tags
macro hotkeys intermediate unsolved
βοΈ Related PME Features
- Macro Editor
- Hotkey Configuration
- Python Scripting
π¬ Content
I wrote this a while back to make a single hotkey frame selected objects if selected, or all objects if none are selected. It works, but doesnβt use smooth view in preferences, it just pops immediately.
When I use bpy.ops.view3d.view_selected(use_all_regions=False) from the View menu in 3dview, there are a bunch of bpy.ops.view3d.smoothview() print outs.
Is bpy.ops.view3d.smoothview() something I need to include in the script as well?
if bpy.context.object.mode == 'OBJECT':
selected = list(bpy.context.selected_objects)
if len(selected) != 0:
bpy.ops.view3d.view_selected(use_all_regions=False)
elif len(selected) == 0:
bpy.ops.view3d.view_all(center=False)