From 072fa8904087ad780ef09132e0e0717d0eecdb68 Mon Sep 17 00:00:00 2001 From: yum Date: Tue, 31 Mar 2026 21:52:22 -0700 Subject: ssfd bugfixes --- Scripts/Editor/StackTextures3D.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Scripts/Editor') diff --git a/Scripts/Editor/StackTextures3D.cs b/Scripts/Editor/StackTextures3D.cs index 3e88025..c3c65c2 100644 --- a/Scripts/Editor/StackTextures3D.cs +++ b/Scripts/Editor/StackTextures3D.cs @@ -6,6 +6,7 @@ public class StackTextures3D : EditorWindow Texture2D[] _slices = new Texture2D[0]; SerializedObject _so; SerializedProperty _slicesProp; + [SerializeField] bool reverseStackOrder = false; [MenuItem("Tools/yum_food/Stack Textures to 3D")] static void Open() => GetWindow("Stack Textures to 3D"); @@ -31,6 +32,9 @@ public class StackTextures3D : EditorWindow var prop = _so.FindProperty("slices"); EditorGUILayout.PropertyField(prop, new GUIContent("Slices"), true); + EditorGUILayout.PropertyField( + _so.FindProperty("reverseStackOrder"), + new GUIContent("Reverse Stack Order")); _so.ApplyModifiedProperties(); if (slices == null || slices.Length == 0) @@ -86,12 +90,13 @@ public class StackTextures3D : EditorWindow } } - bool mipMaps = true; + bool mipMaps = false; var tex = new Texture3D(width, height, depth, fmt, mipMaps); for (int z = 0; z < depth; z++) { - var pixels = slices[z].GetPixels(); + int sourceIndex = reverseStackOrder ? (depth - 1 - z) : z; + var pixels = slices[sourceIndex].GetPixels(); for (int y = 0; y < height; y++) for (int x = 0; x < width; x++) { @@ -100,7 +105,7 @@ public class StackTextures3D : EditorWindow } tex.wrapMode = TextureWrapMode.Repeat; - tex.filterMode = FilterMode.Trilinear; + tex.filterMode = FilterMode.Bilinear; tex.Apply(); string dir = System.IO.Path.GetDirectoryName(AssetDatabase.GetAssetPath(slices[0])); -- cgit v1.2.3