Land Explorer in HomeCamp with boot loading, journal UI, and CDN publish tooling.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
public static class TuneHomeCampExposure
|
||||
{
|
||||
const string ProfilePath = "Assets/Bundles/Scenes/Town/HomeCamp/HomeCampVolume.asset";
|
||||
public static string Apply()
|
||||
{
|
||||
if (EditorApplication.isPlaying) throw new InvalidOperationException("Apply in Edit Mode.");
|
||||
var profile = AssetDatabase.LoadAssetAtPath<VolumeProfile>(ProfilePath);
|
||||
if (!profile || !profile.TryGet<ColorAdjustments>(out var color)) throw new InvalidOperationException("Missing camp ColorAdjustments");
|
||||
float before = color.postExposure.value;
|
||||
Undo.RecordObject(color, "Lower HomeCamp exposure");
|
||||
color.postExposure.Override(.30f);
|
||||
EditorUtility.SetDirty(color);
|
||||
AssetDatabase.SaveAssetIfDirty(color);
|
||||
return "Saved HomeCamp postExposure " + before + " -> " + color.postExposure.value + " EV";
|
||||
}
|
||||
|
||||
public static string Capture()
|
||||
{
|
||||
var hud = HotUpdate.UI.UiManager.Instance?.Get("UI_MainHUD");
|
||||
if (!hud) throw new InvalidOperationException("Start the isolated home preview first.");
|
||||
var camera = GameObject.Find("HomeMobileTestCamera").GetComponent<Camera>();
|
||||
var canvas = hud.GetComponent<Canvas>();
|
||||
var target = new RenderTexture(Screen.width, Screen.height, 24);
|
||||
var pixels = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
|
||||
var mode = canvas.renderMode; var worldCamera = canvas.worldCamera; var mask = camera.cullingMask;
|
||||
var previous = RenderTexture.active;
|
||||
try
|
||||
{
|
||||
camera.targetTexture = target; camera.cullingMask = 1 << LayerMask.NameToLayer("UI");
|
||||
canvas.renderMode = RenderMode.ScreenSpaceCamera; canvas.worldCamera = camera; canvas.planeDistance = 1;
|
||||
Canvas.ForceUpdateCanvases(); camera.Render(); RenderTexture.active = target;
|
||||
pixels.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); pixels.Apply();
|
||||
var dir = Path.GetFullPath(Path.Combine(Application.dataPath, "../../Tools/output/homecamp_exposure_20261104"));
|
||||
Directory.CreateDirectory(dir);
|
||||
var path = Path.Combine(dir, "home_exposure_030.png");
|
||||
File.WriteAllBytes(path, pixels.EncodeToPNG());
|
||||
return path;
|
||||
}
|
||||
finally
|
||||
{
|
||||
RenderTexture.active = previous; camera.targetTexture = null; camera.cullingMask = mask;
|
||||
canvas.renderMode = mode; canvas.worldCamera = worldCamera;
|
||||
target.Release(); UnityEngine.Object.Destroy(target); UnityEngine.Object.Destroy(pixels);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user