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 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): lockAsset(node, False) saveOTL(node) node.type().definition().save(libraryPath) hou.hda.uninstallFile(libraryPath, change_oplibraries_file=False) assetdir = amu.checkin(toCheckin, False) 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.')
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()
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')
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()
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()
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, False) srcFile = amu.getAvailableInstallFiles(dest)[0] amu.install(dest, srcFile) else: ui.infoWindow("Checkin Failed")
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 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): hou.hipFile.save() hou.hipFile.clear() dest = amu.checkin(toCheckin, False) srcFile = amu.getAvailableInstallFiles(dest)[0] amu.install(dest, srcFile) else: ui.infoWindow('Checkin Failed')
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): hou.hipFile.save() hou.hipFile.clear() dest = amu.checkin(toCheckin, False) srcFile = amu.getAvailableInstallFiles(dest)[0] amu.install(dest, srcFile) else: hou.ui.displayMessage("Checkin Failed")
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() if amu.canCheckin(toCheckin) and saveGeo(): # objs must be saved before checkin cmds.file(force=True, new=True) #open new file dest = amu.checkin(toCheckin) #checkin if rig: srcFile = amu.getAvailableInstallFiles(dest)[0] amu.install(dest, srcFile) else: showFailDialog()
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.")
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 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() if amu.canCheckin(toCheckin) and saveGeo(): # objs must be saved before checkin cmds.file(force=True, new=True) #open new file dest = amu.checkin(toCheckin, anim or rig) #checkin srcFile = amu.getAvailableInstallFiles(dest)[0] if rig: amu.install(dest, srcFile) if anim and showConfirmAlembicDialog() == 'Yes': amu.runAlembicConverter(dest, srcFile) else: showFailDialog()
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')
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.')
def newContainer(hpath): templateNode = hou.node(hpath).createNode("containerTemplate") templateNode.hide(True) # resp = ui.inputWindow("Enter the New Operator Label", wtitle="OTL Label") response = hou.ui.readInput("Enter the New Operator Label", buttons=('Ok', 'Cancel'), title="OTL Label") if response[0] == 0: name = response[1] else: name = None if name != None and name.strip() != '': name = hou_asset_mgr.formatName(name) filename = name.replace(' ', '_') newfilepath = os.path.join(OTLDIR, filename + '.otl') if not os.path.exists(newfilepath): # create file heirarchy if container asset amu.createNewAssetFolders(ASSETSDIR, filename) newversiondir = os.path.join(ASSETSDIR, filename + '/otl') print "dir " + newversiondir newversionpath = os.path.join(newversiondir, 'src/v000/' + filename + '.otl') print "path " + newversionpath templateNode.type().definition().copyToHDAFile(newversionpath, new_name=filename, new_menu_name=name) stablepath = amu.install(newversiondir, newversionpath) fileutil.clobberPermissions(stablepath) os.symlink(stablepath, newfilepath) hou.hda.installFile(newfilepath, change_oplibraries_file=True) newnode = hou.node(hpath).createNode(filename) # templateNode.type().definition().copyToHDAFile(newfilepath, new_name=filename, new_menu_name=name) # hou.hda.installFile(newfilepath, change_oplibraries_file=True) # fileutil.clobberPermissions(newfilepath) # newnode = hou.node(hpath).createNode(filename) else: hou.ui.displayMessage( "Asset by that name already exists. Cannot create asset.", title='Asset Name', severity=hou.severityType.Error) # clean up templateNode.destroy()
def newContainer(hpath): templateNode = hou.node(hpath).createNode("containerTemplate") templateNode.hide(True) # resp = ui.inputWindow("Enter the New Operator Label", wtitle="OTL Label") response = hou.ui.readInput("Enter the New Operator Label", buttons=('Ok', 'Cancel'), title="OTL Label") if response[0]==0: name = response[1] else: name = None if name != None and name.strip() != '': name = hou_asset_mgr.formatName(name) filename = name.replace(' ', '_') newfilepath = os.path.join(OTLDIR, filename+'.otl') if not os.path.exists(newfilepath): # create file heirarchy if container asset amu.createNewAssetFolders(ASSETSDIR, filename) newversiondir = os.path.join(ASSETSDIR, filename+'/otl') print "dir " + newversiondir newversionpath = os.path.join(newversiondir, 'src/v000/'+filename+'.otl') print "path " + newversionpath templateNode.type().definition().copyToHDAFile(newversionpath, new_name=filename, new_menu_name=name) stablepath = amu.install(newversiondir, newversionpath) fileutil.clobberPermissions(stablepath) os.symlink(stablepath, newfilepath) hou.hda.installFile(newfilepath, change_oplibraries_file=True) newnode = hou.node(hpath).createNode(filename) # Then we will call the set_permissions shell script to see if this will fix our issue. set_permissions_path = JOB+"/papa-tools/set_permissions.sh" subprocess.call([set_permissions_path]) # templateNode.type().definition().copyToHDAFile(newfilepath, new_name=filename, new_menu_name=name) # hou.hda.installFile(newfilepath, change_oplibraries_file=True) # fileutil.clobberPermissions(newfilepath) # newnode = hou.node(hpath).createNode(filename) else: hou.ui.displayMessage("Asset by that name already exists. Cannot create asset.", title='Asset Name', severity=hou.severityType.Error) # clean up templateNode.destroy()