本文整理汇总了Python中ui_tools.ui.infoWindow函数的典型用法代码示例。如果您正苦于以下问题:Python infoWindow函数的具体用法?Python infoWindow怎么用?Python infoWindow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了infoWindow函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkoutLightingFile
def checkoutLightingFile():
print("checkoutLightingFile")
shotPaths = glob.glob(os.path.join(os.environ["SHOTS_DIR"], "*"))
selections = []
for sp in shotPaths:
selections.append(os.path.basename(sp))
selections.sort()
print("Im calling ui")
answer = ui.listWindow(selections, wmessage="Select shot file to checkout:")
print("Im done calling ui")
if answer:
answer = answer[0]
toCheckout = os.path.join(os.environ["SHOTS_DIR"], selections[answer], "lighting")
try:
destpath = amu.checkout(toCheckout, True)
except Exception as e:
if not amu.checkedOutByMe(toCheckout):
ui.infoWindow("Can Not Checkout: " + str(e))
return
else:
destpath = amu.getCheckoutDest(toCheckout)
toOpen = os.path.join(destpath, get_filename(toCheckout) + ".hipnc")
if os.path.exists(toOpen):
hou.hipFile.load(toOpen)
else:
hou.hipFile.clear()
hou.hipFile.save(toOpen)
示例2: checkFiles
def checkFiles(files):
'''
Checks the list of output files against which files were actually created
@param: files - a list of strings representing full paths
@return: a list of paths to files that do not exist
'''
missingFiles = []
for filename in files:
print "CHECKING********** " + filename
if not os.path.exists(filename):
missingFiles.append(filename)
if not len(missingFiles) == 0:
errorMessage = ""
for f in missingFiles:
errorMessage += "MISSING FILE: " + f + "\n"
print(errorMessage)
errorMessage = str(len(missingFiles)) + " Files Missing:\n\n" + errorMessage
#mc.confirmDialog(title="Error exporting files", message=errorMessage)
ui.infoWindow(errorMessage, wtitle="Error exporting files", msev=messageSeverity.Error)
return missingFiles
示例3: checkin
def checkin():
"""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."""
updateDB()
node = getSelectedNode()
if node != None:
if not isDigitalAsset(node):
ui.infoWindow("Not a Digital Asset.")
else:
libraryPath = node.type().definition().libraryFilePath()
filename = os.path.basename(libraryPath)
info = getFileInfo(filename)
if info == None:
ui.infoWindow("Add the OTL first")
elif info[2]:
if not node.isLocked() and info[3] == USERNAME:
saveOTL(node) # This save is not strictly necessary since we save again two lines down
lockAsset(node, False)
saveOTL(node)
moveToOtlDir(node, filename)
unlockOTL(filename)
ui.infoWindow("Checkin Successful!")
else:
ui.infoWindow(lockedBy(info[3].encode('utf-8')))
else:
ui.infoWindow("Already checked in.")
else:
#ui.infoWindow("Select EXACTLY one node.")
checkinLightingFile()
示例4: checkout
def checkout(node):
"""Checks out the selected node. EXACTLY ONE node may be selected, and it MUST be a digital asset.
The node must already exist in the database."""
updateDB()
if not isDigitalAsset(node):
ui.infoWindow("Not a Digital Asset.")
else:
if node.type().name() == "geometryTemplate":
ui.infoWindow("Cannot checkout geometry template node.")
return False
libraryPath = node.type().definition().libraryFilePath()
filename = os.path.basename(libraryPath)
info = getFileInfo(filename)
if info == None:
ui.infoWindow("Add OTL First.")
elif not info[2] or (info[2] and info[3].encode("utf-8") == USERNAME):
copyToUsrDir(node, filename)
lockAsset(node, True)
saveOTL(node)
node.allowEditingOfContents()
lockOTL(filename)
ui.infoWindow("Checkout Successful!", wtitle="Success!")
else:
logname, realname = amu.lockedBy(info[3].encode("utf-8"))
whoLocked = "User Name: " + logname + "\nReal Name: " + realname + "\n"
errstr = "Cannot checkout asset. Locked by: \n\n" + whoLocked
ui.infoWindow(errstr, wtitle="Asset Locked", msev=messageSeverity.Error)
示例5: checkout
def checkout():
"""Checks out the selected node. EXACTLY ONE node may be selected, and it MUST be a digital asset.
The node must already exist in the database."""
updateDB()
node = getSelectedNode()
if node != None:
if not isDigitalAsset(node):
ui.infoWindow("Not a Digital Asset.")
else:
if node.type().name() == "geometryTemplate":
ui.infoWindow("Cannot checkout geometry template node.")
return False
libraryPath = node.type().definition().libraryFilePath()
filename = os.path.basename(libraryPath)
info = getFileInfo(filename)
if info == None:
ui.infoWindow("Add OTL First.")
elif not info[2]: #or (info[2] and info[3] == USERNAME):
copyToUsrDir(node, filename)
lockAsset(node, True)
saveOTL(node)
node.allowEditingOfContents()
lockOTL(filename)
ui.infoWindow("Checkout Successful!", wtitle='Success!')
else:
ui.infoWindow(lockedBy(info[3].encode('utf-8')))
else:
#ui.infoWindow("Select EXACTLY one node.")
checkoutLightingFile()
示例6: checkoutLightingFile
def checkoutLightingFile():
shotPaths = glob.glob(os.path.join(os.environ['SHOTS_DIR'], '*'))
selections = []
for sp in shotPaths:
selections.append(os.path.basename(sp))
selections.sort()
answer = ui.listWindow(selections, wmessage='Select shot file to checkout:')
if answer:
answer = answer[0]
toCheckout = os.path.join(os.environ['SHOTS_DIR'], selections[answer], 'lighting')
try:
destpath = amu.checkout(toCheckout, True)
except Exception as e:
if not amu.checkedOutByMe(toCheckout):
ui.infoWindow('Can Not Checkout: '+str(e))
return
else:
destpath = amu.getCheckoutDest(toCheckout)
toOpen = os.path.join(destpath, get_filename(toCheckout)+'.hipnc')
if os.path.exists(toOpen):
hou.hipFile.load(toOpen)
else:
hou.hipFile.clear()
hou.hipFile.save(toOpen)
示例7: checkin
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."""
updateDB()
if node != None:
if not isDigitalAsset(node):
ui.infoWindow("Not a Digital Asset.")
else:
libraryPath = node.type().definition().libraryFilePath()
filename = os.path.basename(libraryPath)
info = getFileInfo(filename)
if info == None:
ui.infoWindow("Add the OTL first")
elif info[2]:
if not node.isLocked() and info[3] == USERNAME:
saveOTL(node) # This save is not strictly necessary since we save again two lines down
lockAsset(node, False)
saveOTL(node)
moveToOtlDir(node, filename)
unlockOTL(filename)
ui.infoWindow("Checkin Successful!")
else:
logname, realname = amu.lockedBy(info[3].encode('utf-8'))
whoLocked = 'User Name: ' + logname + '\nReal Name: ' + realname + '\n'
errstr = 'Cannot checkin asset. Locked by: \n\n' + whoLocked
ui.infoWindow(errstr, wtitle='Asset Locked', msev=messageSeverity.Error)
else:
ui.infoWindow("Already checked in.")
else:
#ui.infoWindow("Select EXACTLY one node.")
checkinLightingFile()
示例8: newGeo
def newGeo(hpath):
templateNode = hou.node(hpath).createNode("geometryTemplate")
alist = listContainers()
resp = ui.inputWindow("Enter the New Operator Label", wtitle="OTL Label")
filename = str()
if resp != None and resp.strip() != "":
name = formatName(resp)
filename = name.replace(" ", "_")
templateNode.setName(filename, unique_name=True)
answer = ui.listWindow(alist, wmessage="Select Container Asset this belongs to:")
if not answer:
ui.infoWindow(
"Geometry must be associated with a container asset! Geometry asset not created.",
msev=messageSeverity.Error,
)
templateNode.destroy()
return
answer = answer[0]
sdir = "$JOB/PRODUCTION/assets/"
gfile = ui.fileChooser(
start_dir=sdir + alist[answer] + "/geo",
wtitle="Choose Geometry",
mode=fileMode.Read,
extensions="*.bjson, *.obj",
)
if len(gfile) > 4 and gfile[:4] != "$JOB":
ui.infoWindow(
"Path must start with '$JOB'. Default geometry used instead.",
wtitle="Path Name",
msev=messageSeverity.Error,
)
templateNode.destroy()
elif gfile != "":
hou.parm(templateNode.path() + "/read_file/file").set(gfile)
示例9: newTexture
def newTexture():
# Get a list of assets
assetList = glob.glob(os.path.join(os.environ['ASSETS_DIR'], '*'))
selections = []
for aL in assetList:
# basename takes last folder in path.
selections.append(os.path.basename(aL))
# sort alphabetically
selections.sort()
answer = ui.listWindow(selections, wmessage='Choose an asset to add/update textures for')
if answer:
answer = answer[0]
assetName = selections[answer]
assetImageDir = os.path.join(os.environ['ASSETS_DIR'], assetName, 'images')
# Direct user to geometry file path and have them choose the correct one
sdir = '$JOB/PRODUCTION/assets/'+assetName+'/geo/bjsonFiles'
geoPath = ui.fileChooser(start_dir=sdir, wtitle='Choose Asset Geometry for Texture', mode=fileMode.Read, extensions='*.bjson, *.obj')
geoName, ext = os.path.splitext(os.path.basename(geoPath))
# Show a list of shading passes
shadingPassList = ['diffuse','specular','bump','scalar_displacement','vector_displacement', 'opacity', 'single_SSS', 'multi_SSS', 'other']
answer = ui.listWindow(shadingPassList, wmessage='Which texture will you be creating/updating?')
if answer:
answer = answer[0]
shadingPass = shadingPassList[answer]
# Allow user to choose texture map in user local directory
userDirectory = os.environ['USER_DIR']
userTextureMap = ui.fileChooser(start_dir=userDirectory, wtitle='Browse to the Texture Map in your User Directory', image=True, extensions='*.jpg,*.jpeg,*.tiff,*.tif,*.png,*.exr')
#Allow user to search for texture in any directory
userTextureMap = os.path.expandvars(userTextureMap)
# Set Variables for texture paths
newTexture = '/tmp/newTexture.png'
convertedTexture = '/tmp/convertedTexture.png'
finalTexture = '/tmp/finalTexture.exr'
# Change to 16 bits and convert to png
os.system('iconvert -d 16 ' +userTextureMap+ newTexture)
# Gamma correct for linear workflow
if shadingPass == 'diffuse' or shadingPass == 'specular' or shadingPass == 'single_SSS' or shadingPass == 'multi_SSS' or shadingPass == 'other':
os.system('icomposite' +convertedTexture +'= gamma 0.4545454545' +newTexture)
# Convert to .exr with otimized settings
os.system('iconvert -d half '+convertedTexture+finalTexture+' storage tile 64 tiley 65 compression zip')
# Seperate extension from filename and rename texture to production pipeline name
finalTextureName, ext = os.path.splitext(os.path.basename(finalTexture))
newTextureName = assetName+'_'+geoName+'_'+shadingPass+ext
newfilepath = os.path.join(assetImageDir,newTextureName)
shutil.copy(finalTexture,newfilepath)
# Output final success message
ui.infoWindow('Your texture was saved to: '+newfilepath+' as a .exr image file')
示例10: convert_texture
def convert_texture(userTextureMap, assetImageDir, folder_name=''):
print userTextureMap
if os.path.isdir(userTextureMap):
return
extensions = ['.jpg','.jpeg','.tiff','.tif','.png','.exr']
userFileName, userExt = os.path.splitext(os.path.basename(userTextureMap))
if userExt not in extensions:
return
# Set Variables for texture paths
convertedTexture = os.path.join('/tmp','intermediate'+userFileName+'.exr')
print "convertedTexture:: "+convertedTexture
finalTexture = os.path.join('/tmp','finished'+userFileName+'.exr')
print "finalTexture:: "+finalTexture
# Gamma correct for linear workflow
if 'DIFF' in userTextureMap or 'diffuse' in userTextureMap:
args = ['icomposite',convertedTexture,'=','gamma',str(1/2.2),userTextureMap]
subprocess.check_call(args)
didgamma = '\nIt has been gamma corrected.'
else:
convertedTexture = userTextureMap
didgamma = ''
# Convert to .exr with otimized settings. Also, setting compatible with RenderMan (in case we need to render there)
args = ['txmake','-mode','periodic','-compression','zip']
args += ['-format','openexr','-half',convertedTexture,finalTexture]
# Uncomment the following and comment out the previous call if PRMan is not present
"""
args = 'iconvert -d half ' + convertedTexture + ' '
args += finalTexture + ' storage tile tilex 32 tiley 32 compression zip'
subprocess.check_call( args.split() )
"""
try:
subprocess.check_call(args)
except subprocess.CalledProcessError as e:
ui.infoWindow('Failed to convert texture. The following error occured:\n' + str(e))
else:
# Rename texture and move into production pipeline
newTextureName = userFileName + '.exr'
newfilepath = os.path.join(assetImageDir, folder_name, newTextureName)
print "new file path:: "+newfilepath
try:
fileutil.move(finalTexture, newfilepath)
except Exception as e:
os.remove(finalTexture)
ui.infoWindow('Failed to move texture. The following error occured:\n' + str(e), msev=messageSeverity.Error)
finally:
if convertedTexture != userTextureMap:
os.remove(convertedTexture)
示例11: rollbackOTL
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"
示例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')
示例13: unlockOTL1
def unlockOTL1():
"""Calls unlockOTL with the selected node"""
node = getSelectedNode()
if node != None:
if not isDigitalAsset(node):
ui.infoWindow("Not a Digital Asset.")
else:
libraryPath = node.type().definition().libraryFilePath()
filename = os.path.basename(libraryPath)
#TODO save this somewhere
unlockOTL(filename)
示例14: 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, False)
srcFile = amu.getAvailableInstallFiles(dest)[0]
amu.install(dest, srcFile)
else:
ui.infoWindow("Checkin Failed")
示例15: getNodeInfo
def getNodeInfo(node):
if node != None and isDigitalAsset(node):
updateDB()
libraryPath = node.type().definition().libraryFilePath()
filename = os.path.basename(libraryPath)
nodeInfo = getFileInfo(filename)
message = ""
if nodeInfo[2]:
logname, realname = amu.lockedBy(nodeInfo[3].encode("utf-8"))
message = "Checked out by " + realname + " (" + logname + ")"
else:
message = "Not checked out."
ui.infoWindow(message, wtitle="Node Info")