Game: - Assistant and Director portraits: GPT backgrounds and a holographic appear/disappear shader (Talk/TalkHolo) instead of on/off - Phone redesigned (HaulOS home, address bar, dock, error/loading states) and the browser link made sturdier - Settings > Graphics > Lighting: Classic / Enhanced (runtime volume, no project assets changed); Enhanced SSAO uses the smooth interleaved-gradient method at high samples so flat panels don't speckle - Painted board textures (T_HullPanel, T_BarnRed) keep only edge wear: the big bare-wood patches read as dirty smudges - The head leans into a sidestep smoothly instead of snapping with A / D - New keys in all 11 languages Review only (nothing swapped into the game yet): ArtSource/Blender/remaster (v1 paint pass of our own models, Synty-built ones left out), remaster/crew (crew repaint with arm, colour-edge and face fixes), remaster_v2 (smooth-geometry pilot). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
131 lines
6.1 KiB
C#
131 lines
6.1 KiB
C#
using UnityEditor;
|
||
using UnityEngine;
|
||
|
||
namespace GrassCutter.EditorTools
|
||
{
|
||
/// <summary>Import settings for Blender FBX, UI art, textures and audio.</summary>
|
||
public class ImportRules : AssetPostprocessor
|
||
{
|
||
void OnPreprocessModel()
|
||
{
|
||
bool pack = assetPath.StartsWith("Assets/Art/Pack/");
|
||
if (!pack && !assetPath.StartsWith("Assets/Art/Models/")) return;
|
||
var mi = (ModelImporter)assetImporter;
|
||
mi.bakeAxisConversion = true;
|
||
mi.useFileScale = true;
|
||
mi.globalScale = 1f;
|
||
mi.importCameras = false;
|
||
mi.importLights = false;
|
||
mi.importVisibility = false;
|
||
mi.importAnimation = false;
|
||
mi.animationType = assetPath.Contains("SM_Crew") || assetPath.Contains("SM_Dir_") ? ModelImporterAnimationType.Generic : ModelImporterAnimationType.None;
|
||
mi.addCollider = false;
|
||
// runtime MeshColliders (seabed rocks and wrecks) need CPU-readable meshes in the player
|
||
mi.isReadable = assetPath.Contains("SM_Spire") || assetPath.Contains("SM_Wreck") || (pack && !assetPath.Contains("SM_Veh_") && !assetPath.Contains("Hay_Bale"));
|
||
mi.meshCompression = ModelImporterMeshCompression.Off;
|
||
mi.importNormals = ModelImporterNormals.Import;
|
||
mi.importTangents = ModelImporterTangents.CalculateMikk;
|
||
mi.materialImportMode = ModelImporterMaterialImportMode.ImportViaMaterialDescription;
|
||
mi.materialLocation = ModelImporterMaterialLocation.InPrefab;
|
||
mi.materialSearch = ModelImporterMaterialSearch.Everywhere;
|
||
mi.materialName = ModelImporterMaterialName.BasedOnMaterialName;
|
||
}
|
||
|
||
/// <summary>
|
||
/// The Blender exports land rotated 180° about Y (fronts face −Z). Turn every model around so the manifest's
|
||
/// convention holds in Unity: front = +Z, N flap = +Z, E = +X.
|
||
/// </summary>
|
||
void OnPostprocessModel(GameObject g)
|
||
{
|
||
if (!assetPath.StartsWith("Assets/Art/Models/")) return;
|
||
g.transform.localRotation = Quaternion.AngleAxis(180f, Vector3.up) * g.transform.localRotation;
|
||
}
|
||
|
||
/// <summary>Use our hand-made URP materials (Assets/Art/Materials/M_*.mat) instead of the FBX ones.</summary>
|
||
Material OnAssignMaterialModel(Material material, Renderer renderer)
|
||
{
|
||
// the pack's atlas, and its glass as far as a name tells
|
||
if (assetPath.StartsWith("Assets/Art/Pack/"))
|
||
return AssetDatabase.LoadAssetAtPath<Material>(material.name.Contains("Glass") || renderer.name.Contains("Glass") ? "Assets/Art/Materials/M_PackGlass.mat" : "Assets/Art/Materials/M_Pack.mat");
|
||
if (!assetPath.StartsWith("Assets/Art/Models/")) return null;
|
||
var name = material.name;
|
||
int dot = name.IndexOf('.');
|
||
if (dot > 0) name = name.Substring(0, dot); // Blender duplicates: M_Foo.001
|
||
var path = "Assets/Art/Materials/" + name + ".mat";
|
||
return AssetDatabase.LoadAssetAtPath<Material>(path);
|
||
}
|
||
|
||
void OnPreprocessTexture()
|
||
{
|
||
var ti = (TextureImporter)assetImporter;
|
||
if (assetPath.StartsWith("Assets/Art/UI/"))
|
||
{
|
||
ti.textureType = TextureImporterType.Default;
|
||
ti.alphaIsTransparency = true;
|
||
ti.mipmapEnabled = false;
|
||
ti.sRGBTexture = true;
|
||
ti.wrapMode = TextureWrapMode.Clamp;
|
||
ti.maxTextureSize = 2048;
|
||
ti.textureCompression = TextureImporterCompression.CompressedHQ;
|
||
ti.npotScale = TextureImporterNPOTScale.None;
|
||
}
|
||
else if (assetPath.StartsWith("Assets/Art/Textures/"))
|
||
{
|
||
ti.textureType = TextureImporterType.Default;
|
||
ti.mipmapEnabled = true;
|
||
ti.anisoLevel = 4;
|
||
ti.wrapMode = TextureWrapMode.Repeat;
|
||
bool crew = assetPath.Contains("T_Crew_");
|
||
ti.maxTextureSize = assetPath.Contains("PolygonFarm") || crew ? 2048 : 1024;
|
||
ti.textureCompression = crew ? TextureImporterCompression.Compressed : TextureImporterCompression.CompressedHQ;
|
||
}
|
||
else if (assetPath.StartsWith("Assets/Resources/Talk/"))
|
||
{
|
||
// the rooms behind the video calls: mipmapped, so TalkHolo can take them a little out of focus
|
||
ti.textureType = TextureImporterType.Default;
|
||
ti.mipmapEnabled = true;
|
||
ti.sRGBTexture = true;
|
||
ti.wrapMode = TextureWrapMode.Clamp;
|
||
ti.maxTextureSize = 1024;
|
||
ti.textureCompression = TextureImporterCompression.CompressedHQ;
|
||
}
|
||
else if (assetPath.StartsWith("Assets/Art/Generated/"))
|
||
{
|
||
ti.textureType = TextureImporterType.Default;
|
||
ti.alphaIsTransparency = true;
|
||
ti.mipmapEnabled = true;
|
||
ti.wrapMode = TextureWrapMode.Clamp;
|
||
ti.textureCompression = TextureImporterCompression.Uncompressed;
|
||
}
|
||
}
|
||
|
||
void OnPreprocessAudio()
|
||
{
|
||
if (!assetPath.StartsWith("Assets/Audio/")) return;
|
||
var ai = (AudioImporter)assetImporter;
|
||
var s = ai.defaultSampleSettings;
|
||
bool music = assetPath.Contains("music_");
|
||
bool loop = assetPath.Contains("_loop");
|
||
if (music)
|
||
{
|
||
s.loadType = AudioClipLoadType.Streaming;
|
||
s.compressionFormat = AudioCompressionFormat.Vorbis;
|
||
s.quality = 0.75f;
|
||
}
|
||
else if (loop)
|
||
{
|
||
s.loadType = AudioClipLoadType.CompressedInMemory;
|
||
s.compressionFormat = AudioCompressionFormat.Vorbis;
|
||
s.quality = 0.8f;
|
||
}
|
||
else
|
||
{
|
||
s.loadType = AudioClipLoadType.DecompressOnLoad;
|
||
s.compressionFormat = AudioCompressionFormat.ADPCM;
|
||
}
|
||
ai.defaultSampleSettings = s;
|
||
ai.loadInBackground = music;
|
||
}
|
||
}
|
||
}
|