constants.py 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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. BAKE_KEYFRAMES = 'bake_tracks'
  84. MORPH_TARGETS = 'morphTargets'
  85. MORPH_TARGETS_ANIM = 'morphTargetsAnimation'
  86. BLEND_SHAPES = 'blendShapes'
  87. POSE = 'pose'
  88. REST = 'rest'
  89. SKIN_INDICES = 'skinIndices'
  90. SKIN_WEIGHTS = 'skinWeights'
  91. LOGGING = 'logging'
  92. CAMERAS = 'cameras'
  93. LIGHTS = 'lights'
  94. HIERARCHY = 'hierarchy'
  95. FACE_MATERIALS = 'faceMaterials'
  96. SKINNING = 'skinning'
  97. EXPORT_TEXTURES = 'exportTextures'
  98. EMBED_TEXTURES = 'embedTextures'
  99. TEXTURE_FOLDER = 'textureFolder'
  100. ENABLE_PRECISION = 'enablePrecision'
  101. PRECISION = 'precision'
  102. DEFAULT_PRECISION = 6
  103. CUSTOM_PROPERTIES = 'customProperties'
  104. EMBED_GEOMETRY = 'embedGeometry'
  105. EMBED_ANIMATION = 'embedAnimation'
  106. OFF = 'off'
  107. GLOBAL = 'global'
  108. BUFFER_GEOMETRY = 'BufferGeometry'
  109. GEOMETRY = 'geometry'
  110. GEOMETRY_TYPE = 'geometryType'
  111. INDEX_TYPE = 'indexType'
  112. CRITICAL = 'critical'
  113. ERROR = 'error'
  114. WARNING = 'warning'
  115. INFO = 'info'
  116. DEBUG = 'debug'
  117. DISABLED = 'disabled'
  118. NONE = 'None'
  119. MSGPACK = 'msgpack'
  120. PACK = 'pack'
  121. FLOAT_32 = 'Float32Array'
  122. UINT_16 = 'Uint16Array'
  123. UINT_32 = 'Uint32Array'
  124. INFLUENCES_PER_VERTEX = 'influencesPerVertex'
  125. EXPORT_OPTIONS = {
  126. FACES: True,
  127. VERTICES: True,
  128. NORMALS: True,
  129. UVS: True,
  130. APPLY_MODIFIERS: True,
  131. COLORS: False,
  132. EXTRA_VGROUPS: '',
  133. INDEX_TYPE: UINT_16,
  134. MATERIALS: False,
  135. FACE_MATERIALS: False,
  136. SCALE: 1,
  137. FRAME_STEP: 1,
  138. FRAME_INDEX_AS_TIME: False,
  139. SCENE: False,
  140. MIX_COLORS: False,
  141. COMPRESSION: None,
  142. MAPS: False,
  143. ANIMATION: OFF,
  144. KEYFRAMES: False,
  145. BAKE_KEYFRAMES: False,
  146. BONES: False,
  147. SKINNING: False,
  148. MORPH_TARGETS: False,
  149. BLEND_SHAPES: False,
  150. CAMERAS: False,
  151. LIGHTS: False,
  152. HIERARCHY: False,
  153. EXPORT_TEXTURES: True,
  154. EMBED_TEXTURES: False,
  155. TEXTURE_FOLDER: '',
  156. LOGGING: DEBUG,
  157. ENABLE_PRECISION: False,
  158. PRECISION: DEFAULT_PRECISION,
  159. CUSTOM_PROPERTIES: False,
  160. EMBED_GEOMETRY: True,
  161. EMBED_ANIMATION: True,
  162. GEOMETRY_TYPE: BUFFER_GEOMETRY,
  163. INFLUENCES_PER_VERTEX: 2,
  164. INDENT: True
  165. }
  166. FORMAT_VERSION = 4.4
  167. VERSION = 'version'
  168. THREE = 'io_three'
  169. GENERATOR = 'generator'
  170. SOURCE_FILE = 'sourceFile'
  171. VALID_DATA_TYPES = (str, int, float, bool, list, tuple, dict)
  172. JSON = 'json'
  173. GZIP = 'gzip'
  174. EXTENSIONS = {
  175. JSON: '.json',
  176. MSGPACK: '.pack',
  177. GZIP: '.gz'
  178. }
  179. METADATA = 'metadata'
  180. GEOMETRIES = 'geometries'
  181. IMAGES = 'images'
  182. TEXTURE = 'texture'
  183. TEXTURES = 'textures'
  184. USER_DATA = 'userData'
  185. DATA = 'data'
  186. TYPE = 'type'
  187. MATERIAL = 'material'
  188. OBJECT = 'object'
  189. PERSPECTIVE_CAMERA = 'PerspectiveCamera'
  190. ORTHOGRAPHIC_CAMERA = 'OrthographicCamera'
  191. AMBIENT_LIGHT = 'AmbientLight'
  192. DIRECTIONAL_LIGHT = 'DirectionalLight'
  193. POINT_LIGHT = 'PointLight'
  194. SPOT_LIGHT = 'SpotLight'
  195. # TODO (abelnation): confirm this is correct area light string for exporter
  196. RECT_AREA_LIGHT = 'RectAreaLight'
  197. HEMISPHERE_LIGHT = 'HemisphereLight'
  198. # TODO: RectAreaLight support
  199. MESH = 'Mesh'
  200. EMPTY = 'Empty'
  201. SPRITE = 'Sprite'
  202. DEFAULT_METADATA = {
  203. VERSION: FORMAT_VERSION,
  204. TYPE: OBJECT.title(),
  205. GENERATOR: THREE
  206. }
  207. UUID = 'uuid'
  208. MATRIX = 'matrix'
  209. POSITION = 'position'
  210. QUATERNION = 'quaternion'
  211. ROTATION = 'rotation'
  212. SCALE = 'scale'
  213. UV = 'uv'
  214. UV2 = 'uv2'
  215. ATTRIBUTES = 'attributes'
  216. NORMAL = 'normal'
  217. ITEM_SIZE = 'itemSize'
  218. ARRAY = 'array'
  219. VISIBLE = 'visible'
  220. CAST_SHADOW = 'castShadow'
  221. RECEIVE_SHADOW = 'receiveShadow'
  222. QUAD = 'quad'
  223. MASK = {
  224. QUAD: 0,
  225. MATERIALS: 1,
  226. UVS: 3,
  227. NORMALS: 5,
  228. COLORS: 7
  229. }
  230. CHILDREN = 'children'
  231. URL = 'url'
  232. WRAP = 'wrap'
  233. REPEAT = 'repeat'
  234. WRAPPING = type('Wrapping', (), {
  235. 'REPEAT': 'repeat',
  236. 'CLAMP': 'clamp',
  237. 'MIRROR': 'mirror'
  238. })
  239. ANISOTROPY = 'anisotropy'
  240. MAG_FILTER = 'magFilter'
  241. MIN_FILTER = 'minFilter'
  242. MAPPING = 'mapping'
  243. IMAGE = 'image'
  244. NAME = 'name'
  245. PARENT = 'parent'
  246. LENGTH = 'length'
  247. FPS = 'fps'
  248. HIERARCHY = 'hierarchy'
  249. POS = 'pos'
  250. ROTQ = 'rotq'
  251. ROT = 'rot'
  252. SCL = 'scl'
  253. TIME = 'time'
  254. KEYS = 'keys'
  255. COLOR = 'color'
  256. EMISSIVE = 'emissive'
  257. SPECULAR = 'specular'
  258. SPECULAR_COEF = 'specularCoef'
  259. SHININESS = 'shininess'
  260. SIDE = 'side'
  261. OPACITY = 'opacity'
  262. TRANSPARENT = 'transparent'
  263. WIREFRAME = 'wireframe'
  264. BLENDING = 'blending'
  265. VERTEX_COLORS = 'vertexColors'
  266. DEPTH_WRITE = 'depthWrite'
  267. DEPTH_TEST = 'depthTest'
  268. MAP = 'map'
  269. SPECULAR_MAP = 'specularMap'
  270. LIGHT_MAP = 'lightMap'
  271. BUMP_MAP = 'bumpMap'
  272. BUMP_SCALE = 'bumpScale'
  273. NORMAL_MAP = 'normalMap'
  274. NORMAL_SCALE = 'normalScale'
  275. #@TODO ENV_MAP, REFLECTIVITY, REFRACTION_RATIO, COMBINE
  276. MAP_DIFFUSE = 'mapDiffuse'
  277. MAP_DIFFUSE_REPEAT = 'mapDiffuseRepeat'
  278. MAP_DIFFUSE_WRAP = 'mapDiffuseWrap'
  279. MAP_DIFFUSE_ANISOTROPY = 'mapDiffuseAnisotropy'
  280. MAP_SPECULAR = 'mapSpecular'
  281. MAP_SPECULAR_REPEAT = 'mapSpecularRepeat'
  282. MAP_SPECULAR_WRAP = 'mapSpecularWrap'
  283. MAP_SPECULAR_ANISOTROPY = 'mapSpecularAnisotropy'
  284. MAP_LIGHT = 'mapLight'
  285. MAP_LIGHT_REPEAT = 'mapLightRepeat'
  286. MAP_LIGHT_WRAP = 'mapLightWrap'
  287. MAP_LIGHT_ANISOTROPY = 'mapLightAnisotropy'
  288. MAP_NORMAL = 'mapNormal'
  289. MAP_NORMAL_FACTOR = 'mapNormalFactor'
  290. MAP_NORMAL_REPEAT = 'mapNormalRepeat'
  291. MAP_NORMAL_WRAP = 'mapNormalWrap'
  292. MAP_NORMAL_ANISOTROPY = 'mapNormalAnisotropy'
  293. MAP_BUMP = 'mapBump'
  294. MAP_BUMP_REPEAT = 'mapBumpRepeat'
  295. MAP_BUMP_WRAP = 'mapBumpWrap'
  296. MAP_BUMP_ANISOTROPY = 'mapBumpAnisotropy'
  297. MAP_BUMP_SCALE = 'mapBumpScale'
  298. NORMAL_BLENDING = 0
  299. VERTEX_COLORS_ON = 2
  300. VERTEX_COLORS_OFF = 0
  301. SIDE_DOUBLE = 2
  302. THREE_BASIC = 'MeshBasicMaterial'
  303. THREE_LAMBERT = 'MeshLambertMaterial'
  304. THREE_PHONG = 'MeshPhongMaterial'
  305. INTENSITY = 'intensity'
  306. DISTANCE = 'distance'
  307. ANGLE = 'angle'
  308. DECAY = 'decayExponent'
  309. FOV = 'fov'
  310. ASPECT = 'aspect'
  311. NEAR = 'near'
  312. FAR = 'far'
  313. LEFT = 'left'
  314. RIGHT = 'right'
  315. TOP = 'top'
  316. BOTTOM = 'bottom'
  317. SHADING = 'shading'
  318. COLOR_DIFFUSE = 'colorDiffuse'
  319. COLOR_EMISSIVE = 'colorEmissive'
  320. COLOR_SPECULAR = 'colorSpecular'
  321. DBG_NAME = 'DbgName'
  322. DBG_COLOR = 'DbgColor'
  323. DBG_INDEX = 'DbgIndex'
  324. EMIT = 'emit'
  325. PHONG = 'phong'
  326. LAMBERT = 'lambert'
  327. BASIC = 'basic'
  328. NORMAL_BLENDING = 'NormalBlending'
  329. DBG_COLORS = (0xeeeeee, 0xee0000, 0x00ee00, 0x0000ee,
  330. 0xeeee00, 0x00eeee, 0xee00ee)
  331. DOUBLE_SIDED = 'doubleSided'
  332. EXPORT_SETTINGS_KEY = 'threeExportSettings'
  333. # flips vectors
  334. XZ_Y = "XZ_Y"
  335. X_ZY = "X_ZY"
  336. XYZ = "XYZ"
  337. _XY_Z = "_XY_Z"