Exemplo n.º 1
0
def getVersionComment(assetVersion, originalFileName):
    # Gets the comment of that version from the .nodeInfo file.

    filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(originalFileName)))
    checkInDest = amu.getCheckinDest(filePath)

    return amu.getVersionComment(checkInDest, assetVersion)
Exemplo n.º 2
0
def getCheckoutDest(coPath):
	# Returns the checkout destination path - inside the user's directory.

	nodeInfo = ConfigParser()
	nodeInfo.read(os.path.join(coPath, ".nodeInfo"))
	version = nodeInfo.get("Versioning", "latestversion")
	return os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(coPath))+"_"+os.path.basename(coPath)+"_"+("%03d" % int(version)))
Exemplo n.º 3
0
def getAssetName(originalFileName):
    # Precondition: filePath is a valid path to a asset currently checked out.
    # Returns the name of the asset split from the path.
    filePath = os.path.join(
        amu.getUserCheckoutDir(),
        os.path.basename(os.path.dirname(originalFileName)))
    checkinDest = amu.getCheckinDest(filePath)
    return os.path.basename(os.path.dirname(checkinDest))
Exemplo n.º 4
0
def getAssetVersions(originalFileName):

    filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(originalFileName)))
    checkInDest = amu.getCheckinDest(filePath)
    versionFolders = os.path.join(checkInDest, "src")
    selections = glob.glob(os.path.join(versionFolders, '*'))
    for i in range(0, len(selections)):
        selections[i] = os.path.basename(selections[i]) # Strip the path so its just the version number.
    return selections
Exemplo n.º 5
0
def getVersionComment(assetVersion, originalFileName):
    # Gets the comment of that version from the .nodeInfo file.

    filePath = os.path.join(
        amu.getUserCheckoutDir(),
        os.path.basename(os.path.dirname(originalFileName)))
    checkInDest = amu.getCheckinDest(filePath)

    return amu.getVersionComment(checkInDest, assetVersion)
Exemplo n.º 6
0
def getCheckoutDest(coPath):
    # Returns the checkout destination path - inside the user's directory.

    nodeInfo = ConfigParser()
    nodeInfo.read(os.path.join(coPath, ".nodeInfo"))
    version = nodeInfo.get("Versioning", "latestversion")
    return os.path.join(
        amu.getUserCheckoutDir(),
        os.path.basename(os.path.dirname(coPath)) + "_" +
        os.path.basename(coPath) + "_" + ("%03d" % int(version)))
Exemplo n.º 7
0
def getAssetVersions(originalFileName):

    filePath = os.path.join(
        amu.getUserCheckoutDir(),
        os.path.basename(os.path.dirname(originalFileName)))
    checkInDest = amu.getCheckinDest(filePath)
    versionFolders = os.path.join(checkInDest, "src")
    selections = glob.glob(os.path.join(versionFolders, '*'))
    for i in range(0, len(selections)):
        selections[i] = os.path.basename(
            selections[i])  # Strip the path so its just the version number.
    return selections
Exemplo n.º 8
0
def rollback(originalFileName, destpath, correctCheckoutDir):
    # Move to the correct checkout directory.
    if not destpath==correctCheckoutDir:
        if os.path.exists(correctCheckoutDir):
            shutil.rmtree(correctCheckoutDir)
        os.rename(destpath, correctCheckoutDir)

    # Return the path to the file name.
    filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(originalFileName)))
    checkinDest = amu.getCheckinDest(filePath)

    return os.path.join(correctCheckoutDir, amu.get_filename(checkinDest))
Exemplo n.º 9
0
def tempSetVersion(originalFileName, version):
    """
    Temporarily sets the 'latest version' as the specified version without deleting later versions
    Returns the version number that we override
    @precondition 'original_file_name' is a valid file name
    """
    # I wanted this to be the originalFileName instead of the path to it, but we need a place to get the pathname.
    filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(originalFileName)))
    print "tempSetVersion filePath: ", filePath
    toCheckout = amu.getCheckinDest(filePath)

    return amu.tempSetVersion(toCheckout, version)
Exemplo n.º 10
0
def tempSetVersion(originalFileName, version):
    """
    Temporarily sets the 'latest version' as the specified version without deleting later versions
    Returns the version number that we override
    @precondition 'original_file_name' is a valid file name
    """
    # I wanted this to be the originalFileName instead of the path to it, but we need a place to get the pathname.
    filePath = os.path.join(
        amu.getUserCheckoutDir(),
        os.path.basename(os.path.dirname(originalFileName)))
    print "tempSetVersion filePath: ", filePath
    toCheckout = amu.getCheckinDest(filePath)

    return amu.tempSetVersion(toCheckout, version)
Exemplo n.º 11
0
def build_alembic_filepath(self, refPath, filePath):
    # This builds the location where the alembic file will be stored. This definitely needs to be moved.
    #Get Shot Directory
    # filePath = cmds.file(q=True, sceneName=True)
    toCheckin = os.path.join(amu.getUserCheckoutDir(),
                             os.path.basename(os.path.dirname(filePath)))
    dest = amu.getCheckinDest(toCheckin)

    #Get Asset Name
    # refPath = cmds.referenceQuery(unicode(ref), filename=True)
    assetName = os.path.basename(refPath).split('.')[0]

    return os.path.join(os.path.dirname(dest), 'animation_cache', 'abc',
                        assetName + '.abc')
