Import multiple Takes
-
Hi, we need to import multiple Takes in independant animations. We were working with GLTF but it seems it support only one take, so we have added full support for direct C4D import with Cineware but we are unable to import multiple take. We import the name of all takes but it seems all the take play the same things ! Is it possible to import multiple takes ? At this time the only option for our customer is to use blender that support out of the box multiple animation for real time animation of characters in a real time application.
Best regards
-
Hello @yannickkohn,
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
It is quite hard to answer your question in this form, please read the points listed above. From what I get, you have some C++ application and use there the Cineware SDK to import c4d files. You now want to read take data in these scenes. First of all, I would recommend to read the end user docs on takes, in case you have not already.
Takes are somewhat comparable to render settings in Cinema 4D, as in that you always have at least one of them in a scene, but also can have many (which also can be nested). Just likes for render settings, there can only be one active take at a time. So unless you have called SetCurrentTake, the data of your scene will not change.
Cineware is also a sparse/discrete data format, i.e., all procedural goodness of Cinema 4D has been baked down. Without knowing what take data you want to see being exported, it is hard to tell if what you are experiencing is working as intended or not. Please share your code and images or files of the scene you are trying to export, including examples/descriptions of what data is missing.
Cheers,
Ferdinand -
Hi Ferdinand,
thanks for your message. We need to import 3D scene with animation (for example a car with the wheel rotating and moving along a path) and/or skinned animation (for example a skinned animated human with bones). We want to be able to import from the C4D several independant animation (for example Three different path for the car) that we can recall independently. Or for example for a human I want to import the IDLE, Walk and running animation. For this the user will create three takes with each one an animation, one take for the IDLE, one for the walk and one the running. In my software I need to be able to import the 3 different animations IDLE,WALK,RUNNING.
Best regards
Yannnick
-
Hey Yannick, as I said without code and your scene data we will not be able to help you. In understand what you want to do conceptually, but for concrete help we will need concrete code and concrete data. As I hinted at, not all aspects of takes can be faithfully exported into the Melange (a.k.a.) Cineware format. The Take export has be initially written for the Adobe After Effects bindings, so there might be gaps even when data could be discretized in principle.
-
Herer is a pseudo code
doc = LoadDocument("file.c4d"); doc->CreateSceneFromC4D(); takeData = doc->GetTakeData(); prevTake = takeData ? takeData->GetCurrentTake() : null; prevTime = doc->GetTime(); takes = collectAllTakesRecursively(takeData->GetMainTake()); for each take in takes: takeData->SetCurrentTake(take); isMain = (take == takeData->GetMainTake()); useEvaluatedValues = !isMain; for each object in doc: overrideKeys = {}; if (override = take->FindOverride(takeData, object)): // override tracks (animated overrides) for each ctrack in override->GetFirstCTrack(): addTrack(ctrack, isOverride=true); overrideKeys.insert(trackKey(ctrack)); // override params (constant overrides) for each descId in override->GetNodeData()->GetAllOverrideDescID(): overrideKeys.insert(trackKey(descId)); markPropertyAsAnimated(descId); // create channel even if no curve // main tracks (skip those overridden) if (!overrideOnly): for each ctrack in object->GetFirstCTrack(): if (!overrideKeys.contains(trackKey(ctrack))): addTrack(ctrack, isOverride=false); // Build one animation for this take // For non-main takes, sample evaluated values to capture final override result for each animated property (pos/rot/scale, joints too): times = keyTimesFromCurves(); if (useEvaluatedValues) times = [docMinTime..docMaxTime] @ fps; for t in times: doc->SetTime(t); doc->Execute(); value = object->GetParameter(propertyId); writeKey(t, value); takeData->SetCurrentTake(prevTake); doc->SetTime(prevTime); doc->Execute();We import each C4D take as a separate animation by iterating TakeData (main + child takes). For each take we call SetCurrentTake(take) and then collect animation data from:
- override tracks (BaseOverride::GetFirstCTrack()), and
- override parameters (BaseOverrideData::GetAllOverrideDescID()), so constant overrides are not missed.
We also read the base tracks (BaseObject::GetFirstCTrack()) but skip any channel that is overridden in the current take.
For non‑main takes we sample evaluated values (doc->SetTime(t); doc->Execute(); GetParameter()) over the document time range, because takes can change the final evaluated state even without explicit tracks.
This gives one animation per take (e.g., Idle/Walk/Run). Joint objects (Ojoint/Obone) are handled the same way as regular objects, so skinning animation is captured via joint transforms.
-
Hey @yannickkohn,
Thank you for the source code, but pseudo code is often problematic, especially when it contains so many undefined functions. I cannot say much about any bugs, as your code is so 'pseudo' and you do not show the really deep down work (reading curves and keys here).
What also is a bit weird is that you use
FindOverride. That function is private for a reason. You should set the active take and then just evaluate the scene data or the tracks of scene data when you are interested in animations only.Cheers,
Ferdinand