can't transfer required scene data from VolumeData



  • On 26/02/2015 at 14:55, xxxxxxxx wrote:

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

    ---------
    I have a VideoPostData plugin, it is a renderer, so I need to transfer all scene data, the problem is:
    1- how to get the tag from the object "to read which shader is assigned to the polygon object" , this fails with a cube primitive where RayObject::link returns NULL.
    2- if there is a cloner object with a dynamics tag, it doesn't read correctly "it reads initial positions NOT the modified dynamics positions"

    there may be other problems which I don't know... here is a sample code

        
        
        	if (vps->vp==VIDEOPOSTCALL_RENDER && vps->open)
        
        	{
        
        		for(Int32 i = 0; i < vps->vd->GetObjCount(); ++i)//iterate over polygon objects
        
        		{
        
        			RayObject *op = vps->vd->GetObj(i);
        
          
        
        
        			if(op->type ==  O_POLYGON)
        
        			{				
        
        				BaseObject *bop = op->link;
        
        				if(bop)
        
        				{
        
        					//reading tags here, which fails for primitives and may be other untested cases  
        				}
        
        			}
        
        		}
        
        	}
        
        
    


  • On 26/02/2015 at 15:10, xxxxxxxx wrote:

    here is where I guess it is a problem in the RayObject generation function, which may be relying on current state to object.

    1- open presets-> SSS grapes scene
    2- open the dynamics tag on the grapes cloner object, go to cache, delete cache, run animation to frame 30 so the grapes fill the bowl.
    3- now right click the cloner object-> Current State to Object ... IT WON'T WORK!! , and here comes the problem...

    any suggestions?



  • On 27/02/2015 at 06:23, xxxxxxxx wrote:

    Hello,

    In Cinema 4D shaders are not assigned to objects. Materials are assigned to objects.

    the "link" property of an RayObject links to the reference object. But this may be an (polygon) object in a generator's cache. Only this generator will carry the tags. This generator can be accessed using GetCacheParent(). Be aware that the caches in Cinema can be quite complex.

    Also, to get the texture assigned to a RayObject the method GetTexData() is available.

    Best wishes,
    Sebastian



  • On 27/02/2015 at 07:28, xxxxxxxx wrote:

    Hi Sebastian,

    GetTexData() won't help me, my materials are custom and accessed in a totally different way, so I need the Material tag

    now let's consider a very simple 2 cases:
    1- a simple primitive cube object with a material tag, how to get this tag from RayObject?
    2- a generator with a long tree and many objects inside this tree "a cloner object for example" , how to get this cloner? "I assume the WORST case, that the RayObject link will return NULL!! and I can't get the BaseObject* to get its parent "

    Edit:
    I was too hasty, I think GetTexData() can get the tag as needed, the 2 questions above are needed to answer though "hopefully".



  • On 02/03/2015 at 06:26, xxxxxxxx wrote:

    Hello,

    as you know you can get the object that is referenced by a RayObject from it's "link" property. As this link object may be an object from a generator's cache you may have to check the parent objects and the cache parents to get all tags that may be assigned to the object, it's parents or it's generator. Something like that:

      
    void CheckParents(BaseObject* object)  
    {  
     while(object)  
     {  
         BaseTag* tag = object->GetFirstTag();  
      
         while(tag)  
         {  
             GePrint(tag->GetName());  
             tag = tag->GetNext();  
         }  
      
         if(object->GetUp())  
             object = object->GetUp();  
         else  
             object = object->GetCacheParent();  
     }  
    }  
    

    The exact code may depend on your needs.

    best wishes,
    Sebastian



  • On 02/03/2015 at 07:42, xxxxxxxx wrote:

    Hi Sebastian,

    thanks for the code snippet which solves question (2) in my previous reply, but there is one main problem, link is NULL ... what should I do?
    also this function ALWAYS crashes [at first call]:

    for(Int32 j = 0; j < op->vcnt; ++j)
    {
    	PolyVector mNormal;
    	vps->vd->GetNormals(op, j, &mNormal);//get first polygon phong normals
    }
    


  • On 02/03/2015 at 11:00, xxxxxxxx wrote:

    Hello,

    well, if "link" is a nullptr there is nothing you can do. Can you give an example or describe a situation where this happens?

    For questions no longer related to this thread's original topic please open a new thread. Thanks.

    Best wishes,
    Sebastian



  • On 02/03/2015 at 13:01, xxxxxxxx wrote:

    Hi Sebastian,

    I think I was wrong, link  is not nullptr, but in docs it is written:
    Can be nullptr , always check.

    so I'm not sure if this may happen.
    anyway thanks a lot, you made my day 🙂


Log in to reply