On 23/02/2014 at 14:10, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 15
Platform: Windows ;
Language(s) : C++ ;
---------
Hi plugincafe-community,
I am writing a plugin that should fulfill the following task:
* Analyze the whole document and search for polygon-objects, cameras and lights
* Write some useful information that I need about the objects to a file
What I have so far:
* Command plugin with a nice GUI that has an export button
* Iterates the whole document, finds the required objects, and exports meaningful values
* Plugin computes frame times and does the analysis for each frame (and here comes the problem!)
In a test scene I have a cloth simulation, a moving camera and a deformer. When I hit "Play" in Cinema4d everything animates just fine. When i hit the "Pause" button, I can run my plugin and everything works just great. All deformations of the mesh (vertex positions, normals,...) all camera settings (positions, orientation, fov,...) are in the correct state.
But I want to do the simulation/animation from my plugin. So my plugin should step to the next frame and get a valid state of the whole document. Then it should export all required data as before.
I use the following code to simulate/animate the document from code:
BaseObject* pObject = m_pDocument->GetFirstObject();
while( pObject != nullptr )
{
m_pDocument->SetTime( BaseTime( time ) );
m_pDocument->AnimateObject( pObject, BaseTime( time ), ANIMATEFLAGS::ANIMATEFLAGS_0);
pObject = Utility::crawlScene( pObject );
}
time... computed value for the current time of a frame
Utility::crawlScene... function that returns the next child or sibling or nullptr
The strange thing is that the field of view of my camera is animated just fine as well as the position changes of a light source. But my camera matrix (Mg), the changes caused by a deformer and a simple cloth-simulation are ignored.
Maybe I am using the wrong plugin type? My goal is to write some sort of exporter for Cinema4d and therefore I need the valid states for each frame.
I could guess that the physics is a problem, because I have to simulate this separately. But where is the problem with the deformers and the simple matrix (Mg) of my camera?
Thanks for your help!