mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-06-04 11:25:44 +08:00
File renaming and added maya plugin
This commit is contained in:
parent
0f69ddffb1
commit
07fbd55e44
6
maya/README.md
Normal file
6
maya/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
Description
|
||||
===========
|
||||
|
||||
Plugin which add support for Draco files in Autodesk Maya.
|
||||
Currently is supported drc file import on Windows, from the import menu or by drag & drop
|
||||
|
59
maya/draco_maya.py
Normal file
59
maya/draco_maya.py
Normal file
@ -0,0 +1,59 @@
|
||||
import maya.api.OpenMaya as OpenMaya
|
||||
import maya.OpenMayaMPx as OpenMayaMPx
|
||||
import sys
|
||||
|
||||
__author__ = "Mattia Pezzano, Federico de Felici, Duccio Lenkowicz"
|
||||
__version__ = "0.1"
|
||||
|
||||
class DracoTranslator(OpenMayaMPx.MPxFileTranslator):
|
||||
def __init__(self):
|
||||
OpenMayaMPx.MPxFileTranslator.__init__(self)
|
||||
|
||||
def maya_useNewAPI():
|
||||
pass
|
||||
|
||||
def haveWriteMethod(self):
|
||||
return False
|
||||
|
||||
def haveReadMethod(self):
|
||||
return True
|
||||
|
||||
def filter(self):
|
||||
return "*.drc"
|
||||
|
||||
def defaultExtension(self):
|
||||
return "drc"
|
||||
|
||||
def reader(self, fileObject, optionString, accessMode):
|
||||
print(fileObject.fullName())
|
||||
vertices = [OpenMaya.MPoint(10, 10, 10), OpenMaya.MPoint(-10, -10, -10), OpenMaya.MPoint(0, 10, 0)]
|
||||
indices = [0, 1, 2]
|
||||
polyCount = [3]
|
||||
|
||||
fnMesh = OpenMaya.MFnMesh()
|
||||
newMesh = fnMesh.create(vertices, polyCount, indices)
|
||||
fnMesh.updateSurface()
|
||||
|
||||
def translatorCreator():
|
||||
return OpenMayaMPx.asMPxPtr(DracoTranslator())
|
||||
|
||||
|
||||
def initializePlugin(mobject):
|
||||
print('init')
|
||||
mplugin = OpenMayaMPx.MFnPlugin(
|
||||
mobject, "Autodesk", '0.1', "Any")
|
||||
|
||||
try:
|
||||
mplugin.registerFileTranslator(
|
||||
'drc',
|
||||
None,
|
||||
translatorCreator) # ,
|
||||
# kPluginTranslatorDefaultOptions)
|
||||
|
||||
except Exception as e:
|
||||
sys.stderr.write("Failed to register command: %s\n" %
|
||||
'drc')
|
||||
raise
|
||||
|
||||
def uninitializePlugin(mobject):
|
||||
print('uninit')
|
@ -1,4 +1,4 @@
|
||||
from draco import Draco
|
||||
from dracodec_maya import Draco
|
||||
|
||||
drc = Draco()
|
||||
mesh = drc.decode('bunny.drc')
|
BIN
maya/test_nm_quant.0.9.0.drc
Normal file
BIN
maya/test_nm_quant.0.9.0.drc
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user