public override void Init()
        {
            try
            {
                JSONStorable js = containingAtom.GetStorableByID("geometry");
                if (js != null)
                {
                    DAZCharacterSelector       dcs     = js as DAZCharacterSelector;
                    GenerateDAZMorphsControlUI morphUI = dcs.morphsControlUI;
                    if (morphUI != null)
                    {
                        stomachMorph   = morphUI.GetMorphByDisplayName("Breath1");
                        mouthMorph     = morphUI.GetMorphByDisplayName("Mouth Open");
                        nosePinchMorph = morphUI.GetMorphByDisplayName("Nose Pinch");
                        noseFlareMorph = morphUI.GetMorphByDisplayName("Nostrils Flare");
                    }
                }

                headAudio       = containingAtom.GetStorableByID("HeadAudioSource");
                chestController = containingAtom.GetStorableByID("chestControl") as FreeControllerV3;

                SetupUI();

                if (chestController != null)
                {
                    chestController.jointRotationDriveSpring = chestSpring.val;
                    chestController.jointRotationDriveDamper = 1.0f;
                }

                List <BreathEntry> tmp = new List <BreathEntry>();
                for (int i = 0; i < breathEntries.Length; ++i)
                {
                    if (!breathEntries[i].moan)
                    {
                        tmp.Add(breathEntries[i]);
                    }
                }
                breathEntriesNoMoan = tmp.ToArray();

                breatheNeedInit = true;

                float v     = variance.val * (breathEntries.Length - 1);
                float bi    = breatheIntensity * (breathEntries.Length - 1);
                float min   = Mathf.Max(bi - v - 1.0f, -0.5f);
                float max   = Mathf.Min(bi + v + 1.0f, breathEntries.Length - 0.5f);
                int   index = Mathf.RoundToInt(UnityEngine.Random.Range(min, max));
                breatheIndex = Mathf.Clamp(index, 0, breathEntries.Length - 1);

                breatheCycle     = 0.0f;
                breatheIntensity = intensity.val;
                breathePower     = UnityEngine.Random.Range(0.8f, 1.2f);
                breatheDuration  = UnityEngine.Random.Range(0.0f, 1.5f);
            }
            catch (Exception e)
            {
                SuperController.LogError("Exception caught: " + e);
            }
        }
        public ExpressionAnimation(GenerateDAZMorphsControlUI morphControl, ExpressionAnimation stopping, ExpressionAnimation starting)
        {
            this.morphControl = morphControl;

            ExpressionKeyframe stoppingFrame = stopping.keyframes[0];
            ExpressionKeyframe startingFrame = starting.keyframes[0];

            List <string> stoppingMorphs = stoppingFrame.morphValues.Keys.ToList();
            List <string> startingMorphs = startingFrame.morphValues.Keys.ToList();
            List <string> notInStarting  = stoppingMorphs.Where((stoppingName) =>
            {
                return(startingMorphs.Contains(stoppingName) == false);
            }).ToList();

            ExpressionKeyframe startFrame = new ExpressionKeyframe()
            {
                time = 0
            };
            ExpressionKeyframe endFrame = new ExpressionKeyframe()
            {
                time = 1
            };

            notInStarting.ForEach((morphName) =>
            {
                DAZMorph morph = morphControl.GetMorphByDisplayName(morphName);
                startFrame.morphValues[morphName] = morph.appliedValue;
                endFrame.morphValues[morphName]   = morph.startValue;
            });

            keyframes.Add(startFrame);
            keyframes.Add(endFrame);
            duration = TRANSITION_ANIMATION_DURATION;
        }
