ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
在渲染方法里面调 `[self.menusView setupDefaultBeautyAndFaceValueWithIsTX:YES];` 例如腾讯直播 ``` #pragma mark - TXVideoCustomProcessDelegate - (GLuint)onPreProcessTexture:(GLuint)texture width:(CGFloat)width height:(CGFloat)height {     GLuint newTexture = texture; //    if (_needScale){ //        newTexture = [self.beautyManager processWithTexture:texture width:width height:height scale:0.75]; //    }else{ //        [self.beautyManager processWithTexture:texture width:width height:height]; //    }     if (!self.isSetDefaultValue) {         [self.menusView setupDefaultBeautyAndFaceValueWithIsTX:YES];         self.isSetDefaultValue = YES;     }     [self.beautyManager processWithTexture:newTexture width:width height:height];     return newTexture; } ``` 在这个方法里面设置默认值 ``` - (void)setupDefaultBeautyAndFaceValueWithIsTX:(BOOL)isTX{     //设置美型默认数据,按照数组的名称设置初始值,不要换顺序     //此处只是说明该位置对应的类型,如果打开注释,请填写具体数值 //    NSArray *originalValuesArr = @[@"0",@"大眼",@"瘦脸", //    @"嘴型", //    @"瘦鼻", //    @"下巴", //    @"额头", //    @"眉毛", //    @"眼角", //    @"眼距", //    @"开眼角", //    @"削脸", //    @"长鼻"]; //    for (int i = 0; i<originalValuesArr.count; i++) { //        if (i != 0) { //            NSString *value = originalValuesArr[i]; //            [self handleFaceBeautyWithType:i sliderValue:value.integerValue];     // }      //   NSString *faceKey = [NSString stringWithFormat:@"face_%ld",(long)i];       //  [[NSUserDefaults standardUserDefaults] setInteger:value.integerValue forKey:faceKey]; // //    }     //设置美颜参数,范围是0-9 //    NSArray *beautyArr = //     @[@"磨皮数值",@"美白数值",@"红润数值"];      NSString *mopi =  @"7";//磨皮数值      NSString *white = @"7";//美白数值      NSString *hongrun = @"5";//红润数值     if (isTX) {         [self beautyLevel:mopi.intValue whitenessLevel:white.intValue ruddinessLevel:hongrun.intValue brightnessLevel:57];     } else {         [_beautyManager setBuffing:(mopi.intValue)*100/9];         [_beautyManager setSkinWhiting:(white.intValue)*100/9];//磨皮参数0到1         [_beautyManager setRuddiness:(hongrun.intValue)*100/9]; } ``` 在MHBeautyView.m里面注释掉下面的代码就可以设置美颜的默认值 ``` NSString *beautKey = [NSString stringWithFormat:@"beauty_%ld",(long)i]; NSInteger originalValue = model.originalValue.integerValue; [[NSUserDefaults standardUserDefaults] setInteger:originalValue forKey:beautKey]; ``` 在MHBeautyFaceView.m里面的 configureFaceData方法里面注释掉下面的代码就可以设置美型的默认值 ``` NSString *faceKey = [NSString stringWithFormat:@"face_%ld",(long)i]; NSInteger originalValue = model.originalValue.integerValue; [[NSUserDefaults standardUserDefaults] setInteger:originalValue forKey:faceKey]; ```