示例#1
0
    def checkout_button_clicked(self):
        version = self.rollback_dialog.get_current_item()[1:]
        filePath = common.get_checkin_path()
        toCheckout = amu.getCheckinDest(filePath)

        latestVersion = amu.tempSetVersion(toCheckout, version)
        amu.discard(filePath)
        try:
            destpath = amu.checkout(toCheckout, True)
        except Exception as e:
            if not amu.checkedOutByMe(toCheckout):
                muke.message(str(e))
                return
            else:
                destpath = amu.getCheckoutDest(toCheckout)

        amu.tempSetVersion(toCheckout, latestVersion)
        # move to correct checkout directory
        correctCheckoutDir = amu.getCheckoutDest(toCheckout)
        if not destpath == correctCheckoutDir:
            if os.path.exists(correctCheckoutDir):
                shutil.rmtree(correctCheckoutDir)
            os.rename(destpath, correctCheckoutDir)
        toOpen = os.path.join(correctCheckoutDir,
                              self.get_filename(toCheckout) + '.nk')
        if not os.path.exists(toOpen):
            # create new file
            nuke.scriptNew()
            nuke.scriptSaveAs(filename=toOpen, overwrite=0)
        else:
            nuke.scriptOpen(toOpen)
        self.rollback_dialog.close()
def go():
    try:
        assetName, assetType, version = geo.decodeFileName()
    except IndexError:
        showErrorDialog()
        return

    if not assetType == 'animation':
        showErrorDialog()
        return

    fileName = mc.file(q=True, sceneName=True)
    dirName = os.path.dirname(fileName)
    source = amu.getCheckinDest(dirName)
    blastPath = os.path.join(os.path.dirname(source), 'playblasts')
    versionNum = amu.getLatestVersion(source)+1
    name = os.path.join(blastPath, assetName+"_v"+("%03d" % versionNum))

    startFrame = mc.playbackOptions(q=True, min=True)
    endFrame = mc.playbackOptions(q=True, max=True)

    choice = mc.confirmDialog( title = 'Playblast Tool'
                              , message       = 'What kind of playblast?'
                              , button        = ['Cancel', 'GL', 'Simple']
                              , defaultButton = 'Simple'
                              , cancelButton  = 'Cancel'
                              , dismissString = 'Cancel')
    if choice == 'Simple':
        simpleBlast(name, startFrame, endFrame)
    elif choice == 'GL':
        glBlast(name, startFrame, endFrame)
示例#3
0
 def populate_list(self):
     filePath = common.get_checkin_path()
     checkInDest = amu.getCheckinDest(filePath)
     versionFolders = os.path.join(checkInDest, "src")
     selections = glob.glob(os.path.join(versionFolders, '*'))
     selections = [os.path.basename(selection) for selection in selections]
     self.rollback_dialog.set_list(selections)
示例#4
0
def checkin():
    print 'checkin'
    saveFile()  # save the file before doing anything
    print 'save'
    filePath = cmds.file(q=True, sceneName=True)
    print 'filePath: ' + filePath
    toCheckin = os.path.join(amu.getUserCheckoutDir(),
                             os.path.basename(os.path.dirname(filePath)))
    print 'toCheckin: ' + toCheckin
    if amu.canCheckin(toCheckin):

        comment = 'Comment'
        commentPrompt = cmds.promptDialog(title='Comment',
                                          message='What changes did you make?',
                                          button=['OK', 'Cancel'],
                                          defaultButton='OK',
                                          dismissString='Cancel',
                                          sf=True)
        if commentPrompt == 'OK':
            comment = cmds.promptDialog(query=True, text=True)
        else:
            return
        amu.setComment(toCheckin, comment)
        dest = amu.getCheckinDest(toCheckin)

        saveFile()
        cmds.file(force=True, new=True)  #open new file
        dest = amu.checkin(toCheckin)  #checkin
    else:
        showFailDialog()