Exemple #3
0
        public ExpressionController(DollmasterPlugin dm) : base(dm)
        {
            expressionsEnabled = new JSONStorableBool("expressionsEnabled", true);
            dm.RegisterBool(expressionsEnabled);
            UIDynamicToggle moduleEnableToggle = dm.CreateToggle(expressionsEnabled);

            moduleEnableToggle.label           = "Enable Expressions + Voice";
            moduleEnableToggle.backgroundColor = Color.green;

            JSONStorable         geometry  = atom.GetStorableByID("geometry");
            DAZCharacterSelector character = geometry as DAZCharacterSelector;

            morphControl = character.morphsControlUI;

            mouthOpenMorph   = morphControl.GetMorphByDisplayName("Mouth Open Wide");
            tongueRaiseMorph = morphControl.GetMorphByDisplayName("Tongue Raise-Lower");

            interpolationSpeed = new JSONStorableFloat("expression speed", 8f, 0.1f, 20.0f, true);
            dm.RegisterFloat(interpolationSpeed);
            dm.CreateSlider(interpolationSpeed);

            upperJaw = atom.GetStorableByID("upperJaw") as DAZBone;
            lowerJaw = atom.GetStorableByID("lowerJaw") as DAZBone;

            //  Hack to fix bad tongue morph values
            morphControl.GetMorphByDisplayName("Tongue In-Out").startValue = 1.0f;

            dm.CreateSpacer();
        }
Exemple #4
0
        public override void Init()
        {
            try
            {
                if (containingAtom.type != "Person")
                {
                    SuperController.LogError($"Requires atom of type person, instead selected: {containingAtom.type}");
                    return;
                }

                JSONStorable               geometry = containingAtom.GetStorableByID("geometry");
                DAZCharacterSelector       dcs      = geometry as DAZCharacterSelector;
                GenerateDAZMorphsControlUI morphUI  = dcs.morphsControlUI;
                if (morphUI != null)
                {
                    eyesClosed = morphUI.GetMorphByDisplayName("Eyes Closed");
                }

                JSONStorable eyelids = containingAtom.GetStorableByID("EyelidControl");
                autoBlink = eyelids.GetBoolJSONParam("blinkEnabled");
            }
            catch (System.Exception e) {
                SuperController.LogError("Exception caught: " + e);
            }
        }
Exemple #5
0
        protected void UpdateRandomParams()
        {
            JSONStorable               geometry     = containingAtom.GetStorableByID("geometry");
            DAZCharacterSelector       character    = geometry as DAZCharacterSelector;
            GenerateDAZMorphsControlUI morphControl = character.morphsControlUI;

            // define the random values to switch to
            morphControl.GetMorphDisplayNames().ForEach((name) =>
            {
                DAZMorph morph = morphControl.GetMorphByDisplayName(name);
                if (toggles.ContainsKey(name) == false)
                {
                    return;
                }

                if (toggles[name].toggle.isOn)
                {
                    if (morph.animatable == false)
                    {
                        float valeur         = UnityEngine.Random.Range(minSlider.val, maxSlider.val) * multiSlider.val;
                        newMorphValues[name] = valeur;
                    }
                }
            });
        }
        List <MorphAnimationStep> ConstructPlayback(JSONClass animationData)
        {
            DAZCharacterSelector       dcs     = containingAtom.GetStorableByID("geometry") as DAZCharacterSelector;
            GenerateDAZMorphsControlUI morphUI = dcs.morphsControlUI;

            return(animationData.Keys.ToList().Select((morphName) =>
            {
                DAZMorph morph = morphUI.GetMorphByDisplayName(morphName);
                JSONArray changes = animationData[morphName].AsArray;

                List <MorphAnimationStep> steps = changes.Childs.ToList().Select(change =>
                {
                    JSONClass changeObject = change.AsObject;
                    float time = float.Parse(changeObject["time"]);
                    float value = float.Parse(changeObject["value"]);
                    MorphAnimationStep step = new MorphAnimationStep()
                    {
                        morph = morph,
                        time = time,
                        value = value,
                    };
                    return step;
                }).ToList();

                for (int i = 0; i < steps.Count - 1; i++)
                {
                    steps[i].next = steps[i + 1];
                }

                MorphAnimationStep head = steps[0];
                return head;
            }).ToList());
        }
        protected void FixedUpdate()
        {
            if (toggles["Play"].toggle.isOn)
            {
                JSONStorable               geometry     = containingAtom.GetStorableByID("geometry");
                DAZCharacterSelector       character    = geometry as DAZCharacterSelector;
                GenerateDAZMorphsControlUI morphControl = character.morphsControlUI;

                Dictionary <string, UIDynamicToggle> togglesOn = toggles.Where(t => t.Value.toggle.isOn).ToDictionary(p => p.Key, p => p.Value);

                // morph progressively every morphs to their new values
                foreach (KeyValuePair <string, UIDynamicToggle> entry in togglesOn)
                {
                    string name = entry.Key;
                    if (name != "Play")
                    {
                        DAZMorph morph = morphControl.GetMorphByDisplayName(name);
                        if (morph.animatable == false)
                        {
                            float valeur = Mathf.Lerp(CurrentMorphsValues[name], newMorphValues[name], Time.deltaTime * animLengthSlider.val * masterSpeedSlider.val);
                            CurrentMorphsValues[name] = morph.morphValue = valeur;
                        }
                    }
                }
            }
        }
