Show mask-count header badges even when folded; include user follow-up in 1.4.3 build33

这个提交包含在:
mac 于 2026-11-02 12:25:51 +08:00 提交
1 父节点 b4dc7e3267
当前提交 26a888f453
4 个文件已更改
+41 -4

没有与搜索条件相匹配的文件

+28 -2
查看文件
@@ -26,6 +26,26 @@ static NSButton *DYButton(NSString *title,id target,SEL action) {
b.bezelStyle=NSBezelStyleRounded; b.font=[NSFont systemFontOfSize:11];
b.contentTintColor=DYAccent(); return b;
}
// Header status stays visible while the body is folded and never intercepts clicks.
@interface DYMaskCountBadge : NSView
@property(nonatomic) NSUInteger count;
@end
@implementation DYMaskCountBadge
- (void)setCount:(NSUInteger)count {_count=count;self.hidden=count==0;[self setNeedsDisplay:YES];}
- (NSView*)hitTest:(NSPoint)point {return nil;}
- (BOOL)isAccessibilityElement {return YES;}
- (NSString*)accessibilityRole {return NSAccessibilityStaticTextRole;}
- (id)accessibilityValue {return [NSString stringWithFormat:@"%lu 个蒙版",(unsigned long)_count];}
- (void)drawRect:(NSRect)dirtyRect {
if(!_count)return;NSRect frame=NSInsetRect(self.bounds,.6,.6);
NSBezierPath *pill=[NSBezierPath bezierPathWithRoundedRect:frame xRadius:6 yRadius:6];
[DYThemeColor(@"field") setFill];[pill fill];[DYAccent() setStroke];pill.lineWidth=1.2;[pill stroke];
NSString *text=[NSString stringWithFormat:@"%lu",(unsigned long)_count];
NSDictionary *attributes=@{NSFontAttributeName:[NSFont monospacedDigitSystemFontOfSize:10.5 weight:NSFontWeightBold],NSForegroundColorAttributeName:DYInk()};
NSSize size=[text sizeWithAttributes:attributes];[text drawAtPoint:NSMakePoint(NSMidX(self.bounds)-size.width/2,NSMidY(self.bounds)-size.height/2) withAttributes:attributes];
}
@end
static BOOL DYStrengthUsesUnitRange(NSDictionary *d) {
return [d[@"key"] hasSuffix:@"Strength"] && [d[@"max"] doubleValue]<=1;
}
@@ -624,6 +644,7 @@ static NSImage *DYWheelImage(void) {
NSString *nodeID=_embedded?[(DYToolManager*)_manager nodeID]:[@"base:" stringByAppendingString:key];
DYToolMaskPanel *maskPanel=[[[DYToolMaskPanel alloc]initWithManager:host nodeID:nodeID]autorelease];[card addSubview:maskPanel];[body insertObject:maskPanel atIndex:0];record[@"maskPanel"]=maskPanel;
NSButton *mask=DYButton(@"",self,@selector(toolMask:));mask.tag=index;mask.bordered=NO;mask.image=[NSImage imageWithSystemSymbolName:@"circle.dashed.inset.filled" accessibilityDescription:@"添加蒙版"];mask.toolTip=@"添加本工具的独立蒙版";mask.accessibilityLabel=[section[@"title"]stringByAppendingString:@"添加蒙版"];[card addSubview:mask];record[@"maskButton"]=mask;
DYMaskCountBadge *maskBadge=[[[DYMaskCountBadge alloc]initWithFrame:NSZeroRect]autorelease];maskBadge.hidden=YES;maskBadge.accessibilityLabel=[section[@"title"] stringByAppendingString:@"蒙版数量"];[card addSubview:maskBadge];record[@"maskBadge"]=maskBadge;
NSButton *repeat=DYButton(@"",self,@selector(repeatTool:));repeat.tag=index;repeat.bordered=NO;repeat.image=[NSImage imageWithSystemSymbolName:@"plus.square.on.square" accessibilityDescription:@"再加一层"];repeat.toolTip=@"紧接当前工具插入一层初始化工具";repeat.accessibilityLabel=[section[@"title"]stringByAppendingString:@"再加一层"];[card addSubview:repeat];record[@"repeatButton"]=repeat;
if(_embedded){NSButton *remove=DYButton(@"删除此层",self,@selector(removeTool:));remove.identifier=@"removeTool";[card addSubview:remove];[body addObject:remove];}
[_cards addObject:record];
@@ -680,7 +701,7 @@ static NSImage *DYWheelImage(void) {
CGFloat headerHeight=43;
card.frame=NSMakeRect(16,y,cw,headerHeight+(contentHeight>0?contentHeight+8:0));y+=card.frame.size.height+12;
[c[@"reset"]setFrame:NSMakeRect(cw-34,10,24,24)];
[c[@"repeatButton"]setFrame:NSMakeRect(cw-62,10,24,24)];[c[@"maskButton"]setFrame:NSMakeRect(cw-90,10,24,24)];
[c[@"repeatButton"]setFrame:NSMakeRect(cw-62,10,24,24)];[c[@"maskButton"]setFrame:NSMakeRect(cw-90,10,24,24)];[c[@"maskBadge"]setFrame:NSMakeRect(cw-83,3,18,16)];
[c[@"add"]setFrame:NSMakeRect(cw-33,headerHeight+contentHeight-28,20,24)];[c[@"add"]setEnabled:_visibleLooks<5];[c[@"add"]setHidden:collapsed];
CGFloat rowY=headerHeight;
for(NSView *row in body) {
@@ -753,7 +774,12 @@ static NSImage *DYWheelImage(void) {
[c[@"enabled"]setToolTip:enabled?@"停用本组,保留参数和展开状态":@"启用本组,保留展开状态"];[c[@"enabled"]setAccessibilityHelp:[c[@"enabled"]toolTip]];
for(NSView *row in c[@"body"])row.alphaValue=enabled?1:.45;
}
id<PROAPIAccessing> maskHost=_embedded?[(DYToolManager*)_manager host]:_manager;NSDictionary *tools=DYReadTools(maskHost,t).document;for(NSDictionary *card in _cards)[card[@"maskPanel"]refreshWithDocument:tools time:t];
id<PROAPIAccessing> maskHost=_embedded?[(DYToolManager*)_manager host]:_manager;NSDictionary *tools=DYReadTools(maskHost,t).document;for(NSDictionary *card in _cards){
[card[@"maskPanel"]refreshWithDocument:tools time:t];
NSString *nodeID=_embedded?[(DYToolManager*)_manager nodeID]:[@"base:" stringByAppendingString:card[@"section"][@"key"]];NSUInteger count=[DYMasksForTool(tools,nodeID) count];
[(DYMaskCountBadge*)card[@"maskBadge"]setCount:count];NSString *hint=count?[NSString stringWithFormat:@"已有 %lu 个蒙版;点击添加独立蒙版",(unsigned long)count]:@"添加本工具的独立蒙版";
[card[@"maskButton"]setToolTip:hint];[card[@"maskButton"]setAccessibilityHelp:hint];
}
DYAssetState *assets=DYReadAssets(_manager,t);[_spiderPanel setMesh:assets.spiderMesh linked:assets.spiderLinked];
double profile=0,configured=0;[get getFloatValue:&profile fromParameter:2013 atTime:t];[get getFloatValue:&configured fromParameter:2236 atTime:t];
DYInspectorToken *oldToken=nil;[get getCustomParameterValue:&oldToken fromParameter:DYInspectorParameterID atTime:t];
+1 -1
查看文件
@@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.4.3</string>
<key>CFBundleVersion</key>
<string>32</string>
<string>33</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>PlugInKit</key>