From e3635a98315822350ea650351932ad314dda90a0 Mon Sep 17 00:00:00 2001 From: mac Date: Sat, 31 Oct 2026 12:00:55 +0800 Subject: [PATCH] feat: couple group expansion to activation and default to basic adjustments only --- template/sources/RegisteredParameters.json | 18 ++--- template/verification/StaticContract.json | 2 +- template/大鱼调色.moef | 16 ++--- tools/create_group_fold_host_fixture.py | 18 +++++ 大鱼调色/Plugin/DYDiagnostics.mm | 22 ++++-- 大鱼调色/Plugin/DYInspector.mm | 79 ++++++++++++---------- 大鱼调色/Plugin/DYModel.mm | 8 +-- 大鱼调色/Plugin/Info.plist | 2 +- 大鱼调色/Wrapper Application/Info.plist | 2 +- 9 files changed, 101 insertions(+), 66 deletions(-) create mode 100644 tools/create_group_fold_host_fixture.py diff --git a/template/sources/RegisteredParameters.json b/template/sources/RegisteredParameters.json index e438f0a..1b27eae 100644 --- a/template/sources/RegisteredParameters.json +++ b/template/sources/RegisteredParameters.json @@ -47,7 +47,7 @@ "title": "输入强度" }, { - "default": 1, + "default": 0, "key": "inputEnabled", "kind": "bool", "max": 1, @@ -523,7 +523,7 @@ "title": "风格 5 强度" }, { - "default": 1, + "default": 0, "key": "lookEnabled", "kind": "bool", "max": 1, @@ -1106,7 +1106,7 @@ "title": "蓝 扩展点4 X" }, { - "default": 1, + "default": 0, "key": "curveEnabled", "kind": "bool", "max": 1, @@ -1491,7 +1491,7 @@ "title": "显示自定义色选区" }, { - "default": 1, + "default": 0, "key": "hslEnabled", "kind": "bool", "max": 1, @@ -1656,7 +1656,7 @@ "title": "平衡" }, { - "default": 1, + "default": 0, "key": "gradingEnabled", "kind": "bool", "max": 1, @@ -1733,7 +1733,7 @@ "title": "蓝原色 饱和度" }, { - "default": 1, + "default": 0, "key": "primariesEnabled", "kind": "bool", "max": 1, @@ -1964,7 +1964,7 @@ "title": "蓝 输出白" }, { - "default": 1, + "default": 0, "key": "levelsEnabled", "kind": "bool", "max": 1, @@ -2184,7 +2184,7 @@ "title": "高光 黄 ↔ 蓝" }, { - "default": 1, + "default": 0, "key": "balanceEnabled", "kind": "bool", "max": 1, @@ -2198,7 +2198,7 @@ "sourceSHA256": { "template/tools/dump_model.mm": "2ef22e010e0cae15b73107d39fb2c125f6049b1e5405e88078f936cf29e79350", "大鱼调色/Plugin/DYModel.h": "66507eb37e0c0e3426a10ab45f7388fd53fcba570a715a6574396056731d5129", - "大鱼调色/Plugin/DYModel.mm": "ba97a42935a7721ceb560b25f610fcdacfe302d8a4ac1f76e1f37408e808cb36", + "大鱼调色/Plugin/DYModel.mm": "cf46784f302014d7c025249c5ebbd02505a5e70739ec3ffc0d269890601bb5c5", "大鱼调色/Plugin/DYUniforms.h": "06db5ec83703aa320c9569a7de08617a2fdbc535ac29f438558959d485aa2138" } } diff --git a/template/verification/StaticContract.json b/template/verification/StaticContract.json index 07f1473..c11eef7 100644 --- a/template/verification/StaticContract.json +++ b/template/verification/StaticContract.json @@ -1,6 +1,6 @@ { "passed": true, - "sha256": "46b613b2b9d799ce6b55902f973a5fd901b289c6105b39c0b4f6a018949cc81b", + "sha256": "ebf8b7aa7a6781b9ce611375a838d89997656b0fc01077b2a7e5b1b2a2c373e1", "version": "5.13", "displayversion": "5.6.7", "filterCount": 1, diff --git a/template/大鱼调色.moef b/template/大鱼调色.moef index a8f0144..0302ceb 100644 --- a/template/大鱼调色.moef +++ b/template/大鱼调色.moef @@ -303,7 +303,7 @@ - + @@ -345,7 +345,7 @@ - + @@ -398,7 +398,7 @@ - + @@ -433,7 +433,7 @@ - + @@ -448,14 +448,14 @@ - + - + @@ -476,7 +476,7 @@ - + @@ -496,7 +496,7 @@ - + diff --git a/tools/create_group_fold_host_fixture.py b/tools/create_group_fold_host_fixture.py new file mode 100644 index 0000000..2624a2f --- /dev/null +++ b/tools/create_group_fold_host_fixture.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +"""Create a fresh FCP instance for group expansion/activation acceptance.""" +from pathlib import Path +import runpy +import xml.etree.ElementTree as ET + +root = Path(__file__).resolve().parent.parent +runpy.run_path(str(root / 'tools/create_host_fixture.py')) +qa = Path('/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa') +tree = ET.parse(qa / '大鱼调色_正式版验收.fcpxml') +document = tree.getroot() +document.find('.//event').set('name', '大鱼调色_分组展开验收') +document.find('.//project').set('name', '大鱼调色_分组展开与启用验收') +ET.indent(document) +output = qa / '大鱼调色_分组展开与启用验收.fcpxml' +output.write_text('\n\n' + + ET.tostring(document, encoding='unicode') + '\n') +print(output) diff --git a/大鱼调色/Plugin/DYDiagnostics.mm b/大鱼调色/Plugin/DYDiagnostics.mm index aa86752..7ff23a1 100644 --- a/大鱼调色/Plugin/DYDiagnostics.mm +++ b/大鱼调色/Plugin/DYDiagnostics.mm @@ -125,6 +125,9 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool { for(NSDictionary *row in descriptors)if([row[@"offset"]integerValue]>=0){float value=*field(&defaults,row);finite&=std::isfinite(value);matches&=value==[row[@"default"]floatValue];} for(int c=0;c<3;c++)finite&=std::isfinite(defaults.primariesM0[c])&&std::isfinite(defaults.primariesM1[c])&&std::isfinite(defaults.primariesM2[c]); run.need(@"finite-real-model-defaults",finite&&matches); + bool initialGroups=true; + for(NSDictionary *section in sections){BOOL base=[@[@"base",@"color"]containsObject:section[@"key"]];for(NSDictionary *row in descriptors)if([row[@"pid"]isEqual:section[@"enabled"]])initialGroups&=([row[@"default"]doubleValue]>=.5)==base;} + run.record(@"only-basic-adjustments-enabled-by-default",initialGroups); DYDiagnosticManager *manager=[[[DYDiagnosticManager alloc]init]autorelease];error=nil; run.need(@"native-parameter-creation",DYCreateParameters(manager,&error)&&!manager->_duplicate&&manager->_values.count==descriptors.count&&manager->_custom.count==2,@{@"error":reason(error)}); id setter=[manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];id getter=[manager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]; @@ -144,6 +147,11 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool { [[source metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:input.data() bytesPerRow:width*8]; DYRenderer *renderer=[[[DYRenderer alloc]init]autorelease];Pixels neutral=render(run,renderer,source,destination,gpu,defaults,@{},@"renderer-default-pass");Difference neutralDifference=difference(input,neutral); run.record(@"transparent-premultiplied-neutral",neutralDifference.nonfinite==0&&neutralDifference.maximum<=.001,measure(neutralDifference)); + auto checkFoldedGroup=[&](DYUniforms active,NSUInteger offset,NSDictionary *paths,NSString *name){ + *(float *)((uint8_t *)&active+offset)=0; + Pixels folded=render(run,renderer,source,destination,gpu,active,paths,[name stringByAppendingString:@"-render"]); + Difference delta=difference(neutral,folded);run.record(name,delta.nonfinite==0&&delta.maximum==0,measure(delta)); + }; size_t transparentBad=0;for(size_t i=0;i100,measure(wbDifference)); u.colorSectionEnabled=0;bypass=render(run,renderer,source,destination,gpu,u,@{},@"renderer-color-bypass-pass");bypassDifference=difference(neutral,bypass);run.record(@"color-group-bypass",bypassDifference.nonfinite==0&&bypassDifference.maximum==0,measure(bypassDifference)); - u=defaults;u.hslHueA.x=28;u.hslSatA.y=45;u.hslLumB.z=-18;Pixels hsl=render(run,renderer,source,destination,gpu,u,@{},@"renderer-hsl-pass");Difference hslDifference=difference(neutral,hsl);run.record(@"hsl-real-table-frame",hslDifference.nonfinite==0&&hslDifference.different>100,measure(hslDifference)); - u=defaults;u.colorGradingHueSatA.x=210;u.colorGradingHueSatA.y=42;u.colorGradingLuma.x=18;Pixels grading=render(run,renderer,source,destination,gpu,u,@{},@"renderer-grading-pass");Difference gradingDifference=difference(neutral,grading);run.record(@"grading-real-table-frame",gradingDifference.nonfinite==0&&gradingDifference.different>100,measure(gradingDifference)); - for(int profile=1;profile<=17;profile++){@autoreleasepool{u=defaults;u.inputProfile=profile;Pixels transformed=render(run,renderer,source,destination,gpu,u,@{},[NSString stringWithFormat:@"input-profile-%02d-load-render",profile]);Difference delta=difference(neutral,transformed);run.record([NSString stringWithFormat:@"input-profile-%02d-finite-nonzero",profile],delta.nonfinite==0&&delta.nonzero>100,measure(delta));}} - DYRenderer *analysisRenderer=[[[DYRenderer alloc]init]autorelease];u=defaults;u.inputProfile=1;render(run,analysisRenderer,source,destination,gpu,u,@{},@"renderer-input-analysis-pass"); + u=defaults;u.hslSectionEnabled=1;u.hslHueA.x=28;u.hslSatA.y=45;u.hslLumB.z=-18;Pixels hsl=render(run,renderer,source,destination,gpu,u,@{},@"renderer-hsl-pass");Difference hslDifference=difference(neutral,hsl);run.record(@"hsl-real-table-frame",hslDifference.nonfinite==0&&hslDifference.different>100,measure(hslDifference)); + checkFoldedGroup(u,offsetof(DYUniforms,hslSectionEnabled),@{},@"folded-hsl-bypasses-retained-adjustments"); + u=defaults;u.colorGradingSectionEnabled=1;u.colorGradingHueSatA.x=210;u.colorGradingHueSatA.y=42;u.colorGradingLuma.x=18;Pixels grading=render(run,renderer,source,destination,gpu,u,@{},@"renderer-grading-pass");Difference gradingDifference=difference(neutral,grading);run.record(@"grading-real-table-frame",gradingDifference.nonfinite==0&&gradingDifference.different>100,measure(gradingDifference)); + checkFoldedGroup(u,offsetof(DYUniforms,colorGradingSectionEnabled),@{},@"folded-grading-bypasses-retained-adjustments"); + for(int profile=1;profile<=17;profile++){@autoreleasepool{u=defaults;u.inputSectionEnabled=1;u.inputProfile=profile;Pixels transformed=render(run,renderer,source,destination,gpu,u,@{},[NSString stringWithFormat:@"input-profile-%02d-load-render",profile]);Difference delta=difference(neutral,transformed);run.record([NSString stringWithFormat:@"input-profile-%02d-finite-nonzero",profile],delta.nonfinite==0&&delta.nonzero>100,measure(delta));}} + checkFoldedGroup(u,offsetof(DYUniforms,inputSectionEnabled),@{},@"folded-input-bypasses-retained-profile"); + DYRenderer *analysisRenderer=[[[DYRenderer alloc]init]autorelease];u=defaults;u.inputSectionEnabled=1;u.inputProfile=1;render(run,analysisRenderer,source,destination,gpu,u,@{},@"renderer-input-analysis-pass"); NSData *inputPreview=[analysisRenderer preview];bool analysisDifferent=inputPreview.length==preview.length&&preview.length==320*180*16;double analysisMaximum=0;size_t analysisChanges=0; if(analysisDifferent){const float *a=(const float *)preview.bytes,*b=(const float *)inputPreview.bytes;for(NSUInteger i=0;i1e-5)analysisChanges++;}}} run.record(@"analysis-applies-selected-input-LUT",analysisDifferent&&analysisChanges>100,@{@"changedComponents":@(analysisChanges),@"maxAbsoluteError":@(analysisMaximum)}); NSString *lookFile=[runtime stringByAppendingPathComponent:@"diagnostic-look.cube"];NSMutableString *cube=[NSMutableString stringWithString:@"TITLE \"Self test look\"\nLUT_3D_SIZE 2\nDOMAIN_MIN 0 0 0\nDOMAIN_MAX 1 1 1\n"]; for(int b=0;b<2;b++)for(int g=0;g<2;g++)for(int r=0;r<2;r++)[cube appendFormat:@"%.8f %.8f %.8f\n",.7f*r+.1f,.8f*g+.05f,.85f*b+.02f];error=nil;run.need(@"temporary-look-file",[cube writeToFile:lookFile atomically:YES encoding:NSUTF8StringEncoding error:&error],@{@"error":reason(error)}); - NSDictionary *paths=@{@"look0":lookFile,@"look1":lookFile,@"look2":lookFile,@"look3":lookFile,@"look4":lookFile};u=defaults;u.postLUTStrength=.35f;u.extraPostLUTStrengths=(DYFloat4){.4f,.5f,.6f,.7f};Pixels looks=render(run,renderer,source,destination,gpu,u,paths,@"renderer-five-look-pass");Difference looksDifference=difference(neutral,looks);run.record(@"five-look-mixes-affect-frame",looksDifference.nonfinite==0&&looksDifference.different>100,measure(looksDifference)); + NSDictionary *paths=@{@"look0":lookFile,@"look1":lookFile,@"look2":lookFile,@"look3":lookFile,@"look4":lookFile};u=defaults;u.lookSectionEnabled=1;u.postLUTStrength=.35f;u.extraPostLUTStrengths=(DYFloat4){.4f,.5f,.6f,.7f};Pixels looks=render(run,renderer,source,destination,gpu,u,paths,@"renderer-five-look-pass");Difference looksDifference=difference(neutral,looks);run.record(@"five-look-mixes-affect-frame",looksDifference.nonfinite==0&&looksDifference.different>100,measure(looksDifference)); + checkFoldedGroup(u,offsetof(DYUniforms,lookSectionEnabled),paths,@"folded-look-bypasses-retained-LUTs"); NSURL *exportURL=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"diagnostic-export.cube"]];error=nil;run.need(@"renderer-export-33cube",[renderer exportLUT:exportURL uniforms:u paths:paths error:&error],@{@"error":reason(error),@"path":exportURL.path}); NSString *exported=[NSString stringWithContentsOfURL:exportURL encoding:NSUTF8StringEncoding error:&error];NSUInteger triples=0,nonzero=0;bool exportFinite=true;for(NSString *line in [exported componentsSeparatedByCharactersInSet:NSCharacterSet.newlineCharacterSet]){float r,g,b;if(sscanf(line.UTF8String,"%f %f %f",&r,&g,&b)==3){triples++;exportFinite&=std::isfinite(r)&&std::isfinite(g)&&std::isfinite(b);if(r!=0||g!=0||b!=0)nonzero++;}} run.record(@"export-33cube-data-contract",[exported containsString:@"LUT_3D_SIZE 33"]&&triples==33*33*33&&exportFinite&&nonzero>0,@{@"rows":@(triples),@"nonzeroRows":@(nonzero),@"bytes":@([[[NSFileManager defaultManager]attributesOfItemAtPath:exportURL.path error:nil][NSFileSize]unsignedLongLongValue])}); diff --git a/大鱼调色/Plugin/DYInspector.mm b/大鱼调色/Plugin/DYInspector.mm index 2f9715f..ad5c4f3 100644 --- a/大鱼调色/Plugin/DYInspector.mm +++ b/大鱼调色/Plugin/DYInspector.mm @@ -141,7 +141,9 @@ static NSArray *DYAccessibleSubviews(NSView *view, BOOL visibleOnly) { NSRect r=NSInsetRect(self.bounds,.5,2); NSGradient *g=[[[NSGradient alloc]initWithStartingColor:DYThemePalette()[@"headerTop"] endingColor:DYThemePalette()[@"headerBottom"]]autorelease]; [g drawInBezierPath:[NSBezierPath bezierPathWithRoundedRect:r xRadius:8 yRadius:8] angle:90]; - [self.title drawInRect:NSInsetRect(r,9,5) withAttributes:@{NSFontAttributeName:self.font,NSForegroundColorAttributeName:DYInk()}]; + NSDictionary *attributes=@{NSFontAttributeName:self.font,NSForegroundColorAttributeName:DYInk()}; + [(self.state==NSControlStateValueOn?@"▾":@"▸") drawInRect:NSMakeRect(8,7,12,16) withAttributes:attributes]; + [self.title drawInRect:NSMakeRect(23,7,MAX(0,r.size.width-31),16) withAttributes:attributes]; } - (void)mouseDown:(NSEvent *)event { if(event.clickCount==2) [NSApp sendAction:self.doubleClickAction to:self.target from:self]; @@ -482,23 +484,18 @@ static NSImage *DYWheelImage(void) { [_document addSubview:card]; DYHeader *header=[[[DYHeader alloc] initWithFrame:NSZeroRect] autorelease]; header.title=[section[@"key"] isEqual:@"skin"]?@"肤色保护设置":section[@"title"]; + [header setButtonType:NSButtonTypePushOnPushOff]; header.bordered=NO; header.alignment=NSTextAlignmentLeft; header.font=[NSFont boldSystemFontOfSize:12]; header.contentTintColor=DYInk(); header.target=self; header.action=@selector(toggleSection:); header.tag=index; - header.doubleClickAction=@selector(resetSection:); header.toolTip=@"点击折叠;双击还原本组"; + header.doubleClickAction=@selector(resetSection:); header.toolTip=@"展开启用,折叠停用;双击还原本组"; [card addSubview:header]; NSButton *enabled=DYButton(@"",self,@selector(groupEnabled:));enabled.bordered=NO;[enabled setButtonType:NSButtonTypePushOnPushOff];enabled.image=[NSImage imageWithSystemSymbolName:@"eye" accessibilityDescription:@"启用本组"]; enabled.tag=index; enabled.contentTintColor=DYAccent(); enabled.toolTip=@"启用或旁路本组"; enabled.accessibilityLabel=[section[@"title"] stringByAppendingString:@"启用"]; [card addSubview:enabled]; enabled.hidden=section[@"enabled"]==nil; - NSTextField *status=DYLabel(@"已旁路 · 可调整",10); - status.textColor=DYThemeColor(@"secondary");status.hidden=YES; - status.identifier=[section[@"key"] stringByAppendingString:@"BypassStatus"]; - status.accessibilityLabel=[header.title stringByAppendingString:@":已旁路,参数仍可调整"]; - status.toolTip=@"参数仍可调整;点击左侧眼睛使本组生效"; - [card addSubview:status]; NSButton *reset=DYButton(@"↺",self,@selector(resetSection:)); reset.tag=index; reset.bordered=NO; - reset.toolTip=@"还原本组"; reset.accessibilityLabel=[section[@"title"] stringByAppendingString:@"还原"]; + reset.toolTip=@"还原本组默认值与开关"; reset.accessibilityLabel=[section[@"title"] stringByAppendingString:@"还原"]; [card addSubview:reset]; NSMutableArray *body=[NSMutableArray array]; NSString *key=section[@"key"]?:@""; @@ -584,7 +581,7 @@ static NSImage *DYWheelImage(void) { } for(NSView *row in body)if(![ordered containsObject:row])row.hidden=YES;body=ordered; } - NSMutableDictionary *record=[NSMutableDictionary dictionaryWithDictionary:@{@"section":section,@"view":card,@"header":header,@"enabled":enabled,@"status":status,@"reset":reset,@"body":body,@"collapsed":@([key isEqual:@"skin"])}]; + NSMutableDictionary *record=[NSMutableDictionary dictionaryWithDictionary:@{@"section":section,@"view":card,@"header":header,@"enabled":enabled,@"reset":reset,@"body":body,@"collapsed":@(![section[@"defaultEnabled"]boolValue])}]; if([key isEqual:@"look"]){NSButton *add=DYButton(@"+",self,@selector(addLook:));add.bordered=NO;add.font=[NSFont boldSystemFontOfSize:20];add.accessibilityLabel=@"添加风格 LUT";[card addSubview:add];record[@"add"]=add;} [_cards addObject:record]; index++; @@ -633,17 +630,12 @@ static NSImage *DYWheelImage(void) { NSArray *body=c[@"body"];CGFloat contentHeight=0; for(NSView *row in body)if([self showRow:row section:key])contentHeight+=[self heightForRow:row]; [c[@"enabled"]setFrame:NSMakeRect(12,12,20,20)]; - CGFloat titleWidth=MIN(cw-104,MAX(80,[[(NSButton *)c[@"header"]title]sizeWithAttributes:@{NSFontAttributeName:[NSFont boldSystemFontOfSize:12]}].width+22)); + CGFloat titleWidth=MIN(cw-104,MAX(94,[[(NSButton *)c[@"header"]title]sizeWithAttributes:@{NSFontAttributeName:[NSFont boldSystemFontOfSize:12]}].width+36)); [c[@"header"]setFrame:NSMakeRect(42,8,titleWidth,28)]; - NSTextField *status=c[@"status"]; - CGFloat statusX=42+titleWidth+8,statusRight=cw-(c[@"add"]?70:42); - CGFloat statusWidth=ceil([status.stringValue sizeWithAttributes:@{NSFontAttributeName:status.font}].width)+2; - BOOL statusOnSecondLine=!status.hidden&&statusRight-statusX0) [popup selectItemAtIndex:MAX(0,MIN((NSInteger)llround(v),popup.numberOfItems-1))]; } for(id graphic in _graphics)[graphic setValues:graphicValues]; - for(NSDictionary *c in _cards) { + BOOL groupingChanged=NO; + for(NSMutableDictionary *c in _cards) { NSNumber *pid=c[@"section"][@"enabled"]; - double v=1;if(pid)[get getFloatValue:&v fromParameter:pid.unsignedIntValue atTime:t]; - [c[@"enabled"] setState:v>=.5?NSControlStateValueOn:NSControlStateValueOff]; - [c[@"enabled"]setImage:[NSImage imageWithSystemSymbolName:v>=.5?@"eye":@"eye.slash" accessibilityDescription:v>=.5?@"启用本组":@"旁路本组"]]; - [c[@"enabled"]setToolTip:v>=.5?@"点击旁路本组;参数仍可调整":@"已旁路,参数仍可调整;点击启用本组"]; + double v=[c[@"section"][@"defaultEnabled"]doubleValue];if(pid)[get getFloatValue:&v fromParameter:pid.unsignedIntValue atTime:t]; + NSNumber *extra=c[@"section"][@"extraEnabled"];double extraValue=0; + if(extra)[get getFloatValue:&extraValue fromParameter:extra.unsignedIntValue atTime:t]; + BOOL enabled=v>=.5||extraValue>=.5; + BOOL collapsed=!enabled;groupingChanged|=collapsed!=[c[@"collapsed"]boolValue];c[@"collapsed"]=@(collapsed); + [c[@"header"]setState:enabled?NSControlStateValueOn:NSControlStateValueOff]; + [c[@"header"]setToolTip:enabled?@"折叠并停用本组,保留参数值;双击还原本组":@"展开并启用本组,恢复之前的参数值;双击还原本组"]; + [c[@"header"]setAccessibilityHelp:[c[@"header"]toolTip]]; + [c[@"header"]setNeedsDisplay:YES]; + [c[@"enabled"] setState:enabled?NSControlStateValueOn:NSControlStateValueOff]; + [c[@"enabled"]setImage:[NSImage imageWithSystemSymbolName:enabled?@"eye":@"eye.slash" accessibilityDescription:enabled?@"折叠并停用本组":@"展开并启用本组"]]; + [c[@"enabled"]setToolTip:enabled?@"折叠并停用本组,保留参数值":@"展开并启用本组,恢复之前的参数值"]; [c[@"enabled"]setAccessibilityHelp:[c[@"enabled"]toolTip]]; - [c[@"status"]setHidden:!pid||v>=.5]; - // Bypass affects rendering, not editability. Keep editable rows legible. + // Visibility and rendering share the host's section enable value. for(NSView *row in c[@"body"])row.alphaValue=1; } DYAssetState *assets=DYReadAssets(_manager,t); @@ -713,6 +713,7 @@ static NSImage *DYWheelImage(void) { } for(NSInteger i=1;i<5;i++)if([assets.paths[[NSString stringWithFormat:@"look%ld",(long)i]]length])_visibleLooks=MAX(_visibleLooks,i+1); [self setNeedsLayout:YES]; + if(groupingChanged){[self layoutSubtreeIfNeeded];NSAccessibilityPostNotification(self,NSAccessibilityLayoutChangedNotification);} } @finally { [action endAction:self]; _refreshing=NO; } } - (void)postChanged { [[NSNotificationCenter defaultCenter] postNotificationName:@"DYModelChanged" object:_manager]; } @@ -750,7 +751,7 @@ static NSImage *DYWheelImage(void) { NSDictionary *d=_controls[@(sender.tag)][@"descriptor"];NSNumber *pid=d[@"enabled"];if(!pid)return; id action=[self actionAPI];if(!action)return; [action startAction:self]; - @try {id set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];double value=sender.state==NSControlStateValueOn?1:0;[set setFloatValue:value toParameter:pid.unsignedIntValue atTime:action.currentTime];NSNumber *extra=_cards[sender.tag][@"section"][@"extraEnabled"];if(extra)[set setFloatValue:value toParameter:extra.unsignedIntValue atTime:action.currentTime];} + @try {id set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];double value=sender.state==NSControlStateValueOn?1:0;[set setFloatValue:value toParameter:pid.unsignedIntValue atTime:action.currentTime];} @finally {[action endAction:self];} [self postChanged]; } @@ -764,21 +765,24 @@ static NSImage *DYWheelImage(void) { } @finally {[action endAction:self];} [self postChanged]; } -- (void)groupEnabled:(NSButton *)sender { - if(sender.tag>=_cards.count)return; - NSNumber *pid=_cards[sender.tag][@"section"][@"enabled"];if(!pid)return; +- (void)setSectionEnabled:(BOOL)enabled atIndex:(NSInteger)index { + if(index<0||index>=_cards.count)return; + NSDictionary *section=_cards[index][@"section"]; + NSNumber *pid=section[@"enabled"];if(!pid)return; id action=[self actionAPI];if(!action)return; [action startAction:self]; - @try {id set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];[set setFloatValue:sender.state==NSControlStateValueOn?1:0 toParameter:pid.unsignedIntValue atTime:action.currentTime];} + @try { + id set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)]; + [set setFloatValue:enabled?1:0 toParameter:pid.unsignedIntValue atTime:action.currentTime]; + NSNumber *extra=section[@"extraEnabled"];if(extra)[set setFloatValue:enabled?1:0 toParameter:extra.unsignedIntValue atTime:action.currentTime]; + } @finally {[action endAction:self];} [self postChanged]; } +- (void)groupEnabled:(NSButton *)sender { [self setSectionEnabled:sender.state==NSControlStateValueOn atIndex:sender.tag]; } - (void)toggleSection:(NSButton *)sender { - if(sender.tag>=_cards.count)return; - NSMutableDictionary *card=_cards[sender.tag];BOOL collapsed=![card[@"collapsed"] boolValue];card[@"collapsed"]=@(collapsed); - [sender setNeedsDisplay:YES]; - [self setNeedsLayout:YES]; - NSAccessibilityPostNotification(self,NSAccessibilityLayoutChangedNotification); + if(sender.tag<0||sender.tag>=_cards.count)return; + [self setSectionEnabled:[_cards[sender.tag][@"collapsed"]boolValue] atIndex:sender.tag]; } - (void)resetSection:(NSButton *)sender { if(sender.tag>=_cards.count)return; @@ -788,8 +792,9 @@ static NSImage *DYWheelImage(void) { @try { CMTime t=action.currentTime;id set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)]; for(NSDictionary *d in section[@"rows"]) {[set setFloatValue:[d[@"default"] doubleValue] toParameter:[d[@"pid"] unsignedIntValue] atTime:t];if(d[@"enabled"])[set setFloatValue:1 toParameter:[d[@"enabled"] unsignedIntValue] atTime:t];} - NSNumber *enabled=section[@"enabled"];if(enabled)[set setFloatValue:1 toParameter:enabled.unsignedIntValue atTime:t]; - NSNumber *extra=section[@"extraEnabled"];if(extra)[set setFloatValue:1 toParameter:extra.unsignedIntValue atTime:t]; + double defaultEnabled=[section[@"defaultEnabled"]doubleValue]; + NSNumber *enabled=section[@"enabled"];if(enabled)[set setFloatValue:defaultEnabled toParameter:enabled.unsignedIntValue atTime:t]; + NSNumber *extra=section[@"extraEnabled"];if(extra)[set setFloatValue:defaultEnabled toParameter:extra.unsignedIntValue atTime:t]; NSString *key=section[@"key"]?:@""; if([key localizedCaseInsensitiveContainsString:@"input"]||[key localizedCaseInsensitiveContainsString:@"look"]) { DYAssetState *assets=[[DYReadAssets(_manager,t) copy] autorelease]; diff --git a/大鱼调色/Plugin/DYModel.mm b/大鱼调色/Plugin/DYModel.mm index 322e06a..5e480fe 100644 --- a/大鱼调色/Plugin/DYModel.mm +++ b/大鱼调色/Plugin/DYModel.mm @@ -7,9 +7,9 @@ static NSDictionary *row(NSString*k,NSString*t,NSUInteger o,double lo,double hi, NSMutableDictionary*r=[@{@"key":k,@"title":t,@"pid":@(PID(o)),@"offset":@(o),@"min":@(lo),@"max":@(hi),@"default":@(d),@"step":@(hi-lo>10?1:.01),@"kind":kind?:@"float"}mutableCopy]; [descriptors addObject:r];return [r autorelease]; } -static void section(NSString*k,NSString*t,NSUInteger offset,NSArray*rows,double def=1){ +static void section(NSString*k,NSString*t,NSUInteger offset,NSArray*rows,double def=0){ NSDictionary*e=row([k stringByAppendingString:@"Enabled"],t,offset,0,1,def,@"bool"); - [sections addObject:@{@"key":k,@"title":t,@"enabled":e[@"pid"],@"rows":rows}]; + [sections addObject:@{@"key":k,@"title":t,@"enabled":e[@"pid"],@"defaultEnabled":@(def),@"rows":rows}]; } static NSDictionary *scalar(NSString*k,NSString*t,NSUInteger o,double lo=-100,double hi=100,double def=0){return row(k,t,o,lo,hi,def,@"float");} static void initialize(){static dispatch_once_t once;dispatch_once(&once,^{ @@ -26,8 +26,8 @@ static void initialize(){static dispatch_once_t once;dispatch_once(&once,^{ [descriptors replaceObjectAtIndex:[descriptors indexOfObjectPassingTest:^BOOL(id obj,NSUInteger idx,BOOL*stop){return [obj[@"key"]isEqual:keys[i]];}] withObject:r];[base addObject:r]; } NSDictionary*copyAuto=@{@"key":@"copyAutoGrade",@"title":@"复制时自动调色",@"pid":@8800,@"offset":@(-1),@"min":@0,@"max":@1,@"default":@0,@"step":@1,@"kind":@"bool",@"notAnimatable":@YES};[descriptors addObject:copyAuto]; - section(@"base",@"基础调色",136,[[[base subarrayWithRange:NSMakeRange(0,6)]arrayByAddingObjectsFromArray:[base subarrayWithRange:NSMakeRange(10,3)]]arrayByAddingObject:copyAuto]); - section(@"color",@"白平衡与颜色",140,@[base[6],base[7],base[9],base[8]]); + section(@"base",@"基础调色",136,[[[base subarrayWithRange:NSMakeRange(0,6)]arrayByAddingObjectsFromArray:[base subarrayWithRange:NSMakeRange(10,3)]]arrayByAddingObject:copyAuto],1); + section(@"color",@"白平衡与颜色",140,@[base[6],base[7],base[9],base[8]],1); section(@"skin",@"肤色保护",464,@[scalar(@"skinStrength",@"保护程度",468,0,100,60),scalar(@"skinHue",@"肤色色相",472,0,60,28)],0); NSMutableArray*look=[NSMutableArray arrayWithObject:scalar(@"postLUTStrength",@"风格 1 强度",60,0,1,1)]; for(int i=0;i<4;i++){[look addObject:row([NSString stringWithFormat:@"look%dEnabled",i+2],[NSString stringWithFormat:@"风格 %d 启用",i+2],160+i*4,0,1,1,@"bool")];[look addObject:scalar([NSString stringWithFormat:@"look%dStrength",i+2],[NSString stringWithFormat:@"风格 %d 强度",i+2],64+i*4,0,1,1)];} diff --git a/大鱼调色/Plugin/Info.plist b/大鱼调色/Plugin/Info.plist index e8413c3..5359375 100644 --- a/大鱼调色/Plugin/Info.plist +++ b/大鱼调色/Plugin/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.1.2 CFBundleVersion - 8 + 9 NSHumanReadableCopyright PlugInKit diff --git a/大鱼调色/Wrapper Application/Info.plist b/大鱼调色/Wrapper Application/Info.plist index 114b6de..0661698 100644 --- a/大鱼调色/Wrapper Application/Info.plist +++ b/大鱼调色/Wrapper Application/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.1.2 CFBundleVersion - 8 + 9 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright