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
newSpline.SetName("hair_baked")
doc.InsertObject(newSpline)
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--------"
c4d.EventAdd()