Save Polygons for Melange (AlienPolygonObjectData)

On 27/01/2015 at 19:19, xxxxxxxx wrote:

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


I'm currently implementing an importer for C4D files into my application that supports animation. The problem I'm currently facing, is that I can't get animation data for objects like primitives.

The thing is... my application doesn't support the original Cinema primitives, so I return false in functions like AlienPrimitiveObjectData::Execute, so I can get a call to AlienPolygonObjectData::Execute. I see my object's keyframes in AlienPrimitiveObjectData::Execute but not in AlienPolygonObjectData::Execute, so I got an idea: 
why not reading the animation data in AlienPrimitiveObjectData::Execute, then return false there, and wait for the AlienPolygonObjectData::Execute to apply those keyframes to my polygon object?

The problem with this, is that I have no way of relating the object from AlienPrimitiveObjectData::Execute to the object from AlienPolygonObjectData::Execute.

Is there some kind of unique id I can look at? Is this even possible, this way, or any other?

On 28/01/2015 at 08:47, xxxxxxxx wrote:


the object handled in AlienPolygonObjectData is the same object as returned by GetCache() (if that object is a polygon object). So you could get the polygon data in AlienPrimitiveObjectData by accessing the object's cache.

If the polygon object is the only object in the cache you can use GetUp() on the BaseObject in AlienPolygonObjectData to get the generator object and it's tracks and keys.

Best wishes,

On 28/01/2015 at 09:18, xxxxxxxx wrote:

Thanks for the reply, I can rely on the first option, GetCache() to retrieve the cached object, check if it's a Polygon and if so, treat it as an object that came within the AlienPolygonObjectData::Execute.

I have a question regarding the second option though, what do you mean by "the only object" in cache? So you mean if the scene has only one object total? Or does it has anything to do with hierarchy?

On 28/01/2015 at 09:30, xxxxxxxx wrote:

Originally posted by xxxxxxxx

If the polygon object is the only object in the cache you can use GetUp() on the BaseObject in AlienPolygonObjectData to get the generator object and it's tracks and keys.

Sebastian, is that really true? Because inside of Cinema 4D, you would need to use GetCacheParent(),
not GetUp(), to get the generator of a cache object.

On 29/01/2015 at 00:56, xxxxxxxx wrote:


the cache of a generator can be just a simple polygon object or a list of objects or a complex hierarchy of objects. In the latter case you would have to check the parent object of the parent object for example.

In Melange, GetCacheParent() does not exist.

best wishes,

On 30/01/2015 at 10:58, xxxxxxxx wrote:

Cool thanks, I actually came across one of those cases with the MoText, where both character caps are separate polygons thus multiple caches. The recursive code in the link really helped.

On 24/06/2015 at 10:02, xxxxxxxx wrote:

I just got a new issue on the same matter.
What if I have an animated PolygonObject, and I move it into an animated symmetry object? I can get the animation from the symmetry, and using the recursive method I can go through all cached objects inside the symmetry. The problem is, that cached objects have no tracks which means no animations.

I don't receive any call to AlienPolygonObjectData::Execute() either, so I don't know where to get the animation from.

On 25/06/2015 at 08:21, xxxxxxxx wrote:

Actually, the cached objects from a symmetry primitive, are not even isolated, if I have a cube inside a symmetry primitive, 2 cubes show up in the render, but they are actually the same object, which means I cannot animate them the way it's supposed to.

So if I don't support primitives natively in my application (like symmetry), I guess there's no way to load animated objects that are inside these types of primitives... I'm I right?