public override void Init(IAtomPlugin plugin) { base.Init(plugin); // Right side CreateChangeScreenButton("<b><</b> <i>Back</i>", MoreScreen.ScreenName); prefabFactory.CreateSpacer(); var keyframeCurrentPoseUI = prefabFactory.CreateButton("Keyframe pose (all on controllers)"); keyframeCurrentPoseUI.button.onClick.AddListener(() => KeyframeCurrentPose(true)); var keyframeCurrentPoseTrackedUI = prefabFactory.CreateButton("Keyframe pose (animated targets only)"); keyframeCurrentPoseTrackedUI.button.onClick.AddListener(() => KeyframeCurrentPose(false)); prefabFactory.CreateSpacer(); _bakeUI = prefabFactory.CreateButton("Bake animation (arm & record)"); _bakeUI.button.onClick.AddListener(() => Bake()); prefabFactory.CreateSpacer(); var removeAllKeyframesUI = prefabFactory.CreateButton("Remove all keyframes"); removeAllKeyframesUI.button.onClick.AddListener(() => RemoveAllKeyframes()); var reverseAnimationUI = prefabFactory.CreateButton("Reverse keyframes"); reverseAnimationUI.button.onClick.AddListener(() => ReverseAnimation()); }
public MontageController(DollmasterPlugin dm, PoseController poseController) : base(dm) { montagePath = new JSONStorableUrl("montagePath", DollmasterPlugin.VAMASUTRA_PATH); dm.RegisterUrl(montagePath); UIDynamicButton selectMontageFolderButton = dm.CreateButton("Select Montage Folder", true); selectMontageFolderButton.button.onClick.AddListener(() => { SuperController.singleton.directoryBrowserUI.defaultPath = SuperController.singleton.savesDir; SuperController.singleton.directoryBrowserUI.showDirs = true; SuperController.singleton.directoryBrowserUI.showFiles = false; SuperController.singleton.directoryBrowserUI.selectDirectory = true; SuperController.singleton.directoryBrowserUI.SetTextEntry(true); SuperController.singleton.directoryBrowserUI.Show((path) => { montagePath.SetVal(path); LoadMontagesFromPath(path); }); }); UIDynamicButton montageButton = ui.CreateButton("Random Montage", 200, 50); montageButton.button.onClick.AddListener(RandomMontage); montageButton.transform.Translate(0, 0.3f, 0, Space.Self); UI.ColorButton(montageButton, accessTextColor, accessButtonColor); poseButton = ui.CreateButton("Random Pose", 200, 50); poseButton.button.onClick.AddListener(RandomPose); poseButton.transform.Translate(0.3f, 0.3f, 0, Space.Self); UI.ColorButton(poseButton, accessTextColor, accessButtonColor); }
JSONStorableStringChooser BuildClipUI(int index) { NamedAudioClip clip = null; JSONStorableStringChooser chooser = new JSONStorableStringChooser("clip_" + index, GetClipIds(), null, "Choose Audio Clip", (string choice) => { clip = URLAudioClipManager.singleton.GetClip(choice); clips.Add(clip); clipCount.val = clips.Count; Debug.Log("updating choice " + choice); }); RegisterStringChooser(chooser); UIDynamicPopup popup = CreateScrollablePopup(chooser, true); UIDynamicButton remove = CreateButton("Remove Clip Above", true); remove.button.onClick.AddListener(() => { RemoveButton(remove); Destroy(popup.gameObject); clips.Remove(clip); clipCount.val = clips.Count; }); return(chooser); }
public void RegisterTab(string name, Transform tab) { UIDynamicButton tabButton = ui.CreateButton(name, 150, 80, tabLayout.transform); tabButton.buttonText.fontSize = 48; UI.ColorButton(tabButton, Color.white, new Color(0.5f, 0.8f, 0.4f)); }
public UIBindingRow(ViewModel model, Command command) { using (var tracker = TimingLogger.Track("UIBindingRow.ctor()")) { _model = model; _command = command; ActionName = command.Name; var binding = _model.GetKeyBinding(ActionName); tracker.Log("... after binding"); // checkbox on the left _checkboxStorable = new JSONStorableBool(ActionName, binding == null ? false : binding.Enabled, OnCheckboxHandler); _checkboxUi = _model.Plugin.CreateToggle(_checkboxStorable); _checkboxUi.labelText.text = command.DisplayName; _checkboxUi.labelText.resizeTextMaxSize = _checkboxUi.labelText.fontSize; _checkboxUi.labelText.resizeTextForBestFit = true; _checkboxUi.backgroundColor = Color.clear; tracker.Log("... after checkbox create"); var shortcutText = binding == null ? "" : binding.KeyChord.ToString(); _shortcutButtonUi = _model.Plugin.CreateButton(shortcutText, rightSide: true); _shortcutButtonUi.height = _checkboxUi.height; _shortcutButtonUi.button.onClick.AddListener(OnShortcutHandler); tracker.Log("... after button create"); } }
public override void Init(IAtomPlugin plugin, object arg) { base.Init(plugin, arg); CreateChangeScreenButton("<b><</b> <i>Back</i>", MoreScreen.ScreenName); prefabFactory.CreateSpacer(); _backupUI = prefabFactory.CreateButton("Backup"); _backupUI.button.onClick.AddListener(TakeBackup); _restoreUI = prefabFactory.CreateButton("Restore"); _restoreUI.button.onClick.AddListener(RestoreBackup); prefabFactory.CreateSpacer(); prefabFactory.CreateSlider(_reduceMaxFramesPerSecondJSON).valueFormat = "F1"; prefabFactory.CreateToggle(_averageToSnapJSON); prefabFactory.CreateToggle(_removeFlatSectionsKeyframes); prefabFactory.CreateToggle(_simplifyKeyframes); prefabFactory.CreateSlider(_reduceMinDistanceJSON).valueFormat = "F3"; prefabFactory.CreateSlider(_reduceMinRotationJSON).valueFormat = "F2"; prefabFactory.CreateSlider(_reduceMinFloatParamRangeRatioJSON).valueFormat = "F3"; _reduceUI = prefabFactory.CreateButton("Reduce"); _reduceUI.button.onClick.AddListener(Reduce); _restoreUI.button.interactable = _backup != null; if (_backup != null) { _restoreUI.label = $"Restore [{_backupTime}]"; } }
private void InitPlaybackButtons(Transform buttonPrefab) { var container = new GameObject("Playback"); container.transform.SetParent(transform, false); var gridLayout = container.AddComponent <HorizontalLayoutGroup>(); gridLayout.spacing = 4f; gridLayout.childForceExpandWidth = false; gridLayout.childControlWidth = true; var playAll = Instantiate(buttonPrefab, container.transform, false); playAll.GetComponent <UIDynamicButton>().label = "\u25B6 All"; playAll.GetComponent <UIDynamicButton>().button.onClick.AddListener(() => _animationEditContext.PlayAll()); playAll.GetComponent <LayoutElement>().preferredWidth = 0; playAll.GetComponent <LayoutElement>().flexibleWidth = 100; _playAll = playAll.GetComponent <UIDynamicButton>(); var playClip = Instantiate(buttonPrefab, container.transform, false); playClip.GetComponent <UIDynamicButton>().label = "\u25B6 Clip"; playClip.GetComponent <UIDynamicButton>().button.onClick.AddListener(() => _animationEditContext.PlayCurrentClip()); playClip.GetComponent <LayoutElement>().preferredWidth = 0; playClip.GetComponent <LayoutElement>().flexibleWidth = 100; _playClip = playClip.GetComponent <UIDynamicButton>(); var stop = Instantiate(buttonPrefab, container.transform, false); stop.GetComponent <UIDynamicButton>().label = "\u25A0 Stop"; stop.GetComponent <UIDynamicButton>().button.onClick.AddListener(() => { _animationEditContext.Stop(); }); stop.GetComponent <LayoutElement>().preferredWidth = 0; stop.GetComponent <LayoutElement>().flexibleWidth = 30; }
public void Init(MVRScript plugin, string mainScreen) { _mainScreenName = mainScreen; _backButton = plugin.CreateButton("< Back"); _backButton.button.onClick.AddListener(() => Show(mainScreen)); _backButton.height = 100f; }
protected UIDynamicButton CreateModuleButton(string name) { UIDynamicButton button = ui.CreateButton(name, 120, 80, moduleButtonsLayout.transform); UI.ColorButton(button, Color.white, new Color(0.77f, 0.64f, 0.26f)); return(button); }
private IEnumerator UpdateAnimButton(UIDynamicButton btn, AtomAnimationClip clip) { yield return(0); var playLabel = $" \u25B6 {clip.animationName}"; while (!_disposing) { if (!clip.playbackEnabled && !clip.playbackMainInLayer) { if (btn.label != playLabel) { btn.label = playLabel; } } else { btn.label = $" \u25A0 [time: {clip.clipTime:00.000}, weight: {Mathf.Round(clip.playbackBlendWeight * 100f):000}%]"; } for (var i = 0; i < 4; i++) { yield return(0); } } }
private void InitCustomUI() { var atomsToLinkUI = CreateScrollablePopup(_atomsToLink); atomsToLinkUI.popupPanelHeight = 800f; atomsToLinkUI.popup.onOpenPopupHandlers += () => _atomsToLink.choices = GetAtomsWithVamTimelinePlugin().ToList(); _linkButton = CreateButton("Link"); _linkButton.button.interactable = _atomsToLink.choices.Count > 0; _linkButton.button.onClick.AddListener(() => LinkAtom(_atomsToLink.val)); var resyncButton = CreateButton("Re-Sync Atom Plugins"); resyncButton.button.onClick.AddListener(() => { DestroyControlPanelContainer(); _mainLinkedAnimation = null; RestoreAtomsLink(_savedAtomsJSON.val); _atomsToLink.choices = GetAtomsWithVamTimelinePlugin().ToList(); }); CreateToggle(_autoPlayJSON, true); CreateToggle(_hideJSON, true); CreateToggle(_enableKeyboardShortcuts, true); }
private void InitFixMissingUI() { if (plugin.animation.Clips.Count <= 1) { return; } var clipList = current.AllTargets.Select(t => t.name).OrderBy(x => x); var otherList = plugin.animation.Clips.Where(c => c != current).SelectMany(c => c.AllTargets).Select(t => t.name).OrderBy(x => x).Distinct(); var ok = clipList.SequenceEqual(otherList); if (ok) { return; } UIDynamicButton enableAllTargetsUI = null; UIDynamic spacerUI = null; enableAllTargetsUI = plugin.CreateButton("Add All Other Animations' Targets", true); enableAllTargetsUI.button.onClick.AddListener(() => { EnableAllTargets(); plugin.RemoveButton(enableAllTargetsUI); plugin.RemoveSpacer(spacerUI); }); enableAllTargetsUI.buttonColor = Color.yellow; RegisterComponent(enableAllTargetsUI); spacerUI = CreateSpacer(true); }
private void InitRemoveUI() { _removeUI = prefabFactory.CreateButton("Remove selected"); _removeUI.buttonColor = Color.red; _removeUI.textColor = Color.white; _removeUI.button.onClick.AddListener(RemoveSelected); }
public UIDynamicButton CreateButton(GameObject parent, string name, float width = 100, float height = 80, int left = 0, int top = 0, Texture2D texture = null) { Transform button = GameObject.Instantiate <Transform>(_context.manager.configurableButtonPrefab); button.transform.localPosition = new Vector3(left, top, 0.0f); button.SetParent(parent.transform, false); RectTransform rt = button.GetComponent <RectTransform>(); rt.sizeDelta = new Vector2(width, height); RectTransform parentRectTransform = button.GetComponent <RectTransform>(); SetAnchors(parent, button.gameObject, "topleft", left, top); UIDynamicButton uiButton = button.GetComponent <UIDynamicButton>(); uiButton.label = name; if (texture != null) { Sprite mySprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), 100.0f); uiButton.buttonImage.sprite = mySprite; } return(uiButton); }
UIDynamicButton ConfigButton(UIDynamicButton button) { button.buttonColor = DollMaker.BG_COLOR; button.textColor = DollMaker.FG_COLOR; button.buttonText.fontSize = 30; return(button); }
public void Bind(IAtomPlugin plugin, string defaultScreen = null) { _plugin = plugin; _leftPanelPrefabFactory = leftPanel.AddComponent <VamPrefabFactory>(); _leftPanelPrefabFactory.plugin = plugin; _controlPanel = CreateControlPanel(leftPanel); _controlPanel.Bind(plugin); InitClipboardUI(); InitChangeCurveTypeUI(); _curves = InitCurvesUI(); tabs.Add(AnimationsScreen.ScreenName); tabs.Add(TargetsScreen.ScreenName); tabs.Add(EditAnimationScreen.ScreenName); tabs.Add(MoreScreen.ScreenName); _expandButton = tabs.Add("Collapse >"); InitToggleRightPanelButton(_expandButton); tabs.onTabSelected.AddListener(screenName => { screensManager.ChangeScreen(screenName); Expand(true); }); screensManager = InitScreensManager(rightPanel); screensManager.onScreenChanged.AddListener(screenName => tabs.Select(screenName)); screensManager.Bind(plugin, defaultScreen); }
protected override void CreateCustomUI(IUIBuilder builder) { TargetChooser = builder.CreateScrollablePopup("MotionSource:PhysicsLink:Target", "Select Target", null, null, TargetChooserCallback, true); CaptureOriginButton = builder.CreateButton("Capture Origin", CaptureOriginCallback, true); FindAtoms(); }
public override void Init(IAtomPlugin plugin, object arg) { base.Init(plugin, arg); // Right side CreateChangeScreenButton("<b><</b> <i>Back</i>", MoreScreen.ScreenName); prefabFactory.CreateSpacer(); _resizeAnimationJSON = new JSONStorableBool("Resize animation to mocap length", current.targetControllers.Count == 0 || _lastResizeAnimation, val => _lastResizeAnimation = val); prefabFactory.CreateToggle(_resizeAnimationJSON); _importRecordedUI = prefabFactory.CreateButton("Import recorded animation (mocap)"); _importRecordedUI.button.onClick.AddListener(ImportRecorded); prefabFactory.CreateSpacer(); _playAndRecordControllersUI = prefabFactory.CreateButton(_recordingControllersCoroutine != null ? _recordingLabel : _startRecordControllersLabel); _playAndRecordControllersUI.button.onClick.AddListener(PlayAndRecordControllers); prefabFactory.CreateSpacer(); CreateChangeScreenButton("<i>Go to <b>reduce</b> screen...</i>", ReduceScreen.ScreenName); prefabFactory.CreateSpacer(); var clearMocapUI = prefabFactory.CreateButton("Clear atom's mocap"); clearMocapUI.button.onClick.AddListener(ClearMocapData); clearMocapUI.buttonColor = Color.yellow; animationEditContext.onTargetsSelectionChanged.AddListener(OnTargetsSelectionChanged); OnTargetsSelectionChanged(); }
public override void Init(IAtomPlugin plugin) { base.Init(plugin); CreateChangeScreenButton("<b><</b> <i>Back</i>", MoreScreen.ScreenName); InitSelectionUI(); prefabFactory.CreateSpacer(); InitBulkClipboardUI(); prefabFactory.CreateSpacer(); InitChangeCurveUI(); prefabFactory.CreateSpacer(); InitDeleteUI(); prefabFactory.CreateSpacer(); _offsetControllerUI = prefabFactory.CreateButton(_offsetting ? _offsetControllerUIOfsettingLabel : _offsetControllerUILabel); _offsetControllerUI.button.onClick.AddListener(() => OffsetController()); // Init _startJSON.valNoCallback = 0f; _endJSON.valNoCallback = current.animationLength; current.onTargetsSelectionChanged.AddListener(OnTargetsSelectionChanged); OnTargetsSelectionChanged(); }
public Node(UI ui, AnimationPattern ap) { this.ap = ap; this.ui = ui; connectButton = ui.CreateButton("Connect", 100, 50); disconnectButton = ui.CreateButton("Disconnect All", 100, 50); disconnectButton.transform.SetParent(connectButton.transform); disconnectButton.transform.Translate(0, -0.08f, 0); UIDynamicButton playButton = ui.CreateButton("Play", 100, 50); playButton.transform.SetParent(connectButton.transform); playButton.transform.Translate(0, -0.16f, 0); playButton.button.onClick.AddListener(() => { ap.SetBoolParamValue("on", true); if (ap.GetBoolParamValue("pause") == true) { playButton.label = "Stop"; ap.ResetAnimation(); } else { playButton.label = "Play"; ap.SetBoolParamValue("on", false); } ap.TogglePause(); }); }
private void InitDeleteLayerUI() { _deleteLayerUI = prefabFactory.CreateButton("Delete layer"); _deleteLayerUI.button.onClick.AddListener(DeleteLayer); _deleteLayerUI.buttonColor = Color.red; _deleteLayerUI.textColor = Color.white; }
private void InitDeleteAnimationsUI() { _deleteAnimationUI = prefabFactory.CreateButton("Delete animation"); _deleteAnimationUI.button.onClick.AddListener(DeleteAnimation); _deleteAnimationUI.buttonColor = Color.red; _deleteAnimationUI.textColor = Color.white; }
public virtual void CreateUI(IUIBuilder builder) { _group = new UIGroup(builder); var visible = false; var group = new UIGroup(_group); MainTitle = _group.CreateButton("Main", () => group.SetVisible(visible = !visible), new Color(0.3f, 0.3f, 0.3f), Color.white, true); SmoothingSlider = group.CreateSlider("Plugin:Smoothing", "Smoothing (%)", 0.1f, 0.0f, 0.99f, true, true, true, "P0"); ReferenceLengthScaleSlider = group.CreateSlider("Device:ReferenceLengthScale", "Reference Length (%)", 1.0f, 0, 3, true, true, true, "P0"); ReferenceRadiusScaleSlider = group.CreateSlider("Device:ReferenceRadiusScale", "Reference Radius (%)", 3.0f, 0, 5, true, true, true, "P0"); group.SetVisible(false); CreateL0AxisUI(_group); CreateL1AxisUI(_group); CreateL2AxisUI(_group); CreateR0AxisUI(_group); CreateR1AxisUI(_group); CreateR2AxisUI(_group); CreateV0AxisUI(_group); CreateA0AxisUI(_group); CreateA1AxisUI(_group); CreateA2AxisUI(_group); }
public void AddControls() { spacer = synthia.CreateSpacer(); spacer.height = 24; // TODO id just so happens to match here // perhaps actually pass in the id here and let animation hold on to it? playButton = synthia.CreateButton("Play " + id); playButton.button.onClick.AddListener(() => { synthia.ForcePlayAnimation(this); }); playButton.buttonColor = new Color(.3f, 0.9f, 0.33f); idLabel = synthia.CreateTextField(new JSONStorableString("id", id)); idLabel.height = 4; loopToggle = synthia.CreateToggle(loopStorable); restartOnAnimationChangeToggle = synthia.CreateToggle(restartOnAnimationChangeStorable); startFrameSlider = synthia.CreateSlider(startFrameStorable); endFrameSlider = synthia.CreateSlider(endFrameStorable); rootMotionXZToggle = synthia.CreateToggle(rootMotionXZStorable); rootMotionYToggle = synthia.CreateToggle(rootMotionYStorable); removeButton = synthia.CreateButton("Remove " + id); removeButton.button.onClick.AddListener(() => { synthia.animations.Remove(id); RemoveControls(); }); removeButton.buttonColor = new Color(.8f, 0.3f, 0.2f); }
public void CreateUI() { pluginLabelJSON.val = PluginName; _builder = new UIBuilder(); _group = new UIGroup(_builder); _group.BlacklistStorable("Device Report"); PluginTitle = _group.CreateDisabledButton("Plugin", new Color(0.3f, 0.3f, 0.3f), Color.white); PresetButtonGroup = _group.CreateHorizontalGroup(510, 50, new Vector2(10, 0), 3, idx => _group.CreateButtonEx()); var saveButton = PresetButtonGroup.items[0].GetComponent <UIDynamicButton>(); saveButton.buttonText.fontSize = 25; saveButton.label = "Save Config"; saveButton.buttonColor = new Color(0.309f, 1f, 0.039f) * 0.8f; saveButton.textColor = Color.white; saveButton.button.onClick.AddListener(SaveConfigCallback); var loadButton = PresetButtonGroup.items[1].GetComponent <UIDynamicButton>(); loadButton.buttonText.fontSize = 25; loadButton.label = "Load Config"; loadButton.buttonColor = new Color(1f, 0.168f, 0.039f) * 0.8f; loadButton.textColor = Color.white; loadButton.button.onClick.AddListener(LoadConfigCallback); var defaultButton = PresetButtonGroup.items[2].GetComponent <UIDynamicButton>(); defaultButton.buttonText.fontSize = 25; defaultButton.label = "As Default"; defaultButton.buttonColor = new Color(1f, 0.870f, 0.039f) * 0.8f; defaultButton.textColor = Color.white; defaultButton.button.onClick.AddListener(SaveDefaultConfigCallback); OutputTargetSettings = new OutputTargetSettings(t => _outputTarget = t); OutputTargetSettings.CreateUI(_group); var debugGroup = new UIGroup(_group); var visible = false; DebugTitle = _group.CreateButton("Debug", () => debugGroup.SetVisible(visible = !visible), new Color(0.3f, 0.3f, 0.3f), Color.white); DebugDrawEnableToggle = debugGroup.CreateToggle("Plugin:DebugDrawEnable", "Enable Debug", false); DeviceReportText = debugGroup.CreateTextField("Device Report", "", 320); DeviceReportText.text.font = Font.CreateDynamicFontFromOSFont("Consolas", 24); DeviceReportText.text.fontSize = 24; debugGroup.SetVisible(false); MotionSourceTitle = _group.CreateDisabledButton("Motion Source", new Color(0.3f, 0.3f, 0.3f), Color.white); MotionSourceChooser = _group.CreatePopup("Plugin:MotionSourceChooser", "Select motion source", new List <string> { "Male + Female", "Asset + Female", "D***o + Female", "Animation Pattern", "Range Test" }, "Male + Female", MotionSourceChooserCallback); DeviceChooserCallback("T-code"); MotionSourceChooserCallback("Male + Female"); }
public override void Init() { try { disableUpdate = true; pluginLabelJSON.val = "Wardrobe v2.2.1 (by VamDazzler)"; // Obtain our person if (containingAtom == null) { SuperController.LogError("Please add this plugin to a PERSON atom."); throw new Exception("Halting Wardrobe due to de-Atom-ization"); } // Create the clothing items drop-down clothingItems = new JSONStorableStringChooser("clothing", EMPTY_CHOICES, null, "Clothing Item"); UIDynamicPopup clothingSelector = CreateScrollablePopup(clothingItems); // Create the outfit selection drop-down outfitNames = new JSONStorableStringChooser("outfit", EMPTY_CHOICES, null, "Outfit"); UIDynamicPopup outfitSelector = CreateScrollablePopup(outfitNames); outfitSelector.popupPanelHeight = 900f; RectTransform panel = outfitSelector.popup.popupPanel; panel.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 400f); panel.pivot = new Vector2(0.35f, 1.0f); // Create the slot in which all changed textures are stored. storedOutfits = new StorableReplacements(); RegisterString(storedOutfits); // Action to perform replacement applyButton = CreateButton("Apply"); applyButton.button.onClick.AddListener(ApplyOutfitCallback); // Force reload forceReloadButton = CreateButton("Refresh Textures"); forceReloadButton.button.onClick.AddListener(ForceReloadCallback); // Create a dump button UIDynamic align = CreateSpacer(true); align.height = 25; dumpButton = CreateButton("Dump OBJ and MTL files - look in root", true); if (dumpButton != null) { dumpButton.button.onClick.AddListener(DumpButtonCallback); dumpButton.button.interactable = false; } // Create the material listing window materialList = new JSONStorableString("matlist", ""); UIDynamicTextField matListTextField = CreateTextField(materialList, true); matListTextField.height = 400f; } catch (Exception ex) { SuperController.LogError($"Could not initialize Wardrobe {ex}"); } }
public override void Init() { try { _targetControllerJSON = new JSONStorableStringChooser("Target Controller", containingAtom.freeControllers.Select(fc => fc.name).ToList(), containingAtom.linkableRigidbodies.FirstOrDefault()?.name, "Target Controller", OnTargetControllerUpdated); RegisterStringChooser(_targetControllerJSON); CreateScrollablePopup(_targetControllerJSON, false).popupPanelHeight = 1000; _parentAtomJSON = new JSONStorableStringChooser("Parent Atom", _emptyStringsList, null, "Parent Atom", SyncDropDowns); RegisterStringChooser(_parentAtomJSON); CreateScrollablePopup(_parentAtomJSON, false).popupPanelHeight = 900; _parentRigidbodyJSON = new JSONStorableStringChooser("Parent Rigidbody", _emptyStringsList, null, "Parent Rigidbody", OnParentRigidbodyUpdated); RegisterStringChooser(_parentRigidbodyJSON); CreateScrollablePopup(_parentRigidbodyJSON, false).popupPanelHeight = 800; _parentTransformJSON = new JSONStorableStringChooser("Parent Transform", new List <string> { _both, _rotationOnly, _positionOnly, _none }, _both, "Parent Transform"); RegisterStringChooser(_parentTransformJSON); CreateScrollablePopup(_parentTransformJSON, false).popupPanelHeight = 300; _weightJSON = new JSONStorableFloat("Weight", 0f, (float val) => _scaledWeight = ExponentialScale(val, 0.1f, 1f), 0f, 1f, true); RegisterFloat(_weightJSON); CreateSlider(_weightJSON, true); _posXJSON = new JSONStorableFloat("PosX", 0f, OnOffsetUpdated, -10f, 10f, false); RegisterFloat(_posXJSON); _posYJSON = new JSONStorableFloat("PosY", 0f, OnOffsetUpdated, -10f, 10f, false); RegisterFloat(_posYJSON); _posZJSON = new JSONStorableFloat("PosZ", 0f, OnOffsetUpdated, -10f, 10f, false); RegisterFloat(_posZJSON); _rotXJSON = new JSONStorableFloat("RotX", 0f, OnOffsetUpdated, -10f, 10f, false); RegisterFloat(_rotXJSON); _rotYJSON = new JSONStorableFloat("RotY", 0f, OnOffsetUpdated, -10f, 10f, false); RegisterFloat(_rotYJSON); _rotZJSON = new JSONStorableFloat("RotZ", 0f, OnOffsetUpdated, -10f, 10f, false); RegisterFloat(_rotZJSON); _rotWJSON = new JSONStorableFloat("RotW", 0f, OnOffsetUpdated, -10f, 10f, false); RegisterFloat(_rotWJSON); var recordJSON = new JSONStorableAction("Record Current Position", OnRecordCurrentPosition); RegisterAction(recordJSON); _recordButton = CreateButton("Record current position"); _recordButton.button.onClick.AddListener(OnRecordCurrentPosition); _recordButton.button.interactable = false; OnTargetControllerUpdated(_targetControllerJSON.val); SyncDropDowns(_parentAtomJSON.val); OnParentRigidbodyUpdated(_parentRigidbodyJSON.val); } catch (Exception e) { SuperController.LogError($"{nameof(RubberLeash)}.{nameof(Init)}: {e}"); } }
private void InitFloatParamsUI(bool rightSide) { var storables = GetStorablesWithFloatParams().ToList(); _addStorableListJSON = new JSONStorableStringChooser("Animate Storable", storables, storables.Contains("geometry") ? "geometry" : storables.FirstOrDefault(), "Animate Storable", (string name) => { RefreshStorableFloatsList(); _addParamListJSON.valNoCallback = _addParamListJSON.choices.FirstOrDefault() ?? ""; }) { isStorable = false }; RegisterStorable(_addStorableListJSON); _addStorableListUI = plugin.CreateScrollablePopup(_addStorableListJSON, rightSide); _addStorableListUI.popupPanelHeight = 700f; _addStorableListUI.popup.onOpenPopupHandlers += RefreshStorablesList; RegisterComponent(_addStorableListUI); _addParamListJSON = new JSONStorableStringChooser("Animate Param", new List <string> { "" }, "", "Animate Param") { isStorable = false }; RegisterStorable(_addParamListJSON); _addParamListUI = plugin.CreateScrollablePopup(_addParamListJSON, rightSide); _addParamListUI.popup.onOpenPopupHandlers += RefreshStorableFloatsList; _addParamListUI.popupPanelHeight = 600f; RegisterComponent(_addParamListUI); _toggleFloatParamUI = plugin.CreateButton("Add Param", rightSide); _toggleFloatParamUI.button.onClick.AddListener(() => AddAnimatedFloatParam()); RegisterComponent(_toggleFloatParamUI); RefreshStorableFloatsList(); _addParamListJSON.valNoCallback = _addParamListJSON.choices.FirstOrDefault() ?? ""; var character = plugin.containingAtom.GetComponentInChildren <DAZCharacterSelector>(); if (character != null) { var makeMorphsAnimatableUI = plugin.CreateButton("<i>Add morphs (Make Animatable)</i>", rightSide); RegisterComponent(makeMorphsAnimatableUI); makeMorphsAnimatableUI.button.onClick.AddListener(() => { var selector = plugin.containingAtom.gameObject.GetComponentInChildren <UITabSelector>(); if (character.selectedCharacter.isMale) { selector.SetActiveTab("Male Morphs"); } else { selector.SetActiveTab("Female Morphs"); } }); } }
public void CreateSelectButton() { selectButton = script.CreateButton("Select: " + t, false); selectButton.button.onClick.AddListener(() => { script.SelectStep(this); }); selectButton.buttonColor = Color.white; }
//IEnumerator OffsetMaterial(Material mat, float amount){ // yield return new WaitForEndOfFrame(); // mat.SetTextureOffset("_MainTex", new Vector2(amount, 0)); // mat.mainTextureOffset = new Vector2(amount, 0); //} public UIDynamicButton CreateClickablePanel(GameObject parent, Color normalColor, Color highlightColor, int width, int height, int offsetX = 0, int offsetY = 0, Texture2D texture = null) { UIDynamicButton localPanel = CreateButton(parent, "", width, height, offsetX, offsetY, normalColor, highlightColor, Color.white, texture); RectTransform r = localPanel.GetComponent <RectTransform>(); r.sizeDelta = new Vector2(width, height); SetAnchors(parent, localPanel.gameObject, "bottom", offsetX, offsetY); return(localPanel); }