On 30/07/2018 at 10:51, xxxxxxxx wrote:
Hello Yaroslav,
welcome to the Plugin Café forums
As you are new here, I'd like to ask you to consider a few rules in future. I hope you don't mind.
Please do not cross-post into multiple forums. Chances are, the question gets solved in another forum without us noticing. Then leading to work being done twice without any need.
Secondly, when posting code, please make use of the code tags, a link below this input field explains all the BBcodes.
Lastly we'd prefer to get a more detailed problem description, instead of just some code and "it doesn't work".
Ok, now to your code. There are actually a few issues.
Your myspline() function always creates a new SplineObject. a) For the PLA animation to work, you should actually stay with one object and just modify this from keyframe to keyframe. b) After inserting the object returned from myspline(), you ignore the returned object in the following completely. So, while you may think to modify the first object, in fact you are always creating new ones with every myspline() call, ignoring the result completely.
In the end the script most likely lacks an EventAdd() call.
More a cosmetic or speed issue, you don't have to search for the object all the time. Your myspline() function returns an object reference. You can just use it in the following code.
My suggestion would be to have a CreateMySpline(), looking roughly like your myspline() in t<1 case. This also returns the spline reference. And then for the later calls rather have a ChangeMySpline() function, just working on a spline object passed in as parameter.
I hope this helps. Please don't hesitate to ask, if there are questions remaining.