# Python: Store rotation / normal in bezier curve point?

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?
• 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 – lemon Aug 3 '16 at 6:16
• 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. – Ray Aug 3 '16 at 8:52
• the user has the ability to delete it in your game while you don't know it ? – lemon Aug 3 '16 at 8:55
• 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. – Ray Aug 3 '16 at 10:52

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

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

• 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... – Ray Aug 2 '16 at 20:42