THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/02/2006 at 10:42, xxxxxxxx wrote:
1. Looks like you'll want to create a set of primitive objects (scaled cylinders and cubes). Either way, something like this is best animated as a set of objects in hierarchy rather than a single object (which would require bones and some form of weighting).
2. Opening and reading the data is rather simple. You can use simple C fileIO functions (fopen, fread, fscanf) to read the data:
Real Px,Py,Pz,Rx,Ry,Rz;
LONG frame = 0;
File* fp;
char buffer[BUFFER_SIZE];
char oname[64];
char* filename = "C:\MyFolder\data.txt";
if (!(fp = fopen(filename, "r"))) handleError();
while (fReadLine(fp, &buffer;[0]))
{
sscanf(&buffer;[0], "%s %f %f %f %f %f %f", &oname;[0], &Px;, &Py;, &Pz;, &Rx;, &Ry;, &Rz;);
// Call function to create tracks/seqs/keys on object for data
frame++;
}
The problem here is how you intend to organize the data in the file. Since the data affects a set of objects, you must somehow specify which object is being modified by the pos/rot data at each frame. Maybe add a string identifier that matches the created object's name so that you can find it in the document.
Creating Tracks/Sequences/Keys is a little tricky. There is code for doing this in the plugins/cinema4dsdk folder. For something like this, a hierarchical animation, you may want to concatenate matrices (MatrixMove(), MatrixRotX(), MatrixRotY(), and MatrixRotZ()) and apply to the object (obj->SetMg(m) or obj->SetMl(m)), then use obj->GetPos() and obj->GetRot() to set the key values. Shouldn't need to advance to the frame since any object matrix settings should be nullified by the keyframes.
Rendering in C++ should be possible using RenderDocument(). You'll need to set up a RenderData structure which contains all of the render settings, such as file format and so on. Hopefully someone with experience in this can help as I have not used this before.