1
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

batFINGER
  • 84,216
  • 10
  • 108
  • 233
  • 1
    Hi. Where specifically are you getting stuck? Please show the code you have so far so we know what exactly you need help with. – Ray Mairlot Feb 28 '20 at 23:04
  • Hi @RayMairlot, I have edited the post to include an image. I feel like I should be using if commands. – deezuslemonade Mar 01 '20 at 12:56
  • 2
    Hello. For that, should be better to paste the code directly instead of image. If someone wants to answer, he won't need to rewrite all... thanks. – lemon Mar 01 '20 at 13:02
  • 1
    There are a lot of examples including this from here; among numerous others, , addon code, UI code or in the script templates. Much of this code is in your blender installation folder and can be investigated with any text editor. Suggest will not find anything like layout.operator(bpy.data.collections["Foo"].hide_viewport = True) in any working blender panel or menu code. – batFINGER Mar 01 '20 at 13:45

0 Answers0