From 020f064a282cea162faa432b401d114c9917605c Mon Sep 17 00:00:00 2001 From: mac Date: Mon, 2 Nov 2026 01:32:16 +0800 Subject: [PATCH] Map single-step source time to timeline time for offset clips; 292 native checks pass --- tools/deliver.py | 9 +++++++-- 大鱼调色/Plugin/DYToolHostMethods.inc.h | 2 +- 大鱼调色/Plugin/DYToolTrackingDiagnostics.inc.h | 5 ++++- 大鱼调色/Plugin/DYToolTrackingProbe.inc.h | 6 ++++-- 大鱼调色/Plugin/Info.plist | 2 +- 大鱼调色/Wrapper Application/Info.plist | 2 +- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/tools/deliver.py b/tools/deliver.py index 3b99ca8..ad732dc 100644 --- a/tools/deliver.py +++ b/tools/deliver.py @@ -92,8 +92,13 @@ def main(): if old:unregister(old/PLUGIN) archive.unlink();backup=CACHE/'previous-template.moef' if backup.exists():backup.unlink() - run('pluginkit','-a',str(DEST/PLUGIN));registry=run('pluginkit','-m','-A','-D','-v','-i','com.dayu.color.XPC') - entries=[l for l in registry.splitlines() if 'com.dayu.color.XPC(' in l] + # 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): + run('pluginkit','-a',str(DEST/PLUGIN));registry=run('pluginkit','-m','-A','-D','-v','-i','com.dayu.color.XPC') + entries=[l for l in registry.splitlines() if 'com.dayu.color.XPC(' in l] + 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()) if old:record['previousInstallBackup']=str(old) diff --git a/大鱼调色/Plugin/DYToolHostMethods.inc.h b/大鱼调色/Plugin/DYToolHostMethods.inc.h index f3ddff4..2c1f515 100644 --- a/大鱼调色/Plugin/DYToolHostMethods.inc.h +++ b/大鱼调色/Plugin/DYToolHostMethods.inc.h @@ -87,7 +87,7 @@ BOOL hasResults=![self->_trackingCandidate[@"keys"]isEqual:self->_trackingFrozenMask[@"keys"]];NSString *message=self->_trackingMessage?:[NSString stringWithFormat:@"%@跟踪完成 · %lu 个轨迹键",self->_trackingBoth?@"双向":(self->_trackingBackward?@"反向":@"正向"),(unsigned long)[self->_trackingCandidate[@"keys"]count]]; if(hasResults&&!self->_trackingDiscard){ida=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(a){[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(self->_apiManager,a.currentTime).document);NSMutableDictionary *mask=[self toolMask:self->_trackingMaskID node:self->_trackingNode document:doc];if(mask&&[mask isEqual:self->_trackingFrozenMask]){self->_trackingCandidate[@"status"]=message;[mask setDictionary:self->_trackingCandidate];idundo=[self->_apiManager apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"蒙版区域跟踪"];BOOL written=DYWriteTools(self->_apiManager,doc,a.currentTime);[undo endUndoGroup];if(!written)message=@"宿主未接受轨迹,原蒙版已保留";}else message=@"目标工具或蒙版已更改,已丢弃过期跟踪结果";}@finally{[a endAction:self];}}} CMTime stepTime=self->_trackingPreviousTime;BOOL advance=self->_trackingSingle&&hasResults&&!self->_trackingDiscard&&!self->_trackingCancelled.load()&&CMTIME_IS_NUMERIC(stepTime); - self->_trackingActive.store(false);if(advance){idseek=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(seek){[seek startAction:self];@try{idcommand=[self->_apiManager apiForProtocol:@protocol(FxCommandAPI_v2)];[command movePlayheadToTime:stepTime error:nil];}@finally{[seek endAction:self];}}}[self->_toolAnalysisTimer invalidate];[self->_toolAnalysisTimer release];self->_toolAnalysisTimer=nil;[self toolStatus:message];[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager]; + self->_trackingActive.store(false);if(advance){idseek=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(seek){[seek startAction:self];@try{idtiming=[self->_apiManager apiForProtocol:@protocol(FxTimingAPI_v4)];CMTime timelineTime=kCMTimeInvalid;[timing timelineTime:&timelineTime fromInputTime:stepTime];idcommand=[self->_apiManager apiForProtocol:@protocol(FxCommandAPI_v2)];if(!CMTIME_IS_NUMERIC(timelineTime)||![command movePlayheadToTime:timelineTime error:nil])message=[message stringByAppendingString:@";轨迹已保存,宿主未能移动播放头"];}@finally{[seek endAction:self];}}}[self->_toolAnalysisTimer invalidate];[self->_toolAnalysisTimer release];self->_toolAnalysisTimer=nil;[self toolStatus:message];[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager]; });return YES; } diff --git a/大鱼调色/Plugin/DYToolTrackingDiagnostics.inc.h b/大鱼调色/Plugin/DYToolTrackingDiagnostics.inc.h index 7778c36..aefc19a 100644 --- a/大鱼调色/Plugin/DYToolTrackingDiagnostics.inc.h +++ b/大鱼调色/Plugin/DYToolTrackingDiagnostics.inc.h @@ -14,7 +14,10 @@ capture(0);request(1);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=0;i<3&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}NSMutableDictionary *changed=DYMutablePlist(DYReadTools(base,kCMTimeZero).document);changed[@"baseMasks"][@"hsl"][0][@"enabled"]=@NO;DYWriteTools(base,changed,kCMTimeZero);[plugin cleanupAnalysis:nil];drain();run.record(@"stale-analysis-cannot-overwrite-edited-mask",[DYReadTools(base,kCMTimeZero).document isEqual:changed]&&base->_undoStarts==writes); DYWriteTools(base,doc,kCMTimeZero);capture(0);request(1);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=0;i<3&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}request(9);setFrame(3);NSError *cancelError=nil;BOOL stopped=![plugin analyzeFrame:frame atTime:timeAt(3) error:&cancelError];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"cancel-keeps-only-contiguous-trusted-segment",callbacks&&stopped&&[tracked[@"keys"]count]==3&&base->_undoStarts==writes+1);run.record(@"cancel-sends-sdk-quiet-analysis-termination",[cancelError.domain isEqual:FxPlugErrorDomain]&&cancelError.code==kFxError_UserCancelled); DYWriteTools(base,doc,kCMTimeZero);capture(2);host->_state=kFxAnalysisState_NotAnalyzing;request(0);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=2;i<6&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}[plugin cleanupAnalysis:nil];drain();BOOL backward=host->_backwardStarts==1;callbacks&=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=2;i>=0&&callbacks;i--){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}[plugin cleanupAnalysis:nil];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"bidirectional-passes-share-reference-and-merge-once",callbacks&&backward&&[tracked[@"keys"]count]==6&&base->_undoStarts==writes+2); - DYWriteTools(base,doc,kCMTimeZero);capture(2);host->_state=kFxAnalysisState_NotAnalyzing;request(-2);BOOL range=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&CMTimeCompare(desired.start,timeAt(1))==0&&CMTimeCompare(desired.duration,timeAt(2))==0;[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=2;i>=1;i--){setFrame(i);[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}setFrame(0);NSError *singleStopError=nil;stopped=![plugin analyzeFrame:frame atTime:timeAt(0) error:&singleStopError];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"backward-single-step-includes-reference-and-one-neighbor",range&&stopped&&[tracked[@"keys"]count]==2);run.record(@"single-step-sends-sdk-quiet-analysis-termination",[singleStopError.domain isEqual:FxPlugErrorDomain]&&singleStopError.code==kFxError_UserCancelled); + DYWriteTools(base,doc,kCMTimeZero);capture(2);host->_timelineOffset=CMTimeMake(4,1);host->_state=kFxAnalysisState_NotAnalyzing;request(-2);BOOL range=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&CMTimeCompare(desired.start,timeAt(1))==0&&CMTimeCompare(desired.duration,timeAt(2))==0;[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=2;i>=1;i--){setFrame(i);[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}setFrame(0);NSError *singleStopError=nil;stopped=![plugin analyzeFrame:frame atTime:timeAt(0) error:&singleStopError];drain();tracked=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];run.record(@"backward-single-step-includes-reference-and-one-neighbor",range&&stopped&&[tracked[@"keys"]count]==2);run.record(@"single-step-sends-sdk-quiet-analysis-termination",[singleStopError.domain isEqual:FxPlugErrorDomain]&&singleStopError.code==kFxError_UserCancelled); + run.record(@"backward-single-step-seeks-timeline-with-clip-offset",host->_seekCount==1&&CMTimeCompare(host->_seekTime,CMTimeAdd(CMTimeMake(4,1),timeAt(1)))==0&&CMTimeCompare(host->_time,timeAt(1))==0); + DYWriteTools(base,doc,kCMTimeZero);capture(2);BOOL repeated=YES;for(int first=2;first<4;first++){request(2);repeated&=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=first;i<=first+1&&repeated;i++){setFrame(i);repeated&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];}[plugin cleanupAnalysis:nil];drain();repeated&=CMTimeCompare(host->_time,timeAt(first+1))==0;}run.record(@"repeated-forward-single-step-continues-source-frames-at-offset-clip",repeated&&host->_seekCount==3&&CMTimeCompare(host->_seekTime,CMTimeAdd(CMTimeMake(4,1),timeAt(4)))==0); + // An expected loss must end the host job, not only our local tracking state. DYWriteTools(base,doc,kCMTimeZero);capture(0);request(1);callbacks=[plugin desiredAnalysisTimeRange:&desired forInputWithTimeRange:inputRange error:nil]&&[plugin setupAnalysisForTimeRange:desired frameDuration:timeAt(1) error:nil];for(int i=0;i<3&&callbacks;i++){setFrame(i);callbacks&=[plugin analyzeFrame:frame atTime:timeAt(i) error:nil];} Pixels flat(tw*th*4,.1f);for(size_t i=3;i { @public - id _base;CMTime _time;FxAnalysisState _state;int _forwardStarts,_backwardStarts; + id _base;CMTime _time,_timelineOffset,_seekTime;int _seekCount;FxAnalysisState _state;int _forwardStarts,_backwardStarts; } @end @implementation DYToolTrackingProbe -- (id)apiForProtocol:(Protocol*)protocol{NSString *name=NSStringFromProtocol(protocol);if([@[@"FxAnalysisAPI",@"FxTimingAPI_v4",@"FxCustomParameterActionAPI_v4"]containsObject:name])return self;return [_base apiForProtocol:protocol];} +- (id)apiForProtocol:(Protocol*)protocol{NSString *name=NSStringFromProtocol(protocol);if([@[@"FxAnalysisAPI",@"FxTimingAPI_v4",@"FxCustomParameterActionAPI_v4",@"FxCommandAPI_v2"]containsObject:name])return self;return [_base apiForProtocol:protocol];} - (void)startAction:(id)sender{[(id)_base startAction:sender];} - (void)endAction:(id)sender{[(id)_base endAction:sender];} - (CMTime)currentTime{return _time;} +- (void)timelineTime:(CMTime*)timeline fromInputTime:(CMTime)input{*timeline=CMTimeAdd(input,CMTIME_IS_NUMERIC(_timelineOffset)?_timelineOffset:kCMTimeZero);} +- (BOOL)movePlayheadToTime:(CMTime)time error:(NSError**)error{_seekTime=time;_seekCount++;_time=CMTimeSubtract(time,CMTIME_IS_NUMERIC(_timelineOffset)?_timelineOffset:kCMTimeZero);return YES;} - (FxAnalysisState)analysisStateForEffect{return _state;} - (BOOL)startForwardAnalysis:(FxAnalysisLocation)location error:(NSError**)error{_forwardStarts++;_state=kFxAnalysisState_AnalysisStarted;return YES;} - (BOOL)startBackwardAnalysis:(FxAnalysisLocation)location error:(NSError**)error{_backwardStarts++;_state=kFxAnalysisState_AnalysisStarted;return YES;} diff --git a/大鱼调色/Plugin/Info.plist b/大鱼调色/Plugin/Info.plist index 32c5fe4..362a48b 100644 --- a/大鱼调色/Plugin/Info.plist +++ b/大鱼调色/Plugin/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.4.2 CFBundleVersion - 28 + 29 NSHumanReadableCopyright PlugInKit diff --git a/大鱼调色/Wrapper Application/Info.plist b/大鱼调色/Wrapper Application/Info.plist index 7f85f66..1493e7d 100644 --- a/大鱼调色/Wrapper Application/Info.plist +++ b/大鱼调色/Wrapper Application/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.4.2 CFBundleVersion - 28 + 29 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright