Add dark defaults, modular effect templates and canvas leveling

这个提交包含在:
mac 于 2026-11-06 11:29:52 +08:00 提交
1 父节点 ffabdca5b1
当前提交 5ca307414c
25 个文件已更改
+1702 -88

没有与搜索条件相匹配的文件

+31 -12
查看文件
@@ -16,6 +16,7 @@ OUTPUT_VERSION='5.11'
OUTPUT_DISPLAY_VERSION='5.4.5'
NATIVE_ALPHABET='*-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
STANDARD_ALPHABET='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
STARTERS={'primary':'一级调色','hsl':'HSL'}
CONTENT_TAGS={'scenenode','layer','group','filter','behavior','mask'}
@@ -58,7 +59,11 @@ def custom_archive(encoded):
return text,name
def build(model):
def archives(model, starter):
return model['archivesBase64'] | (model['starterArchives'][starter] if starter else {})
def build(model, starter=None):
root=E.parse(SOURCES/'NativeEffectSource.moef').getroot()
scene=root.find('scene');project=scene.find('scenenode[@factoryID="4"]')
source=scene.find('.//scenenode[@name="效果源"]')
@@ -83,7 +88,7 @@ def build(model):
host=list(filt.findall('parameter'))
for node in host:filt.remove(node)
for pid,name in [('9000','大鱼调色'),('9001','LUT 文件'),('9002','工具与蒙版')]:
text,class_name=custom_archive(model['archivesBase64'][pid])
text,class_name=custom_archive(archives(model, starter)[pid])
expected={'9000':'DYInspectorToken','9001':'DYAssetState','9002':'DYToolDocument'}[pid]
if class_name!=expected:raise ValueError('Wrong custom parameter class')
flags='12884901888' if pid=='9000' else '12889161776'
@@ -104,7 +109,8 @@ def build(model):
for node in list(pub):
if node.tag!='version':pub.remove(node)
E.SubElement(pub,'target',object='10060',channel='./9000',name='大鱼调色')
E.SubElement(pub,'target',object='10060',channel='./10001',name='混合')
if not starter:
E.SubElement(pub,'target',object='10060',channel='./10001',name='混合')
current=scene.find('currentObject')
if current is None:
current=E.Element('currentObject');scene.insert(list(scene).index(scene.find('currentFrame'))+1,current)
@@ -119,7 +125,7 @@ def build(model):
return data
def verify(data,model):
def verify(data,model,starter=None):
root=E.fromstring(data);scene=root.find('scene');factories={f.get('id'):f.get('uuid') for f in root.findall('factory')}
assert root.get('version')==OUTPUT_VERSION and root.findtext('displayversion')==OUTPUT_DISPLAY_VERSION
assert all(not list(root.iter(tag)) for tag in ['Object3DEnvironments','DRTSupport','onHDRDisplay','missingDynamicRangeType'])
@@ -133,7 +139,7 @@ def verify(data,model):
# FCP also applies a changed dataValue to existing nil-state instances.
# Keep both carriers at the original registered value; V3 is explicit opt-in.
for pid in ['9000','9001','9002']:
assert params[pid].findtext('defaultVal')==params[pid].findtext('dataValue')==custom_archive(model['archivesBase64'][pid])[0]
assert params[pid].findtext('defaultVal')==params[pid].findtext('dataValue')==custom_archive(archives(model, starter)[pid])[0]
assert all(not v in data for v in (b'CameraRawTables',b'1.png',b'relativeURL'))
assert len(root.findall('.//behavior'))==0 and len(root.findall('.//keypoint'))==0
assert scene.find('.//scenenode[@name="效果源"]/parameter[@id="2"]/parameter[@id="321"]').get('value')=='3'
@@ -145,7 +151,9 @@ def verify(data,model):
if node.tag in CONTENT_TAGS and node is not project and node.find('baseFlags') is not None and int(node.findtext('baseFlags'))&0x10000001:selected.append(node.get('id'))
assert not selected and scene.findtext('currentObject')==project.get('id')
pub=scene.find('publishSettings').findall('target')
assert [(t.get('object'),t.get('channel'),t.get('name')) for t in pub]==[('10060','./9000','大鱼调色'),('10060','./10001','混合')]
expected=[('10060','./9000','大鱼调色')]
if not starter:expected.append(('10060','./10001','混合'))
assert [(t.get('object'),t.get('channel'),t.get('name')) for t in pub]==expected
assert all(scene.find('.//scenenode[@id="'+identity+'"]') is None for identity in ['10080','10081','10082'])
assert all(text.encode() not in data for text in ['FCP 版本作者','更多模板浏览器访问','大鱼先森Media','dayu.media'])
assert not any(f.get('uuid')=='dd0036f96c9e4bfdadb82f71fbf5c9d8' for f in root.findall('factory'))
@@ -154,11 +162,22 @@ def verify(data,model):
def main():
p=argparse.ArgumentParser(description=__doc__);p.add_argument('--output',type=Path,default=TEMPLATE/'大鱼调色.moef');p.add_argument('--overwrite',action='store_true');p.add_argument('--refresh-model',action='store_true');args=p.parse_args()
if args.output.exists() and not args.overwrite:raise FileExistsError('Output exists; choose another file or explicitly --overwrite')
p=argparse.ArgumentParser(description=__doc__)
p.add_argument('--output',type=Path,default=TEMPLATE/'大鱼调色.moef')
p.add_argument('--overwrite',action='store_true')
p.add_argument('--refresh-model',action='store_true')
p.add_argument('--starters',action='store_true',help='Build the two starter MOEFs alongside the full effect')
args=p.parse_args()
outputs={None:args.output}
if args.starters:
outputs.update({starter:args.output.parent/name/(name+'.moef') for starter,name in STARTERS.items()})
for output in outputs.values():
if output.exists() and not args.overwrite:raise FileExistsError('Output exists: '+str(output))
model=refresh_metadata() if args.refresh_model else metadata()
data=build(model);report=verify(data,model)
args.output.parent.mkdir(parents=True,exist_ok=True);args.output.write_bytes(data)
(TEMPLATE/'verification/StaticContract.json').write_text(json.dumps(report,ensure_ascii=False,indent=2)+'\n')
print(json.dumps(report,ensure_ascii=False,indent=2))
for starter,output in outputs.items():
data=build(model,starter);report=verify(data,model,starter)
output.parent.mkdir(parents=True,exist_ok=True);output.write_bytes(data)
if not starter:
(TEMPLATE/'verification/StaticContract.json').write_text(json.dumps(report,ensure_ascii=False,indent=2)+'\n')
print(json.dumps(dict(report,path=str(output),starter=starter),ensure_ascii=False))
if __name__=='__main__':main()
+49 -17
查看文件
@@ -2,6 +2,7 @@
"""Single-install Release delivery; keeps a product lock through host acceptance."""
from pathlib import Path
import subprocess,os,json,shutil,plistlib,uuid,sys,datetime,hashlib,time
from template_payload import template_files
ROOT=Path(__file__).resolve().parent.parent
CACHE=Path('/Users/mac/Library/Caches/CodexBuilds/com.dayu.color')
LOCK=Path('/Users/mac/.codex/app-delivery-locks/com.dayu.color.lock')
@@ -9,7 +10,9 @@ DEST=Path('/Library/Plug-Ins/FxPlug/大鱼调色.app')
APP=CACHE/'DerivedData/Build/Products/Release/大鱼调色.app'
LOOSE=CACHE/'DerivedData/Build/Products/Release/大鱼调色 XPC Service.pluginkit'
PLUGIN='Contents/PlugIns/大鱼调色 XPC Service.pluginkit'
TEMPLATE=Path.home()/'Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef'
TEMPLATE_ROOT=Path.home()/'Movies/Motion Templates.localized/Effects.localized/大鱼调色'
TEMPLATE=TEMPLATE_ROOT/'大鱼调色/大鱼调色.moef'
BUNDLED_TEMPLATES=Path('Contents/Resources/FCP Templates')
IDENTITY='Developer ID Application: zhong luo (B3W25FX5H5)'
PROFILE='codex-dayu-notary-B3W25FX5H5'
KEYCHAIN='/Users/mac/Library/Keychains/login.keychain-db'
@@ -44,6 +47,43 @@ def self_test(executable,report):
failed=[x.get('name') for x in parsed.get('results',[]) if not x.get('pass',True)]
raise RuntimeError('原生自检未通过,正式旧版未替换。诊断:'+str(report)+';失败项:'+str(failed))
return parsed
def install_templates():
# Keep the previous Motion Templates files available until the new set is
# verified. Stage each replacement on the same volume as the destination.
changed=[]
hashes={}
try:
for _,bundled,installed in template_files():
source=DEST/BUNDLED_TEMPLATES/bundled
target=TEMPLATE_ROOT/installed
target.parent.mkdir(parents=True,exist_ok=True)
previous=(target.read_bytes(),target.stat().st_mode & 0o777,target.stat().st_flags) if target.exists() else None
data=source.read_bytes()
changed.append((target,previous))
write_template_file(target,data,0o644,2 if target.suffix=='.png' else 0)
assert target.read_bytes()==data
hashes[str(installed)]=hashlib.sha256(data).hexdigest()
except Exception:
for target,previous in reversed(changed):
if previous is not None:
write_template_file(target,*previous)
elif target.exists():
os.chflags(target,0)
target.unlink()
raise
return hashes
def write_template_file(target,data,mode,flags):
temp=target.with_name('.dayu-color-stage-'+uuid.uuid4().hex)
try:
temp.write_bytes(data)
temp.chmod(mode)
if target.exists() and target.stat().st_flags:os.chflags(target,0)
os.replace(temp,target)
if flags:os.chflags(target,flags)
finally:
temp.unlink(missing_ok=True)
def main():
hosts_closed();CACHE.mkdir(parents=True,exist_ok=True);LOCK.parent.mkdir(parents=True,exist_ok=True);LOCK.mkdir()
(LOCK/'owner.json').write_text(json.dumps(dict(PID=os.getpid(),cwd=str(ROOT),product='大鱼调色',started=datetime.datetime.now(datetime.timezone.utc).isoformat())))
@@ -54,11 +94,11 @@ def main():
if any(l.endswith('/Contents/MacOS/大鱼调色') for l in run('ps','-axo','comm=').splitlines()):raise RuntimeError('请先正常退出当前大鱼调色窗口')
print('Building final Release',flush=True)
run('xcodebuild','-project','大鱼调色.xcodeproj','-scheme','Wrapper Application','-configuration','Release','-enableAddressSanitizer','NO','-derivedDataPath',str(CACHE/'DerivedData'),'clean','build',log=CACHE/'release-build.log')
b=APP/'Contents/Resources/FCP Templates/大鱼调色.moef';b.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(ROOT/'template/大鱼调色.moef',b)
b.chmod(0o644)
for name in ['large.png','small.png']:
if (ROOT/'template'/name).exists():
target=b.parent/name;shutil.copy2(ROOT/'template'/name,target);target.chmod(0o644)
for source,bundled,_ in template_files():
target=APP/BUNDLED_TEMPLATES/bundled
target.parent.mkdir(parents=True,exist_ok=True)
shutil.copyfile(ROOT/'template'/source,target)
target.chmod(0o644)
# Sources on exFAT can be exposed as owner-only. Installer changes ownership to root.
(APP/'Contents/Resources/Basis_balanceWheel.png').chmod(0o644)
identity(APP,'com.dayu.color');plugin=APP/PLUGIN;identity(plugin,'com.dayu.color.XPC')
@@ -96,24 +136,16 @@ def main():
if str(DEST/'Contents/MacOS/大鱼调色') in run('ps','-axo','comm=').splitlines():break
time.sleep(.25)
else:raise RuntimeError('未从正式安装路径启动')
template_hashes=install_templates()
except Exception:
failed=DEST.parent/('.dayu-color-failed-'+uuid.uuid4().hex+'.app');os.replace(DEST,failed)
if old:os.replace(old,DEST);old=None
raise
TEMPLATE.parent.mkdir(parents=True,exist_ok=True)
if TEMPLATE.exists():shutil.copy2(TEMPLATE,CACHE/'previous-template.moef')
tmp=TEMPLATE.with_name('.dayu-color-template-stage.moef');shutil.copy2(DEST/'Contents/Resources/FCP Templates/大鱼调色.moef',tmp);os.replace(tmp,TEMPLATE)
for name in ['large.png','small.png']:
source=DEST/'Contents/Resources/FCP Templates'/name;target=TEMPLATE.parent/name
if source.exists():
if target.exists():os.chflags(target,0)
shutil.copy2(source,target);os.chflags(target,2)
# All generated copies are removed before final registry/host verification.
for copy,expected in [(APP,'com.dayu.color'),(LOOSE,'com.dayu.color.XPC')]:
if copy.exists():identity(copy,expected);unregister(copy/PLUGIN if copy.suffix=='.app' else copy);shutil.rmtree(copy)
if old:unregister(old/PLUGIN)
archive.unlink();backup=CACHE/'previous-template.moef'
if backup.exists():backup.unlink()
archive.unlink()
# Unregistering an old copy can race the host's launch registration. Re-add
# only the verified installed path; never repeat signing/notarization/install.
for attempt in range(3):
@@ -122,7 +154,7 @@ def main():
if entries:break
time.sleep(.5)
if len(entries)!=1 or not entries[0].rstrip().endswith('\t'+str(DEST/PLUGIN)):raise RuntimeError('PluginKit发现多份/错误版本: '+registry)
record=dict(status='installed-awaiting-host-verification',path=str(DEST),bundleID='com.dayu.color',version=plistlib.loads((DEST/'Contents/Info.plist').read_bytes())['CFBundleShortVersionString'],build=plistlib.loads((DEST/'Contents/Info.plist').read_bytes())['CFBundleVersion'],team='B3W25FX5H5',notaryID=result['id'],notaryStatus=result['status'],gatekeeper=gate,sourceCommit=run('git','rev-parse','HEAD'),templatePath=str(TEMPLATE),templateSHA256=hashlib.sha256(TEMPLATE.read_bytes()).hexdigest(),shaderSHA256=hashlib.sha256((DEST/PLUGIN/'Contents/Resources/default.metallib').read_bytes()).hexdigest())
record=dict(status='installed-awaiting-host-verification',path=str(DEST),bundleID='com.dayu.color',version=plistlib.loads((DEST/'Contents/Info.plist').read_bytes())['CFBundleShortVersionString'],build=plistlib.loads((DEST/'Contents/Info.plist').read_bytes())['CFBundleVersion'],team='B3W25FX5H5',notaryID=result['id'],notaryStatus=result['status'],gatekeeper=gate,sourceCommit=run('git','rev-parse','HEAD'),templatePath=str(TEMPLATE),templateSHA256=template_hashes[str(TEMPLATE.relative_to(TEMPLATE_ROOT))],installedTemplateSHA256=template_hashes,shaderSHA256=hashlib.sha256((DEST/PLUGIN/'Contents/Resources/default.metallib').read_bytes()).hexdigest())
if old:record['previousInstallBackup']=str(old)
output=ROOT/'verification/Delivery.json';output.write_text(json.dumps(record,ensure_ascii=False,indent=2)+'\n')
run('open',str(DEST));print('FORMAL_INSTALLED. Run installed self-test and host verification; type complete only after success. Type leave to preserve pending state.',flush=True)
+15
查看文件
@@ -0,0 +1,15 @@
"""Shared source, bundle and Motion Templates paths for the shipped effects."""
from pathlib import Path
EFFECTS = ("大鱼调色", "一级调色", "HSL")
PREVIEWS = ("large.png", "small.png")
def template_files():
for effect in EFFECTS:
for name in (effect + ".moef", *PREVIEWS):
installed = Path(effect) / name
# Preserve the full effect's original flat bundle layout and artwork.
bundled = Path(name) if effect == EFFECTS[0] else installed
source = Path(name) if name in PREVIEWS else bundled
yield source, bundled, installed
+6 -1
查看文件
@@ -13,7 +13,12 @@ import xml.etree.ElementTree as E
ROOT=Path(__file__).resolve().parent.parent
module=runpy.run_path(str(ROOT/'tools/build_template.py'),run_name='template_contract')
file=ROOT/'template'/'\u5927\u9c7c\u8c03\u8272.moef'
data=file.read_bytes();contract=module['verify'](data,module['metadata']())
model=module['metadata']()
data=file.read_bytes();contract=module['verify'](data,model)
for starter,name in module['STARTERS'].items():
path=file.parent/name/(name+'.moef')
module['verify'](path.read_bytes(),model,starter)
print('Verified starter:',name)
root=E.fromstring(data);scene=root.find('scene');factories={f.get('id'):f.get('uuid') for f in root.findall('factory')}
project=[node for node in scene.findall('scenenode') if factories.get(node.get('factoryID'))==module['PROJECT_UUID']][0]
assert root.get('version')=='5.11' and root.findtext('displayversion')=='5.4.5'