RayObject and mograph clones [SOLVED]

On 14/05/2015 at 07:04, xxxxxxxx wrote:

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

I want to create a shader, that can access any data the user want from mograph clones.
what I know -> I can get everything that I want from MoData class.
what I don't know -> if I have a RayObject, how to know that it is generated from mograph (other types also are important, like particles, thinking particles, other plugin particles "Effex, TFD, XParticles, ...")?? and its index??

On 15/05/2015 at 08:33, xxxxxxxx wrote:


as discussed earlier a RayObject links to the geometry it represents. This geometry may be in the cache of a generator. To get this cache parent use GetCacheParent(). You find some discussion on this in some older threads.

SDK support cannot help you with any questions regarding other third party plugins. You have to get in contact with the developers of these plugins to get proper information.

Best wishes,

On 15/05/2015 at 09:39, xxxxxxxx wrote:

Hi Sebastian,

I know that was discussed earlier in one of my threads, but I got a little of confusion, which to choose and where: "the link for a good snippet is here also, https://developers.maxon.net/docs/Cinema4DCPPSDK/html/class_base_object.html#aceb4039aaf9b2235d1f43f1e060a4d6d"
and here "https://developers.maxon.net/docs/Cinema4DCPPSDK/html/class_base_object.html#a6b249a119e991c6199a9d2deccfd0078"

1- GetCacheParent()
2- GetCache()
3- GetDeformCache()

let's consider a complex hierarchy where you have a cloner object, with lots of children, with deformers, cache tags/dynamic tags.

what I understand:
RayObject is the final state that I want for raytracing.

what I need:
extra data from objects that may affect cache "like cloner object, deformer, tag, ...".

from previous thread "sorry for not searching for it earlier, it got a good info about index of mograph generated clones"

                        BaseObject \* cacheParent = rayObject->link->GetCacheParent();  
                          BaseContainer \* bc = cacheParent->GetDataInstance();  
                          const Int32 index = bc->GetInt32(BC_ID_MODATAINDEX,NOTOK);  
                          if(index != NOTOK)  
                              GePrint("index: "+String::IntToString(index));  

now let's consider it is affected by many things as stated above, does these "caches" guarantee to be called in a specific order? or I call any of them in a large loop and check if any one "enters" so I go with it.

the cache system is kinda complex so bare with me

On 15/05/2015 at 09:55, xxxxxxxx wrote:

Check out the docs for GetCache() and GetDeformCache(). It shows quite nicely how the cache system in C4D operates.

On 15/05/2015 at 10:15, xxxxxxxx wrote:

Hi Samir,
I read both of them "actually they are tagged in the last reply" , and I understand to some extent how it works, but you know what, after re-reading it I understood it in a different way!! :astonished:

@Sebastian, you can mark this as solved.