Get render modes for cached polygons

On 31/12/2015 at 04:55, xxxxxxxx wrote:

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


I have an array with a cube as a child and i use the cache recursion:
 to access the cached polygons.

The problem is that i need the render mode of the produced cached objects.
For the array, which has a null as cached object, i simply use GetRenderMode of the cache parent.
But for the polygons produced by the cube control object, the GetRenderMode returns the same as the array, instead of the actual control object.

So my question is: How do i get the correct Render mode of the produced cached objects ?

Thank you.

On 04/01/2016 at 04:58, xxxxxxxx wrote:


can you elaborate a bit more, why you are looking for the Render Mode of caches?
In general it should work, just like with every other object. If Render mode is set to default, you will need to consider the Render Mode of parent objects as well.
A piece of code could help to understand your problem better as well.

On 04/01/2016 at 05:24, xxxxxxxx wrote:

Hello dear Andreas.

Here is how i get the top cached parent:

BaseObject* parent = cached_object;
parent = parent->GetCacheParent();

and here is how i get the render mode:

LONG render_mode = parent->GetRenderMode();

Consider an array with a cube as a child and 2 as count.
Now, if you use the GetCache recursion code to retrieve the array's cache,
you will get a Null object with 4 children. One of them will be the cube control object :


The other 3 objects will be the ones produced by the array. Lets call them A , B and C.

Now, in C4D's object hierarchy, I set the render mode of the cube child to off.
What render mode should A, B and C have ? (they have the same as array instead of the control object)

Thank you.

On 04/01/2016 at 05:36, xxxxxxxx wrote:


do you know the Active Object Dialog (gui/activeobject.cpp) from the cinema4dsdk examples?
This can be a very nice tool in situations like yours, since it can visualize the cache structure.
I strongly suggest to have a look at it.
When I use it here, with your array/cube scenario, I see that the cloned cubes have the same Render Mode as the input cube. Their caches have default Render Mode and thus inherit from their cloned parent. That's about what I would expect as well.
Always remember, if Render Mode is set to default, you need to check the parents (until one has set a definitive value, like on or off) in order to determine the actual value.

On 10/01/2016 at 13:37, xxxxxxxx wrote:

there are 2 solutions "1 is ugly, 1 is smarter "
ugly 1:

	object = object->GetCacheParent();
else if (object->GetUp())
	object = object->GetUp();

the smarter solution:
pass render state of the current object "that you have the cache from when you do cache recursion" to child.