示例#1
0
def canRename(assetDirPath, newName='__null_asset_path'):
    head, tail = os.path.split(assetDirPath)
    dest = os.path.join(head, newName)
    modelDir = os.path.join(assetDirPath, 'model')
    rigDir = os.path.join(assetDirPath, 'rig')
    if not amu.isCheckedOut(modelDir) and not amu.isCheckedOut(rigDir) and not os.path.exists(dest):
        return True
    return False
def canRename(assetDirPath, newName='__null_asset_path'):
    head, tail = os.path.split(assetDirPath)
    dest = os.path.join(head, newName)
    modelDir = os.path.join(assetDirPath, 'model')
    rigDir = os.path.join(assetDirPath, 'rig')
    if not amu.isCheckedOut(modelDir) and not amu.isCheckedOut(
            rigDir) and not os.path.exists(dest):
        return True
    return False
示例#3
0
def isShotCheckedOut(currentlySelected, currentIndex):
    # Checks to see if a shot can be renamed.
    
    dirPath = buildDirPath(currentIndex)

    coPath = dirPath + currentlySelected + '/animation';
    coPath = str(coPath);
    if not amu.isVersionedFolder(coPath):
        raise Exception("Not a versioned folder.");

    if amu.isCheckedOut(coPath): # If it isn't checkout out, it's free to rename.
        return False
    else:
        return True
def isShotCheckedOut(currentlySelected, currentIndex):
    # Checks to see if a shot can be renamed.

    dirPath = buildDirPath(currentIndex)

    coPath = dirPath + currentlySelected + '/animation'
    coPath = str(coPath)
    if not amu.isVersionedFolder(coPath):
        raise Exception("Not a versioned folder.")

    if amu.isCheckedOut(
            coPath):  # If it isn't checkout out, it's free to rename.
        return False
    else:
        return True
示例#5
0
def cloneShot(src_name, dst_name, currentIndex):

    paths = prepCloneShot(src_name, dst_name, currentIndex)
    src = paths[0]
    dst = paths[1]

    # First, check if the shot isn't checked out.
    if (amu.isCheckedOut(dst)):
        return False

    # I wish we could clean up the ConfigParser code in all of the buttons so that we write to utilities... But it might have to wait.
    src_cfg = ConfigParser()
    dst_cfg = ConfigParser()
    src_cfg.read(os.path.join(src, ".nodeInfo"))
    dst_cfg.read(os.path.join(dst, ".nodeInfo"))
    src_version = amu.getLatestVersion(src)
    dst_version = amu.getLatestVersion(dst)

    src_path = os.path.join(src, "src", 'v' + "%03d" % src_version)
    src_filepath = os.path.join(src_path, src_name + '_animation.mb')
    print dst_version
    dst_path = os.path.join(dst, "src", 'v' + "%03d" % (dst_version + 1))
    os.mkdir(dst_path)
    dst_filepath = os.path.join(dst_path, dst_name + '_animation.mb')
    print 'copying ' + src_filepath + ' to ' + dst_filepath
    shutil.copyfile(src_filepath, dst_filepath)

    # Fix permissions to the file.
    os.system('chmod 774 -R ' + dst_path)
    os.system('chmod 774 ' + dst_filepath)

    #write out new animation info
    timestamp = time.strftime("%a, %d %b %Y %I:%M:%S %p", time.localtime())
    user = amu.getUsername()
    comment = 'copied from ' + src_name
    dst_cfg.set("Versioning", "lastcheckintime", timestamp)
    dst_cfg.set("Versioning", "lastcheckinuser", user)
    dst_cfg.set("Versioning", "latestversion", str(dst_version + 1))
    commentLine = user + ': ' + timestamp + ': ' + '"' + comment + '"'
    dst_cfg.set("Comments", 'v' + "%03d" % (dst_version + 1, ), commentLine)
    amu._writeConfigFile(os.path.join(dst, ".nodeInfo"), dst_cfg)
    return True
示例#6
0
def cloneShot(src_name, dst_name, currentIndex):

    paths = prepCloneShot(src_name, dst_name, currentIndex)
    src = paths[0]
    dst = paths[1]

    # First, check if the shot isn't checked out.
    if (amu.isCheckedOut(dst)):
        return False

    # I wish we could clean up the ConfigParser code in all of the buttons so that we write to utilities... But it might have to wait.
    src_cfg = ConfigParser()
    dst_cfg = ConfigParser()
    src_cfg.read(os.path.join(src, ".nodeInfo"))
    dst_cfg.read(os.path.join(dst, ".nodeInfo"))
    src_version = amu.getLatestVersion(src)
    dst_version = amu.getLatestVersion(dst)

    src_path = os.path.join(src, "src", 'v'+"%03d" % src_version)
    src_filepath = os.path.join(src_path, src_name+'_animation.mb')
    print dst_version
    dst_path = os.path.join(dst, "src", 'v'+"%03d" % (dst_version+1))
    os.mkdir(dst_path)
    dst_filepath = os.path.join(dst_path, dst_name+'_animation.mb')
    print 'copying '+src_filepath+' to '+dst_filepath
    shutil.copyfile(src_filepath, dst_filepath)

    # Fix permissions to the file.
    os.system('chmod 774 -R ' + dst_path)
    os.system('chmod 774 '+ dst_filepath)

    #write out new animation info
    timestamp = time.strftime("%a, %d %b %Y %I:%M:%S %p", time.localtime())
    user = amu.getUsername()
    comment = 'copied from '+src_name
    dst_cfg.set("Versioning", "lastcheckintime", timestamp)
    dst_cfg.set("Versioning", "lastcheckinuser", user)
    dst_cfg.set("Versioning", "latestversion", str(dst_version+1))
    commentLine = user + ': ' + timestamp + ': ' + '"' + comment + '"' 
    dst_cfg.set("Comments", 'v' + "%03d" % (dst_version+1,), commentLine)   
    amu._writeConfigFile(os.path.join(dst, ".nodeInfo"), dst_cfg)
    return True