diff --git a/大鱼调色/Plugin/DYToolCanvasDiagnostics.inc.h b/大鱼调色/Plugin/DYToolCanvasDiagnostics.inc.h index d7c5dc7..4fd719f 100644 --- a/大鱼调色/Plugin/DYToolCanvasDiagnostics.inc.h +++ b/大鱼调色/Plugin/DYToolCanvasDiagnostics.inc.h @@ -128,7 +128,6 @@ run.record(@"native-osc-stamp-selects-saved-overlay-when-action-time-differs", stamp&&[[plugin toolCanvasMaskAtTime:actionTime][@"id"]isEqual:stamp[@"id"]]&& ![[viewer valueForKey:@"stampArmed"]boolValue]&&![[(id)osc valueForKey:@"stampSaving"]boolValue]); - host->_time=kCMTimeZero; [osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero]; NSString *stampID=[[stamp[@"id"]copy]autorelease]; NSMutableDictionary *tracked=DYMutablePlist(DYReadTools(host,kCMTimeZero).document); @@ -162,6 +161,19 @@ NSDictionary *resized=DYSharedMaskWithID(DYReadTools(host,kCMTimeZero).document,stampID); DYMaskParameters enlarged=DYMaskAtTime(resized,kCMTimeZero); run.record(@"native-osc-stamp-resizes-coverage-without-rotation-handle-or-track-changes",!rotationHandle&&part==2&&enlarged.width>target.width&&enlarged.height>target.height&&enlarged.centerX==target.centerX&&enlarged.centerY==target.centerY&&[resized[@"keys"]isEqual:keys]); + [osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero]; + undo=base->_undoStarts; + part=down(404,212.5); + [osc mouseDraggedAtPositionX:460 positionY:196.75 activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero]; + up(460,196.75,part);drain(); + NSDictionary *repositioned=DYSharedMaskWithID(DYReadTools(host,kCMTimeZero).document,stampID); + NSArray *editedKeys=repositioned[@"keys"]; + DYMaskParameters trackedCenter=DYMaskAtTime(repositioned,kCMTimeZero); + run.record(@"native-osc-stamp-target-move-saves-the-canvas-key-with-a-different-action-time", + part==1&&fabs(trackedCenter.centerX-.75)<1e-6&&fabs(trackedCenter.centerY-.55)<1e-6&& + editedKeys.count==2&&[editedKeys[0][@"manual"]boolValue]&&[editedKeys[1]isEqual:keys[1]]&& + base->_undoStarts==undo+1&&base->_undoEnds==undo+1); + host->_time=kCMTimeZero; click(251,104);drain(); // top-down viewport y=30...345, forward button is x=212...290. run.record(@"native-osc-stamp-forward-action-starts-the-existing-host-tracker",host->_forwardStarts==1&&host->_backwardStarts==0); [plugin cleanupAnalysis:nil];drain(); @@ -180,5 +192,18 @@ run.record(@"native-osc-stamp-retries-with-the-same-source-and-saves-once", afterRetry.count==DYSharedMasks(beforeRejected).count+1&& [afterRetry.lastObject[@"stampSource"]isEqual:source]&&![[viewer valueForKey:@"stampArmed"]boolValue]); + NSString *untrackedID=[[afterRetry.lastObject[@"id"]copy]autorelease]; + [osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero]; + host->_time=actionTime; + undo=base->_undoStarts; + part=down(404,212.5); + [osc mouseDraggedAtPositionX:460 positionY:196.75 activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero]; + up(460,196.75,part);drain(); + NSDictionary *untracked=DYSharedMaskWithID(DYReadTools(host,kCMTimeZero).document,untrackedID); + DYMaskParameters untrackedCenter=DYMaskAtTime(untracked,kCMTimeZero); + run.record(@"native-osc-untracked-stamp-target-saves-in-place-with-a-different-action-time", + part==1&&fabs(untrackedCenter.centerX-.75)<1e-6&&fabs(untrackedCenter.centerY-.55)<1e-6&& + ![untracked[@"keys"]count]&&[untracked[@"stampSource"]isEqual:source]&& + base->_undoStarts==undo+1&&base->_undoEnds==undo+1); [(id)osc release];[(id)plugin release]; } diff --git a/大鱼调色/Plugin/DYToolCanvasEditing.inc.h b/大鱼调色/Plugin/DYToolCanvasEditing.inc.h index 814812e..0b95a9e 100644 --- a/大鱼调色/Plugin/DYToolCanvasEditing.inc.h +++ b/大鱼调色/Plugin/DYToolCanvasEditing.inc.h @@ -8,8 +8,8 @@ @synchronized(self){[_toolCanvasDraft release];_toolCanvasDraft=nil;[_toolCanvasOriginal release];_toolCanvasOriginal=nil;_toolDrawingPen=_toolDrawingShape=NO;_toolCanvasHasHover=NO;_toolCanvasEditTime=kCMTimeInvalid;++_toolCanvasRevision;}[self postToolCanvasStatus:nil]; } - (void)commitToolCanvasDraftAtTime:(CMTime)eventTime { - NSDictionary *draft=nil,*original=nil;NSString *node=nil,*maskID=nil;CMTime time;uint64_t revision;BOOL sourceEdit,resizeStamp; - @synchronized(self){if(!_toolCanvasDraft||!_toolCanvasOriginal)return;if(!CMTIME_IS_NUMERIC(eventTime)||CMTimeCompare(eventTime,_toolCanvasEditTime)!=0){[self discardToolCanvasDraft];[self postToolCanvasStatus:@"播放头已移动,请重新绘制。"];return;}draft=[_toolCanvasDraft copy];original=[_toolCanvasOriginal copy];node=[_selectedToolNode copy];maskID=[_selectedToolMask copy];time=_toolCanvasEditTime;sourceEdit=_toolDragPart==DYCloneSourcePart;resizeStamp=draft[@"stampSource"]&&_toolDragPart>=2&&_toolDragPart<=5; + NSDictionary *draft=nil,*original=nil;NSString *node=nil,*maskID=nil;CMTime time;uint64_t revision;BOOL stampEdit,sourceEdit,resizeStamp; + @synchronized(self){if(!_toolCanvasDraft||!_toolCanvasOriginal)return;if(!CMTIME_IS_NUMERIC(eventTime)||CMTimeCompare(eventTime,_toolCanvasEditTime)!=0){[self discardToolCanvasDraft];[self postToolCanvasStatus:@"播放头已移动,请重新绘制。"];return;}draft=[_toolCanvasDraft copy];original=[_toolCanvasOriginal copy];node=[_selectedToolNode copy];maskID=[_selectedToolMask copy];time=_toolCanvasEditTime;stampEdit=draft[@"stampSource"]!=nil;sourceEdit=_toolDragPart==DYCloneSourcePart;resizeStamp=stampEdit&&_toolDragPart>=2&&_toolDragPart<=5; // Keep the completed path visible until the authoritative write returns. // Discarding it here exposed the new pen mask's default rectangular nodes // during the OSC redraw that immediately follows the closing click. @@ -18,9 +18,13 @@ @synchronized(self){if(self->_trackingActive.load()||revision!=self->_toolCanvasRevision||![node isEqual:self->_selectedToolNode]||![maskID isEqual:self->_selectedToolMask])return;} ida=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;BOOL changed=NO; [a startAction:self];@try{ - os_log(OS_LOG_DEFAULT,"dayu_pen_commit event=%{public}.9f action=%{public}.9f nodes=%{public}lu",CMTimeGetSeconds(time),CMTimeGetSeconds(a.currentTime),(unsigned long)([draft[@"nodes"]length]/sizeof(DYBezierNode))); - if(!CMTIME_IS_NUMERIC(a.currentTime)||CMTimeCompare(DYHostDisplayedFrameTime(self->_apiManager,a.currentTime),time)!=0){[self postToolCanvasStatus:@"播放头已移动,本次蒙版草稿未写入其它帧。"];return;} - NSMutableDictionary *doc=DYMutablePlist(DYReadTools(self->_apiManager,time).document),*current=[self toolMask:maskID node:node document:doc]; + CMTime actionTime=DYHostDisplayedFrameTime(self->_apiManager,a.currentTime); + os_log(OS_LOG_DEFAULT,"dayu_pen_commit stamp=%{public}d event=%{public}.9f action=%{public}.9f nodes=%{public}lu",stampEdit,CMTimeGetSeconds(time),CMTimeGetSeconds(actionTime),(unsigned long)([draft[@"nodes"]length]/sizeof(DYBezierNode))); + if(!CMTIME_IS_NUMERIC(actionTime)||(!stampEdit&&CMTimeCompare(actionTime,time)!=0)){[self postToolCanvasStatus:@"播放头已移动,本次蒙版草稿未写入其它帧。"];return;} + // The stamp document is non-animatable. Preserve the canvas time for the + // geometry and tracking key, and access the document at the host action time. + CMTime writeTime=stampEdit?actionTime:time; + NSMutableDictionary *doc=DYMutablePlist(DYReadTools(self->_apiManager,writeTime).document),*current=[self toolMask:maskID node:node document:doc]; if(!current||![current isEqual:original]){os_log(OS_LOG_DEFAULT,"dayu_pen_commit conflict current=%{public}d",current!=nil);[self postToolCanvasStatus:@"蒙版已在其它位置修改,本次画面草稿未覆盖它。"];return;} NSMutableDictionary *result=sourceEdit?[[draft mutableCopy]autorelease]:DYMutablePlist(draft); if(resizeStamp){ @@ -29,10 +33,10 @@ result[@"parameters"]=[NSData dataWithBytes:&authored length:sizeof(authored)]; result[@"keys"]=current[@"keys"]; }else if(!sourceEdit&&[current[@"keys"]count]){DYMaskParameters p=DYMaskAtTime(result,time);if(current[@"stampSource"])result[@"parameters"]=current[@"parameters"];NSMutableArray *keys=[[current[@"keys"]mutableCopy]autorelease];NSIndexSet *same=[keys indexesOfObjectsPassingTest:^BOOL(NSDictionary *key,NSUInteger i,BOOL *stop){return CMTimeCompare(CMTimeMakeWithEpoch([key[@"value"]longLongValue],[key[@"scale"]intValue],[key[@"epoch"]longLongValue]),time)==0;}];[keys removeObjectsAtIndexes:same];[keys addObject:DYMaskKey(time,p,YES,1)];result[@"keys"]=@[];if(!DYMergeTracking(result,keys))return;} - if(DYValidToolMask(result)&&![current isEqual:result]){[current setDictionary:result];idundo=[self->_apiManager apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:sourceEdit?@"移动图章取样点":@"编辑工具蒙版"];changed=DYWriteTools(self->_apiManager,doc,time);[undo endUndoGroup];if(changed){DYToolDocument *saved=[[[DYToolDocument alloc]init]autorelease];saved.document=doc;[self adoptToolCanvasDocument:saved.document];}} + if(DYValidToolMask(result)&&![current isEqual:result]){[current setDictionary:result];idundo=[self->_apiManager apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:sourceEdit?@"移动图章取样点":stampEdit?@"编辑仿制图章":@"编辑工具蒙版"];changed=DYWriteTools(self->_apiManager,doc,writeTime);[undo endUndoGroup];if(changed){DYToolDocument *saved=[[[DYToolDocument alloc]init]autorelease];saved.document=doc;[self adoptToolCanvasDocument:saved.document];}else if(stampEdit)[self postToolCanvasStatus:@"宿主未保存图章修改,已保留上一次位置。"];} }@finally{[a endAction:self];} os_log(OS_LOG_DEFAULT,"dayu_pen_commit result=%{public}d valid=%{public}d",changed,DYValidToolMask(draft)); - if(changed)[self postToolCanvasStatus:sourceEdit?@"图章取样点已移动 · 可一次撤销":@"蒙版已保存 · 可一次撤销"]; + if(changed)[self postToolCanvasStatus:sourceEdit?@"图章取样点已移动 · 可一次撤销":stampEdit?@"图章已保存 · 可一次撤销":@"蒙版已保存 · 可一次撤销"]; [NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager]; }@finally{@synchronized(self){if(revision==self->_toolCanvasRevision){[self->_toolCanvasDraft release];self->_toolCanvasDraft=nil;[self->_toolCanvasOriginal release];self->_toolCanvasOriginal=nil;self->_toolCanvasEditTime=kCMTimeInvalid;}self->_toolCanvasCommitPending=NO;}[self postToolCanvasStatus:nil];}});[draft release];[original release];[node release];[maskID release]; } diff --git a/大鱼调色/Plugin/Info.plist b/大鱼调色/Plugin/Info.plist index 2d9621a..2c75107 100644 --- a/大鱼调色/Plugin/Info.plist +++ b/大鱼调色/Plugin/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 1.13.3 + 1.13.4 CFBundleVersion - 87 + 88 NSHumanReadableCopyright PlugInKit @@ -71,7 +71,7 @@ uuid 1C17B73B-F229-4C09-A434-EAF6DFF5F22A version - 1.13.3 + 1.13.4 className diff --git a/大鱼调色/Wrapper Application/Info.plist b/大鱼调色/Wrapper Application/Info.plist index c93d7c8..d621d8d 100644 --- a/大鱼调色/Wrapper Application/Info.plist +++ b/大鱼调色/Wrapper Application/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.13.3 + 1.13.4 CFBundleVersion - 87 + 88 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright