constants.py 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. '''
  2. All constant data used in the package should be defined here.
  3. '''
  4. from collections import OrderedDict as BASE_DICT
  5. BLENDING_TYPES = type('Blending', (), {
  6. 'NONE': 'NoBlending',
  7. 'NORMAL': 'NormalBlending',
  8. 'ADDITIVE': 'AdditiveBlending',
  9. 'SUBTRACTIVE': 'SubtractiveBlending',
  10. 'MULTIPLY': 'MultiplyBlending',
  11. 'CUSTOM': 'CustomBlending'
  12. })
  13. BLENDING_CONSTANTS = type('BlendingConstant', (), {
  14. 'NoBlending':0,
  15. 'NormalBlending':1,
  16. 'AdditiveBlending':2,
  17. 'SubtractiveBlending':3,
  18. 'MultiplyBlending':4,
  19. 'CustomBlending':5
  20. })
  21. NEAREST_FILTERS = type('NearestFilters', (), {
  22. 'NEAREST': 'NearestFilter',
  23. 'MIP_MAP_NEAREST': 'NearestMipMapNearestFilter',
  24. 'MIP_MAP_LINEAR': 'NearestMipMapLinearFilter'
  25. })
  26. LINEAR_FILTERS = type('LinearFilters', (), {
  27. 'LINEAR': 'LinearFilter',
  28. 'MIP_MAP_NEAREST': 'LinearMipMapNearestFilter',
  29. 'MIP_MAP_LINEAR': 'LinearMipMapLinearFilter'
  30. })
  31. MAPPING_TYPES = type('Mapping', (), {
  32. 'UV': 'UVMapping',
  33. 'CUBE_REFLECTION': 'CubeReflectionMapping',
  34. 'CUBE_REFRACTION': 'CubeRefractionMapping',
  35. 'SPHERICAL_REFLECTION': 'SphericalReflectionMapping'
  36. })
  37. NUMERIC = {
  38. 'UVMapping': 300,
  39. 'CubeReflectionMapping': 301,
  40. 'CubeRefractionMapping': 302,
  41. 'EquirectangularReflectionMapping': 303,
  42. 'EquirectangularRefractionMapping': 304,
  43. 'SphericalReflectionMapping': 305,
  44. 'RepeatWrapping': 1000,
  45. 'repeat': 1000,
  46. 'ClampToEdgeWrapping': 1001,
  47. 'MirroredRepeatWrapping': 1002,
  48. 'NearestFilter': 1003,
  49. 'NearestMipMapNearestFilter': 1004,
  50. 'NearestMipMapLinearFilter': 1005,
  51. 'LinearFilter': 1006,
  52. 'LinearMipMapNearestFilter': 1007,
  53. 'LinearMipMapLinearFilter': 1008
  54. }
  55. JSON = 'json'
  56. EXTENSION = '.%s' % JSON
  57. INDENT = 'indent'
  58. MATERIALS = 'materials'
  59. SCENE = 'scene'
  60. VERTICES = 'vertices'
  61. FACES = 'faces'
  62. NORMALS = 'normals'
  63. BONES = 'bones'
  64. UVS = 'uvs'
  65. APPLY_MODIFIERS = 'applyModifiers'
  66. COLORS = 'colors'
  67. MIX_COLORS = 'mixColors'
  68. EXTRA_VGROUPS = 'extraVertexGroups'
  69. INDEX = 'index'
  70. DRAW_CALLS = 'drawcalls'
  71. DC_START = 'start'
  72. DC_COUNT = 'count'
  73. DC_INDEX = 'index'
  74. GROUPS = 'groups'
  75. SCALE = 'scale'
  76. COMPRESSION = 'compression'
  77. MAPS = 'maps'
  78. FRAME_STEP = 'frameStep'
  79. FRAME_INDEX_AS_TIME = 'frameIndexAsTime'
  80. ANIMATION = 'animations'
  81. CLIPS="clips"
  82. KEYFRAMES = 'tracks'
  83. MORPH_TARGETS = 'morphTargets'
  84. MORPH_TARGETS_ANIM = 'morphTargetsAnimation'
  85. BLEND_SHAPES = 'blendShapes'
  86. POSE = 'pose'
  87. REST = 'rest'
  88. SKIN_INDICES = 'skinIndices'
  89. SKIN_WEIGHTS = 'skinWeights'
  90. LOGGING = 'logging'
  91. CAMERAS = 'cameras'
  92. LIGHTS = 'lights'
  93. HIERARCHY = 'hierarchy'
  94. FACE_MATERIALS = 'faceMaterials'
  95. SKINNING = 'skinning'
  96. EXPORT_TEXTURES = 'exportTextures'
  97. EMBED_TEXTURES = 'embedTextures'
  98. TEXTURE_FOLDER = 'textureFolder'
  99. ENABLE_PRECISION = 'enablePrecision'
  100. PRECISION = 'precision'
  101. DEFAULT_PRECISION = 6
  102. CUSTOM_PROPERTIES = 'customProperties'
  103. EMBED_GEOMETRY = 'embedGeometry'
  104. EMBED_ANIMATION = 'embedAnimation'
  105. OFF = 'off'
  106. GLOBAL = 'global'
  107. BUFFER_GEOMETRY = 'BufferGeometry'
  108. GEOMETRY = 'geometry'
  109. GEOMETRY_TYPE = 'geometryType'
  110. INDEX_TYPE = 'indexType'
  111. CRITICAL = 'critical'
  112. ERROR = 'error'
  113. WARNING = 'warning'
  114. INFO = 'info'
  115. DEBUG = 'debug'
  116. DISABLED = 'disabled'
  117. NONE = 'None'
  118. MSGPACK = 'msgpack'
  119. PACK = 'pack'
  120. FLOAT_32 = 'Float32Array'
  121. UINT_16 = 'Uint16Array'
  122. UINT_32 = 'Uint32Array'
  123. INFLUENCES_PER_VERTEX = 'influencesPerVertex'
  124. EXPORT_OPTIONS = {
  125. FACES: True,
  126. VERTICES: True,
  127. NORMALS: True,
  128. UVS: True,
  129. APPLY_MODIFIERS: True,
  130. COLORS: False,
  131. EXTRA_VGROUPS: '',
  132. INDEX_TYPE: UINT_16,
  133. MATERIALS: False,
  134. FACE_MATERIALS: False,
  135. SCALE: 1,
  136. FRAME_STEP: 1,
  137. FRAME_INDEX_AS_TIME: False,
  138. SCENE: False,
  139. MIX_COLORS: False,
  140. COMPRESSION: None,
  141. MAPS: False,
  142. ANIMATION: OFF,
  143. KEYFRAMES: False,
  144. BONES: False,
  145. SKINNING: False,
  146. MORPH_TARGETS: False,
  147. BLEND_SHAPES: False,
  148. CAMERAS: False,
  149. LIGHTS: False,
  150. HIERARCHY: False,
  151. EXPORT_TEXTURES: True,
  152. EMBED_TEXTURES: False,
  153. TEXTURE_FOLDER: '',
  154. LOGGING: DEBUG,
  155. ENABLE_PRECISION: False,
  156. PRECISION: DEFAULT_PRECISION,
  157. CUSTOM_PROPERTIES: False,
  158. EMBED_GEOMETRY: True,
  159. EMBED_ANIMATION: True,
  160. GEOMETRY_TYPE: BUFFER_GEOMETRY,
  161. INFLUENCES_PER_VERTEX: 2,
  162. INDENT: True
  163. }
  164. FORMAT_VERSION = 4.4
  165. VERSION = 'version'
  166. THREE = 'io_three'
  167. GENERATOR = 'generator'
  168. SOURCE_FILE = 'sourceFile'
  169. VALID_DATA_TYPES = (str, int, float, bool, list, tuple, dict)
  170. JSON = 'json'
  171. GZIP = 'gzip'
  172. EXTENSIONS = {
  173. JSON: '.json',
  174. MSGPACK: '.pack',
  175. GZIP: '.gz'
  176. }
  177. METADATA = 'metadata'
  178. GEOMETRIES = 'geometries'
  179. IMAGES = 'images'
  180. TEXTURE = 'texture'
  181. TEXTURES = 'textures'
  182. USER_DATA = 'userData'
  183. DATA = 'data'
  184. TYPE = 'type'
  185. MATERIAL = 'material'
  186. OBJECT = 'object'
  187. PERSPECTIVE_CAMERA = 'PerspectiveCamera'
  188. ORTHOGRAPHIC_CAMERA = 'OrthographicCamera'
  189. AMBIENT_LIGHT = 'AmbientLight'
  190. DIRECTIONAL_LIGHT = 'DirectionalLight'
  191. POINT_LIGHT = 'PointLight'
  192. SPOT_LIGHT = 'SpotLight'
  193. # TODO (abelnation): confirm this is correct area light string for exporter
  194. RECT_AREA_LIGHT = 'RectAreaLight'
  195. HEMISPHERE_LIGHT = 'HemisphereLight'
  196. # TODO: RectAreaLight support
  197. MESH = 'Mesh'
  198. EMPTY = 'Empty'
  199. SPRITE = 'Sprite'
  200. DEFAULT_METADATA = {
  201. VERSION: FORMAT_VERSION,
  202. TYPE: OBJECT.title(),
  203. GENERATOR: THREE
  204. }
  205. UUID = 'uuid'
  206. MATRIX = 'matrix'
  207. POSITION = 'position'
  208. QUATERNION = 'quaternion'
  209. ROTATION = 'rotation'
  210. SCALE = 'scale'
  211. UV = 'uv'
  212. UV2 = 'uv2'
  213. ATTRIBUTES = 'attributes'
  214. NORMAL = 'normal'
  215. ITEM_SIZE = 'itemSize'
  216. ARRAY = 'array'
  217. VISIBLE = 'visible'
  218. CAST_SHADOW = 'castShadow'
  219. RECEIVE_SHADOW = 'receiveShadow'
  220. QUAD = 'quad'
  221. MASK = {
  222. QUAD: 0,
  223. MATERIALS: 1,
  224. UVS: 3,
  225. NORMALS: 5,
  226. COLORS: 7
  227. }
  228. CHILDREN = 'children'
  229. URL = 'url'
  230. WRAP = 'wrap'
  231. REPEAT = 'repeat'
  232. WRAPPING = type('Wrapping', (), {
  233. 'REPEAT': 'repeat',
  234. 'CLAMP': 'clamp',
  235. 'MIRROR': 'mirror'
  236. })
  237. ANISOTROPY = 'anisotropy'
  238. MAG_FILTER = 'magFilter'
  239. MIN_FILTER = 'minFilter'
  240. MAPPING = 'mapping'
  241. IMAGE = 'image'
  242. NAME = 'name'
  243. PARENT = 'parent'
  244. LENGTH = 'length'
  245. FPS = 'fps'
  246. HIERARCHY = 'hierarchy'
  247. POS = 'pos'
  248. ROTQ = 'rotq'
  249. ROT = 'rot'
  250. SCL = 'scl'
  251. TIME = 'time'
  252. KEYS = 'keys'
  253. COLOR = 'color'
  254. EMISSIVE = 'emissive'
  255. SPECULAR = 'specular'
  256. SPECULAR_COEF = 'specularCoef'
  257. SHININESS = 'shininess'
  258. SIDE = 'side'
  259. OPACITY = 'opacity'
  260. TRANSPARENT = 'transparent'
  261. WIREFRAME = 'wireframe'
  262. BLENDING = 'blending'
  263. VERTEX_COLORS = 'vertexColors'
  264. DEPTH_WRITE = 'depthWrite'
  265. DEPTH_TEST = 'depthTest'
  266. MAP = 'map'
  267. SPECULAR_MAP = 'specularMap'
  268. LIGHT_MAP = 'lightMap'
  269. BUMP_MAP = 'bumpMap'
  270. BUMP_SCALE = 'bumpScale'
  271. NORMAL_MAP = 'normalMap'
  272. NORMAL_SCALE = 'normalScale'
  273. #@TODO ENV_MAP, REFLECTIVITY, REFRACTION_RATIO, COMBINE
  274. MAP_DIFFUSE = 'mapDiffuse'
  275. MAP_DIFFUSE_REPEAT = 'mapDiffuseRepeat'
  276. MAP_DIFFUSE_WRAP = 'mapDiffuseWrap'
  277. MAP_DIFFUSE_ANISOTROPY = 'mapDiffuseAnisotropy'
  278. MAP_SPECULAR = 'mapSpecular'
  279. MAP_SPECULAR_REPEAT = 'mapSpecularRepeat'
  280. MAP_SPECULAR_WRAP = 'mapSpecularWrap'
  281. MAP_SPECULAR_ANISOTROPY = 'mapSpecularAnisotropy'
  282. MAP_LIGHT = 'mapLight'
  283. MAP_LIGHT_REPEAT = 'mapLightRepeat'
  284. MAP_LIGHT_WRAP = 'mapLightWrap'
  285. MAP_LIGHT_ANISOTROPY = 'mapLightAnisotropy'
  286. MAP_NORMAL = 'mapNormal'
  287. MAP_NORMAL_FACTOR = 'mapNormalFactor'
  288. MAP_NORMAL_REPEAT = 'mapNormalRepeat'
  289. MAP_NORMAL_WRAP = 'mapNormalWrap'
  290. MAP_NORMAL_ANISOTROPY = 'mapNormalAnisotropy'
  291. MAP_BUMP = 'mapBump'
  292. MAP_BUMP_REPEAT = 'mapBumpRepeat'
  293. MAP_BUMP_WRAP = 'mapBumpWrap'
  294. MAP_BUMP_ANISOTROPY = 'mapBumpAnisotropy'
  295. MAP_BUMP_SCALE = 'mapBumpScale'
  296. NORMAL_BLENDING = 0
  297. VERTEX_COLORS_ON = 2
  298. VERTEX_COLORS_OFF = 0
  299. SIDE_DOUBLE = 2
  300. THREE_BASIC = 'MeshBasicMaterial'
  301. THREE_LAMBERT = 'MeshLambertMaterial'
  302. THREE_PHONG = 'MeshPhongMaterial'
  303. INTENSITY = 'intensity'
  304. DISTANCE = 'distance'
  305. ANGLE = 'angle'
  306. DECAY = 'decayExponent'
  307. FOV = 'fov'
  308. ASPECT = 'aspect'
  309. NEAR = 'near'
  310. FAR = 'far'
  311. LEFT = 'left'
  312. RIGHT = 'right'
  313. TOP = 'top'
  314. BOTTOM = 'bottom'
  315. SHADING = 'shading'
  316. COLOR_DIFFUSE = 'colorDiffuse'
  317. COLOR_EMISSIVE = 'colorEmissive'
  318. COLOR_SPECULAR = 'colorSpecular'
  319. DBG_NAME = 'DbgName'
  320. DBG_COLOR = 'DbgColor'
  321. DBG_INDEX = 'DbgIndex'
  322. EMIT = 'emit'
  323. PHONG = 'phong'
  324. LAMBERT = 'lambert'
  325. BASIC = 'basic'
  326. NORMAL_BLENDING = 'NormalBlending'
  327. DBG_COLORS = (0xeeeeee, 0xee0000, 0x00ee00, 0x0000ee,
  328. 0xeeee00, 0x00eeee, 0xee00ee)
  329. DOUBLE_SIDED = 'doubleSided'
  330. EXPORT_SETTINGS_KEY = 'threeExportSettings'
  331. # flips vectors
  332. XZ_Y = "XZ_Y"
  333. X_ZY = "X_ZY"
  334. XYZ = "XYZ"
  335. _XY_Z = "_XY_Z"