THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/11/2011 at 05:46, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Hi nux95, thank you so much for taking your time to do this.
I've created a python tag
The code is not usuable for a Pythontag. A Pythontag is executed every frame, etc. You don't want this to be executed while your working in c4d, do you ?
Copy it into the script manager.
Also, op is the tag itself in the Python tag. In the script manager, op is the selected object.
The reason why you don't see any output is, because the Python tag does not have animated tracks etc.
Originally posted by xxxxxxxx
How would I go about printing them in a txt file, in the format frame#, x, y, z? (sorry, übernoob here)
That's basic Python, actually. If you want to do more with Python, you should start reading the Python tutorial in the official documentation.
Just an example:
fl = open(r"C:\Users\MyName\Desktop\myFile.txt.", "w")
fl.write("ASCII KEYFRAME EXPORTER\n")
for i in xrange(keysCount) : # make `i` go from 0 - keysCount
fl.write( str(i) + " " ) # write the framenumber and a whitespace
keyx, keyy, keyz = keys[0][i], keys[1][i], keys[2][i]
fl.write( str(keyx.GetValue()) + " ") # write the x-value and whitespace
fl.write( str(keyy.GetValue()) + " ") # write the y-value and whitespace
fl.write( str(keyz.GetValue()) + "\n") # write the z-value for key `i`
# and a new line
fl.close()
Note that this code is not usuable for your need ^^
Originally posted by xxxxxxxx
ps: there is an ascii exporter but as far as i know only for the 3D point structure (found on the structure tab), but maybe I'm wrong
Ah, you're right, yes.
Are you aware that you also need to parse the file again when you want to import it in cinema 4d ?
Writing complex data to files and parsing it again is a very much harder job than it may appear to you and actually needs some knowledge in how data is stored using 8 bit characters and knowledge in programming.