import bpy
class EXAMPLE_PT_panel(bpy.types.Panel):
bl_label = "Test Rig"
bl_category = "Rig Options"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
def draw(self, context):
layout = self.layout
layout.label(text="Collection 1")
layout.operator(bpy.data.objects["Jeans"].hide = True)
laout.label(text=Collection 2")
layout.operator(bpy.data.objects["Jacket"].hide = True)
classes = (EXAMPLE_PT_panel,)
def register():
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()
I'm learning python and want to try and make a simple menu that allows a user to click 1 object in menu and have the others hidden until chosen.
For example select value 1, values 2-5 are hidden. select value 3, values 1-2, 4-5 are hidden
layout.operator(bpy.data.collections["Foo"].hide_viewport = True)in any working blender panel or menu code. – batFINGER Mar 01 '20 at 13:45