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

    Material Marker for dumi

    SDK Help
    0
    2
    239
    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 07/03/2003 at 05:46, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   8.012 
      Platform:      Mac OSX  ; 
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      Hello,
      I am very stupid but I can't find why It is not working:
      Id'like to set a material to a cube, here is my code:
      main(doc,op)
      {
           var MonMark = new(Marker);
           var matiere=doc -> FindMaterial("BlackScreen") ;
           if (!matiere) //Make mymaterial
                {
                matiere = new(Material) ;
                matiere -> SetName ("BlackScreen");
                MonMark=matiere->GetMarker();// I get the Marker here!!!!
                doc ->InsertMaterial (matiere,NULL) ;
                matiere -> Update () ;
                }
           var MonGroup=op->GetDown() ;
           if (!MonGroup)
                {
           MonGroup=new(PrimitiveObject) ;
                MonGroup->SetName("My Object");
                MonGroup->SetPrimitiveType(PRIMITIVE_CUBE);
                var MonTag = new(TextureTag);
      //          MonTag->SetMaterial(MonMark);// Here I try to set mymaterial to the TextureTag of "my object"

      MonGroup->InsertTag(MonTag,NULL);     
                doc->InsertObject(MonGroup,op,NULL);
           }
      }

      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 07/03/2003 at 11:48, xxxxxxxx wrote:

        Hello Platane !
        I just sent you the working code by mail, but I put it there for everybody:
        // This function update the C4D document
        Refresh(mydoc)
        {
            mydoc->Message(DOCUMENT_CHANGED);
            GeEventAdd(ACTIVE_OBJECT_CHANGED);
        }
        // Main function
        main(doc,op)
        {
            // 1 - We look for the "child" object
            var MonGroup=op->GetDown() ;
            if (MonGroup) return;          // if there is, we exit the coffee script
            // else we create this object  
             MonGroup=new(PrimitiveObject) ;
             MonGroup->SetName("My Object");
             MonGroup->SetPrimitiveType(PRIMITIVE_CUBE);
             doc->InsertObject(MonGroup,op,NULL);
             Refresh(doc); // update
            // 2 - Does the "BlakScreen" Material exist ?
            var matiere=doc -> FindMaterial("BlackScreen") ;
            if (!matiere)
            {
                matiere = new(Material) ;
                matiere -> SetName ("BlackScreen");
                doc ->InsertMaterial (matiere,NULL) ;
                matiere -> Update () ;
            }
            var MonMark=matiere->GetMarker();// We get the material marker
            // 3 - Apply the TextureTag on the Cube object
            var MonTag = new(TextureTag);
            MonGroup->InsertTag(MonTag,NULL);
            MonGroup->Message(MSG_UPDATE); // IMPORTANT !!!
            // 4 - TextureTag configuration
            MonTag->SetMaterial(MonMark);
            Refresh(doc); // Update
        }

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