THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/11/2008 at 11:08, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R10+
Platform: Windows ;
Language(s) : C++ ;
---------
I'm implementing a sequenced .obj file export in my Riptide Pro plugin and just got the basic/framework implementation working last night. Here is a code-snippet:
------ S N I P -----
//----------------------------------------------------------------
// Next, we're going to need a path to save the files to...
//----------------------------------------------------------------
String tStr = String("Select Export Path");
if( !m_rootPath.FileSelect(FSTYPE_ANYTHING,GE_DIRECTORY,&tStr) )
return;
EventAdd();
//----------------------------------------------------------------
// ok, now we need to:
// - loop through the frames
// --- animate the document
// --- polygonize it for that frame
// --- export a file
// --- free the polygonized doc
//----------------------------------------------------------------
LONG i;
LONG startf = m_XpOpts.XpStartFrame();
LONG endf = m_XpOpts.XpEndFrame();
LONG fps = m_XpOpts.XpFps();
BaseDocument *pRealDoc = GetActiveDocument();
if( !pRealDoc ) break;
m_fileSeq = m_XpOpts.XpSequenceStart();
for(i=startf; i<endf; i++)
{
//----------------------------------------------------------------
// animate the document to the next frame
//----------------------------------------------------------------
BaseTime stime = BaseTime::BaseTime(i, fps);
pRealDoc->SetTime(stime);
pRealDoc->AnimateDocument(NULL, **TRUE** , **TRUE** );
EventAdd();
//----------------------------------------------------------------
// polygonize the document, keeping animations
//----------------------------------------------------------------
m_baseDoc = pRealDoc->Polygonize( **true** );
if( !m_baseDoc ) break;
if( !PrepFileName() ) break;
if( !BeginOBJFile() ) break;
//----------------------------------------------------------------
// get element count for progress bar updates
//----------------------------------------------------------------
m_elements = 0;
CountSceneElements(m_baseDoc->GetFirstObject(), true, 0);
//----------------------------------------------------------------
// Call the tree-walker routine to get the export underway...
//----------------------------------------------------------------
m_rootPath.CopyTo(&fPath);
WriteObjects(m_baseDoc->GetFirstObject(),Matrix(), true, 0, NULL, NULL, fPath);
//----------------------------------------------------------------
// clean up and prep for next frame
//----------------------------------------------------------------
EndOBJFile();
BaseDocument::Free(m_baseDoc); m_baseDoc = NULL;
m_fileSeq++;
}
------ S N I P -----
...ok, so far, so good - the document animates as intended and files are saved out fine...
Exception: Expressions are not being evaluated.
I have a sample scene that has an Xresso tag that drives the position of one of the objects and while the Bend deformer in the scene is working fine (animating and affecting the mesh), the Xpresso expression is not being evaluated like it does if I just scrub the timeline by hand or hit play.
Any ideas? Is this an issue wth doc->Polygonize(true) ? Or an issue with doc->AnimateDocument(NULL, true, true) ?
Thanks,
Keith