Copy Overrides to other objects

On 11/08/2017 at 02:38, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   18 
Platform:   Windows  ;   
Language(s) :     C++  ;

Hi there,

I'm trying to copy some Overrides to another object (they are not of the same type, but base properties are still the same, as they derive from Obase)

The following code actually works to some extent, but not for all takes.

I'm pretty sure that I made a mistake here. Also, I don't fully understand the sub-takes yet. Just started  with them. :)

Here's some example code:

    inline void TransferTakeOverrides(BaseObject* srcObj, BaseObject* tgtObj, BaseDocument* doc)
        // Get doc's take data
        TakeData* takeData = doc->GetTakeData();
        if (!takeData)
        // Get main take to start from
        BaseTake* currentTake = takeData->GetMainTake();
        // Set main take active as we need the parameters in "backup state"
        // TODO: Disable Auto-Take / Set Mode to manual
        // Iterate over all other takes
        while (currentTake)
            // skip main take
	    // ...
            // Check all overrides for object in current take
            BaseOverride* srcOverride = currentTake->FindOverride(takeData, srcObj);
            while (srcOverride)
                maxon::BaseArray<DescID> srcDescIDs;
                for (auto descID : srcDescIDs)
                    GeData overrideValue;
                    srcOverride->GetParameter(descID, overrideValue, DESCFLAGS_GET_0);
                    BaseOverride* tgtOverride = currentTake->FindOrAddOverrideParam(takeData, tgtObj, descID, overrideValue);
                    tgtOverride->UpdateSceneNode(takeData, descID);
                 srcOverride = static_cast<BaseOverride*>(GetNextNode(static_cast<GeListNode*>(srcOverride)));
             currentTake = static_cast<BaseTake*>(GetNextNode(static_cast<GeListNode*>(currentTake)));

On 13/08/2017 at 11:39, xxxxxxxx wrote:

Probably can answer this myself.

I simply retrieved the "Backup"-value via FindOverrideCounterPart() and provided this as the backupValue Parameter to FindOrAddOverrideParam().

However, I'm pretty sure there's a more elegant way?

On 18/08/2017 at 00:46, xxxxxxxx wrote:

Sorry for bumping this thread, but I would be very thankful for some feedback, if this is the right way. :)

On 18/08/2017 at 09:15, xxxxxxxx wrote:


I'm terribly sorry, when you said, you could answer it yourself, I thought you had a working solution and considered the thread more or less done.

In general it works the way you describe, not sure you would want to skip the Main Take (as the comment in your code suggests), but that's probably a question of the desired final result.

If there's a more elegant way to achieve the same result, to be honest I don't know, yet. I will discuss it on Monday with the rest of the team.

One more note: As BaseOverride and BaseTake are both derived from GeListNode, there's no need for the cast, when passing them to your GetNextNode() as parameters. Might make the code a bit more readable without.

On 18/08/2017 at 10:30, xxxxxxxx wrote:

Thanks Andreas, looking forward to your findings.

The cast in the end was from a temporary code. I now use a generic "walker". So, no need to adress it. :)

On 21/08/2017 at 10:50, xxxxxxxx wrote:


we discussed the question this morning, but we didn't come up with a more elegant solution.

So I will just add the link to the Take System Overview page, I had forgotten so far. Don't miss the manual child pages!

On 22/08/2017 at 05:20, xxxxxxxx wrote:

Yay, thanks! :)