Xpresso python tag issue
-
This script in the xpresso python tag works fine in Cinema 4D R19 but it doesn't work in higher versions. When I click on compile it says "no errors". The script should write spline data that I use in a range mapper node. But when I connect the output ports to the range mapper spline input port both the python and the range mapper turn yellow. Does anybody have an idea why this works in older versions of Cinema 4D but not in 2025?
import c4d import math def main(): global steps #number of steps global stepsize #size of each step global skidstep #spline data for range mapper global returnstep #spline data for range mapper points = steps * 2 Xstep = 1 / points Ystep = 1 / steps points = points + 1 skidstep = c4d.SplineData() skidstep.MakePointBuffer(points) returnstep = c4d.SplineData() returnstep.MakePointBuffer(points) X = 0 Ya = 0 Yb = 1 step = 0 while step < points: vec_A = c4d.Vector(X, Ya, 0) vec_B = c4d.Vector(X, Yb, 0) skidstep.SetKnot(step, vec_A) returnstep.SetKnot(step, vec_B) X = X + Xstep step = step + 1 if step % 2 != 0: Ya = Ya + Ystep Yb = 0 else: Yb = 1
-
Hello @arjo,
Thank you for reaching out to us. Without your scene file there is not much what we can do for you. That code, at a glance, is correct.
Cheers,
Ferdinand -
-
Hey @arjo,
There are errors in your console, and they tell you exactly what the issue is. Your
steps
variable is not an integer andMakePointBuffer
expects an integer for its number of points.Cheers,
FerdinandBefore
and after, I just cast
points
toint
:
-
Ah, super! thank you.