Beispiel #1
0
 def import_palette(self, xgen_path, deltas, namespace=None):
     if isinstance(deltas, basestring):
         deltas = [deltas]
     if not os.path.isfile(xgen_path):
         logger.warning("%s is not an exist path." % xgen_path)
         return
     xgen.importPalette(xgen_path, deltas, namespace)
    def _do_import(self):
        """
        Imports the groom into the scene
        """
        # todo: query if is it the last version
        import_folder = self.ui.groom_package_txf.text()
        self.character = self.ui.import_character_cbx.currentText()

        if not import_folder:
            raise ValueError("Import path must be specified")

        # build scene
        mc.loadPlugin('xgenToolkit.mll')

        import_path_folder = import_folder.replace('.zip', '')
        _, groom_asset = os.path.split(import_path_folder)
        xgen_file = [f for f in os.listdir(import_path_folder) if f.endswith('.xgen')][-1]
        xgen_file = os.path.join(import_path_folder, xgen_file).replace('\\', '/')
        map_folder = [os.path.join(import_path_folder, d) for d in os.listdir(import_path_folder) if
                      os.path.isdir(os.path.join(import_path_folder, d))][0]

        # import maya scenes
        mc.file(os.path.join(import_folder, 'scalps.ma'), i=True, type="mayaAscii", ignoreVersion=True,
                mergeNamespacesOnClash=False, gl=True, namespace=self.character, options="v=0", groupReference=False)

        # load mapping
        in_data = dict()
        with open(os.path.join(import_path_folder, 'mapping.json'), 'r') as fp:
            in_data = json.load(fp)

        # import xgen
        try:
            xg.importPalette(fileName=str(xgen_file), deltas=[], nameSpace=str(self.character))
        except Exception:
            LOGGER.warning('Not found maps folder')
        # set path to xgen
        xg.setAttr('xgDataPath', str(map_folder), xg.palettes()[0])

        # todo: remember shader is not imported, it will be imported by the shader import tool

        # Get the description editor first.
        # Changes in the groom itself, guides, and so on
        de = xgg.DescriptionEditor
        #
        #
        #
        #
        # Do a full UI refresh
        de.refresh("Full")
Beispiel #3
0
	# reference geo
	cmds.file('O:/201603_SongOfKnights/Maya/assets/char/assassin_xGen_geoHolder_master.ma', r= 1, typ= 'mayaAscii',  iv= 1, mnc= 1, ns= ':')


	# import geoCache
	cmds.select(cl= 1)
	for geo in geoCollection.keys():
		cmds.select(cmds.ls('*' + geo, r= 1)[0], add= 1)
	moGeoCache.importGeoCache('assassin_' + cutId + '_geoCache_v01', 1, 'assassin')


# import collections
for geo in geoCollection.keys():
	cmds.select(cmds.ls('*' + geo, r= 1)[0], r= 1)
	cmds.setAttr(cmds.ls(sl= 1)[0] + '.v', 0)
	xg.importPalette( geoCollection[geo], [], '' )


# get abc
for disc in hairCacheDisc:
	xg.setAttr( 'cacheFileName', str(hairSimRoot + cutId + '/' + disc + '.abc'), hairColl, disc, 'SplinePrimitive')
	xg.setAttr( 'useCache', 'true', hairColl, disc, 'SplinePrimitive')
	xg.setAttr( 'liveMode', 'false', hairColl, disc, 'SplinePrimitive')

# set renderer
for collection in xg.palettes():
	for disc in xg.descriptions(collection):
		xg.setAttr( 'renderer', 'VRay', collection, disc, 'RendermanRenderer')

# update ui
de = xgg.DescriptionEditor 
Beispiel #4
0
 def importSources(self):
     pm.importFile(self.sourceDirPath / self.scalpGrp + '.ma')
     xg.importPalette(
         str(self.sourceDirPath / self.collection + '.xgen').replace(
             '\\', '/'), '')
     pm.importFile(self.sourceDirPath / self.collection + '_shaders.ma')
Beispiel #5
0
def import_palette(xgen_path, deltas=None, namespace="", wrapPatches=True):
    xgen_path = xgen_path.replace("\\", "/")
    deltas = deltas or []
    return xg.importPalette(str(xgen_path), deltas, str(namespace),
                            bool(wrapPatches))
Beispiel #6
0
        iv=1,
        mnc=1,
        ns=':')

    # import geoCache
    cmds.select(cl=1)
    for geo in geoCollection.keys():
        cmds.select(cmds.ls('*' + geo, r=1)[0], add=1)
    moGeoCache.importGeoCache('assassin_' + cutId + '_geoCache_v01', 1,
                              'assassin')

# import collections
for geo in geoCollection.keys():
    cmds.select(cmds.ls('*' + geo, r=1)[0], r=1)
    cmds.setAttr(cmds.ls(sl=1)[0] + '.v', 0)
    xg.importPalette(geoCollection[geo], [], '')

# get abc
for disc in hairCacheDisc:
    xg.setAttr('cacheFileName', str(hairSimRoot + cutId + '/' + disc + '.abc'),
               hairColl, disc, 'SplinePrimitive')
    xg.setAttr('useCache', 'true', hairColl, disc, 'SplinePrimitive')
    xg.setAttr('liveMode', 'false', hairColl, disc, 'SplinePrimitive')

# set renderer
for collection in xg.palettes():
    for disc in xg.descriptions(collection):
        xg.setAttr('renderer', 'VRay', collection, disc, 'RendermanRenderer')

# update ui
de = xgg.DescriptionEditor