Python:Maya2WRL简单导出脚本(source included)
来源:互联网 发布:电子标书制作软件 编辑:程序博客网 时间:2024/05/29 16:04
可以快速的导出Maya的mesh到wrl格式(For my GF)
例如,上图Tshape所导出wrl为:
#VRML V2.0 utf8 (Converted to ASCII)#Exported from Maya by SU&WEIShape {geometry IndexedFaceSet {coord Coordinate {point [-0.5 -0.5 0.5 -10.5 -0.5 0.5 -1-0.5 0.5 0.5 -10.5 0.5 0.5 -1-0.5 0.5 -0.5 -10.5 0.5 -0.5 -1-0.5 -0.5 -0.5 -10.5 -0.5 -0.5 -1-0.5 -0.5 1.94956040382 -10.5 -0.5 1.94956040382 -10.5 0.5 1.94956040382 -1-0.5 0.5 1.94956040382 -11.39999997616 -0.5 -0.5 -11.39999997616 -0.5 0.5 -11.39999997616 0.5 -0.5 -11.39999997616 0.5 0.5 -1-1.39999997616 -0.5 -0.5 -1-1.39999997616 -0.5 0.5 -1-1.39999997616 0.5 0.5 -1-1.39999997616 0.5 -0.5 -1]}coordIndex [ 8 9 11 -1 9 10 11 -1 2 3 4 -1 3 4 5 -1 4 5 6 -1 5 6 7 -1 0 6 7 -1 0 1 7 -1 12 13 15 -1 12 14 15 -1 16 17 19 -1 17 18 19 -1 0 1 8 -1 1 8 9 -1 1 3 9 -1 3 9 10 -1 2 3 10 -1 2 10 11 -1 0 2 11 -1 0 8 11 -1 1 7 13 -1 7 12 13 -1 5 7 12 -1 5 12 14 -1 3 5 14 -1 3 14 15 -1 1 3 15 -1 1 13 15 -1 0 6 16 -1 0 16 17 -1 0 2 17 -1 2 17 18 -1 2 4 18 -1 4 18 19 -1 4 6 19 -1 6 16 19 -1]}}
source:
from maya.cmds import *import re'''Transport selected mesh into .wrl format and write it to d:\\maya_output.wrl'''# generateprint('Generating WRL...'),buffer = '''#VRML V2.0 utf8 (Converted to ASCII)#Exported from Maya by SU&WEIShape {geometry IndexedFaceSet {coord Coordinate {point ['''numVtx = polyEvaluate(v=1)for i in range(numVtx): pos = pointPosition('.vtx['+str(i)+']') buffer+='\t'*3+str(pos[0])+' '+str(pos[1])+' '+str(pos[2])+' -1\n'buffer+=''']}coordIndex ['''p=re.compile('\[\d*\]')numPoly = polyEvaluate(f=1)for i in range(numPoly): vtxIds = polyListComponentConversion('.f['+str(i)+']',tv=1) vtxIds = filterExpand(vtxIds,ex=1,sm=31) buffer+='\t'*3 for j in vtxIds: id = p.search(j).group() id = id[1:-1] buffer+=' '+id buffer+=' -1'+'\n'buffer+=''']}}'''print('OK')# writeprint(r'Writing to d:\maya_output.wrl...'),f = open(r'd:\maya_output.wrl','w')f.write(buffer)f.close()print('OK')
- Python:Maya2WRL简单导出脚本(source included)
- Voronoi Shader (Source code included)
- 简单Python脚本实现数据导出Excel格式的尝试
- 简单Python脚本实现数据导出Excel格式的尝试
- pppoe驱动双版本...source code included
- Beginning Python - Chapter10 : Batteries included
- python简单脚本1
- python简单脚本2
- CityEngine使用Python脚本导出模型
- python mysql 导出到mongodb脚本
- Angry Birds Clone in Unity 3D (source code included)
- Python 简单数据备份脚本
- 简单的Python脚本实践
- caffe的简单python脚本
- Python常用标准库(batteries included)
- Python简单爬虫导出CSV文件
- 用Py2exe打包Python脚本简单介绍
- python 脚本性能查看简单方式
- 各种常用字符串Hash函数比较
- 截屏必杀技
- android查询指定的程序是否安装上 查询安装包
- Delphi实现高性能的Socket通讯服务器(完成端口模型IOCP)
- Flex 用接口把值传递给子界面
- Python:Maya2WRL简单导出脚本(source included)
- HDU 1003 - Max Sum
- JS仪表盘实现
- Socket编程服务器和客户端(多个客户端可以同时连接一个服务器的同一端口)
- C#实现托盘图标动画
- XML轻松学习手册(5)XML实例解析
- java打印excel
- C转义字符表
- 本人电脑选装软件