Post #1533: ![](https://blenderartists.org/user_avatar/blenderartists.org/kickflipkid687/48/

πŸ“‹ Metadata

🏷️ Tags

pie-menu hotkeys intermediate solved

  • Command tab
  • Property tab
  • Python Scripting

πŸ’¬ Content

Kickflipkid687:

I got this working via an external Python Script, in another format, but can I write this as 1 line, and skip the external file?

if bpy.context.space_data.show_only_render == False bpy.context.space_data.show_only_render = True else bpy.context.space_data.show_only_render = False

Use this code in Command tab:

bpy.context.space_data.show_only_render = not bpy.context.space_data.show_only_render

Or:

setattr(bpy.context.space_data, "show_only_render", True) if bpy.context.space_data.show_only_render == False else setattr(bpy.context.space_data, "show_only_render", False)

Or just use the path in Property tab to add a toggle button:

bpy.context.space_data.show_only_render

Kickflipkid687:

Is it possible to copy this panel or settings somehow, so I can move object in Local Space/etc? Ideally I’d like to be able to Toggle Global/Local Space buttons, and it would let me use the same spinners , but according to the space.

It’s not easy but I think it’s possible. You can copy active operator settings using:

bpy.context.active_operator...

πŸ”— View on Blender Artists