Alembic baking round 2 [SOLVED]

  • On 07/04/2015 at 00:55, xxxxxxxx wrote:

    So I got back into it, and discover that the points link method will indeed work in some form of fashion. I'm tackling this from a different perspective, I generate a Spline object from a number of alembic curve manually this time, but all I get in the end is a mass of points, not a bunch of segments with individual splines. I was curious as to what i may be doing wrong

    import c4d
    import os, hashlib, csv
    from c4d import bitmaps, gui, plugins, documents, utils
    from types import *
    if __name__ == '__main__':
        # Get active doc
        doc = c4d.documents.GetActiveDocument()
        # Get project current start and end frames
        startFrameValue = int(doc.GetMinTime().GetFrame(doc.GetFps()))
        endFrameValue = int(doc.GetMaxTime().GetFrame(doc.GetFps()))
        #pointCount = op.GetGuides().GetPointCount()
        newSpline = c4d.SplineObject(0, c4d.SPLINETYPE_LINEAR)
        #newSpline = c4d.BaseObject(c4d.Ospline) # Create new null
        extCurves = op.GetChildren()
        for curve in extCurves:
            realSpline = curve.GetRealSpline()
            obj = realSpline.GetClone()
            if(obj) :
                curvePntCnt = obj.GetPointCount()
                segPntStart = newSpline.GetPointCount() # the start of the new segment's points should be here
                print "Segment point start: " + str(segPntStart) 
                # if the point count for this alembic curve is zero with shouldn't make a new segment
                if(curvePntCnt != 0) :
                    newSpline.ResizeObject(newSpline.GetPointCount()+curvePntCnt, newSpline.GetSegmentCount()+1)
                    print "Segment count: " + str(newSpline.GetSegmentCount())
                    print "Point count: " + str(newSpline.GetPointCount())
                    # transfer point positions from alembic curve to combined spline
                    print "-----------Point vectors----------"
                    for i in range(0, curvePntCnt-1) :       
                        print obj.GetPoint(i)
                        newSpline.SetPoint(segPntStart + i, obj.GetPoint(i))
                    print "---------Point vectors end--------"

  • On 07/04/2015 at 01:55, xxxxxxxx wrote:


    the segments can be defined with SplineObject.SetSegment().
    You can set up your segments e.g. in the last for loop of your script.

    (I always sent an update message if the bounding box of an object has changed.

    Hope this helps!
    Best wishes

  • On 07/04/2015 at 06:44, xxxxxxxx wrote:


    as Martin said, you must use SetSegment() to define the segments of the spline you create. You find a example on how to us this function in the Double Circle plugin.

    Best wishes,

  • On 08/04/2015 at 01:11, xxxxxxxx wrote:

    there were just a few more complications but the SetSegment advice and several hours of looking at documentation and point counts got me the rest of the way. Once I had the splines showing up I began to realize C4Ds hair system uses the same point count for each guide, whereas upon export/import that count gets jacked up. Incorporating a guide point count and the  ID_MODELING_SPLINE_ROUND_TOOL via SendModelingCommand got me the rest of the way there.

Log in to reply