蜘蛛盘本地跟手并合并宿主拖动写入
这个提交包含在:
1 父节点
9f12f7b42a
当前提交
178e1e7d16
12 个文件已更改
+251
-79
没有与搜索条件相匹配的文件
@@ -0,0 +1,17 @@
|
||||
# Color Finale 2.17.0 蜘蛛盘交互取证
|
||||
|
||||
2026-11-09,目标是本机 Color Finale 2.17.0(632)的 Color Warper。取证范围为 arm64 发布二进制中的拖动、取样和着色调用链。这里记录当前版本观察到的设计,没有旧版同场景数据可判定哪些是该版本新增的提速项。
|
||||
|
||||
| 二进制与地址 | 观察 |
|
||||
| --- | --- |
|
||||
| 插件 `0x10003d514`,`FTColorWarperView mouseDragged:` | 在本地改节点偏移,设置重绘,标记散点位图过期,再通知控制器。GradeKit `0x1f320` 修改偏移和固定标志后传播联动。 |
|
||||
| 插件 `0x100039ddc`、`0x10003aac8` | 色场底图和散点图各有位图缓存,按显示尺寸和模式复用。拖动使散点位图失效。重建函数 `0x10003ac04` 读取已有散点数据和本地网格形变,重新投影并栅格化。 |
|
||||
| 插件 `0x10003e2c8`、`0x10003e504` | 从单独的帧取样入口取得图块,缩放后生成散点数据,再投递回界面。拖动回调的直接调用链未进入该取样入口。 |
|
||||
| 插件 `0x10003f694 → 0x10009313c → 0x1000772fc → 0x100075fdc` | 更新读数,存储调整栈,只刷新当前节点的修改指示。存储调用进入宿主参数动作。取证未发现该链路的固定节流频率。 |
|
||||
| GradeKit `0x2209c`,RenderingEngine `0x2437c`、`0x24a80` | 检查各平面是否有变形,将有效偏移生成查找纹理,挂到 Core Image 着色节点上。宿主输出通过 GradeKit 的 `FTCIRenderer` 编排。 |
|
||||
|
||||
文件 SHA-256 为插件 `d2697ec11a33e5bab20a49aa176552ba4f99b1892187585bfec256b8f94c92f3`、GradeKit `703f94a4eb0be78fc7f7d5dc811cb2000b7d5240da5e6fe7f69857186df6894d`、RenderingEngine `add5a618cf4af0423df9910f6b2fab5ec3e3c6c59e6138722b0fd3c5f45c82ea`。地址由 `nm -arch arm64` 与 `otool -arch arm64 -tV` 核对。以上是静态证据,未测目标的 FCP 端到端帧率。
|
||||
|
||||
大鱼 1.21.6 的 `DYSpiderDisc` 每次拖动都生成两份废弃的 16×6 兼容数据,接收方只使用当前网格。每次写入后同步发 `DYModelChanged`,检查器重新读标量、更新卡片和布局。画布的蜘蛛盘写入则是每个事件向主队列投递一笔,并在实际写入前重复验证宿主状态。静态底图已有缓存,矢量轨迹每次绘制仍重新包装位图。
|
||||
|
||||
1.21.7 借鉴本地几何、宿主写入和取样的分工。检查器与工作台的网格即时跟手,最长每 1/60 秒合并一笔宿主写入,松手同步补交末值,整次拖动保留一个撤销组。拖动时复用上一张示波轨迹,结束后回到最终输出取样。画布主队列每批只写最新网格,继续验证时间、目标层及外部变动。网格算法、GPU 调色与预设编码沿用项目原实现。
|
||||
+29
-2
@@ -39,6 +39,7 @@
|
||||
BOOL _duplicate;
|
||||
@public
|
||||
int _undoStarts,_undoEnds;BOOL _undoActive;
|
||||
NSUInteger _assetWrites;
|
||||
}
|
||||
@end
|
||||
@interface DYInspector (DiagnosticActions)
|
||||
@@ -53,7 +54,7 @@
|
||||
@protocol DYSpiderProbe
|
||||
@property(nonatomic,copy) NSData *meshData;
|
||||
@property(nonatomic,retain) NSMutableIndexSet *selection,*pinned;
|
||||
@property(nonatomic,copy) void(^changed)(DYGrade,NSData*);
|
||||
@property(nonatomic,copy) void(^changed)(NSData*);
|
||||
@property(nonatomic,copy) void(^gesture)(BOOL);
|
||||
@property(nonatomic,readonly) NSInteger hueCount,saturationCount;
|
||||
- (void)changeHueCount:(int)hues saturationCount:(int)saturation;
|
||||
@@ -98,7 +99,7 @@
|
||||
id stored=_custom[@(pid)];if(!stored)return NO;if(value)*value=stored;return YES;
|
||||
}
|
||||
- (BOOL)setCustomParameterValue:(NSObject<NSSecureCoding,NSCopying> *)value toParameter:(UInt32)pid atTime:(CMTime)time {
|
||||
if(!_custom[@(pid)]||!value)return NO;_custom[@(pid)]=[[value copy]autorelease];return YES;
|
||||
if(!_custom[@(pid)]||!value)return NO;_custom[@(pid)]=[[value copy]autorelease];if(pid==DYAssetsParameterID)++_assetWrites;return YES;
|
||||
}
|
||||
@end
|
||||
#include "DYWorkspaceDiagnosticHost.inc.h"
|
||||
@@ -340,6 +341,32 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
|
||||
starts=uiHost->_undoStarts;ends=uiHost->_undoEnds;dragNode(2,18,8);DYAssetState *spiderSaved=DYReadAssets(uiHost,kCMTimeZero);auto dragged=DYSpiderMesh(spiderSaved.spiderMesh);
|
||||
run.record(@"spider-single-drag-spoke-following-and-pin",dragged.x[0]>initialMesh.x[0]&&dragged.x[1]>initialMesh.x[1]&&dragged.x[3]>initialMesh.x[3]&&dragged.x[4]==initialMesh.x[4]&&dragged.x[5]==initialMesh.x[5]&&dragged.pins[2]);
|
||||
run.record(@"spider-drag-one-host-undo-group",uiHost->_undoStarts==starts+1&&uiHost->_undoEnds==ends+1&&!uiHost->_undoActive);
|
||||
NSData *beforeBurst=spiderSaved.spiderMesh;
|
||||
NSUInteger writesBeforeBurst=uiHost->_assetWrites;
|
||||
NSPoint burstStart=[disc point:2];
|
||||
[disc mouseDown:mouseFor(disc,NSEventTypeLeftMouseDown,burstStart)];
|
||||
for(int step=1;step<=120;step++)
|
||||
[disc mouseDragged:mouseFor(disc,NSEventTypeLeftMouseDragged,NSMakePoint(burstStart.x+step*.1,burstStart.y+step*.05))];
|
||||
run.record(@"spider-draft-follows-input-before-host-write",![beforeBurst isEqual:disc.meshData]&&uiHost->_assetWrites==writesBeforeBurst);
|
||||
NSData *lastDraft=disc.meshData;
|
||||
[disc mouseUp:mouseFor(disc,NSEventTypeLeftMouseUp,NSMakePoint(burstStart.x+12,burstStart.y+6))];
|
||||
run.record(@"spider-burst-coalesces-to-last-host-value",uiHost->_assetWrites==writesBeforeBurst+1&&[lastDraft isEqual:DYReadAssets(uiHost,kCMTimeZero).spiderMesh]);
|
||||
burstStart=[disc point:2];
|
||||
[disc mouseDown:mouseFor(disc,NSEventTypeLeftMouseDown,burstStart)];
|
||||
NSPoint nextPoint=NSMakePoint(burstStart.x+9,burstStart.y+3);
|
||||
[disc mouseDragged:mouseFor(disc,NSEventTypeLeftMouseDragged,nextPoint)];
|
||||
NSDate *deadline=[NSDate dateWithTimeIntervalSinceNow:.2];
|
||||
while(uiHost->_assetWrites==writesBeforeBurst+1&&[deadline timeIntervalSinceNow]>0)
|
||||
[[NSRunLoop currentRunLoop]runMode:NSDefaultRunLoopMode beforeDate:deadline];
|
||||
run.record(@"spider-paused-drag-writes-live-before-release",uiHost->_assetWrites==writesBeforeBurst+2&&[disc.meshData isEqual:DYReadAssets(uiHost,kCMTimeZero).spiderMesh]);
|
||||
DYAssetState *external=[[DYReadAssets(uiHost,kCMTimeZero)copy]autorelease];
|
||||
auto externalMesh=dy::neutralMesh(6,6);
|
||||
external.spiderMesh=[NSData dataWithBytes:&externalMesh length:sizeof(externalMesh)];
|
||||
DYWriteAssets(uiHost,external,kCMTimeZero);
|
||||
[disc mouseDragged:mouseFor(disc,NSEventTypeLeftMouseDragged,NSMakePoint(nextPoint.x+8,nextPoint.y+3))];
|
||||
[disc mouseUp:mouseFor(disc,NSEventTypeLeftMouseUp,NSMakePoint(nextPoint.x+8,nextPoint.y+3))];
|
||||
run.record(@"spider-deferred-write-preserves-external-edit",[external.spiderMesh isEqual:DYReadAssets(uiHost,kCMTimeZero).spiderMesh]&&!uiHost->_undoActive);
|
||||
DYWriteAssets(uiHost,spiderSaved,kCMTimeZero);[inspector refresh];
|
||||
error=nil;NSData *spiderArchive=[NSKeyedArchiver archivedDataWithRootObject:spiderSaved requiringSecureCoding:YES error:&error];DYAssetState *decodedSpider=[NSKeyedUnarchiver unarchivedObjectOfClass:DYAssetState.class fromData:spiderArchive error:&error];run.record(@"spider-archive-retains-mesh-pins-and-lut-paths",decodedSpider&&[decodedSpider isEqual:spiderSaved],@{@"error":reason(error)});
|
||||
NSDictionary *snapshot=[inspector performSelector:@selector(presetSnapshot)];NSData *presetJSON=[NSJSONSerialization dataWithJSONObject:snapshot options:0 error:&error];NSDictionary *decodedPreset=[NSJSONSerialization JSONObjectWithData:presetJSON options:0 error:&error];run.record(@"complete-version-seven-preset-includes-mesh",[decodedPreset[@"version"]isEqual:@7]&&[DYSpiderFromJSON(decodedPreset[@"spider"])isEqual:spiderSaved.spiderMesh]);
|
||||
NSDictionary *portable=DYSpiderJSON(spiderSaved.spiderMesh,spiderSaved.spiderLinked);NSData *decodedPortable=DYSpiderFromJSON(portable);run.record(@"spider-json-preset-exact-roundtrip",[decodedPortable isEqual:spiderSaved.spiderMesh]);
|
||||
|
||||
+57
-6
@@ -233,6 +233,7 @@ static NSArray *DYPresentationSections(BOOL cstOnly,BOOL splitOutput) {
|
||||
@protocol DYGraphicDelegate <NSObject>
|
||||
- (void)writeGraphicValues:(NSDictionary *)values;
|
||||
- (void)writeSpiderMesh:(NSData *)mesh linked:(BOOL)linked;
|
||||
- (void)spiderGesture:(BOOL)begin;
|
||||
- (void)graphicGesture:(BOOL)begin title:(NSString *)title;
|
||||
@end
|
||||
|
||||
@@ -497,6 +498,9 @@ NSView<DYWorkspaceMaskEditing> *DYCreateWorkspaceMaskEditor(id<PROAPIAccessing>
|
||||
BOOL _refreshing,_graphicUndoOpen,_graphicCancelled;CMTime _graphicTime;NSMutableDictionary *_graphicExpected;
|
||||
BOOL _embedded,_workspaceEditor,_unified,_measuringDefaultHeight;NSArray *_renderOrder;NSMutableDictionary *_stackViews;NSArray *_stackOrder;NSDictionary *_stackRoots;CGFloat _stackHeight,_preferredHeight,_maximumViewportHeight;
|
||||
DYSpiderPanel *_spiderPanel;
|
||||
BOOL _spiderEditing,_spiderUndoOpen,_spiderConflict;
|
||||
CMTime _spiderTime;
|
||||
DYAssetState *_spiderExpected;
|
||||
NSMutableDictionary *_assetLoads,*_assetLoadIDs;
|
||||
NSUInteger _nextAssetLoadID;
|
||||
NSProgress *_menuScan;
|
||||
@@ -595,7 +599,7 @@ NSView<DYWorkspaceMaskEditing> *DYCreateWorkspaceMaskEditor(id<PROAPIAccessing>
|
||||
DYBetaSpanEnd(beta,nil);return self;
|
||||
}
|
||||
- (void)dealloc {
|
||||
[self graphicGesture:NO title:nil];_spiderPanel.delegate=nil;[_workspace close];[_workspace release];[_workspaceButton release];[_workspaceSelectedNode release];
|
||||
[self graphicGesture:NO title:nil];_spiderPanel.delegate=nil;[self spiderGesture:NO];[_workspace close];[_workspace release];[_workspaceButton release];[_workspaceSelectedNode release];
|
||||
for(id graphic in _graphics)if([graphic isKindOfClass:DYPrimaryBalanceWheel.class])[(DYPrimaryBalanceWheel*)graphic setDelegate:nil];
|
||||
for(NSProgress *p in _assetLoads.allValues)[p cancel];[_assetLoads release];[_assetLoadIDs release];[_menuScan cancel];[_menuScan release];[_pendingAssetMenuCommand release];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];[NSWorkspace.sharedWorkspace.notificationCenter removeObserver:self];
|
||||
@@ -617,7 +621,7 @@ NSView<DYWorkspaceMaskEditing> *DYCreateWorkspaceMaskEditor(id<PROAPIAccessing>
|
||||
- (NSSize)intrinsicContentSize { return NSMakeSize(360,_preferredHeight); }
|
||||
- (void)viewDidMoveToWindow {
|
||||
[super viewDidMoveToWindow];
|
||||
if(!self.window){[self graphicGesture:NO title:nil];[self cancelAssetLoads];[_workspace close];}
|
||||
if(!self.window){[_spiderPanel finishGesture];[self graphicGesture:NO title:nil];[self cancelAssetLoads];[_workspace close];}
|
||||
if(self.window) {
|
||||
[self refresh];
|
||||
NSAccessibilityPostNotification(self,NSAccessibilityLayoutChangedNotification);
|
||||
@@ -986,7 +990,7 @@ NSView<DYWorkspaceMaskEditing> *DYCreateWorkspaceMaskEditor(id<PROAPIAccessing>
|
||||
return (roots==1&&[only isEqual:key])||[@[@"primary",@"base",@"spider"]containsObject:key];
|
||||
}
|
||||
- (void)refresh {
|
||||
if(_refreshing||!_manager)return;
|
||||
if(_refreshing||_spiderEditing||!_manager)return;
|
||||
id<FxCustomParameterActionAPI_v4> action=[self actionAPI]; if(!action)return;
|
||||
_refreshing=YES;
|
||||
uint64_t beta=DYBetaSpanBegin(@"inspector_refresh",nil);
|
||||
@@ -1142,9 +1146,56 @@ NSView<DYWorkspaceMaskEditing> *DYCreateWorkspaceMaskEditor(id<PROAPIAccessing>
|
||||
if(begin==_graphicUndoOpen)return;id<FxCustomParameterActionAPI_v4>a=[self actionAPI];if(!a)return;[a startAction:self];
|
||||
@try{id<FxUndoAPI>undo=[_manager apiForProtocol:@protocol(FxUndoAPI)];if(begin){_graphicTime=a.currentTime;_graphicCancelled=NO;[_graphicExpected release];_graphicExpected=[NSMutableDictionary new];id<FxParameterRetrievalAPI_v6>get=[_manager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];for(NSDictionary*r in _controls.allValues){NSDictionary*d=r[@"descriptor"];double value=NAN;if([get getFloatValue:&value fromParameter:[d[@"pid"]unsignedIntValue]atTime:_graphicTime]&&std::isfinite(value))_graphicExpected[d[@"key"]]=@(value);}_graphicUndoOpen=[undo startUndoGroup:title?:@"调整颜色"];}else{[undo endUndoGroup];_graphicUndoOpen=NO;_graphicCancelled=NO;[_graphicExpected removeAllObjects];}}@finally{[a endAction:self];}
|
||||
}
|
||||
- (void)writeSpiderMesh:(NSData *)mesh linked:(BOOL)linked{
|
||||
if(mesh.length&&!DYSpiderMeshIsValid(mesh))return;id<FxCustomParameterActionAPI_v4>a=[self actionAPI];if(!a)return;[a startAction:self];
|
||||
@try{DYAssetState *state=[[DYReadAssets(_manager,a.currentTime)copy]autorelease];state.spiderMesh=mesh;state.spiderLinked=linked;DYWriteAssets(_manager,state,a.currentTime);}@finally{[a endAction:self];}[self postChanged];
|
||||
- (void)spiderGesture:(BOOL)begin {
|
||||
if(begin==_spiderEditing)return;
|
||||
id<FxCustomParameterActionAPI_v4> action=[self actionAPI];
|
||||
if(begin){
|
||||
_spiderEditing=YES;
|
||||
_spiderConflict=!action;
|
||||
if(!action)return;
|
||||
[action startAction:self];
|
||||
@try{
|
||||
_spiderTime=action.currentTime;
|
||||
_spiderExpected=[DYReadAssets(_manager,_spiderTime) retain];
|
||||
_spiderUndoOpen=[[_manager apiForProtocol:@protocol(FxUndoAPI)] startUndoGroup:@"调整蜘蛛盘"];
|
||||
}@finally{[action endAction:self];}
|
||||
return;
|
||||
}
|
||||
if(_spiderUndoOpen){
|
||||
[action startAction:self];
|
||||
@try{[[_manager apiForProtocol:@protocol(FxUndoAPI)] endUndoGroup];}
|
||||
@finally{[action endAction:self];}
|
||||
}
|
||||
_spiderEditing=_spiderUndoOpen=NO;
|
||||
[_spiderExpected release];_spiderExpected=nil;
|
||||
if(_spiderPanel.delegate)[self postChanged];
|
||||
}
|
||||
- (void)writeSpiderMesh:(NSData *)mesh linked:(BOOL)linked {
|
||||
if((mesh.length&&!DYSpiderMeshIsValid(mesh))||(_spiderEditing&&_spiderConflict))return;
|
||||
id<FxCustomParameterActionAPI_v4> action=[self actionAPI];
|
||||
if(!action)return;
|
||||
BOOL written=NO;
|
||||
[action startAction:self];
|
||||
@try{
|
||||
CMTime time=action.currentTime;
|
||||
if(_spiderEditing&&(!CMTIME_IS_NUMERIC(time)||!CMTIME_IS_NUMERIC(_spiderTime)||CMTimeCompare(time,_spiderTime)!=0)){
|
||||
_spiderConflict=YES;return;
|
||||
}
|
||||
DYAssetState *old=DYReadAssets(_manager,time);
|
||||
if(_spiderEditing&&(![old.spiderMesh?:[NSData data] isEqual:_spiderExpected.spiderMesh?:[NSData data]]||old.spiderLinked!=_spiderExpected.spiderLinked)){
|
||||
_spiderConflict=YES;return;
|
||||
}
|
||||
if([old.spiderMesh?:[NSData data] isEqual:mesh?:[NSData data]]&&old.spiderLinked==linked)return;
|
||||
DYAssetState *state=[[old copy]autorelease];
|
||||
state.spiderMesh=mesh;
|
||||
state.spiderLinked=linked;
|
||||
written=DYWriteAssets(_manager,state,time);
|
||||
if(_spiderEditing){
|
||||
_spiderConflict=!written;
|
||||
if(written){[_spiderExpected release];_spiderExpected=[state retain];}
|
||||
}
|
||||
}@finally{[action endAction:self];}
|
||||
if(written&&!_spiderEditing)[self postChanged];
|
||||
}
|
||||
- (void)setSectionEnabled:(BOOL)enabled atIndex:(NSInteger)index {
|
||||
if(index<0||index>=_cards.count)return;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
@property(nonatomic,assign) id<DYGraphicDelegate> delegate;
|
||||
- (void)setMesh:(NSData *)mesh linked:(BOOL)linked;
|
||||
- (void)setScopeRenderer:(DYRenderer *)renderer;
|
||||
- (void)finishGesture;
|
||||
@end
|
||||
@implementation DYSpiderPanel {
|
||||
DYSpiderDisc *_disc; NSPopUpButton *_hues,*_saturation; NSButton *_link;
|
||||
@@ -16,8 +17,8 @@
|
||||
if((self=[super initWithFrame:frame])){
|
||||
_linked=YES;_disc=[[DYSpiderDisc alloc]initWithFrame:NSZeroRect];[self addSubview:_disc];
|
||||
__block DYSpiderPanel *owner=self;
|
||||
_disc.changed=^(DYGrade g,NSData *pins){if(owner.delegate)[owner.delegate writeSpiderMesh:owner->_disc.meshData linked:owner->_linked];};
|
||||
_disc.gesture=^(BOOL begin){[owner.delegate graphicGesture:begin title:@"调整蜘蛛盘"];};
|
||||
_disc.changed=^(NSData *mesh){[owner.delegate writeSpiderMesh:mesh linked:owner->_linked];};
|
||||
_disc.gesture=^(BOOL begin){[owner.delegate spiderGesture:begin];};
|
||||
_status=[DYLabel(@"拖动一点,同列自由点联动。⌘ 多选,Shift 固定,右键复位。",10)retain];_status.maximumNumberOfLines=2;[self addSubview:_status];
|
||||
_disc.selectionChanged=^(NSString *text){owner->_status.stringValue=text;};
|
||||
for(int axis=0;axis<2;axis++){
|
||||
@@ -32,6 +33,7 @@
|
||||
}return self;
|
||||
}
|
||||
- (void)dealloc{_disc.changed=nil;_disc.gesture=nil;_disc.selectionChanged=nil;[_disc release];[_hues release];[_saturation release];[_link release];[_status release];[super dealloc];}
|
||||
- (void)finishGesture{[_disc finishGesture];}
|
||||
- (void)setScopeRenderer:(DYRenderer *)renderer{_disc.scopeRenderer=renderer;}
|
||||
- (void)setMesh:(NSData *)data linked:(BOOL)linked{auto m=DYSpiderMesh(data);_disc.meshData=[NSData dataWithBytes:&m length:sizeof(m)];_linked=linked;[_hues selectItemWithTag:m.hues];[_saturation selectItemWithTag:m.rings+1];_link.state=linked?NSControlStateValueOn:NSControlStateValueOff;}
|
||||
- (void)layout{[super layout];CGFloat w=self.bounds.size.width;
|
||||
|
||||
+77
-31
@@ -1,7 +1,6 @@
|
||||
// Ported from dayu-colorplate; provenance in research/SpiderAndBalanceSources.json.
|
||||
#include "DYSpiderScopeDrawing.h"
|
||||
@interface DYSpiderDisc : NSView
|
||||
@property(nonatomic) DYGrade grade;
|
||||
@property(nonatomic,retain) DYRenderer *scopeRenderer;
|
||||
@property(nonatomic,copy) NSData *meshData;
|
||||
@property(nonatomic,readonly) NSInteger hueCount,saturationCount;
|
||||
@@ -9,17 +8,24 @@
|
||||
- (void)resetMesh;
|
||||
@property(nonatomic) NSInteger selected;
|
||||
@property(nonatomic,retain) NSMutableIndexSet *pinned,*selection;
|
||||
@property(nonatomic,copy) NSData *pinData;
|
||||
@property(nonatomic) BOOL interactionEnabled;
|
||||
- (void)selectRing;
|
||||
- (void)selectSpoke;
|
||||
- (void)resetSelected;
|
||||
@property(nonatomic,copy) void(^changed)(DYGrade,NSData*);
|
||||
@property(nonatomic,copy) void(^changed)(NSData*);
|
||||
@property(nonatomic,copy) void(^selectionChanged)(NSString*);
|
||||
@property(nonatomic,copy) void(^gesture)(BOOL);
|
||||
- (void)toggleLock;
|
||||
- (void)finishGesture;
|
||||
@end
|
||||
@implementation DYSpiderDisc {BOOL _dragging,_marquee,_gestureActive;NSPoint _dragOrigin,_marqueeEnd;DYGrade _dragGrade;dy::SpiderMesh _mesh,_dragMesh;BOOL _variableMesh;NSMutableIndexSet*_selectionStart,*_pinsStart;}
|
||||
@implementation DYSpiderDisc {
|
||||
BOOL _dragging,_marquee,_gestureActive,_pendingChange;
|
||||
NSPoint _dragOrigin,_marqueeEnd;
|
||||
dy::SpiderMesh _mesh,_dragMesh;
|
||||
NSMutableIndexSet *_selectionStart,*_pinsStart;
|
||||
NSData *_scopeRaster;
|
||||
NSImage *_scopeTrace;
|
||||
}
|
||||
- (void)dealloc{[self finishGesture];self.scopeRenderer=nil;[_pinned release];[_selection release];[_selectionStart release];[_pinsStart release];[_changed release];[_selectionChanged release];[_gesture release];[super dealloc];}
|
||||
- (void)setScopeRenderer:(DYRenderer *)renderer {
|
||||
if(renderer==_scopeRenderer)return;
|
||||
@@ -29,6 +35,7 @@
|
||||
[center removeObserver:self name:@"DYSpiderScopeDidChange" object:_scopeRenderer];
|
||||
}
|
||||
[_scopeRenderer release];_scopeRenderer=[renderer retain];
|
||||
DYUpdateSpiderTrace(nil,_scopeRaster,_scopeTrace);
|
||||
if(renderer){
|
||||
[center addObserver:self selector:@selector(finalOutputChanged:) name:@"DYFinalOutputDidChange" object:renderer];
|
||||
[center addObserver:self selector:@selector(spiderScopeChanged:) name:@"DYSpiderScopeDidChange" object:renderer];
|
||||
@@ -39,10 +46,10 @@
|
||||
return self.window&&!self.hiddenOrHasHiddenAncestor&&!NSIsEmptyRect(self.visibleRect);
|
||||
}
|
||||
- (void)finalOutputChanged:(NSNotification *)note {
|
||||
if([self canDisplayScope])[_scopeRenderer outputSpiderScope];
|
||||
if(!_gestureActive&&[self canDisplayScope])[_scopeRenderer outputSpiderScope];
|
||||
}
|
||||
- (void)spiderScopeChanged:(NSNotification *)note {
|
||||
if([self canDisplayScope])self.needsDisplay=YES;
|
||||
if(!_gestureActive&&[self canDisplayScope])self.needsDisplay=YES;
|
||||
}
|
||||
- (BOOL)isFlipped{return YES;}
|
||||
- (BOOL)acceptsFirstResponder{return YES;}
|
||||
@@ -52,26 +59,62 @@
|
||||
- (NSString*)accessibilityHelp{return @"拖动一点,同一色相列的自由点自动联动。固定点仍可直接拖动。Command 多选,Shift 固定,右键复位。Tab 切点,方向键微调,Escape 取消。";}
|
||||
- (id)accessibilityValue{NSInteger i=_selected>=0?_selected:(NSInteger)_selection.firstIndex;return i>=0&&i<[self nodeCount]?[NSString stringWithFormat:@"已选 %lu 点,主点 %ld,X %.4f,Y %.4f,固定点仍可拖动",(unsigned long)_selection.count,(long)i+1,_mesh.x[i],_mesh.y[i]]:@"拖动一点,周围自由点自动联动";}
|
||||
- (BOOL)accessibilityPerformPress{[self.window makeFirstResponder:self];if(!_selection.count)[_selection addIndex:0];[self describeSelection];self.needsDisplay=YES;return YES;}
|
||||
- (void)finishGesture{if(_gestureActive){_gestureActive=NO;if(_gesture)_gesture(NO);}}
|
||||
- (void)viewWillMoveToWindow:(NSWindow*)window{if(!window)[self finishGesture];[super viewWillMoveToWindow:window];}
|
||||
- (void)flushMeshChange {
|
||||
if(!_pendingChange)return;
|
||||
_pendingChange=NO;
|
||||
if(_changed)_changed(self.meshData);
|
||||
}
|
||||
- (void)finishGesture {
|
||||
if(!_gestureActive)return;
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(flushMeshChange) object:nil];
|
||||
[self flushMeshChange];
|
||||
_gestureActive=NO;
|
||||
if(_gesture)_gesture(NO);
|
||||
[self finalOutputChanged:nil];
|
||||
}
|
||||
- (void)viewWillMoveToWindow:(NSWindow*)window{
|
||||
if(!window){_dragging=_marquee=NO;[self finishGesture];}
|
||||
[super viewWillMoveToWindow:window];
|
||||
}
|
||||
- (NSInteger)nodeCount{return dy::meshCount(_mesh);}
|
||||
- (NSInteger)hueCount{return _mesh.hues;}
|
||||
- (NSInteger)saturationCount{return _mesh.rings+1;}
|
||||
- (NSData*)meshData{return _variableMesh?[NSData dataWithBytes:&_mesh length:sizeof(_mesh)]:nil;}
|
||||
- (void)setMeshData:(NSData*)data{dy::SpiderMesh m{};BOOL variable=data.length==sizeof(m);if(variable){memcpy(&m,data.bytes,sizeof(m));if(!dy::validMesh(m))return;}else m=dy::legacyMesh(_grade,(const uint8_t*)self.pinData.bytes);BOOL topology=m.hues!=_mesh.hues||m.rings!=_mesh.rings;_mesh=m;_variableMesh=variable;if(topology){_dragging=_marquee=NO;[self finishGesture];[_selection removeAllIndexes];_selected=-1;}[self updatePins];self.needsDisplay=YES;}
|
||||
- (NSData*)meshData{return [NSData dataWithBytes:&_mesh length:sizeof(_mesh)];}
|
||||
- (void)setMeshData:(NSData*)data{
|
||||
if(_gestureActive)return;
|
||||
auto mesh=DYSpiderMesh(data);
|
||||
if(!memcmp(&mesh,&_mesh,sizeof(mesh)))return;
|
||||
BOOL topology=mesh.hues!=_mesh.hues||mesh.rings!=_mesh.rings;
|
||||
_mesh=mesh;
|
||||
if(topology){_dragging=_marquee=NO;[_selection removeAllIndexes];_selected=-1;}
|
||||
[self updatePins];self.needsDisplay=YES;
|
||||
}
|
||||
- (void)updatePins{self.pinned=[NSMutableIndexSet indexSet];for(int i=0;i<[self nodeCount];i++)if(_mesh.pins[i])[_pinned addIndex:i];}
|
||||
- (NSData*)pinData{uint8_t flags[81]={};auto m=dy::resampleMesh(_mesh,16,6);for(int i=0;i<81;i++)flags[i]=m.pins[i];return [NSData dataWithBytes:flags length:81];}
|
||||
- (void)setPinData:(NSData*)data{if(!_variableMesh){const uint8_t*p=data.length==81?(const uint8_t*)data.bytes:nullptr;_mesh=dy::legacyMesh(_grade,p);[self updatePins];}self.needsDisplay=YES;}
|
||||
- (void)notifyChange{for(int i=0;i<[self nodeCount];i++)_mesh.pins[i]=dy::meshBoundary(_mesh,i)||[_pinned containsIndex:i];_grade=dy::meshLegacyGrade(_grade,_mesh);if(_changed)_changed(_grade,self.pinData);[self describeSelection];self.needsDisplay=YES;}
|
||||
- (void)changeHueCount:(int)hues saturationCount:(int)saturation{if(!_interactionEnabled||!dySpiderResolution(hues)||!dySpiderResolution(saturation))return;if(hues==_mesh.hues&&saturation==_mesh.rings+1)return;[self finishGesture];_dragging=_marquee=NO;_mesh=dy::resampleMesh(_mesh,hues,saturation);_variableMesh=YES;[_selection removeAllIndexes];_selected=-1;[self updatePins];[self notifyChange];}
|
||||
- (void)resetMesh{_mesh=dy::neutralMesh(_mesh.hues,_mesh.rings+1);_variableMesh=YES;[_selection removeAllIndexes];_selected=-1;[self updatePins];[self notifyChange];}
|
||||
- (void)moveFrom:(DYGrade)g x:(float)x y:(float)y {
|
||||
if(!_selection.count||(x==0&&y==0))return;std::bitset<dy::SpiderMeshCapacity>selected;for(int i=0;i<[self nodeCount];i++)selected[i]=[_selection containsIndex:i];
|
||||
auto start=_dragging?_dragMesh:_mesh;auto moved=dy::moveMesh(start,selected,x,y);if(!memcmp(&moved,&_mesh,sizeof(moved)))return;_mesh=moved;_grade=g;_grade.spiderEnabled=1;[self updatePins];[self notifyChange];
|
||||
- (void)notifyChange{
|
||||
for(int i=0;i<[self nodeCount];i++)_mesh.pins[i]=dy::meshBoundary(_mesh,i)||[_pinned containsIndex:i];
|
||||
self.needsDisplay=YES;
|
||||
if(!_gestureActive){
|
||||
[self describeSelection];
|
||||
if(_changed)_changed(self.meshData);
|
||||
}else if(!_pendingChange){
|
||||
// AppKit draws the local mesh immediately. Only the newest draft reaches FxPlug.
|
||||
_pendingChange=YES;
|
||||
[self performSelector:@selector(flushMeshChange) withObject:nil afterDelay:1.0/60.0 inModes:@[NSRunLoopCommonModes,NSEventTrackingRunLoopMode]];
|
||||
}
|
||||
}
|
||||
- (void)changeHueCount:(int)hues saturationCount:(int)saturation{if(!_interactionEnabled||!dySpiderResolution(hues)||!dySpiderResolution(saturation))return;if(hues==_mesh.hues&&saturation==_mesh.rings+1)return;[self finishGesture];_dragging=_marquee=NO;_mesh=dy::resampleMesh(_mesh,hues,saturation);[_selection removeAllIndexes];_selected=-1;[self updatePins];[self notifyChange];}
|
||||
- (void)resetMesh{_mesh=dy::neutralMesh(_mesh.hues,_mesh.rings+1);[_selection removeAllIndexes];_selected=-1;[self updatePins];[self notifyChange];}
|
||||
- (void)moveMeshX:(float)x y:(float)y {
|
||||
if(!_selection.count)return;
|
||||
std::bitset<dy::SpiderMeshCapacity>selected;
|
||||
for(NSUInteger i=_selection.firstIndex;i<[self nodeCount];i=[_selection indexGreaterThanIndex:i])selected[i]=1;
|
||||
auto moved=dy::moveMesh(_dragging?_dragMesh:_mesh,selected,x,y);
|
||||
if(!memcmp(&moved,&_mesh,sizeof(moved)))return;
|
||||
_mesh=moved;[self updatePins];[self notifyChange];
|
||||
}
|
||||
- (void)keyDown:(NSEvent*)e {
|
||||
if(!_interactionEnabled)return;unichar c=e.charactersIgnoringModifiers.length?[e.charactersIgnoringModifiers characterAtIndex:0]:0;
|
||||
if(c==27){if(_dragging){_grade=_dragGrade;_mesh=_dragMesh;self.pinned=[[_pinsStart mutableCopy]autorelease];[self notifyChange];}if(_marquee)self.selection=[[_selectionStart mutableCopy]autorelease];_dragging=_marquee=NO;[self finishGesture];self.needsDisplay=YES;return;}
|
||||
if(c==27){if(_dragging){_mesh=_dragMesh;self.pinned=[[_pinsStart mutableCopy]autorelease];[self notifyChange];}if(_marquee)self.selection=[[_selectionStart mutableCopy]autorelease];_dragging=_marquee=NO;[self finishGesture];self.needsDisplay=YES;return;}
|
||||
if((e.modifierFlags&NSEventModifierFlagCommand)&&c=='a'){[_selection addIndexesInRange:NSMakeRange(0,[self nodeCount])];[self describeSelection];self.needsDisplay=YES;return;}
|
||||
if(c=='\t'){_selected=(_selected+(e.modifierFlags&NSEventModifierFlagShift?[self nodeCount]-1:1)+[self nodeCount])%[self nodeCount];[_selection removeAllIndexes];[_selection addIndex:_selected];[self describeSelection];self.needsDisplay=YES;return;}
|
||||
if(c==' '){[self toggleLock];return;}if(c==NSDeleteCharacter||c==NSBackspaceCharacter){[self resetSelected];return;}
|
||||
@@ -86,30 +129,33 @@
|
||||
NSInteger lead=_selected>=0&&[_selection containsIndex:_selected]?_selected:_selection.firstIndex;
|
||||
NSRect rect=self.discRect;
|
||||
NSPoint delta=DYSpiderMeshDelta(rect,_mesh.x[lead],_mesh.y[lead],NSMakePoint(move.x*NSWidth(rect),move.y*NSHeight(rect)));
|
||||
[self moveFrom:_grade x:delta.x y:delta.y];
|
||||
[self moveMeshX:delta.x y:delta.y];
|
||||
}
|
||||
}
|
||||
- (instancetype)initWithFrame:(NSRect)r{if((self=[super initWithFrame:r])){_grade=dyDefaultGrade();_mesh=dy::legacyMesh(_grade);_selected=-1;self.pinData=nil;self.selection=[NSMutableIndexSet indexSet];_interactionEnabled=YES;self.accessibilityLabel=@"蜘蛛盘,含矢量示波器和肤色指示线";}return self;}
|
||||
- (instancetype)initWithFrame:(NSRect)r{if((self=[super initWithFrame:r])){_mesh=dy::neutralMesh();_selected=-1;[self updatePins];self.selection=[NSMutableIndexSet indexSet];_interactionEnabled=YES;self.accessibilityLabel=@"蜘蛛盘,含矢量示波器和肤色指示线";}return self;}
|
||||
- (NSRect)discRect{CGFloat s=MAX(0,MIN(self.bounds.size.width,self.bounds.size.height)-32);return NSMakeRect((self.bounds.size.width-s)/2,(self.bounds.size.height-s)/2,s,s);}
|
||||
- (NSPoint)point:(NSInteger)i{return DYSpiderPlotPoint(self.discRect,_mesh.x[i],_mesh.y[i]);}
|
||||
- (void)setGrade:(DYGrade)g{if(memcmp(g.spiderX,_grade.spiderX,sizeof(g.spiderX))||memcmp(g.spiderY,_grade.spiderY,sizeof(g.spiderY))){_grade=g;self.meshData=nil;}else _grade=g;self.needsDisplay=YES;}
|
||||
- (void)drawRect:(NSRect)dirty{
|
||||
NSRect r=self.discRect;if(NSIsEmptyRect(r))return;
|
||||
DYDrawSpiderScope(r,[self canDisplayScope]?[_scopeRenderer outputSpiderScope]:nil,1);
|
||||
if(!_gestureActive&&[self canDisplayScope])DYUpdateSpiderTrace([_scopeRenderer outputSpiderScope],_scopeRaster,_scopeTrace);
|
||||
DYDrawSpiderScope(r,_scopeTrace,1);
|
||||
NSPoint points[dy::SpiderMeshCapacity];
|
||||
int count=dy::meshCount(_mesh);
|
||||
for(int i=0;i<count;i++)points[i]=DYSpiderPlotPoint(r,_mesh.x[i],_mesh.y[i]);
|
||||
NSBezierPath *net=[NSBezierPath bezierPath];
|
||||
for(int ring=1;ring<=_mesh.rings;ring++){
|
||||
for(int hue=0;hue<=_mesh.hues;hue++){
|
||||
NSPoint q=[self point:dy::meshIndex(_mesh,hue%_mesh.hues,ring)];
|
||||
NSPoint q=points[dy::meshIndex(_mesh,hue%_mesh.hues,ring)];
|
||||
if(hue==0)[net moveToPoint:q];else[net lineToPoint:q];
|
||||
}
|
||||
}
|
||||
for(int hue=0;hue<_mesh.hues;hue++){
|
||||
[net moveToPoint:[self point:[self nodeCount]-1]];
|
||||
for(int ring=1;ring<=_mesh.rings;ring++)[net lineToPoint:[self point:dy::meshIndex(_mesh,hue,ring)]];
|
||||
[net moveToPoint:points[count-1]];
|
||||
for(int ring=1;ring<=_mesh.rings;ring++)[net lineToPoint:points[dy::meshIndex(_mesh,hue,ring)]];
|
||||
}
|
||||
DYDrawSpiderNet(net,1);
|
||||
for(int i=0;i<[self nodeCount];i++)
|
||||
DYDrawSpiderNode([self point:i],1,[_selection containsIndex:i]?DYAccent():nil,[_pinned containsIndex:i]);
|
||||
for(int i=0;i<count;i++)
|
||||
DYDrawSpiderNode(points[i],1,[_selection containsIndex:i]?DYAccent():nil,[_pinned containsIndex:i]);
|
||||
if(_marquee){
|
||||
NSRect box=NSMakeRect(MIN(_dragOrigin.x,_marqueeEnd.x),MIN(_dragOrigin.y,_marqueeEnd.y),fabs(_dragOrigin.x-_marqueeEnd.x),fabs(_dragOrigin.y-_marqueeEnd.y));
|
||||
NSBezierPath*outline=[NSBezierPath bezierPathWithRect:box];outline.lineWidth=1.25;
|
||||
@@ -125,7 +171,7 @@
|
||||
- (void)rightMouseDown:(NSEvent*)e{if(!_interactionEnabled)return;NSInteger i=[self hitPoint:[self convertPoint:e.locationInWindow fromView:nil]];if(i<0)return;_selected=i;[_selection removeAllIndexes];[_selection addIndex:i];[self resetSelected];[_selection removeAllIndexes];[self describeSelection];}
|
||||
- (void)mouseDown:(NSEvent*)e {
|
||||
if(!_interactionEnabled)return;[self.window makeFirstResponder:self];NSPoint p=[self convertPoint:e.locationInWindow fromView:nil];NSInteger chosen=[self hitPoint:p];
|
||||
_dragOrigin=_marqueeEnd=p;_dragGrade=_grade;_dragMesh=_mesh;[_selectionStart release];_selectionStart=[_selection mutableCopy];[_pinsStart release];_pinsStart=[_pinned mutableCopy];_dragging=_marquee=NO;_selected=chosen;
|
||||
_dragOrigin=_marqueeEnd=p;_dragMesh=_mesh;[_selectionStart release];_selectionStart=[_selection mutableCopy];[_pinsStart release];_pinsStart=[_pinned mutableCopy];_dragging=_marquee=NO;_selected=chosen;
|
||||
BOOL additive=(e.modifierFlags&NSEventModifierFlagCommand)!=0;
|
||||
if(chosen>=0&&(e.modifierFlags&NSEventModifierFlagShift)){[_pinned addIndex:chosen];[self notifyChange];return;}
|
||||
if(chosen<0){_marquee=YES;if(!additive)[_selection removeAllIndexes];if(!additive)[_selectionStart removeAllIndexes];}
|
||||
@@ -137,8 +183,8 @@
|
||||
if(!_interactionEnabled)return;NSPoint p=[self convertPoint:e.locationInWindow fromView:nil];
|
||||
if(_marquee){_marqueeEnd=p;NSRect box=NSMakeRect(MIN(_dragOrigin.x,p.x),MIN(_dragOrigin.y,p.y),fabs(p.x-_dragOrigin.x),fabs(p.y-_dragOrigin.y));self.selection=[[_selectionStart mutableCopy]autorelease];for(int i=0;i<[self nodeCount];i++)if(NSPointInRect([self point:i],box))[_selection addIndex:i];[self describeSelection];self.needsDisplay=YES;}
|
||||
else if(_dragging){if(!_gestureActive){_gestureActive=YES;if(_gesture)_gesture(YES);}NSPoint delta=DYSpiderMeshDelta(self.discRect,_dragMesh.x[_selected],_dragMesh.y[_selected],
|
||||
NSMakePoint(p.x-_dragOrigin.x,p.y-_dragOrigin.y));[self moveFrom:_dragGrade x:delta.x y:delta.y];}
|
||||
NSMakePoint(p.x-_dragOrigin.x,p.y-_dragOrigin.y));[self moveMeshX:delta.x y:delta.y];}
|
||||
}
|
||||
- (void)mouseUp:(NSEvent*)e{_dragging=_marquee=NO;[self finishGesture];self.needsDisplay=YES;}
|
||||
- (void)mouseUp:(NSEvent*)e{if(_dragging&&_gestureActive)[self mouseDragged:e];_dragging=_marquee=NO;[self finishGesture];self.needsDisplay=YES;}
|
||||
@end
|
||||
|
||||
@@ -68,28 +68,28 @@ static inline void DYDrawSpiderWheel(NSRect rect) {
|
||||
fraction:1 respectFlipped:YES hints:nil];
|
||||
}
|
||||
|
||||
static inline void DYDrawSpiderTrace(NSRect rect, NSData *raster) {
|
||||
// Keep the immutable scope image while only the control geometry is changing.
|
||||
static inline void DYUpdateSpiderTrace(NSData *raster,NSData *&cachedRaster,NSImage *&cachedImage) {
|
||||
if(raster==cachedRaster)return;
|
||||
[cachedRaster release];cachedRaster=[raster retain];
|
||||
[cachedImage release];cachedImage=nil;
|
||||
constexpr size_t side=dyscope::Bins;
|
||||
if(raster.length!=side*side*4)return;
|
||||
CGDataProviderRef provider=CGDataProviderCreateWithCFData((CFDataRef)raster);
|
||||
CGColorSpaceRef space=CGColorSpaceCreateDeviceRGB();
|
||||
CGImageRef image=CGImageCreate(side,side,8,32,side*4,space,kCGImageAlphaPremultipliedLast,
|
||||
provider,nullptr,false,kCGRenderingIntentDefault);
|
||||
if(image){
|
||||
NSImage *trace=[[[NSImage alloc]initWithCGImage:image size:NSZeroSize]autorelease];
|
||||
[trace drawInRect:rect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver
|
||||
fraction:1 respectFlipped:YES hints:@{NSImageHintInterpolation:@(NSImageInterpolationLow)}];
|
||||
CGImageRelease(image);
|
||||
}
|
||||
if(image){cachedImage=[[NSImage alloc]initWithCGImage:image size:NSZeroSize];CGImageRelease(image);}
|
||||
CGColorSpaceRelease(space);CGDataProviderRelease(provider);
|
||||
}
|
||||
|
||||
static inline void DYDrawSpiderScope(NSRect rect,NSData *raster,CGFloat scale) {
|
||||
static inline void DYDrawSpiderScope(NSRect rect,NSImage *trace,CGFloat scale) {
|
||||
if(NSIsEmptyRect(rect))return;
|
||||
[NSGraphicsContext saveGraphicsState];
|
||||
[[NSBezierPath bezierPathWithOvalInRect:rect]addClip];
|
||||
DYDrawSpiderWheel(rect);
|
||||
DYDrawSpiderTrace(rect,raster);
|
||||
[trace drawInRect:rect fromRect:NSZeroRect operation:NSCompositingOperationSourceOver
|
||||
fraction:1 respectFlipped:YES hints:@{NSImageHintInterpolation:@(NSImageInterpolationLow)}];
|
||||
|
||||
NSBezierPath *line=[NSBezierPath bezierPath];
|
||||
[line moveToPoint:DYSkinScopePoint(rect,.08)];
|
||||
|
||||
@@ -62,7 +62,8 @@
|
||||
}
|
||||
if([area[@"kind"]isEqual:@"spiderPlot"]){
|
||||
auto mesh=DYSpiderMesh([self spiderData]);
|
||||
DYDrawSpiderScope(r,[_bridge canvasSpiderScopeAtTime:_time],s);
|
||||
DYUpdateSpiderTrace([_bridge canvasSpiderScopeAtTime:_time],_spiderScopeRaster,_spiderScopeTrace);
|
||||
DYDrawSpiderScope(r,_spiderScopeTrace,s);
|
||||
auto point=[&](int i){return DYSpiderPlotPoint(r,mesh.x[i],mesh.y[i]);};
|
||||
NSBezierPath *net=[NSBezierPath bezierPath];
|
||||
for(int ring=1;ring<=mesh.rings;ring++)for(int hue=0;hue<=mesh.hues;hue++){NSPoint q=point(dy::meshIndex(mesh,hue%mesh.hues,ring));if(hue==0)[net moveToPoint:q];else[net lineToPoint:q];}
|
||||
|
||||
@@ -68,7 +68,8 @@ static BOOL DYViewerSanitizeValue(NSDictionary *d,double input,double *output) {
|
||||
NSDictionary *_snapshot,*_sourceDocument;NSString *_selectedNode;
|
||||
CMTime _snapshotTime;
|
||||
BOOL _invalidated,_validationScheduled;
|
||||
uint64_t _requestSequence,_requestedGesture,_completedGesture;
|
||||
uint64_t _requestSequence,_requestedGesture,_completedGesture,_pendingSpiderGesture;
|
||||
NSData *_pendingSpiderMesh;
|
||||
|
||||
// The fields below are confined to the main queue.
|
||||
id<PROAPIAccessing> _writerHost,_writerTarget;
|
||||
@@ -88,7 +89,7 @@ static BOOL DYViewerSanitizeValue(NSDictionary *d,double input,double *output) {
|
||||
// the queued block keeps the bridge alive until its host group is closed.
|
||||
NSCAssert(!_writerUndoOpen,@"Viewer parameter group must be closed before teardown");
|
||||
[NSNotificationCenter.defaultCenter removeObserver:self];[_renderer release];[_selectedNode release];[_snapshot release];[_sourceDocument release];[_writerHost release];[_writerTarget release];
|
||||
[_writerDescriptors release];[_writerLastValues release];[_writerCompanions release];[_writerNode release];[_writerType release];[super dealloc];
|
||||
[_writerDescriptors release];[_writerLastValues release];[_writerCompanions release];[_writerNode release];[_writerType release];[_pendingSpiderMesh release];[super dealloc];
|
||||
}
|
||||
- (void)publishAssets:(DYAssetState*)assets atTime:(CMTime)time {
|
||||
@synchronized(self){if(_invalidated||!_snapshot||CMTimeCompare(time,_snapshotTime)!=0)return;NSMutableDictionary *next=[[_snapshot mutableCopy]autorelease];next[@"spider"]=assets.spiderMesh?:[NSData data];[_snapshot release];_snapshot=[next copy];}
|
||||
@@ -307,27 +308,47 @@ static BOOL DYViewerSanitizeValue(NSDictionary *d,double input,double *output) {
|
||||
if(!descriptor)return;[self beginParameter:descriptor node:node value:enabled atTime:time];uint64_t gesture;@synchronized(self){gesture=_requestedGesture;}NSData *original=[mesh copy]?:[NSData new];
|
||||
dispatch_async(dispatch_get_main_queue(),^{if(self->_writerGesture==gesture&&[self->_writerType isEqual:@"spider"]){self->_writerSpider=YES;self->_writerLastMesh=[original copy];if(![self writerStillValid])[self closeWriter];}});[original release];
|
||||
}
|
||||
- (void)changeSpider:(NSData*)mesh {
|
||||
if(!DYSpiderMeshIsValid(mesh))return;NSData *frozen=[mesh copy];uint64_t gesture;@synchronized(self){gesture=_invalidated?0:_requestedGesture;}
|
||||
if(gesture)dispatch_async(dispatch_get_main_queue(),^{
|
||||
if(self->_writerGesture!=gesture||!self->_writerSpider)return;
|
||||
if(![self writerStillValid]){[self closeWriter];return;}
|
||||
if([frozen isEqual:self->_writerLastMesh])return;
|
||||
id<FxCustomParameterActionAPI_v4>a=[self->_writerTarget apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];BOOL changed=NO,failed=NO;
|
||||
[a startAction:self];@try{
|
||||
if(!CMTIME_IS_NUMERIC(a.currentTime)||CMTimeCompare(DYHostDisplayedFrameTime(self->_writerHost,a.currentTime),self->_writerTime)!=0||![self writerValueMatches]){failed=YES;}
|
||||
else{
|
||||
if(!self->_writerUndoOpen)self->_writerUndoOpen=[[self->_writerHost apiForProtocol:@protocol(FxUndoAPI)]startUndoGroup:@"画面调整 · 蜘蛛盘"];
|
||||
if(self->_writerUndoOpen){DYAssetState *old=DYReadAssets(self->_writerTarget,self->_writerTime);DYAssetState *next=[[old copy]autorelease];next.spiderMesh=frozen;
|
||||
failed=!DYWriteAssets(self->_writerTarget,next,self->_writerTime);
|
||||
if(failed)DYWriteAssets(self->_writerTarget,old,self->_writerTime);else changed=YES;
|
||||
}
|
||||
- (void)flushSpiderGesture:(uint64_t)gesture {
|
||||
NSData *mesh=nil;
|
||||
@synchronized(self){
|
||||
if(_invalidated||_pendingSpiderGesture!=gesture)return;
|
||||
mesh=[_pendingSpiderMesh autorelease];_pendingSpiderMesh=nil;_pendingSpiderGesture=0;
|
||||
}
|
||||
if(_writerGesture!=gesture||!_writerSpider||[mesh isEqual:_writerLastMesh])return;
|
||||
id<FxCustomParameterActionAPI_v4>a=[_writerTarget apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];
|
||||
if(!a){[self closeWriter];return;}
|
||||
BOOL changed=NO,failed=NO;
|
||||
[a startAction:self];@try{
|
||||
if(!CMTIME_IS_NUMERIC(a.currentTime)||CMTimeCompare(DYHostDisplayedFrameTime(_writerHost,a.currentTime),_writerTime)!=0||![self writerValueMatches]){failed=YES;}
|
||||
else{
|
||||
if(!_writerUndoOpen)_writerUndoOpen=[[_writerHost apiForProtocol:@protocol(FxUndoAPI)]startUndoGroup:@"画面调整 · 蜘蛛盘"];
|
||||
if(_writerUndoOpen){
|
||||
DYAssetState *old=DYReadAssets(_writerTarget,_writerTime);DYAssetState *next=[[old copy]autorelease];next.spiderMesh=mesh;
|
||||
failed=!DYWriteAssets(_writerTarget,next,_writerTime);
|
||||
if(failed)DYWriteAssets(_writerTarget,old,_writerTime);else changed=YES;
|
||||
}
|
||||
}@finally{[a endAction:self];}
|
||||
// Re-read after DYToolManager commits its document at the outer boundary.
|
||||
if(changed){[a startAction:self];NSData *actual=nil;@try{actual=[DYReadAssets(self->_writerTarget,self->_writerTime).spiderMesh retain];}@finally{[a endAction:self];}BOOL saved=[actual isEqual:frozen];[actual release];if(!saved)failed=YES;else{[self->_writerLastMesh release];self->_writerLastMesh=[frozen copy];[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];}}
|
||||
if(failed)[self closeWriter];
|
||||
});[frozen release];
|
||||
}
|
||||
}@finally{[a endAction:self];}
|
||||
// Re-read after DYToolManager commits its document at the outer boundary.
|
||||
if(changed){
|
||||
[a startAction:self];NSData *actual=nil;
|
||||
@try{actual=[DYReadAssets(_writerTarget,_writerTime).spiderMesh retain];}@finally{[a endAction:self];}
|
||||
BOOL saved=[actual isEqual:mesh];[actual release];
|
||||
if(!saved)failed=YES;
|
||||
else{[_writerLastMesh release];_writerLastMesh=[mesh copy];[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_apiManager];}
|
||||
}
|
||||
if(failed)[self closeWriter];
|
||||
}
|
||||
- (void)changeSpider:(NSData*)mesh {
|
||||
if(!DYSpiderMeshIsValid(mesh))return;
|
||||
@synchronized(self){
|
||||
if(_invalidated||!_requestedGesture)return;
|
||||
uint64_t gesture=_requestedGesture;
|
||||
[_pendingSpiderMesh release];_pendingSpiderMesh=[mesh copy];
|
||||
if(_pendingSpiderGesture==gesture)return;
|
||||
_pendingSpiderGesture=gesture;
|
||||
dispatch_async(dispatch_get_main_queue(),^{[self flushSpiderGesture:gesture];});
|
||||
}
|
||||
}
|
||||
- (void)writeValues:(NSDictionary<NSString*,NSNumber*>*)values gesture:(uint64_t)gesture {
|
||||
NSCAssert(NSThread.isMainThread,@"Host writes require the main queue");
|
||||
@@ -464,7 +485,7 @@ static BOOL DYViewerSanitizeValue(NSDictionary *d,double input,double *output) {
|
||||
@synchronized(self){return !_invalidated&&gesture>_completedGesture;}
|
||||
}
|
||||
- (void)invalidate {
|
||||
@synchronized(self){if(_invalidated)return;_invalidated=YES;_requestedGesture=0;_apiManager=nil;}
|
||||
@synchronized(self){if(_invalidated)return;_invalidated=YES;_requestedGesture=0;_pendingSpiderGesture=0;[_pendingSpiderMesh release];_pendingSpiderMesh=nil;_apiManager=nil;}
|
||||
dispatch_async(dispatch_get_main_queue(),^{[self closeWriter];});
|
||||
}
|
||||
@end
|
||||
@@ -21,11 +21,12 @@
|
||||
NSString *_nodeID,*_toolType,*_selectedX;NSMutableDictionary *_draftValues;NSInteger _channel,_hslAxis,_selectedSpider;NSData *_spiderDraft;BOOL _graphMode,_visible;NSSize _size;NSRect _panel,_viewport;BOOL _hasViewport;CGFloat _scale;BOOL _open,_catalog,_dragging,_hasDraft,_positioned,_movingPanel;NSPoint _position,_panelStart;
|
||||
NSInteger _page,_catalogPage,_capacity,_catalogCapacity,_hover,_pressed;NSPoint _down;NSDictionary *_captured;
|
||||
double _draftValue,_downValue;CGFloat _knobOffset;CMTime _time,_downTime;
|
||||
NSData *_spiderScopeRaster;NSImage *_spiderScopeTrace;
|
||||
NSDictionary *_releasedCurveValues;uint64_t _curveCommit;CMTime _curveCommitTime;
|
||||
}
|
||||
@synthesize bridge=_bridge,toolType=_toolType,visible=_visible;
|
||||
- (instancetype)init{if((self=[super init])){_areas=[NSMutableArray new];_nodeID=[@"base:base" copy];_scale=1;_open=YES;_visible=YES;_graphMode=YES;_selectedSpider=-1;_draftValues=[NSMutableDictionary new];_time=_downTime=kCMTimeInvalid;}return self;}
|
||||
- (void)dealloc{if(_pressed)[_bridge endGesture];[_bridge release];[_spiderDraft release];[_snapshot release];[_nodes release];[_rows release];[_areas release];[_nodeID release];[_toolType release];[_selectedX release];[_draftValues release];[_releasedCurveValues release];[_captured release];[super dealloc];}
|
||||
- (void)dealloc{if(_pressed)[_bridge endGesture];[_bridge release];[_spiderDraft release];[_spiderScopeRaster release];[_spiderScopeTrace release];[_snapshot release];[_nodes release];[_rows release];[_areas release];[_nodeID release];[_toolType release];[_selectedX release];[_draftValues release];[_releasedCurveValues release];[_captured release];[super dealloc];}
|
||||
- (void)clearReleasedCurve{[_releasedCurveValues release];_releasedCurveValues=nil;_curveCommit=0;}
|
||||
- (void)finishCurveWithValues:(NSDictionary*)values{
|
||||
[self clearReleasedCurve];
|
||||
|
||||
+2
-2
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.21.6</string>
|
||||
<string>1.21.7</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>124</string>
|
||||
<string>125</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>PlugInKit</key>
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.21.6</string>
|
||||
<string>1.21.7</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>124</string>
|
||||
<string>125</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
更新于 2026-11-08(Asia/Shanghai)。这是新对话的接手入口。历史设计和实现细节按需查阅专项交接,复现和交付证据以对应版本的报告为准。
|
||||
|
||||
## 1.21.7(125)蜘蛛盘跟手优化
|
||||
|
||||
2026-11-09。仅分析 Color Finale 2.17.0(632)的 Color Warper。核对了本地网格编辑、位图复用、独立取样、当前节点读数更新和 GPU 查表路径。大鱼移植本地草稿与重活分离的方式,合并检查器/工作台拖动写入,松手补交最终位置并关闭撤销组。画布合并待处理网格,检查外部修改和目标时间。现有蜘蛛盘数学和预设数据结构继续使用。[取证与实现](research/ColorFinaleSpiderFluidity-20261109.md)
|
||||
|
||||
本检查点已完成代码与定向回归,正式构建、公证、FCP 验收和发行核验待执行。接手先使用唯一正式路径,并对照同一组拖动事件的本地写入量和最终网格。站点文章和主 APP 更新通道基线为 1.21.6(124)。
|
||||
|
||||
## 1.21.6(124)LUT 预览复用
|
||||
|
||||
2026-11-08。缩略图与右侧划像共用当前画质下的同一张 LUT 位图。点击已生成的缩略图后,等待宿主确认应用,划像左侧保留原图,右侧直接使用该缩略图。浏览器忽略参数更新期间的空快照,同一播放头位置沿用点选前的取样,避免某些色彩管理路径把新应用的 LUT 带入下一轮预览。移到新帧时后台生成新图,生成期间保留上一次完整画面。
|
||||
|
||||
在新工单中引用
屏蔽一个用户