mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
Merge branch 'enhancement/usd_workflow' of https://github.com/BigRoy/ayon-core into enhancement/usd_workflow
This commit is contained in:
commit
d93d7951d7
6 changed files with 34 additions and 221 deletions
|
|
@ -26,6 +26,10 @@ class ExtractAlembic(publish.Extractor):
|
|||
families = ["pointcache", "model", "vrayproxy.alembic"]
|
||||
targets = ["local", "remote"]
|
||||
|
||||
# From settings
|
||||
bake_attributes = []
|
||||
bake_attribute_prefixes = []
|
||||
|
||||
def process(self, instance):
|
||||
if instance.data.get("farm"):
|
||||
self.log.debug("Should be processed on farm, skipping.")
|
||||
|
|
@ -40,10 +44,12 @@ class ExtractAlembic(publish.Extractor):
|
|||
attrs = instance.data.get("attr", "").split(";")
|
||||
attrs = [value for value in attrs if value.strip()]
|
||||
attrs += instance.data.get("userDefinedAttributes", [])
|
||||
attrs += self.bake_attributes
|
||||
attrs += ["cbId"]
|
||||
|
||||
attr_prefixes = instance.data.get("attrPrefix", "").split(";")
|
||||
attr_prefixes = [value for value in attr_prefixes if value.strip()]
|
||||
attr_prefixes += self.bake_attribute_prefixes
|
||||
|
||||
self.log.debug("Extracting pointcache..")
|
||||
dirname = self.staging_dir(instance)
|
||||
|
|
|
|||
|
|
@ -389,7 +389,13 @@ def imprint(node, data, tab=None):
|
|||
|
||||
"""
|
||||
for knob in create_knobs(data, tab):
|
||||
node.addKnob(knob)
|
||||
# If knob name exists we set the value. Technically there could be
|
||||
# multiple knobs with the same name, but the intent is not to have
|
||||
# duplicated knobs so we do not account for that.
|
||||
if knob.name() in node.knobs().keys():
|
||||
node[knob.name()].setValue(knob.value())
|
||||
else:
|
||||
node.addKnob(knob)
|
||||
|
||||
|
||||
@deprecated
|
||||
|
|
|
|||
216
client/ayon_core/vendor/python/common/pysync.py
vendored
216
client/ayon_core/vendor/python/common/pysync.py
vendored
|
|
@ -1,216 +0,0 @@
|
|||
#!/usr/local/bin/python3
|
||||
# https://github.com/snullp/pySync/blob/master/pySync.py
|
||||
|
||||
import sys
|
||||
import shutil
|
||||
import os
|
||||
import time
|
||||
import configparser
|
||||
from os.path import (
|
||||
getsize,
|
||||
getmtime,
|
||||
isfile,
|
||||
isdir,
|
||||
join,
|
||||
abspath,
|
||||
expanduser,
|
||||
realpath
|
||||
)
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
ignoreFiles = ("Thumbs.db", ".DS_Store")
|
||||
|
||||
# this feature is not yet implemented
|
||||
ignorePaths = []
|
||||
|
||||
if os.name == 'nt':
|
||||
# msvcrt can't function correctly in IDLE
|
||||
if 'idlelib.run' in sys.modules:
|
||||
print("Please don't run this script in IDLE.")
|
||||
sys.exit(0)
|
||||
import msvcrt
|
||||
|
||||
def flush_input(str, set=None):
|
||||
if not set:
|
||||
while msvcrt.kbhit():
|
||||
ch = msvcrt.getch()
|
||||
if ch == '\xff':
|
||||
print("msvcrt is broken, this is weird.")
|
||||
sys.exit(0)
|
||||
return input(str)
|
||||
else:
|
||||
return set
|
||||
else:
|
||||
import select
|
||||
|
||||
def flush_input(str, set=None):
|
||||
if not set:
|
||||
while len(select.select([sys.stdin.fileno()], [], [], 0.0)[0]) > 0:
|
||||
os.read(sys.stdin.fileno(), 4096)
|
||||
return input(str)
|
||||
else:
|
||||
return set
|
||||
|
||||
|
||||
def compare(fa, fb, options_input=[]):
|
||||
if isfile(fa) == isfile(fb):
|
||||
if isdir(fa):
|
||||
walktree(fa, fb, options_input)
|
||||
elif isfile(fa):
|
||||
if getsize(fa) != getsize(fb) \
|
||||
or int(getmtime(fa)) != int(getmtime(fb)):
|
||||
log.info(str((fa, ': size=', getsize(fa), 'mtime=',
|
||||
time.asctime(time.localtime(getmtime(fa))))))
|
||||
log.info(str((fb, ': size=', getsize(fb), 'mtime=',
|
||||
time.asctime(time.localtime(getmtime(fb))))))
|
||||
if getmtime(fa) > getmtime(fb):
|
||||
act = '>'
|
||||
else:
|
||||
act = '<'
|
||||
|
||||
set = [i for i in options_input if i in [">", "<"]][0]
|
||||
|
||||
s = flush_input('What to do?(>,<,r,n)[' + act + ']', set=set)
|
||||
if len(s) > 0:
|
||||
act = s[0]
|
||||
if act == '>':
|
||||
shutil.copy2(fa, fb)
|
||||
elif act == '<':
|
||||
shutil.copy2(fb, fa)
|
||||
elif act == 'r':
|
||||
if isdir(fa):
|
||||
shutil.rmtree(fa)
|
||||
elif isfile(fa):
|
||||
os.remove(fa)
|
||||
else:
|
||||
log.info(str(('Remove: Skipping', fa)))
|
||||
if isdir(fb):
|
||||
shutil.rmtree(fb)
|
||||
elif isfile(fb):
|
||||
os.remove(fb)
|
||||
else:
|
||||
log.info(str(('Remove: Skipping', fb)))
|
||||
|
||||
else:
|
||||
log.debug(str(('Compare: Skipping non-dir and non-file', fa)))
|
||||
else:
|
||||
log.error(str(('Error:', fa, ',', fb, 'have different file type')))
|
||||
|
||||
|
||||
def copy(fa, fb, options_input=[]):
|
||||
set = [i for i in options_input if i in ["y"]][0]
|
||||
s = flush_input('Copy ' + fa + ' to another side?(r,y,n)[y]', set=set)
|
||||
if len(s) > 0:
|
||||
act = s[0]
|
||||
else:
|
||||
act = 'y'
|
||||
if act == 'y':
|
||||
if isdir(fa):
|
||||
shutil.copytree(fa, fb)
|
||||
elif isfile(fa):
|
||||
shutil.copy2(fa, fb)
|
||||
else:
|
||||
log.debug(str(('Copy: Skipping ', fa)))
|
||||
elif act == 'r':
|
||||
if isdir(fa):
|
||||
shutil.rmtree(fa)
|
||||
elif isfile(fa):
|
||||
os.remove(fa)
|
||||
else:
|
||||
log.debug(str(('Remove: Skipping ', fa)))
|
||||
|
||||
|
||||
stoentry = []
|
||||
tarentry = []
|
||||
|
||||
|
||||
def walktree(source, target, options_input=[]):
|
||||
srclist = os.listdir(source)
|
||||
tarlist = os.listdir(target)
|
||||
if '!sync' in srclist:
|
||||
return
|
||||
if '!sync' in tarlist:
|
||||
return
|
||||
# files in source dir...
|
||||
for f in srclist:
|
||||
if f in ignoreFiles:
|
||||
continue
|
||||
spath = join(source, f)
|
||||
tpath = join(target, f)
|
||||
if spath in ignorePaths:
|
||||
continue
|
||||
if spath in stoentry:
|
||||
# just in case target also have this one
|
||||
if f in tarlist:
|
||||
del tarlist[tarlist.index(f)]
|
||||
continue
|
||||
|
||||
# if also exists in target dir
|
||||
if f in tarlist:
|
||||
del tarlist[tarlist.index(f)]
|
||||
compare(spath, tpath, options_input)
|
||||
|
||||
# exists in source dir only
|
||||
else:
|
||||
copy(spath, tpath, options_input)
|
||||
|
||||
# exists in target dir only
|
||||
set = [i for i in options_input if i in ["<"]]
|
||||
|
||||
for f in tarlist:
|
||||
if f in ignoreFiles:
|
||||
continue
|
||||
spath = join(source, f)
|
||||
tpath = join(target, f)
|
||||
if tpath in ignorePaths:
|
||||
continue
|
||||
if tpath in tarentry:
|
||||
continue
|
||||
if set:
|
||||
copy(tpath, spath, options_input)
|
||||
else:
|
||||
print("REMOVING: {}".format(f))
|
||||
if os.path.isdir(tpath):
|
||||
shutil.rmtree(tpath)
|
||||
else:
|
||||
os.remove(tpath)
|
||||
print("REMOVING: {}".format(f))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
stoconf = configparser.RawConfigParser()
|
||||
tarconf = configparser.RawConfigParser()
|
||||
stoconf.read("pySync.ini")
|
||||
tarconf.read(expanduser("~/.pysync"))
|
||||
stoname = stoconf.sections()[0]
|
||||
tarname = tarconf.sections()[0]
|
||||
|
||||
# calculate storage's base folder
|
||||
if stoconf.has_option(stoname, 'BASE'):
|
||||
stobase = abspath(stoconf.get(stoname, 'BASE'))
|
||||
stoconf.remove_option(stoname, 'BASE')
|
||||
else:
|
||||
stobase = os.getcwd()
|
||||
|
||||
# same, for target's base folder
|
||||
if tarconf.has_option(tarname, 'BASE'):
|
||||
tarbase = abspath(tarconf.get(tarname, 'BASE'))
|
||||
tarconf.remove_option(tarname, 'BASE')
|
||||
else:
|
||||
tarbase = expanduser('~/')
|
||||
|
||||
print("Syncing between", stoname, "and", tarname)
|
||||
sto_content = {x: realpath(join(stobase, stoconf.get(stoname, x)))
|
||||
for x in stoconf.options(stoname)}
|
||||
tar_content = {x: realpath(join(tarbase, tarconf.get(tarname, x)))
|
||||
for x in tarconf.options(tarname)}
|
||||
stoentry = [sto_content[x] for x in sto_content]
|
||||
tarentry = [tar_content[x] for x in tar_content]
|
||||
|
||||
for folder in sto_content:
|
||||
if folder in tar_content:
|
||||
print('Processing', folder)
|
||||
walktree(sto_content[folder], tar_content[folder], options_input)
|
||||
print("Done.")
|
||||
|
|
@ -9,7 +9,7 @@ from ayon_server.settings import (
|
|||
task_types_enum,
|
||||
)
|
||||
|
||||
from ayon_server.types import ColorRGB_uint8, ColorRGBA_uint8
|
||||
from ayon_server.types import ColorRGBA_uint8
|
||||
|
||||
|
||||
class ValidateBaseModel(BaseSettingsModel):
|
||||
|
|
@ -221,7 +221,12 @@ class OIIOToolArgumentsModel(BaseSettingsModel):
|
|||
|
||||
class ExtractOIIOTranscodeOutputModel(BaseSettingsModel):
|
||||
_layout = "expanded"
|
||||
name: str = SettingsField("", title="Name")
|
||||
name: str = SettingsField(
|
||||
"",
|
||||
title="Name",
|
||||
description="Output name (no space)",
|
||||
regex=r"[a-zA-Z0-9_]([a-zA-Z0-9_\.\-]*[a-zA-Z0-9_])?$",
|
||||
)
|
||||
extension: str = SettingsField("", title="Extension")
|
||||
transcoding_type: str = SettingsField(
|
||||
"colorspace",
|
||||
|
|
|
|||
|
|
@ -299,6 +299,16 @@ class ExtractAlembicModel(BaseSettingsModel):
|
|||
families: list[str] = SettingsField(
|
||||
default_factory=list,
|
||||
title="Families")
|
||||
bake_attributes: list[str] = SettingsField(
|
||||
default_factory=list, title="Bake Attributes",
|
||||
description="List of attributes that will be included in the alembic "
|
||||
"export.",
|
||||
)
|
||||
bake_attribute_prefixes: list[str] = SettingsField(
|
||||
default_factory=list, title="Bake Attribute Prefixes",
|
||||
description="List of attribute prefixes for attributes that will be "
|
||||
"included in the alembic export.",
|
||||
)
|
||||
|
||||
|
||||
class ExtractObjModel(BaseSettingsModel):
|
||||
|
|
@ -1184,7 +1194,9 @@ DEFAULT_PUBLISH_SETTINGS = {
|
|||
"pointcache",
|
||||
"model",
|
||||
"vrayproxy.alembic"
|
||||
]
|
||||
],
|
||||
"bake_attributes": [],
|
||||
"bake_attribute_prefixes": []
|
||||
},
|
||||
"ExtractObj": {
|
||||
"enabled": False,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Package declaring addon version."""
|
||||
__version__ = "0.1.11"
|
||||
__version__ = "0.1.12"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue