// getting or creating bevel object
List<Geometry> bevelObject = null;
Pointer pBevelObject = (Pointer) curveStructure.getFieldValue("bevobj");
if (pBevelObject.isNotNull()) {
Pointer pBevelStructure = (Pointer) pBevelObject.fetchData().get(0).getFieldValue("data");
Structure bevelStructure = pBevelStructure.fetchData().get(0);
bevelObject = this.toCurve(bevelStructure, blenderContext);
} else {
int bevResol = ((Number) curveStructure.getFieldValue("bevresol")).intValue();
float extrude = ((Number) curveStructure.getFieldValue("ext1")).floatValue();
float bevelDepth = ((Number) curveStructure.getFieldValue("ext2")).floatValue();
if (bevelDepth > 0.0f) {
float handlerLength = bevelDepth / 2.0f;
List<Vector3f> conrtolPoints = new ArrayList<Vector3f>(extrude > 0.0f ? 19 : 13);
if (extrude > 0.0f) {
conrtolPoints.add(new Vector3f(-bevelDepth, 0, extrude));
conrtolPoints.add(new Vector3f(-bevelDepth, 0, -handlerLength + extrude));
conrtolPoints.add(new Vector3f(-bevelDepth, 0, handlerLength - extrude));
}
conrtolPoints.add(new Vector3f(-bevelDepth, 0, -extrude));
conrtolPoints.add(new Vector3f(-bevelDepth, 0, -handlerLength - extrude));
conrtolPoints.add(new Vector3f(-handlerLength, 0, -bevelDepth - extrude));
conrtolPoints.add(new Vector3f(0, 0, -bevelDepth - extrude));
conrtolPoints.add(new Vector3f(handlerLength, 0, -bevelDepth - extrude));
if (extrude > 0.0f) {
conrtolPoints.add(new Vector3f(bevelDepth, 0, -extrude - handlerLength));
conrtolPoints.add(new Vector3f(bevelDepth, 0, -extrude));
conrtolPoints.add(new Vector3f(bevelDepth, 0, -extrude + handlerLength));
}
conrtolPoints.add(new Vector3f(bevelDepth, 0, extrude - handlerLength));
conrtolPoints.add(new Vector3f(bevelDepth, 0, extrude));
conrtolPoints.add(new Vector3f(bevelDepth, 0, extrude + handlerLength));
conrtolPoints.add(new Vector3f(handlerLength, 0, bevelDepth + extrude));
conrtolPoints.add(new Vector3f(0, 0, bevelDepth + extrude));
conrtolPoints.add(new Vector3f(-handlerLength, 0, bevelDepth + extrude));
conrtolPoints.add(new Vector3f(-bevelDepth, 0, handlerLength + extrude));
conrtolPoints.add(new Vector3f(-bevelDepth, 0, extrude));
Spline bevelSpline = new Spline(SplineType.Bezier, conrtolPoints, 0, false);
Curve bevelCurve = new Curve(bevelSpline, bevResol);
bevelObject = new ArrayList<Geometry>(1);
bevelObject.add(new Geometry("", bevelCurve));
} else if (extrude > 0.0f) {
Spline bevelSpline = new Spline(SplineType.Linear, new Vector3f[] { new Vector3f(0, 0, -extrude), new Vector3f(0, 0, extrude) }, 1, false);
Curve bevelCurve = new Curve(bevelSpline, bevResol);
bevelObject = new ArrayList<Geometry>(1);
bevelObject.add(new Geometry("", bevelCurve));
}
}
// getting taper object
Spline taperObject = null;
Pointer pTaperObject = (Pointer) curveStructure.getFieldValue("taperobj");
if (bevelObject != null && pTaperObject.isNotNull()) {
Pointer pTaperStructure = (Pointer) pTaperObject.fetchData().get(0).getFieldValue("data");
Structure taperStructure = pTaperStructure.fetchData().get(0);
taperObject = this.loadTaperObject(taperStructure);
}
Vector3f loc = this.getLoc(curveStructure);
// creating the result curves