/// <summary>
        /// When maker is not loaded, but is loading, wait for it before setting belly sliders (Only needed on maker first load)
        /// </summary>
        internal IEnumerator WaitForMakerLoad()
        {
            while (!MakerAPI.InsideAndLoaded)
            {
                yield return(new WaitForSeconds(0.01f));
            }

            if (PregnancyPlusPlugin.DebugLog.Value)
            {
                PregnancyPlusPlugin.Logger.LogInfo($" WaitForMakerLoad done, setting initial sliders");
            }
            //Restore sliders to current state
            PregnancyPlusGui.OnRestore(PregnancyPlusGui.sliders, GetCardData());
        }
Example #2
0
        internal void Start()
        {
            Logger            = base.Logger;
            DebugTools.logger = Logger;
            errorCodeCtrl     = new ErrorCodeController(Logger, PregnancyPlusPlugin.DebugLog != null ? PregnancyPlusPlugin.DebugLog.Value : false);
            //Initilize the Bepinex F1 ConfigurationManager options
            PluginConfig();

            //Attach the mesh inflation logic to each character
            CharacterApi.RegisterExtraBehaviour <PregnancyPlusCharaController>(GUID);

            var hi = new Harmony(GUID);

            Hooks.InitHooks(hi);

            //Set up studio/malker GUI sliders
            PregnancyPlusGui.InitStudio(hi, this);
            PregnancyPlusGui.InitMaker(hi, this);
        }
        /// <summary>
        /// On user button click. Create blendshape from current belly state.  Add it to infConfig so it will be saved to char card if the user chooses save scene
        /// </summary>
        /// <param name="temporary">If Temporary, the blendshape will not be saved to char card</param>
        /// <returns>boolean true if any blendshapes were created</returns>
        internal bool OnCreateBlendShapeSelected(bool temporary = false)
        {
            if (PregnancyPlusPlugin.DebugLog.Value)
            {
                PregnancyPlusPlugin.Logger.LogInfo($" ");
            }
            if (PregnancyPlusPlugin.DebugLog.Value)
            {
                PregnancyPlusPlugin.Logger.LogInfo($" OnCreateBlendShapeSelected ");
            }

            var meshBlendShapes = new List <MeshBlendShape>();

            meshWithBlendShapes = new List <SkinnedMeshRenderer>();

            //Get all cloth renderes and attempt to create blendshapes from preset inflatedVerticies
            var clothRenderers = PregnancyPlusHelper.GetMeshRenderers(ChaControl.objClothes);

            meshBlendShapes = LoopAndCreateBlendShape(clothRenderers, meshBlendShapes, true);

            //do the same for body meshs
            var bodyRenderers = PregnancyPlusHelper.GetMeshRenderers(ChaControl.objBody);

            meshBlendShapes = LoopAndCreateBlendShape(bodyRenderers, meshBlendShapes);

            //Save any meshBlendShapes to card
            if (!temporary)
            {
                AddBlendShapesToData(meshBlendShapes);
            }

            //Reset belly size to 0 so the blendshape can be used with out interference
            PregnancyPlusGui.ResetSlider(PregnancyPlusGui.inflationSize, 0);

            //Append the smrs that have new blendspahes to the GUI to be seen
            blendShapeGui.OnSkinnedMeshRendererBlendShapesCreated(meshWithBlendShapes);

            return(meshBlendShapes.Count > 0);
        }