Added eye texture cutting, bug fix
This commit is contained in:
@@ -49,6 +49,7 @@ public class TextureExporter
|
|||||||
if (mat_shader.GetPropertyType(i) == UnityEngine.Rendering.ShaderPropertyType.Texture)
|
if (mat_shader.GetPropertyType(i) == UnityEngine.Rendering.ShaderPropertyType.Texture)
|
||||||
{
|
{
|
||||||
Texture2D mat_texture = (Texture2D)mat.GetTexture(p_name);
|
Texture2D mat_texture = (Texture2D)mat.GetTexture(p_name);
|
||||||
|
|
||||||
if (mat_texture)
|
if (mat_texture)
|
||||||
{
|
{
|
||||||
string tex_name = mat_texture.name;
|
string tex_name = mat_texture.name;
|
||||||
@@ -59,8 +60,23 @@ public class TextureExporter
|
|||||||
textureNames.Add(dpath);
|
textureNames.Add(dpath);
|
||||||
}
|
}
|
||||||
if (!File.Exists(tex_path))
|
if (!File.Exists(tex_path))
|
||||||
{
|
{
|
||||||
|
|
||||||
mat_texture = duplicateTexture(mat_texture);
|
mat_texture = duplicateTexture(mat_texture);
|
||||||
|
|
||||||
|
if (tex_name.EndsWith("eye0"))
|
||||||
|
{
|
||||||
|
var clip_texture = duplicateTexture(mat_texture);
|
||||||
|
var pixels = clip_texture.GetPixels(0, 0, clip_texture.width / 4, clip_texture.height);
|
||||||
|
clip_texture.Resize(clip_texture.width / 4, clip_texture.height);
|
||||||
|
clip_texture.SetPixels(pixels);
|
||||||
|
|
||||||
|
|
||||||
|
byte[] clip = clip_texture.EncodeToPNG();
|
||||||
|
File.WriteAllBytes(tex_path, clip);
|
||||||
|
tex_path = savePath + tex_name + "_all" + ".png";
|
||||||
|
}
|
||||||
|
|
||||||
byte[] bytes = mat_texture.EncodeToPNG();
|
byte[] bytes = mat_texture.EncodeToPNG();
|
||||||
File.WriteAllBytes(tex_path, bytes);
|
File.WriteAllBytes(tex_path, bytes);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
|
|
||||||
public GameObject LiveControllerPrefab;
|
public GameObject LiveControllerPrefab;
|
||||||
|
|
||||||
private bool ShadersLoaded = false;
|
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
|||||||
@@ -196,7 +196,9 @@ public class UmaViewerMain : MonoBehaviour
|
|||||||
UI.LoadLivePanels();
|
UI.LoadLivePanels();
|
||||||
loadingUI.LoadingProgressChange(-1, -1);
|
loadingUI.LoadingProgressChange(-1, -1);
|
||||||
|
|
||||||
UmaAssetManager.LoadAssetBundle(AbList["shader"], true); //Load Shader First
|
//Load Shader First
|
||||||
|
var shaders = UmaAssetManager.LoadAssetBundle(AbList["shader"], true);
|
||||||
|
Builder.ShaderList = new List<Shader>(shaders.LoadAllAssets<Shader>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OpenUrl(string url)
|
public void OpenUrl(string url)
|
||||||
|
|||||||
Reference in New Issue
Block a user