private async UniTaskVoid DownloadDreams() { // --- 変換元パンツテクスチャのリストをDL --- var dreamsData = await _gateway.GetDreamsData(); if (dreamsData == null) { Debug.LogError("Download Error: 変換元パンツ情報のダウンロードに失敗しました"); ClearGUIWaiting(); return; } // --- 変換元テクスチャを一括ダウンロード&保存 --- var existFiles = FilerOperator.getExistsTextures(); foreach (var imageName in dreamsData.images) { // 既にローカルにテクスチャが存在する場合はスキップ if (existFiles != null && existFiles.Contains(imageName)) { continue; } var tex = await _gateway.GetDreamTexture(imageName); // テクスチャデータの保存 var creator = new FilerOperator(); creator.Create(imageName, "Dreams", tex); } ClearGUIWaiting(); }
private async UniTaskVoid Convert() { var fileName = convertTexture.name + ".png"; var modelName = _avatersData.models[selectedIndex]; var tex = await _gateway.GetConvertedTexture(fileName, modelName, baseAvaterTexture); // 重ねるアバターのテクスチャが設定されていればテクスチャを合成する if (baseAvaterTexture != null) { // Pathからアバターのテクスチャを取得 var baseTexPath = AssetDatabase.GetAssetPath(baseAvaterTexture); var baseTex2D = FilerOperator.GetTexture(baseTexPath); tex = TextureUtils.Overlap(overTex: tex, baseTex: baseTex2D); } // テクスチャデータの保存 var dir = "ConvertedDreams/" + modelName; var creator = new FilerOperator(); creator.Create(fileName, dir, tex); _gateway = null; _disableMode = 0; EditorUtility.ClearProgressBar(); Debug.Log("Converting completed!"); }
private static void Example() { var type = typeof(GameObject); var content = EditorGUIUtility.ObjectContent(null, type); var image = content.image; var tex = Convert(image); var f = new FilerOperator(); f.Create("ressult.png", BASE_PATH + "Results", tex); Debug.Log("Test is Done"); }
private static void Init() { // ScriptableObjectからアバターデータを読み込む var file = new FilerOperator(); _avatersData = file.readAvatersData(); var window = GetWindow <PantiePatchEditorConvertWindow>(); window.titleContent = new GUIContent("パンツ変換"); window.Show(); }
private async UniTaskVoid UpdateAvaters() { var data = await _gateway.GetAvatarsData(); if (data != null) { var file = new FilerOperator(); file.SaveAvatarsData(data); ClearGUIWaiting(); Debug.Log("Updating completed!"); Debug.Log(string.Join(",", data.display_names)); Debug.Log(string.Join(",", data.models)); } }
public async void Execute(Gateway gateway) { // 通信実装を毎フレーム呼び出し switch (State) { case GatewayState.GETTING_DREAMS_LIST: _existsFiles = FilerOperator.getExistsTextures(); _dream = await gateway.GetDreamsData(); if (_dream != null) { State = GatewayState.GETTING_DREAM_TEXTURE_INIT; } break; case GatewayState.GETTING_DREAM_TEXTURE_INIT: _image = _dream.images[_counter]; // 既にローカルにテクスチャが存在する場合はスキップ if (_existsFiles != null && _existsFiles.Contains(_image)) { State = GatewayState.GETTING_DREAM_TEXTURE_FINISHED; break; } //gateway.SetUrlFromFileName(_image); //State = gateway.GetDreamTexture(_image); break; case GatewayState.GETTING_DREAM_TEXTURE: //State = gateway.GetDreamTexture(_image); break; case GatewayState.GETTING_DREAM_TEXTURE_FINISHED: _counter++; if (_counter < _dream.images.Length) { State = GatewayState.GETTING_DREAM_TEXTURE_INIT; } else { State = GatewayState.GETTING_DREAM_TEXTURES_COMPLETED; } break; case GatewayState.GETTING_DREAM_TEXTURES_COMPLETED: break; } }