This might not be the most efficient, but we have this in place as part of a larger archive script, happy to share:
import nuke import os import sys def recursiveDependencies(n): '''Given a node, find all upstream nodes. This works, but for moderately complex nuke graphs it can take a long long time, eg 516 nodes found in 1418 seconds''' thisDependencies = set(n.dependencies()) if not thisDependencies: return set() dependencyDependencies = set() for nn in thisDependencies: dependencyDependencies.update(recursiveDependencies(nn)) return thisDependencies.union(dependencyDependencies) def findOutputs(): result = [] for n in nuke.allNodes(): if n.Class() in ["Write"]: result.append(n) return result def findInputsFromOutputs(): result = set() for n in findOutputs(): dependencies = recursiveDependencies(n) for dependent in dependencies: if dependent.Class() in ['Read','ReadGeo']: result.add(os.path.dirname(nuke.filename(dependent))) return list(result) def printInputsFromOutputs(): print '\n'.join(findInputsFromOutputs()) def findInputs(): result = set() for n in nuke.allNodes(): if n.Class() in ["Read", "ReadGeo"]: result.add(os.path.dirname(nuke.filename(n))) result = list(result) result.sort() return result def printInputs(): print '\n'.join(findInputs()) On Thu, Feb 11, 2016 at 11:34 AM, Dan Stein <daniel.st...@thefoundry.co.uk> wrote: > For non-GUI you can load Nuke as a Python module. > > > http://docs.thefoundry.co.uk/nuke/80/pythondevguide/nuke_as_python_module.html > > Then just collect the Read and ReadGeo nodes however you would in the GUI, > nuke.allNodes('Read')... etc > > On Feb 11, 2016, at 10:52 AM, Gabor Hovanyi <hova...@gmail.com> wrote: > > for reads, you could use nukescripts.get_script_data() or > nukescripts.get_reads() > > -g > > On Thu, Feb 11, 2016 at 10:26 AM, Gary Jaeger <g...@corestudio.com> wrote: > >> Is there a way, preferably in non-gui mode, to quickly generate a list of >> all read nodes, including geo, used in a script? >> >> Gary Jaeger // Core Studio >> 249 Princeton Avenue >> Half Moon Bay, CA 94019 >> 650.728.7957 (direct) >> 650.728.7060 (main) >> http://corestudio.com >> >> >> _______________________________________________ >> Nuke-users mailing list >> Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ >> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users >> > > _______________________________________________ > Nuke-users mailing list > Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users > > > _______________________________________________ > Nuke-users mailing list > Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users >
_______________________________________________ Nuke-users mailing list Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users