Exemple #1
0
def rollbackShotFiles():
    # NOTE: Currently, we do not "check out" a shot file when it is pulled in. That is interesting. I wonder why not? Anyway, I don't know if that is an issue yet. Ah well. I guess we'll play with it.
    print "RollbackShotFiles"
    filepath = hou.hipFile.path(
    )  # The filepath goes to the path for the checked out file in the user directory.
    filename = os.path.basename(filepath)

    if not (filename == "untitled.hip"):        \
		# If it isn't untitled, then we have a checked out lighting file, and we will proceed.

        shotNumber = filename.split("_")
        shotPaths = os.path.join(SHOTSDIR, str(shotNumber[0]))
        lightingPath = os.path.join(shotPaths, "lighting")
        lightingSrc = os.path.join(lightingPath, "src")

        versions = glob.glob(os.path.join(lightingSrc, "*"))
        versionList = []
        versionInfo = []
        nodeInfoDest = lightingPath

        for v in versions:
            versionList.append(os.path.basename(v))
            comment = amu.getVersionComment(nodeInfoDest, os.path.basename(v))
            versionInfo.append(comment)

        versionList.sort()  # Should only be one. Whatever.
        dialog = VersionDialog()
        dialog.addItems(versionList, versionInfo)
        dialog.show()
        dialog.setParams(lightingSrc, shotNumber, lightingPath, False)
        pyqt_houdini.exec_(dialog)
def rollbackShotFiles():
	# NOTE: Currently, we do not "check out" a shot file when it is pulled in. That is interesting. I wonder why not? Anyway, I don't know if that is an issue yet. Ah well. I guess we'll play with it.
	print "RollbackShotFiles"
	filepath = hou.hipFile.path() # The filepath goes to the path for the checked out file in the user directory.
	filename = os.path.basename(filepath)

	if not (filename == "untitled.hip"):\
		# If it isn't untitled, then we have a checked out lighting file, and we will proceed.
		shotNumber = filename.split("_");
		shotPaths = os.path.join(SHOTSDIR, str(shotNumber[0]))
		lightingPath = os.path.join(shotPaths, "lighting")
		lightingSrc = os.path.join(lightingPath, "src")	
	
		versions = glob.glob(os.path.join(lightingSrc, "*"))
		versionList = []
		versionInfo = []
		nodeInfoDest = lightingPath

		for v in versions:
			versionList.append(os.path.basename(v))
			comment = amu.getVersionComment(nodeInfoDest,os.path.basename(v))
			versionInfo.append(comment)

		versionList.sort() # Should only be one. Whatever.
		dialog = VersionDialog()
		dialog.addItems(versionList,versionInfo)
		dialog.show()
		dialog.setParams(lightingSrc,shotNumber,lightingPath,False)
		pyqt_houdini.exec_(dialog)
 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)
Exemple #4
0
def rollbackOTL(node=None):
    """Pulls a rollback window for the user to select a version to rollback to. EXACTLY ONE node may be selected, and it MUST be a digital asset.
	    The node must already exist in the database.
	"""
    print 'RollbackOTL'

    #Need to check if a particular node is a digital asset first. Rollback is will only work as a DA, with model, rigs and animation.
    if node != None:

        if not ham.isDigitalAsset(node):
            ui.infoWindow('Wait! You can only rollback Digital Assets!')
            print "NOT A DIGITAL ASSET."
        else:
            # First, we need to see if this is checked out or not. If it is checked out, then we can proceed. If not, state so.
            # For the productions path
            libraryPath = node.type().definition().libraryFilePath()
            filename = os.path.basename(libraryPath)

            asset_name, ext = os.path.splitext(filename)
            #print "asset_name " + asset_name
            toCheckout = os.path.join(ASSETSDIR, asset_name, 'otl')
            #print "toCheckout " + toCheckout
            myCheckout = False

            myCheckout = amu.isCheckedOut(toCheckout)
            if myCheckout:  #If it has been checked out
                myCheckout = amu.checkedOutByMe(toCheckout)
                if myCheckout:  #If user was the last to checkout
                    #Here we rollback.
                    versionedFolders = os.path.join(toCheckout, "src")
                    #print "versionedFolders ", versionedFolders
                    versions = glob.glob(os.path.join(versionedFolders, '*'))
                    #print "selections ", versions
                    #Wooohoooo!!!
                    selections = []
                    selectionInfo = []
                    nodeInfoDest = toCheckout

                    for vr in versions:
                        selections.append(os.path.basename(vr))
                        comment = amu.getVersionComment(
                            nodeInfoDest, os.path.basename(vr))
                        selectionInfo.append(comment)
                    selections.sort()
                    dialog = VersionDialog()
                    dialog.addItems(selections, selectionInfo)
                    dialog.show()
                    dialog.setParams(versionedFolders, asset_name, toCheckout,
                                     True)
                    pyqt_houdini.exec_(dialog)

                else:
                    hou.ui.displayMessage('Already checked out.')
                    return
            else:
                hou.ui.displayMessage('Please checkout asset first.')
    else:
        print "Node does not exist"
def rollbackOTL(node = None):
	"""Pulls a rollback window for the user to select a version to rollback to. EXACTLY ONE node may be selected, and it MUST be a digital asset.
	    The node must already exist in the database.
	"""
	print 'RollbackOTL'

	#Need to check if a particular node is a digital asset first. Rollback is will only work as a DA, with model, rigs and animation.
	if node != None:

		if not ham.isDigitalAsset(node):
			ui.infoWindow('Wait! You can only rollback Digital Assets!')
			print "NOT A DIGITAL ASSET."
		else:
			# First, we need to see if this is checked out or not. If it is checked out, then we can proceed. If not, state so.
			# For the productions path			
			libraryPath = node.type().definition().libraryFilePath()
			filename = os.path.basename(libraryPath)

			asset_name, ext = os.path.splitext(filename)
			#print "asset_name " + asset_name
			toCheckout = os.path.join(ASSETSDIR, asset_name, 'otl')
			#print "toCheckout " + toCheckout
			myCheckout = False

			myCheckout = amu.isCheckedOut(toCheckout)
			if myCheckout: #If it has been checked out
				myCheckout = amu.checkedOutByMe(toCheckout)
				if myCheckout: #If user was the last to checkout
					#Here we rollback.
					versionedFolders = os.path.join(toCheckout, "src")
					#print "versionedFolders ", versionedFolders
					versions = glob.glob(os.path.join(versionedFolders, '*'))
					#print "selections ", versions
					#Wooohoooo!!!
					selections = []
					selectionInfo = []
					nodeInfoDest = toCheckout

					for vr in versions:
						selections.append(os.path.basename(vr))
						comment = amu.getVersionComment(nodeInfoDest,os.path.basename(vr))
						selectionInfo.append(comment)
					selections.sort()
					dialog = VersionDialog()
					dialog.addItems(selections,selectionInfo)
					dialog.show()
					dialog.setParams(versionedFolders,asset_name,toCheckout,True)
					pyqt_houdini.exec_(dialog)
					
				else:
					hou.ui.displayMessage('Already checked out.')
					return
			else:
				hou.ui.displayMessage('Please checkout asset first.')
	else:
		print "Node does not exist"
 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)