示例#5
0
    def checkout_version(self):
        dialogResult = self.verify_checkout_dialog()
        if(dialogResult == 'Yes'):
            #checkout
            version = str(self.current_item.text())[1:]
            filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(self.ORIGINAL_FILE_NAME)))
            toCheckout = amu.getCheckinDest(filePath)
            
            latestVersion = amu.tempSetVersion(toCheckout, version)
            amu.discard(filePath)
            try:
                destpath = amu.checkout(toCheckout, True)
            except Exception as e:
                if not amu.checkedOutByMe(toCheckout):
                    cmd.confirmDialog(  title          = 'Can Not Checkout'
                                   , message       = str(e)
                                   , button        = ['Ok']
                                   , defaultButton = 'Ok'
                                   , cancelButton  = 'Ok'
                                   , dismissString = 'Ok')
                    return
                else:
                    destpath = amu.getCheckoutDest(toCheckout)

            toOpen = os.path.join(destpath, self.get_filename(toCheckout)+'.mb')
            self.ORIGINAL_FILE_NAME = toOpen
            amu.tempSetVersion(toCheckout, latestVersion)
            if not os.path.exists(toOpen):
                # create new file
                cmd.file(force=True, new=True)
                cmd.file(rename=toOpen)
                cmd.file(save=True, force=True)
            self.close_dialog()
示例#6
0
def go():
    try:
        assetName, assetType, version = geo.decodeFileName()
    except IndexError:
        showErrorDialog()
        return

    if not assetType == 'animation':
        showErrorDialog()
        return

    fileName = mc.file(q=True, sceneName=True)
    dirName = os.path.dirname(fileName)
    source = amu.getCheckinDest(dirName)
    blastPath = os.path.join(os.path.dirname(source), 'playblasts')
    versionNum = amu.getLatestVersion(source) + 1
    name = os.path.join(blastPath, assetName + "_v" + ("%03d" % versionNum))

    startFrame = mc.playbackOptions(q=True, min=True)
    endFrame = mc.playbackOptions(q=True, max=True)

    choice = mc.confirmDialog(title='Playblast Tool',
                              message='What kind of playblast?',
                              button=['Cancel', 'GL', 'Simple'],
                              defaultButton='Simple',
                              cancelButton='Cancel',
                              dismissString='Cancel')
    if choice == 'Simple':
        simpleBlast(name, startFrame, endFrame)
    elif choice == 'GL':
        glBlast(name, startFrame, endFrame)
示例#7
0
def go():
    try:
        assetName, assetType, version = geo.decodeFileName()
    except IndexError:
        showErrorDialog()
        return

    if not assetType == "animation":
        showErrorDialog()
        return

    fileName = mc.file(q=True, sceneName=True)
    dirName = os.path.dirname(fileName)
    source = amu.getCheckinDest(dirName)
    blastPath = os.path.join(os.path.dirname(source), "playblasts")
    name = os.path.join(blastPath, assetName)

    startFrame = mc.playbackOptions(q=True, min=True)
    endFrame = mc.playbackOptions(q=True, max=True)

    choice = mc.confirmDialog(
        title="Playblast Tool",
        message="What kind of playblast?",
        button=["Cancel", "GL", "Simple"],
        defaultButton="Simple",
        cancelButton="Cancel",
        dismissString="Cancel",
    )
    if choice == "Simple":
        simpleBlast(name, startFrame, endFrame)
    elif choice == "GL":
        glBlast(name, startFrame, endFrame)
def go():
    filePath = cmds.file(q=True, sceneName=True)
    toCheckin = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath)))
    toCheckout = amu.getCheckinDest(toCheckin) 
    maya_checkin.checkin()
    try:
        destpath = amu.checkout(toCheckout, True)
    except Exception as e:
        print str(e)
        if not amu.checkedOutByMe(toCheckout):
            cmd.confirmDialog(  title          = 'Can Not Checkout'
                               , message       = str(e)
                               , button        = ['Ok']
                               , defaultButton = 'Ok'
                               , cancelButton  = 'Ok'
                               , dismissString = 'Ok')
            return
        else:
            destpath = amu.getCheckoutDest(toCheckout)
    filename = os.path.basename(os.path.dirname(toCheckout))+'_'+os.path.basename(toCheckout)+'.mb'
    toOpen = os.path.join(destpath, filename)
    # open the file
    if os.path.exists(toOpen):
        cmds.file(toOpen, force=True, open=True)#, loadReferenceDepth="none")
    else:
        # create new file
        cmds.file(force=True, new=True)
        cmds.file(rename=toOpen)
        cmds.viewClipPlane('perspShape', ncp=0.01)
        cmds.file(save=True, force=True)
