-
Notifications
You must be signed in to change notification settings - Fork 0
/
cm_cameraDot.nk
39 lines (39 loc) · 4.45 KB
/
cm_cameraDot.nk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Dot {
name cm_cameraDot
knobChanged auto_reconnect_cameraDot.connect_the_Dots()
note_font "Bitstream Vera Sans Bold"
note_font_size 21
note_font_color 0x5b5b5bff
selected true
xpos 3209
ypos 18281
hide_input true
addUserKnob {20 controls l cameraDot}
addUserKnob {4 cameraList l "connect camera" M {----------------------------------- ""}}
addUserKnob {22 reloadCams l "Reload Camera List" -STARTLINE T "def getCameras():\n with nuke.root():\n myCameras = \[]\n \n ##For loop to grab all nodes in the class\n for i in nuke.allNodes():\n if i.Class() == \"Camera\" or i.Class() == \"Camera2\" or i.Class() == \"Camera3\" or i.Class() == \"Camera4\":\n myCameras.append(i.knob('name').getValue())\n \n if myCameras == \[]:\n resetCameras()\n else: \n myCameras.sort()\n return myCameras\n\n\n\n\ndef resetCameras():\n n.setInput(0, None)\n n\['label'].setValue(\"\")\n if myCameras == \[]:\n nuke.message(\"Bring in a camera\") \n return\n\n\n\nmyCameras = \[]\nn = nuke.thisNode()\nk = n\['cameraList']\ncurrent = k.value()\n\n\nif getCameras() == None:\n n\['cameraList'].setValues(\['-----------------------------------'])\nelse:\n with nuke.root():\n k.setValues(getCameras())\n k.setValue(current)"}
addUserKnob {22 connect l "Connect This" -STARTLINE T "n = nuke.thisNode()\nk = n\['cameraList']\nif k.value() != '-----------------------------------':\n cam = nuke.toNode(n\['cameraList'].value())\n n.setInput(0, cam)\n n\['aboutCamera'].clearFlag(nuke.INVISIBLE)\n n\['label'].setValue(cam\['name'].value())\n n\['focalLength'].setValue(str(cam\['focal'].value()))\n n\['stop'].setValue(str(cam\['fstop'].value()))\n n\['distance'].setValue(str(cam\['focal_point'].value()))\nelse:\n n\['aboutCamera'].setFlag(nuke.INVISIBLE)\n nuke.message(\"Hit Reload\")"}
addUserKnob {22 python_button l "Reconnect All" -STARTLINE T "for i in nuke.allNodes():\n if i\['name'].value().startswith('cm_cameraDot'):\n cam = nuke.toNode(i\['cameraList'].value())\n if i\['cameraList'].value() != \"-----------------------------------\" or \"\":\n i.setInput(0, cam)\n i\['label'].setValue(cam\['name'].value())\n else:\n pass"}
addUserKnob {26 text_2 l "" +STARTLINE T " "}
addUserKnob {6 autoReconnect l "Auto Reconnect" +STARTLINE}
autoReconnect true
addUserKnob {26 text_3 l "" +STARTLINE T " "}
addUserKnob {20 aboutCamera l Camera +INVISIBLE n 1}
addUserKnob {26 ""}
addUserKnob {26 text_1 l "" +STARTLINE T " "}
addUserKnob {22 openCameraProperties l "Open Properties" T "#Opens selected camera's properties panel\n\n\nn = nuke.thisNode() \ntry:\n nuke.show(nuke.toNode(n\[\"cameraList\"].value()))\nexcept:\n pass" +STARTLINE}
addUserKnob {22 zoomToCamera l "Zoom to Camera" -STARTLINE T "#Zooms to selected camera\n\n\nn = nuke.thisNode()\ntry:\n ni = nuke.toNode(n\[\"cameraList\"].value())\n nuke.zoom(nuke.zoom(),(ni\[\"xpos\"].value(),ni\[\"ypos\"].value())) \nexcept:\n nuke.message(\"Unable to zoom.\")"}
addUserKnob {22 returnToDot l "Return to Dot" -STARTLINE T "#Returns to the dot\n\n\nn = nuke.thisNode()\ntry:\n nuke.zoom(nuke.zoom(),(n\[\"xpos\"].value(),n\[\"ypos\"].value()))\nexcept:\n pass"}
addUserKnob {26 text_6 l "" +STARTLINE T " "}
addUserKnob {26 ""}
addUserKnob {26 cameraData l "" +STARTLINE T "<span style=\"color:#757575;\">Camera Data</span>"}
addUserKnob {26 text l "" +STARTLINE T " "}
addUserKnob {26 focalLength l "Focal Length" T " "}
addUserKnob {26 stop l T-Stop T " "}
addUserKnob {26 distance l "Focal Distance" T " "}
addUserKnob {26 text_4 l "" +STARTLINE T " "}
addUserKnob {22 reloadData l "Reload Data" T "n = nuke.thisNode()\nk = n\['cameraList']\nif k.value() != '-----------------------------------':\n cam = nuke.toNode(n\['cameraList'].value())\n n.setInput(0, cam)\n n\['label'].setValue(cam\['name'].value())\n n\['focalLength'].setValue(str(cam\['focal'].value()))\n n\['stop'].setValue(str(cam\['fstop'].value()))\n n\['distance'].setValue(str(cam\['focal_point'].value()))\nelse:\n pass" +STARTLINE}
addUserKnob {26 text_5 l "" +STARTLINE T " "}
addUserKnob {20 endGroup n -1}
addUserKnob {26 ""}
addUserKnob {26 cm l "" +STARTLINE T "cm_cameraDot v1.3 - (c) 2024 | <a href=\"www.chrismccrowe.com\" style=\"color:#757575; text-decoration:none\">www.chrismccrowe.com</a>"}
}