Exemplo n.º 12
0
def rollback(originalFileName, destpath, correctCheckoutDir):
    # Move to the correct checkout directory.
    if not destpath == correctCheckoutDir:
        if os.path.exists(correctCheckoutDir):
            shutil.rmtree(correctCheckoutDir)
        os.rename(destpath, correctCheckoutDir)

    # Return the path to the file name.
    filePath = os.path.join(
        amu.getUserCheckoutDir(),
        os.path.basename(os.path.dirname(originalFileName)))
    checkinDest = amu.getCheckinDest(filePath)

    return os.path.join(correctCheckoutDir, amu.get_filename(checkinDest))
Exemplo n.º 13
0
def discard(filePath):
	"""
	Discards a local checked out folder without creating a new version.
	"""

	toDiscard = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath)))
	print "toDiscard: ", toDiscard
	chkoutInfo = ConfigParser()
	chkoutInfo.read(os.path.join(toDiscard, ".checkoutInfo"))
	chkInDest = chkoutInfo.get("Checkout", "checkedoutfrom")

	nodeInfo = ConfigParser()
	nodeInfo.read(os.path.join(chkInDest, ".nodeInfo"))

	nodeInfo.set("Versioning", "locked", "False")
	amu._writeConfigFile(os.path.join(chkInDest, ".nodeInfo"), nodeInfo)

	shutil.rmtree(toDiscard)
	if(os.path.exists(toDiscard)):
		os.rmdir(toDiscard)
Exemplo n.º 14
0
def getAssetType(originalFileName):
    # This gets back the file's asset type. Necessary for buttons that don't have a context(menus) to help us know, like rollback.

    filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(originalFileName)))
    toCheckin = amu.getCheckinDest(filePath)
    print "toCheckout: ", toCheckin

    # Need to distinguish between previs and animation. These are actually located on the third directory up, not the most recent one.

    assetType = os.path.basename(toCheckin).capitalize() # Prepping this for checking out.

    if assetType == 'Model' or assetType == 'Rig':
        return assetType
    else:
        # Otherwise check if it is Previs.
        assetType = os.path.basename(os.path.dirname(os.path.dirname(toCheckin))).capitalize()
        if assetType == 'Previs':
            return assetType
        else:
            return 'Animation'
Exemplo n.º 15
0
def discard(filePath):
    """
	Discards a local checked out folder without creating a new version.
	"""

    toDiscard = os.path.join(amu.getUserCheckoutDir(),
                             os.path.basename(os.path.dirname(filePath)))
    print "toDiscard: ", toDiscard
    chkoutInfo = ConfigParser()
    chkoutInfo.read(os.path.join(toDiscard, ".checkoutInfo"))
    chkInDest = chkoutInfo.get("Checkout", "checkedoutfrom")

    nodeInfo = ConfigParser()
    nodeInfo.read(os.path.join(chkInDest, ".nodeInfo"))

    nodeInfo.set("Versioning", "locked", "False")
    amu._writeConfigFile(os.path.join(chkInDest, ".nodeInfo"), nodeInfo)

    shutil.rmtree(toDiscard)
    if (os.path.exists(toDiscard)):
        os.rmdir(toDiscard)
Exemplo n.º 16
0
def getAssetType(originalFileName):
    # This gets back the file's asset type. Necessary for buttons that don't have a context(menus) to help us know, like rollback.

    filePath = os.path.join(
        amu.getUserCheckoutDir(),
        os.path.basename(os.path.dirname(originalFileName)))
    toCheckin = amu.getCheckinDest(filePath)
    print "toCheckout: ", toCheckin

    # Need to distinguish between previs and animation. These are actually located on the third directory up, not the most recent one.

    assetType = os.path.basename(
        toCheckin).capitalize()  # Prepping this for checking out.

    if assetType == 'Model' or assetType == 'Rig':
        return assetType
    else:
        # Otherwise check if it is Previs.
        assetType = os.path.basename(
            os.path.dirname(os.path.dirname(toCheckin))).capitalize()
        if assetType == 'Previs':
            return assetType
        else:
            return 'Animation'
Exemplo n.º 17
0
def isCheckedOutByMe(filePath):
    toDiscard = os.path.join(amu.getUserCheckoutDir(),
                             os.path.basename(os.path.dirname(filePath)))

    return amu.isCheckedOutCopyFolder(toDiscard)
Exemplo n.º 18
0
def getCheckinDest(originalFileName):
    filePath = os.path.join(
        amu.getUserCheckoutDir(),
        os.path.basename(os.path.dirname(originalFileName)))
    print "tempSetVersion filePath: ", filePath
    return amu.getCheckinDest(filePath)
Exemplo n.º 19
0
def getAssetName(originalFileName):
    # Precondition: filePath is a valid path to a asset currently checked out.
    # Returns the name of the asset split from the path.
    filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(originalFileName)))
    checkinDest = amu.getCheckinDest(filePath)
    return os.path.basename(os.path.dirname(checkinDest))
Exemplo n.º 20
0
def isCheckedOutByMe(filePath):
	toDiscard = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath)))

	return amu.isCheckedOutCopyFolder(toDiscard)
Exemplo n.º 21
0
def getCheckinDest(originalFileName):
    filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(originalFileName)))
    print "tempSetVersion filePath: ", filePath
    return amu.getCheckinDest(filePath)