// Creates a new FileOut node and makes the directory it points to, ready for render. // The directory is created two levels up from the .shk script, inside a directory // called "renders", named after the script. It creates a resolution directory // inside that, taken from the script's default format. The image names are taken // from the script name. For example: // Shake script at: /path/to/somewhere/scripts/my_awesome_thing.shk // Render goes to: /path/to/somewhere/renders/my_awesome_thing/2048x1556/my_awesome_thing.####.dpx // // Put this file in your ~/nreal/include/startup/ui folder. // // Share and enjoy! // lewis@lewissaunders.com extern { int system(const char *); } void magicFileOut() { const char *c = stringf("tail +31 ~/nreal/include/startup/ui/magicFileOut.h | python - \"%s\" %d %d", NRiScript1.scriptName, NRiScript1.defaultWidth, NRiScript1.defaultHeight); nuiNodeViewCopy(); system(c); nuiNodeViewPaste(); } nuiPushMenu("NRiNodeViewPopup", 1); nuiMenuSeparator(); nuiMenuItem("Magic FileOut", magicFileOut()); nuiPopMenu(); /* py time! (this is line 30) import sys, os, errno f = sys.argv[1] up1 = os.path.dirname(f) up2 = os.path.dirname(up1) scriptname = os.path.basename(f) rendername = scriptname[:-4] w = sys.argv[2] h = sys.argv[3] rendersize = w + "x" + h renderdir = up2 + "/renders/" + rendername + "/" + rendersize try: os.makedirs(renderdir) print "magicFileout: created directory" + renderdir except OSError, e: if e.errno == errno.EEXIST: pass else: print("magicFileOut: Failed to create directory " + renderdir) nodename = os.popen("pbpaste").read().split()[0] s = rendername + " = FileOut(" + nodename + ', "' + renderdir + '/' + rendername + '.#.dpx");' os.popen("pbcopy", "wb").write(s) # */