Exemplo n.º 1
0
def importCurves(name,
                 identifier,
                 jobInfo,
                 parentXform=None,
                 isConstant=False,
                 nbCurves=1):
    cmds.ExocortexAlembic_profileBegin(
        f="Python.ExocortexAlembic._import.importCurves")
    try:
        topoReader = cmds.createNode("ExocortexAlembicCurves")
        cmds.connectAttr(jobInfo.filenode + ".outFileName",
                         topoReader + ".fileName")
        cmds.connectAttr(jobInfo.timeCtrl + ".outTime", topoReader + ".inTime")
        cmds.setAttr(topoReader + ".identifier", identifier, type="string")

        shape = fnt.alembicCreateNode(name, "nurbsCurve", parentXform)
        cmds.connectAttr(topoReader + ".outCurve[0]", shape + ".create")
        for curve in xrange(1, nbCurves):
            shape = fnt.alembicCreateNode(name + "_" + str(curve),
                                          "nurbsCurve", parentXform)
            cmds.connectAttr(topoReader + ".outCurve[" + str(curve) + "]",
                             shape + ".create")

    except Exception as ex:
        shape = "?importCurves --> exception: \"" + str(
            ex.args) + "\" of type " + str(type(ex))
        apix.MPxCommand.setResult(shape)
    cmds.ExocortexAlembic_profileEnd(
        f="Python.ExocortexAlembic._import.importCurves")
    return shape
Exemplo n.º 2
0
def importPolyMesh(name, identifier, jobInfo, parentXform=None, isConstant=False, useDynTopo=False):
	cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._import.importPolyMesh")

	try:
		reader = ""
		shape  = fnt.alembicCreateNode(name, "mesh", parentXform)
		cmds.sets(shape, e=True, forceElement="initialShadingGroup")

		topoReader = cmds.createNode("ExocortexAlembicPolyMesh")
		cmds.connectAttr(topoReader+".outMesh", shape+".inMesh")
		cmds.connectAttr(jobInfo.filenode+".outFileName", topoReader+".fileName")
		cmds.setAttr(topoReader+".identifier", identifier, type="string")
		cmds.setAttr(topoReader+".normals", jobInfo.useNormals)
		cmds.setAttr(topoReader+".uvs", jobInfo.useUVs)
		if jobInfo.useFaceSets:
			cmds.ExocortexAlembic_createFaceSets(o=shape, f=jobInfo.filename, i=identifier)

		if useDynTopo:
			cmds.connectAttr(jobInfo.timeCtrl+".outTime", topoReader+".inTime")
			reader = topoReader
		elif not isConstant:
			reader = cmds.deformer(shape, type="ExocortexAlembicPolyMeshDeform")[0]
			setupReaderAttribute(reader, identifier, isConstant, jobInfo)

		#if not useDynTopo:
		#	setupReaderAttribute(topoReader, identifier, isConstant, jobInfo)

	except Exception as ex:
		shape = "?importPolyMesh --> exception: \"" + str(ex.args) + "\" of type " + str(type(ex));
		apix.MPxCommand.setResult(shape)
	cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._import.importPolyMesh")
	return shape
Exemplo n.º 3
0
def importCamera(name, identifier, jobInfo, parentXform=None, isConstant=False):
	cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._import.importCamera")
	# TODO: set isConstant properly elsewhere when there are no transforms but are
	# animated attributes
	isConstant = False
	try:
		shape 	= fnt.alembicCreateNode(name, "camera", parentXform)
		reader 	= cmds.createNode("ExocortexAlembicCamera")

		cmds.connectAttr(reader+".focalLength", shape+".focalLength")
		cmds.connectAttr(reader+".focusDistance", shape+".focusDistance")
		cmds.connectAttr(reader+".lensSqueezeRatio", shape+".lensSqueezeRatio")
		cmds.connectAttr(reader+".horizontalFilmAperture", shape+".horizontalFilmAperture")
		cmds.connectAttr(reader+".verticalFilmAperture", shape+".verticalFilmAperture")
		cmds.connectAttr(reader+".horizontalFilmOffset", shape+".horizontalFilmOffset")
		cmds.connectAttr(reader+".verticalFilmOffset", shape+".verticalFilmOffset")
		cmds.connectAttr(reader+".fStop", shape+".fStop")
		cmds.connectAttr(reader+".shutterAngle", shape+".shutterAngle")

		setupReaderAttribute(reader, identifier, isConstant, jobInfo)
	except:
		return [traceback.format_exc()]
	finally:
		cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._import.importCamera")
	return [shape, reader]
