constants.py 6.8 KB

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