Adding new (custom) materials



  • 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!



  • 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



  • 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! ;)


Log in to reply