Trees | Indices | Help |
|
---|
|
1 # Copyright (c) 2009 The Foundry Visionmongers Ltd. All Rights Reserved. 2 3 import nuke 4 import os 57 root = nuke.toNode("root") 8 curve_name = nuke.getInput("New curve name", "f") 9 if curve_name is not None: 10 if not len(curve_name) > 0: 11 nuke.message("Curve name can't be blank.") 12 else: 13 curve_knob = root.knob(curve_name) 14 if curve_knob is None: 15 root.addKnob(nuke.Double_Knob(curve_name, curve_name)) 16 nuke.animation("root."+curve_name, "expression", ("",))17 1820 '''Create a Read node for a file selected from the file browser. 21 If a node is currently selected in the nodegraph and it has a 'file' 22 (or failing that a 'proxy') knob, the value (if any) will be used as the default 23 path for the file browser.''' 24 # Get the selected node, and the path on it's 'file' knob if it 25 # has one, or failing that, it's 'proxy' node, if it has that. 26 sel_node = None 27 default_dir = None 28 try: 29 sel_node = nuke.selectedNode() 30 except: 31 pass 32 if ( sel_node is not None ) and ( sel_node != '' ): 33 if 'file' in sel_node.knobs(): 34 default_dir = sel_node['file'].value() 35 if (default_dir == None or default_dir == '') and 'proxy' in sel_node.knobs(): 36 default_dir = sel_node['proxy'].value() 37 38 # Revert default_dir to None if it's empty so that the file browser 39 # will do it's default unset behaviour rather than open on an empty path. 40 if default_dir == '': default_dir = None 41 42 # Raise the file browser and get path(s) for Read node(s). 43 files = nuke.getClipname( "Read File(s)", default=default_dir, multiple=True ) 44 if files != None: 45 for f in files: 46 nodeType = defaulttype 47 if isAudioFilename( f ): 48 nodeType = "AudioRead" 49 if isGeoFilename( f ): 50 nodeType = "ReadGeo2" 51 if isDeepFilename( f ): 52 nodeType = "DeepRead" 53 nuke.createNode( nodeType, "file {"+f+"}", inpanel = True)5456 filenameLower = filename.lower() 57 _, ext = os.path.splitext( filenameLower ) 58 59 if ext in ['.fbx', '.obj']: 60 return True 61 else: 62 return False6365 filenameLower = filename.lower() 66 _, ext = os.path.splitext( filenameLower ) 67 68 if ext in ['.dtex', '.dshd', '.deepshad']: 69 return True 70 else: 71 return False7274 filenameLower = filename.lower() 75 _, ext = os.path.splitext( filenameLower ) 76 77 if ext in ['.wav', '.wave', '.aif', '.aiff']: 78 return True 79 else: 80 return False8183 views = nuke.views() 84 if len(views) < 2: 85 nuke.message("Only one view, nothing to split and rejoin.") 86 return 87 88 sel = nuke.selectedNode() 89 if sel == None: 90 nuke.message("You need to select a node to split views from and rejoin.") 91 return 92 93 nodes = [] 94 for i in views: 95 n = nuke.createNode("OneView", inpanel=False) 96 n.knob("label").setValue(i) 97 nodes.append(n) 98 99 selx = sel.knob("xpos").getValue() 100 sely = sel.knob("ypos").getValue() 101 102 join = nuke.createNode("JoinViews", inpanel=False) 103 104 for idx in range(0, len(nodes)): 105 nodes[idx].knob("view").setValue(idx+1) 106 nodes[idx].setInput(0, sel) 107 nodes[idx].knob("xpos").setValue(selx + idx * 100 - (len(nodes)-1)*50) 108 nodes[idx].knob("ypos").setValue(sely + 90) 109 join.setInput(idx, nodes[idx]) 110 111 join.knob("xpos").setValue(selx) 112 join.knob("ypos").setValue(sely+180)113
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Jul 17 22:06:13 2011 | http://epydoc.sourceforge.net |