import bpy
from bpy.props import *
def initSceneProperties(scn):
stin = bpy.types.Scene
stin.MyString1 = BoolProperty(
name = "String")
scn['MyString1'] = "Test 1"
stin.MyString2 = BoolProperty(
name = "String")
scn['MyString2'] = "Test 2"
return
initSceneProperties(bpy.context.scene)
# Layout panel
class LayoutPanel(bpy.types.Panel):
bl_label = "Hide Tools"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOL_PROPS"
def draw(self, context):
layout = self.layout
scn = context.scene
layout.label("TEST")
# First LayerString
layout.prop(scn, 'MyString1', text="")
row = layout.row(align=True)
row.operator("my.button", text="1", icon="CANCEL", toggle=True)
# Second LayerString
layout.prop(scn, 'MyString2', text="")
row = layout.row(align=True)
row.operator("my.button", text="2", icon="CANCEL", toggle=True)
# Button
class OBJECT_OT_Button(bpy.types.Operator):
bl_idname = "my.button"
bl_label = "Button"
def execute(self, context):
scn = context.scene
layout = self.layout
icon = LayoutPanel.draw
if scn.MyString1 == "MyString2" | row.operator(toggle=True):
label = "TEST2"
icon.row.operator[icon] == "ERROR"
icon.row.operator[text] == "A"
icon.row.operator[toggle] = True
else:
scn.MyString1 == "MyString1"
label = "TEST1"
icon.row.operator[icon] == "CANCEL"
icon.row.operator[text] == "B"
icon.row.operator[toggle] = False
return{'FINISHED'}
bpy.utils.register_module(__name__)