constants.py 7.9 KB

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