Added GenerateMask to AssetsHelpers;

This commit is contained in:
Misaki
2024-12-26 00:44:11 +09:00
parent 509357011c
commit 2a455513bc
47 changed files with 974 additions and 297 deletions

View File

@@ -0,0 +1,33 @@
using UnityEditor;
using UnityEngine;
namespace Misaki.ArtToolEditor
{
internal class CreateDecalMenu
{
[MenuItem("Assets/Art Tools/Material Helpers/Create Decal", true)]
public static bool CreateDecalValidator()
{
foreach (var selectedObject in Selection.objects)
{
if (selectedObject is not Material)
{
return false;
}
}
return true;
}
[MenuItem("Assets/Art Tools/Material Helpers/Create Decal")]
public static void CreateDecal()
{
var createDecal = new CreateDecalMenu();
var window = EditorWindow.GetWindow<OutputOptionsWindow>(true, "Decal Output Options");
window.WithItemSource(Selection.objects);
window.RegisterProcessor<CreateDecalProcessor>();
window.InitializeAndShow();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a4585b41cdb0577478ac9c4e563dc639

View File

@@ -0,0 +1,32 @@
using System.IO;
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
namespace Misaki.ArtToolEditor
{
internal class CreateDecalProcessor : IAssetsProcessor
{
public void OnPreProcess(AssetsProcessContext context)
{
}
public void OnProcess(UnityEngine.Object source, string outputDirectory, AssetsProcessContext context)
{
if (source is not Material mat)
{
return;
}
var outputPath = Path.Combine(outputDirectory, mat.name + ".prefab");
var decal = AssetCreationHelpers.CreateDecal(outputPath);
mat.shader = Shader.Find(Constants.Shader.DECAL_SHADER_PATH);
decal.transform.rotation = Quaternion.Euler(90, 0, 0);
decal.GetComponent<DecalProjector>().material = mat;
}
public void OnPostProcess(AssetsProcessContext context)
{
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 94792199a8319cd46b91c5b746992046