2D Curve Depth Sorting

When you set a curve to 2d, it flattens all curve shapes within an object to the same z position. It would be better if it instead flattened all SHAPES in the object to their own z position. This way a user can position 2d curves at different z-positions within a single object. This makes setting up shapekeys for these curve objects a lot easier to manage and would be exceptionally useful to 2d Animators.

I downloaded the Blender source and I navigated to the Curve.h and Curve.cpp files, but I’m currently confused (first time in Blender source). My understanding is that the function ‘getPoint2d()’ in the header is where a 2d vector is assigned only an x,y position.

I’m thinking that if I can access the shapeID for the currently active vertex, I can save the first z-position of a vertex and then test the next vertex to see if it’s a part of the same shape. If it is, it’ll assign it the same z-position and continue doing this until the shapeID is different. If it is, it’ll store a new z-value and continue until all shapes have been assigned a position.

Is this a reasonable plan?

I don’t know the relevant code to have an opinion on this. I don’t think there is something like shapeIDs within a single curve object. Like Meshes, I would expect that there is only vertices and edges between them, not actual “shapes”. You would probably have to partition them yourself to achieve what you want. I’m just guessing though.

In any case, you’re looking at the wrong code. Curve.h/Curve.cpp belongs to the freestyle renderer extension (Blender core code is in C). Instead look at BKE_curve.h, etc.

Wow, I’m looking through those files and I practically had to blow the dust off of them. I know that Blender has been neglecting the curve system for a while, but some of these files look untouched since 2001. I’m not very familiar with C, but I’m going to brush up on my knowledge of it and see if I can make sense of this…