From 4330632ef09237e360af91fbbcc1cbc5aa3a3be8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 26 Aug 2011 05:33:04 +0000 Subject: Superficial pep8 edits --- mocap/__init__.py | 16 ++++++---------- mocap/mocap_constraints.py | 2 +- mocap/mocap_tools.py | 9 +++++---- 3 files changed, 12 insertions(+), 15 deletions(-) (limited to 'mocap') diff --git a/mocap/__init__.py b/mocap/__init__.py index 7a8547a9..e1829a98 100644 --- a/mocap/__init__.py +++ b/mocap/__init__.py @@ -26,7 +26,7 @@ bl_info = { "location": "Object UI -> Mocap tools", "description": "Various tools for working with motion capture animation", "warning": "", - "wiki_url": ("http://wiki.blender.org/index.php/User:Benjycook/GSOC/Manual"), + "wiki_url": "http://wiki.blender.org/index.php/User:Benjycook/GSOC/Manual", "tracker_url": "", "support": 'OFFICIAL', "category": "Animation"} @@ -121,7 +121,6 @@ class MocapConstraint(bpy.types.PropertyGroup): real_constraint_bone = bpy.props.StringProperty() - # Animation Stitch Settings, used for animation stitching of 2 retargeted animations. class AnimationStitchSettings(bpy.types.PropertyGroup): first_action = bpy.props.StringProperty(name="Action 1", @@ -141,7 +140,6 @@ class AnimationStitchSettings(bpy.types.PropertyGroup): default="") - # MocapNLA Tracks. Stores which tracks/actions are associated with each retargeted animation. class MocapNLATracks(bpy.types.PropertyGroup): name = bpy.props.StringProperty() @@ -151,8 +149,6 @@ class MocapNLATracks(bpy.types.PropertyGroup): stride_action = bpy.props.StringProperty() - - #Update function for Advanced Retarget boolean variable. def advancedRetargetToggle(self, context): enduser_obj = context.active_object @@ -168,7 +164,6 @@ def advancedRetargetToggle(self, context): retarget.cleanTempConstraints(enduser_obj) - def toggleIKBone(self, context): #Update function for IK functionality. Is called when IK prop checkboxes are toggled. if self.IKRetarget: @@ -220,7 +215,6 @@ class MocapMapping(bpy.types.PropertyGroup): name = bpy.props.StringProperty() - def updateIKRetarget(): # ensures that Blender constraints and IK properties are in sync # currently runs when module is loaded, should run when scene is loaded @@ -237,6 +231,7 @@ def updateIKRetarget(): updateIKRetarget() + def hasIKConstraint(pose_bone): #utility function / predicate, returns True if given bone has IK constraint ik = [constraint for constraint in pose_bone.constraints if constraint.type == "IK"] @@ -245,6 +240,7 @@ def hasIKConstraint(pose_bone): else: return False + class MocapPanel(bpy.types.Panel): # Motion capture retargeting panel bl_label = "Mocap tools" @@ -281,7 +277,7 @@ class MocapPanel(bpy.types.Panel): perf_pose_bones = enduser_obj.pose.bones MappingRow = self.layout.row(align=True) footCol = MappingRow.column(align=True) - nameCol =MappingRow.column(align=True) + nameCol = MappingRow.column(align=True) nameCol.scale_x = 2 mapCol = MappingRow.column(align=True) mapCol.scale_x = 2 @@ -877,8 +873,8 @@ def register(): description="Amount of frames to skip - for previewing retargets quickly. 1 is fully sampled", min=1) bpy.utils.register_module(__name__) - - + + def unregister(): bpy.utils.unregister_module(__name__) diff --git a/mocap/mocap_constraints.py b/mocap/mocap_constraints.py index 5e349454..4b6611bf 100644 --- a/mocap/mocap_constraints.py +++ b/mocap/mocap_constraints.py @@ -282,7 +282,7 @@ def setConstraint(m_constraint, context): real_constraint.target = obj real_constraint.subtarget = getConsObj(bones[m_constraint.constrained_boneB]).name real_constraint.limit_mode = "LIMITDIST_ONSURFACE" - if m_constraint.targetDist<0.01: + if m_constraint.targetDist < 0.01: m_constraint.targetDist = 0.01 real_constraint.distance = m_constraint.targetDist diff --git a/mocap/mocap_tools.py b/mocap/mocap_tools.py index ede55db4..8815f169 100644 --- a/mocap/mocap_tools.py +++ b/mocap/mocap_tools.py @@ -116,8 +116,8 @@ class dataPoint: def crossCorrelationMatch(curvesA, curvesB, margin): dataA = [] dataB = [] - start = int(max(curvesA[0].range()[0],curvesB[0].range()[0])) - end = int(min(curvesA[0].range()[1],curvesB[0].range()[1])) + start = int(max(curvesA[0].range()[0], curvesB[0].range()[0])) + end = int(min(curvesA[0].range()[1], curvesB[0].range()[1])) #transfer all fcurves data on each frame to a single NdVector. for i in range(1, end): @@ -131,6 +131,7 @@ def crossCorrelationMatch(curvesA, curvesB, margin): if fcurve.data_path in [otherFcurve.data_path for otherFcurve in curvesA]: vec.append(fcurve.evaluate(i)) dataB.append(NdVector(vec)) + #Comparator for Cross Correlation. "Classic" implementation uses dot product, as do we. def comp(a, b): return a * b @@ -877,7 +878,7 @@ def anim_stitch(context, enduser_obj): scene.frame_set(stitch_settings.blend_frame - 1) desired_pos = (enduser_obj.matrix_world * selected_bone.matrix.to_translation()) scene.frame_set(stitch_settings.blend_frame) - actual_pos = (enduser_obj.matrix_world * selected_bone.matrix.to_translation() ) + actual_pos = (enduser_obj.matrix_world * selected_bone.matrix.to_translation()) print(desired_pos, actual_pos) offset = Vector(actual_pos) - Vector(desired_pos) @@ -887,7 +888,7 @@ def anim_stitch(context, enduser_obj): pt.co.y -= offset[i] pt.handle_left.y -= offset[i] pt.handle_right.y -= offset[i] - + #actionBStrip.blend_in = stitch_settings.blend_amount -- cgit v1.2.3