External rendering problems with my objectData



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/09/2010 at 02:47, xxxxxxxx wrote:

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

    ---------
    Hi,
    I am making a pluginObject which make clones of BaseObject created by the user. But my plugin only works in the editor and with the editor rendering, but not in the "picture view" and "Make preview" renderer.
    I do this in the getVirtualObjects method, and it seems that the baseObject I want to clone has two different adresses, one for the editor, and the second for the external rendering, and I only know the first one, and I don't how to get the second one.
    Does anyone know how to do?
    Thanks for your help.
    Best,
    Olivier



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/09/2010 at 03:47, xxxxxxxx wrote:

    Please provide some simplified code otherwise it's difficult to tell what's going wrong.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/09/2010 at 07:54, xxxxxxxx wrote:

    Thanks for the reply. Below is a simplified code of a plugin that doesn't work like I expected because the rendering in the picture viewer is different than in the editor. More precisely, if the user creates some objects (e.g. primitive objects) and then creates "MyObjectPlugin", then the plugin will display moved clones of the primitive objects in the editor and with the editor renderer, but with the "picture view renderer" the plugin does nothing, in fact we always have "clone == NULL" in this case.

      
    #include "c4d.h"   
    #include<vector>    
    std::vector<BaseObject*> listOfObjects;    
    class MyObjectData : public ObjectData   
    {   
    public:   
      static NodeData *Alloc(){return gNew MyObjectData;}   
      virtual BaseObject *GetVirtualObjects(BaseObject *op, HierarchyHelp *hh)   
      {   
          // Fill the list with the objects created by the user. Do this just one time.   
          if (listOfObjects.size() == 0)   
          {   
              BaseObject *bo = op->GetDocument()->GetFirstObject();   
              while (bo)   
              {   
                  if (bo->GetType() != 1000001) // fill the list with object that are not the pluginObject;   
                      listOfObjects.push_back(bo);   
                  bo = bo->GetNext();   
              }   
          }       
       
          // create clones of the listed objects, put them in a group, and move the group to differentiate the clones from the originals.   
          BaseObject *nullObject = BaseObject::Alloc(Onull);   
          if (!nullObject)   
              return NULL;   
          for (int i = 0; i< listOfObjects.size(); i++)   
          {   
              BaseObject *clone = listOfObjects[i]->GetHierarchyClone(hh,listOfObjects[i],0, NULL, NULL);   
              if (clone)    
                  clone->InsertUnder(nullObject);   
          }   
          nullObject->SetPos(Vector(300,0,0));    
          return nullObject;   
      }   
    };    
    Bool PluginStart(void){return RegisterObjectPlugin(1000001,"MyObjectPlugin",OBJECT_GENERATOR,MyObjectData::Alloc,String(),0);}   
    void PluginEnd(void){}   
    Bool PluginMessage(LONG id, void *data){return FALSE;}  
    

Log in to reply