mirror of
https://github.com/maxartz15/VertexAnimation.git
synced 2025-07-30 09:36:06 +02:00
Simplify data.
Remoing asset builder. Simple data setup.
This commit is contained in:
54
Runtime/Scripts/ModelBaker/NamingConventionUtils.cs
Normal file
54
Runtime/Scripts/ModelBaker/NamingConventionUtils.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TAO.VertexAnimation
|
||||
{
|
||||
public static class NamingConventionUtils
|
||||
{
|
||||
public struct TextureInfo
|
||||
{
|
||||
public string name;
|
||||
public int frames;
|
||||
public int maxFrames;
|
||||
public int fps;
|
||||
}
|
||||
|
||||
public static TextureInfo GetTextureInfo(this string name)
|
||||
{
|
||||
TextureInfo textureInfo = new TextureInfo();
|
||||
|
||||
string[] parts = name.Split('_');
|
||||
foreach (var p in parts)
|
||||
{
|
||||
if (p.StartsWith("N-"))
|
||||
{
|
||||
textureInfo.name = p.Remove(0, 2);
|
||||
}
|
||||
else if (p.StartsWith("F-"))
|
||||
{
|
||||
if (int.TryParse(p.Remove(0, 2), out int frames))
|
||||
{
|
||||
textureInfo.frames = frames;
|
||||
}
|
||||
}
|
||||
else if (p.StartsWith("MF-"))
|
||||
{
|
||||
if (int.TryParse(p.Remove(0, 3), out int maxFrames))
|
||||
{
|
||||
textureInfo.maxFrames = maxFrames;
|
||||
}
|
||||
}
|
||||
else if (p.StartsWith("FPS-"))
|
||||
{
|
||||
if (int.TryParse(p.Remove(0, 4), out int fps))
|
||||
{
|
||||
textureInfo.fps = fps;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return textureInfo;
|
||||
}
|
||||
}
|
||||
}
|
11
Runtime/Scripts/ModelBaker/NamingConventionUtils.cs.meta
Normal file
11
Runtime/Scripts/ModelBaker/NamingConventionUtils.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e54b4ebcbd661d44592a0fa8e9f7d1a2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user