Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
When python uses (iconTextButton) to import the path, is there any way to remove the suffix? My script is a script that reads the cache. After clicking the folder icon to import the path, you need to delete the suffix before reading it. Is there any way to automatically delete the file suffix after importing the path?
def Cacha_path(pp=1):
global browsePath
singleFilter = "Maya Files (*.abc *.fur *.png)"
path = cmds.fileDialog2(fileFilter=singleFilter,dialogStyle=2)
browsePath = str(path[0])
if pp == 1:
cmds.textField("readCachepath", e=True, text=browsePath)
return browsePath
def read_yeti_cache():
r_cache_path = cmds.textField("readCachepath", q=True, text=True)
r_cache_path = r_cache_path.replace('\\', '/')
r_shufix = cmds.optionMenu(rshufix, query=True, value=True)
sel = cmds.ls(sl=1, dag=1, s=1, type='pgYetiMaya')
for node in sel:
cmds.setAttr(node + '.fileMode', 1)
cmds.setAttr(node + '.cacheFileName', "{}{}".format(r_cache_path, r_shufix), type='string')
cmds.window( title='maya_tool')
cmds.columnLayout()
cmds.rowLayout(nc=3)
cmds.textField("readCachepath", editable=True, w=300, h=30)
cmds.iconTextButton(st='iconOnly', i1='SP_FileDialogNewFolder.png', c="Cacha_path(pp=1)",w=50, h=30)
cmds.setParent('..')
cmds.rowLayout(nc=3)
rshufix = cmds.optionMenu("rs_hufix", h=30, w = 200, label = "suffix")
cmds.menuItem( label='.%03d.fur' )
cmds.menuItem( label='.%03d.abc' )
cmds.button(l='Read cache', c="read_yeti_cache()", bgc=(0.4, 0.2, 0.3), width=200, h=30)
cmds.showWindow()
Solved! Go to Solution.