Add dark defaults, modular effect templates and canvas leveling

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

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

+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)