Hi Saihtam,
I replaced the path and placed the coordinates into an excel file, since Maya isn't able to read the .hvo file.
I then received an error on line 3.1
------------------------------------------------------------------------------------------------------
import maya.cmds as cmds
#object in scene to apply animation to
transform = 'locator1'
#path to your file
filePath = ' C:/Users/vtran.HCE/Desktop/Convert/hve/hve_coordinates.xlsx'
#open the file in python and read it's content as lines and pass that to a list
with open(filePath) as f:
content = f.readlines()
#delete the two first lines since we're not interested in them
del content[:2]
#loop through the remaining lines and spilt each line to get out the values
for line in content:
timeVar, tx, ty, tz, rz, rx, ry = line.split()
#now set the values that we've read, I'm using float on value as it will
#error if we pass in an integer. So just making sure.
cmds.setKeyframe(transform, time=timeVar, attribute='tx', value=float(tx))
cmds.setKeyframe(transform, time=timeVar, attribute='ty', value=float(ty))
cmds.setKeyframe(transform, time=timeVar, attribute='tz', value=float(tz))
cmds.setKeyframe(transform, time=timeVar, attribute='rx', value=float(rx))
cmds.setKeyframe(transform, time=timeVar, attribute='ry', value=float(ry))
cmds.setKeyframe(transform, time=timeVar, attribute='rz', value=float(rz));
// Error: #object in scene to apply animation to
//
// Error: Line 3.1: Syntax error //
------------------------------------------------------------------------------------------------------
Here is the code I placed in:
import maya.cmds as cmds
#object in scene to apply animation to
transform = 'locator1'
#path to your file
filePath = ' C:/Users/vtran.HCE/Desktop/Convert/hve/hve_coordinates.xlsx'
#open the file in python and read it's content as lines and pass that to a list
with open(filePath) as f:
content = f.readlines()
#delete the two first lines since we're not interested in them
del content[:2]
#loop through the remaining lines and spilt each line to get out the values
for line in content:
timeVar, tx, ty, tz, rz, rx, ry = line.split()
#now set the values that we've read, I'm using float on value as it will
#error if we pass in an integer. So just making sure.
cmds.setKeyframe(transform, time=timeVar, attribute='tx', value=float(tx))
cmds.setKeyframe(transform, time=timeVar, attribute='ty', value=float(ty))
cmds.setKeyframe(transform, time=timeVar, attribute='tz', value=float(tz))
cmds.setKeyframe(transform, time=timeVar, attribute='rx', value=float(rx))
cmds.setKeyframe(transform, time=timeVar, attribute='ry', value=float(ry))
cmds.setKeyframe(transform, time=timeVar, attribute='rz', value=float(rz))
Excel file:
https://www.dropbox.com/s/tli5bwgqkatstse/hve_coordinates.xlsx?dl=0
HVO file:
https://www.dropbox.com/s/mnfjyggi823mv0x/test1.hvo?dl=0
Much thanks