Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
feat(nuke): read node loaders with preset for node name
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubjezek001 committed Mar 17, 2021
1 parent 67ca08b commit 1a46bdd
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
17 changes: 13 additions & 4 deletions pype/plugins/nuke/load/load_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class LoadImage(api.Loader):
)
]

# presets
name_expression = "{class_name}_{ext}"

def load(self, context, name, namespace, options):
from avalon.nuke import (
containerise,
Expand Down Expand Up @@ -73,10 +76,16 @@ def load(self, context, name, namespace, options):
frame,
format(frame_number, "0{}".format(padding)))

read_name = "Read_{0}_{1}_{2}".format(
repr_cont["asset"],
repr_cont["subset"],
repr_cont["representation"])
name_data = {
"asset": repr_cont["asset"],
"subset": repr_cont["subset"],
"representation": context["representation"]["name"],
"ext": repr_cont["representation"],
"id": context["representation"]["_id"],
"class_name": self.__class__.__name__
}

read_name = self.name_expression.format(**name_data)

# Create the Loader with the filename path set
with viewer_update_and_undo_stop():
Expand Down
17 changes: 13 additions & 4 deletions pype/plugins/nuke/load/load_mov.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ class LoadMov(api.Loader):
icon = "code-fork"
color = "orange"

# presets
name_expression = "{class_name}_{ext}"

def loader_shift(self, node, frame, relative=True):
"""Shift global in time by i preserving duration
Expand Down Expand Up @@ -152,10 +155,16 @@ def load(self, context, name, namespace, data):

file = file.replace("\\", "/")

read_name = "Read_{0}_{1}_{2}".format(
repr_cont["asset"],
repr_cont["subset"],
repr_cont["representation"])
name_data = {
"asset": repr_cont["asset"],
"subset": repr_cont["subset"],
"representation": context["representation"]["name"],
"ext": repr_cont["representation"],
"id": context["representation"]["_id"],
"class_name": self.__class__.__name__
}

read_name = self.name_expression.format(**name_data)

# Create the Loader with the filename path set
with viewer_update_and_undo_stop():
Expand Down
17 changes: 13 additions & 4 deletions pype/plugins/nuke/load/load_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ class LoadSequence(api.Loader):
icon = "file-video-o"
color = "white"

# presets
name_expression = "{class_name}_{ext}"

@staticmethod
def fix_hashes_in_path(file, repr_cont):
if "#" not in file:
Expand Down Expand Up @@ -137,10 +140,16 @@ def load(self, context, name, namespace, data):

file = self.fix_hashes_in_path(file, repr_cont).replace("\\", "/")

read_name = "Read_{0}_{1}_{2}".format(
repr_cont["asset"],
repr_cont["subset"],
context["representation"]["name"])
name_data = {
"asset": repr_cont["asset"],
"subset": repr_cont["subset"],
"representation": context["representation"]["name"],
"ext": repr_cont["representation"],
"id": context["representation"]["_id"],
"class_name": self.__class__.__name__
}

read_name = self.name_expression.format(**name_data)

# Create the Loader with the filename path set
with viewer_update_and_undo_stop():
Expand Down

0 comments on commit 1a46bdd

Please sign in to comment.