ToolBar scripting help

Hello I am new to scripting and very new to python scripting, the last few days i have been working on a custom toolbar for tools that i use very often after having went through the blender scripting tutorial on cgcookie. Right now my toolbar is more or less just a panel off to the side right now but the ultimate goal will be a tool bar more akin to the maya shelf system which is one of the things i really enjoyed about maya.

Anyway the reason I am here today is this: Mark and clear seams, i cant get it to work i have been all over the net trying
to find the right way to get things working and have no difficulty in getting the button for the mark seam command to work just fine but clear seam is giving me horrible problems, most of which i really don’t understand, but i really want to learn more about scripting in blender and figure this is as good as any place to start.

the script is nothing fancy mostly just a bunch of col.operator("") calls mixed in with some menu_enum calls as well,
but mark and clear seam are kinda strange as so far i have yet to figure out how to use them as a button.

Any help would be great. Thanks in advance.

You might want to post a code snippet that doesn’t work so someone can maybe figure out why.

not sure what the problem is, there are stock mark and clear seam buttons, so why not just look at that code?

        col = layout.column(align=True)
        col.label(text="UV Mapping:")
        col.operator("wm.call_menu", text="Unwrap").name = "VIEW3D_MT_uv_map"
        col.operator("mesh.mark_seam").clear = False
        col.operator("mesh.mark_seam", text="Clear Seam").clear = True


Thats the thing I don’t normally use the buttons on the interface as i have most of them memorized by the hotkey, which isn’t a problem now but when i was first starting to learn blender it was huge, now its more of a convenience thing than anything, and i just picked up scripting like 2 days ago for blender and don’t know how to call a lot of things just yet.

Honestly Uncle Entity my code isn’t that complex thats why I didn’t put it down i’m not afraid of people using it or anything its just
I figured anyone who knew what i was talking about probably knew the correct syntax and or way to implement what i wanted to do.
but if your intrested in my super awesome ultra HQ tool panel ill happily share it with you.

CoDEmanX you nailed it.

Now is there any way i could possibly build a custom panel at the top of the 3d view as i find the side bars annoying and intrusive that and put my tools in that instead like in maya or am i limited to just what’s there, cause if thats the case i could deal with it fine but i just wanted some place for my buttons to display that doesn’t mean i have to scroll for an hour to find what i’m looking for.

anyway its nothing special but I find it useful. should put the shortcut keys in the name just so i won’t forget them lol.



#////////////////////////////////////////////////////////////////////////////////////////////////////
#  This custom panel was made by waco using the UnityCookie tutorial located here:
#  http://cgcookie.com/blender/2013/07/12/creating-custom-toolbar-panel-python-scripting
#  I hope you enjoy the tool bar and the tutorial as I worked hard to dig up the information for the 
#  rest of the stuff the tutorial didnt cover.
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
import bpy


class customPanel(bpy.types.Panel):
    #A custom panel in the viewport
    
    bl_label = "Waco's Modeling Panal"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    
    def draw(self, context):
        layout = self.layout
        
        row = layout.row()        
        row.label(text="3D Cursor behavour:")
        
        split = layout.split()
        col = split.column(align = True)
        row = col.row(align=True)
        
        col.operator("view3d.snap_cursor_to_center",text="cursor to center", icon='CURSOR')
        col.operator("view3d.snap_cursor_to_selected",text="cursor to Selected", icon='CURSOR')
        col.operator("view3d.snap_cursor_to_grid",text="cursor to Grid", icon='CURSOR')
        col.operator("view3d.snap_cursor_to_active",text="cursor to Active", icon='CURSOR')
        col.operator("view3d.snap_selected_to_grid",text=" Selection to Grid", icon='CURSOR')
        col.operator("view3d.snap_selected_to_cursor",text="Selection to cursor", icon='CURSOR')
        
        col.label(text="Object Origin:")
        
        col.operator_menu_enum("object.origin_set","type")
          
        col.label(text="UV Mapping:")
        col.operator("wm.call_menu", text="Unwrap", icon = 'TEXTURE_DATA').name = "VIEW3D_MT_uv_map"
        col.operator("mesh.mark_seam",icon = 'TEXTURE_DATA').clear = False
        col.operator("mesh.mark_seam", text="Clear Seam",icon = 'TEXTURE_DATA').clear = True
                     
        col.label(text="Objects:")
        
        
        
        col.operator("mesh.primitive_plane_add",text="Plane", icon='MESH_PLANE')
        col.operator("mesh.primitive_cube_add",text="Cube", icon='MESH_CUBE')
        col.operator("mesh.primitive_circle_add",text="Circle", icon='MESH_CIRCLE')
        col.operator("mesh.primitive_uv_sphere_add",text="UV Sphere", icon='MESH_UVSPHERE')
        col.operator("mesh.primitive_ico_sphere_add",text="ICO Sphere", icon='MESH_ICOSPHERE')
        col.operator("mesh.primitive_cylinder_add",text="Cylinder", icon='MESH_CYLINDER')
        col.operator("mesh.primitive_cone_add",text="Cone", icon='MESH_CONE')
        col.operator("mesh.primitive_torus_add",text="Torus", icon='MESH_TORUS')
        col.operator("mesh.primitive_grid_add",text="Grid", icon='MESH_GRID')
        
        
        col.label(text="Modifiers:")
        
        col.operator_menu_enum("object.modifier_add","type")
        col.label(text="Constraints")
        col.operator_menu_enum("object.constraint_add","type")
        
def register():
    bpy.utils.register_class(customPanel)
    
def unregister():
    bpy.utils.register_class(customPanel)




if __name__ == "__main__":
    register()