Exemple #8
0
        protected void UpdateRandomParams()
        {
            GenerateDAZMorphsControlUI morphControl = returnMorphs();

            // define the random values to switch to
            foreach (KeyValuePair <string, UIDynamicToggle> entry in togglesOn)
            {
                string name = entry.Key;
                if (name != "Play")
                {
                    DAZMorph morph = morphControl.GetMorphByDisplayName(name);
                    if (morph.animatable == false)
                    {
                        if (CurrentMorphsValues[name] > 0.1f && abaToggle.val)
                        {
                            newMorphValues[name] = 0;
                        }
                        else
                        {
                            float valeur = UnityEngine.Random.Range(minSlider.val, maxSlider.val) * multiSlider.val;
                            newMorphValues[name] = valeur;
                        }
                    }
                }
            }
        }
Exemple #9
0
        private void InitializeMorphs()
        {
            var atom = containingAtom;

            JSONStorable geometry = atom.GetStorableByID("geometry");

            if (geometry == null)
            {
                throw new InvalidOperationException($"Cannot get morphs control for this atom: {atom.uid}");
            }

            DAZCharacterSelector dcs = geometry as DAZCharacterSelector;

            if (dcs == null)
            {
                throw new InvalidOperationException($"Cannot get morphs control for this atom: {atom.uid}");
            }

            morphsControl = dcs.morphsControlUI;
            foreach (var item in vibrationStrengths)
            {
                var morph = morphsControl.GetMorphByDisplayName(item.Key);
                if (morph != null)
                {
                    previousMorphChange[item.Key] = 0.0f;
                }
            }
        }
        public ExpressionAnimation(GenerateDAZMorphsControlUI morphControl, string jsonString)
        {
            this.morphControl = morphControl;

            JSONClass obj = JSON.Parse(jsonString).AsObject;

            audio    = obj["audio"].Value;
            duration = obj["duration"].AsFloat;
            JSONArray keyframesData = obj["keyframes"].AsArray;

            for (int i = 0; i < keyframesData.Count; i++)
            {
                ExpressionKeyframe keyframe = new ExpressionKeyframe();

                JSONClass keyframeData = keyframesData[i].AsObject;

                keyframeData.Keys.ToList().ForEach((keyName) =>
                {
                    float value = keyframeData[keyName].AsFloat;
                    if (keyName == "time")
                    {
                        keyframe.time = value;
                    }
                    else
                    {
                        keyframe.morphValues[keyName] = value;
                    }
                });

                keyframes.Add(keyframe);
            }

            nac = URLAudioClipManager.singleton.GetClip(audio);
        }
 protected void FixedUpdate()
 {
     if (toggles["Play"].toggle.isOn)
     {
         GenerateDAZMorphsControlUI           morphControl = returnMorphs();
         Dictionary <string, UIDynamicToggle> togglesOn    = toggles.Where(t => t.Value.toggle.isOn).ToDictionary(p => p.Key, p => p.Value);
         // morph progressively every morphs to their new values
         string textBoxMessage     = "\n Animatable morphs (not animated) :\n";
         string animatableSelected = textBoxMessage;
         foreach (KeyValuePair <string, UIDynamicToggle> entry in togglesOn)
         {
             string name = entry.Key;
             if (name != "Play")
             {
                 DAZMorph morph = morphControl.GetMorphByDisplayName(name);
                 if (morph.animatable == false)
                 {
                     // float valeur = Mathf.Lerp(CurrentMorphsValues[name], newMorphValues[name], Time.deltaTime * animLengthSlider.val * masterSpeedSlider.val);
                     float valeur = Mathf.Lerp(CurrentMorphsValues[name], newMorphValues[name], Time.deltaTime * animLengthSlider.val * masterSpeedSlider.val * Mathf.Sin(timer / (animWaitSlider.val / masterSpeedSlider.val) * Mathf.PI));
                     CurrentMorphsValues[name] = morph.morphValue = valeur;
                 }
                 else
                 {
                     animatableSelected = animatableSelected + " " + name + "\n";
                 }
             }
         }
         if (animatableSelected != textBoxMessage || morphList.val != textBoxMessage)
         {
             morphList.val = animatableSelected;
         }
     }
 }
        public GenerateDAZMorphsControlUI GetMorphControl()
        {
            DAZCharacterSelector       dcs     = containingAtom.GetStorableByID("geometry") as DAZCharacterSelector;
            GenerateDAZMorphsControlUI morphUI = dcs.morphsControlUI;

            return(morphUI);
        }
