Hello All,
I have a question in regards to nukes version-ing up system. Nuke already
has a "Save New Version" button however, the company that I am working at
does not want to have the mandatory "v" in their naming convention for
their pipeline. So I made a little script to version up without using the
"v" BUT, right now the script versions up but nuke does not switch to the
new/latest save of the save file, if that makes sense.. So I am wondering
what is the way to tell nuke to version up and to switch to the new version
of the file without nuke restarting? Basically do what nuke already does
just without the "v" haha :P. I just do not know where to even start
looking for the right code to make this happen.. so any help would be
awesome :). If this isn't a possibility then please let me know as well.
(I know the script is very amateur.. I just started learning python a week
and a half ago. But I'm catching on pretty fast. Feel free to give me
pointers on my python grammar :D)
Thanks!
Manley
######################
import nuke, os
def nukeScripVersionUp():
currentNukeScriptName = nuke.root().name()
nukeSaveFolderPath = os.path.dirname(currentNukeScriptName)
splitUpScriptName1 = currentNukeScriptName.split('/')
splitUpScriptName2 = splitUpScriptName1[-1]
splitScriptNameAndExtention = splitUpScriptName2.split('.')
currentNukeScriptName = splitScriptNameAndExtention[0]
splitUpCurrentScriptName = currentNukeScriptName.split('_')
currentVersionNumber = splitUpCurrentScriptName[-1]
decimalVersionNumber = "1" + str(currentVersionNumber)
addingNumber = 1
currentVersionPlusOne = int(decimalVersionNumber) + int(addingNumber)
listUpVersion = list(str(currentVersionPlusOne))
del listUpVersion[0]
newVersionNumber = "".join(listUpVersion)
del splitUpScriptName1[-1]
nukeShotName = currentNukeScriptName.split("_")
del nukeShotName[-1]
nukeShotName = "_".join(splitUpCurrentScriptName)
newScriptNameAndPath = nukeSaveFolderPath + "/" + nukeShotName + "_" +
newVersionNumber + ".nk"
if os.path.exists(currentNukeScriptFileName):
os.rename(currentNukeScriptFileName, newScriptNameAndPath)
print nuke.message ("Nuke Script Version Up")
else:
print nuke.message ("Cannot Save")
######################################
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python