forked from johnzero7/XNALaraMesh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xps_types.py
156 lines (125 loc) · 3.68 KB
/
xps_types.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
from . import xps_const
class XpsBone:
def __init__(self, id, name, co, parentId):
self.id = id
self.name = name
self.co = co
self.parentId = parentId
class XpsBonePose:
def __init__(self, boneName, coordDelta, rotDelta, scale):
self.boneName = boneName
self.coordDelta = coordDelta
self.rotDelta = rotDelta
self.scale = scale
class XpsMesh:
def __init__(self, name, textures, vertices, faces, uvCount):
self.name = name
self.textures = textures
self.vertices = vertices
self.faces = faces
self.uvCount = uvCount
class BoneWeight:
def __init__(self, id, weight):
self.id = id
self.weight = weight
class XpsVertex:
def __init__(self, id, co, norm, vColor, uv, boneWeights):
self.id = id
self.co = co
self.norm = norm
self.vColor = vColor
self.uv = uv
self.boneWeights = boneWeights
self.merged = False
def __copy__(self):
return XpsVertex(
self.id,
self.co[:],
self.norm[:],
self.vColor[:],
self.uv[:],
self.boneWeights
)
class XpsTexture:
def __init__(self, id, file, uvLayer):
self.id = id
self.file = file
self.uvLayer = uvLayer
class XpsData:
def __init__(self, header='', bones=[], meshes=[]):
self.header = header
self.bones = bones
self.meshes = meshes
class XpsHeader:
def __init__(
self,
magic_number=xps_const.MAGIC_NUMBER,
version_mayor=xps_const.XPS_VERSION_MAYOR,
version_minor=xps_const.XPS_VERSION_MINOR,
xna_aral=xps_const.XNA_ARAL,
settingsLen=xps_const.STRLEN,
machine='',
user='',
files='',
settings='',
pose=''):
self.magic_number = magic_number
self.version_mayor = version_mayor
self.version_minor = version_minor
self.xna_aral = xna_aral
self.settingsLen = settingsLen
self.machine = machine
self.user = user
self.files = files
self.settings = settings
self.pose = pose
class XpsImportSettings:
def __init__(
self,
filename,
uvDisplX,
uvDisplY,
importDefaultPose,
joinMeshRips,
joinMeshParts,
markSeams,
vColors,
connectBones,
autoIk,
importNormals):
self.filename = filename
self.uvDisplX = uvDisplX
self.uvDisplY = uvDisplY
self.importDefaultPose = importDefaultPose
self.joinMeshRips = joinMeshRips
self.joinMeshParts = joinMeshParts
self.markSeams = markSeams
self.vColors = vColors
self.connectBones = connectBones
self.autoIk = autoIk
self.importNormals = importNormals
class XpsExportSettings:
def __init__(
self,
filename,
format,
uvDisplX,
uvDisplY,
exportOnlySelected,
expDefPose,
preserveSeams,
vColors,
exportNormals,
versionMayor,
versionMinor):
self.filename = filename
self.format = format
self.uvDisplX = uvDisplX
self.uvDisplY = uvDisplY
self.exportOnlySelected = exportOnlySelected
self.expDefPose = expDefPose
self.preserveSeams = preserveSeams
self.vColors = vColors
self.exportNormals = exportNormals
self.versionMayor = versionMayor
self.versionMinor = versionMinor