I ran into something similar and decided to stop for performance reasons. The factory cmds.nodeType is just so fast that I couldn't rationalize doing all of this in python.
-Judah On Fri, Dec 3, 2010 at 4:57 PM, Adam Mechtley <[email protected]>wrote: > I think part of the problem here is that the "types" recognized in the > command engine (e.g. listConnections) are somewhat arbitrary. I mean those > are just sort of "nice names" for some API type, right? One possibility > would be to write a script that just creates a node of each type and uses > the nodeType command to populate a "static" dictionary in some module with > niceName:apiType pairs, assuming you want the same types represented by nice > names in the command engine. In the case of custom node types (e.g., apiType > = kPluginDependNode), I think you'd just need to rely on the MTypeID to > distinguish one from another. I've only ever had to filter custom node types > in associated custom commands, in which case I just validate the argdata > using the MTypeID of the object. > > On Fri, Dec 3, 2010 at 6:22 PM, Chad Dombrova <[email protected]> wrote: > >> >> hi all, >> i'm trying to write a function using the maya API that reproduces the >> behavior of listConnections, and i'm getting tripped up on the type filter. >> All of the MIt classes take an MFn::type as a filter, but there seems to be >> no way lookup an MFn::type given a maya node type name, e.g. "transform" --> >> kTransform. worse still, there is not an MFn::type for every node type, so >> how do i go about searching for a specific custom node? for example, if >> someone passes in "myCustomNode" as the type i would imagine i would have to >> first determine that the MFn::type is kPluginDependNode. since filtering >> on kPluginDependNode will include all custom dependency nodes, i would then >> have to do a post-filter to test the actual node type. so on top of needing >> to know how to lookup MFn::types from node types, i also need to maintain a >> list of all the MFn::types like kPluginDependNode and kPluginDeformNode that >> will need additional post-filtering. please tell me there is a better way. >> >> -chad >> >> >> >> >> >> -- >> http://groups.google.com/group/python_inside_maya >> > > -- > http://groups.google.com/group/python_inside_maya > -- http://groups.google.com/group/python_inside_maya