示例#9
0
def go():
    filePath = cmds.file(q=True, sceneName=True)
    toCheckin = os.path.join(amu.getUserCheckoutDir(),
                             os.path.basename(os.path.dirname(filePath)))
    toCheckout = amu.getCheckinDest(toCheckin)
    maya_checkin.checkin()
    try:
        destpath = amu.checkout(toCheckout, True)
    except Exception as e:
        print str(e)
        if not amu.checkedOutByMe(toCheckout):
            cmd.confirmDialog(title='Can Not Checkout',
                              message=str(e),
                              button=['Ok'],
                              defaultButton='Ok',
                              cancelButton='Ok',
                              dismissString='Ok')
            return
        else:
            destpath = amu.getCheckoutDest(toCheckout)
    filename = os.path.basename(os.path.dirname(
        toCheckout)) + '_' + os.path.basename(toCheckout) + '.mb'
    toOpen = os.path.join(destpath, filename)
    # open the file
    if os.path.exists(toOpen):
        cmds.file(toOpen, force=True, open=True)  #, loadReferenceDepth="none")
    else:
        # create new file
        cmds.file(force=True, new=True)
        cmds.file(rename=toOpen)
        cmds.viewClipPlane('perspShape', ncp=0.01)
        cmds.file(save=True, force=True)
	def checkout_button_clicked(self):
		version = self.rollback_dialog.get_current_item()[1:]
		filePath = common.get_checkin_path()
		toCheckout = amu.getCheckinDest(filePath)
		
		latestVersion = amu.tempSetVersion(toCheckout, version)
		amu.discard(filePath)
		try:
			destpath = amu.checkout(toCheckout, True)
		except Exception as e:
			if not amu.checkedOutByMe(toCheckout):
				muke.message(str(e))
				return
			else:
				destpath = amu.getCheckoutDest(toCheckout)

		amu.tempSetVersion(toCheckout, latestVersion)
		# move to correct checkout directory
		correctCheckoutDir = amu.getCheckoutDest(toCheckout)
		if not destpath == correctCheckoutDir:
			if os.path.exists(correctCheckoutDir):
				shutil.rmtree(correctCheckoutDir)
			os.rename(destpath, correctCheckoutDir)
		toOpen = os.path.join(correctCheckoutDir, self.get_filename(toCheckout)+'.nk')
		if not os.path.exists(toOpen):
			# create new file
			nuke.scriptNew()
			nuke.scriptSaveAs(filename=toOpen, overwrite=0)
		else:
			nuke.scriptOpen(toOpen)
		self.rollback_dialog.close()
	def populate_list(self):
		filePath = common.get_checkin_path()
		checkInDest = amu.getCheckinDest(filePath)
		versionFolders = os.path.join(checkInDest, "src")
		selections = glob.glob(os.path.join(versionFolders, '*'))
		selections = [os.path.basename(selection) for selection in selections]
		self.rollback_dialog.set_list(selections)
示例#12
0
def checkin():
        print 'checkin'
        saveFile() # save the file before doing anything
        print 'save'
        filePath = cmds.file(q=True, sceneName=True)
        print 'filePath: '+filePath
        toCheckin = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath)))
        print 'toCheckin: '+toCheckin
        if amu.canCheckin(toCheckin):

                comment = 'Comment'
                commentPrompt = cmds.promptDialog(
                                    title='Comment',
                                    message='What changes did you make?',
                                    button=['OK','Cancel'],
                                    defaultButton='OK',
                                    dismissString='Cancel',
                                    sf = True)
                if commentPrompt == 'OK':
                    comment = cmds.promptDialog(query=True, text=True);
                else:
                    return
                amu.setComment(toCheckin, comment)
                dest = amu.getCheckinDest(toCheckin)

                saveFile()
                cmds.file(force=True, new=True) #open new file
                dest = amu.checkin(toCheckin) #checkin
        else:
                showFailDialog()
