resolve conflict

This commit is contained in:
Kayla Man 2024-07-02 22:53:18 +08:00
commit 5b8485a394
2 changed files with 28 additions and 12 deletions

View file

@ -11,6 +11,7 @@ import json
import logging
import contextlib
import capture
import clique
from .exitstack import ExitStack
from collections import OrderedDict, defaultdict
from math import ceil
@ -4254,7 +4255,7 @@ def search_textures(filepath):
dynamic patterns like <UDIM> or %04d
Returns:
list[str | clique.Collection]: The files found on disk
list: The files found on disk
"""
filename = os.path.basename(filepath)
@ -4264,15 +4265,15 @@ def search_textures(filepath):
# For UDIM based textures (tiles)
if "<UDIM>" in filename:
sequences = get_sequence(filepath,
pattern="<UDIM>")
sequences = self.get_sequence(filepath,
pattern="<UDIM>")
if sequences:
return sequences
# Frame/time - Based textures (animated masks f.e)
elif "%04d" in filename:
sequences = get_sequence(filepath,
pattern="%04d")
sequences = self.get_sequence(filepath,
pattern="%04d")
if sequences:
return sequences
@ -4282,7 +4283,6 @@ def search_textures(filepath):
return []
def get_sequence(filepath, pattern="%04d"):
"""Get sequence from filename.
@ -4299,11 +4299,9 @@ def get_sequence(filepath, pattern="%04d"):
pattern (str): The pattern to swap with the variable frame number.
Returns:
list[clique.Collection]: List of sequence frame collections.
list: file sequence.
"""
import clique
escaped = re.escape(filepath)
re_pattern = escaped.replace(pattern, "-?[0-9]+")
@ -4312,6 +4310,6 @@ def get_sequence(filepath, pattern="%04d"):
if re.match(re_pattern, f)]
pattern = [clique.PATTERNS["frames"]]
collections, remainder = clique.assemble(
files, patterns=pattern, minimum_items=1)
return collections
collection, remainder = clique.assemble(files, patterns=pattern)
return collection

View file

@ -1,5 +1,6 @@
import os
import re
import pyblish.api
from ayon_core.pipeline.publish import KnownPublishError
from ayon_maya.api import lib
@ -214,3 +215,20 @@ class CollectYetiRig(plugin.MayaInstancePlugin):
resources.append(item)
return resources
def _replace_tokens(self, strings):
env_re = re.compile(r"\$\{(\w+)\}")
replaced = []
for s in strings:
matches = re.finditer(env_re, s)
for m in matches:
try:
s = s.replace(m.group(), os.environ[m.group(1)])
except KeyError:
msg = "Cannot find requested {} in environment".format(
m.group(1))
self.log.error(msg)
raise RuntimeError(msg)
replaced.append(s)
return replaced