Retrieving take data and overrides.
-
Hello,
We are using Cineware SDK, 22.0_355130, C++, to read c4d files into our application.
Now we started to read take data in hope to read multiple animations assigned to objects.File is simple - one object with two takes. Each has it's own set of animations.
We can get cineware::TakeData and can retrieve tree or BaseTake, with names. Exactly the same as in Cinema4D UI.
Now the problems:
- We can't get anything from BaseTake. All methods for all objects and all takes returns nothing: GetOverrideGroups - returns empty array. take->FindOverride () - returns NULL.
- TakeData::SetCurrentTake - doesn't work with any take. It returns true, but GetCurrentTake returns old take. I had a hope that I can just set another current take and read right animations.
- When we read this file with many takes we are getting memory leaks. Even without any data processing on our side.
Surprisingly, leaks are related to reading of OverrideData Part of the stack is below:
cineware::MemAlloc(__int64 size) Line 24 C++ cineware::DescID::operator=(const cineware::DescID & src) Line 119 C++ cineware::DescID::DescID(const cineware::DescID & src) Line 21 C++ cineware::BaseOverrideData::Read(cineware::HyperFile * hf, int id, int level) Line 145 C++ cineware::PluginNode::HandleSubChunk(cineware::HyperFile * hf, int id, int level) Line 281 C++ cineware::PrivateChunk::ReadChunk(cineware::HyperFile * hf, bool keepin, bool noheader) Line 39 C++
This is the code to extract array of takes (it works as expected):
void C4Import::EnummTakesImp(cineware::BaseTake*take) { AnimationData*ad=(AnimationData*)m_mem->AllocZ(sizeof(AnimationData)); ad->take=take; m_animations->Insert(ad); const UInt16 *out_ptr; const cineware::String&str=take->GetName(); UINT32 len=str.GetDataPtr(&out_ptr); if(len) { ad->name=(wchar_t*)m_mem->AllocZ((len+1)*sizeof(wchar_t)); memcpy(ad->name,out_ptr,len*sizeof(wchar_t)); ad->name[len]=0; } BaseTake*takeDown=take->GetDown(); while(takeDown) { EnummTakesImp(takeDown); takeDown=takeDown->GetNext(); } }; void C4Import::EnummTakes() { BaseTake*bt=m_take->GetMainTake(); if(bt) { m_animations=Array::Create(); EnummTakesImp(bt); } };
This is the code to find overrides:
BaseList2D*base=(BaseList2D*)_node->object_c4d; if(base && m_animations) { for(int i=0;i<m_animations->count;i++) { AnimationData*ad=(AnimationData*)m_animations->At(i); BaseOverride*over= ad->take->FindOverride(m_take, base); if(over) { int idbg=0; idbg++; } } }
Should I do something extra in order to enable reading of overrides? Or may be required functionality is disabled in this SDK?
Thank you in advance.
Alex -
Hi,
Takes are not supported with Cineware version 22.0_355130. May I ask you what kind of software are you developing?
Cheers,
Manuel -
Hi Manuel,
Thank you. I've been expecting this. Hope such support will be added sooner or later
Our app: finalmesh.com
Alex