def iterMembers( self, *args, **kwargs ): """Iterate members of this set :note: All keywords of iterMembers are supported :note: if 'handlePlugs' is False, the iteration using a filter type will be faster :note: handleComponents will allow component iteration - see the iterator documentation""" return it.iterSelectionList( self.getMembers( ), *args, **kwargs )
def miterPlugs(self, **kwargs): """:return: Iterator yielding all plugs on this selection list. :param kwargs: passed on to `it.iterSelectionList`""" kwargs["handlePlugs"] = True pred = lambda n: isinstance(n, api.MPlug) kwargs["predicate"] = pred return it.iterSelectionList(self, **kwargs)
def miterPlugs( self, **kwargs ): """:return: Iterator yielding all plugs on this selection list. :param kwargs: passed on to `it.iterSelectionList`""" kwargs['handlePlugs'] = True pred = lambda n: isinstance(n, api.MPlug) kwargs['predicate'] = pred return it.iterSelectionList( self, **kwargs )
def miterComponents(self, **kwargs): """ :return: Iterator yielding node, component pairs, component is guaranteed to carry a component, implying that this iterator applies a filter :param kwargs: passed on to `it.iterSelectionList`""" kwargs["handleComponents"] = True pred = lambda pair: not pair[1].isNull() kwargs["predicate"] = pred return it.iterSelectionList(self, **kwargs)
def miterComponents( self, **kwargs ): """ :return: Iterator yielding node, component pairs, component is guaranteed to carry a component, implying that this iterator applies a filter :param kwargs: passed on to `it.iterSelectionList`""" kwargs['handleComponents'] = True pred = lambda pair: not pair[1].isNull() kwargs['predicate'] = pred return it.iterSelectionList( self, **kwargs )
def _addRemoveMembers( self, members, mode, ignore_failure ): """Add or remove the members to the set :param mode: kRemove or kAdd or kAddForce""" sellist = nt.toSelectionList( members ) # handles 'member is SelectionList' case ! lsellist = sellist.length() if not lsellist: return self # if there is only one member, use our single member function # as it will be faster when checking for partition constraints if lsellist == 1: return self._addRemoveMember( it.iterSelectionList( sellist, asNode = 0 ).next(), api.MObject(), mode, ignore_failure ) # prepare operation mfninst = self._mfncls( self._apiobj ) doitfunc = mfninst.addMembers undoitfunc = mfninst.removeMembers # swap functions if we remove the node if mode == ObjectSet.kRemove: tmp = undoitfunc undoitfunc = doitfunc doitfunc = tmp # IMPORTANT: If one member of sellist is not in the set, the operation # will *silently* ( WTF ??) fail. Hence we have to make sure that # we only even remotely think about trying to remove items which are # actually in the set ! sellist = self.intersection(sellist) # END function swapping op = undo.GenericOperation() op.setDoitCmd( doitfunc, sellist ) op.setUndoitCmd( undoitfunc, sellist ) op.doIt() return self._checkMemberAddResult( sellist, None, mode, ignore_failure, False )
def iterDifference( self, setOrSetsOrObjects, **kwargs ): """As difference, but returns an iterator :param kwargs: passed to it.iterSelectionList""" return it.iterSelectionList( self.difference( setOrSetsOrObjects ), **kwargs )
def iterIntersection( self, setOrSetsOrObjects, **kwargs ): """As intersection, but returns an iterator :param kwargs: passed to it.iterSelectionList""" return it.iterSelectionList( self.intersection( setOrSetsOrObjects ), **kwargs )
def mtoIter(self, *args, **kwargs): """:return: iterator yielding of Nodes and MPlugs stored in this given selection list :note: all args and kwargs are passed to `it.iterSelectionList`""" return it.iterSelectionList(self, *args, **kwargs)
def mtoIter( self, *args, **kwargs ): """:return: iterator yielding of Nodes and MPlugs stored in this given selection list :note: all args and kwargs are passed to `it.iterSelectionList`""" return it.iterSelectionList( self, *args, **kwargs )