State:New|TargetRelease:No Target|icon_bug|icon_nuke|database:public|Resolution:Fixed|BugID:154775|
Problem summary
Pythonically added Camera and Axis node file paths do not set the node's knob values, such as translate and rotate.
This applies to both running through the GUI and through Terminal.
This can be resolved via showing, then hiding the control panel, after adding the files.
This affects Classic and New 3D systems with Camera3 and Camera4 nodes
Customer reported version
Nuke 10.0v4
Steps to reproduce through GUI:
1) Open Nuke
2) Create a Camera node
3) Enable read from file, and close the Camera node's properties panel.
4) Run the below code, replacing the path for a camera .fbxor.abc file:
node = nuke.toNode('Camera1')node['file'].setValue('<path/to/camerafile.fbx/.abc')print node["translate"].value()
Result: The values with print out 0.0 as they haven't been set by the file.
5) Running the below code doesn't correct the issue:
node.forceValidate()node['reload'].execute()print node["translate"].value()
Workaround
Open the node in the properties bin, and reload with the panel open. This can be done with the code below:
node = nuke.toNode('Camera1') node['file'].setValue('<path/to/camerafile.fbx/.abc')# Show and hide the control panel to add the .fbx or .abcnode.showControlPanel()node.hideControlPanel()print node["translate"].value()
To set it up on creation of a Camera/Axis node, the script below can be used (switch 'Camera2' to 'Axis2' for axis node creation)
# Creates an Camera2 node with the user's chosen Alembic, and prints all 'fbx_node_name' variablesdef createCamera2(alembicPath): # Create the Axis2 Node node = nuke.createNode('Camera2',inpanel = False) # Switch 'Camera2' to 'Axis2' for axis nodes # Set the file path to the alembic, and set 'read_from_file' to True node.knob("file").setValue(alembicPath) node.knob("read_from_file").setValue(True) # Show and hide the control panel to add the Alembic values node.showControlPanel() node.hideControlPanel() print node["translate"].value()# Path for the alembic ( CHANGE to your Alembic/FBX )alembicPath = '/Your/Path/Here/camerafile.abc/.fbx'# Execute the definitioncreateAxis(alembicPath)
Steps to reproduce through Terminal:
1) Paste the below script into a text editor and save as 'autoCam.py' to your desktop (replacing the directory of your fbx file in the script before saving)
import nukenode = nuke.createNode("Camera2")node["suppress_dialog"].setValue(True)node['file'].setValue('<directory>/<yourcamera>.fbx')nuke.frame(1)viewer = nuke.createNode("Viewer")viewer.setInput(0, node )node.forceValidate()print node["matrix"].getValue()
2) Open up a terminal window
3) Enter in your Nuke application location followed by the directory to the autoCam.py file. (Replacing out your directory info again)
For example if I am using Nuke 10.5v5, it would look like this:
"C:\Program Files\Nuke10.5v5\Nuke10.5.exe" -ti C:/Users/<directory>/autoCam.py
note: the '-ti' flag will let open terminal through interactive.
You will get the following result
[1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]
4) Now run the same results through the GUI by taking of the Terminal '-t' flag.
"C:\Program Files\Nuke10.5v5\Nuke10.5.exe" -i C:/Users/<directory>/autoCam.py
5) An instance of Nuke will open, and if you look in the 'Script Editor', you will see the following result printed out.
[-0.9999902248382568, -1.3526966540666763e-05, -0.00442271726205945, -0.2267269790172577, 0.0, 0.9999953508377075, -0.003058505244553089, 1.0332183837890625, 0.004422737751156092, -0.0030584754422307014, -0.9999855756759644, -51.263404846191406, 0.0, 0.0, 0.0, 1.0]
Result:
The numbers generated by the Matrix node (as a test callback) have different values, they should have the same values, no matter if they are being called calculated through the GUI or Terminal.
Workaround
There is currently no workaround for this through Terminal unfortunately.
Reproduced by Support in:
Nuke 16.0v8 - Windows 11
Nuke 14.0v6 - Windows 10, CentOS 7
Nuke 13.0v1 - Windows 10
Nuke 12.0v1 - Windows 10
Nuke 11.0v1 - Windows 10
Nuke 10.0v1 - Windows 10
Nuke 9.0v1 - Windows 10, CentOS 7
Expected behaviour
For the Camera or Axis node to be updated with the information from the read in file
Actual behaviour
The Camera or Axis node should updated with the information from the read in file
We're sorry to hear that
Please tell us why