constants.py 7.7 KB

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