speaking of which, why doesn't this work?

import maya.OpenMaya as om
sel = om.MSelectionList()
sel.add( 'persp' )
obj = om.MObject()
sel.getDependNode( 0, obj )
mfd = om.MFnDependencyNode(obj)
plugs = om.MPlugArray()
mfd.getConnections(plugs)

i feel like i must be missing something obvious because i would  
imagine this is a fairly regularly used method.

-chad



On Dec 8, 2009, at 9:53 AM, Chris G wrote:

> You could probably use undoInfo to turn off undo, and then
> MFnDependencyNode::getConnections.  There is still a lot of overhead
> there, so not sure how much that would help.
>
>
> On Tue, Dec 8, 2009 at 12:32 PM, Sune <[email protected]> wrote:
>> "(I once had to get rid of 150 000 keyframes the animator had made on
>> every
>> single vertice in a scene, so I feel your pain)"
>>
>> Ha ha :-)
>>
>> Thank you for that, those are good points. I'll give that a go. I'm
>> not sure I can save these scenes as .ma though..
>>
>> Sune
>>
>> On Dec 8, 5:18 pm, Jo Jürgens <[email protected]> wrote:
>>> Maybe a stupid idea, but how about parsing the maya ascii file to  
>>> detect
>>> connections and save a list to disk, then go through that list when
>>> deleting?
>>>
>>> Also, putting flushUndo in the loop will help a lot, so that maya  
>>> wont have
>>> to keep 200 000 deletes in memory. Even save as for every 1000  
>>> iterations,
>>> in case Maya dies in the middle of the process
>>>
>>> (I once had to get rid of 150 000 keyframes the animator had made  
>>> on every
>>> single vertice in a scene, so I feel your pain)
>>>
>>>
>>>
>>> On Tue, Dec 8, 2009 at 5:59 PM, Sune <[email protected]> wrote:
>>>> Uh, I can see that "delete" also takes forever, so please take this
>>>> into account as well
>>>
>>>> On Dec 8, 3:16 pm, Sune <[email protected]> wrote:
>>>>> Hi,
>>>
>>>>> I need to look at a bunch of nodes and check if they have more  
>>>>> than
>>>>> one connections. Alternatively I can check if a specific  
>>>>> attrubte has
>>>>> an outgoing connection. The problem if that there are 200000+ of  
>>>>> these
>>>>> nodes in some scenes, so "listConnections" on all of them just  
>>>>> takes a
>>>>> bit too long :-)
>>>
>>>>> Current code:
>>>
>>>>> for g in ls(type='groupId'):
>>>>>         if 2 > len(listConnections(g, destination=True,  
>>>>> source=False)):
>>>>>                 delete(g)
>>>
>>>>> So any input on some optimised code to do this would be great!  
>>>>> Maybe
>>>>> some openmaya? I have pymel installed.
>>>
>>>>> Thanks,
>>>>> Sune
>>>
>>>> --
>>>> http://groups.google.com/group/python_inside_maya
>>
>> --
>> http://groups.google.com/group/python_inside_maya
>
> -- 
> http://groups.google.com/group/python_inside_maya

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to