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 <[email protected]>:
> Send Nuke-python mailing list submissions to
> [email protected]
>
> 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
> [email protected]
>
> You can reach the person managing the list at
> [email protected]
>
> 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 <[email protected]>
> Subject: [Nuke-python] nuke.Node.hasError() -- Question re: Groups...
> To: Nuke Python discussion <[email protected]>
> Message-ID: <[email protected]>
> 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: [email protected] <mailto:
> [email protected]>
> http://armstrong-white.com/ <http://armstrong-white.com/>
>
> Email: [email protected] <mailto:[email protected]>
> 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
> [email protected], 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
[email protected]
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python