Skip to content

Commit

Permalink
Add scale for morph tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
Chryfi committed Sep 23, 2021
1 parent fcdd516 commit 3c66b31
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
bl_info = {
"name": "Aperture JSON tracking import",
"author": "Christian F. (known as Chryfi)",
"version": (1, 2),
"version": (1, 3),
"blender": (2, 80, 0),
"location": "File > Import",
"description": "Import tracking data from a json file generated by the Aperture Mod.",
"warning": "",
"category": "Import"
}
version_no = 120
version_no = 130

import bpy
import json
Expand Down Expand Up @@ -174,15 +174,19 @@ def execute(self, context):
if frame == 0:
startFrame = int(int(frameData["frame"]) // ignoreFrame)

keyframePos = blenderFrame+frameOffset+startFrame

#obj.delta_rotation_euler = Euler((math.radians(90), 0, 0), 'ZXY')
#obj.rotation_euler = Euler((math.radians(frameData["rotation"][1]), math.radians(frameData["rotation"][0] - 90), math.radians(90 - frameData["rotation"][2])), 'ZXY')

obj.rotation_mode = 'ZYX'
obj.rotation_euler = (math.radians(frameData["rotation"][0]+90), math.radians(frameData["rotation"][1]), math.radians(frameData["rotation"][2]))
obj.location = (frameData["position"][0], -frameData["position"][2], frameData["position"][1])
obj.scale = (frameData["scale"][0], frameData["scale"][1], frameData["scale"][2])

obj.keyframe_insert(data_path="rotation_euler", frame=blenderFrame+frameOffset+startFrame)
obj.keyframe_insert(data_path="location", frame=blenderFrame+frameOffset+startFrame)
obj.keyframe_insert(data_path="rotation_euler", frame=keyframePos)
obj.keyframe_insert(data_path="location", frame=keyframePos)
obj.keyframe_insert(data_path="scale", frame=keyframePos)

except:
traceback.print_exc()
Expand Down

0 comments on commit 3c66b31

Please sign in to comment.