constants.py 7.8 KB

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