import nuke,nukescripts
def setProjectRootSettings():
#
setProjectFps = nuke.root()['fps'].setValue(30)
#
def largeFormat():
sn = nuke.selectedNode()
if sn.Class() != 'Read':
print('#[WARNING]: リードノードが選択されてません')
normalFormat()
else:
targetSizeFormat = nuke.selectedNode().knob("format").value()
sizeFormatWidth = targetSizeFormat.width()
sizeFormatHeight = targetSizeFormat.height()
sizeFormatPixelAspect = targetSizeFormat.pixelAspect()
hogehogeLarge = str(sizeFormatWidth) + " " + str(sizeFormatHeight) + " " + str(sizeFormatPixelAspect) + " " + "hogehoge(large)"
nuke.addFormat( hogehogeLarge )
nuke.root()['format'].setValue("hogehoge(large)")
setProjectFps
def normalFormat():
hogehogeNormalSize = '2520 1418 hogehoge(normal)'
nuke.addFormat( hogehogeNormalSize )
nuke.root()['format'].setValue("hogehoge(normal)")
setProjectFps
nodeSelected = nuke.nodesSelected()
#print nodeSelected
if nodeSelected == False:
normalFormat()
else:
largeFormat()
setProjectRootSettings()