Hey there. I've run into some trouble with a little script I'm hacking together, hoping someone could spare a moment to take a look?
I'm just trying to connect the components of a spline to some arbitrary nulls within my document. So far everything seems to be working, except the tangents- which are not positioned where their corresponding nulls are. Document attached and code below.
import c4d
#Welcome to the world of Python
def main():
MySpline = op.GetObject() #This is the spline.
P1 = op[c4d.ID_USERDATA,1] #First point
T1L = op[c4d.ID_USERDATA,3] #First point's left tangent
T1R = op[c4d.ID_USERDATA,4] #First point's right tangent
P2 = op[c4d.ID_USERDATA,6] #Second point
T2L = op[c4d.ID_USERDATA,7] #Second point's left tangent
T2R = op[c4d.ID_USERDATA,8] #Second point's right tangent
MySpline.SetPoint(0, P1.GetMg().off) #Set position of first spline point
MySpline.SetPoint(1, P2.GetMg().off) #Set position of second spline point
MySpline.SetTangent(0, T1L.GetMg().off, T1R.GetMg().off) #Adjust tangents for point 1 - Not Working!
MySpline.SetTangent(1, T2L.GetMg().off, T2R.GetMg().off) #Adjust tangents for point 2 - Not Working!
MySpline.Message(c4d.MSG_UPDATE)
Spline Rig 02b.c4d