Replace TownSquare with HomeCamp art and land humanoid bots, LittleBear, and LmGirl review assets.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -16,6 +16,7 @@ using UnityEngine.SceneManagement;
|
||||
public sealed class CharacterReviewSubject
|
||||
{
|
||||
public string id, kind, prefab, notes;
|
||||
public string localForward = "+Z";
|
||||
public float expectedHeight = 1.8f, heightTolerance = 0.15f;
|
||||
public int maxTriangles = 3500;
|
||||
public bool requireXpbr = true;
|
||||
@@ -134,6 +135,7 @@ public static class BuildCharacterReview
|
||||
kind = ExtractString(slice, "kind"),
|
||||
prefab = ExtractString(slice, "prefab"),
|
||||
notes = ExtractString(slice, "notes"),
|
||||
localForward = slice.Contains("\"localForward\"") ? ExtractString(slice, "localForward") : "+Z",
|
||||
expectedHeight = ExtractFloat(slice, "expectedHeight", 1.8f),
|
||||
heightTolerance = ExtractFloat(slice, "heightTolerance", 0.15f),
|
||||
maxTriangles = ExtractInt(slice, "maxTriangles"),
|
||||
@@ -177,6 +179,8 @@ public static class BuildCharacterReview
|
||||
{
|
||||
if (string.IsNullOrEmpty(subject.id) || string.IsNullOrEmpty(subject.prefab))
|
||||
throw new Exception("Subject missing id/prefab");
|
||||
if (subject.localForward != "+Z" && subject.localForward != "-Z")
|
||||
throw new Exception("Subject localForward must be +Z or legacy -Z: " + subject.id);
|
||||
if (AssetDatabase.LoadAssetAtPath<GameObject>(Norm(subject.prefab)) == null)
|
||||
throw new Exception("Missing prefab " + subject.prefab);
|
||||
}
|
||||
@@ -207,7 +211,7 @@ public static class BuildCharacterReview
|
||||
instance.name = subject.id;
|
||||
instance.transform.localPosition = new Vector3(i * data.spacing, 0f, 0f);
|
||||
instance.transform.localRotation = Quaternion.identity;
|
||||
AddForwardMarker(instance.transform);
|
||||
AddForwardMarker(instance.transform, subject.localForward);
|
||||
AddNameLabel(instance.transform, subject.id + " / " + subject.kind);
|
||||
EnsureAnimCycle(instance);
|
||||
}
|
||||
@@ -295,12 +299,14 @@ public static class BuildCharacterReview
|
||||
}
|
||||
}
|
||||
|
||||
static void AddForwardMarker(Transform subject)
|
||||
static void AddForwardMarker(Transform subject, string localForward = "+Z")
|
||||
{
|
||||
if (localForward != "+Z" && localForward != "-Z") throw new ArgumentException("Unsupported localForward");
|
||||
var marker = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
marker.name = "ForwardMinusZ";
|
||||
bool legacy = localForward == "-Z";
|
||||
marker.name = legacy ? "ForwardMinusZ" : "ForwardPlusZ";
|
||||
marker.transform.SetParent(subject, false);
|
||||
marker.transform.localPosition = new Vector3(0f, 0.05f, -0.55f);
|
||||
marker.transform.localPosition = new Vector3(0f, 0.05f, legacy ? -0.55f : 0.55f);
|
||||
marker.transform.localScale = new Vector3(0.12f, 0.04f, 0.45f);
|
||||
UnityEngine.Object.DestroyImmediate(marker.GetComponent<Collider>());
|
||||
var renderer = marker.GetComponent<Renderer>();
|
||||
@@ -309,6 +315,17 @@ public static class BuildCharacterReview
|
||||
renderer.sharedMaterial = mat;
|
||||
}
|
||||
|
||||
public static string VerifyForwardConvention()
|
||||
{
|
||||
var subjects=ParseSubjects("[{\"id\":\"new\"},{\"id\":\"legacy\",\"localForward\":\"-Z\"}]");
|
||||
if(subjects.Length!=2 || subjects[0].localForward!="+Z" || subjects[1].localForward!="-Z")
|
||||
throw new Exception("Manifest forward defaults or explicit legacy override failed");
|
||||
var manifest=ReadManifest();
|
||||
if(manifest.subjects.Any(s=>s.localForward!="+Z" && s.localForward!="-Z"))
|
||||
throw new Exception("Invalid declared forward in current manifest");
|
||||
return "PASS +Z defaults and legacy -Z overrides; manifest subjects="+manifest.subjects.Length;
|
||||
}
|
||||
|
||||
static void AddNameLabel(Transform subject, string label)
|
||||
{
|
||||
var go = new GameObject("NameLabel");
|
||||
@@ -454,7 +471,7 @@ public static class BuildCharacterReview
|
||||
var node = root.transform.Find("Subjects/" + subject.id);
|
||||
if (node == null) throw new Exception("Missing subject node " + subject.id);
|
||||
var renderers = node.GetComponentsInChildren<Renderer>(true)
|
||||
.Where(r => r.name != "ForwardMinusZ" && r.name != "NameLabel" && r.GetComponentInParent<TextMesh>() == null && !r.name.StartsWith("Label_", StringComparison.Ordinal))
|
||||
.Where(r => r.name != "ForwardMinusZ" && r.name != "ForwardPlusZ" && r.name != "NameLabel" && r.GetComponentInParent<TextMesh>() == null && !r.name.StartsWith("Label_", StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (renderers.Length == 0) throw new Exception(subject.id + " has no mesh renderer");
|
||||
var bounds = ActualBounds(renderers[0]);
|
||||
|
||||
Reference in New Issue
Block a user