1
$\begingroup$

I have a file that define some curves and values from 0 to 1 for each point in the curve. I am trying to create a material which uses this values from 0 to 1 as the UV coordinates for a colormap texture so I can see the values from 0 to 1 as colors in Blender.

I have seen several ways of using generated UV coordinates for the curve, but I haven't found any way of using my own data as UV coordinates.

I have tried something like this, but it doesn't work as a SplinePoint doesn't have uv property (or something similar).

    curveData = bpy.data.curves.new('myCurve', type='CURVE')
    curveData.dimensions = '3D'
    curveData.bevel_resolution = 0
    curveData.bevel_depth = 1
    curveData.use_uv_as_generated = True


    polyline = curveData.splines.new(type='POLY')
    polyline.points.add(len(yarn)-1)
    for point, node in zip(polyline.points, yarn):
        position = positions[node]
        point.co = (position[0], position[1], position[2], 1)
        point.radius = radii[node]
        point.uv = blending[node] # Of course, this doesn't work...

Any idea on how I could achieve this?

$\endgroup$
  • $\begingroup$ I don't think this is currently possible, unless you convert to mesh which is unfortunately destructive, at least until we get a spline info node $\endgroup$ – Duarte Farrajota Ramos Sep 19 '19 at 12:07
  • $\begingroup$ I dont really care destroying the curve, as all this is going to run in background to render several files. But I'm not sure how can I know which mesh node corresponds to each curve node to get the UV property for my data... $\endgroup$ – jjcasmar Sep 19 '19 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.