using System; using UnityEngine; using System.Collections.Generic; using MVR.FileManagementSecure; using System.Linq; using SimpleJSON; using System.Collections; using MeshVR; using System.Text.RegularExpressions; namespace ky1001 { public class AppearanceLoader : MVRScript { #region PluginInfo public string pluginAuthor = "ky1001"; public string pluginName = "AppearanceLoader"; public string pluginVersion = "20.2"; public string pluginDate = "2025-1-31"; public string pluginLicense = "CC BY-SA"; public string pluginDescription = ""; #endregion #region Vars private const string _vapLookPath = "Custom\\Atom\\Person\\Appearance"; private const string _jsonLookPath = "Saves\\Person\\appearance"; private const string _jsonScenePath = "Saves\\scene"; private const string _geomet = "geometry"; private const string _chara = "character"; private string LoadData; private string ext; private string reload; private string loadDir; private string vapPreviousFolder; private string jsonPreviousFolder; private string scenePreviousFolder; private string SELF; private string id; private string characterName; private string tempHair; private string tempClothing; private string emptyName; private string previousCharacter; private bool devMode = false; private bool sceneBool; private bool reloadBool; private bool femaleOnMale; private bool maleOnFemale; private bool previousClothingBool; private bool _isReset; private bool enabledClothing; private bool _fromUrl; private bool _texturesLoaded; private float scale; private Vector3 rootPosi; private Vector3 rootRota; private Vector3 localPosi; private Vector3 localRota; private Vector3 posi; private Vector3 rota; private Vector3 targetPosi; private Vector3 targetRota; private Vector3 tempPosi; private Vector3 tempRota; private JSONStorableStringChooser selectPerson; private JSONStorableStringChooser selectWaitTime; private JSONStorableBool shortcuts_Bool; private JSONStorableBool morphs_Bool; private JSONStorableBool textures_Bool; private JSONStorableBool eye_Bool; private JSONStorableBool mouth_Bool; private JSONStorableBool hair_Bool; private JSONStorableBool clothing_Bool; private JSONStorableBool realClothing_Bool; private JSONStorableBool notRealClothing_Bool; private JSONStorableBool clothingMerge_Bool; private JSONStorableBool keepFolder_Bool; private JSONStorableBool cua_Bool; private JSONStorableBool scale_Bool; private JSONStorableBool breast_Bool; private JSONStorableBool glute_Bool; private JSONStorableBool deletePluginPreset_Bool; private JSONStorableBool plugin_Bool; private JSONStorableBool disableTongueCollision; private JSONStorableBool _clearOldCUA; private JSONStorableString filename; private JSONStorableString message; private JSONStorableString missingItem; private JSONStorableString persons; private JSONStorableString hairAndClothing; private JSONStorableUrl appearanceFileUrl; private JSONStorable geometry; private UIDynamicTextField messageBox; private UIDynamicTextField messageBox2; private UIDynamicTextField messageBox3; private UIDynamicTextField messageBox4; private UIDynamicToggle shortcuts_toggle; private JSONNode jSONNode; private JSONArray atomArray; private JSONArray asArray; private JSONArray morphsAsArray; private JSONArray morphsOtherAsArray; private JSONArray hairAsArray; private JSONArray clothingAsArray; private JSONClass cuaPluginPreset; private JSONClass pluginPreset; private JSONClass asAtomObject; private JSONClass asObject; private JSONClass hairAsObject; private JSONClass clothingAsObject; private JSONClass morphs; private JSONClass morphsOther; private JSONClass texturesPreset; private Atom TargetAtom; private Rigidbody linkToAtom; private Rigidbody _rigid; private GameObject _dummyObject = new GameObject(); private Transform _dummyObjectTransform; private DAZCharacterSelector character; private GenerateDAZMorphsControlUI morphControl; private PresetManager pm; private Dictionary asObjectCUA = new Dictionary(); private Dictionary> idDic = new Dictionary>(); private Dictionary simClothingDic = new Dictionary(); private Dictionary sourcePositionDic = new Dictionary(); private Dictionary sourceRotationDic = new Dictionary(); private Dictionary paramControls = new Dictionary(); private Dictionary PosiST = new Dictionary(); private Dictionary RotaST = new Dictionary(); private Dictionary _currentSkinDic = new Dictionary(); private List personList = new List(); private List simClothingList = new List(); private List idListVap = new List(); private List hairList = new List(); private List clothingList = new List(); private List allNotRealClothingUids = new List(); private List allNotRealClothing = new List(); private List newClothingUids = new List(); private readonly string[] idList = new string[] { "BreastControl", "GluteControl", "LowerPhysicsMesh", "BreastPhysicsMesh", "JawControl", "FemaleEyelashes", "MaleEyelashes", "irises", "sclera", "lacrimals", "skin", "textures", "teeth", "tongue", "mouth" }; private readonly string[] idList2 = new string[] { "rescaleObject", "BendFix", "FemaleAnatomy", "BreastInOut", "EyelidControl", "AutoJawMouthMorph", "AutoExpressions", "SoftBodyPhysicsEnabler" }; private readonly string[] idList3 = new string[] { "AllJointsControl", "AnimatedFingerDrive", "AppearancePresets", "AtomControl", "CharacterPoseSnapRestore", "DebugJointsControl", "Eyes", "FemaleAnatomyAlt", "FemaleBreastPhysicsPresets", "FemaleGlutePhysicsPresets", "Genesis2Female", "geometry", "HairPresets", "HeadAudioSource", "LeftHandControl", "LeftHandFingerControl", "lEye", "MaleAnatomy", "MorphPresets", "PhysicsModel", "PluginManager", "PluginPresets", "PosePresets", "Preset", "rEye", "RightHandControl", "RightHandFingerControl", "SkinPresets", "SpeechBubble", "ThoughtBubble", "TongueControl", "TriggerGroup", "upperJaw" }; private readonly string[] actionList = new string[] { "SaveToStore1", "SaveToStore2", "SaveToStore3", "RestoreAllFromStore1", "RestorePhysicsFromStore1", "RestoreAppearanceFromStore1", "RestoreAllFromStore2", "RestorePhysicsFromStore2", "RestoreAppearanceFromStore2", "RestoreAllFromStore3", "RestorePhysicsFromStore3", "RestoreAppearanceFromStore3", "RestoreAllFromDefaults", "RestorePhysicalFromDefaults", "RestoreAppearanceFromDefaults", "CreateUVTemplateTexture", "CreateSimTemplateTexture", "OpenTextureFolderInExplorer" }; private readonly string[] rigidbodies = new string[] { "chest", "hip", "head", "neck", "lToe", "lFoot", "lShin", "lThigh", "lHand", "lForeArm", "lShldr", "lCollar", "rToe", "rFoot", "rShin", "rThigh", "rHand", "rForeArm", "rShldr", "rCollar", "abdomen", "abdomen2", "pelvis", "lPectoral", "rPectoral", "LGlute", "RGlute" }; private readonly string[] femaleCharacters = new string[] { "Female Dummy", "Female 1", "Female 2", "Female 3", "Female 4", "Female 5", "Female 6", "Female 7", "Female 8", "Female 9", "Female 10", "Female 11", "Female 12", "Female 13", "Female 14", "Female 15", "Female 16", "Female 17", "Candy", "Evey", "Janie", "Kayla", "Lexi", "Maria", "Mia", "Simone", "Tara", "Tina", "Female Custom" }; private readonly string[] maleCharacters = new string[] { "Male Dummy", "Male 1", "Male 2", "Male 3", "Male 4", "Male 5", "Male 6", "Male 7", "Male 8", "Male 9", "Lee", "Julian", "Futa Kayla", "Futa Lexi", "Futa Maria", "Futa Mia", "Futa Simone", "Male Custom" }; #endregion // Use this for initialization public override void Init() { try { TargetAtom = containingAtom; #region Buttons filename = new JSONStorableString("Set Appearance Filename", "Custom/Atom/Person/Appearance/"); vapPreviousFolder = _vapLookPath; jsonPreviousFolder = _jsonLookPath; scenePreviousFolder = _jsonScenePath; SELF = ""; keepFolder_Bool = new JSONStorableBool("Keep the previous folder", true); CreateToggle(keepFolder_Bool, false); var loadVapLook = CreateButton("Load Vap Appearance Preset", false); loadVapLook.button.onClick.AddListener(() => { var tempPath = _vapLookPath; if (keepFolder_Bool.val) { tempPath = vapPreviousFolder; } filename.val = ""; selectPerson.val = "None"; sceneBool = false; var vapLookShortcuts = FileManagerSecure.GetShortCutsForDirectory(_vapLookPath, false, false, true, true); SuperController.singleton.GetMediaPathDialog(HandleLoadPreset, "vap", tempPath, true, true, false, null, false, vapLookShortcuts); }); JSONStorableAction LoadVapDatas = new JSONStorableAction("Load Appearance from VapPreset", () => { selectPerson.val = "None"; sceneBool = false; HandleLoadPreset(""); }); var loadJsonLook = CreateButton("Load Json Appearance Preset", false); loadJsonLook.button.onClick.AddListener(() => { var tempPath = _jsonLookPath; if (keepFolder_Bool.val) { tempPath = jsonPreviousFolder; } filename.val = ""; selectPerson.val = "None"; sceneBool = false; var jsonLookShortcuts = FileManagerSecure.GetShortCutsForDirectory(_jsonLookPath, false, false, true, true); SuperController.singleton.GetMediaPathDialog(HandleLoadPreset, "json", tempPath, true, true, false, null, false, jsonLookShortcuts); }); JSONStorableAction LoadJsonDatas = new JSONStorableAction("Load Appearance from JsonPreset", () => { selectPerson.val = "None"; sceneBool = false; HandleLoadPreset(""); }); //var spacer = CreateSpacer(false); //spacer.height = 40f; //spacer = CreateSpacer(true); //spacer.height = 40f; var reloadLook = CreateButton("Reload Appearance Preset", true); reloadLook.button.onClick.AddListener(() => { reloadBool = true; HandleLoadPreset(reload); }); reloadLook.buttonColor = Color.yellow; JSONStorableAction reloadAct = new JSONStorableAction("Reload Appearance Preset", () => { reloadBool = true; HandleLoadPreset(reload); }); shortcuts_Bool = new JSONStorableBool("Use Shortcuts in Scene Load Dialog", true); shortcuts_toggle = CreateToggle(shortcuts_Bool, true); var selectScene = CreateButton("Select Scene", true); selectScene.button.onClick.AddListener(() => { var tempPath = _jsonScenePath; if (keepFolder_Bool.val) { tempPath = scenePreviousFolder; } filename.val = ""; selectPerson.val = "None"; sceneBool = true; var jsonSceneShortcuts = FileManagerSecure.GetShortCutsForDirectory(_jsonScenePath, false, false, true, true); if (!shortcuts_Bool.val) { jsonSceneShortcuts = null; } SuperController.singleton.GetMediaPathDialog(HandleLoadPreset, "json", tempPath, true, true, false, null, false, jsonSceneShortcuts); //SuperController.singleton.GetScenePathDialog(HandleLoadPreset); }); JSONStorableAction SelectSceneDatas = new JSONStorableAction("Select Scene", () => { selectPerson.val = "None"; sceneBool = true; HandleLoadPreset(""); }); selectPerson = new JSONStorableStringChooser("Select Person", null, "None", "Select Person"); UIDynamicPopup udp3 = CreatePopup(selectPerson, true); udp3.popup.selectColor = new Color(0.8f, 0.8f, 0.8f); personList.Add("None"); selectPerson.choices = personList; selectPerson.val = "None"; List timeList = new List { "1", "2", "5", "10", "15", "20" }; selectWaitTime = new JSONStorableStringChooser("Select Wait Time", timeList, "5", "Select Wait Time"); selectWaitTime.choices = timeList; selectWaitTime.val = "5"; var loadScene = CreateButton("Load Appearance From Scene", true); loadScene.button.onClick.AddListener(() => { if (selectPerson.val == "None") { var tempPath = _jsonScenePath; if (scenePreviousFolder != "" && keepFolder_Bool.val) { tempPath = scenePreviousFolder; } filename.val = ""; sceneBool = true; //var jsonSceneShortcuts = FileManagerSecure.GetShortCutsForDirectory(scenePreviousFolder, false, false, true, true); var jsonSceneShortcuts = FileManagerSecure.GetShortCutsForDirectory(_jsonScenePath, false, false, true, true); if (!shortcuts_Bool.val) { jsonSceneShortcuts = null; } SuperController.singleton.GetMediaPathDialog(HandleLoadPreset, "json", tempPath, true, true, false, null, false, jsonSceneShortcuts); //SuperController.singleton.GetScenePathDialog(HandleLoadPreset); //SuperController.singleton.GetMediaPathDialog(HandleLoadPreset, "json", _jsonScenePath); } else { sceneBool = true; HandleLoadPreset(reload); } }); JSONStorableAction LoadSceneDatas = new JSONStorableAction("Load Appearance From Scene", () => { sceneBool = true; HandleLoadPreset(""); }); //spacer = CreateSpacer(false); //spacer.height = 40f; message = new JSONStorableString("", ""); messageBox = CreateTextField(message, false); messageBox.height = 200f; hairAndClothing = new JSONStorableString("", ""); messageBox2 = CreateTextField(hairAndClothing, false); messageBox2.height = 220f; persons = new JSONStorableString("", ""); messageBox3 = CreateTextField(persons, true); messageBox3.height = 110f; missingItem = new JSONStorableString("", ""); messageBox4 = CreateTextField(missingItem, true); messageBox4.height = 150f; var selectAll = CreateButton("Select All Options"); selectAll.button.onClick.AddListener(SelectAll); JSONStorableAction selectAllAct = new JSONStorableAction("Select All Options", SelectAll); var clearAll = CreateButton("Clear All Options", true); clearAll.button.onClick.AddListener(ClearAll); JSONStorableAction clearAllAct = new JSONStorableAction("Clear All Options", ClearAll); morphs_Bool = new JSONStorableBool("Change Morphs", true); CreateToggle(morphs_Bool, false); scale_Bool = new JSONStorableBool("Change Scale", true); CreateToggle(scale_Bool, false); breast_Bool = new JSONStorableBool("Change Breast Physics", true); CreateToggle(breast_Bool, false); glute_Bool = new JSONStorableBool("Change Glute Physics", true); CreateToggle(glute_Bool, false); textures_Bool = new JSONStorableBool("Change Textures", true); CreateToggle(textures_Bool, false); eye_Bool = new JSONStorableBool("Change Eyes", true); CreateToggle(eye_Bool, false); disableTongueCollision = new JSONStorableBool("Disable Tongue Collision", true); CreateToggle(disableTongueCollision, false); _clearOldCUA = new JSONStorableBool("Clear Old Custom Unity Asset", true); CreateToggle(_clearOldCUA, false); mouth_Bool = new JSONStorableBool("Change Mouth", true); CreateToggle(mouth_Bool, true); hair_Bool = new JSONStorableBool("Change Hair", true); CreateToggle(hair_Bool, true); clothing_Bool = new JSONStorableBool("Change Clothing", true); previousClothingBool = clothing_Bool.val; //CreateToggle(clothing_Bool, true); realClothing_Bool = new JSONStorableBool("Change Real Clothing", true); CreateToggle(realClothing_Bool, true); notRealClothing_Bool = new JSONStorableBool("Change Not Real Clothing", true); CreateToggle(notRealClothing_Bool, true); clothingMerge_Bool = new JSONStorableBool("Clothing Merge Load", false); CreateToggle(clothingMerge_Bool, true); cua_Bool = new JSONStorableBool("Load CUA (Scene only)", true); CreateToggle(cua_Bool, true); plugin_Bool = new JSONStorableBool("Load Plugin", false); CreateToggle(plugin_Bool, true); deletePluginPreset_Bool = new JSONStorableBool("Delete Plugin Preset File", true); //CreateToggle(deletePluginPreset_Bool, true); appearanceFileUrl = new JSONStorableUrl("Set Appearance File URL", ""); JSONStorableAction appearanceFileLoadAct = new JSONStorableAction("Appearance File Load", () => { selectPerson.val = "None"; sceneBool = false; _fromUrl = true; HandleLoadPreset(""); }); UIDynamicPopup udp4 = CreateScrollablePopup(selectWaitTime, true); udp4.popup.selectColor = new Color(0.8f, 0.8f, 0.8f); 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; RegisterString(filename); RegisterBool(keepFolder_Bool); RegisterAction(LoadVapDatas); RegisterAction(LoadJsonDatas); RegisterAction(reloadAct); RegisterBool(shortcuts_Bool); RegisterAction(SelectSceneDatas); RegisterStringChooser(selectPerson); RegisterAction(LoadSceneDatas); RegisterBool(morphs_Bool); RegisterBool(scale_Bool); RegisterBool(breast_Bool); RegisterBool(glute_Bool); RegisterBool(textures_Bool); RegisterBool(eye_Bool); RegisterBool(mouth_Bool); RegisterBool(hair_Bool); RegisterBool(clothing_Bool); RegisterBool(realClothing_Bool); RegisterBool(notRealClothing_Bool); RegisterBool(clothingMerge_Bool); RegisterBool(cua_Bool); RegisterBool(plugin_Bool); RegisterBool(deletePluginPreset_Bool); RegisterBool(disableTongueCollision); RegisterBool(_clearOldCUA); RegisterAction(selectAllAct); RegisterAction(clearAllAct); RegisterStringChooser(selectWaitTime); RegisterUrl(appearanceFileUrl); RegisterAction(appearanceFileLoadAct); #endregion } catch (Exception e) { SuperController.LogError("Exception caught: " + e); } } private void SelectAll() { morphs_Bool.val = true; scale_Bool.val = true; breast_Bool.val = true; glute_Bool.val = true; textures_Bool.val = true; eye_Bool.val = true; mouth_Bool.val = true; hair_Bool.val = true; clothing_Bool.val = true; realClothing_Bool.val = true; notRealClothing_Bool.val = true; clothingMerge_Bool.val = true; cua_Bool.val = true; plugin_Bool.val = true; deletePluginPreset_Bool.val = true; previousClothingBool = true; } private void ClearAll() { morphs_Bool.val = false; scale_Bool.val = false; breast_Bool.val = false; glute_Bool.val = false; textures_Bool.val = false; eye_Bool.val = false; mouth_Bool.val = false; hair_Bool.val = false; clothing_Bool.val = false; realClothing_Bool.val = false; notRealClothing_Bool.val = false; clothingMerge_Bool.val = false; cua_Bool.val = false; plugin_Bool.val = false; deletePluginPreset_Bool.val = false; previousClothingBool = false; } private void makeDic() { idDic = new Dictionary>(); foreach (var item in idList) { if (TargetAtom.GetStorableByID(item) != null) { var act = TargetAtom.GetStorableByID(item).GetActionNames(); var actAndParam = TargetAtom.GetStorableByID(item).GetAllParamAndActionNames(); List param = new List(); foreach (var dummy in actAndParam) { if (!act.Contains(dummy) && !actionList.Contains(dummy)) { param.Add(dummy); } } if (param.Count >= 1) { idDic[item] = param; } } } } #region Preset Load and Save private void HandleLoadPreset(string path) { //SuperController.LogMessage(path); if (filename.val != "" || appearanceFileUrl.val != "") { string fileUrl; if (_fromUrl && appearanceFileUrl.val != "") { fileUrl = appearanceFileUrl.val.ToString(); _fromUrl = false; //SuperController.LogMessage("URL " + fileUrl); } else if (filename.val != "") { fileUrl = filename.val.ToString(); //SuperController.LogMessage("Name " + fileUrl); } else if (path != "") { fileUrl = path; } else { return; } fileUrl = fileUrl.Replace("\\", "/"); if (fileUrl.Length > 5) { if (fileUrl.Substring(fileUrl.Length - 5, 5) == ".json") { ext = ".json"; } } if (fileUrl.Length > 4) { if (fileUrl.Substring(fileUrl.Length - 4, 4) == ".vap") { ext = ".vap"; } } if (ext == "") { fileUrl = fileUrl + ".vap"; } if (fileUrl.IndexOf(":") == -1) { if (fileUrl.Substring(0, 7) != "Custom/" && fileUrl.Substring(0, 6) != "Saves/") // 外部コントロールでJSONがロードできなかった対策 { path = "Custom/Atom/Person/Appearance/" + fileUrl; } else { path = fileUrl; } } else { path = fileUrl; } } if (path == "") { return; } else { path = path.Replace("\\", "/"); reload = path; } hairAndClothing.val = ""; if (!sceneBool) { personList = new List(); personList.Clear(); personList.Add("None"); selectPerson.choices = personList; selectPerson.val = "None"; persons.val = ""; var pathSplit = path.Replace("\\", "/").Split('/'); var tempName = pathSplit[pathSplit.Length - 1]; if (tempName.Substring(0, 7) == "Preset_") { tempName = tempName.Substring(7); } tempName = tempName.Replace(".vap", "").Replace(".json", ""); hairAndClothing.val = "Preset Name: " + tempName + "\n"; } else if (selectPerson.val == "None") { personList = new List(); personList.Clear(); personList.Add("None"); persons.val = ""; } else if (selectPerson.val != "None") { hairAndClothing.val = "Person Name: " + selectPerson.val + "\n"; } loadDir = ""; string[] dirList = path.Split('/'); //bool tempBool = false; for (int i = 0; i < dirList.Count() - 1; i++) { loadDir = loadDir + dirList[i] + "/"; } string varName; if (path.Contains(":")) { varName = path.Substring(0, path.IndexOf(":")); if (varName.Length < 5) { varName = ""; } else { varName = varName + ":/"; } } else { varName = ""; } string tempPath = loadDir.Substring(0, loadDir.Length - 1); var charPosi = tempPath.IndexOf("Custom/Atom/Person/"); if (charPosi != -1) { vapPreviousFolder = varName + tempPath.Substring(charPosi); vapPreviousFolder = vapPreviousFolder.Replace("/", "\\"); } charPosi = tempPath.IndexOf("Saves/Person/"); if (charPosi != -1) { jsonPreviousFolder = varName + tempPath.Substring(charPosi); jsonPreviousFolder = jsonPreviousFolder.Replace("/", "\\"); } charPosi = tempPath.IndexOf("Saves/scene"); if (charPosi != -1) { scenePreviousFolder = varName + tempPath.Substring(charPosi); scenePreviousFolder = scenePreviousFolder.Replace("/", "\\"); } if (path.Contains(":")) { SELF = path.Substring(0, path.IndexOf(":")); } //SuperController.LogMessage(SELF); //SuperController.LogMessage(path); var tempLoadData = SuperController.singleton.ReadFileIntoString(path); tempLoadData = tempLoadData.Replace("SELF:/", SELF + ":/"); //string pattern = "\"([^\"]*?\\.latest:/[^\"]*?)\""; string pattern = "\"([^\"]*?\\.latest:/)"; MatchCollection matches = Regex.Matches(tempLoadData, pattern); HashSet uniqueStrings = new HashSet(); foreach (Match match in matches) { uniqueStrings.Add(match.Groups[1].Value); } List extractedStrings = new List(uniqueStrings); if (extractedStrings.Count != 0) { foreach (var item in extractedStrings) { var returnName = checkVarDir(item); tempLoadData = tempLoadData.Replace(item, returnName); //SuperController.LogMessage(item); //SuperController.LogMessage(returnName); } } LoadData = tempLoadData; jSONNode = JSON.Parse(LoadData); _isReset = true; bool jsonExt = path.Substring(path.Length - 4, 4) != ".vap"; if (jsonExt) { atomArray = jSONNode["atoms"].AsArray; for (int k = 0; k < atomArray.Count; k++) { asAtomObject = atomArray[k].AsObject; id = asAtomObject["id"]; string type = asAtomObject["type"]; JSONArray tempArray = asAtomObject["storables"].AsArray; JSONClass tempObject; string characterType = ""; for (int l = 0; l < tempArray.Count; l++) { tempObject = tempArray[l].AsObject; string tempId = tempObject["id"]; if ("geometry" == tempId) { if (tempObject["character"] != null) { characterType = tempObject["character"]; } } } if (type == "Person") { if (sceneBool && selectPerson.val == "None") { personList.Add(id); persons.val = persons.val + id + " : " + characterType + "\n"; } asArray = asAtomObject["storables"].AsArray; } } if (sceneBool && selectPerson.val == "None") { if (personList.Count != 2) { selectPerson.choices = personList; return; } else { selectPerson.choices = personList; selectPerson.val = personList[1]; hairAndClothing.val = "Person Name: " + selectPerson.val + "\n"; } } if (sceneBool) { var m = 0; asObjectCUA = new Dictionary(); for (int k = 0; k < atomArray.Count; k++) { asAtomObject = atomArray[k].AsObject; id = asAtomObject["id"]; string type = asAtomObject["type"]; if (type == "Person" && id == selectPerson.val) { asArray = asAtomObject["storables"].AsArray; for (int l = 0; l < asArray.Count; l++) { asObject = asArray[l].AsObject; id = asObject["id"]; if (id == "control") { posi.x = float.Parse(asObject["position"][0]); posi.y = float.Parse(asObject["position"][1]); posi.z = float.Parse(asObject["position"][2]); sourcePositionDic[id] = posi; rota.x = float.Parse(asObject["rotation"][0]); rota.y = float.Parse(asObject["rotation"][1]); rota.z = float.Parse(asObject["rotation"][2]); sourceRotationDic[id] = rota; } else if (id == "hip") { if (asObject["relativeRootPosition"] != null && asObject["relativeRootRotation"] != null) { posi.x = float.Parse(asObject["relativeRootPosition"][0]); posi.y = float.Parse(asObject["relativeRootPosition"][1]); posi.z = float.Parse(asObject["relativeRootPosition"][2]); sourcePositionDic["relativeRootPosition"] = posi; rota.x = float.Parse(asObject["relativeRootRotation"][0]); rota.y = float.Parse(asObject["relativeRootRotation"][1]); rota.z = float.Parse(asObject["relativeRootRotation"][2]); sourceRotationDic["relativeRootRotation"] = rota; sourcePositionDic[id] = new Vector3(0, 0, 0); sourceRotationDic[id] = new Vector3(0, 0, 0); } else { sourcePositionDic["relativeRootPosition"] = new Vector3(0, 0, 0); sourceRotationDic["relativeRootRotation"] = new Vector3(0, 0, 0); sourcePositionDic[id] = new Vector3(0, 0, 0); sourceRotationDic[id] = new Vector3(0, 0, 0); } if (asObject["rootPosition"] != null && asObject["rootRotation"] != null) { posi.x = float.Parse(asObject["rootPosition"][0]); posi.y = float.Parse(asObject["rootPosition"][1]); posi.z = float.Parse(asObject["rootPosition"][2]); sourcePositionDic["rootPosition"] = posi; rota.x = float.Parse(asObject["rootRotation"][0]); rota.y = float.Parse(asObject["rootRotation"][1]); rota.z = float.Parse(asObject["rootRotation"][2]); sourceRotationDic["rootRotation"] = rota; } } else if (asObject["localPosition"] != null && asObject["localPosition"] != null) { id = asObject["id"]; posi.x = float.Parse(asObject["localPosition"][0]); posi.y = float.Parse(asObject["localPosition"][1]); posi.z = float.Parse(asObject["localPosition"][2]); sourcePositionDic[id] = posi; rota.x = float.Parse(asObject["localRotation"][0]); rota.y = float.Parse(asObject["localRotation"][1]); rota.z = float.Parse(asObject["localRotation"][2]); sourceRotationDic[id] = rota; } else if (asObject["position"] != null && asObject["rotation"] != null) { posi.x = float.Parse(asObject["position"][0]); posi.y = float.Parse(asObject["position"][1]); posi.z = float.Parse(asObject["position"][2]); sourcePositionDic[id] = posi; rota.x = float.Parse(asObject["rotation"][0]); rota.y = float.Parse(asObject["rotation"][1]); rota.z = float.Parse(asObject["rotation"][2]); sourceRotationDic[id] = rota; } } } if (type == "CustomUnityAsset") { var tempAsArray = asAtomObject["storables"].AsArray; for (int l = 0; l < tempAsArray.Count; l++) { var tempAsObject = tempAsArray[l].AsObject; string tempId = tempAsObject["id"]; if (tempId == "control") { if (tempAsObject["linkTo"] != null) { var sp = tempAsObject["linkTo"].ToString().Substring(1).Split(':'); if (sp[0] == selectPerson.val) { asObjectCUA[m] = atomArray[k].AsObject; m++; } } } } } } } } else { if (jSONNode["setUnlistedParamsToDefault"] != null) { _isReset = bool.Parse(jSONNode["setUnlistedParamsToDefault"]); } asArray = jSONNode["storables"].AsArray; } hairAndClothing.val = hairAndClothing.val + "setUnlistedParamsToDefault: " + _isReset.ToString() + "\n"; scale = 1f; idListVap = new List(); pluginPreset = new JSONClass(); cuaPluginPreset = new JSONClass(); maleOnFemale = false; femaleOnMale = false; characterName = ""; int jn = 0; for (int i = 0; i < asArray.Count; i++) { asObject = asArray[i].AsObject; id = asObject["id"]; idListVap.Add(id); if (id == "geometry" && asObject["character"] != null) { characterName = asObject["character"]; } if (id == "geometry" && asObject["useMaleMorphsOnFemale"] != null) { maleOnFemale = bool.Parse(asObject["useMaleMorphsOnFemale"]); } if (id == "geometry" && asObject["useFemaleMorphsOnMale"] != null) { femaleOnMale = bool.Parse(asObject["useFemaleMorphsOnMale"]); } if (id == "geometry" && asObject["hair"] != null) { hairList = new List(); if (asObject["hair"].Count != 0) { hairAsArray = asObject["hair"].AsArray; for (int j = 0; j < hairAsArray.Count; j++) { hairAsObject = hairAsArray[j].AsObject; if (hairAsObject["id"] != null) { string hair = hairAsObject["id"]; if (hair.Substring(hair.Length - 4) == ".vam") { if (hairAsObject["internalId"] != null && hairAsObject["internalId"] != "") { hairList.Add(hairAsObject["internalId"]); string temp = hairAsObject["internalId"]; if (temp.Contains(":")) { var tempSplit = temp.Split(':'); hairList.Add(tempSplit[1]); hairList.Add(tempSplit[1].Replace(" ", "")); } temp = temp.Replace(" ", ""); hairList.Add(temp); } else { hairList.Add(hairAsObject["id"]); string temp = hairAsObject["id"]; if (temp.Contains(":")) { var tempSplit = temp.Split(':'); hairList.Add(tempSplit[1]); hairList.Add(tempSplit[1].Replace(" ", "")); } temp = temp.Replace(" ", ""); hairList.Add(temp); } } else { if (hairAsObject["id"] != null && hairAsObject["id"] != "") { hairList.Add(hairAsObject["id"]); string temp = hairAsObject["id"]; if (temp.Contains(":")) { var tempSplit = temp.Split(':'); hairList.Add(tempSplit[1]); hairList.Add(tempSplit[1].Replace(" ", "")); } temp = temp.Replace(" ", ""); hairList.Add(temp); } } } else { if (hairAsObject["name"] != null && hairAsObject["name"] != "") { hairList.Add(hairAsObject["name"]); string temp = hairAsObject["name"]; if (temp.Contains(":")) { var tempSplit = temp.Split(':'); hairList.Add(tempSplit[1]); hairList.Add(tempSplit[1].Replace(" ", "")); } temp = temp.Replace(" ", ""); hairList.Add(temp); } } } } else { if (asObject["hair"] != null && asObject["hair"] != "") { hairList.Add(asObject["hair"]); string temp = asObject["hair"]; if (temp.Contains(":")) { var tempSplit = temp.Split(':'); hairList.Add(tempSplit[1]); hairList.Add(tempSplit[1].Replace(" ", "")); } temp = temp.Replace(" ", ""); hairList.Add(temp); } } hairList.Add("HairPresets"); hairList.Add("hairScalpMaskTool"); hairList.Add("HairSim"); hairList.Add("hairTool"); hairList.Add("Sim2Hair"); hairList.Add("V5ElitePonytail"); hairList.Add("VictoriaElitePonytail"); //hairList.Add("HairSimShortBangs"); //SuperController.LogMessage("hair"); } if (id == "geometry" && asObject["clothing"] != null) { clothingList = new List(); if (asObject["clothing"].Count != 0) { clothingAsArray = asObject["clothing"].AsArray; for (int j = 0; j < clothingAsArray.Count; j++) { clothingAsObject = clothingAsArray[j].AsObject; if (clothingAsObject["id"] != null) { string clothing = clothingAsObject["id"]; if (clothing.Substring(clothing.Length - 4) == ".vam") { if (clothingAsObject["internalId"] != null) { clothingList.Add(clothingAsObject["internalId"]); string temp = clothingAsObject["internalId"]; if (temp.Contains(":")) { var tempSplit = temp.Split(':'); clothingList.Add(tempSplit[1]); clothingList.Add(tempSplit[1].Replace(" ", "")); } temp = temp.Replace(" ", ""); clothingList.Add(temp); } else { clothingList.Add(clothingAsObject["id"]); string temp = clothingAsObject["id"]; if (temp.Contains(":")) { var tempSplit = temp.Split(':'); clothingList.Add(tempSplit[1]); clothingList.Add(tempSplit[1].Replace(" ", "")); } temp = temp.Replace(" ", ""); clothingList.Add(temp); } } else { clothingList.Add(clothingAsObject["id"]); string temp = clothingAsObject["id"]; if (temp.Contains(":")) { var tempSplit = temp.Split(':'); clothingList.Add(tempSplit[1]); clothingList.Add(tempSplit[1].Replace(" ", "")); } temp = temp.Replace(" ", ""); clothingList.Add(temp); } } else if (clothingAsObject["name"] != null) { string clothing = clothingAsObject["name"]; if (clothing.Substring(clothing.Length - 4) == ".vam") { if (clothingAsObject["internalId"] != null) { clothingList.Add(clothingAsObject["internalId"]); string temp = clothingAsObject["internalId"]; if (temp.Contains(":")) { var tempSplit = temp.Split(':'); clothingList.Add(tempSplit[1]); clothingList.Add(tempSplit[1].Replace(" ", "")); } temp = temp.Replace(" ", ""); clothingList.Add(temp); } else { clothingList.Add(clothingAsObject["name"]); string temp = clothingAsObject["name"]; if (temp.Contains(":")) { var tempSplit = temp.Split(':'); clothingList.Add(tempSplit[1]); clothingList.Add(tempSplit[1].Replace(" ", "")); } temp = temp.Replace(" ", ""); clothingList.Add(temp); } } else { clothingList.Add(clothingAsObject["name"]); string temp = clothingAsObject["name"]; if (temp.Contains(":")) { var tempSplit = temp.Split(':'); clothingList.Add(tempSplit[1]); clothingList.Add(tempSplit[1].Replace(" ", "")); } temp = temp.Replace(" ", ""); clothingList.Add(temp); } } } } else { if (asObject["clothing"] != null && asObject["clothing"] != "") { clothingList.Add(asObject["clothing"]); string temp = asObject["clothing"]; if (temp.Contains(":")) { var tempSplit = temp.Split(':'); clothingList.Add(tempSplit[1]); clothingList.Add(tempSplit[1].Replace(" ", "")); } temp = temp.Replace(" ", ""); clothingList.Add(temp); } } } if (id == "rescaleObject") { if (asObject["scale"] != null) { scale = float.Parse(asObject["scale"]); } else { scale = 1f; } } if (id == "PluginManager" && plugin_Bool.val) { pluginPreset = new JSONClass(); if (asObject["plugins"] != null) { if (asObject["plugins"].Count != 0) { pluginPreset["setUnlistedParamsToDefault"] = "true"; pluginPreset["storables"][0]["id"] = "PluginManager"; var collection = asObject["plugins"].AsObject; foreach (var item in collection.Keys) { if (asObject["plugins"][item] != null) { pluginPreset["storables"][0]["plugins"][item] = asObject["plugins"][item]; } } } } } if (id.Contains("plugin#") && plugin_Bool.val) { jn++; List keys = new List(asObject.Keys); foreach (var item in keys) { if (asObject[item] != null) { pluginPreset["storables"][jn][item] = asObject[item]; } } } } geometry = TargetAtom.GetStorableByID("geometry"); character = geometry as DAZCharacterSelector; morphControl = character.morphsControlUI; paramControls = new Dictionary(); foreach (var item in idList) { if (TargetAtom.GetStorableByID(item) != null) { paramControls[item] = TargetAtom.GetStorableByID(item); } } makeDic(); message.val = "Processing"; missingItem.val = ""; StartCoroutine(applyData()); } IEnumerator applyData() { _currentSkinDic = new Dictionary(); var jc = TargetAtom.GetStorableByID("skin").GetJSON(); _currentSkinDic["skin"] = jc.AsObject; jc = TargetAtom.GetStorableByID("textures").GetJSON(); _currentSkinDic["textures"] = jc.AsObject; jc = TargetAtom.GetStorableByID("teeth").GetJSON(); _currentSkinDic["teeth"] = jc.AsObject; jc = TargetAtom.GetStorableByID("tongue").GetJSON(); _currentSkinDic["tongue"] = jc.AsObject; jc = TargetAtom.GetStorableByID("mouth").GetJSON(); _currentSkinDic["mouth"] = jc.AsObject; simClothingDic = new Dictionary(); simClothingList = new List(); var tempId = TargetAtom.GetStorableIDs(); foreach (var item in tempId) { if (TargetAtom.GetStorableByID(item).GetBoolParamNames() != null) { var tempBool = TargetAtom.GetStorableByID(item).GetBoolParamNames(); if (tempBool.Contains("simEnabled")) { simClothingList.Add(item); simClothingDic[item] = TargetAtom.GetStorableByID(item).GetBoolJSONParam("simEnabled").val; TargetAtom.GetStorableByID(item).GetBoolJSONParam("simEnabled").val = false; } } } message.val = "Set New Character"; yield return setNewCharacter(); message.val = message.val + " ... done" + "\n"; message.val = message.val + "Clear Old Data"; clearOldData(); message.val = message.val + " ... done" + "\n"; message.val = message.val + "Set New Data"; yield return setNewData(); message.val = message.val + " ... done" + "\n"; if (textures_Bool.val) { message.val = message.val + "Clear Old Textures"; clearOldSkin(); message.val = message.val + " ... done" + "\n"; } if (hair_Bool.val) { message.val = "Clear Old Hair"; clearOldHair(); //yield return new WaitForSeconds(1f);もともと消してた message.val = message.val + " ... done" + "\n"; message.val = message.val + "Set New Hair"; setNewHair1(); //yield return new WaitForSeconds(1f); 必要かも message.val = message.val + " ... done" + "\n"; message.val = message.val + "Set Hair Params"; yield return setNewHair2(); //yield return new WaitForSeconds(1f); message.val = message.val + " ... done" + "\n"; } if (realClothing_Bool.val || notRealClothing_Bool.val) { message.val = message.val + "Clear Old Clothing"; clearOldClothing(); message.val = message.val + " ... done" + "\n"; message.val = message.val + "Set New Clothing"; setNewClothing1(); //yield return new WaitForSeconds(1f); 必要かも message.val = message.val + " ... done" + "\n"; message.val = message.val + "Set Clothing Params"; yield return setNewClothing2(); //yield return new WaitForSeconds(1f); message.val = message.val + " ... done" + "\n"; } if (textures_Bool.val || mouth_Bool.val) { message.val = "Set New Textures"; setNewTextures(); message.val = message.val + " ... done" + "\n"; message.val = message.val + "Load New Textures"; yield return loadTexturesPreset(); message.val = message.val + " ... done" + "\n"; } if (plugin_Bool.val) { message.val = message.val + "Load Plugin"; loadPlugin(); message.val = message.val + " ... done" + "\n"; } if (cua_Bool.val && sceneBool) { message.val = message.val + "Load CUA"; yield return loadCUA(); //yield return new WaitForSeconds(2f); message.val = message.val + " ... done" + "\n"; } message.val = message.val + "Sim Enable"; simEnable(); message.val = message.val + " ... done" + "\n"; TargetAtom.collisionEnabledJSON.val = true; if (disableTongueCollision.val) { TargetAtom.GetStorableByID("TongueControl").GetBoolJSONParam("tongueCollision").val = false; } message.val = message.val + "Finished"; TargetAtom.GetStorableByID("AppearancePresets")?.GetComponent()?.postLoadEvent?.Invoke(); } private void clearOldData() { if (morphs_Bool.val) { if (_isReset || idListVap.Contains("geometry")) { geometry.GetBoolJSONParam("useAdvancedColliders").SetValToDefault(); geometry.GetBoolJSONParam("useAuxBreastColliders").SetValToDefault(); geometry.GetBoolJSONParam("disableAnatomy").SetValToDefault(); geometry.GetBoolJSONParam("useMaleMorphsOnFemale").SetValToDefault(); geometry.GetBoolJSONParam("useFemaleMorphsOnMale").SetValToDefault(); } if (_isReset || idListVap.Contains("JawControl")) { id = "JawControl"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null) { paramControls[id].GetBoolJSONParam(item).SetValToDefault(); } if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } } } } } if (_isReset || idListVap.Contains("BendFix")) { TargetAtom.GetStorableByID("BendFix").GetBoolJSONParam("enabled").SetValToDefault(); } if (_isReset || idListVap.Contains("FemaleAnatomy")) { TargetAtom.GetStorableByID("FemaleAnatomy").GetBoolJSONParam("enabled").SetValToDefault(); } if (_isReset || idListVap.Contains("MaleAnatomy")) { TargetAtom.GetStorableByID("MaleAnatomy").GetBoolJSONParam("enabled").SetValToDefault(); } if (_isReset || idListVap.Contains("BreastInOut")) { TargetAtom.GetStorableByID("BreastInOut").GetBoolJSONParam("enabled").SetValToDefault(); } if (_isReset || idListVap.Contains("EyelidControl")) { TargetAtom.GetStorableByID("EyelidControl").GetBoolJSONParam("eyelidLookMorphsEnabled").SetValToDefault(); } if (_isReset || idListVap.Contains("AutoJawMouthMorph")) { TargetAtom.GetStorableByID("AutoJawMouthMorph").GetBoolJSONParam("enabled").SetValToDefault(); } if (_isReset || idListVap.Contains("SoftBodyPhysicsEnabler")) { TargetAtom.GetStorableByID("SoftBodyPhysicsEnabler").GetBoolJSONParam("enabled").SetValToDefault(); } } if (breast_Bool.val && (_isReset || idListVap.Contains("BreastControl"))) { id = "BreastControl"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } } } } } if (breast_Bool.val && (_isReset || idListVap.Contains("BreastPhysicsMesh"))) { id = "BreastPhysicsMesh"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null) { paramControls[id].GetBoolJSONParam(item).SetValToDefault(); } if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } } } } } if (glute_Bool.val && (_isReset || idListVap.Contains("GluteControl"))) { id = "GluteControl"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } } } } } if (glute_Bool.val && (_isReset || idListVap.Contains("LowerPhysicsMesh"))) { id = "LowerPhysicsMesh"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null) { paramControls[id].GetBoolJSONParam(item).SetValToDefault(); } if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } } } } } if (textures_Bool.val && (_isReset || idListVap.Contains("FemaleEyelashes"))) { id = "FemaleEyelashes"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null) { paramControls[id].GetBoolJSONParam(item).SetValToDefault(); } if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } if (paramControls[id].GetColorJSONParam(item) != null) { paramControls[id].GetColorJSONParam(item).SetValToDefault(); } } } } } if (textures_Bool.val && (_isReset || idListVap.Contains("MaleEyelashes"))) { id = "MaleEyelashes"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null) { paramControls[id].GetBoolJSONParam(item).SetValToDefault(); } if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } if (paramControls[id].GetColorJSONParam(item) != null) { paramControls[id].GetColorJSONParam(item).SetValToDefault(); } } } } } if (eye_Bool.val && (_isReset || idListVap.Contains("irises"))) { id = "irises"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null) { paramControls[id].GetBoolJSONParam(item).SetValToDefault(); } if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } if (paramControls[id].GetUrlJSONParam(item) != null) { paramControls[id].GetUrlJSONParam(item).SetValToDefault(); } if (paramControls[id].GetColorJSONParam(item) != null) { paramControls[id].GetColorJSONParam(item).SetValToDefault(); } } } } } if (eye_Bool.val && (_isReset || idListVap.Contains("sclera"))) { id = "sclera"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null) { paramControls[id].GetBoolJSONParam(item).SetValToDefault(); } if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } if (paramControls[id].GetUrlJSONParam(item) != null) { paramControls[id].GetUrlJSONParam(item).SetValToDefault(); } if (paramControls[id].GetColorJSONParam(item) != null) { paramControls[id].GetColorJSONParam(item).SetValToDefault(); } } } } } if (eye_Bool.val && (_isReset || idListVap.Contains("lacrimals"))) { id = "lacrimals"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null) { paramControls[id].GetBoolJSONParam(item).SetValToDefault(); } if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } if (paramControls[id].GetUrlJSONParam(item) != null) { paramControls[id].GetUrlJSONParam(item).SetValToDefault(); } if (paramControls[id].GetColorJSONParam(item) != null) { paramControls[id].GetColorJSONParam(item).SetValToDefault(); } } } } } if (mouth_Bool.val && (_isReset || idListVap.Contains("teeth"))) { id = "teeth"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null) { paramControls[id].GetBoolJSONParam(item).SetValToDefault(); } if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } if (paramControls[id].GetUrlJSONParam(item) != null) { paramControls[id].GetUrlJSONParam(item).SetValToDefault(); } if (paramControls[id].GetColorJSONParam(item) != null) { paramControls[id].GetColorJSONParam(item).SetValToDefault(); } } } } } if (mouth_Bool.val && (_isReset || idListVap.Contains("tongue"))) { id = "tongue"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null) { paramControls[id].GetBoolJSONParam(item).SetValToDefault(); } if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } if (paramControls[id].GetUrlJSONParam(item) != null) { paramControls[id].GetUrlJSONParam(item).SetValToDefault(); } if (paramControls[id].GetColorJSONParam(item) != null) { paramControls[id].GetColorJSONParam(item).SetValToDefault(); } } } } } if (mouth_Bool.val && (_isReset || idListVap.Contains("mouth"))) { id = "mouth"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null) { paramControls[id].GetBoolJSONParam(item).SetValToDefault(); } if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } if (paramControls[id].GetUrlJSONParam(item) != null) { paramControls[id].GetUrlJSONParam(item).SetValToDefault(); } if (paramControls[id].GetColorJSONParam(item) != null) { paramControls[id].GetColorJSONParam(item).SetValToDefault(); } } } } } } private void clearOldSkin() { if (textures_Bool.val && (_isReset || idListVap.Contains("skin"))) { id = "skin"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null) { paramControls[id].GetBoolJSONParam(item).SetValToDefault(); } if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } if (paramControls[id].GetUrlJSONParam(item) != null) { paramControls[id].GetUrlJSONParam(item).SetValToDefault(); } if (paramControls[id].GetStringChooserJSONParam(item) != null) { paramControls[id].GetStringChooserJSONParam(item).SetValToDefault(); } if (paramControls[id].GetColorJSONParam(item) != null) { paramControls[id].GetColorJSONParam(item).SetValToDefault(); } } } } } if (textures_Bool.val && (_isReset || idListVap.Contains("textures"))) { id = "textures"; if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null) { paramControls[id].GetBoolJSONParam(item).SetValToDefault(); } if (paramControls[id].GetFloatJSONParam(item) != null) { paramControls[id].GetFloatJSONParam(item).SetValToDefault(); } if (item.Contains("Url") && paramControls[id].GetUrlJSONParam(item) != null) { paramControls[id].GetUrlJSONParam(item).SetValToDefault(); } } } } //paramControls[id].GetBoolJSONParam("autoBlendGenitalTextures").val = false; //paramControls[id].GetBoolJSONParam("autoBlendGenitalSpecGlossNormalTextures").val = false; } } private void clearOldHair() { if (hair_Bool.val && (_isReset || idListVap.Contains("geometry"))) { var allHair = TargetAtom.GetStorableByID("geometry").GetBoolParamNames(); foreach (var item in allHair) { if (TargetAtom.GetStorableByID("geometry").GetBoolJSONParam(item).val && item.Contains("hair:")) { TargetAtom.GetStorableByID("geometry").GetBoolJSONParam(item).val = false; } } } } private void clearOldClothing() { if ((realClothing_Bool.val || notRealClothing_Bool.val) && !clothingMerge_Bool.val && (_isReset || idListVap.Contains("geometry"))) { const string prefix = "clothing:"; var geometry = (DAZCharacterSelector)TargetAtom.GetStorableByID("geometry"); allNotRealClothingUids = new List(); allNotRealClothing = new List(); foreach (string boolParamName in geometry.GetBoolParamNames()) { if (!boolParamName.StartsWith(prefix)) { continue; } string uid = boolParamName; DAZClothingItem item = geometry.GetClothingItem(uid.Replace(prefix, "")); if (item.isRealItem) { if (item.isActiveAndEnabled && realClothing_Bool.val) { TargetAtom.GetStorableByID("geometry").GetBoolJSONParam(uid).val = false; } } else { if (item.isActiveAndEnabled && notRealClothing_Bool.val) { TargetAtom.GetStorableByID("geometry").GetBoolJSONParam(uid).val = false; } allNotRealClothingUids.Add(uid); var names = uid.Replace("clothing:", "").Replace(".vam", "").Replace("\\", "/").Split('/'); var name = names[names.Count() - 1]; allNotRealClothing.Add(name); if (name.Contains(" ")) { allNotRealClothing.Add(name.Replace(" ", "")); } } } } } private void setNewHair1() { if (hair_Bool.val) { var startIds = TargetAtom.GetStorableIDs(); for (int i = 0; i < asArray.Count; i++) { asObject = asArray[i].AsObject; id = asObject["id"]; if (id == "geometry" && asObject["hair"] != null) { if (asObject["hair"].Count != 0) { hairAsArray = asObject["hair"].AsArray; for (int j = 0; j < hairAsArray.Count; j++) { bool hit = false; hairAsObject = hairAsArray[j].AsObject; if (hairAsObject["id"] != null) { tempHair = hairAsObject["id"]; } else { tempHair = hairAsObject["name"]; } if (tempHair.Contains("SELF")) { tempHair = tempHair.Replace("SELF:", SELF + ":"); } if (geometry.GetBoolJSONParam("hair:" + tempHair) != null) { hit = true; tempHair = "hair:" + tempHair; } else { if (tempHair.Contains(":/") && tempHair.Substring(tempHair.Length - 4) == ".vam") { string[] tempHairVar = tempHair.Split(':'); string[] tempHairName = tempHairVar[0].Split('.'); int ver = tempHairName.Count(); string tempName = ""; for (int k = 0; k < ver - 1; k++) { tempName = tempName + tempHairName[k] + "."; } string filenameVar; int varVer = 0; for (int k = 0; k < 100; k++) { filenameVar = tempName + k.ToString() + ":" + tempHairVar[1]; if (geometry.GetBoolJSONParam("hair:" + filenameVar) != null) { varVer = k; } } if (varVer != 0) { hit = true; tempHair = "hair:" + tempName + varVer.ToString() + ":" + tempHairVar[1]; } else { tempHair = tempHairVar[1].Substring(1); if (geometry.GetBoolJSONParam("hair:" + tempHair) != null) { hit = true; tempHair = "hair:" + tempHair; } } } if (!hit && !tempHair.Contains(":/") && tempHair.Contains(":") && !tempHair.Contains(".vam")) { string[] tempHairName = tempHair.Split(':'); foreach (var item in geometry.GetBoolParamNames()) { if (item.Contains(tempHairName[0]) && item.Contains("/" + tempHairName[1] + ".vam")) { hit = true; tempHair = item; } } if (!hit) { foreach (var item in geometry.GetBoolParamNames()) { if (item.Contains("/" + tempHairName[1] + ".vam")) { hit = true; tempHair = item; } } } } if (!hit) { string filenameVar; if (tempHair.Contains("/")) { string[] tempHairName = tempHair.Split('/'); filenameVar = "/" + tempHairName[tempHairName.Count() - 1]; } else { filenameVar = "/" + tempHair; } if (!filenameVar.Contains(".vam")) { filenameVar += ".vam"; } foreach (var item in geometry.GetBoolParamNames()) { if (item.Contains(filenameVar)) { hit = true; tempHair = item; } } } } //SuperController.LogMessage("test " + tempHair); //SuperController.LogMessage(hit.ToString()); //SuperController.LogMessage(""); if (hit && geometry.GetBoolJSONParam(tempHair) != null) { if (hairAsObject["enabled"] != null) { geometry.GetBoolJSONParam(tempHair).val = bool.Parse(hairAsObject["enabled"]); } else { geometry.GetBoolJSONParam(tempHair).val = true; } if (hairAsObject["internalId"] != null) { hairAndClothing.val = hairAndClothing.val + "Hair: " + hairAsObject["internalId"] + "\n"; } else if (hairAsObject["name"] != null) { hairAndClothing.val = hairAndClothing.val + "Hair: " + hairAsObject["name"] + "\n"; } else if (hairAsObject["id"] != null) { string temp = hairAsObject["id"]; if (!temp.Contains("/")) { hairAndClothing.val = hairAndClothing.val + "Hair: " + hairAsObject["id"] + "\n"; } else { string[] dir = temp.Split('/'); temp = dir[dir.Count() - 1]; hairAndClothing.val = hairAndClothing.val + "Hair: " + temp + "\n"; } } } else { missingItem.val = missingItem.val + "Missing Hair:" + tempHair + "\n"; } } } else { string temp = asObject["hair"]; if (temp.Length > 1) { string tempHair = "hair:" + asObject["hair"]; if (geometry.GetBoolJSONParam(tempHair) != null) { geometry.GetBoolJSONParam(tempHair).val = true; } else { foreach (var item in geometry.GetBoolParamNames()) { if (item.Contains("/" + asObject["hair"] + ".vam")) { tempHair = item; } } geometry.GetBoolJSONParam(tempHair).val = true; } } } //SuperController.LogMessage(asObject["hair"]); } } if (_isReset) { var endIds = TargetAtom.GetStorableIDs(); List actIds = new List(); foreach (var item in endIds) { if (!startIds.Contains(item)) { actIds.Add(item); } } foreach (var item2 in actIds) { var actAPA = TargetAtom.GetStorableByID(item2).GetAllParamAndActionNames(); foreach (var item3 in actAPA) { if (TargetAtom.GetStorableByID(item2).GetBoolJSONParam(item3) != null) { TargetAtom.GetStorableByID(item2).GetBoolJSONParam(item3).SetValToDefault(); continue; } if (TargetAtom.GetStorableByID(item2).GetFloatJSONParam(item3) != null) { TargetAtom.GetStorableByID(item2).GetFloatJSONParam(item3).SetValToDefault(); continue; } if (TargetAtom.GetStorableByID(item2).GetColorJSONParam(item3) != null) { TargetAtom.GetStorableByID(item2).GetColorJSONParam(item3).SetValToDefault(); continue; } if (TargetAtom.GetStorableByID(item2).GetStringJSONParam(item3) != null) { TargetAtom.GetStorableByID(item2).GetStringJSONParam(item3).SetValToDefault(); continue; } if (TargetAtom.GetStorableByID(item2).GetVector3JSONParam(item3) != null) { TargetAtom.GetStorableByID(item2).GetVector3JSONParam(item3).SetValToDefault(); continue; } if (TargetAtom.GetStorableByID(item2).GetUrlJSONParam(item3) != null) { TargetAtom.GetStorableByID(item2).GetUrlJSONParam(item3).SetValToDefault(); continue; } if (TargetAtom.GetStorableByID(item2).GetStringChooserJSONParam(item3) != null) { TargetAtom.GetStorableByID(item2).GetStringChooserJSONParam(item3).SetValToDefault(); } } } } } } //private void setNewHair2() IEnumerator setNewHair2() { if (hair_Bool.val) { for (int i = 0; i < asArray.Count; i++) { bool thisIsHair = false; asObject = asArray[i].AsObject; id = asObject["id"]; foreach (var item in hairList) { if (id.Contains(item) && item.Length != 0) { thisIsHair = true; } } if (thisIsHair) { hairAsObject = asArray[i].AsObject; bool ready = false; float timeout = Time.unscaledTime + float.Parse(selectWaitTime.val); while (!ready && Time.unscaledTime < timeout) { yield return null; ready = TargetAtom.GetStorableByID(id) != null; if (!ready) { var tempIDs = TargetAtom.GetStorableIDs(); foreach (var tempId in tempIDs) { if (tempId.Contains(id)) { id = tempId; } } } } if (!ready) { missingItem.val = missingItem.val + "Missing Hair:" + id + "\n"; } if (TargetAtom.GetStorableByID(id) != null) { var param = hairAsObject.Keys; List collection = new List(); if (TargetAtom.GetStorableByID(id).GetUrlParamNames() != null) { collection = TargetAtom.GetStorableByID(id).GetUrlParamNames(); foreach (var item in collection) { if (param.Contains(item) && hairAsObject[item] != null) { string checkUrl = hairAsObject[item]; if (checkUrl.Contains(".")) { var fileUrl = checkPath(hairAsObject[item]); if (fileUrl != "") { TargetAtom.GetStorableByID(id).GetUrlJSONParam(item).val = fileUrl; } } } else if (param.Contains(item)) { TargetAtom.GetStorableByID(id).GetUrlJSONParam(item).val = ""; } } } if (TargetAtom.GetStorableByID(id).GetBoolParamNames() != null) { collection = TargetAtom.GetStorableByID(id).GetBoolParamNames(); foreach (var item in collection) { if (param.Contains(item) && hairAsObject[item] != null) { TargetAtom.GetStorableByID(id).GetBoolJSONParam(item).val = bool.Parse(hairAsObject[item]); } else if (param.Contains(item)) { TargetAtom.GetStorableByID(id).GetBoolJSONParam(item).SetValToDefault(); } } } if (TargetAtom.GetStorableByID(id).GetColorParamNames() != null) { collection = TargetAtom.GetStorableByID(id).GetColorParamNames(); foreach (var item in collection) { if (param.Contains(item) && hairAsObject[item] != null) { float h = float.Parse(asObject[item][0]); float s = float.Parse(asObject[item][1]); float v = float.Parse(asObject[item][2]); TargetAtom.GetStorableByID(id).GetColorJSONParam(item).SetColor(Color.HSVToRGB(h, s, v)); } else if (param.Contains(item)) { TargetAtom.GetStorableByID(id).GetColorJSONParam(item).SetValToDefault(); } } } if (TargetAtom.GetStorableByID(id).GetFloatParamNames() != null) { collection = TargetAtom.GetStorableByID(id).GetFloatParamNames(); foreach (var item in collection) { if (param.Contains(item) && hairAsObject[item] != null) { TargetAtom.GetStorableByID(id).GetFloatJSONParam(item).val = float.Parse(hairAsObject[item]); } else if (param.Contains(item)) { TargetAtom.GetStorableByID(id).GetFloatJSONParam(item).SetValToDefault(); } } } if (TargetAtom.GetStorableByID(id).GetStringParamNames() != null) { collection = TargetAtom.GetStorableByID(id).GetStringParamNames(); foreach (var item in collection) { if (param.Contains(item) && hairAsObject[item] != null) { TargetAtom.GetStorableByID(id).GetStringJSONParam(item).val = hairAsObject[item]; } else if (param.Contains(item)) { TargetAtom.GetStorableByID(id).GetStringJSONParam(item).SetValToDefault(); } } } if (TargetAtom.GetStorableByID(id).GetVector3ParamNames() != null) { collection = TargetAtom.GetStorableByID(id).GetVector3ParamNames(); foreach (var item in collection) { if (param.Contains(item) && hairAsObject[item] != null) { float x = float.Parse(asObject[item][0]); float y = float.Parse(asObject[item][1]); float z = float.Parse(asObject[item][2]); TargetAtom.GetStorableByID(id).GetVector3JSONParam(item).val = new Vector3(x, y, z); } else if (param.Contains(item)) { TargetAtom.GetStorableByID(id).GetVector3JSONParam(item).SetValToDefault(); } } } if (TargetAtom.GetStorableByID(id).GetStringChooserParamNames() != null) { collection = TargetAtom.GetStorableByID(id).GetStringChooserParamNames(); foreach (var item in collection) { if (param.Contains(item) && hairAsObject[item] != null) { TargetAtom.GetStorableByID(id).GetStringChooserJSONParam(item).val = hairAsObject[item]; } else if (param.Contains(item)) { TargetAtom.GetStorableByID(id).GetStringChooserJSONParam(item).SetValToDefault(); } } } if (TargetAtom.GetStorableByID(id).GetPresetFilePathActionNames() != null) { collection = TargetAtom.GetStorableByID(id).GetPresetFilePathActionNames(); foreach (var item in collection) { if (param.Contains(item)) { SuperController.LogMessage("No Hit in Hair item : " + item); } } } } } } } } private void setNewClothing1() { //if (clothing_Bool.val) if (realClothing_Bool.val || notRealClothing_Bool.val) { newClothingUids = new List(); for (int i = 0; i < asArray.Count; i++) { asObject = asArray[i].AsObject; id = asObject["id"]; if (id == "geometry" && asObject["clothing"] != null) { if (asObject["clothing"].Count != 0) { clothingAsArray = asObject["clothing"].AsArray; for (int j = 0; j < clothingAsArray.Count; j++) { bool hit = false; clothingAsObject = clothingAsArray[j].AsObject; if (clothingAsObject["id"] != null) { tempClothing = clothingAsObject["id"]; } else { tempClothing = clothingAsObject["name"]; } if (tempClothing.Contains("SELF")) { tempClothing = tempClothing.Replace("SELF:", SELF + ":"); } if (geometry.GetBoolJSONParam("clothing:" + tempClothing) != null) { hit = true; tempClothing = "clothing:" + tempClothing; } else { if (tempClothing.Contains(":/") && tempClothing.Substring(tempClothing.Length - 4) == ".vam") { string[] tempClothingVar = tempClothing.Split(':'); string[] tempClothingName = tempClothingVar[0].Split('.'); int ver = tempClothingName.Count(); string tempName = ""; for (int k = 0; k < ver - 1; k++) { tempName = tempName + tempClothingName[k] + "."; } string filenameVar; int varVer = 0; for (int k = 0; k < 100; k++) { filenameVar = tempName + k.ToString() + ":" + tempClothingVar[1]; if (geometry.GetBoolJSONParam("clothing:" + filenameVar) != null) { varVer = k; } } if (varVer != 0) { hit = true; tempClothing = "clothing:" + tempName + varVer.ToString() + ":" + tempClothingVar[1]; } else { tempClothing = tempClothingVar[1].Substring(1); if (geometry.GetBoolJSONParam("clothing:" + tempClothing) != null) { hit = true; tempClothing = "clothing:" + tempClothing; } } } if (!hit && tempClothing.Contains(":") && !tempClothing.Contains(".vam")) { string[] tempClothingName = tempClothing.Split(':'); foreach (var item in geometry.GetBoolParamNames()) { if (item.Contains(tempClothingName[0]) && item.Contains("/" + tempClothingName[1] + ".vam")) { hit = true; tempClothing = item; } } if (!hit) { foreach (var item in geometry.GetBoolParamNames()) { if (item.Contains("/" + tempClothingName[1] + ".vam")) { hit = true; tempClothing = item; } } } } if (!hit) { string filenameVar; if (tempClothing.Contains("/")) { string[] tempClothingName = tempClothing.Split('/'); filenameVar = "/" + tempClothingName[tempClothingName.Count() - 1]; } else { filenameVar = "/" + tempClothing; } if (!filenameVar.Contains(".vam")) { filenameVar += ".vam"; } foreach (var item in geometry.GetBoolParamNames()) { if (item.Contains(filenameVar)) { hit = true; tempClothing = item; } } } } //SuperController.LogMessage("test " + tempClothing); //SuperController.LogMessage(hit.ToString()); //SuperController.LogMessage(""); if (hit && geometry.GetBoolJSONParam(tempClothing) != null) { enabledClothing = (realClothing_Bool.val && !allNotRealClothingUids.Contains(tempClothing)) || (notRealClothing_Bool.val && allNotRealClothingUids.Contains(tempClothing)); if (enabledClothing) { if (clothingAsObject["enabled"] != null) { geometry.GetBoolJSONParam(tempClothing).val = bool.Parse(clothingAsObject["enabled"]); if (bool.Parse(clothingAsObject["enabled"])) { newClothingUids.Add(tempClothing); } } else { geometry.GetBoolJSONParam(tempClothing).val = true; newClothingUids.Add(tempClothing); } if (clothingAsObject["internalId"] != null) { hairAndClothing.val = hairAndClothing.val + "Clothing: " + clothingAsObject["internalId"] + "\n"; } else if (clothingAsObject["name"] != null) { hairAndClothing.val = hairAndClothing.val + "Clothing: " + clothingAsObject["name"] + "\n"; } else if (clothingAsObject["id"] != null) { string temp = clothingAsObject["id"]; if (!temp.Contains("/")) { hairAndClothing.val = hairAndClothing.val + "Clothing: " + clothingAsObject["id"] + "\n"; } else { string[] dir = temp.Split('/'); temp = dir[dir.Count() - 1]; hairAndClothing.val = hairAndClothing.val + "Clothing: " + temp + "\n"; } } } } else { missingItem.val = missingItem.val + "Missing Clothing:" + tempClothing + "\n"; } } } else { string temp = asObject["clothing"]; if (temp.Length > 1) { string tempClothing = "clothing:" + asObject["clothing"]; enabledClothing = (realClothing_Bool.val && !allNotRealClothingUids.Contains(tempClothing)) || (notRealClothing_Bool.val && allNotRealClothingUids.Contains(tempClothing)); if (geometry.GetBoolJSONParam(tempClothing) != null) { if (enabledClothing) { geometry.GetBoolJSONParam(tempClothing).val = true; newClothingUids.Add(tempClothing); } } else { foreach (var item in geometry.GetBoolParamNames()) { if (item.Contains("/" + asObject["clothing"] + ".vam")) { tempClothing = item; } } enabledClothing = (realClothing_Bool.val && !allNotRealClothingUids.Contains(tempClothing)) || (notRealClothing_Bool.val && allNotRealClothingUids.Contains(tempClothing)); if (enabledClothing) { geometry.GetBoolJSONParam(tempClothing).val = true; newClothingUids.Add(tempClothing); } } } } } } simClothingDic = new Dictionary(); simClothingList = new List(); var tempId = TargetAtom.GetStorableIDs(); foreach (var item in tempId) { if (TargetAtom.GetStorableByID(item).GetBoolParamNames() != null) { var tempBool = TargetAtom.GetStorableByID(item).GetBoolParamNames(); if (tempBool.Contains("simEnabled")) { simClothingList.Add(item); simClothingDic[item] = TargetAtom.GetStorableByID(item).GetBoolJSONParam("simEnabled").defaultVal; TargetAtom.GetStorableByID(item).GetBoolJSONParam("simEnabled").val = false; } } } if (_isReset) { var ids = TargetAtom.GetStorableIDs(); List actIds = new List(); foreach (var item in ids) { if (TargetAtom.GetStorableByID(item).isActiveAndEnabled) { actIds.Add(item); } } List actClothing = new List(); foreach (var item in newClothingUids) { var names = item.Replace("clothing:", "").Replace(".vam", "").Replace("\\", "/").Split('/'); var name = names[names.Count() - 1]; actClothing.Add(name); if (name.Contains(" ")) { actClothing.Add(name.Replace(" ", "")); } } foreach (var item in actClothing) { foreach (var item2 in actIds) { if (item2.Contains(item)) { var actAPA = TargetAtom.GetStorableByID(item2).GetAllParamAndActionNames(); foreach (var item3 in actAPA) { if (TargetAtom.GetStorableByID(item2).GetBoolJSONParam(item3) != null) { TargetAtom.GetStorableByID(item2).GetBoolJSONParam(item3).SetValToDefault(); continue; } if (TargetAtom.GetStorableByID(item2).GetFloatJSONParam(item3) != null) { TargetAtom.GetStorableByID(item2).GetFloatJSONParam(item3).SetValToDefault(); continue; } if (TargetAtom.GetStorableByID(item2).GetColorJSONParam(item3) != null) { TargetAtom.GetStorableByID(item2).GetColorJSONParam(item3).SetValToDefault(); continue; } if (TargetAtom.GetStorableByID(item2).GetStringJSONParam(item3) != null) { TargetAtom.GetStorableByID(item2).GetStringJSONParam(item3).SetValToDefault(); continue; } if (TargetAtom.GetStorableByID(item2).GetVector3JSONParam(item3) != null) { TargetAtom.GetStorableByID(item2).GetVector3JSONParam(item3).SetValToDefault(); continue; } if (TargetAtom.GetStorableByID(item2).GetUrlJSONParam(item3) != null) { TargetAtom.GetStorableByID(item2).GetUrlJSONParam(item3).SetValToDefault(); continue; } if (TargetAtom.GetStorableByID(item2).GetStringChooserJSONParam(item3) != null) { TargetAtom.GetStorableByID(item2).GetStringChooserJSONParam(item3).SetValToDefault(); } } } } } } } } //private void setNewClothing2() IEnumerator setNewClothing2() { if (realClothing_Bool.val || notRealClothing_Bool.val) { var rigid = TargetAtom.rigidbodies; List rigidList = new List(); foreach (var item in rigid) { rigidList.Add(item.name); } foreach (var item in idList) { rigidList.Add(item); } foreach (var item in idList2) { rigidList.Add(item); } foreach (var item in idList3) { rigidList.Add(item); } for (int i = 0; i < asArray.Count; i++) { bool thisIsClothing = true; asObject = asArray[i].AsObject; id = asObject["id"]; if (rigidList.Contains(id) | id.Contains("plugin#") | id.Contains("Animation") | id.Contains("animation")) { thisIsClothing = false; } foreach (var item in hairList) { if (item != "") { if (id.Contains(item)) { thisIsClothing = false; } } } //thisIsClothing = false; foreach (var item in clothingList) { if (id.Contains(item) && item.Length != 0) { thisIsClothing = true; } } if (thisIsClothing) { clothingAsObject = asArray[i].AsObject; var skip = true; foreach (var item in allNotRealClothing) { if (id.Contains(item) && notRealClothing_Bool.val || !id.Contains(item) && realClothing_Bool.val) { skip = false; } } if (!skip) { bool ready = false; float timeout = Time.unscaledTime + float.Parse(selectWaitTime.val); float startTime = Time.unscaledTime; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = TargetAtom.GetStorableByID(id) != null; if (!ready) { var tempIDs = TargetAtom.GetStorableIDs(); foreach (var tempId in tempIDs) { if (tempId.Contains(id)) { id = tempId; } } } } if (!ready) { missingItem.val = missingItem.val + "Missing Clothing:" + id + "\n"; //SuperController.LogMessage("Missing: " + id + " " + (Time.unscaledTime - startTime).ToString()); } else { //SuperController.LogMessage(id + " " + (Time.unscaledTime - startTime).ToString()); } if (TargetAtom.GetStorableByID(id) != null) { var param = clothingAsObject.Keys; { List collection = new List(); if (TargetAtom.GetStorableByID(id).GetUrlParamNames() != null) { collection = TargetAtom.GetStorableByID(id).GetUrlParamNames(); //SuperController.LogMessage("Url"); foreach (var item in collection) { if (param.Contains(item) && clothingAsObject[item] != null) { string checkUrl = clothingAsObject[item]; if (checkUrl.Contains(".")) { var fileUrl = checkPath(clothingAsObject[item]); if (fileUrl != "") { TargetAtom.GetStorableByID(id).GetUrlJSONParam(item).val = fileUrl; } } } else if (param.Contains(item)) { TargetAtom.GetStorableByID(id).GetUrlJSONParam(item).val = ""; } } } if (TargetAtom.GetStorableByID(id).GetBoolParamNames() != null) { collection = TargetAtom.GetStorableByID(id).GetBoolParamNames(); //SuperController.LogMessage("Bool"); foreach (var item in collection) { if (param.Contains(item) && clothingAsObject[item] != null) { if (item == "simEnabled") { //TargetAtom.GetStorableByID(id).GetBoolJSONParam(item).val = false; simClothingDic[item] = bool.Parse(clothingAsObject[item]); //SuperController.LogMessage(item + " cloth2 " + clothingAsObject[item].ToString()); } else { TargetAtom.GetStorableByID(id).GetBoolJSONParam(item).val = bool.Parse(clothingAsObject[item]); } } else if (param.Contains(item)) { if (item == "simEnabled") { //TargetAtom.GetStorableByID(id).GetBoolJSONParam(item).val = false; //simClothingDic[item] = true; } else { TargetAtom.GetStorableByID(id).GetBoolJSONParam(item).SetValToDefault(); } } } } if (TargetAtom.GetStorableByID(id).GetColorParamNames() != null) { collection = TargetAtom.GetStorableByID(id).GetColorParamNames(); //SuperController.LogMessage("Color"); foreach (var item in collection) { if (param.Contains(item) && clothingAsObject[item] != null) { float h = float.Parse(asObject[item][0]); float s = float.Parse(asObject[item][1]); float v = float.Parse(asObject[item][2]); TargetAtom.GetStorableByID(id).GetColorJSONParam(item).SetColor(Color.HSVToRGB(h, s, v)); } else if (param.Contains(item)) { TargetAtom.GetStorableByID(id).GetColorJSONParam(item).SetValToDefault(); } } } if (TargetAtom.GetStorableByID(id).GetFloatParamNames() != null) { collection = TargetAtom.GetStorableByID(id).GetFloatParamNames(); //SuperController.LogMessage("Float"); foreach (var item in collection) { if (param.Contains(item) && clothingAsObject[item] != null) { TargetAtom.GetStorableByID(id).GetFloatJSONParam(item).val = float.Parse(clothingAsObject[item]); } else if (param.Contains(item)) { TargetAtom.GetStorableByID(id).GetFloatJSONParam(item).SetValToDefault(); } } } if (TargetAtom.GetStorableByID(id).GetStringParamNames() != null) { collection = TargetAtom.GetStorableByID(id).GetStringParamNames(); //SuperController.LogMessage("String"); foreach (var item in collection) { if (param.Contains(item) && clothingAsObject[item] != null) { TargetAtom.GetStorableByID(id).GetStringJSONParam(item).val = clothingAsObject[item]; } else if (param.Contains(item)) { TargetAtom.GetStorableByID(id).GetStringJSONParam(item).SetValToDefault(); } } } if (TargetAtom.GetStorableByID(id).GetVector3ParamNames() != null) { collection = TargetAtom.GetStorableByID(id).GetVector3ParamNames(); //SuperController.LogMessage("Vector3"); foreach (var item in collection) { if (param.Contains(item) && clothingAsObject[item] != null) { float x = float.Parse(asObject[item][0]); float y = float.Parse(asObject[item][1]); float z = float.Parse(asObject[item][2]); TargetAtom.GetStorableByID(id).GetVector3JSONParam(item).val = new Vector3(x, y, z); } else if (param.Contains(item)) { TargetAtom.GetStorableByID(id).GetVector3JSONParam(item).SetValToDefault(); } } } if (TargetAtom.GetStorableByID(id).GetStringChooserParamNames() != null) { collection = TargetAtom.GetStorableByID(id).GetStringChooserParamNames(); //SuperController.LogMessage("StringChooser"); foreach (var item in collection) { if (param.Contains(item) && clothingAsObject[item] != null) { TargetAtom.GetStorableByID(id).GetStringChooserJSONParam(item).val = clothingAsObject[item]; } else if (param.Contains(item)) { TargetAtom.GetStorableByID(id).GetStringChooserJSONParam(item).SetValToDefault(); } } } if (TargetAtom.GetStorableByID(id).GetPresetFilePathActionNames() != null) { collection = TargetAtom.GetStorableByID(id).GetPresetFilePathActionNames(); //SuperController.LogMessage("Preset"); foreach (var item in collection) { if (param.Contains(item)) { SuperController.LogMessage("No Hit in Clothing item : " + item); } } } } } } } } } } //IEnumerator simEnable() private void simEnable() { foreach (var item in simClothingList) { TargetAtom.GetStorableByID(item).GetBoolJSONParam("simEnabled").val = simClothingDic[item]; //TargetAtom.GetStorableByID(item).GetBoolJSONParam("simEnabled").val = true; } var tempId = TargetAtom.GetStorableIDs(); foreach (var item in tempId) { if (TargetAtom.GetStorableByID(item).GetBoolParamNames() != null) { var tempBool = TargetAtom.GetStorableByID(item).GetBoolParamNames(); if (tempBool.Contains("simEnabled")) { TargetAtom.GetStorableByID(item).CallAction("Reset"); } } } } IEnumerator setNewCharacter() { texturesPreset = new JSONClass(); texturesPreset["setUnlistedParamsToDefault"] = _isReset.ToString().ToLower(); //texturesPreset["setUnlistedParamsToDefault"] = "false"; if (characterName != "") { JSONClass geomet = new JSONClass(); geomet["id"] = "geometry"; if (textures_Bool.val) { geomet["character"] = characterName; } else { geomet["character"] = TargetAtom.GetStorableByID("geometry").GetStringChooserJSONParam("characterSelection").val; } texturesPreset["storables"].Add(geomet); } if (textures_Bool.val && characterName != "") { hairAndClothing.val = hairAndClothing.val + "Skin Select: " + characterName + "\n"; previousCharacter = TargetAtom.GetStorableByID(_geomet).GetStringChooserJSONParam("characterSelection").val; //character.characterSelectorUI.characterSelector.SetStringChooserParamValue("characterSelection", characterName);} if (morphs_Bool.val) { morphControl = character.morphsControlUI; DAZMorph morph; morphControl.GetMorphUids().ForEach((uid) => { morph = morphControl.GetMorphByUid(uid); if (!morph.isPoseControl) { morph.SetDefaultValue(); } }); if (femaleOnMale) { morphControl = character.morphsControlFemaleUI; morphControl.GetMorphUids().ForEach((uid) => { morph = morphControl.GetMorphByUid(uid); if (!morph.isPoseControl) { morph.SetDefaultValue(); } }); } if (maleOnFemale) { morphControl = character.morphsControlMaleUI; morphControl.GetMorphUids().ForEach((uid) => { morph = morphControl.GetMorphByUid(uid); if (!morph.isPoseControl) { morph.SetDefaultValue(); } }); } } if (previousCharacter != characterName) { if (characterName == "Female Dummy") { geometry.GetStringChooserJSONParam("characterSelection").val = "Female Custom"; bool ready = false; float timeout = Time.unscaledTime + 20f; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face").choices.Contains("Brows"); } geometry.GetStringChooserJSONParam("characterSelection").val = characterName; ready = false; timeout = Time.unscaledTime + 20f; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = TargetAtom.GetStorableByID("skin") == null; } if (devMode && ready) { SuperController.LogMessage("FD " + characterName); } } else if (characterName == "Male Dummy") { geometry.GetStringChooserJSONParam("characterSelection").val = "Male Custom"; bool ready = false; float timeout = Time.unscaledTime + 20f; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face").choices.Contains("Brows"); } geometry.GetStringChooserJSONParam("characterSelection").val = characterName; ready = false; timeout = Time.unscaledTime + 20f; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = TargetAtom.GetStorableByID("skin") == null; } if (devMode && ready) { SuperController.LogMessage("MD " + characterName); } } else if (previousCharacter == "Female Dummy") { geometry.GetStringChooserJSONParam("characterSelection").val = characterName; bool ready = false; float timeout = Time.unscaledTime + 20f; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = TargetAtom.GetStorableByID("skin") != null; } if (devMode && ready) { SuperController.LogMessage("PFD " + characterName); } } else if (previousCharacter == "Male Dummy") { geometry.GetStringChooserJSONParam("characterSelection").val = characterName; bool ready = false; float timeout = Time.unscaledTime + 20f; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = TargetAtom.GetStorableByID("skin") != null; } if (devMode && ready) { SuperController.LogMessage("PMD " + characterName); } } else if (previousCharacter != "Male Custom" && characterName == "Female Custom") { geometry.GetStringChooserJSONParam("characterSelection").val = characterName; bool ready = false; float timeout = Time.unscaledTime + 20f; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face").choices.Contains("Brows"); } if (devMode && ready) { SuperController.LogMessage("FC " + characterName); } } else if (characterName == "Female Custom") { geometry.GetStringChooserJSONParam("characterSelection").val = characterName; bool ready = false; float timeout = Time.unscaledTime + 20f; while (!ready && Time.unscaledTime < timeout) { yield return null; if (devMode) { var test1 = TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face").choices.Contains("Brows"); var test2 = TargetAtom.GetStorableByID(_geomet).GetBoolParamNames().Contains("clothing:Tank Top"); if (test1) SuperController.LogMessage("FC OK"); if (test2) SuperController.LogMessage("Tank Top OK"); } ready = TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face").choices.Contains("Brows") && TargetAtom.GetStorableByID(_geomet).GetBoolParamNames().Contains("clothing:Tank Top"); } if (devMode && ready) { SuperController.LogMessage("MCFC " + characterName); } } else if (previousCharacter != "Female Custom" && characterName == "Male Custom") { geometry.GetStringChooserJSONParam("characterSelection").val = characterName; bool ready = false; float timeout = Time.unscaledTime + 20f; while (!ready && Time.unscaledTime < timeout) { yield return null; if (TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face") != null) { ready = TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face").choices.Contains("Brows"); } } if (devMode && ready) { SuperController.LogMessage("MC " + characterName); } } else if (characterName == "Male Custom") { geometry.GetStringChooserJSONParam("characterSelection").val = characterName; bool ready = false; float timeout = Time.unscaledTime + 20f; while (!ready && Time.unscaledTime < timeout) { yield return null; if (devMode) { var test1 = TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face").choices.Contains("Brows"); var test2 = TargetAtom.GetStorableByID(_geomet).GetBoolParamNames().Contains("clothing:TShirt"); if (test1) SuperController.LogMessage("MC OK"); if (test2) SuperController.LogMessage("TShirt OK"); } if (TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face") != null) { ready = TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face").choices.Contains("Brows") && TargetAtom.GetStorableByID(_geomet).GetBoolParamNames().Contains("clothing:TShirt"); } } if (devMode && ready) { SuperController.LogMessage("FCMC " + characterName); } } else if (femaleCharacters.Contains(characterName) && characterName != "Female Custom") { geometry.GetStringChooserJSONParam("characterSelection").val = "Female Custom"; bool ready = false; float timeout = Time.unscaledTime + 20f; while (!ready && Time.unscaledTime < timeout) { yield return null; if (TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face") != null) { ready = TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face").choices.Contains("Brows"); } } geometry.GetStringChooserJSONParam("characterSelection").val = characterName; ready = false; timeout = Time.unscaledTime + 20f; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = !TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face").choices.Contains("Brows"); } if (devMode && ready) { SuperController.LogMessage("F " + characterName); } } else if (maleCharacters.Contains(characterName) && characterName != "Male Custom") { geometry.GetStringChooserJSONParam("characterSelection").val = "Male Custom"; bool ready = false; float timeout = Time.unscaledTime + 20f; while (!ready && Time.unscaledTime < timeout) { yield return null; if (TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face") != null) { ready = TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face").choices.Contains("Brows"); } } geometry.GetStringChooserJSONParam("characterSelection").val = characterName; ready = false; timeout = Time.unscaledTime + 20f; while (!ready && Time.unscaledTime < timeout) { yield return null; if (TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face") != null) { ready = !TargetAtom.GetStorableByID("skin").GetStringChooserJSONParam("Face").choices.Contains("Brows"); } else { ready = true; if (devMode) { SuperController.LogMessage("null"); } } if (devMode && ready) { SuperController.LogMessage("M " + characterName); } } } } geometry = TargetAtom.GetStorableByID(_geomet); character = geometry as DAZCharacterSelector; morphControl = character.morphsControlUI; //yield return new WaitForSeconds(1f); makeDic(); paramControls = new Dictionary(); foreach (var item in idList) { if (TargetAtom.GetStorableByID(item) != null) { paramControls[item] = TargetAtom.GetStorableByID(item); } } } } IEnumerator changeMorph() { if (scale_Bool.val) { if (idListVap.Contains("rescaleObject")) { TargetAtom.GetStorableByID("rescaleObject").GetFloatJSONParam("scale").val = scale; } else { TargetAtom.GetStorableByID("rescaleObject").GetFloatJSONParam("scale").val = 1f; } //yield return new WaitForSeconds(0.1f); } if (morphs_Bool.val) { List keyList = new List(); List keyListOther = new List(); Dictionary morphDic = new Dictionary(); Dictionary morphOtherDic = new Dictionary(); for (int i = 0; i < asArray.Count; i++) { asObject = asArray[i].AsObject; id = asObject["id"]; if (id == "geometry") { morphsAsArray = asObject["morphs"].AsArray; for (int j = 0; j < morphsAsArray.Count; j++) { morphs = morphsAsArray[j].AsObject; if (morphs["value"] != null) { var tempUid = morphs["uid"].Value; if (tempUid.Contains("SELF:")) { tempUid = tempUid.Replace("SELF:", SELF + ":"); } keyList.Add(tempUid); morphDic[tempUid] = morphs["name"] + "=" + morphs["value"]; } } morphsOtherAsArray = asObject["morphsOtherGender"].AsArray; for (int j = 0; j < morphsOtherAsArray.Count; j++) { morphsOther = morphsOtherAsArray[j].AsObject; if (morphsOther["value"] != null) { var tempUid = morphsOther["uid"].Value; if (tempUid.Contains("SELF:")) { tempUid = tempUid.Replace("SELF:", SELF + ":"); } keyListOther.Add(tempUid); morphOtherDic[tempUid] = morphsOther["name"] + "=" + morphsOther["value"]; } } } } DAZMorph morph; if (idListVap.Contains("geometry") || _isReset) { morphControl.GetMorphUids().ForEach((uid) => { morph = morphControl.GetMorphByUid(uid); if (!morph.isPoseControl) { morph.SetDefaultValue(); } }); //yield return new WaitForSeconds(1f); morphControl.GetMorphUids().ForEach((uid) => { morph = morphControl.GetMorphByUid(uid); if (!morph.isPoseControl && !keyList.Contains(morph.displayName)) { morph.SetDefaultValue(); } }); } yield return new WaitForSeconds(1f); //0.5fでもOK コリジョン問題の保険のために採用 (var16) foreach (var item in keyList) { var morphName = morphDic[item].Split('=')[0]; var morphValue = morphDic[item].Split('=')[1]; if (morphControl.GetMorphByUid(item) != null) { if (!morphControl.GetMorphByUid(item).isPoseControl) { //morphControl.GetMorphByUid(item).morphValue = float.Parse(morphDic[item]); morphControl.GetMorphByUid(item).morphValue = float.Parse(morphValue); } } else if (morphControl.GetMorphByDisplayName(morphName) != null) { if (!morphControl.GetMorphByDisplayName(morphName).isPoseControl) { //morphControl.GetMorphByUid(item).morphValue = float.Parse(morphDic[item]); morphControl.GetMorphByDisplayName(morphName).morphValue = float.Parse(morphValue); } } else { missingItem.val = missingItem.val + "Missing:" + item + "\n"; } } //yield return new WaitForSeconds(1f); geometry = TargetAtom.GetStorableByID("geometry"); character = geometry as DAZCharacterSelector; morphControl = character.morphsControlUIOtherGender; /* foreach (var item in keyListOther) { if (morphControl.GetMorphByUid(item) != null) { SuperController.LogMessage(item); if (!morphControl.GetMorphByUid(item).isPoseControl) { morphControl.GetMorphByUid(item).morphValue = float.Parse(morphOtherDic[item]); } } } */ if (femaleOnMale) { morphControl = character.morphsControlFemaleUI; foreach (var item in keyListOther) { var morphName = morphOtherDic[item].Split('=')[0]; var morphValue = morphOtherDic[item].Split('=')[1]; if (morphControl.GetMorphByUid(item) != null) { if (!morphControl.GetMorphByUid(item).isPoseControl) { //morphControl.GetMorphByUid(item).morphValue = float.Parse(morphOtherDic[item]); morphControl.GetMorphByUid(item).morphValue = float.Parse(morphValue); } } else if (morphControl.GetMorphByDisplayName(morphName) != null) { if (!morphControl.GetMorphByDisplayName(morphName).isPoseControl) { //morphControl.GetMorphByUid(item).morphValue = float.Parse(morphDic[item]); morphControl.GetMorphByDisplayName(morphName).morphValue = float.Parse(morphValue); } } else { missingItem.val = missingItem.val + "Missing:" + item + "\n"; } } } if (maleOnFemale) { morphControl = character.morphsControlMaleUI; foreach (var item in keyListOther) { var morphName = morphOtherDic[item].Split('=')[0]; var morphValue = morphOtherDic[item].Split('=')[1]; if (morphControl.GetMorphByUid(item) != null) { if (!morphControl.GetMorphByUid(item).isPoseControl) { //morphControl.GetMorphByUid(item).morphValue = float.Parse(morphOtherDic[item]); morphControl.GetMorphByUid(item).morphValue = float.Parse(morphValue); } } else if (morphControl.GetMorphByDisplayName(morphName) != null) { if (!morphControl.GetMorphByDisplayName(morphName).isPoseControl) { //morphControl.GetMorphByUid(item).morphValue = float.Parse(morphDic[item]); morphControl.GetMorphByDisplayName(morphName).morphValue = float.Parse(morphValue); } } else { missingItem.val = missingItem.val + "Missing:" + item + "\n"; } } } yield return new WaitForSeconds(1f); //削除可能 コリジョン問題の保険のために採用 (var16) } } IEnumerator setNewData() //private void setNewData() { for (int i = 0; i < asArray.Count; i++) { asObject = asArray[i].AsObject; id = asObject["id"]; if (morphs_Bool.val) { if (id == "geometry") { if (asObject["useAdvancedColliders"] != null) { geometry.GetBoolJSONParam("useAdvancedColliders").val = bool.Parse(asObject["useAdvancedColliders"]); } if (asObject["useAuxBreastColliders"] != null) { geometry.GetBoolJSONParam("useAuxBreastColliders").val = bool.Parse(asObject["useAuxBreastColliders"]); } if (asObject["disableAnatomy"] != null) { geometry.GetBoolJSONParam("disableAnatomy").val = bool.Parse(asObject["disableAnatomy"]); } if (asObject["useMaleMorphsOnFemale"] != null) { geometry.GetBoolJSONParam("useMaleMorphsOnFemale").val = bool.Parse(asObject["useMaleMorphsOnFemale"]); } if (asObject["useFemaleMorphsOnMale"] != null) { geometry.GetBoolJSONParam("useFemaleMorphsOnMale").val = bool.Parse(asObject["useFemaleMorphsOnMale"]); } } if (id == "JawControl") { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null && asObject[item] != null) { paramControls[id].GetBoolJSONParam(item).val = bool.Parse(asObject[item]); } else if (paramControls[id].GetFloatJSONParam(item) != null && asObject[item] != null) { paramControls[id].GetFloatJSONParam(item).val = float.Parse(asObject[item]); } } } if (id == "BendFix" && asObject["enabled"] != null) { TargetAtom.GetStorableByID(id).GetBoolJSONParam("enabled").val = bool.Parse(asObject["enabled"]); } if (id == "FemaleAnatomy" && asObject["enabled"] != null) { TargetAtom.GetStorableByID(id).GetBoolJSONParam("enabled").val = bool.Parse(asObject["enabled"]); } if (id == "MaleAnatomy" && asObject["enabled"] != null) { TargetAtom.GetStorableByID(id).GetBoolJSONParam("enabled").val = bool.Parse(asObject["enabled"]); } if (id == "BreastInOut" && asObject["enabled"] != null) { TargetAtom.GetStorableByID(id).GetBoolJSONParam("enabled").val = bool.Parse(asObject["enabled"]); } if (id == "EyelidControl" && asObject["eyelidLookMorphsEnabled"] != null) { TargetAtom.GetStorableByID(id).GetBoolJSONParam("eyelidLookMorphsEnabled").val = bool.Parse(asObject["eyelidLookMorphsEnabled"]); } if (id == "AutoJawMouthMorph" && asObject["enabled"] != null) { TargetAtom.GetStorableByID(id).GetBoolJSONParam("enabled").val = bool.Parse(asObject["enabled"]); } if (id == "AutoExpressions" && asObject["enabled"] != null) { TargetAtom.GetStorableByID(id).GetBoolJSONParam("enabled").val = bool.Parse(asObject["enabled"]); } if (id == "SoftBodyPhysicsEnabler" && asObject["enabled"] != null) { TargetAtom.GetStorableByID(id).GetBoolJSONParam("enabled").val = bool.Parse(asObject["enabled"]); } } if (breast_Bool.val) { if (id == "BreastControl" | id == "BreastPhysicsMesh") { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null && asObject[item] != null) { paramControls[id].GetBoolJSONParam(item).val = bool.Parse(asObject[item]); } else if (paramControls[id].GetFloatJSONParam(item) != null && asObject[item] != null) { paramControls[id].GetFloatJSONParam(item).val = float.Parse(asObject[item]); } } } } if (glute_Bool.val) { if (id == "GluteControl" | id == "LowerPhysicsMesh") { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null && asObject[item] != null) { paramControls[id].GetBoolJSONParam(item).val = bool.Parse(asObject[item]); } else if (paramControls[id].GetFloatJSONParam(item) != null && asObject[item] != null) { paramControls[id].GetFloatJSONParam(item).val = float.Parse(asObject[item]); } } } } if (eye_Bool.val) { if (id == "FemaleEyelashes" | id == "MaleEyelashes" | id == "irises" | id == "sclera" | id == "lacrimals") { if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null && asObject[item] != null) { paramControls[id].GetBoolJSONParam(item).val = bool.Parse(asObject[item]); } else if (paramControls[id].GetStringChooserJSONParam(item) != null && asObject[item] != null) { paramControls[id].GetStringChooserJSONParam(item).val = asObject[item]; } else if (paramControls[id].GetColorJSONParam(item) != null && asObject[item] != null && asObject[item].Count >= 3) { float h = float.Parse(asObject[item][0]); float s = float.Parse(asObject[item][1]); float v = float.Parse(asObject[item][2]); paramControls[id].GetColorJSONParam(item).SetColor(Color.HSVToRGB(h, s, v)); } else if (paramControls[id].GetUrlJSONParam(item) != null && asObject[item] != null) { string checkUrl = asObject[item]; if (checkUrl.Contains(".")) { var fileUrl = checkPath(asObject[item]); if (fileUrl != "") { paramControls[id].GetUrlJSONParam(item).val = fileUrl; } } } else if (paramControls[id].GetFloatJSONParam(item) != null && asObject[item] != null) { paramControls[id].GetFloatJSONParam(item).val = float.Parse(asObject[item]); } } } } } } /* if (mouth_Bool.val) { if (id == "teeth" | id == "tongue" | id == "mouth") { if (idDic.Keys.Contains(id)) { if (idDic[id] != null && paramControls[id] != null) { foreach (var item in idDic[id]) { if (paramControls[id].GetBoolJSONParam(item) != null && asObject[item] != null) { paramControls[id].GetBoolJSONParam(item).val = bool.Parse(asObject[item]); } else if (paramControls[id].GetStringChooserJSONParam(item) != null && asObject[item] != null) { paramControls[id].GetStringChooserJSONParam(item).val = asObject[item]; } else if (paramControls[id].GetColorJSONParam(item) != null && asObject[item] != null && asObject[item].Count >= 3) { float h = float.Parse(asObject[item][0]); float s = float.Parse(asObject[item][1]); float v = float.Parse(asObject[item][2]); paramControls[id].GetColorJSONParam(item).SetColor(Color.HSVToRGB(h, s, v)); } else if (paramControls[id].GetUrlJSONParam(item) != null && asObject[item] != null) { string checkUrl = asObject[item]; if (checkUrl.Contains(".")) { var fileUrl = checkPath(asObject[item]); if (fileUrl != "") { paramControls[id].GetUrlJSONParam(item).val = fileUrl; } } } else if (paramControls[id].GetFloatJSONParam(item) != null && asObject[item] != null) { paramControls[id].GetFloatJSONParam(item).val = float.Parse(asObject[item]); } } } } } } */ } //yield return StartCoroutine(changeMorph()); yield return changeMorph(); } private void setNewSkin() { for (int i = 0; i < asArray.Count; i++) { asObject = asArray[i].AsObject; id = asObject["id"]; if (textures_Bool.val && id == "skin") { texturesPreset["storables"].Add(asObject); } } } private void setNewTextures() { for (int i = 0; i < asArray.Count; i++) { asObject = asArray[i].AsObject; id = asObject["id"]; if (id == "skin" || id == "textures") { if (textures_Bool.val) { texturesPreset["storables"].Add(asObject); } else { texturesPreset["storables"].Add(_currentSkinDic[id]); } } else if (id == "teeth" || id == "tongue" || id == "mouth") { if (mouth_Bool.val) { texturesPreset["storables"].Add(asObject); } else { texturesPreset["storables"].Add(_currentSkinDic[id]); } } } } IEnumerator loadTexturesPreset() { if (textures_Bool.val || mouth_Bool.val) { //SaveJSON(texturesPreset, "Custom/Atom/Person/Skin/ky1001/test/Preset_skinPresetTest.vap"); TargetAtom.SetLastRestoredData(texturesPreset, true, true); JSONStorable presetSJS = TargetAtom.GetStorableByID("SkinPresets"); pm = presetSJS.GetComponent(); _texturesLoaded = false; bool mergeLoad = false; pm.LoadPresetFromJSON(texturesPreset, mergeLoad); //pm.postLoadEvent.AddListener(OnSkinPresetLoaded); var ready = false; var timeout = Time.unscaledTime + 300f; while (!ready && Time.unscaledTime < timeout) { yield return null; if (_texturesLoaded) { ready = true; //SuperController.LogMessage("SkinPresets Loaded"); } } } } protected void OnSkinPresetLoaded() { //_texturesLoaded = true; } private void loadPlugin() { if (plugin_Bool.val) { if (pluginPreset["setUnlistedParamsToDefault"] != null) { bool mergeLoad = true; JSONStorable presetPJS = TargetAtom.GetStorableByID("PluginPresets"); PresetManager pmp = presetPJS.GetComponent(); TargetAtom.SetLastRestoredData(pluginPreset, true, true); pmp.LoadPresetFromJSON(pluginPreset, mergeLoad); /* string savePath = "Custom/Atom/Person/Plugins/"; string saveFile = "pluginPreset_by_AppearanceLoader_"; var loadFiles = reload.Replace("\\", "/").Split('/'); string time = DateTime.UtcNow.ToString().Replace("/", "_").Replace(":", "_"); var loadFile = loadFiles[loadFiles.Count() - 1].Replace(".json", "") + "_" + TargetAtom.name + "_" + time; SaveJSON(pluginPreset, savePath + "Preset_" + saveFile + loadFile + ".vap"); */ /* TargetAtom.GetStorableByID("PluginPresets").GetStringJSONParam("presetName").val = saveFile + loadFile; TargetAtom.GetStorableByID("PluginPresets").CallAction("MergeLoadPreset"); if (deletePluginPreset_Bool.val) { TargetAtom.GetStorableByID("PluginPresets").GetStringJSONParam("presetName").val = ""; FileManagerSecure.DeleteFile(savePath + "Preset_" + saveFile + loadFile + ".vap"); } */ } } } IEnumerator loadCUA() { if (cua_Bool.val && sceneBool) { if (_clearOldCUA.val) { List cuaList = new List(); var allAtoms = SuperController.singleton.GetAtomUIDs(); foreach (var item in allAtoms) { Atom atom = SuperController.singleton.GetAtomByUid(item); if (atom.type == "CustomUnityAsset") { if (atom.GetStorableByID("control").GetJSON() != null) { var jc = atom.GetStorableByID("control").GetJSON(); if (jc["linkTo"] != null) { string linkTo = jc["linkTo"]; if (linkTo.Contains(TargetAtom.name + ":")) { cuaList.Add(atom); } } } } } foreach (var item in cuaList) { SuperController.singleton.RemoveAtom(item); } } if (asObjectCUA != null) { if (asObjectCUA.Count() != 0) { for (var i = 0; i < asObjectCUA.Count(); i++) { SuperController.singleton.PauseSimulation(10, "Cloning"); var tempAsObject = asObjectCUA[i]; string cuaName = tempAsObject["id"]; //emptyName = "Empty_for_AppearanceLoader"; //SuperController.LogMessage(cuaName); //yield return StartCoroutine(SuperController.singleton.AddAtomByType("Empty", emptyName, false, true)); //yield return new WaitForSeconds(1f); yield return StartCoroutine(SuperController.singleton.AddAtomByType("CustomUnityAsset", cuaName, false, true)); //yield return new WaitForSeconds(1f); Atom addedCUA = SuperController.singleton.GetSelectedAtom(); if (tempAsObject["collisionEnabled"] != null) { addedCUA.GetBoolJSONParam("collisionEnabled").val = bool.Parse(tempAsObject["collisionEnabled"]); } addedCUA.GetBoolJSONParam("on").val = false; var tempAsArray = tempAsObject["storables"].AsArray; var cuaScale = 1f; int jn = 0; for (int j = 0; j < tempAsArray.Count; j++) { tempAsObject = tempAsArray[j].AsObject; string id = tempAsObject["id"]; if (id == "asset") { var cuaControl = addedCUA.GetStorableByID("asset"); foreach (var item in tempAsObject.Keys) { if (tempAsObject[item] != null) { if (cuaControl.GetBoolJSONParam(item) != null) { cuaControl.GetBoolJSONParam(item).val = bool.Parse(tempAsObject[item]); } else if (cuaControl.GetFloatJSONParam(item) != null) { cuaControl.GetFloatJSONParam(item).val = float.Parse(tempAsObject[item]); } else if (cuaControl.GetStringJSONParam(item) != null) { cuaControl.GetStringJSONParam(item).val = tempAsObject[item]; } else if (cuaControl.GetUrlJSONParam(item) != null) { string checkUrl = tempAsObject[item]; if (checkUrl.Contains(".")) { var fileUrl = checkPath(tempAsObject[item]); if (fileUrl != "") { cuaControl.GetUrlJSONParam(item).val = fileUrl; } //yield return new WaitForSeconds(1f); bool ready = false; float timeout = Time.unscaledTime + 10f; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = cuaControl.GetUrlJSONParam(item).val == fileUrl; } } } } } if (tempAsObject["assetName"] != null) { cuaControl.GetStringChooserJSONParam("assetName").val = tempAsObject["assetName"]; string assetName = tempAsObject["assetName"]; //yield return new WaitForSeconds(1f); bool ready = false; float timeout = Time.unscaledTime + 10f; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = cuaControl.GetStringChooserJSONParam("assetName").val == assetName; } hairAndClothing.val = hairAndClothing.val + "CUA: " + assetName + "\n"; } } if (id == "scale") { if (tempAsObject["scale"] != null) { cuaScale = float.Parse(tempAsObject["scale"]); if (scale_Bool.val) { addedCUA.GetStorableByID("scale").GetFloatJSONParam("scale").val = cuaScale; } } } if (id == "Preset") { if (tempAsObject["presetName"] != null) { addedCUA.GetStorableByID("Preset").GetStringJSONParam("presetName").val = tempAsObject["presetName"]; addedCUA.GetStorableByID("Preset").CallAction("LoadPreset"); } } if (id == "PluginManager") { cuaPluginPreset = new JSONClass(); if (tempAsObject["plugins"] != null) { if (tempAsObject["plugins"].Count != 0) { cuaPluginPreset["setUnlistedParamsToDefault"] = "true"; cuaPluginPreset["storables"][0]["id"] = "PluginManager"; var collection = tempAsObject["plugins"].AsObject; foreach (var item in collection.Keys) { if (tempAsObject["plugins"][item] != null) { cuaPluginPreset["storables"][0]["plugins"][item] = tempAsObject["plugins"][item]; } } } } } if (id.Contains("plugin#")) { jn++; List keys = new List(tempAsObject.Keys); foreach (var item in keys) { if (tempAsObject[item] != null) { cuaPluginPreset["storables"][jn][item] = tempAsObject[item]; } } } if (id == "control") { FreeControllerV3 cuaControl = addedCUA.GetStorableByID("control") as FreeControllerV3; foreach (var item in tempAsObject.Keys) { if (item == "linkTo") { if (tempAsObject["linkTo"] != null) { string linkTo = tempAsObject["linkTo"]; linkTo = linkTo.Replace("\"", ""); string[] link = linkTo.Split(':'); posi.x = float.Parse(tempAsObject["position"][0]); posi.y = float.Parse(tempAsObject["position"][1]); posi.z = float.Parse(tempAsObject["position"][2]); rota.x = float.Parse(tempAsObject["rotation"][0]); rota.y = float.Parse(tempAsObject["rotation"][1]); rota.z = float.Parse(tempAsObject["rotation"][2]); targetPosi = new Vector3(0, 0, 0); targetRota = new Vector3(0, 0, 0); _dummyObject = new GameObject(); _dummyObjectTransform = _dummyObject.transform; if (rigidbodies.Contains(link[1])) { List rbList = new List(); _rigid = TargetAtom.rigidbodies.First(rb => rb.name == link[1]); string rigidName = link[1]; rbList.Add(rigidName); //targetRota = sourceRotationDic[rigidName]; while (rigidName != "hip") { GameObject parent = _rigid.transform.parent.gameObject; rigidName = parent.name; rbList.Add(rigidName); _rigid = TargetAtom.rigidbodies.First(rb => rb.name == rigidName); //targetRota += sourceRotationDic[rigidName]; } rbList.Reverse(); rootPosi = sourcePositionDic["rootPosition"]; rootRota = sourceRotationDic["rootRotation"]; tempPosi = rootPosi; tempRota = rootRota; foreach (var rbName in rbList) { if (rbName == "hip") { _dummyObjectTransform.position = rootPosi; _dummyObjectTransform.rotation = Quaternion.Euler(rootRota); } else { tempPosi = _dummyObjectTransform.TransformPoint(sourcePositionDic[rbName] * scale); tempRota += sourceRotationDic[rbName]; _dummyObjectTransform.position = tempPosi; _dummyObjectTransform.rotation *= Quaternion.Euler(sourceRotationDic[rbName]); } } localPosi = _dummyObjectTransform.InverseTransformPoint(posi); var localRotaQ = Quaternion.Inverse(_dummyObjectTransform.rotation) * Quaternion.Euler(rota); _rigid = TargetAtom.rigidbodies.First(rb => rb.name == link[1]); var newPosi = _rigid.transform.TransformPoint(localPosi / scale); var newRota = _rigid.transform.rotation * localRotaQ; cuaControl.transform.position = newPosi; cuaControl.transform.rotation = newRota; } else { rootPosi = sourcePositionDic["control"]; rootRota = sourceRotationDic["control"]; tempPosi = rootPosi; tempRota = rootRota; _dummyObjectTransform.position = rootPosi; _dummyObjectTransform.rotation = Quaternion.Euler(rootRota); tempPosi = _dummyObjectTransform.TransformPoint(sourcePositionDic[link[1]] * scale); tempRota += sourceRotationDic[link[1]]; _dummyObjectTransform.position = tempPosi; _dummyObjectTransform.rotation = Quaternion.Euler(tempRota); localPosi = _dummyObjectTransform.InverseTransformPoint(posi); var localRotaQ = Quaternion.Inverse(_dummyObjectTransform.rotation) * Quaternion.Euler(rota); var newPosi = TargetAtom.GetStorableByID(link[1]).transform.TransformPoint(localPosi / scale); var newRota = TargetAtom.GetStorableByID(link[1]).transform.rotation * localRotaQ; cuaControl.transform.position = newPosi; cuaControl.transform.rotation = newRota; } //empty.Remove(); linkToAtom = SuperController.singleton.RigidbodyNameToRigidbody(TargetAtom.name + ":" + link[1]); cuaControl.SelectLinkToRigidbody(linkToAtom, FreeControllerV3.SelectLinkState.PositionAndRotation); if (tempAsObject["positionState"] != null) { cuaControl.currentPositionState = PosiST[tempAsObject["positionState"]]; bool ready = false; float timeout = Time.unscaledTime + 10f; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = cuaControl.currentPositionState == PosiST[tempAsObject["positionState"]]; } } else { cuaControl.currentPositionState = PosiST["On"]; bool ready = false; float timeout = Time.unscaledTime + 10f; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = cuaControl.currentPositionState == PosiST["On"]; } } if (tempAsObject["rotationState"] != null) { cuaControl.currentRotationState = RotaST[tempAsObject["rotationState"]]; bool ready = false; float timeout = Time.unscaledTime + 10f; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = cuaControl.currentRotationState == RotaST[tempAsObject["rotationState"]]; } } else { cuaControl.currentRotationState = RotaST["On"]; bool ready = false; float timeout = Time.unscaledTime + 10f; while (!ready && Time.unscaledTime < timeout) { yield return null; ready = cuaControl.currentRotationState == RotaST["On"]; } } //yield return new WaitForSeconds(1f); } } else if (item != "position" && item != "rotation" && item != "positionState" && item != "rotationState") { if (cuaControl.GetBoolJSONParam(item) != null) { cuaControl.GetBoolJSONParam(item).val = bool.Parse(tempAsObject[item]); } else if (cuaControl.GetFloatJSONParam(item) != null) { cuaControl.GetFloatJSONParam(item).val = float.Parse(tempAsObject[item]); } else if (cuaControl.GetStringChooserJSONParam(item) != null) { cuaControl.GetStringChooserJSONParam(item).val = tempAsObject[item]; } else if (cuaControl.GetStringJSONParam(item) != null) { cuaControl.GetStringJSONParam(item).val = tempAsObject[item]; } } } } } var personScale = TargetAtom.GetStorableByID("rescaleObject").GetFloatJSONParam("scale").val; if (!scale_Bool.val) { addedCUA.GetStorableByID("scale").GetFloatJSONParam("scale").val = personScale * cuaScale / scale; } addedCUA.GetStorableByID("control").GetBoolJSONParam("canGrabPosition").val = true; addedCUA.GetStorableByID("control").GetBoolJSONParam("canGrabRotation").val = true; if (cuaPluginPreset["setUnlistedParamsToDefault"] != null) { bool mergeLoad = true; JSONStorable presetPJS = addedCUA.GetStorableByID("Preset"); PresetManager pmp = presetPJS.GetComponent(); addedCUA.SetLastRestoredData(cuaPluginPreset, true, true); pmp.LoadPresetFromJSON(cuaPluginPreset, mergeLoad); /* if (addedCUA.GetStorableByID("Preset").GetStringJSONParam("presetName").val == "") { string savePath = "Custom/Atom/CustomUnityAsset/"; string saveFile = "pluginPreset_by_AppearanceLoader_"; var loadFiles = reload.Replace("\\", "/").Split('/'); string time = DateTime.UtcNow.ToString().Replace("/", "_").Replace(":", "_"); var loadFile = loadFiles[loadFiles.Count() - 1].Replace(".json", "") + "_" + addedCUA.name + "_" + time; SaveJSON(cuaPluginPreset, savePath + "Preset_" + saveFile + loadFile + ".vap"); addedCUA.GetStorableByID("Preset").GetStringJSONParam("presetName").val = saveFile + loadFile; addedCUA.GetStorableByID("Preset").CallAction("MergeLoadPreset"); if (deletePluginPreset_Bool.val) { addedCUA.GetStorableByID("Preset").GetStringJSONParam("presetName").val = ""; FileManagerSecure.DeleteFile(savePath + "Preset_" + saveFile + loadFile + ".vap"); } } */ } addedCUA.GetBoolJSONParam("on").val = true; } } } } SuperController.singleton.SelectController(TargetAtom.mainController); } private string checkVarDir(string varFilename) { var returnName = varFilename; if (FileManagerSecure.DirectoryExists(returnName)) { return returnName; } var splitPath = varFilename.Split(':'); var splitFilename = splitPath[0].Split('.'); for (int k = 1000; k > 0; k--) { returnName = splitFilename[0] + "." + splitFilename[1] + "." + k + ":" + splitPath[1]; if (FileManagerSecure.DirectoryExists(returnName)) { return returnName; } } return varFilename; } private string checkVar(string varFilename) { if (varFilename != "") { if (varFilename.Contains(".") && varFilename.Contains(":")) { string[] tempFilename = varFilename.Split(':'); string[] splitFilename = tempFilename[0].Split('.'); int ver = splitFilename.Count(); string tempName = ""; string reternName = ""; for (int i = 0; i < ver - 1; i++) { tempName = tempName + splitFilename[i] + "."; } string filenameVar; int varVer = 0; for (int k = 0; k < 100; k++) { filenameVar = "AddonPackages/" + tempName + k.ToString() + ".var"; if (FileManagerSecure.FileExists(filenameVar)) { varVer = k; } } if (varVer == 0) { for (int k = 0; k < 100; k++) { filenameVar = "AddonPackages/AddonPackages/" + tempName + k.ToString() + ".var"; if (FileManagerSecure.FileExists(filenameVar)) { varVer = k; } } } if (varVer == 0) { ArrayList allFiles = new ArrayList(); SearchFile("AddonPackages", tempName + "*.var", ref allFiles); var searchedFiles = (string[])allFiles.ToArray(typeof(string)); List varFiles = new List(); if (searchedFiles != null) { foreach (var item in searchedFiles) { var searchedFilesSplit = item.Replace("\\", "/").Split('/'); var searchedVarName = searchedFilesSplit[searchedFilesSplit.Length - 1]; searchedVarName = searchedVarName.Remove(searchedVarName.LastIndexOf(".var")); varFiles.Add(searchedVarName); } if (varFiles.Contains(tempFilename[0])) { var itemSplit = tempFilename[0].Split('.'); varVer = int.Parse(itemSplit[2]); } else { int latest = 1; foreach (var item in varFiles) { var itemSplit = item.Split('.'); if (latest <= int.Parse(itemSplit[2])) { latest = int.Parse(itemSplit[2]); } } varVer = latest; } } else { varVer = 0; } } if (varVer != 0) { reternName = tempName + varVer.ToString() + ":" + tempFilename[1]; if (reternName != varFilename) { //SuperController.LogMessage("Change var number"); //SuperController.LogMessage("from " + varFilename); //SuperController.LogMessage("to " + reternName); //SuperController.LogMessage(""); } return reternName; } } } return varFilename; } private string checkPath(string url) { string temp = url; if (url != "") { if (FileManagerSecure.FileExists(temp)) { return temp; } else if (temp.Contains(".") && temp.Contains(":")) { string[] tempFilename = temp.Split(':'); string[] splitFilename = tempFilename[0].Split('.'); int ver = splitFilename.Count(); string tempName = ""; string returnName = ""; for (int i = 0; i < ver - 1; i++) { tempName = tempName + splitFilename[i] + "."; } for (int k = 1000; k > 0; k--) { returnName = tempName + k.ToString() + ":" + tempFilename[1]; if (FileManagerSecure.FileExists(returnName)) { return returnName; } } } if (temp.Substring(0, 5) == "SELF:") { temp = SELF + temp.Substring(4); } else if (temp.Contains(":")) { if (temp.IndexOf(":") != 1) { temp = checkVar(url); } } else if (temp.Substring(0, 9) == "Textures/") { temp = "Custom/Atom/Person/" + temp; } else if (!temp.Contains("/")) { temp = loadDir + temp; } else if (!(temp.Substring(0, 7) == "Custom/") && !(temp.Substring(0, 6) == "Saves/")) { if (!FileManagerSecure.FileExists(temp)) { temp = loadDir + temp; } } if (temp.IndexOf(":") != 1) { if (!FileManagerSecure.FileExists(temp)) { temp = ""; missingItem.val = missingItem.val + "Missing:" + url + "\n"; } } //SuperController.LogMessage(temp); } return temp; } public static void SearchFile(string folder, string filter, ref ArrayList allFiles) { string[] filses = FileManagerSecure.GetFiles(folder, filter); allFiles.AddRange(filses); string[] subFolders = FileManagerSecure.GetDirectories(folder); foreach (string subF in subFolders) { SearchFile(subF, filter, ref allFiles); } } private void display(string word, Vector3 point) { word = word + " " + (point.x % 360).ToString() + ", "; word = word + (point.y % 360).ToString() + ", "; word = word + (point.z % 360).ToString(); SuperController.LogMessage(word); } void Start() { UpdateInitialMorphs(); } private void UpdateInitialMorphs() { JSONStorable geometry = TargetAtom.GetStorableByID("geometry"); DAZCharacterSelector character = geometry as DAZCharacterSelector; GenerateDAZMorphsControlUI morphControl = character.morphsControlUI; } #endregion private void Update() { if (previousClothingBool != clothing_Bool.val) { previousClothingBool = clothing_Bool.val; realClothing_Bool.val = previousClothingBool; notRealClothing_Bool.val = previousClothingBool; } else { if (realClothing_Bool.val == notRealClothing_Bool.val && realClothing_Bool.val != previousClothingBool) { previousClothingBool = realClothing_Bool.val; clothing_Bool.val = previousClothingBool; } } if (_texturesLoaded) { return; } else { SuperController sc = SuperController.singleton; GameObject loadingIcon = sc.loadingIcon.gameObject; GameObject loadingUI = sc.loadingUI.gameObject; if (loadingIcon.activeSelf || loadingUI.activeSelf) { return; } else { _texturesLoaded = true; } } } public void OnDisable() { } public void OnDestroy() { /* if (pm != null) { pm.postLoadEvent.RemoveListener(OnSkinPresetLoaded); } */ } } }