def checkinLightingFile():
    print('checkin lighting file')
    filepath = hou.hipFile.path()
    toCheckin = os.path.join(amu.getUserCheckoutDir(),
                             os.path.basename(os.path.dirname(filepath)))
    backups = os.path.join(toCheckin, 'backup')
    print 'backup = ' + backups
    if os.path.isdir(backups):
        os.system('rm -rf ' + backups)
    if amu.canCheckin(toCheckin):
        response = hou.ui.readInput("What did you change?",
                                    buttons=(
                                        'OK',
                                        'Cancel',
                                    ),
                                    title='Comment')
        if (response[0] != 0):
            return
        comment = response[1]
        hou.hipFile.save()
        hou.hipFile.clear()
        amu.setComment(toCheckin, comment)
        dest = amu.checkin(toCheckin)
        srcFile = amu.getAvailableInstallFiles(dest)[0]
        amu.install(dest, srcFile)
    else:
        hou.ui.displayMessage('Checkin Failed')
Esempio n. 2
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()
Esempio n. 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()
Esempio n. 5
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()
Esempio n. 6
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()
Esempio n. 7
0
def checkin():
	save = nuke.scriptSave()
	if save==True:
		toCheckin = get_checkin_path()
		if can_checkin():
			amu.setComment(toCheckin, 'comment')
			dest = amu.checkin(toCheckin)
			nuke.message('Checkin Successful!')
			nuke.scriptClose()
		else:
			nuke.message('Can not check in')
Esempio n. 8
0
def checkin():
    save = nuke.scriptSave()
    if save == True:
        toCheckin = get_checkin_path()
        if can_checkin():
            amu.setComment(toCheckin, 'comment')
            dest = amu.checkin(toCheckin)
            nuke.message('Checkin Successful!')
            nuke.scriptClear()
        else:
            nuke.message('Can not check in')
def checkin(node=None):
    """Checks in the selected node.  EXACTLY ONE node may be selected, and it MUST be a digital asset.
        The node must already exist in the database, and USERNAME must have the lock."""
    if not hou_asset_mgr.isDigitalAsset(node):
        hou.ui.displayMessage("Not a Digital Asset.")
    else:
        libraryPath = node.type().definition().libraryFilePath()  # user checkout folder
        filename = os.path.basename(libraryPath)  # otl filename
        toCheckin = os.path.dirname(libraryPath)

        if os.path.exists(os.path.join(toCheckin, ".checkoutInfo")) and amu.canCheckin(toCheckin):
            response = hou.ui.readInput("What did you change?", buttons=("OK", "Cancel"), title="Comment")
            if response[0] != 0:
                return
            comment = response[1]
            hou_asset_mgr.lockAsset(node, False)
            hou_asset_mgr.saveOTL(node)
            node.type().definition().save(libraryPath)
            hou.hda.uninstallFile(libraryPath, change_oplibraries_file=False)
            amu.setComment(toCheckin, comment)
            assetdir = amu.checkin(toCheckin)
            assetpath = amu.getAvailableInstallFiles(assetdir)[0]
            amu.install(assetdir, assetpath)
            hou.hda.installFile(os.path.join(OTLDIR, filename), change_oplibraries_file=True)
            hou.hda.uninstallFile("Embedded")
            if (
                isCameraAsset(node)
                and hou.ui.displayMessage(
                    "Export Alembic?", buttons=("Yes", "No"), default_choice=0, title="Export Alembic"
                )
                == 0
            ):
                writeCamerasToAlembic(node)
            if (
                isSetAsset(node)
                and hou.ui.displayMessage(
                    "Export Alembic?", buttons=("Yes", "No"), default_choice=0, title="Export Alembic"
                )
                == 0
            ):
                writeSetToAlembic(node)
            hou.ui.displayMessage("Checkin Successful!")

        else:
            hou.ui.displayMessage("Can Not Checkin.")
Esempio n. 10
0
def checkinLightingFile():
    print('checkin lighting file')
    filepath = hou.hipFile.path()
    toCheckin = os.path.join(amu.getUserCheckoutDir(), os.path.basename(os.path.dirname(filepath)))
    backups = os.path.join(toCheckin, 'backup')
    print 'backup = ' + backups
    if os.path.isdir(backups):
        os.system('rm -rf '+backups)
    if amu.canCheckin(toCheckin):
        response = hou.ui.readInput("What did you change?", buttons=('OK', 'Cancel',), title='Comment')
        if(response[0] != 0):
            return
        comment = response[1]
        hou.hipFile.save()
        hou.hipFile.clear()
        amu.setComment(toCheckin, comment)
        dest = amu.checkin(toCheckin)
        srcFile = amu.getAvailableInstallFiles(dest)[0]
        amu.install(dest, srcFile)
    else:
        hou.ui.displayMessage('Checkin Failed')
Esempio n. 11
0
def checkin(node = None):
    """Checks in the selected node.  EXACTLY ONE node may be selected, and it MUST be a digital asset.
        The node must already exist in the database, and USERNAME must have the lock."""
    if not hou_asset_mgr.isDigitalAsset(node):
        hou.ui.displayMessage("Not a Digital Asset.")
    else:
        libraryPath = node.type().definition().libraryFilePath() #user checkout folder
        filename = os.path.basename(libraryPath) # otl filename
        toCheckin = os.path.dirname(libraryPath)

        if os.path.exists(os.path.join(toCheckin, ".checkoutInfo")) and amu.canCheckin(toCheckin):
            response = hou.ui.readInput("What did you change?", buttons=('OK', 'Cancel',), title='Comment')
            if(response[0] != 0):
                return
            comment = response[1]
            hou_asset_mgr.lockAsset(node, False)
            hou_asset_mgr.saveOTL(node)
            node.type().definition().save(libraryPath)
            hou.hda.uninstallFile(libraryPath, change_oplibraries_file=False)
            amu.setComment(toCheckin, comment)
            assetdir = amu.checkin(toCheckin)
            assetpath = amu.getAvailableInstallFiles(assetdir)[0]
            amu.install(assetdir, assetpath)
            hou.hda.installFile(os.path.join(OTLDIR, filename), change_oplibraries_file=True)
            hou.hda.uninstallFile("Embedded")
            if isCameraAsset(node) and hou.ui.displayMessage('Export Alembic?'
                                                        , buttons=('Yes','No',)
                                                        , default_choice=0
                                                        , title='Export Alembic') == 0:
                writeCamerasToAlembic(node)
            if isSetAsset(node) and hou.ui.displayMessage('Export Alembic?'
                                                        , buttons=('Yes','No',)
                                                        , default_choice=0
                                                        , title='Export Alembic') == 0:
                writeSetToAlembic(node)
            hou.ui.displayMessage("Checkin Successful!")

        else:
            hou.ui.displayMessage('Can Not Checkin.')