Exemple #13
0
            public Playback(JSONClass json, GenerateDAZMorphsControlUI morphControl)
            {
                float scale = 1;

                if (json.HasKey("scale"))
                {
                    scale = json["scale"].AsFloat;
                }

                var keys = json["keys"].AsObject;
                List <Animation> animations = new List <Animation>();

                foreach (var morphName in keys.Keys.ToList())
                {
                    var animString = keys[morphName].Value;
                    var morph      = morphControl.GetMorphByDisplayName(morphName);
                    if (morph == null)
                    {
                        SuperController.LogError("MorphAnimation: morph not found: " + morphName);
                        continue;
                    }

                    animations.Add(new Animation(morph, animString, scale));
                }

                this.animations = animations;
            }
Exemple #14
0
        private void UpdateCurrentMorphs()
        {
            GenerateDAZMorphsControlUI morphControl = returnMorphs();

            morphControl.GetMorphDisplayNames().ForEach((name) => {
                CurrentMorphsValues[name] = morphControl.GetMorphByDisplayName(name).morphValue;
            });
        }
        void LoadSaveJson(JSONNode aJson)
        {
            string receiver;

            if (_loadReceiver.val)
            {
                receiver = aJson["receiver"].Value;
            }
            else
            {
                receiver = _receiverJSON.val;
            }
            SyncAtom(_atom.name);

            _receiverJSON.val = receiver; // sync receiver

            foreach (JSONNode target in aJson["targets"].AsArray)
            {
                string targetId   = target["id"].Value;
                var    randomizer = GetRandomizerById(targetId);
                if (randomizer != null)
                {
                    randomizer.RestoreFromJson(target);
                }
                else
                {
                    if (_addAnimatable.val && receiver == "geometry")
                    {
                        // Ensure target is animatable
                        JSONStorable               geometry     = containingAtom.GetStorableByID("geometry");
                        DAZCharacterSelector       character    = geometry as DAZCharacterSelector;
                        GenerateDAZMorphsControlUI morphControl = character.morphsControlUI;
                        DAZMorph morph = morphControl.GetMorphByDisplayName(targetId);
                        if (morph != null)
                        {
                            morph.animatable = true;
                            // Add the newly-animatable target to the list and try again
                            SyncTargetChoices();
                            randomizer = GetRandomizerById(targetId);
                            if (null != randomizer)
                            {
                                randomizer.RestoreFromJson(target);
                            }
                        }
                    }

                    // Still no randomizer? Report the missing param
                    if (randomizer == null)
                    {
                        SuperController.LogMessage("Failed to add randomizer for " + targetId);
                    }
                }
            }

            SyncTargetChoices();
            SyncTargets(_targetJson.val);
            UpdateEnabledList();
        }
Exemple #16
0
        public override void Init()
        {
            try
            {
                JSONStorable js = containingAtom.GetStorableByID("geometry");
                if (js != null)
                {
                    DAZCharacterSelector       dcs     = js as DAZCharacterSelector;
                    GenerateDAZMorphsControlUI morphUI = dcs.morphsControlUI;
                    if (morphUI != null)
                    {
                        stomachMorph   = morphUI.GetMorphByDisplayName("Breath1");
                        mouthMorph     = morphUI.GetMorphByDisplayName("Mouth Open");
                        nosePinchMorph = morphUI.GetMorphByDisplayName("Nose Pinch");
                        noseFlareMorph = morphUI.GetMorphByDisplayName("Nostrils Flare");
                    }
                }

                headAudio       = containingAtom.GetStorableByID("HeadAudioSource");
                chestController = containingAtom.GetStorableByID("chestControl") as FreeControllerV3;


                intensity     = CreateFloatSlider("Intensity", 0.0f, 0.0f, 1.0f);
                variance      = CreateFloatSlider("Variance", 0.2f, 0.0f, 0.5f);
                stomachPower  = CreateFloatSlider("StomachPower", 0.3f, 0.0f, 1.0f);
                chestSpring   = CreateFloatSlider("ChestSpring", 90.0f, 0.0f, 250.0f);
                chestDriveMin = CreateFloatSlider("ChestDriveMin", -3.0f, -20.0f, 20.0f);
                chestDriveMax = CreateFloatSlider("ChestDriveMax", 8.0f, -20.0f, 20.0f);
                mouthOpenMin  = CreateFloatSlider("MouthOpenMin", 0.0f, -0.5f, 2.0f);
                mouthOpenMax  = CreateFloatSlider("MouthOpenMax", 0.8f, -0.5f, 2.0f);

                if (chestController != null)
                {
                    chestController.jointRotationDriveSpring = chestSpring.val;
                    chestController.jointRotationDriveDamper = 1.0f;
                }


                breatheNeedInit = true;

                float v     = variance.val * (breathEntries.Length - 1);
                float bi    = breatheIntensity * (breathEntries.Length - 1);
                float min   = Mathf.Max(bi - v - 1.0f, -0.5f);
                float max   = Mathf.Min(bi + v + 1.0f, breathEntries.Length - 0.5f);
                int   index = Mathf.RoundToInt(UnityEngine.Random.Range(min, max));
                breatheIndex = Mathf.Clamp(index, 0, breathEntries.Length - 1);

                breatheCycle     = 0.0f;
                breatheIntensity = intensity.val;
                breathePower     = UnityEngine.Random.Range(0.8f, 1.2f);
                breatheDuration  = UnityEngine.Random.Range(0.0f, 1.5f);
            }
            catch (Exception e)
            {
                SuperController.LogError("Exception caught: " + e);
            }
        }
        public List <string> GetMorphNamesByGroup(string group)
        {
            List <string> names = new List <string>();


            GenerateDAZMorphsControlUI morphControl = GetMorphControl();
            List <string> morphNames = morphControl.GetMorphDisplayNames();

            return(names);
        }
Exemple #18
0
        private void UpdateNewMorphs()
        {
            GenerateDAZMorphsControlUI morphControl = returnMorphs();

            morphControl.GetMorphDisplayNames().ForEach((name) => {
                if (toggles.ContainsKey(name))
                {
                    newMorphValues[name] = morphControl.GetMorphByDisplayName(name).morphValue;
                }
            });
        }
Exemple #19
0
        private void UpdateInitialMorphs()
        {
            JSONStorable               geometry     = containingAtom.GetStorableByID("geometry");
            DAZCharacterSelector       character    = geometry as DAZCharacterSelector;
            GenerateDAZMorphsControlUI morphControl = character.morphsControlUI;

            morphControl.GetMorphDisplayNames().ForEach((name) =>
            {
                initialMorphValues[name] = morphControl.GetMorphByDisplayName(name).morphValue;
            });
        }
Exemple #20
0
 void ZeroMorphs(GenerateDAZMorphsControlUI morphControl)
 {
     morphControl.GetMorphDisplayNames().ForEach((name) =>
     {
         DAZMorph morph = morphControl.GetMorphByDisplayName(name);
         if (morph.isPoseControl)
         {
             morph.SetValue(morph.startValue);
             morph.SyncJSON();
         }
     });
 }
Exemple #21
0
        public void Init(SharedBehaviors plugin)
        {
            JSONStorable               geometry     = plugin.containingAtom.GetStorableByID("geometry");
            DAZCharacterSelector       character    = geometry as DAZCharacterSelector;
            GenerateDAZMorphsControlUI morphControl = character.morphsControlUI;

            blinkMorph = morphControl.GetMorphByDisplayName("Eyes Closed");

            blinkCurve = new AnimationCurve(blinkKeyframes);

            leftSquintMorph  = morphControl.GetMorphByDisplayName("Eyes Squint Left");
            rightSquintMorph = morphControl.GetMorphByDisplayName("Eyes Squint Right");
        }
Exemple #22
0
 public override void Init()
 {
     try
     {
         JSONStorable               geometry     = containingAtom.GetStorableByID("geometry");
         DAZCharacterSelector       character    = geometry as DAZCharacterSelector;
         GenerateDAZMorphsControlUI morphControl = character.morphsControlUI;
     }
     catch (Exception e)
     {
         SuperController.LogError("Exception caught: " + e);
     }
 }
Exemple #23
0
        public ExpressionController(DollmasterPlugin dm) : base(dm)
        {
            morphsEnabled = new JSONStorableBool("morphsEnabled", true, (bool enabled) =>
            {
                if (enabled == false)
                {
                    ZeroTargets();
                }
            });
            dm.RegisterBool(morphsEnabled);
            UIDynamicToggle morphsEnabledToggle = dm.CreateToggle(morphsEnabled);

            morphsEnabledToggle.label           = "Enable Facial Morphs";
            morphsEnabledToggle.backgroundColor = Color.green;

            voiceEnabled = new JSONStorableBool("voiceEnabled", true);
            dm.RegisterBool(voiceEnabled);
            UIDynamicToggle voiceEnabledToggle = dm.CreateToggle(voiceEnabled);

            voiceEnabledToggle.label           = "Enable Voice";
            voiceEnabledToggle.backgroundColor = Color.green;

            morphPercent = new JSONStorableFloat("morph percent", 0.7f, 0, 1, true);
            dm.RegisterFloat(morphPercent);
            UIDynamicSlider morphPercentSlider = dm.CreateSlider(morphPercent);

            JSONStorable         geometry  = atom.GetStorableByID("geometry");
            DAZCharacterSelector character = geometry as DAZCharacterSelector;

            morphControl = character.morphsControlUI;

            mouthOpenMorph   = morphControl.GetMorphByDisplayName("Mouth Open Wide");
            tongueRaiseMorph = morphControl.GetMorphByDisplayName("Tongue Raise-Lower");

            interpolationSpeed = new JSONStorableFloat("expression speed", 8f, 0.1f, 20.0f, true);
            dm.RegisterFloat(interpolationSpeed);
            dm.CreateSlider(interpolationSpeed);

            upperJaw = atom.GetStorableByID("upperJaw") as DAZBone;
            lowerJaw = atom.GetStorableByID("lowerJaw") as DAZBone;

            //  Hack to fix bad tongue morph values.
            //morphControl.GetMorphByDisplayName("Tongue In-Out").startValue = 1.0f;

            dm.CreateSpacer();

            // Prevent mouth from getting too big.
            dm.headAudioSource.SetFloatParamValue("volumeTriggerMultiplier", 0);
        }
Exemple #24
0
        public override void Init()
        {
            JSONStorable               geometry     = containingAtom.GetStorableByID("geometry");
            DAZCharacterSelector       character    = geometry as DAZCharacterSelector;
            GenerateDAZMorphsControlUI morphControl = character.morphsControlUI;

            breathingMorph = morphControl.GetMorphByDisplayName("Breath1");
            throatMorph    = morphControl.GetMorphByDisplayName("deepthroat");

            chestControl = containingAtom.GetStorableByID("chestControl") as FreeControllerV3;
            headControl  = containingAtom.GetStorableByID("headControl") as FreeControllerV3;

            RegisterFloat(speed);
            CreateSlider(speed);
        }