def checkin():
    print "checkin"
    saveFile()  # save the file before doing anything
    print "save"
    filePath = cmds.file(q=True, sceneName=True)
    print "filePath: " + filePath
    toCheckin = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath)))
    print "toCheckin: " + toCheckin
    toInstall = isRigAsset()
    specialInstallFiles = [os.path.join(os.environ["SHOTS_DIR"], "static/animation")]
    anim = isAnimationAsset()
    references = cmds.ls(references=True)
    loaded = []
    if amu.canCheckin(toCheckin) and saveGeo():  # objs must be saved before checkin
        comment = "Comment"
        commentPrompt = cmds.promptDialog(
            title="Comment",
            message="What changes did you make?",
            button=["OK", "Cancel"],
            defaultButton="OK",
            dismissString="Cancel",
            sf=True,
        )
        if commentPrompt == "OK":
            comment = cmds.promptDialog(query=True, text=True)
        else:
            return
        amu.setComment(toCheckin, comment)
        dest = amu.getCheckinDest(toCheckin)
        # if anim and showConfirmAlembicDialog() == 'Yes':
        #   for ref in references:
        #     if cmds.referenceQuery(ref, isLoaded=True):
        #       loaded.append(ref)
        #       cmds.file(unloadReference=ref)
        #   print loaded
        #   for ref in loaded:
        #     cmds.file(loadReference=ref)
        #     refPath = cmds.referenceQuery(ref, filename=True)
        #     assetName = getAssetName(refPath)
        #     print "\n\n\n\n**************************************************************\n"
        #     print dest
        #     print filePath
        #     print refPath
        #     print assetName
        #     saveFile()
        #     amu.runAlembicConverter(dest, filePath, filename=assetName)
        #     cmds.file(unloadReference=ref)

        #   for ref in loaded:
        #     cmds.file(loadReference=ref)

        saveFile()
        cmds.file(force=True, new=True)  # open new file
        dest = amu.checkin(toCheckin)  # checkin
        toInstall |= dest in specialInstallFiles
        srcFile = amu.getAvailableInstallFiles(dest)[0]
        if toInstall:
            amu.install(dest, srcFile)
    else:
        showFailDialog()
示例#14
0
def checkin():
        print 'checkin'
        saveFile() # save the file before doing anything
        print 'save'
        filePath = cmds.file(q=True, sceneName=True)
        print 'filePath: '+filePath
        toCheckin = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath)))
        print 'toCheckin: '+toCheckin
        toInstall = isRigAsset()
	specialInstallFiles = [os.path.join(os.environ['SHOTS_DIR'], 'static/animation')]
        anim = isAnimationAsset()
        references = cmds.ls(references=True)
        loaded = []
        if amu.canCheckin(toCheckin) and saveGeo(): # objs must be saved before checkin
		comment = 'Comment'
		commentPrompt = cmds.promptDialog(
				    title='Comment',
				    message='What changes did you make?',
				    button=['OK','Cancel'],
				    defaultButton='OK',
				    dismissString='Cancel',
				sf = True)
		if commentPrompt == 'OK':
			comment = cmds.promptDialog(query=True, text=True);
		else:
			return
		amu.setComment(toCheckin, comment)
                dest = amu.getCheckinDest(toCheckin)
                # if anim and showConfirmAlembicDialog() == 'Yes':
                #   for ref in references:
                #     if cmds.referenceQuery(ref, isLoaded=True):
                #       loaded.append(ref)
                #       cmds.file(unloadReference=ref)
                #   print loaded
                #   for ref in loaded:
                #     cmds.file(loadReference=ref)
                #     refPath = cmds.referenceQuery(ref, filename=True)
                #     assetName = getAssetName(refPath)
                #     print "\n\n\n\n**************************************************************\n"
                #     print dest
                #     print filePath
                #     print refPath
                #     print assetName
                #     saveFile()
                #     amu.runAlembicConverter(dest, filePath, filename=assetName)
                #     cmds.file(unloadReference=ref)

                #   for ref in loaded:
                #     cmds.file(loadReference=ref)

                saveFile()
                cmds.file(force=True, new=True) #open new file
                dest = amu.checkin(toCheckin) #checkin
		toInstall |= (dest in specialInstallFiles)
                srcFile = amu.getAvailableInstallFiles(dest)[0]
                if toInstall:
                    amu.install(dest, srcFile)
        else:
                showFailDialog()
示例#15
0
 def show_version_info(self):
     asset_version = str(self.current_item.text())
     filePath = os.path.join(
         amu.getUserCheckoutDir(),
         os.path.basename(os.path.dirname(self.ORIGINAL_FILE_NAME)))
     checkInDest = amu.getCheckinDest(filePath)
     comment = amu.getVersionComment(checkInDest, asset_version)
     self.version_info_label.setText(comment)
