Fix some VMD export issues and some other changes (#100)
* Bug fix, improved UI layout and live vocals * Bug Fixes, New Live Compatibility * Android build support * 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 * Add tiptoes rotation for VMD export * Add a save path prompt when exporting VMD files. * Remove the debug code for body dragging. * Remove unused physics components to improve performance. * Fix incorrect VMD exports for loop animations Fix VMD motion errors during repeated recordings Fix ghost bone persistence after multiple recordings * Revert "Remove unused physics components to improve performance." This reverts commit 7a1ae7f7d13d05380f9215b653d1c6719303a458. * Reapply "Remove unused physics components to improve performance." This reverts commit fe4c05f6942198864ca06e25f17a11440961040d. * fix https://github.com/katboi01/UmaViewer/issues/95 * live timescale bug fix * bug fix for skin and tail textures in live * bug fix for skin and tail textures in live (2) * fix https://github.com/katboi01/UmaViewer/issues/108 * message ui bug fix
This commit is contained in:
@@ -5,6 +5,7 @@ using UnityEngine;
|
||||
|
||||
public class UnityCameraVMDRecorder : MonoBehaviour
|
||||
{
|
||||
public const string FileSavePath = "/../VMDRecords";
|
||||
const float WorldScaleFix = 12.5f;
|
||||
const float FPSs = 0.03333f;
|
||||
|
||||
@@ -209,8 +210,8 @@ public class UnityCameraVMDRecorder : MonoBehaviour
|
||||
/// <param name="filePath">保存先の絶対ファイルパス</param>
|
||||
public void SaveVMD()
|
||||
{
|
||||
string fileName = Application.dataPath + "/../VMDRecords/" + string.Format("Camera_{0}.vmd", DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"));
|
||||
Directory.CreateDirectory(Application.dataPath + "/../VMDRecords");
|
||||
string fileName = $"{Application.dataPath}{FileSavePath}/{string.Format("Camera_{0}.vmd", DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"))}";
|
||||
Directory.CreateDirectory(Application.dataPath + FileSavePath);
|
||||
if (IsRecording)
|
||||
{
|
||||
Debug.Log(targetCameraTransform.name + "VMD保存前にレコーディングをストップしてください。");
|
||||
@@ -327,7 +328,7 @@ public class UnityCameraVMDRecorder : MonoBehaviour
|
||||
|
||||
public static void SaveLiveCameraVMD(LiveEntry liveEntry,DateTime time, List<LiveCameraFrame> frames, int MultiCameraIndex = -1)
|
||||
{
|
||||
string directory = $"{Application.dataPath}/../VMDRecords/Live{liveEntry.MusicId}_{time.ToString("yyyy-MM-dd_HH-mm-ss")}/";
|
||||
string directory = $"{Application.dataPath}{FileSavePath}/Live{liveEntry.MusicId}_{time.ToString("yyyy-MM-dd_HH-mm-ss")}/";
|
||||
Directory.CreateDirectory(directory);
|
||||
string fileName = $"{directory}LiveCamera_POS.vmd";
|
||||
string fovFileName = $"{directory}LiveCamera_FOV.vmd";
|
||||
|
||||
@@ -8,6 +8,7 @@ using Gallop;
|
||||
//初期ポーズ(T,Aポーズ)の時点でアタッチ、有効化されている必要がある
|
||||
public class UnityHumanoidVMDRecorder : MonoBehaviour
|
||||
{
|
||||
public const string FileSavePath = "/../VMDRecords";
|
||||
public bool UseParentOfAll = true;
|
||||
public bool UseCenterAsParentOfAll = true;
|
||||
/// <summary>
|
||||
@@ -33,6 +34,7 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
|
||||
const float FPSs = 0.03333f;
|
||||
const string CenterNameString = "センター";
|
||||
const string GrooveNameString = "グルーブ";
|
||||
|
||||
public enum BoneNames
|
||||
{
|
||||
全ての親, センター, 左足IK, 右足IK, 上半身, 上半身2, 首, 頭,
|
||||
@@ -41,8 +43,7 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
|
||||
左薬指1, 左薬指2, 左薬指3, 左小指1, 左小指2, 左小指3, 右親指1, 右親指2,
|
||||
右人指1, 右人指2, 右人指3, 右中指1, 右中指2, 右中指3, 右薬指1, 右薬指2,
|
||||
右薬指3, 右小指1, 右小指2, 右小指3, 左足, 右足, 左ひざ, 右ひざ,
|
||||
左足首, 右足首, None
|
||||
//左つま先, 右つま先は情報付けると足首の回転、位置との矛盾が生じかねない
|
||||
左足首, 右足首, 左足先EX, 右足先EX, None
|
||||
}
|
||||
//コンストラクタにて初期化
|
||||
//全てのボーンを名前で引く辞書
|
||||
@@ -129,9 +130,8 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
|
||||
{ BoneNames.右ひざ, objs.Find(a=>a.name.Equals("Knee_R"))},
|
||||
{ BoneNames.左足首, objs.Find(a=>a.name.Equals("Ankle_L"))},
|
||||
{ BoneNames.右足首, objs.Find(a=>a.name.Equals("Ankle_R"))},
|
||||
//左つま先, 右つま先は情報付けると足首の回転、位置との矛盾が生じかねない
|
||||
//{ BoneNames.左つま先, (animator.GetBoneTransform(HumanBodyBones.LeftToes))},
|
||||
//{ BoneNames.右つま先, (animator.GetBoneTransform(HumanBodyBones.RightToes))}
|
||||
{ BoneNames.左足先EX, objs.Find(a=>a.name.Equals("Toe_L"))},
|
||||
{ BoneNames.右足先EX, objs.Find(a=>a.name.Equals("Toe_R"))}
|
||||
};
|
||||
|
||||
foreach (KeyValuePair<BoneNames, Transform> pair in BoneDictionary)
|
||||
@@ -139,9 +139,14 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
|
||||
transformDictionary.Add(pair.Key.ToString(), pair.Value);
|
||||
}
|
||||
|
||||
var animator = GetComponentInParent<UmaContainerCharacter>().UmaAnimator;
|
||||
var characterContainer = GetComponentInParent<UmaContainerCharacter>();
|
||||
var animator = characterContainer.UmaAnimator;
|
||||
var state = animator.GetCurrentAnimatorStateInfo(0);
|
||||
animator.Rebind();
|
||||
animator.enabled = false;
|
||||
|
||||
// Set to T-Pose
|
||||
characterContainer.ResetBodyPose();
|
||||
characterContainer.UpBodyReset();
|
||||
|
||||
BoneDictionary[BoneNames.左腕].Rotate(0, 0, -aposeDegress);
|
||||
BoneDictionary[BoneNames.右腕].Rotate(0, 0, aposeDegress);
|
||||
@@ -169,6 +174,9 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
|
||||
boneGhost = new BoneGhost(BoneDictionary, UseBottomCenter);
|
||||
morphRecorder = new MorphRecorder(transform);
|
||||
|
||||
BoneDictionary[BoneNames.左腕].Rotate(0, 0, aposeDegress);
|
||||
BoneDictionary[BoneNames.右腕].Rotate(0, 0, -aposeDegress);
|
||||
animator.enabled = true;
|
||||
animator.Play(state.shortNameHash, 0, state.normalizedTime);
|
||||
}
|
||||
|
||||
@@ -602,6 +610,13 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
|
||||
binaryWriter.Close();
|
||||
}
|
||||
}
|
||||
if (boneGhost != null)
|
||||
{
|
||||
foreach(var pair in boneGhost.GhostDictionary)
|
||||
{
|
||||
Destroy(pair.Value.ghost.gameObject);
|
||||
}
|
||||
}
|
||||
Destroy(this);
|
||||
}
|
||||
|
||||
@@ -614,15 +629,15 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
|
||||
/// <param name="keyReductionLevel">キーの書き込み頻度を減らして容量を減らす</param>
|
||||
public void SaveVMD(string modelName, int keyReductionLevel = 3)
|
||||
{
|
||||
string fileName = Application.dataPath + "/../VMDRecords/" + string.Format("UMA_{0}.vmd", DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"));
|
||||
Directory.CreateDirectory(Application.dataPath + "/../VMDRecords");
|
||||
string fileName = $"{Application.dataPath}{FileSavePath}/{string.Format("UMA_{0}.vmd", DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"))}";
|
||||
Directory.CreateDirectory(Application.dataPath + FileSavePath);
|
||||
KeyReductionLevel = keyReductionLevel;
|
||||
SaveVMD(modelName, fileName);
|
||||
}
|
||||
|
||||
public void SaveLiveVMD(LiveEntry liveEntry, DateTime time ,string modelName, int keyReductionLevel = 3)
|
||||
{
|
||||
string fileName = $"{Application.dataPath}/../VMDRecords/Live{liveEntry.MusicId}_{time.ToString("yyyy-MM-dd_HH-mm-ss")}/{modelName}.vmd";
|
||||
string fileName = $"{Application.dataPath}{FileSavePath}/Live{liveEntry.MusicId}_{time.ToString("yyyy-MM-dd_HH-mm-ss")}/{modelName}.vmd";
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(fileName));
|
||||
KeyReductionLevel = keyReductionLevel;
|
||||
SaveVMD(modelName, fileName);
|
||||
@@ -655,9 +670,11 @@ public class UnityHumanoidVMDRecorder : MonoBehaviour
|
||||
{ BoneNames.左足, (BoneNames.None, BoneNames.None, BoneNames.センター) },
|
||||
{ BoneNames.左ひざ, (BoneNames.None, BoneNames.None, BoneNames.左足) },
|
||||
{ BoneNames.左足首, (BoneNames.None, BoneNames.None, BoneNames.左ひざ) },
|
||||
{ BoneNames.左足先EX, (BoneNames.None, BoneNames.None, BoneNames.左足首) },
|
||||
{ BoneNames.右足, (BoneNames.None, BoneNames.None, BoneNames.センター) },
|
||||
{ BoneNames.右ひざ, (BoneNames.None, BoneNames.None, BoneNames.右足) },
|
||||
{ BoneNames.右足首, (BoneNames.None, BoneNames.None, BoneNames.右ひざ) },
|
||||
{ BoneNames.右足先EX, (BoneNames.None, BoneNames.None, BoneNames.右足首) },
|
||||
{ BoneNames.上半身, (BoneNames.None, BoneNames.None, BoneNames.センター) },
|
||||
{ BoneNames.上半身2, (BoneNames.None, BoneNames.None, BoneNames.上半身) },
|
||||
{ BoneNames.首, (BoneNames.上半身2, BoneNames.None, BoneNames.上半身) },
|
||||
|
||||
@@ -16,6 +16,8 @@ public class LiveViewerUI : MonoBehaviour
|
||||
|
||||
public GameObject RecordingUI;
|
||||
|
||||
public Text RecordingText;
|
||||
|
||||
public Text LyricsText;
|
||||
|
||||
public List<UmaLyricsData> CurrentLyrics = new List<UmaLyricsData>();
|
||||
|
||||
@@ -72,7 +72,7 @@ public class UmaAssetManager : MonoBehaviour
|
||||
else
|
||||
{
|
||||
var exist = LoadAB(result[i]);
|
||||
if (!exist && i % percent_num == 0)
|
||||
if (!exist && percent_num > 0 && i % percent_num == 0)
|
||||
{
|
||||
OnLoadProgressChange?.Invoke(i, result.Count, null);
|
||||
yield return null;
|
||||
|
||||
@@ -32,6 +32,7 @@ public class UmaContainerCharacter : UmaContainer
|
||||
public GameObject UpBodyBone;
|
||||
public Vector3 UpBodyPosition;
|
||||
public Quaternion UpBodyRotation;
|
||||
public Dictionary<Transform, (Vector3 pos, Quaternion rot)> InitBoneTransform;
|
||||
|
||||
[Header("Face")]
|
||||
public FaceDrivenKeyTarget FaceDrivenKeyTarget;
|
||||
@@ -80,11 +81,7 @@ public class UmaContainerCharacter : UmaContainer
|
||||
public GameObject PhysicsContainer;
|
||||
public float BodyScale = 1;
|
||||
|
||||
private float dragdistance;
|
||||
private Vector3 dragStartPos;
|
||||
private Collider dragCollider;
|
||||
private BipedIK IK;
|
||||
private PuppetMaster PuppetMaster;
|
||||
private List<Transform> _humanoidBones;
|
||||
private UIHandleCharacterRoot handleRoot;
|
||||
|
||||
@@ -107,7 +104,8 @@ public class UmaContainerCharacter : UmaContainer
|
||||
public void MergeModel()
|
||||
{
|
||||
if (!Body) return;
|
||||
var bodyBones = Body.GetComponentInChildren<SkinnedMeshRenderer>().bones.ToDictionary(bone => bone.name, bone => bone.transform);
|
||||
var bodySkinnedMeshRenderer = Body.GetComponentInChildren<SkinnedMeshRenderer>();
|
||||
var bodyBones = bodySkinnedMeshRenderer.bones.ToDictionary(bone => bone.name, bone => bone.transform);
|
||||
List<Transform> emptyBones = new List<Transform>();
|
||||
emptyBones.Add(Body.transform.Find("Position/Hip/Tail_Ctrl"));
|
||||
while (Body.transform.childCount > 0)
|
||||
@@ -201,6 +199,12 @@ public class UmaContainerCharacter : UmaContainer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InitBoneTransform = new Dictionary<Transform, (Vector3 pos, Quaternion rot)>();
|
||||
foreach (var bone in bodySkinnedMeshRenderer.bones)
|
||||
{
|
||||
InitBoneTransform[bone] = (bone.position, bone.rotation);
|
||||
}
|
||||
}
|
||||
|
||||
public void MergeHairModel()
|
||||
@@ -295,11 +299,6 @@ public class UmaContainerCharacter : UmaContainer
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPuppetMasterMode(PuppetMaster.Mode mode)
|
||||
{
|
||||
PuppetMaster.mode = mode;
|
||||
}
|
||||
|
||||
public void SetDynamicBoneEnable(bool isOn)
|
||||
{
|
||||
if (IsMini) return;
|
||||
@@ -338,69 +337,20 @@ public class UmaContainerCharacter : UmaContainer
|
||||
if (IK && !IK.enabled)
|
||||
{
|
||||
IK.enabled = true;
|
||||
if (PuppetMaster.mode != PuppetMaster.Mode.Active)
|
||||
{
|
||||
SetPuppetMasterMode(PuppetMaster.Mode.Active);
|
||||
}
|
||||
}
|
||||
|
||||
var finalRotation = FaceDrivenKeyTarget.GetEyeTrackRotation(TrackTarget.transform.position);
|
||||
FaceDrivenKeyTarget.SetEyeTrack(finalRotation);
|
||||
|
||||
var cam = Camera.main;
|
||||
var distance = Mathf.Clamp(cam.transform.InverseTransformPoint(HeadBone.transform.position).magnitude - 0.1f, 0, 2);
|
||||
var mousePos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, distance);
|
||||
var worldPos = cam.ScreenToWorldPoint(mousePos);
|
||||
|
||||
//Hold D key to Drag Body
|
||||
if (Input.GetKey(KeyCode.D))
|
||||
{
|
||||
if (dragCollider && dragCollider.attachedRigidbody)
|
||||
{
|
||||
if (PuppetMaster)
|
||||
{
|
||||
PuppetMaster.pinWeight = 0.75f;
|
||||
PuppetMaster.muscleWeight = 0.25f;
|
||||
}
|
||||
dragCollider.attachedRigidbody.isKinematic = true;
|
||||
dragCollider.transform.position = Vector3.Lerp(dragCollider.transform.position, cam.ScreenToWorldPoint(new Vector3(mousePos.x, mousePos.y, dragdistance)) - dragStartPos, Time.fixedDeltaTime * 4);
|
||||
//LookAt Mouse when Dragging
|
||||
TrackTarget.position = Vector3.Lerp(TrackTarget.position, dragCollider.transform.position, Time.fixedDeltaTime * 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Physics.Raycast(cam.ScreenPointToRay(mousePos), out RaycastHit hit))
|
||||
{
|
||||
dragCollider = hit.collider;
|
||||
dragStartPos = (hit.point - hit.collider.transform.position);
|
||||
dragdistance = cam.transform.InverseTransformPoint(hit.point).magnitude;
|
||||
}
|
||||
//LookAt Camera
|
||||
TrackTarget.position = Vector3.Lerp(TrackTarget.position, cam.transform.position, Time.fixedDeltaTime * 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PuppetMaster)
|
||||
{
|
||||
PuppetMaster.pinWeight = 1;
|
||||
PuppetMaster.muscleWeight = 1;
|
||||
}
|
||||
//LookAt Camera
|
||||
TrackTarget.position = Vector3.Lerp(TrackTarget.position, cam.transform.position, Time.fixedDeltaTime * 3);
|
||||
if (dragCollider && dragCollider.attachedRigidbody) dragCollider.attachedRigidbody.isKinematic = false;
|
||||
dragCollider = null;
|
||||
}
|
||||
//LookAt Camera
|
||||
TrackTarget.position = Vector3.Lerp(TrackTarget.position, cam.transform.position, Time.fixedDeltaTime * 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IK && IK.enabled)
|
||||
{
|
||||
IK.enabled = false;
|
||||
if (PuppetMaster && PuppetMaster.mode != PuppetMaster.Mode.Kinematic)
|
||||
{
|
||||
SetPuppetMasterMode(PuppetMaster.Mode.Kinematic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,11 +438,6 @@ public class UmaContainerCharacter : UmaContainer
|
||||
ik.solvers.lookAt.target = TrackTarget.transform;
|
||||
ik.solvers.lookAt.spineWeightCurve = new AnimationCurve(new Keyframe[2] { new Keyframe(0f, 1f), new Keyframe(1f, 0.3f) });
|
||||
IK = ik;
|
||||
|
||||
BipedRagdollCreator.Create(r, options);
|
||||
PuppetMaster = PuppetMaster.SetUp(container.transform, 8, 9);
|
||||
PuppetMaster.solverIterationCount = 3;
|
||||
PuppetMaster.FlattenHierarchy();
|
||||
}
|
||||
|
||||
public FullBodyBipedIK CreatePoseIK()
|
||||
@@ -586,8 +531,9 @@ public class UmaContainerCharacter : UmaContainer
|
||||
|
||||
foreach (Renderer r in Body.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
foreach (Material m in r.sharedMaterials)
|
||||
foreach (Material m in r.materials)
|
||||
{
|
||||
m.name = m.name.Replace(" (Instance)", "");
|
||||
string mainTex = "", toonMap = "", tripleMap = "", optionMap = "", zekkenNumberTex = "";
|
||||
|
||||
if (IsMini)
|
||||
@@ -729,8 +675,9 @@ public class UmaContainerCharacter : UmaContainer
|
||||
|
||||
foreach (Renderer r in head.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
foreach (Material m in r.sharedMaterials)
|
||||
foreach (Material m in r.materials)
|
||||
{
|
||||
m.name = m.name.Replace(" (Instance)", "");
|
||||
//only for mini umas
|
||||
if (head.name.Contains("mchr"))
|
||||
{
|
||||
@@ -878,9 +825,9 @@ public class UmaContainerCharacter : UmaContainer
|
||||
var textures = MobHeadTextures;
|
||||
foreach (Renderer r in hair.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
foreach (Material m in r.sharedMaterials)
|
||||
foreach (Material m in r.materials)
|
||||
{
|
||||
|
||||
m.name = m.name.Replace(" (Instance)", "");
|
||||
//Glasses's shader need to change manually.
|
||||
if (r.name.Contains("Hair") && r.name.Contains("Alpha"))
|
||||
{
|
||||
@@ -928,8 +875,9 @@ public class UmaContainerCharacter : UmaContainer
|
||||
var textures = TailTextures;
|
||||
foreach (Renderer r in Tail.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
foreach (Material m in r.sharedMaterials)
|
||||
foreach (Material m in r.materials)
|
||||
{
|
||||
m.name = m.name.Replace(" (Instance)", "");
|
||||
m.SetTexture("_MainTex", textures.FirstOrDefault(t => t.name.EndsWith("diff")));
|
||||
m.SetTexture("_ToonMap", textures.FirstOrDefault(t => t.name.Contains("shad")));
|
||||
m.SetTexture("_TripleMaskMap", textures.FirstOrDefault(t => t.name.Contains("base")));
|
||||
@@ -1186,6 +1134,10 @@ public class UmaContainerCharacter : UmaContainer
|
||||
{
|
||||
LoadAnimation(posMotion);
|
||||
}
|
||||
else
|
||||
{
|
||||
OverrideController["clip_p"] = null;
|
||||
}
|
||||
|
||||
if (IsMini)
|
||||
{
|
||||
@@ -1642,4 +1594,16 @@ public class UmaContainerCharacter : UmaContainer
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void ResetBodyPose()
|
||||
{
|
||||
if(InitBoneTransform == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (var pair in InitBoneTransform)
|
||||
{
|
||||
pair.Key.SetPositionAndRotation(pair.Value.pos, pair.Value.rot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +150,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
if (asset == null)
|
||||
{
|
||||
Debug.LogError("No body, can't load!");
|
||||
UmaViewerUI.Instance?.ShowMessage("No body, can't load!", UIMessageType.Error);
|
||||
return;
|
||||
}
|
||||
else if (genericCostume)
|
||||
@@ -271,7 +272,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
if (tailId != 0)
|
||||
if (tailId > 0)
|
||||
{
|
||||
string tailName = $"tail{tailId.ToString().PadLeft(4, '0')}_00";
|
||||
string tailPath = $"3d/chara/tail/{tailName}/";
|
||||
@@ -373,6 +374,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
if (asset == null)
|
||||
{
|
||||
Debug.LogError("No body, can't load!");
|
||||
UmaViewerUI.Instance?.ShowMessage("No body, can't load!", UIMessageType.Error);
|
||||
return;
|
||||
}
|
||||
else if (genericCostume)
|
||||
@@ -489,7 +491,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
if (tailId != 0)
|
||||
if (tailId > 0)
|
||||
{
|
||||
string tailName = $"tail{tailId.ToString().PadLeft(4, '0')}_00";
|
||||
string tailPath = $"3d/chara/tail/{tailName}/";
|
||||
@@ -568,6 +570,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
if (asset == null)
|
||||
{
|
||||
Debug.LogError("No body, can't load!");
|
||||
UmaViewerUI.Instance?.ShowMessage("No body, can't load!", UIMessageType.Error);
|
||||
return;
|
||||
}
|
||||
else if (isGeneric)
|
||||
@@ -636,7 +639,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
umaContainer.LoadHead(asset);
|
||||
}
|
||||
|
||||
if (tailId != 0)
|
||||
if (tailId > 0)
|
||||
{
|
||||
string tailName = $"mtail{tailId.ToString().PadLeft(4, '0')}_00";
|
||||
string tailPath = $"3d/chara/mini/tail/{tailName}/";
|
||||
@@ -750,7 +753,6 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
Director.instance.InitializeTimeline(characters, UI.LiveMode);
|
||||
Director.instance.InitializeMusic(live.MusicId, characters);
|
||||
Director.instance.Play();
|
||||
LiveViewerUI.Instance.RecordingUI.SetActive(Gallop.Live.Director.instance.IsRecordVMD);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
public ScrollRect SceneList;
|
||||
public PageManager ScenePageCtrl;
|
||||
public ScrollRect MessageScrollRect;
|
||||
public Text MessageText;
|
||||
public TextMeshProUGUI MessageText;
|
||||
public PoseManager PoseManager;
|
||||
public HandleManager HandleManager;
|
||||
|
||||
@@ -625,7 +625,11 @@ public class UmaViewerUI : MonoBehaviour
|
||||
var list = new List<UmaDatabaseEntry>();
|
||||
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith(UmaDatabaseController.BodyPath) && a.Name.Contains(chara.Id.ToString())));
|
||||
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith(UmaDatabaseController.HeadPath) && a.Name.Contains(chara.Id.ToString())));
|
||||
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith("3d/chara/tail")));
|
||||
var tail_path = getCharaTailPath(chara);
|
||||
if (!string.IsNullOrEmpty(tail_path))
|
||||
{
|
||||
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith(tail_path)));
|
||||
}
|
||||
list.Add(Main.AbList["3d/animator/drivenkeylocator"]);
|
||||
list.Add(Main.AbList[$"3d/motion/event/body/chara/chr{achara.Id}_00/anm_eve_chr{achara.Id}_00_idle01_loop"]);
|
||||
|
||||
@@ -681,7 +685,11 @@ public class UmaViewerUI : MonoBehaviour
|
||||
var list = new List<UmaDatabaseEntry>();
|
||||
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith(UmaDatabaseController.BodyPath) && a.Name.Contains(chara.Id.ToString())));
|
||||
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith(UmaDatabaseController.HeadPath) && a.Name.Contains(chara.Id.ToString())));
|
||||
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith("3d/chara/tail")));
|
||||
var tail_path = getCharaTailPath(chara);
|
||||
if (!string.IsNullOrEmpty(tail_path))
|
||||
{
|
||||
list.AddRange(Main.AbChara.Where(a => a.Name.StartsWith(tail_path)));
|
||||
}
|
||||
list.Add(Main.AbList["3d/animator/drivenkeylocator"]);
|
||||
var motion_path = $"3d/motion/event/body/chara/chr{chara.Id}_00/anm_eve_chr{chara.Id}_00_idle01_loop";
|
||||
if (!chara.IsMob && !ModelSettings.IsHeadFix && Main.AbList.TryGetValue(motion_path, out var motion_entry))
|
||||
@@ -891,6 +899,28 @@ public class UmaViewerUI : MonoBehaviour
|
||||
return (entry == null) ? id.ToString() : entry.GetName();
|
||||
}
|
||||
|
||||
public string getCharaTailPath(CharaEntry chara)
|
||||
{
|
||||
int tailId = 0;
|
||||
if (chara.IsMob)
|
||||
{
|
||||
tailId = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
var charaData = UmaDatabaseController.ReadCharaData(chara);
|
||||
tailId = Convert.ToInt32(charaData["tail_model_id"]);
|
||||
}
|
||||
if (tailId <= 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
var tailName = $"tail{tailId.ToString().PadLeft(4, '0')}_00";
|
||||
var tailPath = $"3d/chara/tail/{tailName}/";
|
||||
var tailPfb = tailPath + $"pfb_{tailName}";
|
||||
return tailPfb;
|
||||
}
|
||||
|
||||
public static string GetCostumeName(string costumeId, string defaultname)
|
||||
{
|
||||
switch (costumeId)
|
||||
@@ -996,6 +1026,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
buttonText.text = "Saving";
|
||||
recorder.SaveVMD(container.name, Config.Instance.VmdKeyReductionLevel);
|
||||
buttonText.text = "Record VMD";
|
||||
ShowMessage($"VMD is saved in {Path.GetFullPath(Application.dataPath + UnityHumanoidVMDRecorder.FileSavePath)}", UIMessageType.Success);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1092,6 +1123,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
_ => $"{msg}\n",
|
||||
};
|
||||
MessageScrollRect.gameObject.SetActive(type != UIMessageType.Close);
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(MessageScrollRect.content);
|
||||
MessageScrollRect.verticalNormalizedPosition = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,12 +128,15 @@ namespace Gallop.Live.Cutt
|
||||
double last_current_time = currentTime;
|
||||
if (timescaleKeys.thisList.Count > 0)
|
||||
{
|
||||
var has_key = false;
|
||||
// apply timescale keys
|
||||
for (int i = timescaleKeys.thisList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
|
||||
var scaleKey = timescaleKeys.thisList[i];
|
||||
if (scaleKey.FrameSecond <= currentTime)
|
||||
{
|
||||
has_key = true;
|
||||
if (scaleKey.FrameSecond <= arg.FrameSecond)
|
||||
{
|
||||
interval += (last_current_time - arg.FrameSecond) * scaleKey.Timescale * arg.playSpeed;
|
||||
@@ -146,6 +149,10 @@ namespace Gallop.Live.Cutt
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!has_key)
|
||||
{
|
||||
interval = (currentTime - arg.FrameSecond) * arg.playSpeed; // no timescale keys, use default speed
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Gallop.Live.Cutt;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -150,6 +151,8 @@ namespace Gallop.Live
|
||||
UI = GameObject.Find("LiveUI").GetComponent<LiveViewerUI>();
|
||||
|
||||
sliderControl = UI.ProgressBar.GetComponent<SliderControl>();
|
||||
LiveViewerUI.Instance.RecordingUI.SetActive(IsRecordVMD);
|
||||
LiveViewerUI.Instance.RecordingText.text = $"¡ñ Recording...\r\n VMD will be saved in {Path.GetFullPath(Application.dataPath + UnityHumanoidVMDRecorder.FileSavePath)}";
|
||||
}
|
||||
|
||||
public void InitializeTimeline(List<LiveCharacterSelect> characters, int mode)
|
||||
|
||||
Reference in New Issue
Block a user