Copy material in C++?


#1

Doing that in maxscript is trivial just:

objectA.material = copy objectB.material
objectA.material.name = "whateveryouwant"

Unfortunately using Clone in 3dsmax retrieves a ReferenceTarget* data instead of a new Material pointer.

Anyone has any tip?

Thank you!


#2

doesn’t

Mtl* clonedMat = reinterpret_cast<Mtl*> (originalMat->Clone());

work ?


#3

My bad I didn’t noticed that I can cast the return data to a Mtl pointer!