import sfmUtils
log = open(r"D:\sfm_channels.txt", "w")
def w(s):
log.write(str(s) + "\n")
log.flush()
anim = sfm.GetCurrentAnimationSet()
w("animset: %s" % anim)
clip = None
try:
clip = sfmUtils.GetChannelsClipForAnimSet(anim)
w("channels clip (1 arg): %s" % clip)
except Exception, e:
w("GetChannelsClipForAnimSet(anim) error: %s" % e)
try:
clip = sfmUtils.GetChannelsClipForAnimSet(anim, sfm.GetCurrentShot())
w("channels clip (2 args): %s" % clip)
except Exception, e2:
w("GetChannelsClipForAnimSet(anim, shot) error: %s" % e2)
if clip:
w("dir(clip): %s" % repr(dir(clip)))
try:
chans = clip.channels
w("channel count: %s" % len(chans))
shown = 0
for ch in chans:
nm = str(ch.name)
if "rootTransform" in nm or "position" in nm.lower():
w("channel: %s" % nm)
try:
lg = ch.log
w(" dir(log): %s" % repr(dir(lg)))
w(" layers: %s" % lg.GetNumLayers())
lay = lg.GetLayer(0)
w(" dir(layer): %s" % repr(dir(lay)))
w(" key count: %s" % lay.GetKeyCount())
except Exception, e3:
w(" log error: %s" % e3)
shown += 1
if shown >= 3:
break
except Exception, e4:
w("channels error: %s" % e4)
log.close()
print "channels done"