Insert Object with Materials into Scene

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

On 26/02/2010 at 10:34, xxxxxxxx wrote:

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

---------
Hi,

I have created a template object with materials in a C4D file. Through a command plugin, I now want to insert this object at a given position in a second scene.

If I do

  
MergeDocument(doc, objectFile, SCENEFILTER_OBJECTS, NULL);   

I end up with the only the object in my scene, but not the materials.
If I use

  
MergeDocument(doc, objectFile, SCENEFILTER_MATERIALS, NULL);   

before, then I have both the materials and the objects, but the object tag is no longer linked to the material.

By the way, using

  
MergeDocument(doc, objectFile, SCENEFILTER_MERGESCENE, NULL);   

results in nothing inserted at all.
What am I doing wrong here?

Thanks, Juergen

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

On 28/02/2010 at 22:31, xxxxxxxx wrote:

try this
MergeDocument(doc, objectFile, SCENEFILTER_MATERIALS | SCENEFILTER_OBJECTS, NULL);

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

On 01/03/2010 at 05:57, xxxxxxxx wrote:

Thanks affa!
That works, but know I have the material twice in the new scene ... very strange.

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

On 01/03/2010 at 06:02, xxxxxxxx wrote:

My mistake .. the second one was a residual code part that loaded the material again seperately. So it now works perfectly!