constants.py 7.8 KB

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