diff options
author | Benjy Cook <benjycook@hotmail.com> | 2011-07-06 17:29:31 +0400 |
---|---|---|
committer | Benjy Cook <benjycook@hotmail.com> | 2011-07-06 17:29:31 +0400 |
commit | ebbcae36b32a3bcb7da800cabf447db109381fcc (patch) | |
tree | fa09f7d1a7d0a8443d7e91eb14db86d3353082f3 /release/scripts | |
parent | 89d7b9a0a6cdd0a2183a8e0f931f38c52303f848 (diff) |
Coding style and cosmetic changes to mocap constraints module
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/modules/mocap_constraints.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/release/scripts/modules/mocap_constraints.py b/release/scripts/modules/mocap_constraints.py index 4a7c22eb771..91ac87d8705 100644 --- a/release/scripts/modules/mocap_constraints.py +++ b/release/scripts/modules/mocap_constraints.py @@ -95,16 +95,8 @@ def updateConstraintBoneType(m_constraint, context): # Function that copies all settings from m_constraint to the real Blender constraints # Is only called when blender constraint already exists -def setConstraint(m_constraint): - if not m_constraint.constrained_bone: - return - obj = bpy.context.active_object - bones = obj.pose.bones - bone = bones[m_constraint.constrained_bone] - cons_obj = getConsObj(bone) - real_constraint = cons_obj.constraints[m_constraint.real_constraint] - #frame changing section +def setConstraintFraming(m_constraint, cons_obj): if isinstance(cons_obj, bpy.types.PoseBone): fcurves = obj.animation_data.action.fcurves else: @@ -125,6 +117,19 @@ def setConstraint(m_constraint): real_constraint.influence = 0 real_constraint.keyframe_insert(data_path="influence", frame=s - s_in) real_constraint.keyframe_insert(data_path="influence", frame=e + s_out) + +def setConstraint(m_constraint): + if not m_constraint.constrained_bone: + return + obj = bpy.context.active_object + bones = obj.pose.bones + bone = bones[m_constraint.constrained_bone] + cons_obj = getConsObj(bone) + real_constraint = cons_obj.constraints[m_constraint.real_constraint] + + #frame changing section + setConstraintFraming(m_constraint, cons_obj) + #Set the blender constraint parameters if m_constraint.type == "point": real_constraint.owner_space = m_constraint.targetSpace @@ -168,6 +173,7 @@ def setConstraint(m_constraint): real_constraint.target = getConsObj(bones[m_constraint.constrained_boneB]) real_constraint.limit_mode = "LIMITDIST_ONSURFACE" real_constraint.distance = m_constraint.targetDist + # active check real_constraint.mute = not m_constraint.active |