diff --git a/大鱼调色/Plugin/DYLUTBrowser.mm b/大鱼调色/Plugin/DYLUTBrowser.mm index e27c112..3a7a8b3 100644 --- a/大鱼调色/Plugin/DYLUTBrowser.mm +++ b/大鱼调色/Plugin/DYLUTBrowser.mm @@ -21,6 +21,41 @@ static NSString *const DYBrowserSidebarPreference=@"com.dayu.color.lookLUTPrevie static NSString *const DYBrowserRecentFolder=@"@recent"; static NSString *DYBrowserPreference(NSString *key,DYLUTLibrary *library){return [NSString stringWithFormat:@"%@|%@",key,library.rootURL.path];} +// Opt-in, local-only geometry samples. No LUT names, paths or image data. +static void DYBrowserGeometrySample(NSView *root,NSString *phase){ + if(![NSUserDefaults.standardUserDefaults boolForKey:@"DYBrowserGeometryDiagnostics"]||!root)return; + NSMutableArray *views=[NSMutableArray array]; + for(NSView *view=root;view&&views.count<8;view=view.superview){ + NSMutableDictionary *sample=[NSMutableDictionary dictionaryWithDictionary:@{ + @"class":NSStringFromClass(view.class),@"frame":NSStringFromRect(view.frame),@"bounds":NSStringFromRect(view.bounds), + @"visibleRect":NSStringFromRect(view.visibleRect),@"windowRect":NSStringFromRect([view convertRect:view.bounds toView:nil]), + @"flipped":@(view.flipped),@"autoresizesSubviews":@(view.autoresizesSubviews),@"autoresizingMask":@(view.autoresizingMask), + @"frameRotation":@(view.frameRotation),@"boundsRotation":@(view.boundsRotation),@"wantsLayer":@(view.wantsLayer)}]; + if(view.layer){CALayer *layer=view.layer;CATransform3D t=layer.transform;sample[@"layer"]=@{ + @"frame":NSStringFromRect(NSRectFromCGRect(layer.frame)),@"bounds":NSStringFromRect(NSRectFromCGRect(layer.bounds)), + @"position":NSStringFromPoint(NSPointFromCGPoint(layer.position)),@"anchorPoint":NSStringFromPoint(NSPointFromCGPoint(layer.anchorPoint)), + @"contentsScale":@(layer.contentsScale),@"geometryFlipped":@(layer.geometryFlipped), + @"transform":@[@(t.m11),@(t.m12),@(t.m21),@(t.m22),@(t.m41),@(t.m42)]};} + [views addObject:sample]; + } + NSMutableDictionary *record=[NSMutableDictionary dictionaryWithDictionary:@{@"phase":phase,@"time":@(NSDate.timeIntervalSinceReferenceDate),@"views":views}]; + NSWindow *window=root.window; + if(window){record[@"window"]=@{@"class":NSStringFromClass(window.class),@"frame":NSStringFromRect(window.frame), + @"contentFrame":NSStringFromRect(window.contentView.frame),@"contentBounds":NSStringFromRect(window.contentView.bounds), + @"contentLayoutRect":NSStringFromRect(window.contentLayoutRect),@"backingScaleFactor":@(window.backingScaleFactor), + @"screenRect":NSStringFromRect([window convertRectToScreen:[root convertRect:root.bounds toView:nil]])};} + NSMutableArray *screens=[NSMutableArray array]; + for(NSScreen *screen in NSScreen.screens)[screens addObject:@{@"frame":NSStringFromRect(screen.frame),@"visibleFrame":NSStringFromRect(screen.visibleFrame),@"backingScaleFactor":@(screen.backingScaleFactor)}]; + record[@"screens"]=screens; + NSString *logs=[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,NSUserDomainMask,YES).firstObject stringByAppendingPathComponent:@"Logs/大鱼调色"]; + [NSFileManager.defaultManager createDirectoryAtPath:logs withIntermediateDirectories:YES attributes:nil error:nil]; + NSString *path=[logs stringByAppendingPathComponent:[NSString stringWithFormat:@"BrowserGeometry-%d.jsonl",NSProcessInfo.processInfo.processIdentifier]]; + NSData *json=[NSJSONSerialization dataWithJSONObject:record options:0 error:nil];if(!json)return; + if(![NSFileManager.defaultManager fileExistsAtPath:path])[NSFileManager.defaultManager createFileAtPath:path contents:nil attributes:nil]; + NSFileHandle *file=[NSFileHandle fileHandleForWritingAtPath:path]; + @try{if([file seekToEndOfFile]<1024*1024){[file writeData:json];[file writeData:[@"\n" dataUsingEncoding:NSUTF8StringEncoding]];}}@finally{[file closeFile];} +} + @interface DYBrowserCanvas : NSView @property(copy) NSDictionary *palette; @property(copy) NSString *fillKey; @@ -230,8 +265,10 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b parent.postsFrameChangedNotifications=YES;parent.postsBoundsChangedNotifications=YES; for(NSNotificationName name in @[NSViewFrameDidChangeNotification,NSViewBoundsDidChangeNotification])[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(remoteParentGeometryChanged:) name:name object:parent]; [parent addSubview:_root];[self layoutBrowser];[_root setNeedsDisplay:YES]; + DYBrowserGeometrySample(_root,@"attached-before-sdk-reply"); // Attach synchronously: the SDK reads the first child before reply returns. - dispatch_async(dispatch_get_main_queue(),^{if(!_closed)[self configurePresentationWindow];}); + dispatch_async(dispatch_get_main_queue(),^{if(!_closed){[self configurePresentationWindow];DYBrowserGeometrySample(_root,@"after-sdk-reply");}}); + if([NSUserDefaults.standardUserDefaults boolForKey:@"DYBrowserGeometryDiagnostics"])dispatch_after(dispatch_time(DISPATCH_TIME_NOW,NSEC_PER_SEC),dispatch_get_main_queue(),^{if(!_closed)DYBrowserGeometrySample(_root,@"settled");}); NSAccessibilityPostNotification(parent,NSAccessibilityLayoutChangedNotification); } - (void)fitRemoteParent{ @@ -241,6 +278,7 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b } - (void)remoteParentGeometryChanged:(NSNotification *)notification{ if(notification.object==_root.superview)[self fitRemoteParent]; + DYBrowserGeometrySample(_root,notification.name); } - (void)configurePresentationWindow{ NSWindow *window=_root.window;if(!window||window==self.window)return; diff --git a/大鱼调色/Plugin/Info.plist b/大鱼调色/Plugin/Info.plist index ed80f4a..30f10a5 100644 --- a/大鱼调色/Plugin/Info.plist +++ b/大鱼调色/Plugin/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 1.7.2 + 1.7.3 CFBundleVersion - 47 + 48 NSHumanReadableCopyright PlugInKit @@ -71,7 +71,7 @@ uuid 1C17B73B-F229-4C09-A434-EAF6DFF5F22A version - 1.7.2 + 1.7.3 className diff --git a/大鱼调色/Wrapper Application/Info.plist b/大鱼调色/Wrapper Application/Info.plist index f5263e8..aa2e25e 100644 --- a/大鱼调色/Wrapper Application/Info.plist +++ b/大鱼调色/Wrapper Application/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.7.2 + 1.7.3 CFBundleVersion - 47 + 48 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright