How to import/extract Point Level Animation (PLA) from a .c4d file with Cineware SDK in C++?
-
Hi, I am working with the Cineware SDK in C++. I am trying to import Point Level Animation (PLA) from a .c4d file. My goal is to sample vertex positions for each frame.
I use SetTime() on the document and then read the vertex positions from the PolygonObject with GetPointR(). However, I always get the same (static) vertex positions for every frame, even though the .c4d file definitely contains PLA (I have verified this in Cinema 4D, and the animation works there).
To double-check, I also wrote a Python script, which I ran in the Script Manager inside Cinema 4D. This script correctly reads different vertex positions for each frame, so I am confident that the .c4d file is set up correctly and that the animation is present.
I noticed that in the Cineware SDK, there is no function equivalent to ExecutePasses() (which exists in the full Cinema 4D SDK and Python). According to the documentation, SetTime() should be enough to update all animated data, including PLA, but in my case it does not update the mesh.
Is there any way to force the evaluation of PLA in Cineware C++? Am I missing a crucial step, or is this a known limitation of Cineware?
I am using the officially available public version of the Cineware SDK from your website: RBCinewareSDK22.0_355130.
If there is a newer version of the Cineware SDK available (even if it is not publicly released) that might resolve this issue and could be made available under special terms or a separate license, I would be very interested in learning about such an option.
-
Hello @lblach,
Welcome to the Maxon developers forum and its community, it is great to have you with us!
Getting Started
Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules.
- Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
- Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
- Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.
It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: How to Ask Questions.
About your First Question
The answer Ilia gave you via mail is correct - but could have been a bit more verbose beyond the purely technical.
Ilias answer:
Regarding your question, the short answer is that in Cineware SDK you cannot execute or animate anything to get calculated.
However, the long answer is that it's still might be kind of possible. If you're interested in PLA animation, you can potentially access the PLA data in the PLA keys (as they are just static snapshots of the mesh vertices). The general idea would be to retrieve the PLAData from the the CKey (one usually accesses it via chain: CTrack -> CCurve -> CTrack), approximately (this is a rough imaginary and not checked code snippet!):
GeData d; CheckState(key->GetParameter(ConstDescID(DescLevel(CK_PLA_DATA, CUSTOMDATATYPE_PLA, 0)), d, DESCFLAGS_GET::NONE)); PLAData* pla = data.GetCustomDataType<PLAData>(); CheckState(pla); VariableTag* ptag = nullptr; VariableTag* htag = nullptr; pla->GetVariableTags(ptag, htag); // etc...
Cineware (Melanage) is an SDK which allows you to read discrete data from a Cinema 4D file. Anything non-discrete, i.e., which must be calculated, is not supported. There is no
BaseDocument::ExecutePasses
, because for that to work, the Cineware SDK would have to be able to replicate everything what Cinema 4D can do, i.e., the Cineware SDK would have to ship the full source code of Cinema 4D and we would have to update it with each version.Ilias workaround, that you try to pry out the raw
VariableTag
s data wont work exactly like this, because there is noVariableTag
in the public Cineware, but you can try to do that with the more explicit interfacesPointTag
andTangentTag
which are exposed. But in general this should work. You just cannot just animate the document, and then expect your mesh to update.Cheers,
Ferdinand -
This post is deleted! -
Thank you very much @ferdinand for your suggestions—I really appreciate your input and support. I will definitely experiment with your leads and see what works best for me. It’s always helpful to get an outside perspective, and your advice has given me some new things to think about. Thanks again!