Hello!
I’m a total beginner at coding and I’m having some troubles with my first script
I copied the main sructure from a script that toggles layer visibility for some bones from a rigging course I did at IHMAN 3D School. Now I’m trying to tweak it to fit my needs.
Aside from a quicker acess to some Armature functions via Toolshelf, I want to be able to set all the selected bones to Deform=True/False at once with a button. I marked the line I wrote to accomplish this.
The script as is now goes as follows:
import bpy
class dwarfButtons(bpy.types.Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_category = "Rigging"
bl_label = "Dwarf Rig Layers"
@classmethod
def poll(self,context):
if(bpy.context.active_object.type == 'ARMATURE'):
return(True)
def draw(self,context):
layout = self.layout
row = layout.row()
row.label("Edit/Display options:")
row = layout.row()
row.prop(context.active_object.data, "use_mirror_x", toggle=True, text="edit: x mirror")
row = layout.row()
row.prop(context.active_object.data, "show_names", toggle=True, text="names")
row = layout.row()
row.prop(context.active_object.data, "show_bone_custom_shapes", toggle=True, text="shapes")
row = layout.row()
row.prop(context.active_object.data, "show_axes", toggle=True, text="axe display")
row = layout.row()
row.prop(context.active_object, "show_x_ray", toggle=True, text="xRay")
row = layout.row()
row.prop(context.selected_bones, "use_deform", toggle=True, text="Deform OFF") <b>#THIS LINE</b>
def register():
bpy.utils.register_class(dwarfButtons)
def unregister():
bpy.utils.unregister_class(dwarfButtons)
if __name__=="__main__":
register()
I don’t totally know what I’m doing yet. I discovered what functions to call trough the info pannel and quick searches at the Pythin API.
Thanks in advance to anyone who can help me understandnig my problem and/or finding a solution.
I already asked for help with the topic at the Animation/Rigging forum, so sorry if either this or the other thread is in the wrong place!