Last active
December 19, 2015 02:09
-
-
Save EricTRocks/5881244 to your computer and use it in GitHub Desktop.
getting softimage key frame time/value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import win32com.client | |
from win32com.client import constants | |
from win32com.client import Dispatch as disp | |
from xml.etree import ElementTree as ET | |
from xml.etree.ElementTree import tostring | |
import base64 | |
import traceback | |
#-------------------------- Import Python base modules. | |
import time | |
import os | |
import random | |
import shutil | |
import sys | |
import string | |
import math | |
import pickle | |
import copy | |
import errno | |
import re | |
#-------------------------- Python si initial setup. | |
null = None | |
false = 0 | |
true = 1 | |
si = Application | |
oRoot = si.ActiveSceneRoot | |
log = si.LogMessage | |
oSel = si.Selection | |
oSel2 = si.GetValue("selectionlist") | |
oPass = si.ActiveProject.ActiveScene.ActivePass | |
oPassCam = oPass.Camera.Name | |
oScn = si.ActiveProject.ActiveScene | |
oProjPath = si.ActiveProject | |
CF = si.GetValue("PlayControl.Current") | |
FF = si.GetValue("PlayControl.In") | |
LF = si.GetValue("PlayControl.Out") | |
intCF = (int(CF)) | |
timelineFrameRange = int(LF - FF + 1) | |
#-------------------------- | |
# camPosX = si.Dictionary.GetObject(oSel2[0].Name + ".kine.global.posx") | |
# camPosY = si.Dictionary.GetObject(oSel2[0].Name + ".kine.global.posy") | |
# camPosZ = si.Dictionary.GetObject(oSel2[0].Name + ".kine.global.posz") | |
# camRotX = si.Dictionary.GetObject(oSel2[0].Name + ".kine.global.rotx") | |
# camRotY = si.Dictionary.GetObject(oSel2[0].Name + ".kine.global.roty") | |
# camRotZ = si.Dictionary.GetObject(oSel2[0].Name + ".kine.global.rotz") | |
# log("camPosX: " + str(camPosX.Value)) | |
# log("camPosY: " + str(camPosY.Value)) | |
# log("camPosZ: " + str(camPosZ.Value)) | |
# log("camRotX: " + str(camRotX.Value)) | |
# log("camRotY: " + str(camRotY.Value)) | |
# log("camRotZ: " + str(camRotZ.Value)) | |
# camPosXFCurve = camPosX.GetKeysBetween() | |
# log(camPosXFCurve) | |
def getKeys(): | |
initSel = disp("XSI.Collection") | |
initSel.SetAsText(oSel.GetAsText()) | |
for eachItem in initSel: | |
posx = eachItem.Kinematics.Local.Parameters("PosX") | |
posy = eachItem.Kinematics.Local.Parameters("PosY") | |
posz = eachItem.Kinematics.Local.Parameters("PosZ") | |
rotx = eachItem.Kinematics.Local.Parameters("RotX") | |
roty = eachItem.Kinematics.Local.Parameters("RotY") | |
rotz = eachItem.Kinematics.Local.Parameters("RotZ") | |
cacheParams = [posx, posy, posz, rotx, roty, rotz] | |
for eachParam in cacheParams: | |
fcurve = disp(eachParam.Source) | |
if not fcurve: | |
log("no fcurve found for " + eachParam.FullName, 4) | |
return False | |
log("\n" + eachParam.FullName) | |
keys = fcurve.GetKeysBetween() | |
for eachKey in keys: | |
time = eachKey.Time | |
value = eachKey.Value | |
log("time: " + str(time) + ", value: " + str(value)) | |
getKeys() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment