From 375761619f1427e3bc858de5565344c3d54ec68c Mon Sep 17 00:00:00 2001 From: mac Date: Sun, 1 Nov 2026 22:14:15 +0800 Subject: [PATCH] fix: cache immutable canvas state for host OSC, select before mask commit and add direct Metal canvas regression checks; prepare build23 --- template/sources/RegisteredParameters.json | 2 +- tools/create_mask_host_fixture.py | 6 +++--- verification/Delivery.json | 10 +++++----- verification/InstalledSelfTest.json | 8 ++++---- 大鱼调色/Plugin/DYDiagnostics.mm | 3 +++ 大鱼调色/Plugin/DYMaskPanel.inc.h | 4 ++-- 大鱼调色/Plugin/DYPlugIn.mm | 4 ++-- 大鱼调色/Plugin/DYToolCanvasDiagnostics.inc.h | 12 ++++++++++++ 大鱼调色/Plugin/DYToolHostIvars.inc.h | 2 +- 大鱼调色/Plugin/DYToolHostMethods.inc.h | 13 ++++++++----- 大鱼调色/Plugin/DYToolState.mm | 7 +++++-- 大鱼调色/Plugin/DYToolTrackingProbe.inc.h | 11 +++++++++++ 大鱼调色/Plugin/Info.plist | 2 +- 大鱼调色/Wrapper Application/Info.plist | 2 +- 14 files changed, 59 insertions(+), 27 deletions(-) create mode 100644 大鱼调色/Plugin/DYToolCanvasDiagnostics.inc.h diff --git a/template/sources/RegisteredParameters.json b/template/sources/RegisteredParameters.json index 9bd23da..1615cd9 100644 --- a/template/sources/RegisteredParameters.json +++ b/template/sources/RegisteredParameters.json @@ -3072,7 +3072,7 @@ "大鱼调色/Plugin/DYModel.mm": "beadabb0773e911581dedc263f55a49e03dde6e6d1fc2329df18cb384710d234", "大鱼调色/Plugin/DYSpiderState.h": "0c80747e41e8fc97762e301b011bd08c18865a825eaafde086ed79ace37b22f9", "大鱼调色/Plugin/DYToolState.h": "a1b0e328faae5dce7bb8497186f028a45d2da4f1a87e1980cd30c7a59a098a9f", - "大鱼调色/Plugin/DYToolState.mm": "d78d64ac6edbcd1e4702a054bbdae26593bfdf9f9bd7a8a3fd600ae05d14b353", + "大鱼调色/Plugin/DYToolState.mm": "2d8aefba3ddd1ab06fe63025c29efc5e6a4e586ce33486c8aceb7352e8ed6099", "大鱼调色/Plugin/DYUniforms.h": "8ef480025c739b29f55884ba0c7218e9d6fd8d80c46cfc72d6ee3da90215abe4", "大鱼调色/Plugin/MaskCore/DYMask.h": "5b9aa44390d4a1fca1baf5e34cb9eefc8483c939a65cc2a0412b7b41fc85bc16", "大鱼调色/Plugin/MaskCore/DYMaskOperator.h": "43fa701ad574f38ce0ab4f4d3900bb034edaaa1adc09821d2f4443ee2b687ba2", diff --git a/tools/create_mask_host_fixture.py b/tools/create_mask_host_fixture.py index db4340e..a66fed0 100644 --- a/tools/create_mask_host_fixture.py +++ b/tools/create_mask_host_fixture.py @@ -6,7 +6,7 @@ out=Path('/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa');out.mkdi media=out/'大鱼调色_蒙版合成运动.mov' if not media.exists(): subprocess.run(['/opt/homebrew/bin/ffmpeg','-v','error','-f','lavfi','-i',"nullsrc=s=1080x640:r=25:d=4,geq=lum='128+70*sin(X/11)*cos(Y/9)+35*sin((X+Y)/4)':cb='128+35*sin(X/17)':cr='128+35*cos(Y/21)',crop=960:540:'40+10*t':'40+5*t'",'-c:v','prores_ks','-profile:v','2','-pix_fmt','yuv422p10le','-color_primaries','bt709','-color_trc','bt709','-colorspace','bt709',str(media)],check=True) -root=E.Element('fcpxml',version='1.12');res=E.SubElement(root,'resources');E.SubElement(res,'format',id='f1',width='960',height='540',frameDuration='1/25s',colorSpace='1-1-1 (Rec. 709)');a=E.SubElement(res,'asset',id='a1',name='合成运动纹理',start='0s',duration='4s',format='f1',hasVideo='1',videoSources='1');E.SubElement(a,'media-rep',kind='original-media',src=media.as_uri());template=Path('/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef');E.SubElement(res,'effect',id='fx',name='大鱼调色',uid='~/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef',src=template.as_uri());lib=E.SubElement(root,'library');event=E.SubElement(lib,'event',name='大鱼调色_1.4_22_蒙版与工具层验收') -for name in ['大鱼调色_1.4_22_独立工具与蒙版','大鱼调色_1.4_22_逐帧跟踪']: +root=E.Element('fcpxml',version='1.12');res=E.SubElement(root,'resources');E.SubElement(res,'format',id='f1',width='960',height='540',frameDuration='1/25s',colorSpace='1-1-1 (Rec. 709)');a=E.SubElement(res,'asset',id='a1',name='合成运动纹理',start='0s',duration='4s',format='f1',hasVideo='1',videoSources='1');E.SubElement(a,'media-rep',kind='original-media',src=media.as_uri());template=Path('/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef');E.SubElement(res,'effect',id='fx',name='大鱼调色',uid='~/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef',src=template.as_uri());lib=E.SubElement(root,'library');event=E.SubElement(lib,'event',name='大鱼调色_1.4_23_蒙版与工具层验收') +for name in ['大鱼调色_1.4_23_独立工具与蒙版','大鱼调色_1.4_23_逐帧跟踪']: project=E.SubElement(event,'project',name=name);seq=E.SubElement(project,'sequence',format='f1',tcStart='0s',tcFormat='NDF',audioLayout='stereo',audioRate='48k',duration='4s');spine=E.SubElement(seq,'spine');clip=E.SubElement(spine,'asset-clip',ref='a1',name=name,offset='0s',start='0s',duration='4s');E.SubElement(clip,'filter-video',ref='fx',name='大鱼调色',enabled='1') -E.indent(root);xml=out/'大鱼调色_1.4_22_蒙版与工具层.fcpxml';xml.write_text('\n\n'+E.tostring(root,encoding='unicode')+'\n');print(xml) +E.indent(root);xml=out/'大鱼调色_1.4_23_蒙版与工具层.fcpxml';xml.write_text('\n\n'+E.tostring(root,encoding='unicode')+'\n');print(xml) diff --git a/verification/Delivery.json b/verification/Delivery.json index cce8fab..527bf60 100644 --- a/verification/Delivery.json +++ b/verification/Delivery.json @@ -3,14 +3,14 @@ "path": "/Library/Plug-Ins/FxPlug/大鱼调色.app", "bundleID": "com.dayu.color", "version": "1.4.0", - "build": "21", + "build": "22", "team": "B3W25FX5H5", - "notaryID": "fc44ab42-4b46-491d-9733-f4ad6c5233df", + "notaryID": "998d1b1e-12a8-41aa-a954-15da4f660aec", "notaryStatus": "Accepted", "gatekeeper": "/Library/Plug-Ins/FxPlug/大鱼调色.app: accepted\nsource=Notarized Developer ID", - "sourceCommit": "3fc32f3e1913c9887a6c6d1c384ed0297930c600", + "sourceCommit": "34162025b6241ddc7ea3464d58186a95948e5928", "templatePath": "/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef", - "templateSHA256": "e6f3fe538e4ef4e1ea2946d360120747a53c088a2c872330f6d79275d253ea5e", + "templateSHA256": "9b8f6e407545429b77c1de88d4cceb738760771c5a7f1dbd9732bdcc95c23738", "shaderSHA256": "df82ed0310281e854085063276ab161db7c623511751a1c1c63607b4072c8097", - "previousInstallBackup": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-cc56f5cdd2894832abaa89e76df4de8b.app" + "previousInstallBackup": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-eb52cb62e5b64c3dbcbe51b4a4f07173.app" } diff --git a/verification/InstalledSelfTest.json b/verification/InstalledSelfTest.json index 78a73c5..389868a 100644 --- a/verification/InstalledSelfTest.json +++ b/verification/InstalledSelfTest.json @@ -12,7 +12,7 @@ "error": "未提供错误信息", "name": "runtime-directory", "pass": true, - "path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/9046B7E8-EA9F-453A-BFBC-7603A1FE84A1" + "path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/C1EB458E-641B-4158-8315-21C451A665C1" }, { "descriptors": 234, @@ -816,7 +816,7 @@ "error": "未提供错误信息", "name": "renderer-export-33cube", "pass": true, - "path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/9046B7E8-EA9F-453A-BFBC-7603A1FE84A1/diagnostic-export.cube" + "path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/C1EB458E-641B-4158-8315-21C451A665C1/diagnostic-export.cube" }, { "bytes": 1186074, @@ -836,7 +836,7 @@ }, { "heartbeats": 0, - "maximumGapMS": 85.91441670432687, + "maximumGapMS": 86.23637491837144, "name": "external-activation-main-loop-responsive", "pass": true }, @@ -1146,6 +1146,6 @@ "pass": true } ], - "runtimePath": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/9046B7E8-EA9F-453A-BFBC-7603A1FE84A1", + "runtimePath": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/C1EB458E-641B-4158-8315-21C451A665C1", "scope": "Native model and renderer integration with real Metal/IOSurface textures and fake FxPlug host selectors; no GUI or live host document." } diff --git a/大鱼调色/Plugin/DYDiagnostics.mm b/大鱼调色/Plugin/DYDiagnostics.mm index fb9078d..5e5979a 100644 --- a/大鱼调色/Plugin/DYDiagnostics.mm +++ b/大鱼调色/Plugin/DYDiagnostics.mm @@ -61,6 +61,8 @@ - (BOOL)addCustomParameterWithName:(NSString *)name parameterID:(UInt32)pid defaultValue:(NSObject *)value parameterFlags:(FxParameterFlags)flags { if(_values[@(pid)]||_custom[@(pid)]){_duplicate=YES;return NO;}_custom[@(pid)]=value;return YES; } +- (BOOL)getStringParameterValue:(NSString**)value fromParameter:(UInt32)pid{id string=_custom[@(pid)];if(![string isKindOfClass:NSString.class])return NO;if(value)*value=string;return YES;} +- (BOOL)setStringParameterValue:(NSString*)value toParameter:(UInt32)pid{if(![_custom[@(pid)]isKindOfClass:NSString.class])return NO;_custom[@(pid)]=value;return YES;} - (BOOL)getFloatValue:(double *)value fromParameter:(UInt32)pid atTime:(CMTime)time { NSNumber *stored=_values[@(pid)];if(!stored)return NO;if(value)*value=stored.doubleValue;return YES; } @@ -417,6 +419,7 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool { } #include "DYToolDiagnostics.inc.h" #include "DYToolTrackingDiagnostics.inc.h" + #include "DYToolCanvasDiagnostics.inc.h" [gpu release]; } @catch(NSException *exception) { run.record(@"diagnostic-exception",false,@{@"exception":exception.name?:@"unknown",@"message":exception.reason?:@"unknown"}); diff --git a/大鱼调色/Plugin/DYMaskPanel.inc.h b/大鱼调色/Plugin/DYMaskPanel.inc.h index ddad503..57d0cc7 100644 --- a/大鱼调色/Plugin/DYMaskPanel.inc.h +++ b/大鱼调色/Plugin/DYMaskPanel.inc.h @@ -50,7 +50,7 @@ - (void)add:(id)sender{[self addMenu:_add];} - (void)addMenu:(NSView*)anchor{NSMenu *menu=[[[NSMenu alloc]initWithTitle:@"添加蒙版"]autorelease];for(int i=0;i<6;i++){NSMenuItem *item=[menu addItemWithTitle:@[@"椭圆",@"矩形",@"钢笔",@"线性渐变",@"HSL 选区",@"亮度选区"][i] action:@selector(addKind:) keyEquivalent:@""];item.target=self;item.tag=i;}[menu popUpMenuPositioningItem:nil atLocation:NSMakePoint(0,anchor.bounds.size.height) inView:anchor];} - (void)addKind:(NSMenuItem*)sender{ - ida=[_host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(_host,a.currentTime).document);NSMutableArray *masks=[[DYMasksForTool(doc,_nodeID)mutableCopy]autorelease];if(masks.count>=DYToolMaskLimit){NSBeep();return;}NSDictionary *mask=DYNewMask(sender.tag);[masks addObject:mask];if(!DYSetToolMasks(doc,_nodeID,masks))return;idundo=[_host apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"添加工具蒙版"];DYWriteTools(_host,doc,a.currentTime);[undo endUndoGroup];[_maskID release];_maskID=[mask[@"id"]copy];}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_host];[self canvas:nil];} + ida=[_host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(_host,a.currentTime).document);NSMutableArray *masks=[[DYMasksForTool(doc,_nodeID)mutableCopy]autorelease];if(masks.count>=DYToolMaskLimit){NSBeep();return;}NSDictionary *mask=DYNewMask(sender.tag);[masks addObject:mask];if(!DYSetToolMasks(doc,_nodeID,masks))return;[_maskID release];_maskID=[mask[@"id"]copy];NSDictionary *staged=[doc copy];[_document release];_document=staged;[self canvas:nil];idundo=[_host apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"添加工具蒙版"];DYWriteTools(_host,doc,a.currentTime);[undo endUndoGroup];[_maskID release];_maskID=[mask[@"id"]copy];}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_host];[self canvas:nil];} - (void)selection:(id)sender{NSArray *m=DYMasksForTool(_document,_nodeID);if(_list.indexOfSelectedItem<0||_list.indexOfSelectedItem>=m.count)return;[_maskID release];_maskID=[m[_list.indexOfSelectedItem][@"id"]copy];[self refreshWithDocument:_document time:_time];[self canvas:nil];[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_host];} - (void)remove:(id)sender{[self edit:@"删除工具蒙版" block:^(NSMutableDictionary *doc,NSMutableDictionary *mask){NSMutableArray *masks=[[DYMasksForTool(doc,self->_nodeID)mutableCopy]autorelease];[masks removeObject:mask];DYSetToolMasks(doc,self->_nodeID,masks);}];[self canvas:nil];} - (void)enabled:(NSButton*)sender{[self edit:@"启停蒙版" block:^(NSMutableDictionary *d,NSMutableDictionary *m){m[@"enabled"]=@(sender.state==NSControlStateValueOn);}];} @@ -58,7 +58,7 @@ - (void)inverted:(NSButton*)sender{[self edit:@"反转蒙版" block:^(NSMutableDictionary *d,NSMutableDictionary *m){DYMaskParameters p;[m[@"parameters"]getBytes:&p length:sizeof(p)];if(sender.state)p.flags|=DYMaskInvert;else p.flags&=~DYMaskInvert;m[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];}];} - (void)valueChanged:(NSControl*)sender{if(_refreshing)return;double value=sender.doubleValue;if(!std::isfinite(value)){NSBeep();return;}NSInteger i=sender.tag;[self edit:@"调整工具蒙版" block:^(NSMutableDictionary *d,NSMutableDictionary *m){DYMaskParameters p=DYMaskAtTime(m,self->_time);float *fields[]={&p.strength,&p.feather,&p.centerX,&p.centerY,&p.width,&p.height,&p.angle,&p.gradientWidth,&p.hueCenterTurns,&p.hueCoreHalfWidth,&p.hueSoftWidth,&p.saturationRange.low,&p.saturationRange.high,&p.lightnessRange.low,&p.lightnessRange.high,&p.inputBlack,&p.inputWhite,&p.inputGamma};*fields[i]=(i==6?value*M_PI/180:i>=8&&i<=10?value/360:value);if(p.kind==DYMaskHSLKey)p.flags|=DYMaskHueEnabled|DYMaskSaturationEnabled|DYMaskLightnessEnabled;if(!dyValidMaskParameters(p))return;if([m[@"keys"]count]&&i<8){NSMutableArray *keys=[[m[@"keys"]mutableCopy]autorelease];[keys filterUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSDictionary *key,NSDictionary *bindings){CMTime t=CMTimeMakeWithEpoch([key[@"value"]longLongValue],[key[@"scale"]intValue],[key[@"epoch"]longLongValue]);return CMTimeCompare(t,self->_time)!=0;}]];[keys addObject:DYMaskKey(self->_time,p,YES,1)];[keys sortUsingComparator:^NSComparisonResult(NSDictionary *a,NSDictionary *b){CMTime x=CMTimeMakeWithEpoch([a[@"value"]longLongValue],[a[@"scale"]intValue],[a[@"epoch"]longLongValue]),y=CMTimeMakeWithEpoch([b[@"value"]longLongValue],[b[@"scale"]intValue],[b[@"epoch"]longLongValue]);return (NSComparisonResult)CMTimeCompare(x,y);}];m[@"keys"]=keys;}else m[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];}];} - (void)canvasSelected:(NSNotification*)n{if([n.userInfo[@"node"]isEqual:_nodeID]&&[n.userInfo[@"mask"]length]){NSString *ID=[n.userInfo[@"mask"]copy];[_maskID release];_maskID=ID;}} -- (void)canvas:(id)sender{[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasSelection" object:_host userInfo:@{@"node":_nodeID,@"mask":_maskID?:@""}];} +- (void)canvas:(id)sender{[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasSelection" object:_host userInfo:@{@"node":_nodeID,@"mask":_maskID?:@"",@"document":_document?:@{}}];} - (void)clear:(id)sender{[self edit:@"清除蒙版轨迹" block:^(NSMutableDictionary *d,NSMutableDictionary *m){DYMaskParameters p=DYMaskAtTime(m,self->_time);m[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];m[@"keys"]=@[];[m removeObjectForKey:@"status"];}];} - (void)track:(NSButton*)sender{[self canvas:nil];[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolTrack" object:_host userInfo:@{@"node":_nodeID,@"mask":_maskID?:@"",@"direction":@(sender.tag)}];} - (void)trackingStatus:(NSNotification*)n{if([n.userInfo[@"node"]isEqual:_nodeID])_status.stringValue=n.userInfo[@"message"]?:@"";} diff --git a/大鱼调色/Plugin/DYPlugIn.mm b/大鱼调色/Plugin/DYPlugIn.mm index 94c7e68..5910429 100644 --- a/大鱼调色/Plugin/DYPlugIn.mm +++ b/大鱼调色/Plugin/DYPlugIn.mm @@ -23,9 +23,9 @@ - (BOOL)addParametersWithError:(NSError**)e{return DYCreateParameters(_apiManager,e);} - (NSSet*)classesForCustomParameterID:(UInt32)pid{return pid==DYToolsParameterID?[NSSet setWithObjects:DYToolDocument.class,NSDictionary.class,NSArray.class,NSString.class,NSNumber.class,NSData.class,nil]:pid==DYAssetsParameterID?[NSSet setWithObjects:DYAssetState.class,NSDictionary.class,NSString.class,NSData.class,nil]:[NSSet setWithObjects:DYInspectorToken.class,NSDictionary.class,NSString.class,NSNumber.class,nil];} - (NSView*)createViewForParameterID:(UInt32)pid{[self scheduleToolCanvasRegistration];return pid==DYInspectorParameterID?[[DYInspector alloc]initWithAPIManager:_apiManager renderer:_renderer]:[[NSView alloc]initWithFrame:NSZeroRect];} -- (BOOL)parameterChanged:(UInt32)pid atTime:(CMTime)t error:(NSError**)e{if(pid==DYToolsParameterID||pid==2013||pid==2014||(pid>=2236&&pid<2400)||pid==DYAssetsParameterID)[_renderer invalidatePreview];dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self.apiManager];});return YES;} +- (BOOL)parameterChanged:(UInt32)pid atTime:(CMTime)t error:(NSError**)e{if(pid==DYToolsParameterID)[self adoptToolCanvasDocument:DYReadTools(_apiManager,t).document];if(pid==DYToolsParameterID||pid==2013||pid==2014||(pid>=2236&&pid<2400)||pid==DYAssetsParameterID)[_renderer invalidatePreview];dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self.apiManager];});return YES;} - (BOOL)pluginState:(NSData**)state atTime:(CMTime)t quality:(FxQuality)q error:(NSError**)e{ - DYUniforms u;DYReadUniforms(_apiManager,t,&u);DYAssetState*a=DYReadAssets(_apiManager,t);double copyAuto=0;[[_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getFloatValue:©Auto fromParameter:8800 atTime:t];NSDictionary*s=@{@"schema":@2,@"tools":DYToolRenderSnapshot(DYReadTools(_apiManager,t).document,t),@"copyAuto":@(copyAuto>.5),@"uniforms":[NSData dataWithBytes:&u length:sizeof(u)],@"paths":a.paths?:@{},@"spider":a.spiderMesh?:[NSData data]};*state=[NSPropertyListSerialization dataWithPropertyList:s format:NSPropertyListBinaryFormat_v1_0 options:0 error:e];return *state!=nil; + DYUniforms u;DYReadUniforms(_apiManager,t,&u);DYAssetState*a=DYReadAssets(_apiManager,t);DYToolDocument *tools=DYReadTools(_apiManager,t);[self adoptToolCanvasDocument:tools.document];double copyAuto=0;[[_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getFloatValue:©Auto fromParameter:8800 atTime:t];NSDictionary*s=@{@"schema":@2,@"tools":DYToolRenderSnapshot(tools.document,t),@"copyAuto":@(copyAuto>.5),@"uniforms":[NSData dataWithBytes:&u length:sizeof(u)],@"paths":a.paths?:@{},@"spider":a.spiderMesh?:[NSData data]};*state=[NSPropertyListSerialization dataWithPropertyList:s format:NSPropertyListBinaryFormat_v1_0 options:0 error:e];return *state!=nil; } - (BOOL)destinationImageRect:(FxRect*)rect sourceImages:(NSArray*)src destinationImage:(FxImageTile*)dst pluginState:(NSData*)s atTime:(CMTime)t error:(NSError**)e{if(!src.count)return NO;*rect=src[0].imagePixelBounds;return YES;} - (BOOL)sourceTileRect:(FxRect*)rect sourceImageIndex:(NSUInteger)i sourceImages:(NSArray*)src destinationTileRect:(FxRect)dstRect destinationImage:(FxImageTile*)dst pluginState:(NSData*)s atTime:(CMTime)t error:(NSError**)e{if(i>=src.count)return NO;*rect=src[i].imagePixelBounds;return YES;} diff --git a/大鱼调色/Plugin/DYToolCanvasDiagnostics.inc.h b/大鱼调色/Plugin/DYToolCanvasDiagnostics.inc.h new file mode 100644 index 0000000..17f9922 --- /dev/null +++ b/大鱼调色/Plugin/DYToolCanvasDiagnostics.inc.h @@ -0,0 +1,12 @@ +{ + DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,&error);DYToolCanvasProbe *host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero; + NSMutableDictionary *doc=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document);NSDictionary *mask=DYNewMask(DYMaskRectangle);doc[@"baseMasks"][@"hsl"]=[NSMutableArray arrayWithObject:mask];DYWriteTools(base,doc,kCMTimeZero); + idplugin=(id)[[NSClassFromString(@"DYPlugIn")alloc]initWithAPIManager:host];[plugin scheduleToolCanvasRegistration];NSData *state=nil;[plugin pluginState:&state atTime:kCMTimeZero quality:(FxQuality)0 error:&error]; + auto drain=[](){double end=NSProcessInfo.processInfo.systemUptime+.1;while(NSProcessInfo.processInfo.systemUptimeosc=(id)[[NSClassFromString(@"DYToolOSC")alloc]initWithAPIManager:host];DYDiagnosticTile *overlay=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:640 height:400]autorelease];[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];Pixels pixels=read(overlay,gpu);NSUInteger opaque=0;BOOL finite=YES;for(NSUInteger i=0;i<640*400;i++){float a=pixels[i*4+3];opaque+=a>.01;finite&=std::isfinite(a);}run.record(@"native-osc-real-metal-overlay-transparent-around-controls",finite&&opaque>100&&opaque<640*400*.2,@{@"coveredPixels":@(opaque)}); + NSInteger part=0;[osc hitTestOSCAtMousePositionX:320 mousePositionY:212.5 activePart:&part atTime:kCMTimeZero];run.record(@"native-osc-object-to-canvas-center-hit",part==1); + int undo=base->_undoStarts;BOOL update=NO;[osc mouseDownAtPositionX:320 positionY:212.5 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseDraggedAtPositionX:348 positionY:196.75 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseUpAtPositionX:348 positionY:196.75 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];drain();NSDictionary *moved=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];DYMaskParameters p=DYMaskAtTime(moved,kCMTimeZero);run.record(@"native-osc-drag-writes-independent-normalized-geometry",fabs(p.centerX-.55)<1e-5&&fabs(p.centerY-.55)<1e-5,@{@"x":@(p.centerX),@"y":@(p.centerY)});run.record(@"native-osc-drag-commits-one-undo-after-callback",base->_undoStarts==undo+1&&base->_undoStarts==base->_undoEnds); + NSDictionary *before=[DYReadTools(base,kCMTimeZero).document copy];[plugin adoptToolCanvasDocument:before];[osc mouseDownAtPositionX:348 positionY:196.75 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseDraggedAtPositionX:370 positionY:180 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];BOOL handled=NO;[osc keyDownAtPositionX:370 positionY:180 keyPressed:27 modifiers:0 forceUpdate:&update didHandle:&handled atTime:kCMTimeZero];drain();run.record(@"native-osc-escape-discards-draft-without-host-edit",[before isEqual:DYReadTools(base,kCMTimeZero).document]&&base->_undoStarts==undo+1);[before release];[osc release];[plugin release]; +} diff --git a/大鱼调色/Plugin/DYToolHostIvars.inc.h b/大鱼调色/Plugin/DYToolHostIvars.inc.h index d33a1e7..31e66bb 100644 --- a/大鱼调色/Plugin/DYToolHostIvars.inc.h +++ b/大鱼调色/Plugin/DYToolHostIvars.inc.h @@ -1,7 +1,7 @@ NSString *_toolSession,*_selectedToolNode,*_selectedToolMask; NSTimer *_toolAnalysisTimer; BOOL _toolCaptureEnabled,_toolCanvasHidden,_toolDrawingPen,_toolShowCoverage; - NSMutableDictionary *_toolCanvasDraft,*_toolCanvasOriginal; + NSMutableDictionary *_toolCanvasDraft,*_toolCanvasOriginal;NSDictionary *_toolCanvasDocument; NSPoint _toolDragStart;DYMaskParameters _toolDragParameters;NSInteger _toolDragPart; dy::GrayFrame _toolSourceFrame,_trackingReferenceFrame; CMTime _toolSourceTime,_trackingReferenceTime,_trackingFrameDuration,_trackingPreviousTime; diff --git a/大鱼调色/Plugin/DYToolHostMethods.inc.h b/大鱼调色/Plugin/DYToolHostMethods.inc.h index bdc8d9a..7054ac6 100644 --- a/大鱼调色/Plugin/DYToolHostMethods.inc.h +++ b/大鱼调色/Plugin/DYToolHostMethods.inc.h @@ -1,10 +1,13 @@ - (void)initializeToolHost { - _toolCaptureDevices=[NSMutableDictionary new];_toolSourceTime=kCMTimeInvalid; + _toolCaptureDevices=[NSMutableDictionary new];_toolCanvasDocument=[[[[DYToolDocument alloc]init]autorelease].document copy];_toolSourceTime=kCMTimeInvalid; NSNotificationCenter *n=NSNotificationCenter.defaultCenter;[n addObserver:self selector:@selector(toolCanvasSelection:) name:@"DYToolCanvasSelection" object:_apiManager];[n addObserver:self selector:@selector(toolTrackRequested:) name:@"DYToolTrack" object:_apiManager]; } - (void)tearDownToolHost { [_toolAnalysisTimer invalidate];[_toolAnalysisTimer release];@synchronized(DYToolCanvasSessions()){if(_toolSession)[DYToolCanvasSessions()removeObjectForKey:_toolSession];} - [_toolSession release];[_selectedToolNode release];[_selectedToolMask release];[_toolCanvasDraft release];[_toolCanvasOriginal release];[_trackingNode release];[_trackingMaskID release];[_trackingFrozenMask release];[_trackingCandidate release];[_trackingSamples release];[_trackingMessage release];[_toolCaptureDevices release]; + [_toolCanvasDocument release];[_toolSession release];[_selectedToolNode release];[_selectedToolMask release];[_toolCanvasDraft release];[_toolCanvasOriginal release];[_trackingNode release];[_trackingMaskID release];[_trackingFrozenMask release];[_trackingCandidate release];[_trackingSamples release];[_trackingMessage release];[_toolCaptureDevices release]; +} +- (void)adoptToolCanvasDocument:(NSDictionary*)document { + if(!document)return;@synchronized(self){[_toolCanvasDocument release];_toolCanvasDocument=[document copy];if([self toolMask:_selectedToolMask node:_selectedToolNode document:document])return;NSString *node=nil,*maskID=nil;for(NSString *type in DYToolTypes())for(NSDictionary *mask in document[@"baseMasks"][type])if(!node&&[mask[@"enabled"]boolValue]){node=[@"base:" stringByAppendingString:type];maskID=mask[@"id"];}for(NSDictionary *layer in document[@"layers"])for(NSDictionary *mask in layer[@"masks"])if(!node&&[mask[@"enabled"]boolValue]){node=layer[@"id"];maskID=mask[@"id"];}[_selectedToolNode release];_selectedToolNode=[node copy];[_selectedToolMask release];_selectedToolMask=[maskID copy];} } - (void)scheduleToolCanvasRegistration { _toolCaptureEnabled=YES;dispatch_async(dispatch_get_main_queue(),^{ida=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{if(!self->_toolSession){NSString *session=NSUUID.UUID.UUIDString;ids=[self->_apiManager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];BOOL accepted=[s setStringParameterValue:session toParameter:DYCanvasSessionParameterID];os_log(OS_LOG_DEFAULT,"dayu_tool_canvas_registered accepted=%{public}d",(int)accepted);{self->_toolSession=[session copy];@synchronized(DYToolCanvasSessions()){[DYToolCanvasSessions()setObject:self forKey:session];}}}}@finally{[a endAction:self];}}); @@ -21,12 +24,12 @@ NSString *node=[[_trackingNode?:_selectedToolNode copy]autorelease];dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolTrackingStatus" object:self->_apiManager userInfo:@{@"node":node?:@"",@"message":message?:@""}];}); } - (void)toolCanvasSelection:(NSNotification*)notification { - NSString *node=notification.userInfo[@"node"],*mask=notification.userInfo[@"mask"];if(!node||!mask)return;os_log(OS_LOG_DEFAULT,"dayu_tool_canvas_selected"); + NSString *node=notification.userInfo[@"node"],*mask=notification.userInfo[@"mask"];if(!node||!mask)return;NSDictionary *document=notification.userInfo[@"document"];if(document&&DYValidToolDocument(document)){DYToolDocument *immutable=[[[DYToolDocument alloc]init]autorelease];immutable.document=document;[self adoptToolCanvasDocument:immutable.document];}os_log(OS_LOG_DEFAULT,"dayu_tool_canvas_selected"); @synchronized(self){if(_trackingActive.load()&&(![_trackingNode isEqual:node]||![_trackingMaskID isEqual:mask])){_trackingCancelled.store(true);_trackingDiscard=YES;}[_selectedToolNode release];_selectedToolNode=[node copy];[_selectedToolMask release];_selectedToolMask=[mask copy];_toolCanvasHidden=[notification.userInfo[@"hidden"]boolValue];_toolDrawingPen=[notification.userInfo[@"draw"]boolValue];[_toolCanvasDraft release];_toolCanvasDraft=nil;[_toolCanvasOriginal release];_toolCanvasOriginal=nil;} } - (BOOL)toolCanvasVisible {@synchronized(self){return _selectedToolNode&&_selectedToolMask&&!_toolCanvasHidden;}} - (NSDictionary*)toolCanvasMaskAtTime:(CMTime)time { - @synchronized(self){if(_toolCanvasHidden||!_selectedToolMask)return nil;NSDictionary *m=_toolCanvasDraft?:[self toolMask:_selectedToolMask node:_selectedToolNode document:DYReadTools(_apiManager,time).document];if(!m)return nil;NSMutableDictionary *snapshot=DYMutablePlist(m);DYMaskParameters p=DYMaskAtTime(m,time);snapshot[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];snapshot[@"drawing"]=@(_toolDrawingPen);snapshot[@"coverage"]=@(_toolShowCoverage);return snapshot;} + @synchronized(self){if(_toolCanvasHidden||!_selectedToolMask)return nil;NSDictionary *m=_toolCanvasDraft?:[self toolMask:_selectedToolMask node:_selectedToolNode document:_toolCanvasDocument];if(!m)return nil;DYMaskParameters p=DYMaskAtTime(m,time);return @{@"id":m[@"id"],@"parameters":[NSData dataWithBytes:&p length:sizeof(p)],@"nodes":m[@"nodes"]?:[NSData data],@"drawing":@(_toolDrawingPen),@"coverage":@(_toolShowCoverage)};} } - (void)toolTrackRequested:(NSNotification*)notification { NSInteger direction=[notification.userInfo[@"direction"]integerValue];if(direction==9){_trackingCancelled.store(true);return;}if(_trackingActive.load()){[self toolStatus:@"请先取消当前跟踪"];return;} @@ -85,7 +88,7 @@ dispatch_async(dispatch_get_main_queue(),^{if(self->_trackingActive.load()||![node isEqual:self->_selectedToolNode]||![maskID isEqual:self->_selectedToolMask])return; if(type==NSEventTypeKeyDown&&key==27){@synchronized(self){[self->_toolCanvasDraft release];self->_toolCanvasDraft=nil;[self->_toolCanvasOriginal release];self->_toolCanvasOriginal=nil;self->_toolDrawingPen=NO;}return;} if(part>=10000&&type==NSEventTypeLeftMouseDown){NSInteger item=part-10000;if(item==7){self->_toolShowCoverage=!self->_toolShowCoverage;return;}if(item==8){self->_toolCanvasHidden=YES;return;}if(item==0){self->_toolDrawingPen=NO;return;} - ida=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(self->_apiManager,time).document);NSMutableArray *masks=[[DYMasksForTool(doc,node)mutableCopy]autorelease];if(masks.count>=DYToolMaskLimit)return;NSInteger kind=((int[]){0,2,1,0,3,4,5})[MIN(6,item)];NSDictionary *m=DYNewMask(kind);[masks addObject:m];if(!DYSetToolMasks(doc,node,masks))return;idu=[self->_apiManager apiForProtocol:@protocol(FxUndoAPI)];[u startUndoGroup:@"添加工具蒙版"];DYWriteTools(self->_apiManager,doc,time);[u endUndoGroup];[self->_selectedToolMask release];self->_selectedToolMask=[m[@"id"]copy];self->_toolDrawingPen=kind==2;[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasSelection" object:self->_apiManager userInfo:@{@"node":node,@"mask":m[@"id"],@"draw":@(kind==2)}];}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];return; + ida=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(self->_apiManager,time).document);NSMutableArray *masks=[[DYMasksForTool(doc,node)mutableCopy]autorelease];if(masks.count>=DYToolMaskLimit)return;NSInteger kind=((int[]){0,2,1,0,3,4,5})[MIN(6,item)];NSDictionary *m=DYNewMask(kind);[masks addObject:m];if(!DYSetToolMasks(doc,node,masks))return;idu=[self->_apiManager apiForProtocol:@protocol(FxUndoAPI)];[u startUndoGroup:@"添加工具蒙版"];DYWriteTools(self->_apiManager,doc,time);[u endUndoGroup];[self->_selectedToolMask release];self->_selectedToolMask=[m[@"id"]copy];self->_toolDrawingPen=kind==2;[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasSelection" object:self->_apiManager userInfo:@{@"node":node,@"mask":m[@"id"],@"draw":@(kind==2),@"document":doc}];}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];return; } BOOL commit=NO; if(type==NSEventTypeLeftMouseDown){ida=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{NSDictionary *m=[self toolMask:maskID node:node document:DYReadTools(self->_apiManager,time).document];if(!m)return;@synchronized(self){if(!self->_toolCanvasDraft){self->_toolCanvasOriginal=[DYMutablePlist(m)retain];self->_toolCanvasDraft=[DYMutablePlist(m)retain];self->_toolDragParameters=DYMaskAtTime(m,time);self->_toolDragParameters.imageAspect=self->_toolSourceFrame.valid()?float(self->_toolSourceFrame.width)/self->_toolSourceFrame.height:1;self->_toolCanvasDraft[@"parameters"]=[NSData dataWithBytes:&self->_toolDragParameters length:sizeof(DYMaskParameters)];self->_toolCanvasDraft[@"keys"]=@[];if(self->_toolDrawingPen)self->_toolCanvasDraft[@"nodes"]=[NSData data];}self->_toolDragStart=point;self->_toolDragPart=part;self->_toolDragParameters=DYMaskAtTime(self->_toolCanvasDraft,time); diff --git a/大鱼调色/Plugin/DYToolState.mm b/大鱼调色/Plugin/DYToolState.mm index 1f43e38..099e70b 100644 --- a/大鱼调色/Plugin/DYToolState.mm +++ b/大鱼调色/Plugin/DYToolState.mm @@ -49,12 +49,15 @@ BOOL DYWriteTools(idm,NSDictionary *d,CMTime t){if(!DYValidTool NSDictionary *DYToolWithID(NSDictionary *doc,NSString *ID){for(NSDictionary *n in doc[@"layers"])if([n[@"id"]isEqual:ID])return n;return nil;} NSArray *DYMasksForTool(NSDictionary *doc,NSString *ID){return [ID hasPrefix:@"base:"]?doc[@"baseMasks"][[ID substringFromIndex:5]]?:@[]:DYToolWithID(doc,ID)[@"masks"]?:@[];} BOOL DYSetToolMasks(NSMutableDictionary *doc,NSString *ID,NSArray *masks){if([ID hasPrefix:@"base:"]){NSString *type=[ID substringFromIndex:5];if(![DYToolTypes()containsObject:type])return NO;doc[@"baseMasks"][type]=masks;}else{NSMutableDictionary *n=(id)DYToolWithID(doc,ID);if(!n)return NO;n[@"masks"]=masks;}return YES;} -DYMaskParameters DYMaskAtTime(NSDictionary *mask,CMTime time){DYMaskParameters p=dyDefaultMaskParameters();readParameters(mask[@"parameters"],&p);NSArray *keys=mask[@"keys"];if(!keys.count||!CMTIME_IS_NUMERIC(time))return p;NSDictionary *left=nil,*right=nil;for(NSDictionary *k in keys){CMTime t=keyTime(k);if(t.epoch!=time.epoch)return p;if(CMTimeCompare(t,time)<=0)left=k;if(CMTimeCompare(t,time)>=0){right=k;break;}}left=left?:right;right=right?:left;DYMaskParameters a,b;readParameters(left[@"parameters"],&a);readParameters(right[@"parameters"],&b);double duration=CMTimeGetSeconds(CMTimeSubtract(keyTime(right),keyTime(left)));float w=duration>0?fmax(0,fmin(1,CMTimeGetSeconds(CMTimeSubtract(time,keyTime(left)))/duration)):0; +DYMaskParameters DYMaskAtTime(NSDictionary *mask,CMTime time){DYMaskParameters p=dyDefaultMaskParameters();readParameters(mask[@"parameters"],&p);NSArray *keys=mask[@"keys"];if(!keys.count||!CMTIME_IS_NUMERIC(time))return p;if(keyTime(keys[0]).epoch!=time.epoch)return p;NSUInteger low=0,high=keys.count;while(low0?fmax(0,fmin(1,CMTimeGetSeconds(CMTimeSubtract(time,keyTime(left)))/duration)):0; // Only temporal geometry/feather/strength interpolate; key selection and levels stay authored. float *v=&p.centerX,*av=&a.centerX,*bv=&b.centerX;for(int i=0;i<8;i++)v[i]=av[i]+(bv[i]-av[i])*w;return p;} NSDictionary *DYMaskKey(CMTime t,DYMaskParameters p,BOOL manual,float confidence){return @{@"value":@(t.value),@"scale":@(t.timescale),@"epoch":@(t.epoch),@"parameters":parameterData(p),@"manual":@(manual),@"confidence":@(confidence)};} BOOL DYMergeTracking(NSMutableDictionary *m,NSArray *samples){if(!samples.count)return YES;NSMutableArray *all=[NSMutableArray array];CMTime lo=keyTime(samples.firstObject),hi=keyTime(samples.lastObject);if(CMTimeCompare(lo,hi)>0)std::swap(lo,hi);for(NSDictionary *key in m[@"keys"])if([key[@"manual"]boolValue]||CMTimeCompare(keyTime(key),lo)<0||CMTimeCompare(keyTime(key),hi)>0)[all addObject:key];for(NSDictionary *key in samples){BOOL manual=NO;for(NSDictionary *old in all)if(CMTimeCompare(keyTime(old),keyTime(key))==0){manual=YES;break;}if(!manual)[all addObject:key];}[all sortUsingComparator:^NSComparisonResult(NSDictionary *a,NSDictionary *b){return (NSComparisonResult)CMTimeCompare(keyTime(a),keyTime(b));}];NSMutableDictionary *candidate=DYMutablePlist(m);candidate[@"keys"]=all;if(!DYValidToolMask(candidate))return NO;m[@"keys"]=all;return YES;} -NSDictionary *DYToolRenderSnapshot(NSDictionary *doc,CMTime t){NSMutableDictionary *out=DYMutablePlist(doc);NSMutableArray *groups=[NSMutableArray arrayWithArray:[out[@"baseMasks"]allValues]];for(NSDictionary *n in out[@"layers"])[groups addObject:n[@"masks"]];for(NSArray *masks in groups)for(NSMutableDictionary *m in masks){m[@"parameters"]=parameterData(DYMaskAtTime(m,t));m[@"keys"]=@[];}return out;} +NSDictionary *DYToolRenderSnapshot(NSDictionary *doc,CMTime t){ + auto resolve=[&](NSArray *masks){NSMutableArray *result=[NSMutableArray arrayWithCapacity:masks.count];for(NSDictionary *mask in masks){NSMutableDictionary *m=[[mask mutableCopy]autorelease];m[@"parameters"]=parameterData(DYMaskAtTime(mask,t));m[@"keys"]=@[];[result addObject:m];}return result;}; + NSMutableDictionary *out=[[doc mutableCopy]autorelease],*base=[NSMutableDictionary dictionary];for(NSString *type in doc[@"baseMasks"])base[type]=resolve(doc[@"baseMasks"][type]);out[@"baseMasks"]=base;NSMutableArray *layers=[NSMutableArray array];for(NSDictionary *node in doc[@"layers"]){NSMutableDictionary *layer=[[node mutableCopy]autorelease];layer[@"masks"]=resolve(node[@"masks"]);[layers addObject:layer];}out[@"layers"]=layers;return out; +} DYUniforms DYToolUniforms(NSDictionary *node){DYUniforms u;DYDefaultUniforms(&u);NSString *type=node[@"type"];for(NSDictionary *s in DYSections())for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:s[@"enabled"]])*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])=0;u.primarySectionEnabled=0;u.cm.configured=-1;u.inputProfile=u.preLUTStrength=0;u.skinProtection.x=0; NSArray *parts=[type isEqual:@"primary"]?@[@"input",@"primary",@"output"]:[type isEqual:@"base"]?@[@"base",@"color"]:@[type];for(NSString *part in parts){NSDictionary *s=DYToolSection(part);for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:s[@"enabled"]])*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])=1;} if([type isEqual:@"primary"]){u.primarySectionEnabled=1;u.cm.configured=1;u.cm.inputTransfer=u.cm.outputTransfer;u.cm.inputGamut=u.cm.outputGamut;} diff --git a/大鱼调色/Plugin/DYToolTrackingProbe.inc.h b/大鱼调色/Plugin/DYToolTrackingProbe.inc.h index 19e4b9b..abf8e07 100644 --- a/大鱼调色/Plugin/DYToolTrackingProbe.inc.h +++ b/大鱼调色/Plugin/DYToolTrackingProbe.inc.h @@ -24,3 +24,14 @@ - (BOOL)analyzeFrame:(FxImageTile*)frame atTime:(CMTime)time error:(NSError**)error; - (BOOL)cleanupAnalysis:(NSError**)error; @end + +@interface DYToolCanvasProbe : DYToolTrackingProbe @end +@implementation DYToolCanvasProbe +- (id)apiForProtocol:(Protocol*)p{if([NSStringFromProtocol(p)isEqual:@"FxOnScreenControlAPI_v4"])return self;return [super apiForProtocol:p];} +- (BOOL)convertPointFromSpace:(FxDrawingCoordinates)from fromX:(double)x fromY:(double)y toSpace:(FxDrawingCoordinates)to toX:(double*)outX toY:(double*)outY{if(outX)*outX=40+x*560;if(outY)*outY=55+y*315;return YES;} +@end +@protocol DYToolCanvasHostProbe +- (void)scheduleToolCanvasRegistration; +- (void)adoptToolCanvasDocument:(NSDictionary*)document; +- (NSDictionary*)toolCanvasMaskAtTime:(CMTime)time; +@end diff --git a/大鱼调色/Plugin/Info.plist b/大鱼调色/Plugin/Info.plist index 4caa8ad..7e6ee91 100644 --- a/大鱼调色/Plugin/Info.plist +++ b/大鱼调色/Plugin/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.4.0 CFBundleVersion - 22 + 23 NSHumanReadableCopyright PlugInKit diff --git a/大鱼调色/Wrapper Application/Info.plist b/大鱼调色/Wrapper Application/Info.plist index 5883494..5810e73 100644 --- a/大鱼调色/Wrapper Application/Info.plist +++ b/大鱼调色/Wrapper Application/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.4.0 CFBundleVersion - 22 + 23 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright