Advertisement
vins31

BlenderPythonGuiHideSHowButton

Feb 27th, 2012
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.09 KB | None | 0 0
  1. import bpy
  2.  
  3. state = 1
  4.  
  5. class TestPanel(bpy.types.Panel):
  6.     bl_label = "Test Panel"
  7.     bl_idname = "OBJECT_PT_test"
  8.     bl_space_type = "PROPERTIES"
  9.     bl_region_type = "WINDOW"
  10.     bl_context = "object"
  11.  
  12.     def draw(self, context):
  13.         layout = self.layout
  14.        
  15.         box = layout.box()
  16.         if state==0:
  17.             box.enabled=False
  18.         box.label("Boite 1")
  19.         box.operator("ops.bouton")
  20.        
  21.         box2 = layout.box()
  22.         if state==1:
  23.             box2.enabled=False
  24.         box2.label("Boite 2")
  25.         box2.operator("ops.bouton")
  26.        
  27. class Bouton(bpy.types.Operator):
  28.     bl_idname = 'ops.bouton'
  29.     bl_label = "Suite ..."
  30.     bl_description = ""
  31.    
  32.     def execute (self, context):
  33.         global state
  34.         print(state)
  35.         state = 1-state
  36.         return {'FINISHED'}
  37.  
  38.  
  39. def register():
  40.     bpy.utils.register_class(Bouton)
  41.     bpy.utils.register_class(TestPanel)
  42.  
  43.  
  44. def unregister():
  45.     bpy.utils.unregister_class(TestPanel)
  46.     bpy.utils.unregister_class(Bouton)
  47.  
  48.  
  49. if __name__ == "__main__":
  50.     register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement