using System; using UnityEngine; using System.Collections.Generic; namespace ky1001 { public class SimpleMirroring: MVRScript { #region PluginInfo public string pluginAuthor = "ky1001"; public string pluginName = "SimpleMirroring"; public string pluginVersion = "1.0"; public string pluginDate = "2021-09-20"; public string pluginDescription = ""; #endregion #region Vars protected Atom CurrentAtom; private Vector3 tempPosition; private Vector3 temprPosition; private Vector3 templPosition; private Quaternion tempRotation; private Quaternion temprRotation; private Quaternion templRotation; private Vector3 tempPosition_h; public string tempPosi_r; public string tempRota_r; public string tempPosi_l; public string tempRota_l; public bool cState; public string HorF, CF, CF1, CT, CT1; protected UIDynamicButton rHbutton; protected UIDynamicButton rFbutton; protected UIDynamicButton lHbutton; protected UIDynamicButton lFbutton; protected UIDynamicButton ubutton; protected JSONStorableBool toggle; Dictionary PosiDic = new Dictionary(); Dictionary RotaDic = new Dictionary(); Dictionary AtomDic = new Dictionary(); Dictionary LinkDic = new Dictionary(); Dictionary PosiST = new Dictionary(); Dictionary RotaST = new Dictionary(); Dictionary RigidbodyList = new Dictionary(); Dictionary HandPose = new Dictionary(); Dictionary PosiV3 = new Dictionary(); Dictionary RotaV3 = new Dictionary(); public string RigidbodyName; Rigidbody linkToAtom; #endregion public readonly string[] ControlNames = new string[] { "chestControl", "headControl", "neckControl", "pelvisControl", "hipControl", "abdomenControl", "abdomen2Control", "eyeTargetControl", "penisBaseControl", "penisMidControl", "penisTipControl", }; public readonly string[] lrControlNames = new string[] { "HandControl", "FootControl", "NippleControl", "ElbowControl", "KneeControl", "ToeControl", "ThighControl", "ArmControl", "ShoulderControl", }; public readonly string[] lrHandControlNames = new string[] { "HandControl", "ElbowControl", "ArmControl", "ShoulderControl", }; public readonly string[] lrFootControlNames = new string[] { "FootControl", "KneeControl", "ToeControl", "ThighControl", }; private readonly string[] OnControlNames = new string[] { "chestControl", "headControl", "hipControl", "rHandControl", "lHandControl", "rFootControl", "lFootControl" }; private readonly string[] lrPoseNames = new string[] { "Hand Chop", "Hand Fist", "Hand Grasp", "Hand Spread", "Hand Straighten", "Fingers Fist", "Fingers Grasp", "Fingers In-Out", "Fingers Squeeze", "Fingers Straighten", "Index Finger Bend", "Mid Finger Bend", "Pinky Finger Bend", "Ring Finger Bend", "Thumb Bend", "Thumb Fist", "Thumb Grasp", "Thumb In-Out", "Thumb Straighten", "Big Toe Bend", "Index Toe Bend", "Mid Toe Bend", "Pinky Toe Bend", "Ring Toe Bend", "Toes Fan Down", "Toes Small Curl", "Toes Spread", }; private readonly string[] lrHandPoseNames = new string[] { "Hand Chop", "Hand Fist", "Hand Grasp", "Hand Spread", "Hand Straighten", "Fingers Fist", "Fingers Grasp", "Fingers In-Out", "Fingers Squeeze", "Fingers Straighten", "Index Finger Bend", "Mid Finger Bend", "Pinky Finger Bend", "Ring Finger Bend", "Thumb Bend", "Thumb Fist", "Thumb Grasp", "Thumb In-Out", "Thumb Straighten", }; private readonly string[] lrFootPoseNames = new string[] { "Big Toe Bend", "Index Toe Bend", "Mid Toe Bend", "Pinky Toe Bend", "Ring Toe Bend", "Toes Fan Down", "Toes Small Curl", "Toes Spread", }; // Use this for initialization public override void Init() { try { #region Buttons lHbutton = CreateButton("Hand : Left to Right"); if (lHbutton != null) { lHbutton.button.onClick.AddListener(CopyHandFromLeftToRight); } lFbutton = CreateButton("Foot : Left to Right"); if (lFbutton != null) { lFbutton.button.onClick.AddListener(CopyFootFromLeftToRight); } rHbutton = CreateButton("Hand : Right to Left", true); if (rHbutton != null) { rHbutton.button.onClick.AddListener(CopyHandFromRightToLeft); } rFbutton = CreateButton("Foot : Right to Left", true); if (rFbutton != null) { rFbutton.button.onClick.AddListener(CopyFootFromRightToLeft); } ubutton = CreateButton("Undo"); if (ubutton != null) { ubutton.button.onClick.AddListener(Undo); } toggle = new JSONStorableBool("Keep Link To Other Atom", true); //CreateToggle(toggle, true); #endregion CurrentAtom = containingAtom; cState=CurrentAtom.collisionEnabledJSON.val; PosiST["On"] = FreeControllerV3.PositionState.On; PosiST["Comply"] = FreeControllerV3.PositionState.Comply; PosiST["Off"] = FreeControllerV3.PositionState.Off; PosiST["ParentLink"] = FreeControllerV3.PositionState.ParentLink; PosiST["PhysicsLink"] = FreeControllerV3.PositionState.PhysicsLink; PosiST["Hold"] = FreeControllerV3.PositionState.Hold; PosiST["Lock"] = FreeControllerV3.PositionState.Lock; RotaST["On"] = FreeControllerV3.RotationState.On; RotaST["Comply"] = FreeControllerV3.RotationState.Comply; RotaST["Off"] = FreeControllerV3.RotationState.Off; RotaST["ParentLink"] = FreeControllerV3.RotationState.ParentLink; RotaST["PhysicsLink"] = FreeControllerV3.RotationState.PhysicsLink; RotaST["Hold"] = FreeControllerV3.RotationState.Hold; RotaST["Lock"] = FreeControllerV3.RotationState.Lock; } catch (Exception e) { SuperController.LogError("Exception caught: " + e); } } void Start() { UpdateInitialMorphs(); } private void CopyHandFromLeftToRight() { HorF = "Hand"; CF = "Left "; CF1 = "l"; CT = "Right "; CT1 = "r"; Mirroring(); } private void CopyFootFromLeftToRight() { HorF = "Foot"; CF = "Left "; CF1 = "l"; CT = "Right "; CT1 = "r"; Mirroring(); } private void CopyHandFromRightToLeft() { HorF = "Hand"; CF = "Right "; CF1 = "r"; CT = "Left "; CT1 = "l"; Mirroring(); } private void CopyFootFromRightToLeft() { HorF = "Foot"; CF = "Right "; CF1 = "r"; CT = "Left "; CT1 = "l"; Mirroring(); } private void UpdateInitialMorphs() { JSONStorable geometry = containingAtom.GetStorableByID("geometry"); DAZCharacterSelector character = geometry as DAZCharacterSelector; GenerateDAZMorphsControlUI morphControl = character.morphsControlUI; } private void ApplyMorphs() { JSONStorable geometry = containingAtom.GetStorableByID("geometry"); DAZCharacterSelector character = geometry as DAZCharacterSelector; GenerateDAZMorphsControlUI morphControl = character.morphsControlUI; List lrPoseList = new List(lrPoseNames); foreach (string lrPoseNames in lrPoseList) { float tempPose_r = morphControl.GetMorphByDisplayName("Right " + lrPoseNames).morphValue; float tempPose_l = morphControl.GetMorphByDisplayName("Left " + lrPoseNames).morphValue; HandPose["Right " + lrPoseNames] = tempPose_r; HandPose["Left " + lrPoseNames] = tempPose_l; } if (HorF == "Hand") { List lrHandPoseList = new List(lrHandPoseNames); foreach (string lrHandPoseNames in lrHandPoseList) { morphControl.GetMorphByDisplayName(CT + lrHandPoseNames).morphValue = HandPose[CF + lrHandPoseNames]; } } else { List lrFootPoseList = new List(lrFootPoseNames); foreach (string lrFootPoseNames in lrFootPoseList) { morphControl.GetMorphByDisplayName(CT + lrFootPoseNames).morphValue = HandPose[CF + lrFootPoseNames]; } } } public void Mirroring() { Copy(); Invoke("StatusRecall", 0.5f); Invoke("ColButtonCallback", 0.5f); } public void Copy() { cState=CurrentAtom.collisionEnabledJSON.val; CurrentAtom.collisionEnabledJSON.val=false; Rigidbody[] objects = containingAtom.rigidbodies; foreach (var ObjectName in objects) { RigidbodyList[ObjectName.ToString()] = ObjectName; } List ControlList = new List(ControlNames); foreach (string ControlNames in ControlList) { FreeControllerV3 CurrentController = CurrentAtom.GetStorableByID(ControlNames) as FreeControllerV3; PosiDic[ControlNames] = CurrentController.currentPositionState.ToString(); RotaDic[ControlNames] = CurrentController.currentRotationState.ToString(); if (!CurrentController.linkToRB) { AtomDic[ControlNames] = "None"; LinkDic[ControlNames] = "None"; RigidbodyList["None"] = CurrentController.linkToRB; } else { var jc = CurrentController.GetJSON(); var linkTo = jc["linkTo"].Value; AtomDic[ControlNames] = linkTo.Split(":"[0])[0]; LinkDic[ControlNames] = CurrentController.linkToRB.ToString(); } CurrentController.SetLinkToAtom("None"); CurrentController.SetLinkToRigidbodyObject("None"); CurrentController.currentPositionState = PosiST["On"]; CurrentController.currentRotationState = RotaST["On"]; } List lrControlList = new List(lrControlNames); foreach (string lrControlNames in lrControlList) { FreeControllerV3 rCurrentController = CurrentAtom.GetStorableByID("r" + lrControlNames) as FreeControllerV3; PosiDic["r" + lrControlNames] = rCurrentController.currentPositionState.ToString(); RotaDic["r" + lrControlNames] = rCurrentController.currentRotationState.ToString(); if (!rCurrentController.linkToRB) { AtomDic["r" + lrControlNames] = "None"; LinkDic["r" + lrControlNames] = "None"; } else { var jc = rCurrentController.GetJSON(); var linkTo = jc["linkTo"].Value; AtomDic["r" + lrControlNames] = linkTo.Split(":"[0])[0]; LinkDic["r" + lrControlNames] = rCurrentController.linkToRB.ToString(); } rCurrentController.SetLinkToAtom("None"); rCurrentController.SetLinkToRigidbodyObject("None"); rCurrentController.currentPositionState = PosiST["On"]; rCurrentController.currentRotationState = RotaST["On"]; FreeControllerV3 lCurrentController = CurrentAtom.GetStorableByID("l" + lrControlNames) as FreeControllerV3; PosiDic["l" + lrControlNames] = lCurrentController.currentPositionState.ToString(); RotaDic["l" + lrControlNames] = lCurrentController.currentRotationState.ToString(); if (!lCurrentController.linkToRB) { AtomDic["l" + lrControlNames] = "None"; LinkDic["l" + lrControlNames] = "None"; } else { var jc = lCurrentController.GetJSON(); var linkTo = jc["linkTo"].Value; AtomDic["l" + lrControlNames] = linkTo.Split(":"[0])[0]; LinkDic["l" + lrControlNames] = lCurrentController.linkToRB.ToString(); } lCurrentController.SetLinkToAtom("None"); lCurrentController.SetLinkToRigidbodyObject("None"); lCurrentController.currentPositionState = PosiST["On"]; lCurrentController.currentRotationState = RotaST["On"]; } foreach (string ControlNames in ControlList) { FreeControllerV3 CurrentController = CurrentAtom.GetStorableByID(ControlNames) as FreeControllerV3; if (ControlNames == "chestControl") { tempPosition_h.x=CurrentController.transform.localPosition.x; } PosiV3[ControlNames] = CurrentController.transform.localPosition; RotaV3[ControlNames] = CurrentController.transform.localRotation; } foreach (string lrControlNames in lrControlList) { FreeControllerV3 lCurrentController = CurrentAtom.GetStorableByID("l" + lrControlNames) as FreeControllerV3; PosiV3["l" + lrControlNames] = lCurrentController.transform.localPosition; RotaV3["l" + lrControlNames] = lCurrentController.transform.localRotation; FreeControllerV3 rCurrentController = CurrentAtom.GetStorableByID("r" + lrControlNames) as FreeControllerV3; PosiV3["r" + lrControlNames] = rCurrentController.transform.localPosition; RotaV3["r" + lrControlNames] = rCurrentController.transform.localRotation; } List lrHandControlList = new List(lrHandControlNames); List lrFootControlList = new List(lrFootControlNames); if (HorF == "Hand") { foreach (string lrHandControlNames in lrHandControlList) { temprPosition.x = CurrentAtom.transform.localPosition.x - PosiV3[CF1 + lrHandControlNames].x + tempPosition_h.x * 2; temprPosition.y = PosiV3[CF1 + lrHandControlNames].y; temprPosition.z = PosiV3[CF1 + lrHandControlNames].z; temprRotation.x = RotaV3[CF1 + lrHandControlNames].x; temprRotation.y = CurrentAtom.transform.localRotation.y - RotaV3[CF1 + lrHandControlNames].y; temprRotation.z = CurrentAtom.transform.localRotation.z - RotaV3[CF1 + lrHandControlNames].z; temprRotation.w = RotaV3[CF1 + lrHandControlNames].w; FreeControllerV3 toCurrentHandController = CurrentAtom.GetStorableByID(CT1 + lrHandControlNames) as FreeControllerV3; toCurrentHandController.transform.localPosition = temprPosition; toCurrentHandController.transform.localRotation = temprRotation; } } else { foreach (string lrFootControlNames in lrFootControlList) { temprPosition.x = CurrentAtom.transform.localPosition.x - PosiV3[CF1 + lrFootControlNames].x + tempPosition_h.x * 2; temprPosition.y = PosiV3[CF1 + lrFootControlNames].y; temprPosition.z = PosiV3[CF1 + lrFootControlNames].z; temprRotation.x = RotaV3[CF1 + lrFootControlNames].x; temprRotation.y = CurrentAtom.transform.localRotation.y - RotaV3[CF1 + lrFootControlNames].y; temprRotation.z = CurrentAtom.transform.localRotation.z - RotaV3[CF1 + lrFootControlNames].z; temprRotation.w = RotaV3[CF1 + lrFootControlNames].w; FreeControllerV3 toCurrentFootController = CurrentAtom.GetStorableByID(CT1 + lrFootControlNames) as FreeControllerV3; toCurrentFootController.transform.localPosition = temprPosition; toCurrentFootController.transform.localRotation = temprRotation; } } ApplyMorphs(); } public void StatusRecall() { List ControlList = new List(ControlNames); foreach (string ControlNames in ControlList) { FreeControllerV3 CurrentController = CurrentAtom.GetStorableByID(ControlNames) as FreeControllerV3; CurrentController.currentPositionState = PosiST[PosiDic[ControlNames]]; CurrentController.currentRotationState = RotaST[RotaDic[ControlNames]]; if (AtomDic[ControlNames] != "None") { RigidbodyName = LinkDic[ControlNames]; linkToAtom = SuperController.singleton.RigidbodyNameToRigidbody(AtomDic[ControlNames] + ":" + RigidbodyName.ToString().Split(" "[0])[0]); CurrentController.SelectLinkToRigidbody(linkToAtom, FreeControllerV3.SelectLinkState.PositionAndRotation); } } List lrControlList = new List(lrControlNames); foreach (string lrControlNames in lrControlList) { FreeControllerV3 rCurrentController = CurrentAtom.GetStorableByID("r" + lrControlNames) as FreeControllerV3; FreeControllerV3 lCurrentController = CurrentAtom.GetStorableByID("l" + lrControlNames) as FreeControllerV3; rCurrentController.SetLinkToAtom(AtomDic["r" + lrControlNames]); lCurrentController.SetLinkToAtom(AtomDic["l" + lrControlNames]); rCurrentController.currentPositionState = PosiST[PosiDic["r" + lrControlNames]]; rCurrentController.currentRotationState = RotaST[RotaDic["r" + lrControlNames]]; lCurrentController.currentPositionState = PosiST[PosiDic["l" + lrControlNames]]; lCurrentController.currentRotationState = RotaST[RotaDic["l" + lrControlNames]]; if (LinkDic["l" + lrControlNames] != "None") { RigidbodyName = LinkDic["l" + lrControlNames]; linkToAtom = SuperController.singleton.RigidbodyNameToRigidbody(AtomDic["l" + lrControlNames] + ":" + RigidbodyName.ToString().Split(" "[0])[0]); lCurrentController.SelectLinkToRigidbody(linkToAtom, FreeControllerV3.SelectLinkState.PositionAndRotation); } else { linkToAtom = SuperController.singleton.RigidbodyNameToRigidbody("None:None"); lCurrentController.SelectLinkToRigidbody(linkToAtom, FreeControllerV3.SelectLinkState.PositionAndRotation); } if (LinkDic["r" + lrControlNames] != "None") { RigidbodyName = LinkDic["r" + lrControlNames]; linkToAtom = SuperController.singleton.RigidbodyNameToRigidbody(AtomDic["r" + lrControlNames] + ":" + RigidbodyName.ToString().Split(" "[0])[0]); rCurrentController.SelectLinkToRigidbody(linkToAtom, FreeControllerV3.SelectLinkState.PositionAndRotation); } else { linkToAtom = SuperController.singleton.RigidbodyNameToRigidbody("None:None"); rCurrentController.SelectLinkToRigidbody(linkToAtom, FreeControllerV3.SelectLinkState.PositionAndRotation); } } List lrHandControlList = new List(lrHandControlNames); List lrFootControlList = new List(lrFootControlNames); if (HorF == "Hand") { foreach (string lrHandControlNames in lrHandControlList) { FreeControllerV3 toCurrentHandController = CurrentAtom.GetStorableByID(CT1 + lrHandControlNames) as FreeControllerV3; toCurrentHandController.SetLinkToAtom(AtomDic[CF1 + lrHandControlNames]); toCurrentHandController.currentPositionState = PosiST[PosiDic[CF1 + lrHandControlNames]]; toCurrentHandController.currentRotationState = RotaST[RotaDic[CF1 + lrHandControlNames]]; if (LinkDic[CF1 + lrHandControlNames] != "None") { RigidbodyName = LinkDic[CF1 + lrHandControlNames]; if (RigidbodyName.Substring(0, 1) == "l") { RigidbodyName = "r" + RigidbodyName.Substring(1, RigidbodyName.Length - 1); } else if (RigidbodyName.Substring(0, 1) == "r") { RigidbodyName = "l" + RigidbodyName.Substring(1, RigidbodyName.Length - 1); } linkToAtom = SuperController.singleton.RigidbodyNameToRigidbody(AtomDic[CF1 + lrHandControlNames] + ":" + RigidbodyName.ToString().Split(" "[0])[0]); } else { linkToAtom = SuperController.singleton.RigidbodyNameToRigidbody("None:None"); } toCurrentHandController.SelectLinkToRigidbody(linkToAtom, FreeControllerV3.SelectLinkState.PositionAndRotation); } } else { foreach (string lrFootControlNames in lrFootControlList) { FreeControllerV3 toCurrentFootController = CurrentAtom.GetStorableByID(CT1 + lrFootControlNames) as FreeControllerV3; toCurrentFootController.SetLinkToAtom(AtomDic[CF1 + lrFootControlNames]); toCurrentFootController.currentPositionState = PosiST[PosiDic[CF1 + lrFootControlNames]]; toCurrentFootController.currentRotationState = RotaST[RotaDic[CF1 + lrFootControlNames]]; if (LinkDic[CF1 + lrFootControlNames] != "None") { RigidbodyName = LinkDic[CF1 + lrFootControlNames]; if (RigidbodyName.Substring(0, 1) == "l") { RigidbodyName = "r" + RigidbodyName.Substring(1, RigidbodyName.Length - 1); } else if (RigidbodyName.Substring(0, 1) == "r") { RigidbodyName = "l" + RigidbodyName.Substring(1, RigidbodyName.Length - 1); } linkToAtom = SuperController.singleton.RigidbodyNameToRigidbody(AtomDic[CF1 + lrFootControlNames] + ":" + RigidbodyName.ToString().Split(" "[0])[0]); } else { linkToAtom = SuperController.singleton.RigidbodyNameToRigidbody("None:None"); } toCurrentFootController.SelectLinkToRigidbody(linkToAtom, FreeControllerV3.SelectLinkState.PositionAndRotation); } } } public void ColButtonCallback() { CurrentAtom.collisionEnabledJSON.val = true; } public void Undo() { AllControlOn(); UndoMain(); Invoke("StatusRecall2", 0.5f); Invoke("ColButtonCallback", 0.5f); } public void AllControlOn() { List ControlList = new List(ControlNames); foreach (string ControlNames in ControlList) { FreeControllerV3 CurrentController = CurrentAtom.GetStorableByID(ControlNames) as FreeControllerV3; CurrentController.currentPositionState = PosiST["On"]; CurrentController.currentRotationState = RotaST["On"]; } List lrControlList = new List(lrControlNames); foreach (string lrControlNames in lrControlList) { FreeControllerV3 rCurrentController = CurrentAtom.GetStorableByID("r" + lrControlNames) as FreeControllerV3; rCurrentController.currentPositionState = PosiST["On"]; rCurrentController.currentRotationState = RotaST["On"]; FreeControllerV3 lCurrentController = CurrentAtom.GetStorableByID("l" + lrControlNames) as FreeControllerV3; lCurrentController.currentPositionState = PosiST["On"]; lCurrentController.currentRotationState = RotaST["On"]; } } public void StatusRecall2() { Rigidbody[] objects = containingAtom.rigidbodies; foreach (var ObjectName in objects) { RigidbodyList[ObjectName.ToString()] = ObjectName; } List ControlList = new List(ControlNames); foreach (string ControlNames in ControlList) { FreeControllerV3 CurrentController = CurrentAtom.GetStorableByID(ControlNames) as FreeControllerV3; CurrentController.currentPositionState = PosiST[PosiDic[ControlNames]]; CurrentController.currentRotationState = RotaST[RotaDic[ControlNames]]; RigidbodyName = LinkDic[ControlNames]; linkToAtom = SuperController.singleton.RigidbodyNameToRigidbody(AtomDic[ControlNames] + ":" + RigidbodyName.ToString().Split(" "[0])[0]); CurrentController.SelectLinkToRigidbody(linkToAtom, FreeControllerV3.SelectLinkState.PositionAndRotation); } List lrControlList = new List(lrControlNames); foreach (string lrControlNames in lrControlList) { FreeControllerV3 rCurrentController = CurrentAtom.GetStorableByID("r" + lrControlNames) as FreeControllerV3; rCurrentController.currentPositionState = PosiST[PosiDic["r" + lrControlNames]]; rCurrentController.currentRotationState = RotaST[RotaDic["r" + lrControlNames]]; RigidbodyName = LinkDic["r" + lrControlNames]; linkToAtom = SuperController.singleton.RigidbodyNameToRigidbody(AtomDic["r" + lrControlNames] + ":" + RigidbodyName.ToString().Split(" "[0])[0]); rCurrentController.SelectLinkToRigidbody(linkToAtom, FreeControllerV3.SelectLinkState.PositionAndRotation); FreeControllerV3 lCurrentController = CurrentAtom.GetStorableByID("l" + lrControlNames) as FreeControllerV3; lCurrentController.currentPositionState = PosiST[PosiDic["l" + lrControlNames]]; lCurrentController.currentRotationState = RotaST[RotaDic["l" + lrControlNames]]; RigidbodyName = LinkDic["l" + lrControlNames]; linkToAtom = SuperController.singleton.RigidbodyNameToRigidbody(AtomDic["l" + lrControlNames] + ":" + RigidbodyName.ToString().Split(" "[0])[0]); lCurrentController.SelectLinkToRigidbody(linkToAtom, FreeControllerV3.SelectLinkState.PositionAndRotation); } } public void UndoMain() { cState=CurrentAtom.collisionEnabledJSON.val; CurrentAtom.collisionEnabledJSON.val=false; Rigidbody[] objects = containingAtom.rigidbodies; foreach (var ObjectName in objects) { RigidbodyList[ObjectName.ToString()] = ObjectName; } List ControlList = new List(ControlNames); foreach (string ControlNames in ControlList) { FreeControllerV3 CurrentController = CurrentAtom.GetStorableByID(ControlNames) as FreeControllerV3; CurrentController.transform.localPosition = PosiV3[ControlNames]; CurrentController.transform.localRotation = RotaV3[ControlNames]; } List lrControlList = new List(lrControlNames); foreach (string lrControlNames in lrControlList) { FreeControllerV3 rCurrentController = CurrentAtom.GetStorableByID("r" + lrControlNames) as FreeControllerV3; rCurrentController.transform.localPosition = PosiV3["r" + lrControlNames]; rCurrentController.transform.localRotation = RotaV3["r" + lrControlNames]; FreeControllerV3 lCurrentController = CurrentAtom.GetStorableByID("l" + lrControlNames) as FreeControllerV3; lCurrentController.transform.localPosition = PosiV3["l" + lrControlNames]; lCurrentController.transform.localRotation = RotaV3["l" + lrControlNames]; } JSONStorable geometry = containingAtom.GetStorableByID("geometry"); DAZCharacterSelector character = geometry as DAZCharacterSelector; GenerateDAZMorphsControlUI morphControl = character.morphsControlUI; List lrPoseList = new List(lrPoseNames); foreach (string lrPoseNames in lrPoseList) { morphControl.GetMorphByDisplayName("Right " + lrPoseNames).morphValue = HandPose["Right " + lrPoseNames]; morphControl.GetMorphByDisplayName("Left " + lrPoseNames).morphValue = HandPose["Left " + lrPoseNames]; } } } }