Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    creating a new material

    SDK Help
    0
    3
    219
    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
      Helper
      last edited by

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

      On 20/10/2005 at 12:32, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   9  
      Platform:   Windows  ;   
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      helloa people, i am new with coffee and plugins.
       i know how to create a plugin that makes objects, and i know how to attach every object a Coffeetag and also other tags....
      now i want to know how to create a new Material, say a simple Blue COLOR, and then tag that material to the Object, i dont see how to do this.
      Please help....

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

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

        On 20/10/2005 at 16:22, xxxxxxxx wrote:

        For materials, you need at least two things:

        1. Material
        2. Texture Tag

        Optionally, you may need polygon/point selections to which to restrict the Texture Tag's material application (Selection setting of the Texture tag in the A.M.).

        The Texture Tag points to the Material, thus providing a link between the Object and the Material. The Material is used for specifying texturing properties. These are broken into Channels (such as Color, Diffusion, Bump, Luminance etc.).

        First thing you'll need to do is create a Material and a Texture Tag, insert the Texture Tag into the Object, insert the Material into the Document, and make reference to the Material from the Texture Tag. Then you can set channels and their containers (something like this - untested) :

          
        // obj is BaseObject to receive Texture Tag  
        var texturetag;  
        var material;  
        var document;  
        var channel;  
        var container;  
        if (!(document = obj->GetDocument()))                              return FALSE;  
        if (!(material = AllocMaterial(Mmaterial)))                    return FALSE;  
        if (!(texturetag = AllocTag(Ttexture)))                         return FALSE;  
        if (!obj->InsertTag(texturetag))                                        return FALSE;  
        if (!document->InsertMaterial(material))                         return FALSE;  
        texturetag->SetMaterial(material);  
        material->SetChannelState(CHANNEL_COLOR, TRUE);  
        if (!(channel = material->GetChannel(CHANNEL_COLOR)))     return FALSE;  
        if (!(container = channel->GetContainer()))                    return FALSE;  
        container->SetData(CH_COLOR, vector(1.0, 0.0, 0.0)); // Make the Color red  
        channel->SetContainer(container);  
        EventAdd();  
        return TRUE;  
        
        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

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

          On 21/10/2005 at 00:15, xxxxxxxx wrote:

          thanks alot,
          it works fine, now i can create materials.

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