Center Selection Filter
Center Selection Filter
Is there any way to get the CenterSelectionFilter command on Python? It is not reported in the output log when executed. Also, is there any place where I can look for all the commands that are not reported in the output log?
Re: Center Selection Filter
to check if center mode is enabled: Application.GetUserPref("SI3D_SRT_CENTER")
to toggle between: Application.SetUserPref("SI3D_SRT_CENTER", not Application.GetUserPref("SI3D_SRT_CENTER"))
to toggle between: Application.SetUserPref("SI3D_SRT_CENTER", not Application.GetUserPref("SI3D_SRT_CENTER"))
Re: Center Selection Filter
As Kolya mentioned, selection filters are preferences, not commands. The command is SelectAllUsingFilter from which you have a log.
As for a way to list all commands, you just need to iterate Application.Commands.
Ex:
If it helps, this is a code I was writing to find some commands a long time ago. I never quite finished but it works:
As for a way to list all commands, you just need to iterate Application.Commands.
Ex:
Code: Select all
for x in Application.Commands:
LogMessage ( '%s | %s | %s' % ( x.Name, x.Category, x.ScriptingName ) )
If it helps, this is a code I was writing to find some commands a long time ago. I never quite finished but it works:
Code: Select all
# Find Commands
# 2016
# myara
#------------------------------------------
xsi = Application
log = xsi.Logmessage
from win32com.client import constants as c
#------------------------------------------
oPSet = XSIFactory.CreateObject("CustomProperty")
oPSet.Name = 'Search Command'
oPSet.AddParameter2( 'keyword', c.siString )
oPSet.AddParameter2( 'allkeys', c.siBool )
oGridParam = oPSet.AddGridParameter( 'resultsGrid' )
oLay = oPSet.PPGLayout
oLay.AddRow()
oLay.AddGroup("",0,90)
oLay.AddItem('keyword', 'Search' )
oLay.EndGroup()
oLay.AddGroup("",0,10)
oLay.AddItem('allkeys')
oLay.EndGroup()
oLay.EndRow()
oGridParam.Value.RowCount = 1
oGridParam.Value.ColumnCount = 3
oGridDataOnPSet = oGridParam.Value
oGridDataOnPSet.SetColumnLabel(0, "Command Name" )
oGridDataOnPSet.SetColumnLabel(1, "Category" )
oGridDataOnPSet.SetColumnLabel(2, "Scripting Name" )
oPPGItem = oLay.AddItem( "resultsGrid", "", c.siControlGrid )
oPPGItem.SetAttribute( "NoLabel", True )
oLay.Language = 'Python'
sLogic='''
xsi = Application
log = xsi.Logmessage
def keyword_OnChanged():
ppg_kw = PPG.keyword.Value
allkeys = PPG.allkeys.Value
cmds = Application.Commands
kws=[]
#get KeyWords
if len(ppg_kw.split(" "))>1:
kws = ppg_kw.split(" ")
elif len(ppg_kw.split(","))>1:
kws = ppg_kw.split(",")
else:
kws.append( ppg_kw )
filteredList = []
filteredListG = []
filteredListS = []
for c in cmds:
if allkeys:
flag = 1
for kw in kws:
if c.Name.lower().find(kw.lower())== -1:
flag = 0
if flag == 1:
filteredList.append( str(c.Name) )
filteredList.append( str(c.Name) )
filteredListG.append( str(c.Category) )
filteredListG.append( str(c.Category) )
filteredListS.append( str(c.ScriptingName) )
filteredListS.append( str(c.ScriptingName) )
else:
for kw in kws:
if c.Name.lower().find(kw.lower())!= -1 or c.ScriptingName.lower().find(kw.lower())!= -1:
if str(c.Name) not in filteredList:
filteredList.append( str(c.Name) )
filteredList.append( str(c.Name) )
filteredListG.append( str(c.Category) )
filteredListG.append( str(c.Category) )
filteredListS.append( str(c.ScriptingName) )
filteredListS.append( str(c.ScriptingName) )
PPGResults = PPG.resultsGrid.Value
PPGResults.BeginEdit()
PPGResults.RowCount = len(filteredList)/2
for i in range(len(filteredList)/2):
a = i *2
PPGResults.SetRowValues( a/2, [filteredList[a], filteredListG[a], filteredListS[a]] ) ;
PPGResults.EndEdit()
def allkeys_OnChanged():
ppgkw = PPG.keyword.Value
if ppgkw != "":
keyword_OnChanged()
'''
oLay.Logic = sLogic
xsi.InspectObj( oPSet, "", "", 3 )
M.Yara
Character Modeler | Softimage Generalist (sort of)
Character Modeler | Softimage Generalist (sort of)
Re: Center Selection Filter
Thank you so much for the help! Also, you are so generous myara, I'm a noob in scripting but I was able to finish my first script thanks to you guys, much appreciated!
Who is online
Users browsing this forum: No registered users and 66 guests