Skip to content
Snippets Groups Projects
Commit 4330632e authored by Campbell Barton's avatar Campbell Barton
Browse files

Superficial pep8 edits

parent 2bb8bb9b
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,7 @@ bl_info = { ...@@ -26,7 +26,7 @@ bl_info = {
"location": "Object UI -> Mocap tools", "location": "Object UI -> Mocap tools",
"description": "Various tools for working with motion capture animation", "description": "Various tools for working with motion capture animation",
"warning": "", "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": "", "tracker_url": "",
"support": 'OFFICIAL', "support": 'OFFICIAL',
"category": "Animation"} "category": "Animation"}
...@@ -121,7 +121,6 @@ class MocapConstraint(bpy.types.PropertyGroup): ...@@ -121,7 +121,6 @@ class MocapConstraint(bpy.types.PropertyGroup):
real_constraint_bone = bpy.props.StringProperty() real_constraint_bone = bpy.props.StringProperty()
# Animation Stitch Settings, used for animation stitching of 2 retargeted animations. # Animation Stitch Settings, used for animation stitching of 2 retargeted animations.
class AnimationStitchSettings(bpy.types.PropertyGroup): class AnimationStitchSettings(bpy.types.PropertyGroup):
first_action = bpy.props.StringProperty(name="Action 1", first_action = bpy.props.StringProperty(name="Action 1",
...@@ -141,7 +140,6 @@ class AnimationStitchSettings(bpy.types.PropertyGroup): ...@@ -141,7 +140,6 @@ class AnimationStitchSettings(bpy.types.PropertyGroup):
default="") default="")
# MocapNLA Tracks. Stores which tracks/actions are associated with each retargeted animation. # MocapNLA Tracks. Stores which tracks/actions are associated with each retargeted animation.
class MocapNLATracks(bpy.types.PropertyGroup): class MocapNLATracks(bpy.types.PropertyGroup):
name = bpy.props.StringProperty() name = bpy.props.StringProperty()
...@@ -151,8 +149,6 @@ class MocapNLATracks(bpy.types.PropertyGroup): ...@@ -151,8 +149,6 @@ class MocapNLATracks(bpy.types.PropertyGroup):
stride_action = bpy.props.StringProperty() stride_action = bpy.props.StringProperty()
#Update function for Advanced Retarget boolean variable. #Update function for Advanced Retarget boolean variable.
def advancedRetargetToggle(self, context): def advancedRetargetToggle(self, context):
enduser_obj = context.active_object enduser_obj = context.active_object
...@@ -168,7 +164,6 @@ def advancedRetargetToggle(self, context): ...@@ -168,7 +164,6 @@ def advancedRetargetToggle(self, context):
retarget.cleanTempConstraints(enduser_obj) retarget.cleanTempConstraints(enduser_obj)
def toggleIKBone(self, context): def toggleIKBone(self, context):
#Update function for IK functionality. Is called when IK prop checkboxes are toggled. #Update function for IK functionality. Is called when IK prop checkboxes are toggled.
if self.IKRetarget: if self.IKRetarget:
...@@ -220,7 +215,6 @@ class MocapMapping(bpy.types.PropertyGroup): ...@@ -220,7 +215,6 @@ class MocapMapping(bpy.types.PropertyGroup):
name = bpy.props.StringProperty() name = bpy.props.StringProperty()
def updateIKRetarget(): def updateIKRetarget():
# ensures that Blender constraints and IK properties are in sync # ensures that Blender constraints and IK properties are in sync
# currently runs when module is loaded, should run when scene is loaded # currently runs when module is loaded, should run when scene is loaded
...@@ -237,6 +231,7 @@ def updateIKRetarget(): ...@@ -237,6 +231,7 @@ def updateIKRetarget():
updateIKRetarget() updateIKRetarget()
def hasIKConstraint(pose_bone): def hasIKConstraint(pose_bone):
#utility function / predicate, returns True if given bone has IK constraint #utility function / predicate, returns True if given bone has IK constraint
ik = [constraint for constraint in pose_bone.constraints if constraint.type == "IK"] ik = [constraint for constraint in pose_bone.constraints if constraint.type == "IK"]
...@@ -245,6 +240,7 @@ def hasIKConstraint(pose_bone): ...@@ -245,6 +240,7 @@ def hasIKConstraint(pose_bone):
else: else:
return False return False
class MocapPanel(bpy.types.Panel): class MocapPanel(bpy.types.Panel):
# Motion capture retargeting panel # Motion capture retargeting panel
bl_label = "Mocap tools" bl_label = "Mocap tools"
...@@ -281,7 +277,7 @@ class MocapPanel(bpy.types.Panel): ...@@ -281,7 +277,7 @@ class MocapPanel(bpy.types.Panel):
perf_pose_bones = enduser_obj.pose.bones perf_pose_bones = enduser_obj.pose.bones
MappingRow = self.layout.row(align=True) MappingRow = self.layout.row(align=True)
footCol = MappingRow.column(align=True) footCol = MappingRow.column(align=True)
nameCol =MappingRow.column(align=True) nameCol = MappingRow.column(align=True)
nameCol.scale_x = 2 nameCol.scale_x = 2
mapCol = MappingRow.column(align=True) mapCol = MappingRow.column(align=True)
mapCol.scale_x = 2 mapCol.scale_x = 2
...@@ -877,8 +873,8 @@ def register(): ...@@ -877,8 +873,8 @@ def register():
description="Amount of frames to skip - for previewing retargets quickly. 1 is fully sampled", description="Amount of frames to skip - for previewing retargets quickly. 1 is fully sampled",
min=1) min=1)
bpy.utils.register_module(__name__) bpy.utils.register_module(__name__)
def unregister(): def unregister():
bpy.utils.unregister_module(__name__) bpy.utils.unregister_module(__name__)
......
...@@ -282,7 +282,7 @@ def setConstraint(m_constraint, context): ...@@ -282,7 +282,7 @@ def setConstraint(m_constraint, context):
real_constraint.target = obj real_constraint.target = obj
real_constraint.subtarget = getConsObj(bones[m_constraint.constrained_boneB]).name real_constraint.subtarget = getConsObj(bones[m_constraint.constrained_boneB]).name
real_constraint.limit_mode = "LIMITDIST_ONSURFACE" real_constraint.limit_mode = "LIMITDIST_ONSURFACE"
if m_constraint.targetDist<0.01: if m_constraint.targetDist < 0.01:
m_constraint.targetDist = 0.01 m_constraint.targetDist = 0.01
real_constraint.distance = m_constraint.targetDist real_constraint.distance = m_constraint.targetDist
......
...@@ -116,8 +116,8 @@ class dataPoint: ...@@ -116,8 +116,8 @@ class dataPoint:
def crossCorrelationMatch(curvesA, curvesB, margin): def crossCorrelationMatch(curvesA, curvesB, margin):
dataA = [] dataA = []
dataB = [] dataB = []
start = int(max(curvesA[0].range()[0],curvesB[0].range()[0])) start = int(max(curvesA[0].range()[0], curvesB[0].range()[0]))
end = int(min(curvesA[0].range()[1],curvesB[0].range()[1])) end = int(min(curvesA[0].range()[1], curvesB[0].range()[1]))
#transfer all fcurves data on each frame to a single NdVector. #transfer all fcurves data on each frame to a single NdVector.
for i in range(1, end): for i in range(1, end):
...@@ -131,6 +131,7 @@ def crossCorrelationMatch(curvesA, curvesB, margin): ...@@ -131,6 +131,7 @@ def crossCorrelationMatch(curvesA, curvesB, margin):
if fcurve.data_path in [otherFcurve.data_path for otherFcurve in curvesA]: if fcurve.data_path in [otherFcurve.data_path for otherFcurve in curvesA]:
vec.append(fcurve.evaluate(i)) vec.append(fcurve.evaluate(i))
dataB.append(NdVector(vec)) dataB.append(NdVector(vec))
#Comparator for Cross Correlation. "Classic" implementation uses dot product, as do we. #Comparator for Cross Correlation. "Classic" implementation uses dot product, as do we.
def comp(a, b): def comp(a, b):
return a * b return a * b
...@@ -877,7 +878,7 @@ def anim_stitch(context, enduser_obj): ...@@ -877,7 +878,7 @@ def anim_stitch(context, enduser_obj):
scene.frame_set(stitch_settings.blend_frame - 1) scene.frame_set(stitch_settings.blend_frame - 1)
desired_pos = (enduser_obj.matrix_world * selected_bone.matrix.to_translation()) desired_pos = (enduser_obj.matrix_world * selected_bone.matrix.to_translation())
scene.frame_set(stitch_settings.blend_frame) 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) print(desired_pos, actual_pos)
offset = Vector(actual_pos) - Vector(desired_pos) offset = Vector(actual_pos) - Vector(desired_pos)
...@@ -887,7 +888,7 @@ def anim_stitch(context, enduser_obj): ...@@ -887,7 +888,7 @@ def anim_stitch(context, enduser_obj):
pt.co.y -= offset[i] pt.co.y -= offset[i]
pt.handle_left.y -= offset[i] pt.handle_left.y -= offset[i]
pt.handle_right.y -= offset[i] pt.handle_right.y -= offset[i]
#actionBStrip.blend_in = stitch_settings.blend_amount #actionBStrip.blend_in = stitch_settings.blend_amount
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment