I have a slightly different method for affecting all nodes, group or not.
First I get all nodes with a recurseGroups = True, then I do a
node.fullName(). If the node has a "." I pass it through a function that
has a "with", "begin" and "end" for each "." (level within a group). That
way I can go all the way down to groups seven layers deep without worrying
about what level I'm at in any given function.

On Wed, Nov 4, 2015 at 3:44 AM, Balázs Kerek <balazs.ke...@gmail.com> wrote:

> group.begin()
> code
> group.end()
>
> works also, but you can do recursive with this extension:
> http://shidarin.github.io/2014/building-a-better-nukeallnodes/
>
> Nothing wrong with your solution imho, but if it is a group you should
> call your def to that group as well!
> def getNodes():
>     for node in nuke.allNodes(group='root'):
>         if node is group:
>            getNodes(node)
>         else:
>            do your thing
>
>
> 2015-11-04 13:00 GMT+01:00 <nuke-python-requ...@support.thefoundry.co.uk>:
>
>> Send Nuke-python mailing list submissions to
>>         nuke-python@support.thefoundry.co.uk
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>> or, via email, send a message with subject or body 'help' to
>>         nuke-python-requ...@support.thefoundry.co.uk
>>
>> You can reach the person managing the list at
>>         nuke-python-ow...@support.thefoundry.co.uk
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of Nuke-python digest..."
>>
>>
>> Today's Topics:
>>
>>    1. nuke.Node.hasError() -- Question re: Groups... (Rich Bobo)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Tue, 03 Nov 2015 14:16:26 -0500
>> From: Rich Bobo <richb...@mac.com>
>> Subject: [Nuke-python] nuke.Node.hasError() -- Question re: Groups...
>> To: Nuke Python discussion <nuke-python@support.thefoundry.co.uk>
>> Message-ID: <0a6e06a8-e4ac-46fa-ab74-d085c6efa...@mac.com>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Hi,
>>
>> I have run into problems getting nuke.Node.hasError() to work on nodes
>> inside a group. I have a solution, but it doesn’t seem very elegant and I’m
>> wondering if there’s a better way…
>>
>> First, a general description of what I’m doing:
>> 1)  Get a list of all the source nodes in a script — Read, ReadGeo, etc.
>> — including nodes in any Groups…
>> 2)  Check the list of nodes for errors using the .hasError() method.
>>
>> If I run my code in the Script Editor, all works as expected. I get the
>> list of nodes and can check them all, including those in groups. However,
>> if I run the code via a menu, the nodes inside the groups are not checked
>> for errors.
>>
>> To workaround this problem, I am doing this:
>>
>> nodes_with_errors = []
>> for node in sourceNodes:
>>         # Check to see if node is actually in a group and run .hasError()
>> method in that context...
>>         if '.' in node.fullName():
>>                 node_group =
>> nuke.toNode('.'.join(node.fullName().split('.')[:-1]))
>>                 with node_group:
>>                         if node.hasError() == True:
>>                                 nodes_with_errors.append(node)
>>         # Node not in a group, so just check it for errors...
>>         else:
>>                 if node.hasError() == True:
>>                         nodes_with_errors.append(node)
>> return nodes_with_errors
>>
>> …Seems kinda ugly. When running code via a menu, is there a better way to
>> take a list of nodes that are both inside and outside of group nodes and
>> operate on them all in the same context…?
>>
>> Thanks for any insights,
>> Rich
>>
>>
>> Rich Bobo
>> Senior VFX Compositor
>> Armstrong White
>> Email:  rich.b...@armstrong-white.com <mailto:
>> rich.b...@armstrong-white.com>
>> http://armstrong-white.com/ <http://armstrong-white.com/>
>>
>> Email:  richb...@mac.com <mailto:richb...@mac.com>
>> Mobile:  (248) 840-2665
>> Web:  http://richbobo.com/ <http://richbobo.com/>
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://support.thefoundry.co.uk/cgi-bin/mailman/private/nuke-python/attachments/20151103/b51f2085/attachment.html
>>
>> ------------------------------
>>
>> _______________________________________________
>> Nuke-python mailing list
>> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>
>> End of Nuke-python Digest, Vol 94, Issue 2
>> ******************************************
>>
>
>
>
> --
> Kerek Balázs
> 70 / 605-38-59
> c...@c1p0.hu
>
> _______________________________________________
> Nuke-python mailing list
> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to