//This is used when an inspected recipe asset is saved public override void Save(UMAData.UMARecipe umaRecipe, UMAContext context) { if (recipeType == "Wardrobe") //Wardrobe Recipes can save the standard UMA way- they dont have WardrobeSets- although the recipe string wont have a packedRecipeType field { base.Save(umaRecipe, context); } else if (recipeType != "Standard") //this will just be for type DynamicCharacterAvatar- and WardrobeCollection if we add that { var packedRecipe = PackRecipeV2(umaRecipe); //DCSPackRecipe doesn't do any more work, it just gets the values from PackRecipeV2 that we need and discards the rest var packedRecipeToSave = new DCSPackRecipe(packedRecipe, this.name, recipeType, activeWardrobeSet); recipeString = JsonUtility.ToJson(packedRecipeToSave); } else //This will be Standard- this is 'backwards Compatible' and is also how the Recipe Editor saves 'backwardsCompatible' 'Standard' recipes when they are inspected { umaRecipe.MergeMatchingOverlays(); var packedRecipe = PackRecipeV2(umaRecipe); var packedRecipeToSave = new DCSUniversalPackRecipe(packedRecipe); //this gets us a recipe with all the standard stuff plus our extra fields //so now we can save the wardrobeSet into it if it existed if (activeWardrobeSet != null) { if (activeWardrobeSet.Count > 0) { packedRecipeToSave.wardrobeSet = activeWardrobeSet; } } recipeString = JsonUtility.ToJson(packedRecipeToSave); } }
/// <summary> /// This is used when an avatar asset, saved using the DCS Model, is loaded for editing in the Inspector /// </summary> /// <param name="dcsPackRecipe"></param> public DCSUniversalPackRecipe(DCSPackRecipe dcsPackRecipe) { //Debug.Log("Created universal model from DCSPackRecipe"); packedRecipeType = dcsPackRecipe.packedRecipeType; version = 2; slotsV2 = new PackedSlotDataV2[0]; //we need this otherwise the RecipeInspector doesn't show anything... race = dcsPackRecipe.race; fColors = dcsPackRecipe.characterColors.ToArray(); sharedColorCount = dcsPackRecipe.characterColors.Count; packedDna = dcsPackRecipe.dna; wardrobeSet = dcsPackRecipe.wardrobeSet; }