mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-08-03 02:00:38 +08:00
Merge pull request #532 from Jiloc/patch-1
integrate maya plugin loading on linux
This commit is contained in:
commit
f29415698d
@ -4,6 +4,7 @@ Draco wrapper for Maya extensions
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import ctypes
|
import ctypes
|
||||||
|
import platform
|
||||||
|
|
||||||
__author__ = "Mattia Pezzano, Federico de Felici, Duccio Lenkowicz"
|
__author__ = "Mattia Pezzano, Federico de Felici, Duccio Lenkowicz"
|
||||||
__version__ = "0.1"
|
__version__ = "0.1"
|
||||||
@ -43,12 +44,17 @@ def array_to_ptr(array, size, ctype):
|
|||||||
carr = (ctype * size)(*array)
|
carr = (ctype * size)(*array)
|
||||||
return ctypes.cast(carr, ctypes.POINTER(ctype))
|
return ctypes.cast(carr, ctypes.POINTER(ctype))
|
||||||
|
|
||||||
# TODO: Add integration for reading Linux lib
|
|
||||||
class Draco:
|
class Draco:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# Lib loading
|
# Lib loading
|
||||||
|
if platform.system() == 'Linux':
|
||||||
|
lib_name = 'libdraco_maya_wrapper.so'
|
||||||
|
else:
|
||||||
|
lib_name = 'draco_maya_wrapper'
|
||||||
|
|
||||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
lib_path = os.path.join(dir_path, 'draco_maya_wrapper')
|
lib_path = os.path.join(dir_path, lib_name)
|
||||||
self.drc_lib = ctypes.CDLL(lib_path)
|
self.drc_lib = ctypes.CDLL(lib_path)
|
||||||
# Mapping decode funct
|
# Mapping decode funct
|
||||||
self.drc_decode = self.drc_lib.drc2py_decode
|
self.drc_decode = self.drc_lib.drc2py_decode
|
||||||
@ -120,4 +126,3 @@ class Draco:
|
|||||||
mesh_ptr = ctypes.byref(mesh)
|
mesh_ptr = ctypes.byref(mesh)
|
||||||
file_ptr = ctypes.c_char_p(file.encode())
|
file_ptr = ctypes.c_char_p(file.encode())
|
||||||
self.drc_encode(mesh_ptr, file_ptr)
|
self.drc_encode(mesh_ptr, file_ptr)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user