private static void SaveBGTex(OCIItem item, string filePath) { if (item?.panelComponent == null) { return; } if (filePath.IsNullOrEmpty()) { return; } if (!File.Exists(filePath)) { return; } string file = Path.GetFileName(filePath); if (DefaultBGs.Contains(file.ToLower())) { return; } for (var i = 0; i < item.panelComponent.renderer.Length; i++) { MaterialEditor.MEStudio.GetSceneController().SetMaterialTextureFromFile(item.objectInfo.dicKey, item.panelComponent.renderer[i].material, "MainTex", filePath); } item.itemInfo.panel.filePath = ""; }
private static void SaveBGTex(OCIItem item, string filePath) { if (item?.panelComponent == null) { return; } if (filePath.IsNullOrEmpty()) { return; } if (!File.Exists(filePath)) { return; } string file = Path.GetFileName(filePath); if (DefaultBGs.Contains(file.ToLower())) { return; } Logger.LogDebug($"Saving background image to scene data."); foreach (var rend in item.panelComponent.renderer) { MaterialEditor.GetSceneController().AddMaterialTexturePropertyFromFile(item.objectInfo.dicKey, rend.material.NameFormatted(), "MainTex", item.objectItem, filePath); } item.itemInfo.panel.filePath = ""; }
internal static void BackgroundCtrl_Load_Postfix(string _file) { #if HS2 if (_file.StartsWith("DefaultData")) { GetSceneController().ClearBGTex(); return; } #endif if (SaveBG.Value && !_file.IsNullOrEmpty() && !DefaultBGs.Contains(_file.ToLower())) { #if !HS2 _file = $"{UserData.Path}bg/{_file}"; #endif //Save the frame to the scene data GetSceneController().SetBGTex(_file); } else { GetSceneController().ClearBGTex(); } }