示例#16
0
 def refresh(self):
     filePath = os.path.join(
         amu.getUserCheckoutDir(),
         os.path.basename(os.path.dirname(self.ORIGINAL_FILE_NAME)))
     checkInDest = amu.getCheckinDest(filePath)
     versionFolders = os.path.join(checkInDest, "src")
     selections = glob.glob(os.path.join(versionFolders, '*'))
     self.update_selection(selections)
示例#17
0
def checkin():
        print 'checkin'
        saveFile() # save the file before doing anything
        print 'save'
        filePath = cmds.file(q=True, sceneName=True)
        print 'filePath: '+filePath
        toCheckin = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath)))
        print 'toCheckin: '+toCheckin
        rig = isRigAsset()
        anim = isAnimationAsset()
        references = cmds.ls(references=True)
        loaded = []
        if amu.canCheckin(toCheckin) and saveGeo(): # objs must be saved before checkin
		comment = 'Comment'
		commentPrompt = cmds.promptDialog(
				    title='Comment',
				    message='What changes did you make?',
				    button=['OK','Cancel'],
				    defaultButton='OK',
				    dismissString='Cancel',
				sf = True)
		if commentPrompt == 'OK':
			comment = cmds.promptDialog(query=True, text=True);
		else:
			return
		amu.setComment(toCheckin, comment)
                dest = amu.getCheckinDest(toCheckin)
                # if anim and showConfirmAlembicDialog() == 'Yes':
                #   for ref in references:
                #     if cmds.referenceQuery(ref, isLoaded=True):
                #       loaded.append(ref)
                #       cmds.file(unloadReference=ref)
                #   print loaded
                #   for ref in loaded:
                #     cmds.file(loadReference=ref)
                #     refPath = cmds.referenceQuery(ref, filename=True)
                #     assetName = getAssetName(refPath)
                #     print "\n\n\n\n**************************************************************\n"
                #     print dest
                #     print filePath
                #     print refPath
                #     print assetName
                #     saveFile()
                #     amu.runAlembicConverter(dest, filePath, filename=assetName)
                #     cmds.file(unloadReference=ref)

                #   for ref in loaded:
                #     cmds.file(loadReference=ref)

                saveFile()
                cmds.file(force=True, new=True) #open new file
                dest = amu.checkin(toCheckin) #checkin
                srcFile = amu.getAvailableInstallFiles(dest)[0]
                if rig:
                    amu.install(dest, srcFile)
        else:
                showFailDialog()
示例#18
0
	def build_alembic_filepath(self, ref):
		#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')
 def open_version(self):
     filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(self.ORIGINAL_FILE_NAME)))
     checkInDest = amu.getCheckinDest(filePath)
     v = str(self.current_item.text())
     checkinPath = os.path.join(checkInDest, "src", v)
     checkinName = os.path.join(checkinPath, os.path.basename(self.ORIGINAL_FILE_NAME))
     print checkinName
     if os.path.exists(checkinName):
         cmd.file(checkinName, force=True, open=True)
     else:
         self.show_no_file_dialog()
示例#20
0
    def build_alembic_filepath(self, ref):
        #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')
def checkin():
    print 'checkin'
    saveFile()  # save the file before doing anything
    print 'save'
    filePath = cmds.file(q=True, sceneName=True)
    print 'filePath: ' + filePath
    toCheckin = os.path.join(amu.getUserCheckoutDir(),
                             os.path.basename(os.path.dirname(filePath)))
    print 'toCheckin: ' + toCheckin
    rig = isRigAsset()
    anim = isAnimationAsset()
    references = cmds.ls(references=True)
    loaded = []
    if amu.canCheckin(
            toCheckin) and saveGeo():  # objs must be saved before checkin
        dest = amu.getCheckinDest(toCheckin)
        # if anim and showConfirmAlembicDialog() == 'Yes':
        #   for ref in references:
        #     if cmds.referenceQuery(ref, isLoaded=True):
        #       loaded.append(ref)
        #       cmds.file(unloadReference=ref)
        #   print loaded
        #   for ref in loaded:
        #     cmds.file(loadReference=ref)
        #     refPath = cmds.referenceQuery(ref, filename=True)
        #     assetName = getAssetName(refPath)
        #     print "\n\n\n\n**************************************************************\n"
        #     print dest
        #     print filePath
        #     print refPath
        #     print assetName
        #     saveFile()
        #     amu.runAlembicConverter(dest, filePath, filename=assetName)
        #     cmds.file(unloadReference=ref)

        #   for ref in loaded:
        #     cmds.file(loadReference=ref)

        saveFile()
        cmds.file(force=True, new=True)  #open new file
        dest = amu.checkin(toCheckin, anim or rig
                           or os.path.basename(os.path.dirname(filePath))[:32]
                           == 'owned_jeff_apartment_walls_model')  #checkin
        srcFile = amu.getAvailableInstallFiles(dest)[0]
        if rig:
            amu.install(dest, srcFile)
    else:
        showFailDialog()
