Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. import bpy
  2. from bpy.props import *
  3.  
  4. def initSceneProperties(scn):
  5. stin = bpy.types.Scene
  6.  
  7. stin.MyString1 = BoolProperty(
  8. name = "String")
  9. scn['MyString1'] = "Test 1"
  10.  
  11. stin.MyString2 = BoolProperty(
  12. name = "String")
  13. scn['MyString2'] = "Test 2"
  14. return
  15.  
  16. initSceneProperties(bpy.context.scene)
  17.  
  18. # Layout panel
  19. class LayoutPanel(bpy.types.Panel):
  20. bl_label = "Hide Tools"
  21. bl_space_type = "VIEW_3D"
  22. bl_region_type = "TOOL_PROPS"
  23.  
  24. def draw(self, context):
  25. layout = self.layout
  26. scn = context.scene
  27.  
  28. layout.label("TEST")
  29. # First Layer
  30. layout.prop(scn, 'MyString1', text="")
  31. row = layout.row(align=True)
  32. row.operator("my.button", text="1", icon="CANCEL", toggle=True)
  33.  
  34. # Second Layer
  35. layout.prop(scn, 'MyString2', text="")
  36. row = layout.row(align=True)
  37. row.operator("my.button", text="2", icon="CANCEL", toggle=True)
  38.  
  39. # Button
  40. class OBJECT_OT_Button(bpy.types.Operator):
  41. bl_idname = "my.button"
  42. bl_label = "Button"
  43.  
  44. def execute(self, context):
  45. scn = context.scene
  46. layout = self.layout
  47. icon = LayoutPanel.draw
  48.  
  49. if scn.MyString1 == "MyString2" | row.operator(toggle=True):
  50. label = "TEST2"
  51. icon.row.operator[icon] == "ERROR"
  52. icon.row.operator[text] == "A"
  53. icon.row.operator[toggle] = True
  54. else:
  55. scn.MyString1 == "MyString1"
  56. label = "TEST1"
  57. icon.row.operator[icon] == "CANCEL"
  58. icon.row.operator[text] == "B"
  59. icon.row.operator[toggle] = False
  60. return{'FINISHED'}
  61.  
  62. bpy.utils.register_module(__name__)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement