-
大小: 18KB文件類型: .zip金幣: 2下載: 0 次發(fā)布日期: 2021-06-12
- 語言: 其他
- 標(biāo)簽: MayaThreejs??
資源簡(jiǎn)介
可以導(dǎo)出maya骨骼動(dòng)畫到three.js 的插件,親測(cè)可用,maya版本最好在2015以后,版本太低會(huì)出現(xiàn)其他問題。可以

代碼片段和文件信息
__author__?=?‘Sean?Griffin‘
__version__?=?‘1.0.1‘
__email__?=?‘sean@thoughtbot.com‘
import?sys
import?os.path
import?json
import?shutil
from?pymel.core?import?*
from?maya.OpenMaya?import?*
from?maya.OpenMayaMPx?import?*
kPluginTranslatorTypeName?=?‘Three.js‘
kOptionscript?=?‘ThreeJsExportscript‘
kDefaultOptionsString?=?‘0‘
FLOAT_PRECISION?=?8
class?ThreeJsWriter(object):
????def?__init__(self):
????????self.componentKeys?=?[‘vertices‘?‘normals‘?‘colors‘?‘uvs‘?‘faces‘
????????????????‘materials‘?‘diffuseMaps‘?‘specularMaps‘?‘bumpMaps‘?‘copyTextures‘
????????????????‘bones‘?‘skeletalAnim‘?‘bakeAnimations‘?‘prettyOutput‘]
????def?write(self?path?optionString?accessMode):
????????self.path?=?path
????????self._parseOptions(optionString)
????????self.verticeOffset?=?0
????????self.uvOffset?=?0
????????self.normalOffset?=?0
????????self.vertices?=?[]
????????self.materials?=?[]
????????self.faces?=?[]
????????self.normals?=?[]
????????self.uvs?=?[]
????????self.morphTargets?=?[]
????????self.bones?=?[]
????????self.animations?=?[]
????????self.skinIndices?=?[]
????????self.skinWeights?=?[]
????????if?self.options[“bakeAnimations“]:
????????????print(“exporting?animations“)
????????????self._exportAnimations()
????????????self._goToframe(self.options[“startframe“])
????????if?self.options[“materials“]:
????????????print(“exporting?materials“)
????????????self._exportMaterials()
????????if?self.options[“bones“]:
????????????print(“exporting?bones“)
????????????select(map(lambda?m:?m.getParent()?ls(type=‘mesh‘)))
????????????runtime.GoToBindPose()
????????????self._exportBones()
????????????print(“exporting?skins“)
????????????self._exportSkins()
????????print(“exporting?meshes“)
????????self._exportMeshes()
????????if?self.options[“skeletalAnim“]:
????????????print(“exporting?keyframe?animations“)
????????????self._exportKeyframeAnimations()
????????print(“writing?file“)
????????output?=?{
????????????‘metadata‘:?{
????????????????‘formatVersion‘:?3.1
????????????????‘generatedBy‘:?‘Maya?Exporter‘
????????????}
????????????‘vertices‘:?self.vertices
????????????‘uvs‘:?[self.uvs]
????????????‘faces‘:?self.faces
????????????‘normals‘:?self.normals
????????????‘materials‘:?self.materials
????????}
????????if?self.options[‘bakeAnimations‘]:
????????????output[‘morphTargets‘]?=?self.morphTargets
????????if?self.options[‘bones‘]:
????????????output[‘bones‘]?=?self.bones
????????????output[‘skinIndices‘]?=?self.skinIndices
????????????output[‘skinWeights‘]?=?self.skinWeights
????????????output[‘influencesPerVertex‘]?=?self.options[“influencesPerVertex“]
????????if?self.options[‘skeletalAnim‘]:
????????????output[‘a(chǎn)nimations‘]?=?self.animations
????????with?file(path?‘w‘)?as?f:
????????????if?self.options[‘prettyOutput‘]:
????????????????f.write(json.dumps(output?sort_keys=True?indent=4?separators=(‘‘?‘:?‘)))
????????????else:
????????????????f.write(json.dumps(output?separators=(“““:“)))
????def?_allMeshes(self):
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-09-21?16:12??修改后的Maya導(dǎo)出THREE.js插件\
?????文件???????14647??2016-09-21?16:12??修改后的Maya導(dǎo)出THREE.js插件\Maya?Exporter?注意事項(xiàng).docx
?????目錄???????????0??2016-09-17?21:51??修改后的Maya導(dǎo)出THREE.js插件\plug-ins\
?????文件???????16688??2016-09-21?15:20??修改后的Maya導(dǎo)出THREE.js插件\plug-ins\threeJsFileTranslator.py
?????目錄???????????0??2016-09-17?21:51??修改后的Maya導(dǎo)出THREE.js插件\sc
?????文件????????4395??2016-07-14?19:16??修改后的Maya導(dǎo)出THREE.js插件\sc
評(píng)論
共有 條評(píng)論