当前位置: 首页>>代码示例>>Python>>正文


Python utilities.getUserCheckoutDir函数代码示例

本文整理汇总了Python中utilities.getUserCheckoutDir函数的典型用法代码示例。如果您正苦于以下问题:Python getUserCheckoutDir函数的具体用法?Python getUserCheckoutDir怎么用?Python getUserCheckoutDir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getUserCheckoutDir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: checkin

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()
开发者ID:pantalones-de-cheese,项目名称:ramshorn-tools,代码行数:60,代码来源:save_version.py

示例2: discard

def discard(filePath=cmds.file(q=True, sceneName=True)):
    if not filePath:
        return
    print filePath
    dlgResult = showWarningDialog()
    if dlgResult == "Yes":
        # get discard directory before opening new file
        toDiscard = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath)))
        if amu.isCheckedOutCopyFolder(toDiscard):
            cmds.file(force=True, new=True)  # open new file
            amu.discard(toDiscard)  # discard changes
        else:
            cmds.confirmDialog(
                title="Invalid Command",
                message="This is not a checked out file. There is nothing to discard.",
                button=["Ok"],
                defaultButton="Ok",
                cancelButton="Ok",
                dismissString="Ok",
            )

    elif dlgResult == "Brent":
        brent.go()
    else:
        cmds.confirmDialog(
            title="Discard Cancelled",
            message="Thank you for being responsible.",
            button=["Ok"],
            defaultButton="Ok",
            cancelButton="Ok",
            dismissString="Ok",
        )
开发者ID:splodingsocks,项目名称:byu-animation-tools,代码行数:32,代码来源:maya_discard.py

示例3: rollbackOTLgo

def rollbackOTLgo(answer,versionedFolders,asset_name,toCheckout):
	#answer = dialog.answer#hou.ui.selectFromList(selections, message='Select version to rollback:', exclusive=True)
	if answer:
		version = int(answer[1:])
		versionStr = "%03d" % version
		newVersion = os.path.join(versionedFolders,"v" + versionStr)
		checkoutFilePath = os.path.join(amu.getUserCheckoutDir(), asset_name)

		rollingBack = hou.ui.displayMessage('WARNING: You are about to remove your most recent changes. Proceed at your own risk.', buttons=('Actually, I don\'t want to', 'Yes. Roll me back'), severity=hou.severityType.Warning, title=("Woah there, pardner!"))
	

		if (rollingBack):
			print "rollingBack"
			# Temporarily set the version to the rollback version, and check out.
			oldVersion = int(amu.tempSetVersion(toCheckout, versionStr))
			oldVersionStr = "%03d" % oldVersion
			print toCheckout
			tempFilePath = os.path.join(checkoutFilePath + "_otl_" + versionStr)
			filePath = os.path.join(checkoutFilePath + "_otl_" + oldVersionStr)
			# Now that we've set the version, we will 
			amu.discard(filePath) # Hey! This is working!!!
			amu.checkout(toCheckout, True)

			# Reset the version number, and rename the checkout path to the most recent version.
			amu.tempSetVersion(toCheckout, oldVersion)
			correctCheckoutDest = amu.getCheckoutDest(toCheckout)
			os.rename(tempFilePath, correctCheckoutDest)
开发者ID:byu-animation,项目名称:ramshorn-tools,代码行数:27,代码来源:houdini_rollback.py

示例4: rollbackShotFilesGo

def rollbackShotFilesGo(answer,versionedFolders,asset_name,toCheckout):
	if answer:
		version = int(answer[1:])	
		versionStr = "%03d" % version

		rollingBack = hou.ui.displayMessage('WARNING: You are about to remove your most recent changes. Proceed at your own risk.', buttons=('Actually, I don\'t want to', 'Yes. Roll me back'), severity=hou.severityType.Warning, title=("Woah there, pardner!"))

		if (rollingBack):
			newLighting = os.path.join(versionedFolders, "v" + versionStr)

			# Again: set the latest version in the .nodeInfo file to the selected version, and checkout the next version.
			#asset_name, ext = os.path.splitext(filename)

			checkoutFilePath = os.path.join(amu.getUserCheckoutDir(), (asset_name[0]+"_lighting"))

			oldVersion = int(amu.tempSetVersion(toCheckout, version))

			oldVersionStr = "%03d" % oldVersion				
			
			tempFilePath = os.path.join(checkoutFilePath + "_" + versionStr)
			filePath = os.path.join(checkoutFilePath + "_" + oldVersionStr)

			# Discard the old file, and check out the rollbacked one.
			amu.discard(filePath) # Hey! This is working!!!
			amu.checkout(toCheckout, True)
			
			# Then resetting the version number back to the most recent, so when we check in again, we will be in the most recent version.
			amu.tempSetVersion(toCheckout, oldVersion)
			correctCheckoutDest = amu.getCheckoutDest(toCheckout)
			#print "correctCheckoutDest ", correctCheckoutDest

			os.rename(tempFilePath, correctCheckoutDest)
