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