Merge pull request #2378 from pypeclub/bugfix/hiero-fix-workio-flatten

This commit is contained in:
Jakub Ježek 2021-12-07 12:45:47 +01:00 committed by GitHub
commit 5808884d9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 15 deletions

View file

@ -37,10 +37,11 @@ self.default_bin_name = "openpypeBin"
AVALON_CONFIG = os.getenv("AVALON_CONFIG", "pype")
def flatten(input_list):
for item in input_list:
def flatten(_list):
for item in _list:
if isinstance(item, (list, tuple)):
yield from flatten(item)
for sub_item in flatten(item):
yield sub_item
else:
yield item

View file

@ -28,12 +28,13 @@ self.timeline = None
self.include_tags = True
def flatten(l):
for i in l:
if isinstance(i, (list, tuple)):
yield from flatten(i)
else:
yield i
def flatten(_list):
for item in _list:
if isinstance(item, (list, tuple)):
for sub_item in flatten(item):
yield sub_item
else:
yield item
def get_current_hiero_project(remove_untitled=False):

View file

@ -65,13 +65,9 @@ def open_file(filepath):
def current_file():
current_file = hiero.core.projects()[-1].path()
normalised = os.path.normpath(current_file)
# Unsaved current file
if normalised == "":
if not current_file:
return None
return normalised
return os.path.normpath(current_file)
def work_root(session):