Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- state = 1
- class TestPanel(bpy.types.Panel):
- bl_label = "Test Panel"
- bl_idname = "OBJECT_PT_test"
- bl_space_type = "PROPERTIES"
- bl_region_type = "WINDOW"
- bl_context = "object"
- def draw(self, context):
- layout = self.layout
- box = layout.box()
- if state==0:
- box.enabled=False
- box.label("Boite 1")
- box.operator("ops.bouton")
- box2 = layout.box()
- if state==1:
- box2.enabled=False
- box2.label("Boite 2")
- box2.operator("ops.bouton")
- class Bouton(bpy.types.Operator):
- bl_idname = 'ops.bouton'
- bl_label = "Suite ..."
- bl_description = ""
- def execute (self, context):
- global state
- print(state)
- state = 1-state
- return {'FINISHED'}
- def register():
- bpy.utils.register_class(Bouton)
- bpy.utils.register_class(TestPanel)
- def unregister():
- bpy.utils.unregister_class(TestPanel)
- bpy.utils.unregister_class(Bouton)
- if __name__ == "__main__":
- register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement