constants.py 7.5 KB

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