forked from bartvdbraak/blender
pep8 compliance for python scripts
This commit is contained in:
parent
2367220108
commit
eb6ac55e93
@ -96,7 +96,7 @@ def updateConstraintBoneType(m_constraint, context):
|
|||||||
# Function that copies all settings from m_constraint to the real Blender constraints
|
# Function that copies all settings from m_constraint to the real Blender constraints
|
||||||
# Is only called when blender constraint already exists
|
# Is only called when blender constraint already exists
|
||||||
|
|
||||||
def setConstraintFraming(m_constraint, cons_obj):
|
def setConstraintFraming(m_constraint, cons_obj, real_constraint):
|
||||||
if isinstance(cons_obj, bpy.types.PoseBone):
|
if isinstance(cons_obj, bpy.types.PoseBone):
|
||||||
fcurves = obj.animation_data.action.fcurves
|
fcurves = obj.animation_data.action.fcurves
|
||||||
else:
|
else:
|
||||||
@ -118,6 +118,7 @@ def setConstraintFraming(m_constraint, cons_obj):
|
|||||||
real_constraint.keyframe_insert(data_path="influence", frame=s - s_in)
|
real_constraint.keyframe_insert(data_path="influence", frame=s - s_in)
|
||||||
real_constraint.keyframe_insert(data_path="influence", frame=e + s_out)
|
real_constraint.keyframe_insert(data_path="influence", frame=e + s_out)
|
||||||
|
|
||||||
|
|
||||||
def setConstraint(m_constraint):
|
def setConstraint(m_constraint):
|
||||||
if not m_constraint.constrained_bone:
|
if not m_constraint.constrained_bone:
|
||||||
return
|
return
|
||||||
@ -128,7 +129,7 @@ def setConstraint(m_constraint):
|
|||||||
real_constraint = cons_obj.constraints[m_constraint.real_constraint]
|
real_constraint = cons_obj.constraints[m_constraint.real_constraint]
|
||||||
|
|
||||||
#frame changing section
|
#frame changing section
|
||||||
setConstraintFraming(m_constraint, cons_obj)
|
setConstraintFraming(m_constraint, cons_obj, real_constraint)
|
||||||
|
|
||||||
#Set the blender constraint parameters
|
#Set the blender constraint parameters
|
||||||
if m_constraint.type == "point":
|
if m_constraint.type == "point":
|
||||||
@ -149,7 +150,7 @@ def setConstraint(m_constraint):
|
|||||||
|
|
||||||
if m_constraint.type == "freeze":
|
if m_constraint.type == "freeze":
|
||||||
real_constraint.owner_space = m_constraint.targetSpace
|
real_constraint.owner_space = m_constraint.targetSpace
|
||||||
bpy.context.scene.frame_set(s)
|
bpy.context.scene.frame_set(m_constraint.s_frame)
|
||||||
if isinstance(cons_obj, bpy.types.PoseBone):
|
if isinstance(cons_obj, bpy.types.PoseBone):
|
||||||
x, y, z = cons_obj.center + (cons_obj.vector / 2)
|
x, y, z = cons_obj.center + (cons_obj.vector / 2)
|
||||||
else:
|
else:
|
||||||
@ -174,6 +175,5 @@ def setConstraint(m_constraint):
|
|||||||
real_constraint.limit_mode = "LIMITDIST_ONSURFACE"
|
real_constraint.limit_mode = "LIMITDIST_ONSURFACE"
|
||||||
real_constraint.distance = m_constraint.targetDist
|
real_constraint.distance = m_constraint.targetDist
|
||||||
|
|
||||||
|
|
||||||
# active check
|
# active check
|
||||||
real_constraint.mute = not m_constraint.active
|
real_constraint.mute = not m_constraint.active
|
||||||
|
@ -550,22 +550,20 @@ def denoise_median():
|
|||||||
|
|
||||||
|
|
||||||
def rotate_fix_armature(arm_data):
|
def rotate_fix_armature(arm_data):
|
||||||
global_matrix = Matrix.Rotation(radians(90),4,"X")
|
global_matrix = Matrix.Rotation(radians(90), 4, "X")
|
||||||
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
|
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
|
||||||
if global_matrix!=Matrix(): #optimization: this might not be needed.
|
#disconnect all bones for ease of global rotation
|
||||||
#disconnect all bones for ease of global rotation
|
connectedBones = []
|
||||||
connectedBones = []
|
for bone in arm_data.edit_bones:
|
||||||
for bone in arm_data.edit_bones:
|
if bone.use_connect:
|
||||||
if bone.use_connect:
|
connectedBones.append(bone.name)
|
||||||
connectedBones.append(bone.name)
|
bone.use_connect = False
|
||||||
bone.use_connect=False
|
|
||||||
|
|
||||||
#rotate all the bones around their center
|
#rotate all the bones around their center
|
||||||
for bone in arm_data.edit_bones:
|
for bone in arm_data.edit_bones:
|
||||||
bone.transform(global_matrix)
|
bone.transform(global_matrix)
|
||||||
|
|
||||||
#reconnect the bones
|
|
||||||
for bone in connectedBones:
|
|
||||||
arm_data.edit_bones[bone].use_connect=True
|
|
||||||
|
|
||||||
|
#reconnect the bones
|
||||||
|
for bone in connectedBones:
|
||||||
|
arm_data.edit_bones[bone].use_connect = True
|
||||||
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
|
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
|
Loading…
Reference in New Issue
Block a user