Beispiel #1
0
def exportAlembicCache(out_path='', asset_list=[], in_frame=101, out_frame=201, step=1):
	""" exports the alembic cache to a preconfigured location """
	job_strings = []
	print asset_list

	for a in asset_list:
		cache_set = (a+':CACHEset')
		try:
			obj_list = cmds.sets(str(cache_set),q=1)
		except:
			obj_list = ()
		obj_str= ','.join(obj_list)
		out_filename = os.path.basename(out_path)+'_'+a+'.abc'
		asset_out_path = os.path.join(out_path,out_filename)
		try: 
			os.makedirs(os.path.join(out_path))
		except OSError:
			if not os.path.isdir(os.path.join(out_path)):
				raise

		job_str = ('filename='+asset_out_path+';')
		job_str += ('objects='+obj_str+';')
		job_str += ('uvs=0;')
		job_str += ('globalspace=1;')
		job_str += ('withouthierarchy=1;')
		job_str += ('in='+in_frame+';')
		job_str += ('out='+out_frame+';')
		job_str += ('step='+step+';')
		job_str += ('ogawa=1')
		job_strings.append(job_str)
	cmds.ExocortexAlembic_export(j=job_strings)
	writeAssetDetails(out_path)
Beispiel #2
0
def doIt(filename,
         exInframe,
         exOutframe,
         exObjects=None,
         exStepframe=1,
         exSubstepframe=1,
         exTopology=3,
         exUVs=True,
         exFaceSets=True,
         exDynTopo=False,
         exGlobSpace=False,
         exWithoutHierarchy=False,
         exXformCache=False,
         exUseInitShadGrp=False,
         exUseOgawa=False):
    """
	Set up the string parameter for ExocortexAlembic_export
	"""
    def doIt_listExportObjects(exObjects):
        objs = str(exObjects[0])
        for obj in exObjects[1:]:
            objs = objs + "," + str(obj)
        return objs

    cmds.ExocortexAlembic_profileBegin(
        f="Python.ExocortexAlembic._export.doIt")
    if exObjects == None:
        exObjects = cmds.ls(sl=True)
    job = "in=" + str(exInframe) + ";out=" + str(exOutframe) + ";step=" + str(
        exStepframe) + ";substep=" + str(
            exSubstepframe) + ";filename=" + filename + ";objects=" + (
                doIt_listExportObjects(exObjects)) + ";ogawa=" + str(
                    int(exUseOgawa))

    if exTopology == 1:
        job += ";purepointcache=1;dynamictopology=0;normals=0;uvs=0;facesets=0"
    else:
        job += ";purepointcache=0;uvs=" + str(int(exUVs))
        job += ";facesets="  #+str(int(exFaceSets)) # move this in the if/else just below
        if exFaceSets:
            job += "1;useInitShadGrp=" + str(int(exUseInitShadGrp))
        else:
            job += "0"

        if exTopology == 2:
            job += ";normals=0;dynamictopology=0"
        else:
            job += ";normals=1;dynamictopology=" + str(int(exDynTopo))

    job += ";globalspace=" + str(int(exGlobSpace))
    job += ";withouthierarchy=" + str(int(exWithoutHierarchy))
    job += ";transformcache=" + str(int(exXformCache))

    cmds.ExocortexAlembic_export(j=job)
    cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._export.doIt")
Beispiel #3
0
def export_exocortex_abc(filename,
                         start,
                         end,
                         objects,
                         uvs=1,
                         facesets=0,
                         purepointcache=0,
                         ogawa=1):
    """
    :param filename: abc path
    :param start: start frame
    :param end: end frame
    :param objects: transform list, must transform node, not shape node
    :param uvs: whether export uv
    :param facesets: whether export facesets
    :return:
    """
    if isinstance(object, basestring):
        objects = [objects]
    file_dir = os.path.dirname(filename)
    if not os.path.isdir(file_dir):
        os.makedirs(file_dir)
    file_name_str = "filename=%s" % filename
    in_str = "in=%s" % start
    out_str = "out=%s" % end
    uvs_str = "uvs=%s" % uvs
    facesets_str = "facesets=%s" % facesets
    purepointcache_str = "purepointcache=%s" % purepointcache
    ogawa_str = "ogawa=%s" % ogawa
    objects_str = "objects=%s" % ",".join(objects)
    j_list = [
        file_name_str, in_str, out_str, uvs_str, facesets_str,
        purepointcache_str, ogawa_str, objects_str
    ]
    j_str = ";".join(j_list)
    print j_str
    mc.ExocortexAlembic_export(j=[j_str])