Skip to content
This repository has been archived by the owner on Jan 22, 2023. It is now read-only.

Commit

Permalink
TextureImporterFormatRule: 自動生成されたReflectionProbeのテクスチャを除外するように
Browse files Browse the repository at this point in the history
  • Loading branch information
esperecyan committed Oct 1, 2022
1 parent 1d1dd2d commit 191c4fb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Assets/VitDeck/Validator/Rules/Asset/TextureMaterialsRule.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using UnityEditor;

namespace VitDeck.Validator
Expand All @@ -9,6 +11,8 @@ namespace VitDeck.Validator
/// </summary>
public class TextureImporterFormatRule : BaseRule
{
private static readonly Regex AutoGeneratedReflectionProbeTextureNamePattern = new Regex(@"ReflectionProbe-[0-9]+\.exr");

private readonly string platform;
private readonly IEnumerable<TextureImporterFormat> importerFormats;

Expand All @@ -20,8 +24,15 @@ public TextureImporterFormatRule(string name, string platform, IEnumerable<Textu

protected override void Logic(ValidationTarget target)
{
var autoGeneratedFolderPaths = target.GetScenes()
.Select(scene => Path.Combine(Path.GetDirectoryName(scene.path), Path.GetFileNameWithoutExtension(scene.path)));

var pathPrefix = target.GetBaseFolderPath() + "/";
var paths = target.GetAllAssetPaths().Where(path => path.StartsWith(pathPrefix)).Distinct();
var paths = target.GetAllAssetPaths().Where(path =>
!(autoGeneratedFolderPaths.Contains(Path.GetDirectoryName(path))
&& AutoGeneratedReflectionProbeTextureNamePattern.IsMatch(Path.GetFileName(path)))
&& path.StartsWith(pathPrefix)
).Distinct();
foreach (var path in paths)
{
LogicForPath(path);
Expand Down

0 comments on commit 191c4fb

Please sign in to comment.