correcting struct declaration
This commit is contained in:
parent
dcdfc666a3
commit
c4220691fd
@ -310,9 +310,22 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
## Add C structures definitions
|
## Add C structures definitions
|
||||||
|
|
||||||
|
# Partial declaration of structures to avoid inter-dependencies issues
|
||||||
|
|
||||||
|
f.write("struct BODY;\n" +
|
||||||
|
"struct VANIM;\n" +
|
||||||
|
"struct PRIM;\n" +
|
||||||
|
"struct MESH;\n" +
|
||||||
|
"struct CAMPOS;\n" +
|
||||||
|
"struct CAMPATH;\n" +
|
||||||
|
"struct CAMANGLE;\n" +
|
||||||
|
"struct SIBLINGS;\n" +
|
||||||
|
"struct CHILDREN;\n" +
|
||||||
|
"struct NODE;\n\n")
|
||||||
|
|
||||||
# BODY
|
# BODY
|
||||||
|
|
||||||
f.write("typedef struct {\n" +
|
f.write("typedef struct BODY {\n" +
|
||||||
"\tVECTOR gForce;\n" +
|
"\tVECTOR gForce;\n" +
|
||||||
"\tVECTOR position;\n" +
|
"\tVECTOR position;\n" +
|
||||||
"\tSVECTOR velocity;\n" +
|
"\tSVECTOR velocity;\n" +
|
||||||
@ -325,7 +338,7 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
# VANIM
|
# VANIM
|
||||||
|
|
||||||
f.write("typedef struct { \n" +
|
f.write("typedef struct VANIM { \n" +
|
||||||
"\tint nframes; // number of frames e.g 20\n" +
|
"\tint nframes; // number of frames e.g 20\n" +
|
||||||
"\tint nvert; // number of vertices e.g 21\n" +
|
"\tint nvert; // number of vertices e.g 21\n" +
|
||||||
"\tint cursor; // anim cursor\n" +
|
"\tint cursor; // anim cursor\n" +
|
||||||
@ -338,14 +351,14 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
# PRIM
|
# PRIM
|
||||||
|
|
||||||
f.write("typedef struct {\n" +
|
f.write("typedef struct PRIM {\n" +
|
||||||
"\tVECTOR order;\n" +
|
"\tVECTOR order;\n" +
|
||||||
"\tint code; // Same as POL3/POL4 codes : Code (F3 = 1, FT3 = 2, G3 = 3, GT3 = 4) Code (F4 = 5, FT4 = 6, G4 = 7, GT4 = 8)\n" +
|
"\tint code; // Same as POL3/POL4 codes : Code (F3 = 1, FT3 = 2, G3 = 3, GT3 = 4) Code (F4 = 5, FT4 = 6, G4 = 7, GT4 = 8)\n" +
|
||||||
"\t} PRIM;\n\n")
|
"\t} PRIM;\n\n")
|
||||||
|
|
||||||
# MESH
|
# MESH
|
||||||
|
|
||||||
f.write("typedef struct { \n"+
|
f.write("typedef struct MESH { \n"+
|
||||||
"\tTMESH * tmesh;\n" +
|
"\tTMESH * tmesh;\n" +
|
||||||
"\tPRIM * index;\n" +
|
"\tPRIM * index;\n" +
|
||||||
"\tTIM_IMAGE * tim; \n" +
|
"\tTIM_IMAGE * tim; \n" +
|
||||||
@ -369,7 +382,7 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
# CAMPOS
|
# CAMPOS
|
||||||
|
|
||||||
f.write("typedef struct {\n" +
|
f.write("typedef struct CAMPOS {\n" +
|
||||||
"\tVECTOR pos;\n" +
|
"\tVECTOR pos;\n" +
|
||||||
"\tSVECTOR rot;\n" +
|
"\tSVECTOR rot;\n" +
|
||||||
"\t} CAMPOS;\n\n" +
|
"\t} CAMPOS;\n\n" +
|
||||||
@ -377,7 +390,7 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
# CAMANGLE
|
# CAMANGLE
|
||||||
|
|
||||||
f.write("typedef struct {\n" +
|
f.write("typedef struct CAMANGLE {\n" +
|
||||||
"\tCAMPOS * campos;\n" +
|
"\tCAMPOS * campos;\n" +
|
||||||
"\tTIM_IMAGE * BGtim;\n" +
|
"\tTIM_IMAGE * BGtim;\n" +
|
||||||
"\tunsigned long * tim_data;\n" +
|
"\tunsigned long * tim_data;\n" +
|
||||||
@ -385,31 +398,31 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
# CAMPATH
|
# CAMPATH
|
||||||
|
|
||||||
f.write("typedef struct {\n" +
|
f.write("typedef struct CAMPATH {\n" +
|
||||||
"\tshort len, cursor, pos;\n" +
|
"\tshort len, cursor, pos;\n" +
|
||||||
"\tVECTOR points[];\n" +
|
"\tVECTOR points[];\n" +
|
||||||
"\t} CAMPATH;\n\n")
|
"\t} CAMPATH;\n\n")
|
||||||
|
|
||||||
# PARENTNODE
|
# SIBLINGS
|
||||||
|
|
||||||
f.write("typedef struct {\n" +
|
f.write("typedef struct SIBLINGS {\n" +
|
||||||
"\tint index;\n" +
|
"\tint index;\n" +
|
||||||
"\tMESH * siblings[];\n" +
|
"\tstruct NODE * list[];\n" +
|
||||||
"\t} PARENTNODE ;\n\n")
|
"\t} SIBLINGS ;\n\n")
|
||||||
|
|
||||||
# CHILDNODE
|
# CHILDREN
|
||||||
|
|
||||||
f.write("typedef struct {\n" +
|
f.write("typedef struct CHILDREN {\n" +
|
||||||
"\tint index;\n" +
|
"\tint index;\n" +
|
||||||
"\tMESH * children[];\n" +
|
"\tMESH * list[];\n" +
|
||||||
"\t} CHILDNODE ;\n\n")
|
"\t} CHILDREN ;\n\n")
|
||||||
|
|
||||||
# NODE
|
# NODE
|
||||||
|
|
||||||
f.write("typedef struct {\n" +
|
f.write("typedef struct NODE {\n" +
|
||||||
"\tMESH * curPlane;\n" +
|
"\tMESH * plane;\n" +
|
||||||
"\tPARENTNODE * siblings;\n" +
|
"\tSIBLINGS * siblings;\n" +
|
||||||
"\tCHILDNODE * objects;\n" +
|
"\tCHILDREN * objects;\n" +
|
||||||
"\t} NODE;\n\n")
|
"\t} NODE;\n\n")
|
||||||
|
|
||||||
## Camera setup
|
## Camera setup
|
||||||
@ -1142,7 +1155,20 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
Yvalues = []
|
Yvalues = []
|
||||||
|
|
||||||
|
# Declare LvlPlanes nodes to avoid declaration dependency issues
|
||||||
|
|
||||||
|
# ~ f.write("NODE ")
|
||||||
|
|
||||||
|
for k in LvlPlanes.keys():
|
||||||
|
|
||||||
|
f.write("NODE node" + CleanName(k) + ";\n\n")
|
||||||
|
|
||||||
|
# ~ if k < len( LvlPlanes.keys() ) - 1:
|
||||||
|
|
||||||
|
# ~ f.write(", ")
|
||||||
|
|
||||||
|
# ~ f.write(";\n\n")
|
||||||
|
|
||||||
# Sides of the plane to check
|
# Sides of the plane to check
|
||||||
|
|
||||||
checkSides = [
|
checkSides = [
|
||||||
@ -1152,7 +1178,6 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
['E','W']
|
['E','W']
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# Generate a dict :
|
# Generate a dict :
|
||||||
|
|
||||||
# ~ {
|
# ~ {
|
||||||
@ -1239,7 +1264,7 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
pName = CleanName(p)
|
pName = CleanName(p)
|
||||||
|
|
||||||
# Write PARENTNODE structure
|
# Write SIBLINGS structure
|
||||||
|
|
||||||
nSiblings = 0
|
nSiblings = 0
|
||||||
|
|
||||||
@ -1259,7 +1284,7 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
nSiblings += len(PlanesObjects[p]['siblings']['W'])
|
nSiblings += len(PlanesObjects[p]['siblings']['W'])
|
||||||
|
|
||||||
f.write("PARENTNODE node" + pName + "_siblings = {\n" +
|
f.write("SIBLINGS node" + pName + "_siblings = {\n" +
|
||||||
"\t" + str(nSiblings) + ",\n" +
|
"\t" + str(nSiblings) + ",\n" +
|
||||||
"\t{\n")
|
"\t{\n")
|
||||||
|
|
||||||
@ -1269,7 +1294,7 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
for sibling in PlanesObjects[p]['siblings'][side]:
|
for sibling in PlanesObjects[p]['siblings'][side]:
|
||||||
|
|
||||||
f.write("\t\t&mesh" + CleanName(sibling) + ",\n")
|
f.write("\t\t&node" + CleanName(sibling) + ",\n")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
f.write("0,\n")
|
f.write("0,\n")
|
||||||
@ -1277,9 +1302,9 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
f.write("\t}\n" +
|
f.write("\t}\n" +
|
||||||
"};\n\n")
|
"};\n\n")
|
||||||
|
|
||||||
# Write CHILDNODE structure
|
# Write CHILDREN structure
|
||||||
|
|
||||||
f.write("CHILDNODE node" + pName + "_objects = {\n")
|
f.write("CHILDREN node" + pName + "_objects = {\n")
|
||||||
|
|
||||||
if 'objects' in PlanesObjects[p]:
|
if 'objects' in PlanesObjects[p]:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user