Exemplo n.º 4
0
def importPolyMesh(name, identifier, jobInfo, parentXform=None, isConstant=False, useDynTopo=False):
	cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._import.importPolyMesh")

	# TODO: set isConstant properly elsewhere when there are no transforms but are
	# animated attributes
	isConstant = False
	try:
		reader = ""
		shape  = fnt.alembicCreateNode(name, "mesh", parentXform)
		cmds.sets(shape, e=True, forceElement="initialShadingGroup")

		topoReader = cmds.createNode("ExocortexAlembicPolyMesh")
		cmds.connectAttr(topoReader+".outMesh", shape+".inMesh")
		cmds.connectAttr(jobInfo.filenode+".outFileName", topoReader+".fileName")
		cmds.setAttr(topoReader+".identifier", identifier, type="string")
		cmds.setAttr(topoReader+".normals", jobInfo.useNormals)
		cmds.setAttr(topoReader+".uvs", jobInfo.useUVs)
		if jobInfo.useFaceSets:
			cmds.ExocortexAlembic_createFaceSets(o=shape, f=jobInfo.filename, i=identifier)

		if useDynTopo:
			cmds.connectAttr(jobInfo.timeCtrl+".outTime", topoReader+".inTime")
			reader = topoReader
		elif not isConstant:
			reader = cmds.deformer(shape, type="ExocortexAlembicPolyMeshDeform")[0]
			setupReaderAttribute(reader, identifier, isConstant, jobInfo)

		#if not useDynTopo:
		#	setupReaderAttribute(topoReader, identifier, isConstant, jobInfo)

	except:
		return [traceback.format_exc()]
	finally:
		cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._import.importPolyMesh")
	return [shape, reader]
Exemplo n.º 5
0
def importPolyMesh(name, identifier, jobInfo, parentXform=None, isConstant=False, useDynTopo=False):
	cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._import.importPolyMesh")

	try:
		reader = ""
		shape  = fnt.alembicCreateNode(name, "mesh", parentXform)
		cmds.sets(shape, e=True, forceElement="initialShadingGroup")

		topoReader = cmds.createNode("ExocortexAlembicPolyMesh")
		cmds.connectAttr(topoReader+".outMesh", shape+".inMesh")
		cmds.connectAttr(jobInfo.filenode+".outFileName", topoReader+".fileName")
		cmds.setAttr(topoReader+".identifier", identifier, type="string")
		cmds.setAttr(topoReader+".normals", jobInfo.useNormals)
		cmds.setAttr(topoReader+".uvs", jobInfo.useUVs)
		if jobInfo.useFaceSets:
			cmds.ExocortexAlembic_createFaceSets(o=shape, f=jobInfo.filename, i=identifier)

		if useDynTopo:
			cmds.connectAttr(jobInfo.timeCtrl+".outTime", topoReader+".inTime")
			reader = topoReader
		elif not isConstant:
			reader = cmds.deformer(shape, type="ExocortexAlembicPolyMeshDeform")[0]
			setupReaderAttribute(reader, identifier, isConstant, jobInfo)

		#if not useDynTopo:
		#	setupReaderAttribute(topoReader, identifier, isConstant, jobInfo)

	except Exception as ex:
		shape = "?importPolyMesh --> exception: \"" + str(ex.args) + "\" of type " + str(type(ex));
		apix.MPxCommand.setResult(shape)
	cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._import.importPolyMesh")
	return shape
Exemplo n.º 6
0
def importPoints(name,
                 identifier,
                 jobInfo,
                 parentXform=None,
                 isConstant=False):
    try:
        cmds.ExocortexAlembic_profileBegin(
            f="Python.ExocortexAlembic._import.importPoints")
        shape = fnt.alembicCreateNode(name, "particle", parentXform)
        reader = cmds.createNode("ExocortexAlembicPoints")

        cmds.addAttr(shape, ln="rgbPP", dt="vectorArray")
        cmds.addAttr(shape, ln="opacityPP", dt="doubleArray")
        cmds.addAttr(shape, ln="agePP", dt="doubleArray")
        cmds.addAttr(shape, ln="shapeInstanceIdPP", dt="doubleArray")
        cmds.addAttr(shape, ln="orientationPP", dt="vectorArray")
        cmds.connectAttr(reader + ".output[0]", shape + ".newParticles[0]")
        cmds.connectAttr(jobInfo.timeCtrl + ".outTime", shape + ".currentTime")
        cmds.setAttr(shape + ".conserve", 0)

        setupReaderAttribute(reader, identifier, isConstant, jobInfo)
    except Exception as ex:
        shape = "?importPoints --> exception: \"" + str(
            ex.args) + "\" of type " + str(type(ex))
        apix.MPxCommand.setResult(shape)
    cmds.ExocortexAlembic_profileEnd(
        f="Python.ExocortexAlembic._import.importPoints")
    return shape
Exemplo n.º 7
0
def importCamera(name,
                 identifier,
                 jobInfo,
                 parentXform=None,
                 isConstant=False):
    cmds.ExocortexAlembic_profileBegin(
        f="Python.ExocortexAlembic._import.importCamera")
    try:
        shape = fnt.alembicCreateNode(name, "camera", parentXform)
        reader = cmds.createNode("ExocortexAlembicCamera")

        cmds.connectAttr(reader + ".focalLength", shape + ".focalLength")
        cmds.connectAttr(reader + ".focusDistance", shape + ".focusDistance")
        cmds.connectAttr(reader + ".lensSqueezeRatio",
                         shape + ".lensSqueezeRatio")
        cmds.connectAttr(reader + ".horizontalFilmAperture",
                         shape + ".horizontalFilmAperture")
        cmds.connectAttr(reader + ".verticalFilmAperture",
                         shape + ".verticalFilmAperture")
        cmds.connectAttr(reader + ".horizontalFilmOffset",
                         shape + ".horizontalFilmOffset")
        cmds.connectAttr(reader + ".verticalFilmOffset",
                         shape + ".verticalFilmOffset")
        cmds.connectAttr(reader + ".fStop", shape + ".fStop")
        cmds.connectAttr(reader + ".shutterAngle", shape + ".shutterAngle")

        setupReaderAttribute(reader, identifier, isConstant, jobInfo)
    except Exception as ex:
        shape = "?importCamera --> exception: \"" + str(
            ex.args) + "\" of type " + str(type(ex))
        apix.MPxCommand.setResult(shape)
    cmds.ExocortexAlembic_profileEnd(
        f="Python.ExocortexAlembic._import.importCamera")
    return shape
Exemplo n.º 8
0
def importCurves(name, identifier, jobInfo, parentXform=None, isConstant=False, nbCurves=1):
	cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._import.importCurves")
	try:
		topoReader = cmds.createNode("ExocortexAlembicCurves")
		cmds.connectAttr(jobInfo.filenode+".outFileName", topoReader+".fileName")
		cmds.connectAttr(jobInfo.timeCtrl+".outTime", topoReader+".inTime")
		cmds.setAttr(topoReader+".identifier", identifier, type="string")

		shape  = fnt.alembicCreateNode(name, "nurbsCurve", parentXform)
		cmds.connectAttr(topoReader+".outCurve[0]", shape+".create")
		for curve in xrange(1, nbCurves):
			shape  = fnt.alembicCreateNode(name + "_" + str(curve), "nurbsCurve", parentXform)
			cmds.connectAttr(topoReader+".outCurve[" + str(curve) + "]", shape+".create")

	except Exception as ex:
		shape = "?importCurves --> exception: \"" + str(ex.args) + "\" of type " + str(type(ex));
		apix.MPxCommand.setResult(shape)
	cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._import.importCurves")
	return shape
