/// <summary> /// Add a new custom category to the Anim > CurrentState tab in the studio top-left menu. /// Can use this at any point. Always returns null outside of studio. /// If the name is empty or null, the Misc/Other category is returned. /// </summary> public static CurrentStateCategory GetOrCreateCurrentStateCategory(string name) { if (!InsideStudio) { KoikatuAPI.Logger.LogDebug("Tried to run StudioAPI.CreateCurrentStateCategory outside of studio!"); return(null); } if (string.IsNullOrEmpty(name)) { name = "Misc/Other"; } var existing = _customCurrentStateCategories.FirstOrDefault(x => x.CategoryName == name); if (existing != null) { return(existing); } var newCategory = new CurrentStateCategory(name); if (StudioLoaded) { CreateCategory(newCategory); } _customCurrentStateCategories.Add(newCategory); return(newCategory); }
private static void CreateCategory(CurrentStateCategory category) { if (category == null) { throw new ArgumentNullException(nameof(category)); } if (_customStateRoot == null) { _customStateRoot = GameObject.Find("StudioScene/Canvas Main Menu/02_Manipulate/00_Chara/01_State/Viewport/Content"); } category.CreateCategory(_customStateRoot); }
/// <summary> /// Add a new custom category to the Anim > CurrentState tab in the studio top-left menu. /// Can use this at any point. /// </summary> public static void CreateCurrentStateCategory(CurrentStateCategory category) { if (!InsideStudio) { Logger.Log(LogLevel.Warning, "[StudioAPI] Tried to run CreateCurrentStateCategory outside of studio!"); return; } if (_studioLoaded) { CreateCategory(category); } _customCurrentStateCategories.Add(category); }
public static void CreateCurrentStateCategory(CurrentStateCategory category) { if (category == null) { throw new ArgumentNullException(nameof(category)); } if (!InsideStudio) { KoikatuAPI.Logger.LogDebug("Tried to run StudioAPI.CreateCurrentStateCategory outside of studio!"); return; } if (StudioLoaded) { CreateCategory(category); } _customCurrentStateCategories.Add(category); }
/// <summary> /// Add a new custom category to the Anim > CurrentState tab in the studio top-left menu. /// Can use this at any point. /// </summary> public static void CreateCurrentStateCategory(CurrentStateCategory category) { if (category == null) { throw new ArgumentNullException(nameof(category)); } if (!InsideStudio) { Logger.Log(LogLevel.Debug, "[StudioAPI] Tried to run CreateCurrentStateCategory outside of studio!"); return; } if (_studioLoaded) { CreateCategory(category); } _customCurrentStateCategories.Add(category); }
private static void CreateCategory(CurrentStateCategory category) { category.CreateCategory(GameObject.Find("StudioScene/Canvas Main Menu/02_Manipulate/00_Chara/01_State/Viewport/Content")); }
private static void RegisterStudioControls() { cat = StudioAPI.GetOrCreateCurrentStateCategory("Pregnancy +"); cat.AddControl(new CurrentStateCategorySwitch("Reset P+ Shape", c => { return(false); })) .Value.Subscribe(f => { if (f == false) { return; } ResetAllSliders(); }); cat.AddControl(new CurrentStateCategorySwitch("Restore Last P+ Shape", c => { return(false); })) .Value.Subscribe(f => { if (f == false) { return; } if (PregnancyPlusPlugin.lastBellyState.HasAnyValue()) { RestoreSliders(PregnancyPlusPlugin.lastBellyState); } }); cat.AddControl(new CurrentStateCategorySwitch(blendshapeText, c => { return(false); })) .Value.Subscribe(f => { if (f == false) { return; } //Open blendshape GUI on click foreach (var ctrl in StudioAPI.GetSelectedControllers <PregnancyPlusCharaController>()) { ctrl.OnOpenBlendShapeSelected(); } }); cat.AddControl(new CurrentStateCategorySlider(inflationSize, c => { var ctrl = GetCharCtrl(c); return(ctrl != null ? ctrl.infConfig.inflationSize : 0); }, SliderRange.inflationSize[0], SliderRange.inflationSize[1] )) .Value.Subscribe(f => { foreach (var ctrl in StudioAPI.GetSelectedControllers <PregnancyPlusCharaController>()) { if (ctrl.infConfig.inflationSize == f) { continue; } ctrl.infConfig.inflationSize = f; ctrl.MeshInflate(); } }); cat.AddControl(new CurrentStateCategorySlider(inflationMultiplier, c => { var ctrl = GetCharCtrl(c); return(ctrl != null ? ctrl.infConfig.inflationMultiplier: 0); }, SliderRange.inflationMultiplier[0], SliderRange.inflationMultiplier[1] )) .Value.Subscribe(f => { foreach (var ctrl in StudioAPI.GetSelectedControllers <PregnancyPlusCharaController>()) { if (ctrl.infConfig.inflationMultiplier == f) { continue; } ctrl.infConfig.inflationMultiplier = f; ctrl.MeshInflate(); } }); cat.AddControl(new CurrentStateCategorySlider(inflationRoundness, c => { var ctrl = GetCharCtrl(c); return(ctrl != null ? ctrl.infConfig.inflationRoundness: 0); }, SliderRange.inflationRoundness[0] * scaleLimits, SliderRange.inflationRoundness[1] * scaleLimits )) .Value.Subscribe(f => { foreach (var ctrl in StudioAPI.GetSelectedControllers <PregnancyPlusCharaController>()) { if (ctrl.infConfig.inflationRoundness == f) { continue; } ctrl.infConfig.inflationRoundness = f; ctrl.MeshInflate(); } }); cat.AddControl(new CurrentStateCategorySlider(inflationMoveY, c => { var ctrl = GetCharCtrl(c); return(ctrl != null ? ctrl.infConfig.inflationMoveY: 0); }, SliderRange.inflationMoveY[0] * scaleLimits, SliderRange.inflationMoveY[1] * scaleLimits )) .Value.Subscribe(f => { foreach (var ctrl in StudioAPI.GetSelectedControllers <PregnancyPlusCharaController>()) { if (ctrl.infConfig.inflationMoveY == f) { continue; } ctrl.infConfig.inflationMoveY = f; ctrl.MeshInflate(); } }); cat.AddControl(new CurrentStateCategorySlider(inflationMoveZ, c => { var ctrl = GetCharCtrl(c); return(ctrl != null ? ctrl.infConfig.inflationMoveZ: 0); }, SliderRange.inflationMoveZ[0] * scaleLimits, SliderRange.inflationMoveZ[1] * scaleLimits )) .Value.Subscribe(f => { foreach (var ctrl in StudioAPI.GetSelectedControllers <PregnancyPlusCharaController>()) { if (ctrl.infConfig.inflationMoveZ == f) { continue; } ctrl.infConfig.inflationMoveZ = f; ctrl.MeshInflate(); } }); cat.AddControl(new CurrentStateCategorySlider(inflationStretchX, c => { var ctrl = GetCharCtrl(c); return(ctrl != null ? ctrl.infConfig.inflationStretchX: 0); }, SliderRange.inflationStretchX[0] * scaleLimits, SliderRange.inflationStretchX[1] * scaleLimits )) .Value.Subscribe(f => { foreach (var ctrl in StudioAPI.GetSelectedControllers <PregnancyPlusCharaController>()) { if (ctrl.infConfig.inflationStretchX == f) { continue; } ctrl.infConfig.inflationStretchX = f; ctrl.MeshInflate(); } }); cat.AddControl(new CurrentStateCategorySlider(inflationStretchY, c => { var ctrl = GetCharCtrl(c); return(ctrl != null ? ctrl.infConfig.inflationStretchY: 0); }, SliderRange.inflationStretchY[0] * scaleLimits, SliderRange.inflationStretchY[1] * scaleLimits )) .Value.Subscribe(f => { foreach (var ctrl in StudioAPI.GetSelectedControllers <PregnancyPlusCharaController>()) { if (ctrl.infConfig.inflationStretchY == f) { continue; } ctrl.infConfig.inflationStretchY = f; ctrl.MeshInflate(); } }); cat.AddControl(new CurrentStateCategorySlider(inflationShiftY, c => { var ctrl = GetCharCtrl(c); return(ctrl != null ? ctrl.infConfig.inflationShiftY: 0); }, SliderRange.inflationShiftY[0] * scaleLimits, SliderRange.inflationShiftY[1] * scaleLimits )) .Value.Subscribe(f => { foreach (var ctrl in StudioAPI.GetSelectedControllers <PregnancyPlusCharaController>()) { if (ctrl.infConfig.inflationShiftY == f) { continue; } ctrl.infConfig.inflationShiftY = f; ctrl.MeshInflate(); } }); cat.AddControl(new CurrentStateCategorySlider(inflationShiftZ, c => { var ctrl = GetCharCtrl(c); return(ctrl != null ? ctrl.infConfig.inflationShiftZ: 0); }, SliderRange.inflationShiftZ[0] * scaleLimits, SliderRange.inflationShiftZ[1] * scaleLimits )) .Value.Subscribe(f => { foreach (var ctrl in StudioAPI.GetSelectedControllers <PregnancyPlusCharaController>()) { if (ctrl.infConfig.inflationShiftZ == f) { continue; } ctrl.infConfig.inflationShiftZ = f; ctrl.MeshInflate(); } }); cat.AddControl(new CurrentStateCategorySlider(inflationTaperY, c => { var ctrl = GetCharCtrl(c); return(ctrl != null ? ctrl.infConfig.inflationTaperY: 0); }, SliderRange.inflationTaperY[0] * scaleLimits, SliderRange.inflationTaperY[1] * scaleLimits )) .Value.Subscribe(f => { foreach (var ctrl in StudioAPI.GetSelectedControllers <PregnancyPlusCharaController>()) { if (ctrl.infConfig.inflationTaperY == f) { continue; } ctrl.infConfig.inflationTaperY = f; ctrl.MeshInflate(); } }); cat.AddControl(new CurrentStateCategorySlider(inflationTaperZ, c => { var ctrl = GetCharCtrl(c); return(ctrl != null ? ctrl.infConfig.inflationTaperZ: 0); }, SliderRange.inflationTaperZ[0] * scaleLimits, SliderRange.inflationTaperZ[1] * scaleLimits )) .Value.Subscribe(f => { foreach (var ctrl in StudioAPI.GetSelectedControllers <PregnancyPlusCharaController>()) { if (ctrl.infConfig.inflationTaperZ == f) { continue; } ctrl.infConfig.inflationTaperZ = f; ctrl.MeshInflate(); } }); cat.AddControl(new CurrentStateCategorySlider(inflationClothOffset, c => { var ctrl = GetCharCtrl(c); return(ctrl != null ? ctrl.infConfig.inflationClothOffset: 0); }, SliderRange.inflationClothOffset[0] * scaleLimits, SliderRange.inflationClothOffset[1] * scaleLimits )) .Value.Subscribe(f => { foreach (var ctrl in StudioAPI.GetSelectedControllers <PregnancyPlusCharaController>()) { if (ctrl.infConfig.inflationClothOffset == f) { continue; } ctrl.infConfig.inflationClothOffset = f; ctrl.MeshInflate(); } }); cat.AddControl(new CurrentStateCategorySlider(inflationFatFold, c => { var ctrl = GetCharCtrl(c); return(ctrl != null ? ctrl.infConfig.inflationFatFold: 0); }, SliderRange.inflationFatFold[0], SliderRange.inflationFatFold[1] )) .Value.Subscribe(f => { foreach (var ctrl in StudioAPI.GetSelectedControllers <PregnancyPlusCharaController>()) { if (ctrl.infConfig.inflationFatFold == f) { continue; } ctrl.infConfig.inflationFatFold = f; ctrl.MeshInflate(); } }); }