2
$\begingroup$

Still trying to visualize a game file format in Blender, I think I reached a limit of what I can do with Blender Bezier Curves.

The game file format defines the coordinates of the curve point and the two handles. It additionally, however, defines a rotation of the curve point, basically a normal, because it needs to move and rotate objects along the path the curve forms.

Is it possible to store a normal in a Bezier Curve Point?

  • I didn't find anything like a normal / rotation for bezier curve points in the documentation.
  • Also, curves don't seem to support custom data layers like with the BMesh API where I could at least store the original normal information. Also it would be hard to edit those normals then visually.
  • I think it would be a monstrous task for someone who has never worked with the Blender C(++) codebase to add a new object type supporting that, or is it possible to relatively "easily" add normals to curve points or derive a new curve type from the existing one, just adding this information and keeping big parts of the base curve class?
$\endgroup$
4
  • $\begingroup$ You can always have a parallel data structure to store this additional information and go from it to the curve (and from the curve to it) using a dictionary $\endgroup$
    – lemon
    Aug 3, 2016 at 6:16
  • $\begingroup$ I thought about that, but what when the user deletes curve points? I can only identify them by index correctly AFAIK, and then the mappings get all messed up. $\endgroup$
    – Ray
    Aug 3, 2016 at 8:52
  • $\begingroup$ the user has the ability to delete it in your game while you don't know it ? $\endgroup$
    – lemon
    Aug 3, 2016 at 8:55
  • $\begingroup$ No. For each point, I need to remember additional data (2 floats, and a rotation). If I store that in a parallel data structure it will desync as soon as a vertex in the curve is deleted. $\endgroup$
    – Ray
    Aug 3, 2016 at 10:52

1 Answer 1

4
$\begingroup$

Bezier curve objects can store a property called tilt. It is basically a per point rotation value or normal that controls it's twisting on a per.vertex basis.

It can be set through the UI in edit mode under the Properties Shelf > Transform > Tilt or through the Python API with bpy.types.BezierSplinePoint.tilt

Bezier Curve Tilt

As far asI know curves don't support arbitrary data layers per vertex like BMesh does, but I may be wrong.

$\endgroup$
1
  • $\begingroup$ That looks quite promising. I just have to find out how to calculate the tilt angle from an XYZ normal rotation the data I got gives me. And yeah, there are no custom data layers according to the docs, which is another issue since I need to store 2 game specific floats for each point... $\endgroup$
    – Ray
    Aug 2, 2016 at 20:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .