Create Material

On 09/01/2018 at 07:00, xxxxxxxx wrote:

I have an object generator plugin with a button only one button, that should create any material other than standard(banji, hair, nukei, fog, etc.), but it always creates standard material.

class Testplugin(c4d.plugins.ObjectData) :
  
    def Message(self, node, type, data) :
        if type == c4d.MSG_DESCRIPTION_COMMAND:
                if data["id"][0].id == TESTPLUGIN_VALUE:
                    material = c4d.Material(1017730)
                    doc = c4d.documents.GetActiveDocument()
                    doc.InsertMaterial(material)
        return True

On 09/01/2018 at 07:00, xxxxxxxx wrote:

Download plugin: https://www.dropbox.com/s/54xhu6fd0k1xj42/Create Material.rar?dl=0

On 09/01/2018 at 07:02, xxxxxxxx wrote:

It is worth mentioning that it works if I'm creating the desired material by utilizing c4d.CallCommand()
I need to use the previous approach but I'm not getting any error messages when using it.

On 09/01/2018 at 07:07, xxxxxxxx wrote:

Figured it out... I had to use c4d.BaseMaterial instead of c4d.Material