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

    Making a hair braid - a job for COFFEE?

    SDK Help
    0
    5
    428
    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 17/10/2004 at 20:22, xxxxxxxx wrote:

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

      ---------
      I've just worked out the topology of the 3-stand tapered hair braid, the trouble is that I've never scripted anything in C4D before and it took me the better part of an hour to enter in all the spline points and handle data by hand, working with my trusty TI-85 calculator. I know there has to be a better way. What I'd like to ask is: Is COFFEE the answer? I'm a Java/C++ programmer by trade, but I'm a little ashamed to say I've never even looked into the capability of COFFEE, mostly because I do enough coding already that when I get 3D modeling assignments, I welcome the change of environment! 🙂 If COFFEE can help with this task, could some one point me to a suitable tutorial or sample script, like one that works with splines already perhaps?

      Here is the braid I made the hard way:

      I need to articulate this to, to make morph positions for the braid, so I'm hoping a coding solution can help with that too.

      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 22/10/2004 at 02:09, xxxxxxxx wrote:

        I think for this a combination of Xpresso and C.O.F.F.E.E. might be the easiest. Xpresso to iterate through the points of the splines and a C.O.F.F.E.E. node to do the math. (Or several Xpresso math nodes if you can be bothered.)

        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 13/12/2006 at 08:40, xxxxxxxx wrote:

          hi..does anyone know how to accees the hair material tag using coffee to access hair color,frizz,wave etc... so that you could set data using coffee to style hair with a click of a button??

          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 13/12/2006 at 12:26, xxxxxxxx wrote:

            Some time ago I started to develop a braid spline plugin too. I would say the easiest way is to use the C++ SDK especially if, as you stated, you already know C++. There is a good spline plugin example in the SDK examples that come with Cinema4D. Here a screenshot what my braid looked like.

            cheers,
            Matthias

            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 13/12/2006 at 21:21, xxxxxxxx wrote:

              hi thanks alot for ur reply...i'm trying to develop the plug in using COFFEE only, this is what i could come up with so far...this is good enough to grow the hair on any given object, but i dont know how to set data to change hair color,frizz, wave etc.. so that i could give it a hair style...is it possible to use coffee and do this? i'm very new to C4D and coffee..as far as i have realized we need to change the texture tag to material tag to set the hair material data..let me know , if u know how to make this possible, to change the parameters under the hair material tag ...This is enough to grow hair..but cant change colour,frizz etc...

              thanks
              cheers

              var doc = GetActiveDocument();
              doc->InsertMaterial(AllocMaterial(Mhair), NULL);

              // Activates the bump channel for a material
              var mat = doc->GetFirstMaterial();
              mat->SetName("Hair");
              //mat->SetChannelState(CHANNEL_COLOR, TRUE);
              //mat->SetChannelState(CHANNEL_BUMP, FALSE);
              //mat->SetChannelState(CHANNEL_SPECULAR, TRUE);

              // Sets a texture for it
              //var color = mat->GetChannel(CHANNEL_COLOR);
              //var colorBc = color->GetContainer();
              //colorBc->SetData(CH_COLOR,vector(0.5,0,0));
              //color->SetContainer(colorBc);

              var hobj = AllocObject(oHair);
              var hcon = hobj->GetContainer();
              var tobj = doc->FindObject("Cube");
              hcon->SetData(HAIRSTYLE_HAIR_COUNT, 40000);
              hcon->SetData(HAIRSTYLE_LINK,tobj);
              hcon->SetData(HAIRSTYLE_FUR,true);
              hcon->SetData(HAIRSTYLE_FUR_COUNT,4800);
              hobj->SetContainer(hcon);

              // Insert a NURBS object
              if(!doc->InsertObject(hobj, NULL, NULL)) return FALSE;

              //new - texture
              var tag,nam;
              nam = hobj->GetName();
              hobj->InsertTag(AllocTag(Ttexture));

              // Messages
              GeEventAdd(NEW_ACTIVE_OBJECT);
              doc->Message(MSG_UPDATE);
              doc->Message(DOCUMENT_CHANGED);

              // var mat1 = vDoc->FindMaterial("Rail");
              var mat2 = doc->FindMaterial("Hair");

              tag = hobj->GetFirstTag();
              var ma;

              ma = mat2->GetMarker();

              while (tag)
                  {

              if (instanceof(tag,TextureTag))
                  {
                        tag->SetMaterial(ma);
                    }

              tag = tag->GetNext();

              } //while end

              GeEventAdd(DOCUMENT_CHANGED);

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