Changeset View
Changeset View
Standalone View
Standalone View
mocap/retarget.py
| Context not available. | |||||
| perf_arm.bones[perf_bone.name].map = end_bone.name | perf_arm.bones[perf_bone.name].map = end_bone.name | ||||
| #creation of intermediate armature | #creation of intermediate armature | ||||
| # the intermediate armature has the hiearchy of the end user, | # the intermediate armature has the hierarchy of the end user, | ||||
| # does not have rotation inheritence | # does not have rotation inheritance | ||||
| # and bone roll is identical to the performer | # and bone roll is identical to the performer | ||||
| # its purpose is to copy over the rotations | # its purpose is to copy over the rotations | ||||
| # easily while concentrating on the hierarchy changes | # easily while concentrating on the hierarchy changes | ||||
| Context not available. | |||||
| lerp_matrix = first_mat.lerp(next_mat, 0.5) | lerp_matrix = first_mat.lerp(next_mat, 0.5) | ||||
| return lerp_matrix | return lerp_matrix | ||||
| #determines the type of hierachy change needed and calls the | #determines the type of hierarchy change needed and calls the | ||||
| #right function | #right function | ||||
| def retargetPerfToInter(inter_bone): | def retargetPerfToInter(inter_bone): | ||||
| if inter_bone.bone.reverseMap: | if inter_bone.bone.reverseMap: | ||||
| Context not available. | |||||
| inter_bones = inter_obj.pose.bones | inter_bones = inter_obj.pose.bones | ||||
| end_bones = enduser_obj.pose.bones | end_bones = enduser_obj.pose.bones | ||||
| #Basic "visual baking" function, for transfering rotations from intermediate to end user | #Basic "visual baking" function, for transferring rotations from intermediate to end user | ||||
| def bakeTransform(end_bone): | def bakeTransform(end_bone): | ||||
| src_bone = inter_bones[end_bone.name] | src_bone = inter_bones[end_bone.name] | ||||
| trg_bone = end_bone | trg_bone = end_bone | ||||
| Context not available. | |||||
| end_bone.keyframe_insert("location") | end_bone.keyframe_insert("location") | ||||
| bakeTransform(end_bone) | bakeTransform(end_bone) | ||||
| #recieves the performer feet bones as a variable | #receives the performer feet bones as a variable | ||||
| # by "feet" I mean those bones that have plants | # by "feet" I mean those bones that have plants | ||||
| # (they don't move, despite root moving) somewhere in the animation. | # (they don't move, despite root moving) somewhere in the animation. | ||||
| Context not available. | |||||