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

    Spline Segments

    SDK Help
    0
    3
    575
    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 15/01/2003 at 07:55, xxxxxxxx wrote:

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

      ---------
      *NEWBIE COFFEE QUESTION*

      How do I choose which spline segment it is that i'm affecting in my spline object? like if i want to make a new segment and put a point in it, how would i do this?

      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 16/01/2003 at 17:37, xxxxxxxx wrote:

        See SplineObject::GetSegments().

        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 16/01/2003 at 19:24, xxxxxxxx wrote:

          i can't seem to get it to work at all... i thought i had... but then it turned out i was wrong.

          here's the code for making a spline with four points and two segments, but it doesn't seem to work, it just creates a single spline with 1 segment, and the getsegemtns command always returns 0 with this even when it has 1 segment.

          if (!instanceof(op,PointObject)) return FALSE;        // Not a point object.

          //segment making part

          var sc= new(VariableChanged); if (!sc) return FALSE;
                    var cnt=op->GetSegmentCount();
                    sc->Init(cnt,2);

          var bt = new(BackupTags); if (!bt) return FALSE; // Allocate a BackupTags object.
                    bt->Init(op);                                    // Backup up 'op'

          // Send the message to all tags and keys and let them return
                    // a boolean, telling us if everything is alright:

          var ok = op->MultiMessage(MSG_SEGMENTS_CHANGED,sc);

          if (!ok)
                    {
                     bt->Restore(); // Restore the object if something went wrong                                
                     return FALSE;
                    }

          var seg=new(array,2);
                    seg[0]=2;
                    seg[1]=2;

          op->SetSegments(seg);

          //end of segment making part

          //spline making part

          var vc = new(VariableChanged); if (!vc) return FALSE; // Allocate class.

          var cnt = op->GetPointCount(); // Get actual point count.
                    vc->Init(cnt,4);            // Resize point count from cnt to cnt+1.
                                          // Just for adding a point at the end of
                                          // the point list one doesn't need a map.

          var bt = new(BackupTags); if (!bt) return FALSE; // Allocate a BackupTags object.
                    bt->Init(op);                                    // Backup up 'op'

          // Send the message to all tags and keys and let them return
                    // a boolean, telling us if everything is alright:

          var ok = op->MultiMessage(MSG_POINTS_CHANGED,vc);

          if (!ok)
                    {
                     bt->Restore(); // Restore the object if something went wrong                                
                     return FALSE;
                    }

          // Now all tags and structures have reacted and resized their
                    // memory part, so one can access the new point:
                    
                    var pnts=new(array,4);
                    pnts[0]=apos;
                    pnts[1]=bpos;
                    pnts[2]=cpos;
                    pnts[3]=dpos;

          op->SetPoints(pnts);    // Set data p for new point
          //end of spline making part
                    op->Message(MSG_UPDATE); // Notify object of change

          i've tried both ways around with the points being made first, and the segmenst second, but i just can't seem to get it to work. apos,bpos,cpos and dpos are the positions of four nulls, and op is the spline.

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