mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-01 20:25:07 +08:00
d998763fbe
* feat: add material switcher Also refactor everything... * refactor: simplify object curve handling * refactor: additional refactoring and bugfixes * feat: inverse mode * feat: add material setter inspector UI * chore: set material setter icon * chore: fix error on build * chore: adjust order of inverted element
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace nadena.dev.modular_avatar.core
|
|
{
|
|
[Serializable]
|
|
public struct MaterialSwitchObject
|
|
{
|
|
public AvatarObjectReference Object;
|
|
public Material Material;
|
|
public int MaterialIndex;
|
|
|
|
public bool Equals(MaterialSwitchObject other)
|
|
{
|
|
return Equals(Object, other.Object) && Equals(Material, other.Material) && MaterialIndex == other.MaterialIndex;
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
return obj is MaterialSwitchObject other && Equals(other);
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return HashCode.Combine(Object, Material, MaterialIndex);
|
|
}
|
|
}
|
|
|
|
[AddComponentMenu("Modular Avatar/MA Material Setter")]
|
|
[HelpURL("https://modular-avatar.nadena.dev/docs/reference/material-setter?lang=auto")]
|
|
|
|
public class ModularAvatarMaterialSetter : ReactiveComponent
|
|
{
|
|
[SerializeField] private List<MaterialSwitchObject> m_objects = new();
|
|
|
|
public List<MaterialSwitchObject> Objects
|
|
{
|
|
get => m_objects;
|
|
set => m_objects = value;
|
|
}
|
|
}
|
|
} |