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

General: Extract review does not crash with old settings overrides #4023

Merged
merged 1 commit into from
Oct 24, 2022
Merged
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
41 changes: 18 additions & 23 deletions openpype/plugins/publish/extract_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -1731,38 +1731,33 @@ def filter_outputs_by_custom_tags(self, outputs, custom_tags):
Returns:
list: Containg all output definitions matching entered tags.
"""

filtered_outputs = []
repre_c_tags_low = [tag.lower() for tag in (custom_tags or [])]
for output_def in outputs:
valid = False
tag_filters = output_def.get("filter", {}).get("custom_tags")

if (
# if any of tag filter is empty, skip
custom_tags and not tag_filters
or not custom_tags and tag_filters
):
continue
elif not custom_tags and not tag_filters:
if not custom_tags and not tag_filters:
# Definition is valid if both tags are empty
valid = True

# lower all filter tags
tag_filters_low = [tag.lower() for tag in tag_filters]

self.log.debug("__ tag_filters: {}".format(tag_filters))
self.log.debug("__ repre_c_tags_low: {}".format(
repre_c_tags_low))
elif not custom_tags or not tag_filters:
# Invalid if one is empty
valid = False

# check if any repre tag is not in filter tags
for tag in repre_c_tags_low:
if tag in tag_filters_low:
valid = True
break

if not valid:
continue
else:
# Check if output definition tags are in representation tags
valid = False
# lower all filter tags
tag_filters_low = [tag.lower() for tag in tag_filters]
# check if any repre tag is not in filter tags
for tag in repre_c_tags_low:
if tag in tag_filters_low:
valid = True
break

filtered_outputs.append(output_def)
if valid:
filtered_outputs.append(output_def)

self.log.debug("__ filtered_outputs: {}".format(
[_o["filename_suffix"] for _o in filtered_outputs]
Expand Down