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

    Adding new (custom) materials

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 228 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

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

      On 30/10/2006 at 05:07, xxxxxxxx wrote:

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

      ---------
      Hi all,

      I've got a custom material type using a MaterialData plugin. At some point of my code i'd like to be able to add a new instance of this kind of material into the current document. I'm trying to use BaseDocument::InsertMaterial, but I'm lost in the correspondence between MaterialData (the plugin itself) and BaseMaterial (which must be inserted in the scene).

      Could anyone point me out how any way to proceed?

      (should I allocate a new instance of the plugin and then link it somehow with a new BaseMaterial instance?)

      Thanks!

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

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

        On 30/10/2006 at 07:25, xxxxxxxx wrote:

        You simply pass the plugin ID of your materialdata plugin to the InsertMaterial function. The folowing code for example creates a new "ParticleVolume" material from the SDK examples.

          
        BaseMaterial *mymat = BaseMaterial::Alloc(1001163);  
        if(mymat)  
        {  
        doc->InsertMaterial(mymat,NULL,FALSE);  
        }  
        

        cheers,
        Matthias

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

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

          On 30/10/2006 at 08:12, xxxxxxxx wrote:

          Thanks Matthias, works perfectly! 😉

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