Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Create Material

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 668 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

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

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

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

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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post