def export_alembic():
    print "Exporting Alembic"

    saveFile()

    filePath = cmds.file(q=True, sceneName=True)
    toCheckin = os.path.join(amu.getUserCheckoutDir(),
                             os.path.basename(os.path.dirname(filePath)))
    dest = amu.getCheckinDest(toCheckin)

    references = cmds.ls(references=True)
    loaded = []
    for ref in references:
        if cmds.referenceQuery(ref, isLoaded=True):
            loaded.append(ref)
            cmds.file(unloadReference=ref)

    if showConfirmAlembicDialog(loaded) == 'Yes':
        print loaded
        for ref in loaded:
            print "\n\n\n\n**************************************************************\n"
            constraints = []
            #TODO refactor the controller stuff to work with a 'prop list' it will scale easier
            if 'controller' in ref:
                for c in loaded:
                    if 'owned_tommy_rig_stable' in c or 'owned_abby_rig_stable' in c or 'owned_jeff_rig_stable' in c:
                        constraints.append(c)

            cmds.file(loadReference=ref)
            for c in constraints:
                print c
                cmds.file(loadReference=c)

            refPath = cmds.referenceQuery(ref, filename=True)
            assetName = getAssetName(refPath)
            print dest
            print filePath
            print refPath
            print assetName
            saveFile()
            abcfilepath = os.path.join(os.path.dirname(dest),
                                       'animation_cache', 'abc',
                                       assetName + '.abc')
            convert(abcfilepath)
            cmds.file(unloadReference=ref)

        for ref in loaded:
            cmds.file(loadReference=ref)
示例#23
0
 def open_version(self):
     dialogResult = self.verify_open_version_dialog()
     if (dialogResult == 'Ok'):
         filePath = os.path.join(
             amu.getUserCheckoutDir(),
             os.path.basename(os.path.dirname(self.ORIGINAL_FILE_NAME)))
         checkInDest = amu.getCheckinDest(filePath)
         v = str(self.current_item.text())
         checkinPath = os.path.join(checkInDest, "src", v)
         checkinName = os.path.join(
             checkinPath, os.path.basename(self.ORIGINAL_FILE_NAME))
         print checkinName
         if os.path.exists(checkinName):
             cmd.file(checkinName, force=True, open=True)
         else:
             self.show_no_file_dialog()
def export_alembic():
    print "Exporting Alembic"

    saveFile()

    filePath = cmds.file(q=True, sceneName=True)
    toCheckin = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath)))
    dest = amu.getCheckinDest(toCheckin)

    references = cmds.ls(references=True)
    loaded = []
    for ref in references:
        if cmds.referenceQuery(ref, isLoaded=True):
            loaded.append(ref)
            cmds.file(unloadReference=ref)

    if showConfirmAlembicDialog(loaded) == "Yes":
        print loaded
        for ref in loaded:
            print "\n\n\n\n**************************************************************\n"
            constraints = []
            # TODO refactor the controller stuff to work with a 'prop list' it will scale easier
            if "controller" in ref:
                for c in loaded:
                    if "owned_tommy_rig_stable" in c or "owned_abby_rig_stable" in c or "owned_jeff_rig_stable" in c:
                        constraints.append(c)

            cmds.file(loadReference=ref)
            for c in constraints:
                print c
                cmds.file(loadReference=c)

            refPath = cmds.referenceQuery(ref, filename=True)
            assetName = getAssetName(refPath)
            print dest
            print filePath
            print refPath
            print assetName
            saveFile()
            abcfilepath = os.path.join(os.path.dirname(dest), "animation_cache", "abc", assetName + ".abc")
            convert(abcfilepath)
            cmds.file(unloadReference=ref)

        for ref in loaded:
            cmds.file(loadReference=ref)
