Skip to content

Commit 4d64c5f

Browse files
committed
v1.7.2 (2022-07-03T13:03Z)
1 parent 5b8ab14 commit 4d64c5f

File tree

2 files changed

+43
-7
lines changed

2 files changed

+43
-7
lines changed

advancedfx_import_gameRecord.py

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,19 @@ def ReadQuaternion(file):
192192
z = 0
193193

194194
return vs.Quaternion(x,y,z,w)
195+
196+
def ReadMatrix3x4(file):
197+
mat = vs.mathlib.matrix3x4_t()
198+
for i in range(3):
199+
for j in range(4):
200+
val = ReadFloat(file)
201+
if val is None:
202+
return None
203+
if math.isinf(val):
204+
val = 0
205+
mat[i*4+j] = val
206+
207+
return mat
195208

196209
def ReadAgrVersion(file):
197210
buf = file.read(14)
@@ -287,7 +300,7 @@ def ReadFile(fileName):
287300
SetError('Invalid file format.')
288301
return False
289302

290-
if 5 != version:
303+
if(5 != version and 6 != version):
291304
SetError('Version '+str(version)+' is not supported!')
292305
return False
293306

@@ -381,8 +394,17 @@ def ReadFile(fileName):
381394

382395
visible = ReadBool(file)
383396

384-
renderOrigin = ReadVector(file)
385-
renderAngles = ReadQAngle(file)
397+
renderOrigin = vs.Vector(0,0,0)
398+
renderRotation = vs.Quaternion(0,0,0,1)
399+
400+
if version == 6:
401+
matrix3x4 = ReadMatrix3x4(file)
402+
vs.mathlib.MatrixPosition(matrix3x4,renderOrigin)
403+
vs.mathlib.MatrixQuaternion(matrix3x4,renderRotation)
404+
else:
405+
renderOrigin = ReadVector(file)
406+
renderAngles = ReadQAngle(file)
407+
renderRotation = QuaternionFromQAngle(renderAngles)
386408

387409
modelHandle = handleToLastModelHandle.get(handle, None)
388410

@@ -441,7 +463,7 @@ def ReadFile(fileName):
441463

442464
MakeKeyFrameValue(channelCache, dagAnimSet, 'visible_channel', timeConverter.GetTime(sfmUtils.GetChannelsClipForAnimSet(dagAnimSet, shot)), visible)
443465

444-
MakeKeyFrameTransform(channelCache, dagAnimSet, "rootTransform", timeConverter.GetTime(sfmUtils.GetChannelsClipForAnimSet(dagAnimSet, shot)), renderOrigin, QuaternionFromQAngle(renderAngles), True)
466+
MakeKeyFrameTransform(channelCache, dagAnimSet, "rootTransform", timeConverter.GetTime(sfmUtils.GetChannelsClipForAnimSet(dagAnimSet, shot)), renderOrigin, renderRotation, True)
445467

446468
if dict.Peekaboo(file,'baseanimating'):
447469
#skin = ReadInt(file)
@@ -456,8 +478,15 @@ def ReadFile(fileName):
456478
numBones = ReadInt(file)
457479

458480
for i in xrange(numBones):
459-
vec = ReadVector(file)
460-
quat = ReadQuaternion(file)
481+
vec = vs.Vector(0,0,0)
482+
quat = vs.Quaternion(0,0,0,1)
483+
if version == 6:
484+
matrix3x4 = ReadMatrix3x4(file)
485+
vs.mathlib.MatrixPosition(matrix3x4,vec)
486+
vs.mathlib.MatrixQuaternion(matrix3x4,quat)
487+
else:
488+
vec = ReadVector(file)
489+
quat = ReadQuaternion(file)
461490

462491
if dagModel is None:
463492
continue

readme.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,14 @@ a custom (skin) model (modelName is '?' then).
7474

7575
Changelog:
7676

77-
1.7.1 (2020-12-14T18:18T):
77+
1.7.2 (2022-07-03T13:03Z):
78+
- advancedfx_import_gameRecord:
79+
- Updated to support AGR version 6.
80+
Please note: AGR version 6 can express more than SFM in terms of matrices for models and model bones,
81+
if the matrices can not be converted to vector position + quaternion rotation, then there will be
82+
problems. E.g. mirrored (view) models would be a problem.
83+
84+
1.7.1 (2020-12-14T18:18Z):
7885
- advancedfx_import_gameRecord:
7986
- Fixed error in script that could cause import to fail in some conditions.
8087

0 commit comments

Comments
 (0)