Exemplo n.º 9
0
def importCurves(name, identifier, jobInfo, parentXform=None, isConstant=False, nbCurves=1):
	cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._import.importCurves")
	# TODO: set isConstant properly elsewhere when there are no transforms but are
	# animated attributes
	isConstant = False
	try:
		topoReader = cmds.createNode("ExocortexAlembicCurves")
		cmds.connectAttr(jobInfo.filenode+".outFileName", topoReader+".fileName")
		cmds.connectAttr(jobInfo.timeCtrl+".outTime", topoReader+".inTime")
		cmds.setAttr(topoReader+".identifier", identifier, type="string")

		shape  = fnt.alembicCreateNode(name, "nurbsCurve", parentXform)
		cmds.connectAttr(topoReader+".outCurve[0]", shape+".create")
		for curve in xrange(1, nbCurves):
			shape  = fnt.alembicCreateNode(name + "_" + str(curve), "nurbsCurve", parentXform)
			cmds.connectAttr(topoReader+".outCurve[" + str(curve) + "]", shape+".create")

	except:
		return [traceback.format_exc()]
	finally:
		cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._import.importCurves")
	return [shape, topoReader]
Exemplo n.º 10
0
def importXform(name, identifier, jobInfo, parentXform=None, isConstant=False):
	cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._import.importXform")

	try:
		shape  = fnt.alembicCreateNode(name, "transform", parentXform)
		reader = cmds.createNode("ExocortexAlembicXform")

		cmds.connectAttr(reader+".translate", 		shape+".translate")
		cmds.connectAttr(reader+".rotate", 			shape+".rotate")
		cmds.connectAttr(reader+".scale", 			shape+".scale")
		cmds.connectAttr(reader+".outVisibility",	shape+".visibility")

		setupReaderAttribute(reader, identifier, isConstant, jobInfo)
	except Exception as ex:
		shape = "?importXform --> exception: \"" + str(ex.args) + "\" of type " + str(type(ex));
		apix.MPxCommand.setResult(shape)
	cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._import.importXform")
	return shape
Exemplo n.º 11
0
def importXform(name, identifier, jobInfo, parentXform=None, isConstant=False):
	cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._import.importXform")

	try:
		shape  = fnt.alembicCreateNode(name, "transform", parentXform)
		reader = cmds.createNode("ExocortexAlembicXform")

		cmds.connectAttr(reader+".translate", 		shape+".translate")
		cmds.connectAttr(reader+".rotate", 			shape+".rotate")
		cmds.connectAttr(reader+".scale", 			shape+".scale")
		cmds.connectAttr(reader+".outVisibility",	shape+".visibility")

		setupReaderAttribute(reader, identifier, isConstant, jobInfo)
	except Exception as ex:
		shape = "?importXform --> exception: \"" + str(ex.args) + "\" of type " + str(type(ex));
		apix.MPxCommand.setResult(shape)
	cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._import.importXform")
	return shape
Exemplo n.º 12
0
def importPoints(name, identifier, jobInfo, parentXform=None, isConstant=False):
	try:
		cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._import.importPoints")
		shape  = fnt.alembicCreateNode(name, "particle", parentXform)
		reader = cmds.createNode("ExocortexAlembicPoints")

		cmds.addAttr(shape, ln="rgbPP", dt="vectorArray")
		cmds.addAttr(shape, ln="opacityPP", dt="doubleArray")
		cmds.addAttr(shape, ln="agePP", dt="doubleArray")
		cmds.addAttr(shape, ln="shapeInstanceIdPP", dt="doubleArray")
		cmds.addAttr(shape, ln="orientationPP", dt="vectorArray")
		cmds.connectAttr(reader+".output[0]", shape+".newParticles[0]")
		cmds.connectAttr(jobInfo.timeCtrl+".outTime", shape+".currentTime")
		cmds.setAttr(shape+".conserve", 0)

		setupReaderAttribute(reader, identifier, isConstant, jobInfo)
	except Exception as ex:
		shape = "?importPoints --> exception: \"" + str(ex.args) + "\" of type " + str(type(ex));
		apix.MPxCommand.setResult(shape)
	cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._import.importPoints")
	return shape
