From 5bf39c3cfb72f7b1b79c847ac9f6f0804f813868 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 25 Jul 2017 01:30:13 +1000 Subject: Cleanup: trailing spaces --- rigify/rigs/limbs/super_finger.py | 114 +++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 57 deletions(-) (limited to 'rigify/rigs/limbs/super_finger.py') diff --git a/rigify/rigs/limbs/super_finger.py b/rigify/rigs/limbs/super_finger.py index 60645372..b08af602 100644 --- a/rigify/rigs/limbs/super_finger.py +++ b/rigify/rigs/limbs/super_finger.py @@ -15,57 +15,57 @@ if is_selected(controls): class Rig: - + def __init__(self, obj, bone_name, params): self.obj = obj self.org_bones = [bone_name] + connected_children_names(obj, bone_name) self.params = params - + if len(self.org_bones) <= 1: - raise MetarigError("RIGIFY ERROR: Bone '%s': listen bro, that finger rig jusaint put tugetha rite. A little hint, use more than one bone!!" % (strip_org(bone_name))) + raise MetarigError("RIGIFY ERROR: Bone '%s': listen bro, that finger rig jusaint put tugetha rite. A little hint, use more than one bone!!" % (strip_org(bone_name))) def generate(self): org_bones = self.org_bones - + bpy.ops.object.mode_set(mode ='EDIT') eb = self.obj.data.edit_bones - + # Bone name lists ctrl_chain = [] def_chain = [] mch_chain = [] mch_drv_chain = [] - + # Create ctrl master bone org_name = self.org_bones[0] temp_name = strip_org(self.org_bones[0]) - + suffix = temp_name[-2:] master_name = temp_name[:-5] + "_master" + suffix master_name = copy_bone( self.obj, org_name, master_name ) ctrl_bone_master = eb[ master_name ] - + ## Parenting bug fix ?? ctrl_bone_master.use_connect = False ctrl_bone_master.parent = None - + ctrl_bone_master.tail += ( eb[ org_bones[-1] ].tail - eb[org_name].head ) * 1.25 for bone in org_bones: eb[bone].use_connect = False if org_bones.index( bone ) != 0: eb[bone].parent = None - + # Creating the bone chains for i in range(len(self.org_bones)): - + name = self.org_bones[i] ctrl_name = strip_org(name) - + # Create control bones ctrl_bone = copy_bone( self.obj, name, ctrl_name ) ctrl_bone_e = eb[ ctrl_name ] - + # Create deformation bones def_name = make_deformer_name( ctrl_name ) def_bone = copy_bone( self.obj, name, def_name ) @@ -73,26 +73,26 @@ class Rig: # Create mechanism bones mch_name = make_mechanism_name( ctrl_name ) mch_bone = copy_bone( self.obj, name, mch_name ) - + # Create mechanism driver bones drv_name = make_mechanism_name(ctrl_name) + "_drv" mch_bone_drv = copy_bone(self.obj, name, drv_name) mch_bone_drv_e = eb[drv_name] - + # Adding to lists ctrl_chain += [ctrl_name] - def_chain += [def_bone] + def_chain += [def_bone] mch_chain += [mch_bone] mch_drv_chain += [drv_name] - + # Restoring org chain parenting for bone in org_bones[1:]: eb[bone].parent = eb[ org_bones[ org_bones.index(bone) - 1 ] ] - + # Parenting the master bone to the first org ctrl_bone_master = eb[ master_name ] ctrl_bone_master.parent = eb[ org_bones[0] ] - + # Parenting chain bones for i in range(len(self.org_bones)): # Edit bone references @@ -100,7 +100,7 @@ class Rig: ctrl_bone_e = eb[ctrl_chain[i]] mch_bone_e = eb[mch_chain[i]] mch_bone_drv_e = eb[mch_drv_chain[i]] - + if i == 0: # First ctl bone ctrl_bone_e.parent = mch_bone_drv_e @@ -117,19 +117,19 @@ class Rig: else: # The rest ctrl_bone_e.parent = mch_bone_drv_e - ctrl_bone_e.use_connect = False - + ctrl_bone_e.use_connect = False + def_bone_e.parent = eb[def_chain[i-1]] def_bone_e.use_connect = True - + mch_bone_drv_e.parent = eb[ctrl_chain[i-1]] mch_bone_drv_e.use_connect = False # Parenting mch bone mch_bone_e.parent = ctrl_bone_e mch_bone_e.use_connect = False - - # Creating tip conrtol bone + + # Creating tip conrtol bone tip_name = copy_bone( self.obj, org_bones[-1], temp_name ) ctrl_bone_tip = eb[ tip_name ] flip_bone( self.obj, tip_name ) @@ -138,17 +138,17 @@ class Rig: ctrl_bone_tip.parent = eb[ctrl_chain[-1]] bpy.ops.object.mode_set(mode ='OBJECT') - + pb = self.obj.pose.bones - + # Setting pose bones locks pb_master = pb[master_name] pb_master.lock_scale = True,False,True - + pb[tip_name].lock_scale = True,True,True pb[tip_name].lock_rotation = True,True,True pb[tip_name].lock_rotation_w = True - + pb_master['finger_curve'] = 0.0 prop = rna_idprop_ui_prop_get(pb_master, 'finger_curve') prop["min"] = 0.0 @@ -159,7 +159,7 @@ class Rig: # Pose settings for org, ctrl, deform, mch, mch_drv in zip(self.org_bones, ctrl_chain, def_chain, mch_chain, mch_drv_chain): - + # Constraining the org bones #con = pb[org].constraints.new('COPY_TRANSFORMS') #con.target = self.obj @@ -169,31 +169,31 @@ class Rig: con = pb[deform].constraints.new('COPY_TRANSFORMS') con.target = self.obj con.subtarget = mch - + # Constraining the mch bones if mch_chain.index(mch) == 0: con = pb[mch].constraints.new('COPY_LOCATION') con.target = self.obj con.subtarget = ctrl - + con = pb[mch].constraints.new('COPY_SCALE') con.target = self.obj con.subtarget = ctrl - + con = pb[mch].constraints.new('DAMPED_TRACK') con.target = self.obj con.subtarget = ctrl_chain[ctrl_chain.index(ctrl)+1] - + con = pb[mch].constraints.new('STRETCH_TO') con.target = self.obj con.subtarget = ctrl_chain[ctrl_chain.index(ctrl)+1] con.volume = 'NO_VOLUME' - + elif mch_chain.index(mch) == len(mch_chain) - 1: con = pb[mch].constraints.new('DAMPED_TRACK') con.target = self.obj con.subtarget = tip_name - + con = pb[mch].constraints.new('STRETCH_TO') con.target = self.obj con.subtarget = tip_name @@ -202,7 +202,7 @@ class Rig: con = pb[mch].constraints.new('DAMPED_TRACK') con.target = self.obj con.subtarget = ctrl_chain[ctrl_chain.index(ctrl)+1] - + con = pb[mch].constraints.new('STRETCH_TO') con.target = self.obj con.subtarget = ctrl_chain[ctrl_chain.index(ctrl)+1] @@ -210,19 +210,19 @@ class Rig: # Constraining and driving mch driver bones pb[mch_drv].rotation_mode = 'YZX' - + if mch_drv_chain.index(mch_drv) == 0: # Constraining to master bone con = pb[mch_drv].constraints.new('COPY_LOCATION') con.target = self.obj con.subtarget = master_name - + con = pb[mch_drv].constraints.new('COPY_ROTATION') con.target = self.obj con.subtarget = master_name con.target_space = 'LOCAL' con.owner_space = 'LOCAL' - + else: # Match axis to expression options = { @@ -239,7 +239,7 @@ class Rig: "-Z" : { "axis" : 2, "expr" : '-((1-sy)*pi)' } } - + axis = self.params.primary_rotation_axis # Drivers @@ -251,7 +251,7 @@ class Rig: drv_var.type = "SINGLE_PROP" drv_var.targets[0].id = self.obj drv_var.targets[0].data_path = pb[master_name].path_from_id() + '.scale.y' - + # Setting bone curvature setting, costum property, and drivers def_bone = self.obj.data.bones[deform] @@ -264,7 +264,7 @@ class Rig: drv_var.type = "SINGLE_PROP" drv_var.targets[0].id = self.obj drv_var.targets[0].data_path = pb_master.path_from_id() + '["finger_curve"]' - + drv = def_bone.driver_add("bbone_out").driver # Ease out drv.type='SUM' @@ -274,10 +274,10 @@ class Rig: drv_var.targets[0].id = self.obj drv_var.targets[0].data_path = pb_master.path_from_id() + '["finger_curve"]' - + # Assigning shapes to control bones create_circle_widget(self.obj, ctrl, radius=0.3, head_tail=0.5) - + # Create ctrl master widget w = create_widget(self.obj, master_name) if w is not None: @@ -292,7 +292,7 @@ class Rig: edges = [(0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 1)] mesh.from_pydata(verts, edges, []) mesh.update() - + # Create tip control widget create_circle_widget(self.obj, tip_name, radius=0.3, head_tail=0.0) @@ -301,8 +301,8 @@ class Rig: ["'" + x + "'" for x in ctrl_chain] ) + ", " + "'" + master_name + "'" return [script % (controls_string, master_name, 'finger_curve')] - - + + def add_parameters(params): """ Add the parameters of this rig type to the RigifyParameters PropertyGroup @@ -316,9 +316,9 @@ def parameters_ui(layout, params): """ r = layout.row() r.label(text="Bend rotation axis:") - r.prop(params, "primary_rotation_axis", text="") - - + r.prop(params, "primary_rotation_axis", text="") + + def create_sample(obj): # generated by rigify.utils.write_metarig bpy.ops.object.mode_set(mode='EDIT') @@ -406,9 +406,9 @@ def create_sample(obj): bone.select = True bone.select_head = True bone.select_tail = True - arm.edit_bones.active = bone - - - - - + arm.edit_bones.active = bone + + + + + -- cgit v1.2.3