release: prepare 1.11.0 canvas tools and rebuild native template metadata

这个提交包含在:
mac 于 2026-11-05 01:51:03 +08:00 提交
1 父节点 1c3e294ce9
当前提交 2711e0016e
15 个文件已更改
+134 -24

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

@@ -52,5 +52,10 @@ if(faceFixture.length){
u.skinProtection.x=1;u.skinVisualize=1;Pixels selection=render(run,face,src,dst,gpu,u,@{},@"face-actual-selection-preview-render");double white=0,black=0;for(NSUInteger y=65;y<185;y++)for(NSUInteger x=175;x<275;x++)white=MAX(white,(float)selection[(y*w+x)*4]);for(NSUInteger y=410;y<470;y++)for(NSUInteger x=410;x<470;x++)black=MAX(black,(float)selection[(y*w+x)*4]);
double maximum=0;NSUInteger maxX=0,maxY=0;for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w;x++)if(selection[(y*w+x)*4]>maximum){maximum=selection[(y*w+x)*4];maxX=x;maxY=y;}
run.record(@"face-preview-shows-actual-weight-and-excludes-background",white>.01&&black<.001,@{@"faceWeight":@(white),@"backgroundWeight":@(black),@"maximum":@(maximum),@"maxX":@(maxX),@"maxY":@(maxY)});
// Both FxPlug row conventions must resolve the same visual face.
Pixels flipped(portrait.size());for(NSUInteger y=0;y<h;y++)memcpy(flipped.data()+y*w*4,portrait.data()+(h-1-y)*w*4,w*8);upload(flipped);[src setDiagnosticImageOrigin:kFxImageOrigin_BOTTOM_LEFT];[dst setDiagnosticImageOrigin:kFxImageOrigin_BOTTOM_LEFT];u.skinVisualize=0;Pixels bottom=render(run,face,src,dst,gpu,u,@{},@"face-bottom-origin-production-render");double flipError=0;for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w*4;x++)flipError=MAX(flipError,fabs((float)bottom[(h-1-y)*w*4+x]-(float)protectedFrame[y*w*4+x]));run.record(@"face-top-and-bottom-origins-protect-identical-visual-region",flipError<.003,@{@"maximumError":@(flipError)});[src setDiagnosticImageOrigin:kFxImageOrigin_TOP_LEFT];[dst setDiagnosticImageOrigin:kFxImageOrigin_TOP_LEFT];upload(portrait);
NSMutableDictionary *masked=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document);NSMutableDictionary *zero=DYMutablePlist(DYNewMask(DYMaskRectangle));DYMaskParameters zeroP=DYMaskAtTime(zero,kCMTimeZero);zeroP.strength=0;zero[@"parameters"]=[NSData dataWithBytes:&zeroP length:sizeof(zeroP)];masked[@"baseMasks"][@"skin"]=[NSMutableArray arrayWithObject:zero];u.skinVisualize=1;NSError *maskError=nil;BOOL maskOK=[face renderSource:src destination:dst uniforms:u paths:@{}spider:nil tools:masked error:&maskError];Pixels empty=read(dst,gpu);double emptyMax=0;for(NSUInteger i=0;i<w*h;i++)emptyMax=MAX(emptyMax,(float)empty[i*4]);run.record(@"face-preview-respects-authored-zero-strength-mask",maskOK&&emptyMax<.001);
u.skinVisualize=0;u.skinProtection.x=0;NSMutableDictionary *layers=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document);NSMutableDictionary *skin=(id)DYInsertTool(layers,@"skin",@"base:skin");skin[@"values"][@"skinStrength"]=@100;skin[@"values"][@"skinVisualize"]=@1;BOOL layerOK=[face renderSource:src destination:dst uniforms:u paths:@{}spider:nil tools:layers error:&maskError];Pixels layerMask=read(dst,gpu);double layerFace=0,layerBackground=0;for(NSUInteger y=65;y<185;y++)for(NSUInteger x=175;x<275;x++)layerFace=MAX(layerFace,(float)layerMask[(y*w+x)*4]);for(NSUInteger y=410;y<470;y++)for(NSUInteger x=410;x<470;x++)layerBackground=MAX(layerBackground,(float)layerMask[(y*w+x)*4]);run.record(@"face-independent-layer-uses-own-preview-and-face-mask",layerOK&&layerFace>.01&&layerBackground<.001);
DYDiagnosticTile *twoSource=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:1024 height:512]autorelease],*twoDest=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:1024 height:512]autorelease];Pixels two(1024*512*4);for(NSUInteger y=0;y<512;y++)for(NSUInteger x=0;x<1024;x++)memcpy(two.data()+(y*1024+x)*4,portrait.data()+(y*512+x%512)*4,8);[[twoSource metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,1024,512)mipmapLevel:0 withBytes:two.data()bytesPerRow:1024*8];u.skinProtection.x=1;BOOL twoOK=[face renderSource:twoSource destination:twoDest uniforms:u paths:@{}error:&maskError];NSData *twoEntries=[face valueForKey:@"faceEntries"];const DYToolMaskEntry *twoMasks=(const DYToolMaskEntry*)twoEntries.bytes;NSInteger faceCount=0;for(NSUInteger i=0;i<twoEntries.length/sizeof(*twoMasks);i++)faceCount+=twoMasks[i].section==-100;run.record(@"face-multiple-people-build-independent-support-regions",twoOK&&faceCount==2,@{@"faces":@(faceCount)});
Pixels noFace(w*h*4);for(NSUInteger i=0;i<w*h;i++){noFace[i*4]=.35;noFace[i*4+1]=.18;noFace[i*4+2]=.1;noFace[i*4+3]=1;}upload(noFace);u.skinVisualize=0;Pixels noFaceProtected=render(run,face,src,dst,gpu,u,@{},@"face-none-protected-render");u.skinProtection.x=0;Pixels noFacePlain=render(run,face,src,dst,gpu,u,@{},@"face-none-unprotected-reference");run.record(@"face-no-detection-clears-prior-frame-and-fails-closed",difference(noFaceProtected,noFacePlain).maximum<.002);
}
+1 -1
查看文件
@@ -30,7 +30,7 @@
[handler release];[request release];_faceEntries=[[NSData alloc]initWithBytes:entries.data() length:entries.size()*sizeof(DYToolMaskEntry)];[_faceCachedEntries release];_faceCachedEntries=[_faceEntries copy];
}
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){
BOOL face=(u.skinProtection.x>.5&&u.skinFaceOnly>.5)||u.skinVisualize>.5;for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);face|=[node[@"type"]isEqual:@"skin"]&&layer.skinProtection.x>.5&&layer.skinFaceOnly>.5;}
DYUniforms effective=u;bypassNeutralTools(&effective);bypassIdleSkin(&effective);BOOL face=effective.skinProtection.x>.5&&(u.skinFaceOnly>.5||u.skinVisualize>.5);for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);face|=[node[@"type"]isEqual:@"skin"]&&layer.skinProtection.x>.5&&layer.skinFaceOnly>.5;}
if(face&&!_exporting)[self prepareFaceSupport:src];else{[_faceEntries release];_faceEntries=nil;}
BOOL ok=[self renderToolsSource:src destination:dst uniforms:u paths:paths spider:spider tools:tools error:error];
return ok;
+5 -5
查看文件
@@ -173,9 +173,9 @@ fragment half4 dyMaskedFragment(DYRaster in [[stage_in]],
float weights[12];float3 encoded=dyToolEncode(float3(sample.rgb));
for(int i=0;i<12;i++)weights[i]=dyToolCoverage(in.uv,encoded,masks,maskHeader,i);
half4 result = dy_gradeMasked(sample, in.uv, source, preLUT, look1, look2, look3,
look4, look5, hslMixer, whiteBalance, colorGrading, uniforms, sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],uniforms.skinVisualize);
look4, look5, hslMixer, whiteBalance, colorGrading, uniforms, sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],(uniforms.skinProtection.x>.5?uniforms.skinVisualize:0));
if(options.blackWhiteMix>0.0f && options.blackWhiteMix<1.0f) {
half4 color=dy_gradeMasked(sample,in.uv,source,preLUT,look1,look2,look3,look4,look5,hslMixer,whiteBalance,colorGrading,colorUniforms,sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],uniforms.skinVisualize);
half4 color=dy_gradeMasked(sample,in.uv,source,preLUT,look1,look2,look3,look4,look5,hslMixer,whiteBalance,colorGrading,colorUniforms,sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],(uniforms.skinProtection.x>.5?uniforms.skinVisualize:0));
result.rgb=mix(color.rgb,result.rgb,half(options.blackWhiteMix));
}
if(uniforms.skinVisualize<.5f && spiderSize.x>0 && uniforms.spiderSectionEnabled>.5f && uniforms.spiderMix>0.0f){
@@ -219,9 +219,9 @@ fragment half4 dySegmentFragment(DYRaster in [[stage_in]],
half4 reference=skinReference.sample(sampleFilter,in.uv);
float3 skinEncoded=dyToolEncode(reference.a>half(0)?float3(reference.rgb/reference.a):float3(0));
half4 result = dy_gradeSegment(sample, in.uv, nativeSource, preLUT, look1, look2, look3,
look4, look5, hslMixer, whiteBalance, colorGrading, uniforms, sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],uniforms.skinVisualize,uint(stages.first),uint(stages.last),skinEncoded,encoded);
look4, look5, hslMixer, whiteBalance, colorGrading, uniforms, sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],(uniforms.skinProtection.x>.5?uniforms.skinVisualize:0),uint(stages.first),uint(stages.last),skinEncoded,encoded);
if(stages.first<=9 && stages.last>=9 && options.blackWhiteMix>0.0f && options.blackWhiteMix<1.0f) {
half4 color=dy_gradeSegment(sample,in.uv,nativeSource,preLUT,look1,look2,look3,look4,look5,hslMixer,whiteBalance,colorGrading,colorUniforms,sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],uniforms.skinVisualize,uint(stages.first),uint(stages.last),skinEncoded,encoded);
half4 color=dy_gradeSegment(sample,in.uv,nativeSource,preLUT,look1,look2,look3,look4,look5,hslMixer,whiteBalance,colorGrading,colorUniforms,sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],(uniforms.skinProtection.x>.5?uniforms.skinVisualize:0),uint(stages.first),uint(stages.last),skinEncoded,encoded);
result.rgb=mix(color.rgb,result.rgb,half(options.blackWhiteMix));
}
result.a = sample.a;
@@ -332,7 +332,7 @@ kernel void dyToolBlend(texture2d<float,access::read> before [[texture(0)]],text
extern "C" float dy_skinWeight(float3 color,float3 reference,constant DYUniforms& uniforms);
extern "C" float3 dy_skinExtra(float3 color,float3 reference,constant DYUniforms& uniforms);
kernel void dyToolSkin(texture2d<float,access::read> before [[texture(0)]],texture2d<float> reference [[texture(1)]],texture2d<half,access::write> output [[texture(2)]],constant DYUniforms& u [[buffer(0)]],uint2 pos [[thread_position_in_grid]]){
if(pos.x>=output.get_width()||pos.y>=output.get_height())return;constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);float4 a=before.read(pos),b=reference.sample(f,(float2(pos)+.5f)/float2(output.get_width(),output.get_height()));if(a.a>0){float3 c=dy_skinExtra(dyToolEncode(a.rgb/a.a),dyToolEncode(b.a>0?b.rgb/b.a:float3(0)),u);a.rgb=u.skinVisualize>.5?float3(dy_skinWeight(float3(0),dyToolEncode(b.a>0?b.rgb/b.a:float3(0)),u)*clamp(u.skinProtection.y*.01f,0.f,1.f)*a.a):dyToolDecode(c)*a.a;}output.write(half4(a),pos);
if(pos.x>=output.get_width()||pos.y>=output.get_height())return;constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);float4 a=before.read(pos),b=reference.sample(f,(float2(pos)+.5f)/float2(output.get_width(),output.get_height()));if(a.a>0){float3 c=dy_skinExtra(dyToolEncode(a.rgb/a.a),dyToolEncode(b.a>0?b.rgb/b.a:float3(0)),u);a.rgb=u.skinProtection.x>.5&&u.skinVisualize>.5?float3(dy_skinWeight(float3(0),dyToolEncode(b.a>0?b.rgb/b.a:float3(0)),u)*clamp(u.skinProtection.y*.01f,0.f,1.f)*a.a):dyToolDecode(c)*a.a;}output.write(half4(a),pos);
}
fragment half4 dyToolCopyFragment(DYRaster in [[stage_in]],texture2d<half> source [[texture(0)]]){constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);return source.sample(f,in.uv);}
+4 -4
查看文件
@@ -38,7 +38,7 @@
id<MTLCommandBuffer>cb=[entry[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>ce=[cb computeCommandEncoder];[ce setComputePipelineState:entry[@"dyToolSkin"]];[ce setTexture:before atIndex:0];[ce setTexture:input atIndex:1];[ce setTexture:after atIndex:2];[ce setBytes:&layer length:sizeof(layer) atIndex:0];[ce dispatchThreads:MTLSizeMake(after.width,after.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];[cb commit];[cb waitUntilCompleted];if(cb.status!=MTLCommandBufferStatusCompleted)return fail(error,cb.error.localizedDescription);
if(![node[@"masks"]count]&&layer.skinFaceOnly<.5&&layer.skinVisualize<.5)return YES;
MTLTextureDescriptor *desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:after.width height:after.height mipmapped:NO];desc.storageMode=MTLStorageModePrivate;desc.usage=MTLTextureUsageRenderTarget|MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite;id<MTLTexture>blend=[d newTextureWithDescriptor:desc];if(!blend)return fail(error,@"无法分配新增工具蒙版缓冲区");
DYToolMaskHeader h{};h.section=3;h.faceOnly=layer.skinFaceOnly>.5;h.skinPreview=layer.skinVisualize>.5;id<MTLBuffer>buffer=[self maskBuffer:@{type:node[@"masks"]} tile:source device:d header:&h];cb=[entry[@"queue"]commandBuffer];[self encodeBlend:before after:after output:blend masks:buffer header:h entry:entry commands:cb];[cb commit];[cb waitUntilCompleted];BOOL ok=cb.status==MTLCommandBufferStatusCompleted;
DYToolMaskHeader h{};h.section=3;h.faceOnly=layer.skinFaceOnly>.5;h.skinPreview=layer.skinProtection.x>.5&&layer.skinVisualize>.5;id<MTLBuffer>buffer=[self maskBuffer:@{type:node[@"masks"]} tile:source device:d header:&h];cb=[entry[@"queue"]commandBuffer];[self encodeBlend:before after:after output:blend masks:buffer header:h entry:entry commands:cb];[cb commit];[cb waitUntilCompleted];BOOL ok=cb.status==MTLCommandBufferStatusCompleted;
DYExportTile *blended=[[DYExportTile alloc]initWithTexture:blend registry:d.registryID];[blended setBounds:source.tilePixelBounds origin:source.imageOrigin];[blended setPixelAspect:source.pixelAspect];[blend release];if(ok)ok=[self copyTile:blended to:destination entry:entry error:error];else fail(error,cb.error.localizedDescription);[blended release];return ok;
}
- (BOOL)renderToolsSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){return DYRenderWithPool(error,[&]()->BOOL{
@@ -46,7 +46,7 @@
DYApplyRemovedBaseTools(&u,tools);paths=DYVisibleBaseToolPaths(paths,tools);if(DYBaseToolRemoved(tools,@"spider"))spider=nil;
NSArray *layers=tools[@"layers"];BOOL active=NO,anchored=NO;for(NSDictionary *node in layers)if(!DYToolIsNeutral(node)){active=YES;anchored|=![DYToolRootAnchor(tools,node[@"id"])isEqual:@"tail"];}
// No active extra tool keeps the exact historical fused path, including HDR.
if(!active&&!DYChannelMixerActive(u)&&!DYFilmToolActive(u)&&u.lensSectionEnabled<.5)return [self renderLegacy:src destination:dst uniforms:u paths:paths spider:spider masks:tools[@"baseMasks"] error:error];
if(!active&&!DYChannelMixerActive(u)&&!DYFilmToolActive(u)&&(u.lensSectionEnabled<.5||(u.lensStrength==0&&u.lensScale==1)))return [self renderLegacy:src destination:dst uniforms:u paths:paths spider:spider masks:tools[@"baseMasks"] error:error];
NSMutableDictionary *entry=[self device:dst.deviceRegistryID error:error];if(!entry)return NO;id<MTLDevice>d=entry[@"device"];id<MTLTexture>input=[src metalTextureForDevice:d];if(!input)return fail(error,@"宿主图像纹理不可用");
MTLTextureDescriptor *desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:input.width height:input.height mipmapped:NO];desc.storageMode=MTLStorageModePrivate;desc.usage=MTLTextureUsageRenderTarget|MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite;
DYExportTile *tile=nil,*skinReference=nil,*originalReference=nil;NSArray *order=DYToolDisplayOrder(tools);NSMutableDictionary *groups=[NSMutableDictionary dictionary];for(NSString *ID in order){NSDictionary *node=DYToolWithID(tools,ID);if(!node||DYToolIsNeutral(node))continue;NSString *root=DYToolRootAnchor(tools,ID);if(!groups[root])groups[root]=[NSMutableArray array];[groups[root]addObject:node];}
@@ -100,8 +100,8 @@
});}}
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){
if(tools&&!DYValidToolDocument(tools))return fail(error,@"工具或蒙版数据损坏,未更改原工程");DYApplyRemovedBaseTools(&u,tools);paths=DYVisibleBaseToolPaths(paths,tools);if(DYBaseToolRemoved(tools,@"spider"))spider=nil;
if((u.lensSectionEnabled>.5&&(u.lensStrength!=0||u.lensScale!=1))||u.skinVisualize>.5)return fail(error,@"镜头修复与肤色区域显示无法保存到 Cube,请保存完整预设。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"lens"]&&!DYToolIsNeutral(node))return fail(error,@"镜头畸变属于空间处理,请保存完整预设。");}
DYUniforms effective=u;bypassNeutralTools(&effective);bypassIdleSkin(&effective);if(effective.skinFaceOnly>.5&&effective.skinProtection.x>.5&&effective.skinProtection.y>0)return fail(error,@"人脸限定肤色保护属于空间选区,Cube 无法保存。请保存完整预设,或关闭人脸限定后导出。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"skin"]&&layer.skinProtection.x>.5&&layer.skinProtection.y>0&&(layer.skinFaceOnly>.5||layer.skinVisualize>.5))return fail(error,@"新增肤色层含人脸空间选区,请保存完整预设。");}
if((u.lensSectionEnabled>.5&&(u.lensStrength!=0||u.lensScale!=1))||(u.skinProtection.x>.5&&u.skinVisualize>.5))return fail(error,@"镜头修复与肤色区域显示无法保存到 Cube,请保存完整预设。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"lens"]&&!DYToolIsNeutral(node))return fail(error,@"镜头畸变属于空间处理,请保存完整预设。");}
DYUniforms effective=u;if(![paths[@"input"]length]&&effective.inputProfile==0)effective.preLUTStrength=0;if(![paths[@"look0"]length])effective.postLUTStrength=0;for(int i=0;i<4;i++)if(![paths[[NSString stringWithFormat:@"look%d",i+1]]length])effective.extraPostLUTStrengths[i]=0;bypassNeutralTools(&effective);bypassIdleSkin(&effective);if(effective.skinFaceOnly>.5&&effective.skinProtection.x>.5&&effective.skinProtection.y>0)return fail(error,@"人脸限定肤色保护属于空间选区,Cube 无法保存。请保存完整预设,或关闭人脸限定后导出。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"skin"]&&layer.skinProtection.x>.5&&layer.skinProtection.y>0&&(layer.skinFaceOnly>.5||layer.skinVisualize>.5))return fail(error,@"新增肤色层含人脸空间选区,请保存完整预设。");}
if(DYFilmToolActive(u)&&DYFilmSpatialActive(u.film))return fail(error,@"当前胶片含晕光、辉光、颗粒或暗角,无法完整保存到静态 Cube。请保存完整预设,或关闭这些处理后再导出。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"film"]&&DYFilmToolActive(layer)&&DYFilmSpatialActive(layer.film))return fail(error,@"新增胶片层含空间或时间处理,无法完整保存到静态 Cube。请保存完整预设。");}
for(NSArray *masks in [tools[@"baseMasks"]allValues])if(masks.count)return fail(error,@"当前调色含空间蒙版或跟踪,Cube 无法保存这些信息。请先保存完整预设,或移除蒙版后导出。");for(NSDictionary *node in tools[@"layers"])if([node[@"masks"]count])return fail(error,@"新增工具含蒙版,无法完整导出为 Cube。请保存完整预设。");
_toolDocument=tools;BOOL ok=NO;@try{ok=[self exportLUT:url uniforms:u paths:paths spider:spider error:error];}@finally{_toolDocument=nil;}return ok;
+1 -1
查看文件
@@ -124,7 +124,7 @@ DYUniforms DYToolUniforms(NSDictionary *node){DYUniforms u;DYDefaultUniforms(&u)
// new layers explicitly disable mapping so adding a neutral layer is identity.
if([type isEqual:@"primary"]){u.primarySectionEnabled=1;u.cm.configured=1;u.cm.inputTransfer=u.cm.outputTransfer;u.cm.inputGamut=u.cm.outputGamut;u.cm.toneMapping=0;}
for(NSDictionary *d in DYDescriptors()){NSNumber *v=node[@"values"][d[@"key"]];if(v&&[d[@"offset"]integerValue]>=0)*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])=v.floatValue;}return u;}
BOOL DYToolIsNeutral(NSDictionary *node){NSString *type=node[@"type"];DYUniforms u=DYToolUniforms(node);NSDictionary *section=DYToolSection(type);BOOL enabled=YES;if([type isEqual:@"primary"])enabled=u.primarySectionEnabled>.5;else if([type isEqual:@"base"])enabled=u.baseSectionEnabled>.5||u.colorSectionEnabled>.5;else for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:section[@"enabled"]])enabled=*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])>.5;if(!enabled)return YES;if([type isEqual:@"primary"]&&u.cm.toneMapping>.5)return NO;if([type isEqual:@"mixer"])return !DYChannelMixerActive(u);if([type isEqual:@"film"])return !DYFilmToolActive(u);if([type isEqual:@"skin"])return u.skinProtection.y==0;if([node[@"type"]isEqual:@"spider"]&&[node[@"spider"]length]){auto mesh=DYSpiderMesh(node[@"spider"]);for(float v:dy::meshSamples(mesh))if(v!=0)return NO;}if([node[@"paths"]count])return NO;for(NSDictionary *d in DYDescriptors()){NSNumber *v=node[@"values"][d[@"key"]];if([type isEqual:@"primary"]&&[d[@"key"]isEqual:@"cmtoneMapping"]&&v.floatValue==0)continue;if(v&&v.floatValue!=[d[@"default"]floatValue])return NO;}return YES;}
BOOL DYToolIsNeutral(NSDictionary *node){NSString *type=node[@"type"];DYUniforms u=DYToolUniforms(node);NSDictionary *section=DYToolSection(type);BOOL enabled=YES;if([type isEqual:@"primary"])enabled=u.primarySectionEnabled>.5;else if([type isEqual:@"base"])enabled=u.baseSectionEnabled>.5||u.colorSectionEnabled>.5;else for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:section[@"enabled"]])enabled=*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])>.5;if(!enabled)return YES;if([type isEqual:@"primary"]&&u.cm.toneMapping>.5)return NO;if([type isEqual:@"lens"])return u.lensStrength==0&&u.lensScale==1;if([type isEqual:@"mixer"])return !DYChannelMixerActive(u);if([type isEqual:@"film"])return !DYFilmToolActive(u);if([type isEqual:@"skin"])return u.skinProtection.y==0&&u.skinVisualize<.5;if([node[@"type"]isEqual:@"spider"]&&[node[@"spider"]length]){auto mesh=DYSpiderMesh(node[@"spider"]);for(float v:dy::meshSamples(mesh))if(v!=0)return NO;}if([node[@"paths"]count])return NO;for(NSDictionary *d in DYDescriptors()){NSNumber *v=node[@"values"][d[@"key"]];if([type isEqual:@"primary"]&&[d[@"key"]isEqual:@"cmtoneMapping"]&&v.floatValue==0)continue;if(v&&v.floatValue!=[d[@"default"]floatValue])return NO;}return YES;}
@implementation DYToolManager {
id<PROAPIAccessing> _host;NSString *_nodeID,*_type;NSInteger _depth;CMTime _time;NSMutableDictionary *_pending;DYInspectorToken *_token;
+1
查看文件
@@ -156,6 +156,7 @@ DY_ABI_ASSERT(offsetof(DYUniforms, film) == 1168, "1.5.0 film settings stay fixe
DY_ABI_ASSERT(offsetof(DYUniforms, filmFrameKey) == 1284, "1.5.0 frozen frame key stays fixed");
DY_ABI_ASSERT(offsetof(DYUniforms, filmPrint) == 1296, "complete 1.5.0 prefix stays fixed");
DY_ABI_ASSERT(offsetof(DYUniforms, lensSectionEnabled) == 1312, "complete 1.10 prefix stays fixed");
DY_ABI_ASSERT(sizeof(DYUniforms) == 1344, "1.11 append-only extension size");
DY_ABI_ASSERT(offsetof(DYUniforms, exposure) == 0, "exposure offset");
DY_ABI_ASSERT(offsetof(DYUniforms, contrast) == 4, "contrast offset");
DY_ABI_ASSERT(offsetof(DYUniforms, highlights) == 8, "highlights offset");
@@ -118,7 +118,7 @@
[self text:title rect:NSInsetRect(r,5*s,5*s) size:[kind isEqual:@"open"]?12:11 color:[kind isEqual:@"toolUnavailable"]?[ink colorWithAlphaComponent:.35]:ink alignment:NSTextAlignmentCenter];
}
}
if(_open){NSString*hint=_catalog?@"选择当前工具的图层":(_graphMode&&[_toolType isEqual:@"curve"])?@"点击加点 · 拖动调整":(_graphMode&&[_toolType isEqual:@"grading"])?@"拖动色轮 · 参数查看亮度":@"拖动调节 · ↺ 还原";if(_hover==20000||_movingPanel)hint=@"拖动标题移动 · 单击折叠";[self text:hint rect:NSMakeRect(_panel.origin.x+40*s,NSMaxY(_panel)-22*s,_panel.size.width-168*s,18*s) size:9 color:ink alignment:NSTextAlignmentCenter];}
if(_open){NSString*hint=_catalog?@"选择当前工具的图层":(_graphMode&&[_toolType isEqual:@"curve"])?@"点击加点 · 拖动调整":(_graphMode&&[_toolType isEqual:@"grading"])?@"拖动色轮 · 参数查看亮度":@"拖动调节 · ↺ 还原";if(_graphMode&&[_toolType isEqual:@"hsl"])hint=@"拖动色点 · 参数精调";if(_graphMode&&[_toolType isEqual:@"spider"])hint=@"拖点联动 · 固定与还原选中点";if(_hover==20000||_movingPanel)hint=@"拖动标题移动 · 单击折叠";[self text:hint rect:NSMakeRect(_panel.origin.x+40*s,NSMaxY(_panel)-22*s,_panel.size.width-168*s,18*s) size:9 color:ink alignment:NSTextAlignmentCenter];}
[NSGraphicsContext restoreGraphicsState];
}
- (NSInteger)partAtPoint:(NSPoint)p{if(!_visible||!std::isfinite(p.x)||!std::isfinite(p.y)||!_bridge||!NSPointInRect(p,NSIntersectionRect(_panel,NSMakeRect(0,0,_size.width,_size.height))))return 0;for(NSDictionary*a in [_areas reverseObjectEnumerator])if(![a[@"kind"]isEqual:@"toolUnavailable"]&&NSPointInRect(p,[a[@"rect"]rectValue]))return [a[@"part"]integerValue];return _open&&NSPointInRect(p,_panel)?20006:0;}
+3 -3
查看文件
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.10.0</string>
<string>1.11.0</string>
<key>CFBundleVersion</key>
<string>72</string>
<string>73</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>PlugInKit</key>
@@ -71,7 +71,7 @@
<key>uuid</key>
<string>1C17B73B-F229-4C09-A434-EAF6DFF5F22A</string>
<key>version</key>
<string>1.10.0</string>
<string>1.11.0</string>
</dict>
<dict>
<key>className</key>
+2 -2
查看文件
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.10.0</string>
<string>1.11.0</string>
<key>CFBundleVersion</key>
<string>72</string>
<string>73</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>