Files
UmaViewer/Assets/Scripts/UmaContainer.cs
T
CroakFang 204752d7d6 Add custom head, live character shader control, and live stage control. (#88)
* Bug fix, improved UI layout and live vocals

* Bug Fixes, New Live Compatibility

* Android build support

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Fix issues with the new version of the game

* bug fix

* add config button

* Improve performance

* Sync fork

* bug fix, new uma compatibility

* Add /UserSettings to gitignore

* bug fix, add live characher shader control

* fix compilation errors

* fix compilation errors 2

* fix the live lighting calculation logic

* bug fix, add editor layout settings to gitignore

* bug fix, add editor layout settings to gitignore

* Add time scale keys for live

* live camera bug fix

* add live stage control, optimize live performance

* fix build error

* add uma head custom
2025-07-11 17:23:57 +02:00

57 lines
1.8 KiB
C#

using Gallop;
using Gallop.Live.Cutt;
using RootMotion.Dynamics;
using RootMotion.FinalIK;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using UnityEngine;
using Random = UnityEngine.Random;
public class UmaContainer : MonoBehaviour
{
public Transform Position;
[Header("Live")]
public bool IsLive = false;
public bool LiveVisible = true;
public LiveTimelineCharaLocator LiveLocator;
[Header("Other")]
public CharaShaderEffectData HeadShaderEffectData;
public CharaShaderEffectData BodyShaderEffectData;
public List<MaterialHelper> Materials = new List<MaterialHelper>();
public List<Renderer> Renderers = new List<Renderer>();
protected UmaViewerBuilder Builder => UmaViewerBuilder.Instance;
protected UmaViewerMain Main => UmaViewerMain.Instance;
protected UmaViewerUI UI => UmaViewerUI.Instance;
public class MaterialHelper
{
public Material Mat;
public UmaUIContainer Toggle;
public Dictionary<Renderer, List<int>> Renderers;
public void ToggleMaterials(bool value)
{
foreach(var rend in Renderers)
{
Debug.Log(rend.Key.name);
Material[] mat = new Material[rend.Key.sharedMaterials.Length];
for(int i = 0; i < mat.Length; i++)
{
//if material slot is not in list, keep current material
//if material slot in list and toggle is on - assign original
//if material slot in list and toggle is off - assign invisible
mat[i] = rend.Value.Contains(i) ? (value? Mat : UmaViewerBuilder.Instance.TransMaterialCharas ): rend.Key.sharedMaterials[i];
}
rend.Key.sharedMaterials = mat;
}
}
}
}