fix: identify inspector LUT requests by generation and clarify import cancellation
这个提交包含在:
1 父节点
ddcaa821be
当前提交
875add7adf
2 个文件已更改
+13
-12
没有与搜索条件相匹配的文件
+11
-10
@@ -387,7 +387,8 @@ static NSImage *DYWheelImage(void) {
|
||||
NSMutableDictionary *_tabs;
|
||||
NSInteger _visibleLooks;
|
||||
BOOL _refreshing;
|
||||
NSMutableDictionary *_assetLoads;
|
||||
NSMutableDictionary *_assetLoads,*_assetLoadIDs;
|
||||
NSUInteger _nextAssetLoadID;
|
||||
NSProgress *_menuScan;
|
||||
}
|
||||
@end
|
||||
@@ -398,7 +399,7 @@ static NSImage *DYWheelImage(void) {
|
||||
}
|
||||
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager renderer:(DYRenderer *)renderer {
|
||||
if((self=[super initWithFrame:NSMakeRect(0,0,360,780)])) {
|
||||
_assetLoads=[NSMutableDictionary new];_manager=manager; _renderer=[renderer retain];_library=[DYLUTLibrary new];_tabs=[NSMutableDictionary new];_visibleLooks=1;
|
||||
_assetLoads=[NSMutableDictionary new];_assetLoadIDs=[NSMutableDictionary new];_manager=manager; _renderer=[renderer retain];_library=[DYLUTLibrary new];_tabs=[NSMutableDictionary new];_visibleLooks=1;
|
||||
_sections=[DYPresentationSections() copy];
|
||||
_cards=[[NSMutableArray alloc] init]; _controls=[[NSMutableDictionary alloc] init];
|
||||
_assetButtons=[[NSMutableDictionary alloc] init]; _graphics=[[NSMutableArray alloc] init];
|
||||
@@ -439,7 +440,7 @@ static NSImage *DYWheelImage(void) {
|
||||
return self;
|
||||
}
|
||||
- (void)dealloc {
|
||||
for(NSProgress *p in _assetLoads.allValues)[p cancel];[_assetLoads release];[_menuScan cancel];[_menuScan release];
|
||||
for(NSProgress *p in _assetLoads.allValues)[p cancel];[_assetLoads release];[_assetLoadIDs release];[_menuScan cancel];[_menuScan release];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[_brand release]; [_subtitle release]; [_resetAll release]; [_save release]; [_load release]; [_export release];
|
||||
[_scroll release]; [_document release]; [_sections release]; [_cards release]; [_controls release]; [_assetButtons release]; [_graphics release]; [_sampler release];
|
||||
@@ -455,7 +456,7 @@ static NSImage *DYWheelImage(void) {
|
||||
- (NSSize)intrinsicContentSize { return NSMakeSize(360,780); }
|
||||
- (void)viewDidMoveToWindow {
|
||||
[super viewDidMoveToWindow];
|
||||
if(!self.window){for(NSProgress *p in _assetLoads.allValues)[p cancel];[_assetLoads removeAllObjects];}
|
||||
if(!self.window)[self cancelAssetLoads];
|
||||
if(self.window) {
|
||||
[self refresh];
|
||||
NSAccessibilityPostNotification(self,NSAccessibilityLayoutChangedNotification);
|
||||
@@ -873,17 +874,17 @@ static NSImage *DYWheelImage(void) {
|
||||
}
|
||||
- (void)removeAsset:(NSButton *)sender { [self setAssetPath:nil forKey:sender.identifier]; }
|
||||
- (void)setAssetPath:(NSString *)path forKey:(NSString *)key {
|
||||
[_assetLoads[key]cancel];[_assetLoads removeObjectForKey:key];
|
||||
[_assetLoads[key]cancel];[_assetLoads removeObjectForKey:key];[_assetLoadIDs removeObjectForKey:key];
|
||||
if(!path.length){[self commitAssetPath:nil forKey:key];return;}
|
||||
__block NSProgress *task=nil;
|
||||
task=DYLUTPrepareAsync(path,^(NSError *error){
|
||||
if(_assetLoads[key]!=task||!self.window)return;[_assetLoads removeObjectForKey:key];
|
||||
if(error){[self refresh];[_assetButtons[key][@"choose"]setToolTip:error.localizedDescription];return;}
|
||||
NSUInteger requestID=++_nextAssetLoadID;_assetLoadIDs[key]=@(requestID);
|
||||
NSProgress *task=DYLUTPrepareAsync(path,^(NSError *error){
|
||||
if([_assetLoadIDs[key]unsignedIntegerValue]!=requestID||!self.window)return;[_assetLoads removeObjectForKey:key];[_assetLoadIDs removeObjectForKey:key];
|
||||
if(error){[self refresh];[_assetButtons[key][@"choose"]setTitle:@"载入失败"];[_assetButtons[key][@"choose"]setToolTip:error.localizedDescription];return;}
|
||||
[self commitAssetPath:path forKey:key];
|
||||
});_assetLoads[key]=task;[_assetButtons[key][@"choose"]setTitle:@"正在载入…"];
|
||||
}
|
||||
- (void)cancelAssetLoads {
|
||||
for(NSProgress *p in _assetLoads.allValues)[p cancel];[_assetLoads removeAllObjects];
|
||||
for(NSProgress *p in _assetLoads.allValues)[p cancel];[_assetLoads removeAllObjects];[_assetLoadIDs removeAllObjects];
|
||||
}
|
||||
- (void)commitAssetPath:(NSString *)path forKey:(NSString *)key {
|
||||
id<FxCustomParameterActionAPI_v4> action=[self actionAPI];if(!action)return;
|
||||
|
||||
@@ -316,13 +316,13 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
|
||||
_statusLabel.toolTip=_libraryTask.localizedAdditionalDescription?:_statusLabel.stringValue;
|
||||
}
|
||||
- (void)beginLibraryTask:(NSProgress *)task {
|
||||
[_libraryTask release];_libraryTask=[task retain];_importFiles.enabled=NO;_importFolder.enabled=NO;_refresh.title=@"取消";
|
||||
[_libraryTask release];_libraryTask=[task retain];_importFiles.enabled=NO;_importFolder.enabled=NO;_refresh.title=@"取消";_done.title=@"停止并关闭";_done.toolTip=@"关闭将取消本次加载,原有 LUT 保留";
|
||||
[_progressTimer invalidate];[_progressTimer release];_progressTimer=[[NSTimer timerWithTimeInterval:.1 target:self selector:@selector(pollLibraryProgress:) userInfo:nil repeats:YES]retain];
|
||||
[[NSRunLoop mainRunLoop]addTimer:_progressTimer forMode:NSRunLoopCommonModes];[self pollLibraryProgress:nil];
|
||||
}
|
||||
- (void)endLibraryTask {
|
||||
[_libraryTask release];_libraryTask=nil;[_progressTimer invalidate];[_progressTimer release];_progressTimer=nil;
|
||||
_importFiles.enabled=YES;_importFolder.enabled=YES;_refresh.title=@"刷新";
|
||||
_importFiles.enabled=YES;_importFolder.enabled=YES;_refresh.title=@"刷新";_done.title=@"完成";_done.toolTip=nil;
|
||||
}
|
||||
- (void)reloadLibrary:(id)sender{
|
||||
if(_libraryTask){[_libraryTask cancel];[self setStatus:@"正在取消…"];return;}
|
||||
|
||||
在新工单中引用
屏蔽一个用户