Exemple #25
0
        private void ResetMorphs()
        {
            JSONStorable               geometry     = containingAtom.GetStorableByID("geometry");
            DAZCharacterSelector       character    = geometry as DAZCharacterSelector;
            GenerateDAZMorphsControlUI morphControl = character.morphsControlUI;

            morphControl.GetMorphDisplayNames().ForEach((name) =>
            {
                if (toggleRelations.ContainsKey(name))
                {
                    DAZMorph morph   = morphControl.GetMorphByDisplayName(name);
                    morph.morphValue = initialMorphValues[name];
                }
            });
        }
Exemple #26
0
        private void ResetMorphs()
        {
            GenerateDAZMorphsControlUI morphControl = returnMorphs();

            morphControl.GetMorphDisplayNames().ForEach((name) => {
                if (toggleRelations.ContainsKey(name))
                {
                    if (toggles.ContainsKey(name))
                    {
                        DAZMorph morph   = morphControl.GetMorphByDisplayName(name);
                        morph.morphValue = initialMorphValues[name];
                    }
                }
            });
        }
Exemple #27
0
        private void ZeroMorphs()
        {
            GenerateDAZMorphsControlUI morphControl = returnMorphs();

            morphControl.GetMorphDisplayNames().ForEach((name) => {
                if (toggleRelations.ContainsKey(name))
                {
                    if (toggles.ContainsKey(name) && toggles[name].toggle.isOn)
                    {
                        DAZMorph morph   = morphControl.GetMorphByDisplayName(name);
                        morph.morphValue = 0;
                    }
                }
            });
        }
Exemple #28
0
        private void ZeroSelectedMorphs(GenerateDAZMorphsControlUI morphControl)
        {
            morphControl.GetMorphDisplayNames().ForEach((name) =>
            {
                DAZMorph morph = morphControl.GetMorphByDisplayName(name);
                if (toggles.ContainsKey(morph.region) == false)
                {
                    return;
                }

                if (toggles[morph.region].toggle.isOn)
                {
                    morph.morphValue = 0.0f;
                }
            });
        }
Exemple #29
0
        private void ResetMorphs()
        {
            JSONStorable               geometry     = containingAtom.GetStorableByID("geometry");
            DAZCharacterSelector       character    = geometry as DAZCharacterSelector;
            GenerateDAZMorphsControlUI morphControl = character.morphsControlUI;

            morphControl.GetMorphDisplayNames().ForEach((name) =>
            {
                DAZMorph morph = morphControl.GetMorphByDisplayName(name);
                if (initialMorphValues.ContainsKey(name) == false)
                {
                    Debug.Log("morph was not initially found: " + name + ", not resetting this morph");
                    return;
                }
                morph.morphValue = initialMorphValues[name];
            });
        }
Exemple #30
0
        public override void Init()
        {
            JSONStorable               geometry     = containingAtom.GetStorableByID("geometry");
            DAZCharacterSelector       character    = geometry as DAZCharacterSelector;
            GenerateDAZMorphsControlUI morphControl = character.morphsControlUI;

            var pluginPath = GetPluginPath();
            var path       = pluginPath + "/animations";
            var files      = SuperController.singleton.GetFilesAtPath(path);

            foreach (var file in files)
            {
                var fileName = PathExtQualia.GetFileNameWithoutExtension(file);
                CreateButton("Test " + fileName).button.onClick.AddListener(() =>
                {
                    var json    = JSON.Parse(SuperController.singleton.ReadFileIntoString(file)).AsObject;
                    Playback pb = new Playback(json, morphControl);
                    pb.Play();
                });
            }

            List <string> twitches = new List <string>()
            {
                "cheekcrease",
                "cheekeyeflex",
                "cheekflexleft",
                "cheekflexright",
                "lipspart",
                "nosewrinkle",
                "nostrilflare",
                "smallsmile",
                "mediumsmile",
                "bigsmile",
            };

            foreach (var twitchFile in twitches)
            {
                var p    = pluginPath + "/animations/" + twitchFile + ".json";
                var json = JSON.Parse(SuperController.singleton.ReadFileIntoString(p)).AsObject;
                affectations.Add(new Playback(json, morphControl));
            }
        }