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

Nuke: adding preset for a Read node name to all img and mov Loaders #1146

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ node_modules/
package-lock.json

pype/premiere/ppro/js/debug.log

/.vscode/
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