Research object: Fnnukeshotexporter script Research in Hiero Objective: To modify the fnnukeshotexporter so that multiple trackitem can be imported into one. NK Fnnukeshotexporter This script controls the Nuke project file output option in exporter, and the methods for Trackitem output to. NK Engineering are stored in this script. The Nukeshotexporter class inherits from the Shottask class in Fnshotexporter, and the output. The core code of the NK project is in the Self.step () method. Reading this code carefully will also find that the method calls the scriptwriter class from hiero.core.nuke.Script.py, which calls multiple Node classes in hiero.core.nuke.Node.py. It's easy to make changes to the functionality after you understand the internal logic relationships. We find that the last part of the Self.step () method has such a line:SCRIPT.WRITETODISK_VHQ (scriptfilename)This is obviously a way to write a script object to a specific. nk file. Locate the method code block as follows:def writetodisk (self, scriptfilename):
Dstdir = Os.path.dirname (scriptfilename)
if not os.path.exists (Dstdir):
Os.makedirs (Dstdir)
if Os.path.lexists (scriptfilename):
Os.remove (Scriptfilename)
filecontents = str (self)
f = open (Scriptfilename, ' W ')
F.write (filecontents)
f.close () We found that the 56th line of code would determine the same name. If the NK project exists, it will be deleted if it exists, and then a new. NK project will be created to write, which is contrary to the idea of writing several trackitem to the same. NK Engineering, so just modify this method so that it can be repeated for the same project. The specific modification method is very simple, will not say.
Analysis and modification of Hiero_fnnukeshotexporter