Skip to content

Commit

Permalink
fix uLipSyncAnimator bug #37.
Browse files Browse the repository at this point in the history
  • Loading branch information
hecomi committed Apr 16, 2023
1 parent 9085d94 commit 349ecdf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Assets/uLipSync/Editor/uLipSyncAnimatorEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace uLipSync
[CustomEditor(typeof(uLipSyncAnimator))]
public class uLipSyncAnimatorEditor : Editor
{
uLipSyncAnimator anim { get { return target as uLipSyncAnimator; } }
uLipSyncAnimator anim => target as uLipSyncAnimator;
ReorderableList _reorderableList = null;

public override void OnInspectorGUI()
Expand Down Expand Up @@ -154,14 +154,14 @@ protected void DrawParameterListItem(Rect rect, int index)

rect.y += singleLineHeight;

var curIndex = param.index + 1;
var curIndex = Mathf.Max(param.index, 0);
var newIndex = EditorGUI.Popup(rect, "Parameter", curIndex, GetParameterArray());
if (newIndex != curIndex ||
param.name != animatorParams[curIndex].name)
{
Undo.RecordObject(target, "Change Parameter");
param.index = newIndex - 1;
param.name = animatorParams[param.index + 1].name;
param.index = Mathf.Clamp(newIndex, 0, animatorParams.Length - 1);
param.name = animatorParams[param.index].name;
param.nameHash = Animator.StringToHash(param.name);
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/uLipSync/Runtime/uLipSyncAnimator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class AnimatorInfo
public string phoneme;
public string name;
public int nameHash;
public int index = -1;
public int index = 0;
public float maxWeight = 1f;

public float weight { get; set; } = 0f;
Expand Down
8 changes: 4 additions & 4 deletions Assets/uLipSync/Samples/09. Animator/09. Animator.unity
Original file line number Diff line number Diff line change
Expand Up @@ -640,22 +640,22 @@ MonoBehaviour:
- phoneme: I
name: I
nameHash: -587065671
index: 0
index: 1
maxWeight: 1
- phoneme: U
name: U
nameHash: -922531082
index: 1
index: 2
maxWeight: 1
- phoneme: E
name: E
nameHash: -726377838
index: 2
index: 3
maxWeight: 1
- phoneme: O
name: O
nameHash: 878818188
index: 3
index: 4
maxWeight: 1
minVolume: -2.5
maxVolume: -1.5
Expand Down

0 comments on commit 349ecdf

Please sign in to comment.