Include linked materials when pasting object

On 28/08/2017 at 06:57, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R17+ 
Language(s) :     C++  ;

Hi! My object has a few link parameters which contains materials. These materials are then added to
virtually generated objects. I'm trying to find away to have these materials automatically copied when
the object is pasted into another document.

I've been looking at MSG_DOCUMENTINFO_OBJECT_INSERT, I could use that to find the materials in
the original document and copy them to the new document. But I have a feeling that it could very
clumsy/complicated when multiple objects referencing the same materials are copied, because I would
have to check which materials have already been copied over.

Is there a "native" way to implement this or is there one single special handling in Cinema 4D that looks
just at Texture Tags?


On 29/08/2017 at 00:04, xxxxxxxx wrote:

There's been this thread coming up recently. Maybe it's some sort of help for you?

Cheers. :)

On 29/08/2017 at 07:28, xxxxxxxx wrote:

As the thread linked in the post above probably already suggests, there is no native way to achieve this. Sorry, Niklas!

On 29/08/2017 at 19:35, xxxxxxxx wrote:

Another solution, a bit dirty I admit, is to make a scenehook that look at Ttexture and if its your material, make invisible Ttexture tag with all your sub material and a selection that is not aviable in the object like that you are sure theses extra Ttexture tag will never be used. And that's it ! :)

Since c4d copy all materials aviable in Ttexture, it will copy for you subs materials

EDIT: I'm not sure if Scenehook is really needed since with SetDParameter you can catch assignement change, so you can handle the creations/delete of thoses tags here