Trees | Indices | Help |
|
---|
|
1 # Copyright (c) 2009 The Foundry Visionmongers Ltd. All Rights Reserved. 2 3 import nuke 4 import nukescripts 5 import math 6 79 """All new camera_up that uses the version_get/set functions. 10 This script takes the render camera up one in selected iread/writes. 11 Camera may be _c# or _p# for previs camera number""" 12 13 n = nuke.selectedNodes() 14 for i in n: 15 _class = i.Class() 16 if _class == "Read" or _class == "Write": 17 name = nuke.filename(i) 18 if name is not None: 19 (prefix, v) = nukescripts.version_get(name, "[cp]") 20 if v is not None: 21 # use expression instead of expr so 0 prefix does not make octal 22 # format result so it has 2 digits 23 v = str("%(#)02d" % {"#":int(nuke.expression(v+"+1"))}) 24 i.knob("file").setValue(nukescripts.version_set(i.knob("file").value(), prefix, v)) 25 i.knob("proxy").setValue(nukescripts.version_set(i.knob("proxy").value(), prefix, v)) 26 nuke.modified(True)2729 """All new camera_down that uses the version_get/set functions. 30 This script takes the render camera up one in selected iread/writes. 31 Camera may be _c# or _p# for previs camera number""" 32 33 camera_up()3436 # get selected nodes 37 selected_nodes = nuke.selectedNodes() 38 39 # deselect all nodes so the camera doesn't link 40 for n in selected_nodes: 41 n["selected"].setValue ( False ) 42 43 camera = nuke.createNode("Camera2") 44 45 viewer = nuke.activeViewer() 46 47 m = viewer.getGLCameraMatrix() 48 t = m.translation() 49 p = m.rotationsZXY() 50 51 camera.knob("rotate").setValue(math.degrees(p[0]), 0) 52 camera.knob("rotate").setValue(math.degrees(p[1]), 1) 53 camera.knob("rotate").setValue(math.degrees(p[2]), 2) 54 55 camera.knob("translate").setValue(t[0], 0) 56 camera.knob("translate").setValue(t[1], 1) 57 camera.knob("translate").setValue(t[2], 2)58
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Feb 14 13:53:21 2020 | http://epydoc.sourceforge.net |