开发者ID:byu-animation,项目名称:ramshorn-tools,代码行数:32,代码来源:houdini_rollback.py

示例5: go

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)
开发者ID:byu-animation,项目名称:ramshorn-tools,代码行数:30,代码来源:maya_save_version.py

示例6: discard

def discard():
        filePath=cmds.file(q=True, sceneName=True)
        if not filePath:
          return
        dlgResult = showWarningDialog()
        if dlgResult == 'Yes':
                # get discard directory before opening new file
                toDiscard = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath)))
                if(amu.isCheckedOutCopyFolder(toDiscard)): 
                        cmds.file(force=True, new=True) #open new file
                        amu.discard(toDiscard) # discard changes
                else:
                        cmds.confirmDialog(  title         = 'Invalid Command'
                                           , message       = 'This is not a checked out file. There is nothing to discard.'
                                           , button        = ['Ok']
                                           , defaultButton = 'Ok'
                                           , cancelButton  = 'Ok'
                                           , dismissString = 'Ok')

        elif dlgResult == 'Brent':
                return
        else:
                cmds.confirmDialog(  title         = 'Discard Cancelled'
                                   , message       = 'Thank you for being responsible.'
                                   , button        = ['Ok']
                                   , defaultButton = 'Ok'
                                   , cancelButton  = 'Ok'
                                   , dismissString = 'Ok')
开发者ID:byu-animation,项目名称:relic-tools,代码行数:28,代码来源:maya_discard.py

示例7: checkout_version

    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()
开发者ID:Romcat100,项目名称:ramshorn-tools,代码行数:33,代码来源:maya_rollback.py

示例8: discardLightingFile

def discardLightingFile():
    filepath = hou.hipFile.path()
    # TODO
    print (filepath)
    if (
        hou.ui.displayMessage(
            "YOU ARE ABOUT TO IRREVOKABLY DISCARD ALL CHANGES YOU HAVE MADE. "
            "Please think this through very carefully.\n "
            "Are you sure you want to discard "
            "your changes?",
            buttons=("Yes", "No"),
            default_choice=1,
            title="Discard Confirmation",
        )
        == 0
    ):
        toDiscard = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filepath)))
        if amu.isCheckedOutCopyFolder(toDiscard):
            hou.hipFile.clear()
            amu.discard(toDiscard)
        else:
            hou.ui.displayMessage(
                "This is not a checked out file.  There is nothing to discard", title="Invalid Command"
            )
    else:
        hou.ui.displayMessage("Thank you for being responsible.", title="Discard Cancelled")
开发者ID:sm-github,项目名称:ramshorn-tools,代码行数:26,代码来源:hou_asset_mgr.py

示例9: checkin

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()
开发者ID:byu-animation,项目名称:relic-tools,代码行数:30,代码来源:maya_checkin.py

示例10: rollback

 def rollback(self):
     dialogResult = self.showWarningDialog()
     if dialogResult == 'Yes':
         version = str(self.current_item.text())[1:]
         dirPath = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(self.ORIGINAL_FILE_NAME)))
         print dirPath
         cmd.file(force=True, new=True)
         amu.setVersion(dirPath, int(version))
         self.close()
开发者ID:garretthoyos,项目名称:byu-animation-tools,代码行数:9,代码来源:maya_rollback.py

示例11: checkin

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()
开发者ID:Azmisov,项目名称:ramshorn-tools,代码行数:57,代码来源:maya_checkin.py

示例12: checkinLightingFile

def checkinLightingFile():
    print 'checkin lighting file'
    filepath = hou.hipFile.path()
    toCheckin = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filepath)))
    if amu.canCheckin(toCheckin):
        hou.hipFile.save()
        hou.hipFile.clear()
        dest = amu.checkin(toCheckin)
    else:
        ui.infoWindow('Checkin Failed')
开发者ID:splodingsocks,项目名称:byu-animation-tools,代码行数:10,代码来源:hou_asset_mgr.py

示例13: open_version

 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()
开发者ID:garretthoyos,项目名称:byu-animation-tools,代码行数:11,代码来源:maya_rollback.py

示例14: checkin

def checkin():
    filePath = nuke.callbacks.filenameFilter( nuke.root().name() )
    save = nuke.scriptSave()
    if save==True:
        toCheckin = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filePath)))
        if amu.canCheckin(toCheckin):
            dest = amu.checkin(toCheckin, False)
            nuke.message('Checkin Successful!')
            nuke.scriptClose()
        else:
            nuke.message('Can not check in')
开发者ID:Azmisov,项目名称:ramshorn-tools,代码行数:11,代码来源:checkin_Nuke.py

示例15: build_alembic_filepath

	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')
开发者ID:cdwasden,项目名称:ramshorn-tools,代码行数:11,代码来源:alembic_exporter.py


注:本文中的utilities.getUserCheckoutDir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。