Exemplo n.º 13
0
def importXform(name, identifier, jobInfo, parentXform=None, isConstant=False):
	cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._import.importXform")

	# TODO: set isConstant properly elsewhere when there are no transforms but are
	# animated attributes
	isConstant = False
	try:
		shape  = fnt.alembicCreateNode(name, "transform", parentXform)
		reader = cmds.createNode("ExocortexAlembicXform")

		cmds.connectAttr(reader+".translate", 		shape+".translate")
		cmds.connectAttr(reader+".rotate", 			shape+".rotate")
		cmds.connectAttr(reader+".scale", 			shape+".scale")
		cmds.connectAttr(reader+".outVisibility",	shape+".visibility")

		setupReaderAttribute(reader, identifier, isConstant, jobInfo)
	except:
		return [traceback.format_exc()]
	finally:
		cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._import.importXform")
	return [shape, reader]
Exemplo n.º 14
0
def importCamera(name, identifier, jobInfo, parentXform=None, isConstant=False):
	cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._import.importCamera")
	try:
		shape 	= fnt.alembicCreateNode(name, "camera", parentXform)
		reader 	= cmds.createNode("ExocortexAlembicCamera")

		cmds.connectAttr(reader+".focalLength", shape+".focalLength")
		cmds.connectAttr(reader+".focusDistance", shape+".focusDistance")
		cmds.connectAttr(reader+".lensSqueezeRatio", shape+".lensSqueezeRatio")
		cmds.connectAttr(reader+".horizontalFilmAperture", shape+".horizontalFilmAperture")
		cmds.connectAttr(reader+".verticalFilmAperture", shape+".verticalFilmAperture")
		cmds.connectAttr(reader+".horizontalFilmOffset", shape+".horizontalFilmOffset")
		cmds.connectAttr(reader+".verticalFilmOffset", shape+".verticalFilmOffset")
		cmds.connectAttr(reader+".fStop", shape+".fStop")
		cmds.connectAttr(reader+".shutterAngle", shape+".shutterAngle")

		setupReaderAttribute(reader, identifier, isConstant, jobInfo)
	except Exception as ex:
		shape = "?importCamera --> exception: \"" + str(ex.args) + "\" of type " + str(type(ex));
		apix.MPxCommand.setResult(shape)
	cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._import.importCamera")
	return shape
Exemplo n.º 15
0
def importPoints(name, identifier, jobInfo, parentXform=None, isConstant=False):
	# TODO: set isConstant properly elsewhere when there are no transforms but are
	# animated attributes
	isConstant = False
	try:
		cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._import.importPoints")
		shape  = fnt.alembicCreateNode(name, "particle", parentXform)
		reader = cmds.createNode("ExocortexAlembicPoints")

		cmds.addAttr(shape, ln="rgbPP", dt="vectorArray")
		cmds.addAttr(shape, ln="opacityPP", dt="doubleArray")
		cmds.addAttr(shape, ln="agePP", dt="doubleArray")
		cmds.addAttr(shape, ln="shapeInstanceIdPP", dt="doubleArray")
		cmds.addAttr(shape, ln="orientationPP", dt="vectorArray")
		cmds.connectAttr(reader+".output[0]", shape+".newParticles[0]")
		cmds.connectAttr(jobInfo.timeCtrl+".outTime", shape+".currentTime")
		cmds.setAttr(shape+".conserve", 0)

		setupReaderAttribute(reader, identifier, isConstant, jobInfo)
	except:
		return [traceback.format_exc()]
	finally:
		cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._import.importPoints")
	return [shape, reader]