Hi. Im trying to get evaluate function for curve spline [Spline](https://docs.blender.org/api/blender2.8/bpy.types.Spline.html) using ctypes. I'm new to ctypes, here is what i
ve got so far:
import bpy, ctypes
from ctypes import Structure, POINTER
class BezTriple(Structure):
"""
typedef struct BezTriple {
float vec[3][3];
float tilt;
float weight;
float radius;
char ipo;
char h1, h2;
char f1, f2, f3;
char hide;
char easing;
float back;
float amplitude, period;
char f5;
char _pad[3];
} BezTriple;
"""
_fields_ = [
("vec", POINTER(POINTER(ctypes.c_float))),
("tilt", ctypes.c_float),
("weight", ctypes.c_float),
("radius", ctypes.c_short),
("ipo", ctypes.c_char),
("h1", ctypes.c_char),
("h2", ctypes.c_char),
("f1", ctypes.c_char),
("f2", ctypes.c_char),
("f3", ctypes.c_char),
("hide", ctypes.c_char),
("easing", ctypes.c_char),
("back", ctypes.c_float),
("amplitude", ctypes.c_float),
("period", ctypes.c_float),
("f5", ctypes.c_char),
("_pad", POINTER(ctypes.c_char)),
]
class BPoint(Structure):
"""
typedef struct BPoint {
float vec[4];
float tilt;
float weight;
short f1, hide;
float radius;
char _pad[4];
} BPoint;
"""
_fields_ = [
("vec", POINTER(ctypes.c_float)),
("tilt", ctypes.c_float),
("weight", ctypes.c_float),
("f1", ctypes.c_short),
("hide", ctypes.c_short),
("radius", ctypes.c_float),
("_pad", ctypes.c_char_p),
]
class Nurb(Structure):
"""
\source\blender\makesdna\DNA_curve_types.h
typedef struct Nurb {
struct Nurb *next, *prev;
short type;
short mat_nr;
short hide, flag;
int pntsu, pntsv;
char _pad[4];
short resolu, resolv;
short orderu, orderv;
short flagu, flagv;
float *knotsu, *knotsv;
BPoint *bp;
BezTriple *bezt;
short tilt_interp;
short radius_interp;
int charidx;
} Nurb;"""
_fields_ = [
# ("next", POINTER(Nurb)),
("next", ctypes.c_void_p),
("prev", ctypes.c_void_p),
("type", ctypes.c_short),
("mat_nr", ctypes.c_short),
("hide", ctypes.c_short),
("flag", ctypes.c_short),
("pntsu", ctypes.c_int),
("pntsv", ctypes.c_int),
("_pad", ctypes.c_char_p),
("resolu", ctypes.c_short),
("resolv", ctypes.c_short),
("orderu", ctypes.c_short),
("orderv", ctypes.c_short),
("flagu", ctypes.c_short),
("flagv", ctypes.c_short),
("knotsu", POINTER(ctypes.c_float)),
("knotsv", POINTER(ctypes.c_float)),
("bp", POINTER(BPoint)),
("bezt", POINTER(BezTriple)),
("tilt_interp", ctypes.c_short),
("radius_interp", ctypes.c_short),
("charidx", ctypes.c_short),
]
spline_ptr = bpy.context.object.data.splines[0].as_pointer()
p = ctypes.POINTER(Nurb)
p.from_address(spline_ptr)
print(p)
print(p.resolu)