edshead
(Ed)
July 16, 2020, 10:40am
1
Hey guys,
at the end of my python script, I’d like to show the 3D-Print-Toolbox in the sidebar (the one you can toggle with ‘N’ key).
I can already programmatically start the 3D-Print-Toolbox-Scan, but the sidebar still is invisible and has to be toggled manually.
Is there a way in scripting this?
Thank you
Ed
const
(const)
July 21, 2020, 6:16pm
2
This is it.
>>> bpy.ops.preferences.addon_enable(module="object_print3d_utils")
{'FINISHED'}
>>> bpy.ops.preferences.addon_disable(module="object_print3d_utils")
{'FINISHED'}
edshead
(Ed)
July 21, 2020, 6:35pm
3
Thanks for the hint, but it’s not exactly what I’ve been looking for.
The code you provided is for enabling / disabling the addon.
What I want to do is: Make the sidebar visible (the same what happens, when pressing the n-key)
Thanks anyways
const
(const)
July 23, 2020, 8:26am
4
I found this one from the keyboard shortcuts window.
import bpy
class SimpleOperator(bpy.types.Operator):
"""Tooltip"""
bl_idname = "object.simple_operator"
bl_label = "Simple Object Operator"
def execute(self, context):
context.space_data.show_region_ui ^= True # show_region_ui = !show_region_ui
return {'FINISHED'}
def register():
bpy.utils.register_class(SimpleOperator)
def unregister():
bpy.utils.unregister_class(SimpleOperator)
if __name__ == "__main__":
try:unregister()
except:pass
register()