function TB_CreateCustomWriteNodes() { // Script written by Lilly Vogelesang // at Toon Boom Animation inc. // 2009-11-13 // // This script takes the selected nodes and attaches write nodes to them. The write nodes point // to a specific location defined by the // structure //serverName/jobName/sceneName/moduleName/moduleName001.tga4 // or by basePath/jobName/sceneName/moduleName/moduleName001.tga4 // // please note that the drawing type can be changed from TGA4 to the desired format scene.beginUndoRedoAccum("Create Custom Write Nodes"); //Enter the base path in the variable below: var basePath = "Z:/basePath/"; var jobName = scene.currentJob(); print(jobName); var sceneName = scene.currentScene(); var frameNames = ""; var nodeType = "WRITE"; var numberOfNodes = selection.numberOfNodesSelected(); print("Number of nodes selected: " + numberOfNodes); var i; //create the Dialog var d = new Dialog; d.title = "Confirm Server, Folder, Job, and Scene"; d.width = 350; var group = new GroupBox; group.title = "The write node will be configured as the following: basePath/jobName/sceneName/moduleName/moduleName001.tga4"; var basePathLE = new LineEdit; basePathLE.label = "Base Path: "; basePathLE.text = basePath; group.add(basePathLE); var jobNameLE = new LineEdit; jobNameLE.label = "Job Name: "; jobNameLE.text = jobName; group.add(jobNameLE); var sceneNameLE = new LineEdit; sceneNameLE.label = "Scene Name: "; sceneNameLE.text = sceneName; group.add(sceneNameLE); d.add(group); var rc = d.exec(); if (!rc){ return; } for (i=0; i<numberOfNodes; i++) { var nodePath = selection.selectedNode(i); var nodeX = node.coordX(nodePath); var nodeY = node.coordY(nodePath); var originalNodeName = node.getName(nodePath); var parentNode = node.parentNode(nodePath); var nodeName = ""; nodeName = (originalNodeName + "_WRITE"); print("Node Path: " + nodePath); node.add("Top", nodeName, nodeType,0,0,0); var writeNodePath = (parentNode + "/" + nodeName); node.link(nodePath, 0, writeNodePath, 0); node.setCoord(writeNodePath, nodeX, nodeY - 100); frameNames = originalNodeName; var writeNodePathLocation = basePathLE.text + jobNameLE.text + "/" + sceneNameLE.text + "/" + originalNodeName + "/" + frameNames + "-"; node.setTextAttr(writeNodePath, "DRAWING_TYPE", 0, "TGA4" ); //here is where you can modify the drawing format - can be changed from TGA4 to the desired format var newDrawingType = node.getTextAttr(writeNodePath, 0, "DRAWING_TYPE"); print("The new drawing type is: " + newDrawingType); node.setTextAttr(writeNodePath, "DRAWING_NAME", 0, writeNodePathLocation); var newDrawingPath = node.getTextAttr(writeNodePath, 0, "DRAWING_NAME"); print("The new location for the frames is: " + newDrawingPath); } scene.endUndoRedoAccum(); // print("This code was brought to you by Lilly Vogelesang!"); } //createWriteNodes();