On 02/03/2018 at 03:00, xxxxxxxx wrote:
Even if it's not 100% true, consider the xpresso tag like a python tag. (I mean they get the same limitations since they are both tag).
So It's really not recommended to add object into the scene from an expresso (and you can't do it with pure xpresso without python), since it can make crash or corrupt the scene.
Regarding your initial code, you get some issues I should have pointed you before.
First of all, you shouldn't use an user data from another objects. As you may be aware, the scene is executed in a given order.
So for example if you got a generator and an object, in this order in the hierarchy, Generator parent of object.
Your generator will be elevated before your object, so that mean if you get an animated user data/parameters into your object and you retrieve this parameter from your generator, you still get the old value.
Then you may be aware a c4d.SplineObject is composed of points and segments
Before to change the structure to an object (this is also true for PolygonObject or PointObject) you have to use ResizeObject.
Then for each segments you have to define how many points it contains by calling SetSegment.
After you can define the position of theses points, and when you finnish to edit your object/spline you need to send a Message to the object in order to generate it's cache.
Which will give us something like
def main() :
ptnCnt = 3
spline = c4d.SplineObject(ptnCnt, c4d.SPLINETYPE_BEZIER)
if spline is None:
# Offset & Set the Points
spline.SetSegment(0, 3, False)
spline.SetPoint(0, c4d.Vector(0, 0, 0))
spline.SetPoint(1, c4d.Vector(50, op[c4d.ID_USERDATA,1], 0))
spline.SetPoint(2, c4d.Vector(100, 0, 0))
spline.SetTangent(1, c4d.Vector(0,-30,-40), c4d.Vector(0,30,40)) # Tangent are in local space of point
Regarding your need to go back to frame 0 on the timeline I'm not able to reproduce it(even with optimize cache and reset on Frame0 checked).
So please share your complete code, if it's not possible to do publicly then send us an email at [email protected]