Merge pull request #644 from pypeclub/bugfix/nuke_name_read_by_representation

Nuke: prevent crash if we only have single frame in sequence
This commit is contained in:
Milan Kolar 2020-10-16 10:28:10 +02:00 committed by GitHub
commit 68ce8e3d7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -119,13 +119,14 @@ class LoadSequence(api.Loader):
repr_cont = context["representation"]["context"] repr_cont = context["representation"]["context"]
if "#" not in file: if "#" not in file:
frame = repr_cont.get("frame") frame = repr_cont.get("frame")
padding = len(frame) if frame:
file = file.replace(frame, "#" * padding) padding = len(frame)
file = file.replace(frame, "#" * padding)
read_name = "Read_{0}_{1}_{2}".format( read_name = "Read_{0}_{1}_{2}".format(
repr_cont["asset"], repr_cont["asset"],
repr_cont["subset"], repr_cont["subset"],
repr_cont["representation"]) context["representation"]["name"])
# Create the Loader with the filename path set # Create the Loader with the filename path set
with viewer_update_and_undo_stop(): with viewer_update_and_undo_stop():
@ -249,8 +250,9 @@ class LoadSequence(api.Loader):
if "#" not in file: if "#" not in file:
frame = repr_cont.get("frame") frame = repr_cont.get("frame")
padding = len(frame) if frame:
file = file.replace(frame, "#" * padding) padding = len(frame)
file = file.replace(frame, "#" * padding)
# Get start frame from version data # Get start frame from version data
version = io.find_one({ version = io.find_one({