https://服务器地址/LightCore.bundle.zip
。Document/Xmagic
)。此时 Document/Xmagic 文件夹里面有 SDK 需要的资源。
NSDictionary *assetsDict = @{@"core_name":@"LightCore.bundle",@"root_path":_filePath ,//_filePath为美颜资源下载到本地后的父目录:Ducument/Xmagic,@"tnn_"@"beauty_config":beautyConfigJson};// Init beauty kit @"root_path":Ducument/Xmagic,self.beautyKit = [[XMagic alloc] initWithRenderSize:_inputSize assetsDict:assetsDict];
NSMutableArray *arrayModels = [NSMutableArray array];for (NSDictionary* dict in motionArray) {BeautyCellModel* model = [BeautyCellModel beautyWithDict:dict];// Load default mainbundle path of motionresif ([model.title isEqualToString:NSLocalizedString(@"item_none_label",nil)]) {model.icon = [NSString stringWithFormat:@"%@/%@.png", [[NSBundle mainBundle] bundlePath], model.key];[arrayModels addObject:model];} else {if(_useNetResource && _filePath != nil){ //使用网络资源时NSString *DirPath = [_filePath stringByAppendingPathComponent:@"2dMotionRes.bundle/"]; //获取美颜资源的绝对路径model.icon = [NSString stringWithFormat:@"%@/%@/template.png", DirPath, model.key];}else{model.icon = [NSString stringWithFormat:@"%@/%@/template.png", [[NSBundle mainBundle] pathForResource:@"2dMotionRes" ofType:@"bundle"], model.key];}if ([fileManager fileExistsAtPath:model.icon]) {[arrayModels addObject:model];}}}
效果类型 | 效果名称 | 效果值 | 说明 | 备注 |
beauty | 美颜id名称 | 美颜效果强度数值 | 美颜类型配置接口 | 无 |
lut | 滤镜路径+滤镜名称 | 滤镜强度数值 | 滤镜类型配置接口 | 无 |
motion | 动效路径名称 | 动效路径 | 动效类型配置接口 | 注意:如果资源中有zip,请确保传入动效路径为可写路径,否则跟app包走需要手动unzip才可以使用 |
**/ | | | | |
[self.beautyKitRef configPropertyWithType:@"beauty" withName:@"beauty.whiten" withData:@"30" withExtraInfo:nil];
字段 | 值 |
propertyType | beauty |
propertyName | beauty.whiten |
propertyValue | 30 |
extraInfo | nil |
NSString *key = [_model.lutIDs[index] path];if (key != nil) {key = [@"lut.bundle/" stringByAppendingPathComponent:key];//滤镜效果图片的相对路径}if(_useNetResource && _filePath != nil){ //如果使用下载的美颜资源key = [_filePath stringByAppendingPathComponent:key];//生成效果图片的绝对路径}[self.beautyKitRef configPropertyWithType:@"lut" withName:key withData:[NSStringstringWithFormat:@"%f",value] withExtraInfo:nil];
字段 | 使用本地资源时传入的参数 | 使用网络资源时传入的参数 | 备注 |
propertyType | lut | lut | - |
propertyName | lut.bundle/n_baixi.png | /var/mobile/Containers/Data/Application/25C7D01A-73F6-4F1B-AEB6-5EE03A221D18/Documents/Xmagic/lut.bundle/n_baixi.png | 文件路径 |
propertyValue | 60.000000 | 60.000000 | - |
extraInfo | null | null | - |
NSString *key = [_model.motionIDs[index] key];NSString *path = [_model.motionIDs[index] path];NSString *motionRootPath = path==nil?[[NSBundle mainBundle] pathForResource:@"MotionRes" ofType:@"bundle"]:path;if(_useNetResource && _filePath != nil){//如果使用下载的美颜资源motionRootPath = [_filePath stringByAppendingPathComponent:@"2dMotionRes.bundle"];//生成2dMotionRes的绝对路径}[self.beautyKitRef configPropertyWithType:@"motion" withName:key withData:motionRootPath withExtraInfo:nil];
字段 | 使用本地资源时传入的参数 | 使用网络资源时传入的参数 | 备注 |
propertyType | motion | motion | - |
propertyName | video_keaituya | video_keaituya | - |
propertyValue | /private/var/containers/Bundle/Application/FD2D7912-E58E-4584-B7E4-8715B8D2338F/BeautyDemo.app/2dMotionRes.bundle | /var/mobile/Containers/Data/Application/25C7D01A-73F6-4F1B-AEB6-5EE03A221D18/Documents/Xmagic/2dMotionRes.bundle | 文件路径 |
extraInfo | nil | nil | - |
本页内容是否解决了您的问题?