示例#25
0
def checkin():
        print 'checkin'
        saveFile() # save the file before doing anything
        print 'save'
        filePath = cmds.file(q=True, sceneName=True)
        print 'filePath: '+filePath
        toCheckin = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath)))
        print 'toCheckin: '+toCheckin
        rig = isRigAsset()
        anim = isAnimationAsset()
        references = cmds.ls(references=True)
        loaded = []
        if amu.canCheckin(toCheckin) and saveGeo(): # objs must be saved before checkin
                dest = amu.getCheckinDest(toCheckin)
                # if anim and showConfirmAlembicDialog() == 'Yes':
                #   for ref in references:
                #     if cmds.referenceQuery(ref, isLoaded=True):
                #       loaded.append(ref)
                #       cmds.file(unloadReference=ref)
                #   print loaded
                #   for ref in loaded:
                #     cmds.file(loadReference=ref)
                #     refPath = cmds.referenceQuery(ref, filename=True)
                #     assetName = getAssetName(refPath)
                #     print "\n\n\n\n**************************************************************\n"
                #     print dest
                #     print filePath
                #     print refPath
                #     print assetName
                #     saveFile()
                #     amu.runAlembicConverter(dest, filePath, filename=assetName)
                #     cmds.file(unloadReference=ref)

                #   for ref in loaded:
                #     cmds.file(loadReference=ref)

                saveFile()
                cmds.file(force=True, new=True) #open new file
                dest = amu.checkin(toCheckin, anim or rig or os.path.basename(os.path.dirname(filePath))[:32]=='owned_jeff_apartment_walls_model') #checkin
                srcFile = amu.getAvailableInstallFiles(dest)[0]
                if rig:
                    amu.install(dest, srcFile)
        else:
                showFailDialog()
示例#26
0
    def checkout_version(self):
        dialogResult = self.verify_checkout_dialog()
        if (dialogResult == 'Yes'):
            #checkout
            version = str(self.current_item.text())[1:]
            filePath = os.path.join(
                amu.getUserCheckoutDir(),
                os.path.basename(os.path.dirname(self.ORIGINAL_FILE_NAME)))
            toCheckout = amu.getCheckinDest(filePath)

            latestVersion = amu.tempSetVersion(toCheckout, version)
            amu.discard(filePath)
            try:
                destpath = amu.checkout(toCheckout, True)
            except Exception as e:
                if not amu.checkedOutByMe(toCheckout):
                    cmd.confirmDialog(title='Can Not Checkout',
                                      message=str(e),
                                      button=['Ok'],
                                      defaultButton='Ok',
                                      cancelButton='Ok',
                                      dismissString='Ok')
                    return
                else:
                    destpath = amu.getCheckoutDest(toCheckout)

            amu.tempSetVersion(toCheckout, latestVersion)
            # move to correct checkout directory
            correctCheckoutDir = amu.getCheckoutDest(toCheckout)
            if not destpath == correctCheckoutDir:
                if os.path.exists(correctCheckoutDir):
                    shutil.rmtree(correctCheckoutDir)
                os.rename(destpath, correctCheckoutDir)
            toOpen = os.path.join(correctCheckoutDir,
                                  self.get_filename(toCheckout) + '.mb')
            self.ORIGINAL_FILE_NAME = toOpen
            if not os.path.exists(toOpen):
                # create new file
                cmd.file(force=True, new=True)
                cmd.file(rename=toOpen)
                cmd.file(save=True, force=True)
            cmd.file(self.ORIGINAL_FILE_NAME, force=True, open=True)
            self.close_dialog()
示例#27
0
 def show_version_info(self):
     asset_version = str(self.current_item.text())
     filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(self.ORIGINAL_FILE_NAME)))
     checkInDest = amu.getCheckinDest(filePath)
     comment = amu.getVersionComment(checkInDest,asset_version)
     self.version_info_label.setText(comment)
 def tag_version(self):
     dialogResult = self.rename_tagged_version()
     filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(self.ORIGINAL_FILE_NAME)))
     findPath = amu.getCheckinDest(filePath)
     print findPath
 def refresh(self):
     filePath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(self.ORIGINAL_FILE_NAME)))
     checkInDest = amu.getCheckinDest(filePath)
     versionFolders = os.path.join(checkInDest, "src")
     selections = glob.glob(os.path.join(versionFolders, '*'))
     self.update_selection(selections)