Merging a .c4d file with actual document

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

On 28/03/2003 at 02:21, xxxxxxxx wrote:

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

---------
Hi there, I just started to code plugins. I wanted to write one which loads a .c4d-file into the actual document by pushing a button.
First I tried to do it as an ObjectData Plugin with that code in Init() function:

    
    
      
    Bool DummyObject::Init(GeListNode *node)  
    {   
     BaseObject *op  = (BaseObject* )node;  
     BaseContainer *data = op->GetDataInstance();  
       
     Filename file = GeGetPluginPath()+ Filename("Dummy.c4D");
    
    
    
    
     BaseDocument* bdoc=LoadDocument(file,TRUE);  
     SetActiveDocument(bdoc);   
     InsertBaseDocument(bdoc);  
      
     return TRUE;  
    }  
    

But so I could only open the Dummy.c4d as a new document. I tried the same using that code:

    
    
      
    Bool DummyObject::Init(GeListNode *node)  
    {   
     BaseObject *op  = (BaseObject* )node;  
     BaseContainer *data = op->GetDataInstance();  
       
     Filename file = GeGetPluginPath()+ Filename("Dummy.c4D");  
     LoadFile(file);  
     return TRUE;  
    }  
    

Here Cinema broke down and I got an access violation anywhere after loading the file.
Is there a way to do that more elegant and working?
Thanks

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

On 28/03/2003 at 10:35, xxxxxxxx wrote:

First of all it sounds like you want to use CommandData instead of ObjectData. That will make a new menu entry in the plugin menu, which you can also add as a toolbar button.
Second, there's no automatic way to merge two documents. You'll have to copy all objects and materials manually. (Make sure to use a single AliasTrans for the whole operation.)

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

On 02/04/2003 at 04:51, xxxxxxxx wrote:

I decided to use an ObjectData plugin because I want to represent the importing scene as a new object type with an own parent symbol in scene tree (like a null object does). If I do that with a CommandData plugin, there won't be created a new object symbol in scene tree, isn't it?

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

On 04/04/2003 at 05:59, xxxxxxxx wrote:

That's right. However, there are some subtle issues when doing such imports in the middle of scene evaluation, so I'd really not recommend it as a first project. You should use LoadDocument() and then output the stuff you find in the GetVirtualObjects() function. See the RoundedTube.cpp example.

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

On 03/09/2003 at 05:24, xxxxxxxx wrote:

After doing some other plugins I found out how to do it.
Thanks anyway.