Skip to content

Commit 0204570

Browse files
committed
1.2.0 (2016-07-15T13:37Z)
1 parent 2f87643 commit 0204570

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

advancedfx_import_gameRecord.py

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) advancedfx.org
22
#
33
# Last changes:
4-
# 2016-07-14 by dominik.matrixstorm.com
4+
# 2016-07-15 by dominik.matrixstorm.com
55
#
66
# First changes:
77
# 2016-07-13 by dominik.matrixstorm.com
@@ -244,6 +244,7 @@ def ReadFile(fileName):
244244

245245
dict = AgrDictionary()
246246
channelCache = ChannelCache()
247+
knownHandleToDagName = {}
247248

248249
stupidCount = 0
249250

@@ -252,6 +253,20 @@ def ReadFile(fileName):
252253

253254
if node0 is None:
254255
break
256+
257+
elif 'deleted' == node0:
258+
handle = ReadInt(file)
259+
time = ReadDouble(file)
260+
261+
dagName = knownHandleToDagName.get(handle, None)
262+
if dagName is not None:
263+
# Make removed ent invisible:
264+
sfm.UsingAnimationSet(dagName)
265+
dagAnimSet = sfm.GetCurrentAnimationSet()
266+
channelsClip = sfmUtils.GetChannelsClipForAnimSet(dagAnimSet, shot)
267+
time = time -firstTime
268+
time = vs.DmeTime_t(time) -channelsClip.timeFrame.start.GetValue()
269+
MakeKeyFrameValue(channelCache, dagAnimSet, 'visible_channel', time, False)
255270

256271
elif 'entity_state' == node0:
257272
stupidCount = stupidCount +1
@@ -273,12 +288,23 @@ def ReadFile(fileName):
273288
time = ReadDouble(file) if dict.Peekaboo(file, 'time') else None
274289
if None == firstTime:
275290
firstTime = time
276-
time = time -firstTime
291+
time = vs.DmeTime_t(time -firstTime)
277292

278293
modelName = dict.Read(file) if dict.Peekaboo(file, 'modelName') else None
279294

295+
dagName = knownHandleToDagName.get(handle, None)
296+
if dagName is not None:
297+
# Switched model, make old model invisible:
298+
sfm.UsingAnimationSet(dagName)
299+
dagAnimSet = sfm.GetCurrentAnimationSet()
300+
channelsClip = sfmUtils.GetChannelsClipForAnimSet(dagAnimSet, shot)
301+
rtime = time -channelsClip.timeFrame.start.GetValue()
302+
MakeKeyFrameValue(channelCache, dagAnimSet, 'visible_channel', rtime, False)
303+
280304
dagName = "afx/" + modelName + "/" +str(handle)
281305

306+
knownHandleToDagName[handle] = dagName
307+
282308
sfm.ClearSelection()
283309
sfm.Select(dagName+':rootTransform')
284310
dagRootTransform = sfm.FirstSelectedDag()
@@ -298,7 +324,7 @@ def ReadFile(fileName):
298324

299325
channelsClip = sfmUtils.GetChannelsClipForAnimSet(dagAnimSet, shot)
300326

301-
time = vs.DmeTime_t(time) -channelsClip.timeFrame.start.GetValue()
327+
time = time -channelsClip.timeFrame.start.GetValue()
302328

303329
visible = ReadBool(file) if dict.Peekaboo(file, 'visible') else None
304330

readme.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ Notes:
6565
In the current version keyframes will only be created when the
6666
gameModel is visible, otherwise we save some memory.
6767

68-
Currently this feature is meant only to import player models
69-
and their animations (no rag dolls etc.).
68+
Currently this feature is mainly meant to import player models.
7069
It will import some viewmodels too, however those
7170
might be missing arms or have the Error model in SFM, due to being
7271
a custom (skin) model (modelName is '?' then).
@@ -75,6 +74,11 @@ a custom (skin) model (modelName is '?' then).
7574

7675
Changelog:
7776

77+
1.2.0 (2016-07-15T13:37Z):
78+
- advancedfx_import_bvh:
79+
- Improved for AfxHookSource 1.6.0, now handles entity delete envents
80+
properly and model switching.
81+
7882
1.1.0 (2016-07-15T13:37Z):
7983
- advancedfx_import_gameRecord:
8084
- First version

0 commit comments

Comments
 (0)