def export_hierarchy_obj(self): """Export the individual meshes in the hierarchy""" file_info = {} # Reverse the geo list so that the deepest geo is deleted first in case there is a geo inside geo geo_list = self.geo_list geo_list.reverse() for self.current_target in geo_list: pm.delete(self.current_target, ch=1) parent = pm.listRelatives(self.current_target, parent=True) pm.parent(self.current_target, w=True) pm.select(self.current_target) path = libFile.linux_path(libFile.join(self.export_dir, self.current_target + ".obj")) # Load the obj plugin cmds.file(path, pr=1, typ="OBJexport", force=1, options="groups=0;ptgroups=0;materials=0;smoothing=0;normals=0", es=1) file_info[self.current_target] = path logger.info("Exporting\n%s" % file_info[self.current_target]) if not self.new_scene and self.cleansing_mode: pm.delete(self.current_target) pm.refresh() else: pm.parent(self.current_target, parent) self.update_progress() # Write the geo file_info self.geo_file_info = file_info
def _import_individual_weights_(self): # Iterate through all the deformers and import the weigths for self.target_deformer in libXml.list_persist(self.import_data["Order"]): # Import weight of cluster weightInfo = libXml.ConvertXmlToDict(libFile.join(self.target_folder, self.file)) if weightInfo['deformerWeight'].has_key("weights"): evalStatment = 'deformerWeights -import -method "index" -deformer "%s" -path "%s" "%s"' % ( self.target_deformer, self.target_folder, self.file) libUtilities.melEval(evalStatment)
def _import_individual_weights_(self): # Iterate through all the deformers and import the weigths for self.target_deformer in self.import_data["Order"]: # Import weight of cluster weightInfo = libFile.load_json(libFile.join(self.target_folder, self.file)) if weightInfo['deformerWeight'].has_key("weights"): evalStatment = 'deformerWeights -import -method "index" -deformer "%s" -path "%s" "%s"' % ( self.target_deformer, self.target_folder, self.file) libUtilities.melEval(evalStatment)
def datapath(self): '''File path to the xml file which contains data relevant to the deformer. This property is used in testing scenarios along with @ref load_data /@ref save_data method. @code import libWeights test = libWeights.Weights() test.folder = r"C:\temp\test" print test.datapath # Result: 'c:/temp/test/info.xml' # @endcode @return joined path of folder and the info xml file ''' return libFile.join(self.folder, "info.xml")
def datapath(self): '''File path to the json file which contains data relevant to the deformer. This property is used in testing scenarios along with @ref load_data /@ref save_data method. @code import libWeights test = libWeights.Weights() test.folder = r"C:\temp\test" print test.datapath # Result: 'c:/temp/test/info.json' # @endcode @return joined path of folder and the info json file ''' return libFile.join(self.folder, "info.json")
def geoListPath(self): """File path which contains information of exported geometery and the associated path.""" return libFile.linux_path(libFile.join(self.export_dir, "geo_list.json"))
def datapath(self): """File path to the json file which contains the hierarchy info.""" return libFile.linux_path(libFile.join(self.export_dir, "hierarchy_info.json"))
def weight_file(self): # Return the weight map file for each blendshape return libFile.join(self.target_folder, self.file)
def target_folder(self): # Create a subfolder with geometry name as the name of the folder if not self._target_folder_: self._target_folder_ = libFile.folder_check(libFile.join(self.folder, str(self.target))) return self._target_folder_
def datapath(self): # File path to the xml file which contains data relevant to the deformer. Here the data is saved in the subfolder This variable is usually used in testing scenarios return libFile.join(self.target_folder, "%sInfo.xml" % self.deformer.capitalize())
to bring about consistency @details This is following documentation on best practice for Pyside in maya http://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/Maya-SDK/files/GUID-66ADA1FF-3E0F-469C-84C7-74CEB36D42EC-htm.html""" from shiboken import wrapInstance import PySide.QtCore as QtCore import PySide.QtGui as QtGui import maya.OpenMayaUI as OpenMayaUI from maya import cmds from pymel.internal.plogging import pymelLogger as pyLog import libFile AppIcon = libFile.join(libFile.current_working_directory(), r"Icons/WinIcon.png") AppLabel = libFile.join(libFile.current_working_directory(), r"Icons/WinLabel.png") # This is a function that is run from your class object to get a handle # to the main Maya window, it uses a combination of the Maya API as well as the SIP module def getMayaMainWindow(): """Setup so that any Pyside window are a child within the maya application""" accessMainWindow = OpenMayaUI.MQtUtil.mainWindow() return wrapInstance(long(accessMainWindow), QtGui.QMainWindow) class QMessageBox(QtGui.QMessageBox): """ Setup up of convience message boxes""" def __init__(self): super(QMessageBox, self).__init__(parent=getMayaMainWindow())
""" from shiboken import wrapInstance import PySide.QtCore as QtCore import PySide.QtGui as QtGui import maya.OpenMayaUI as OpenMayaUI from maya import cmds from PKD_Tools import logger try: import libFile except: from PKD_Tools import libFile AppIcon = libFile.join(libFile.current_working_directory(), r"Icons/WinIcon.png") AppLabel = libFile.join(libFile.current_working_directory(), r"Icons/WinLabel.png") # This is a function that is run from your class object to get a handle # to the main Maya window, it uses a combination of the Maya API as well as the SIP module def getMayaMainWindow(): """Setup so that any Pyside window are a child within the maya application""" accessMainWindow = OpenMayaUI.MQtUtil.mainWindow() return wrapInstance(long(accessMainWindow), QtGui.QMainWindow) class QMessageBox(QtGui.QMessageBox): """ Setup up of convenience message boxes"""
def datapath(self): # File path to the json file which contains data relevant to the deformer. Here the data is saved in the subfolder This variable is usually used in testing scenarios return libFile.join(self.target_folder, "%sInfo.json" % self.deformer.capitalize())
def infoPath(self): """Return the @ref libWeights.Weights.data "data" file which exists in the user defined folder""" infoPath = libFile.join(self.folder_path_line.text().strip(), "%sInfo.xml" % self.deformer) return libFile.linux_path(infoPath)