(Feat) Add build cost

This commit is contained in:
2026-07-14 14:25:02 +02:00
parent c9e923975d
commit 3657b870d8
27 changed files with 1270 additions and 990 deletions
@@ -23,6 +23,12 @@ namespace Ashwild.EditorTools
/// </summary>
private enum LightingPreset { Studio, Soft, Dramatic, Flat }
/// <summary>
/// Which asset kind the Target object picker is filtered to — prefabs/scene objects or raw
/// meshes. Materials, scripts and other assets are intentionally excluded from both.
/// </summary>
private enum TargetKind { Prefab, Mesh }
#endregion
#region Constants
@@ -46,6 +52,8 @@ namespace Ashwild.EditorTools
private string exportFileName = string.Empty;
private bool nameEditedByUser;
private TargetKind targetKind = TargetKind.Prefab;
private bool autoRotate;
private IVisualElementScheduledItem rotateSchedule;
@@ -172,15 +180,30 @@ namespace Ashwild.EditorTools
}
/// <summary>
/// Target card: the object field (prefab / scene object / mesh) plus quick Frame and auto-rotate
/// controls that act on the loaded subject.
/// Target card: a Prefab/Mesh kind selector that filters the object picker to only those assets
/// (so materials, scripts and the like never clutter it), the object field itself, plus quick
/// Frame and auto-rotate controls that act on the loaded subject.
/// </summary>
private VisualElement BuildTargetCard()
{
VisualElement card = Card("Target");
ObjectField field = new ObjectField("Object") { objectType = typeof(UnityEngine.Object), allowSceneObjects = true };
ObjectField field = new ObjectField("Object")
{
objectType = TargetObjectType(),
allowSceneObjects = targetKind == TargetKind.Prefab
};
field.RegisterValueChangedCallback(evt => LoadTarget(evt.newValue));
EnumField kind = new EnumField("Kind", targetKind);
kind.RegisterValueChangedCallback(evt =>
{
targetKind = (TargetKind)evt.newValue;
field.value = null;
field.objectType = TargetObjectType();
field.allowSceneObjects = targetKind == TargetKind.Prefab;
});
card.Add(kind);
card.Add(field);
VisualElement buttons = new VisualElement();
@@ -198,6 +221,12 @@ namespace Ashwild.EditorTools
return card;
}
/// <summary>
/// The Unity type the object picker is restricted to for the current kind — GameObject for
/// prefabs/scene objects, Mesh for raw meshes — so nothing else appears in the picker.
/// </summary>
private Type TargetObjectType() => targetKind == TargetKind.Mesh ? typeof(Mesh) : typeof(GameObject);
/// <summary>
/// Camera card: projection, field of view and framing padding.
/// </summary>