资源简介
可以导出maya骨骼动画到three.js 的插件,亲测可用,maya版本最好在2015以后,版本太低会出现其他问题。可以
代码片段和文件信息
__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[‘animations‘] = 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):
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-09-21 16:12 修改后的Maya导出THREE.js插件\
文件 14647 2016-09-21 16:12 修改后的Maya导出THREE.js插件\Maya Exporter 注意事项.docx
目录 0 2016-09-17 21:51 修改后的Maya导出THREE.js插件\plug-ins\
文件 16688 2016-09-21 15:20 修改后的Maya导出THREE.js插件\plug-ins\threeJsFileTranslator.py
目录 0 2016-09-17 21:51 修改后的Maya导出THREE.js插件\sc
文件 4395 2016-07-14 19:16 修改后的Maya导出THREE.js插件\sc
- 上一篇:织梦仿站教程初、中、高级视频,百度云盘
- 下一篇:flappy bird制作资源素材
评论
共有 条评论