constants.py 7.7 KB

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