Example #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)
Example #2
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))
Example #3
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)
Example #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
Example #5
0
def getVersions(self, origFileName):
	# Gets the version numbers available to rollback. 
    filePath = os.path.join(getItemsDAO.getUserCheckoutDir(self), os.path.basename(os.path.dirname(origFileName)))
    checkInDest = amu.getCheckinDest(filePath)
    versionFolders = os.path.join(checkInDest, "src")
    selection = glob.glob(os.path.join(versionFolders, '*'))
    for s in range(0, len(selection)):
    	selection[s] = os.path.basename(selection[s]) # Strip off the path for the moment.

    return selection
Example #6
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
Example #7
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))
Example #8
0
def getVersions(self, origFileName):
    # Gets the version numbers available to rollback.
    filePath = os.path.join(getItemsDAO.getUserCheckoutDir(self),
                            os.path.basename(os.path.dirname(origFileName)))
    checkInDest = amu.getCheckinDest(filePath)
    versionFolders = os.path.join(checkInDest, "src")
    selection = glob.glob(os.path.join(versionFolders, '*'))
    for s in range(0, len(selection)):
        selection[s] = os.path.basename(
            selection[s])  # Strip off the path for the moment.

    return selection
Example #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)
Example #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)
Example #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')
Example #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))
Example #13
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'
Example #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'
Example #15
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))
Example #16
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)
Example #17
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)