PDA

View Full Version : itemFilter using byScript via python?


delarge
09-13-2010, 02:36 PM
Hi folks,
I'm trying to pass a python function to an itemFilter, which doesn't seem to work. The problem seems to be that a DAG nodename is passed implicitely to the function, which causes a syntax error when passed like this

cmds.itemFilter("myFilter", byScript = "myFilterProc()")

def myFilterProc(name):
return 1


filter = cmds.itemFilter("myFilter", byScript = "myFilterProc()")
cmds.outlinerEditor(name, edit = True, filter = filter)

# Result: #
// Error: myFilterProc() "persp"; //
// Error: Line 1.22: Syntax error //
// Error: myFilterProc() "perspShape"; //
// Error: Line 1.27: Syntax error //
...

In the above result that Maya script editor spits out you can see that
myFilterProc() "persp"

is called. "persp" is the argument for the preceding function name. Which means one cannot use a python function to pass to a -byScript flag for an itemfilter. Unfortunately the python itemFilter -byScript docs are the same as the mel docs.

Has anyone had any success with that before?

Cheers
R

CGTalk Moderation
09-13-2010, 02:36 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.