mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
fix(nuke): repair workaround node position and name
This commit is contained in:
parent
e435b96b1f
commit
922ec77ea6
1 changed files with 26 additions and 20 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
from avalon import api
|
from avalon import api, io
|
||||||
|
from avalon.nuke import lib as anlib
|
||||||
|
from avalon.nuke import containerise, update_container
|
||||||
import nuke
|
import nuke
|
||||||
from pprint import pformat
|
|
||||||
|
|
||||||
class AlembicCameraLoader(api.Loader):
|
class AlembicCameraLoader(api.Loader):
|
||||||
"""
|
"""
|
||||||
|
|
@ -13,12 +15,9 @@ class AlembicCameraLoader(api.Loader):
|
||||||
label = "Load Alembic Camera"
|
label = "Load Alembic Camera"
|
||||||
icon = "camera"
|
icon = "camera"
|
||||||
color = "orange"
|
color = "orange"
|
||||||
|
node_color = "0x3469ffff"
|
||||||
|
|
||||||
def load(self, context, name, namespace, data):
|
def load(self, context, name, namespace, data):
|
||||||
|
|
||||||
# import dependencies
|
|
||||||
from avalon.nuke import containerise
|
|
||||||
|
|
||||||
# get main variables
|
# get main variables
|
||||||
version = context['version']
|
version = context['version']
|
||||||
version_data = version.get("data", {})
|
version_data = version.get("data", {})
|
||||||
|
|
@ -44,21 +43,28 @@ class AlembicCameraLoader(api.Loader):
|
||||||
# getting file path
|
# getting file path
|
||||||
file = self.fname.replace("\\", "/")
|
file = self.fname.replace("\\", "/")
|
||||||
|
|
||||||
camera_node = nuke.createNode(
|
with anlib.maintained_selection():
|
||||||
"Camera2",
|
camera_node = nuke.createNode(
|
||||||
"file {} read_from_file True".format(file),
|
"Camera2",
|
||||||
inpanel=False
|
"name {} file {} read_from_file True".format(
|
||||||
)
|
object_name, file),
|
||||||
camera_node.forceValidate()
|
inpanel=False
|
||||||
camera_node["frame_rate"].setValue(float(fps))
|
)
|
||||||
camera_node["tile_color"].setValue(int("0x3469ffff", 16))
|
camera_node.forceValidate()
|
||||||
|
camera_node["frame_rate"].setValue(float(fps))
|
||||||
|
|
||||||
# workaround because nuke's bug is not adding animation keys properly
|
# workaround because nuke's bug is not adding
|
||||||
nuke.nodeCopy("%clipboard%")
|
# animation keys properly
|
||||||
camera_node_name = camera_node["name"].value()
|
xpos = camera_node.xpos()
|
||||||
nuke.delete(camera_node)
|
ypos = camera_node.ypos()
|
||||||
nuke.nodePaste("%clipboard%")
|
nuke.nodeCopy("%clipboard%")
|
||||||
camera_node = nuke.toNode(camera_node_name)
|
nuke.delete(camera_node)
|
||||||
|
nuke.nodePaste("%clipboard%")
|
||||||
|
camera_node = nuke.toNode(object_name)
|
||||||
|
camera_node.setXYpos(xpos, ypos)
|
||||||
|
|
||||||
|
# color node by correct color by actual version
|
||||||
|
self.node_version_color(version, camera_node)
|
||||||
|
|
||||||
return containerise(
|
return containerise(
|
||||||
node=camera_node,
|
node=camera_node,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue