PDA

View Full Version : Saving object locations?


Dogfish
09-26-2008, 11:35 PM
Short question:

Is there a way to reset the "home" position of an object from Cscript, so that it stays there when the scene ends? e.g. the "mesh" alteration does this, but this doesn't seem to be callable from cscript, or at least there's no documentation about how to do this. If there isn't a way, could we pleeease have one??

More detail, in case you're interested:

I'm creating some objects procedurally using Cscript by analyzing a (complex) scene, as follows:


// create synapse sphere of radius 1.0 at location Sloc
ec_VarUnion Value;
Value.m_fFloat=1.0f;
pSynapse = ec_AddObjectToScene(EC_OBJECTTYPE_SPHERE,"Synapse");
ec_SetObjectVarByDesc(pSynapse,"Radius",EC_VARTYP_FLOAT,Value.GetPointer());
ec_SetObjectLocation(pSynapse, Sloc.GetPointer(), EC_ANISYS_OCS);
ec_CreateObject(pSynapse);

This draws a sphere of the required radius at the required location. I want to save the scene with the synapse object in this location. There will be hundreds of them in the scene and it takes a few seconds to compute the location of each one, because I am searching over vertices of complicated meshes to identify synapse locations. But EC moves each synapse object back to the origin when the scene ends.



Mike.

RadishArtist
09-27-2008, 10:49 AM
No, sorry, currently all positioning functions act like animations and are reset on scene end. The ability to permenently transform an object or collapse the transform matrix in its current position through the api has been on the wish list for some time though.

Probably the best you could do for the time being is to save out the locations into a text file or database and load them back in at scene begin using the get and set location functions.

Sue

Dogfish
09-27-2008, 01:33 PM
OK I'll do the workaround & hope that resetting object transforms moves up the to-do list at EC. This facility would be very useful to be able to create objects procedurally by analysing 3D images. I'm lining up a couple of projects using micro-CT scans and MRI ... lots of potential for bio-medical applications if we can do this.

RadishArtist
10-26-2008, 10:38 AM
Hi Mike,

This has been implemented in the next build:

"All the API transformation functions location, rotation, scale, etc. now have a EC_XFORM_MODE_HOME or EC_XFORM_MODE_ANIM mode"

:)