mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
create camera node with Camera4 instead of Camera2 in Nuke 14.0
This commit is contained in:
parent
399bb404c4
commit
dbf02e266f
2 changed files with 21 additions and 1 deletions
|
|
@ -3483,3 +3483,20 @@ def get_filenames_without_hash(filename, frame_start, frame_end):
|
||||||
new_filename = filename_without_hashes.format(frame)
|
new_filename = filename_without_hashes.format(frame)
|
||||||
filenames.append(new_filename)
|
filenames.append(new_filename)
|
||||||
return filenames
|
return filenames
|
||||||
|
|
||||||
|
|
||||||
|
def create_camera_node_by_version():
|
||||||
|
"""Function to create the camera with the latest node class
|
||||||
|
For Nuke version 14.0 or later, the Camera4 camera node class
|
||||||
|
would be used
|
||||||
|
For the version before, the Camera2 camera node class
|
||||||
|
would be used
|
||||||
|
Returns:
|
||||||
|
Node: camera node
|
||||||
|
"""
|
||||||
|
nuke_version = nuke.NUKE_VERSION_STRING
|
||||||
|
nuke_number_version = next(ver for ver in re.findall("\d+\.\d+", nuke_version))
|
||||||
|
if float(nuke_number_version) >= 14.0:
|
||||||
|
return nuke.createNode("Camera4")
|
||||||
|
else:
|
||||||
|
return nuke.createNode("Camera2")
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ from openpype.hosts.nuke.api import (
|
||||||
NukeCreatorError,
|
NukeCreatorError,
|
||||||
maintained_selection
|
maintained_selection
|
||||||
)
|
)
|
||||||
|
from openpype.hosts.nuke.api.lib import (
|
||||||
|
create_camera_node_by_version
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class CreateCamera(NukeCreator):
|
class CreateCamera(NukeCreator):
|
||||||
|
|
@ -32,7 +35,7 @@ class CreateCamera(NukeCreator):
|
||||||
"Creator error: Select only camera node type")
|
"Creator error: Select only camera node type")
|
||||||
created_node = self.selected_nodes[0]
|
created_node = self.selected_nodes[0]
|
||||||
else:
|
else:
|
||||||
created_node = nuke.createNode("Camera2")
|
created_node = create_camera_node_by_version()
|
||||||
|
|
||||||
created_node["tile_color"].setValue(
|
created_node["tile_color"].setValue(
|
||||||
int(self.node_color, 16))
|
int(self.node_color, 16))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue