void DrawSkinnedMeshRenderer() { EditorUtil.DrawProperty(serializedObject, nameof(blendShape.findFromChildren)); if (blendShape.findFromChildren) { var skinnedMeshRenderers = blendShape.GetComponentsInChildren <SkinnedMeshRenderer>(); int index = 0; for (int i = 0; i < skinnedMeshRenderers.Length; ++i) { var skinnedMeshRenderer = skinnedMeshRenderers[i]; if (skinnedMeshRenderer == blendShape.skinnedMeshRenderer) { index = i; break; } } var names = skinnedMeshRenderers.Select(x => x.gameObject.name).ToArray(); var newIndex = EditorGUILayout.Popup("Skinned Mesh Renderer", index, names); if (newIndex != index) { Undo.RecordObject(target, "Change Skinned Mesh Renderer"); blendShape.skinnedMeshRenderer = skinnedMeshRenderers[newIndex]; } } else { EditorUtil.DrawProperty(serializedObject, nameof(blendShape.skinnedMeshRenderer)); } }
void DrawCallback() { if (EditorUtil.Foldout("Callback", true)) { ++EditorGUI.indentLevel; EditorUtil.DrawProperty(serializedObject, nameof(lipSync.onLipSyncUpdate)); --EditorGUI.indentLevel; EditorGUILayout.Separator(); } }
public override void OnInspectorGUI() { serializedObject.Update(); bool isDefaultAsset = config.name == Common.defaultConfig || config.name == Common.calibrationConfig; if (isDefaultAsset) { EditorGUILayout.IntField("Sample Count", config.sampleCount); EditorGUILayout.IntField("Lpc Order", config.lpcOrder); EditorGUILayout.IntField("Frequency Resolution", config.frequencyResolution); EditorGUILayout.IntField("Max Frequency", config.maxFrequency); EditorGUILayout.EnumPopup("Window Func", config.windowFunc); EditorGUILayout.Toggle("Check Second Derivative", config.checkSecondDerivative); EditorGUILayout.Toggle("Check Third Formant", config.checkThirdFormant); } else { EditorUtil.DrawProperty(serializedObject, nameof(config.sampleCount)); EditorUtil.DrawProperty(serializedObject, nameof(config.lpcOrder)); EditorUtil.DrawProperty(serializedObject, nameof(config.frequencyResolution)); EditorUtil.DrawProperty(serializedObject, nameof(config.maxFrequency)); EditorUtil.DrawProperty(serializedObject, nameof(config.windowFunc)); EditorUtil.DrawProperty(serializedObject, nameof(config.checkSecondDerivative)); EditorUtil.DrawProperty(serializedObject, nameof(config.checkThirdFormant)); } var newFilterH = EditorGUILayout.Slider("Filter H", config.filterH, 0f, 1f); if (!isDefaultAsset && newFilterH != config.filterH) { Undo.RecordObject(config, "Change FilterH"); config.filterH = newFilterH; } if (isDefaultAsset) { EditorGUILayout.Separator(); EditorGUILayout.HelpBox("Cannot change parameters in a default asset.", MessageType.Info); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { serializedObject.Update(); EditorUtil.DrawProperty(serializedObject, nameof(config.sampleCount)); EditorUtil.DrawProperty(serializedObject, nameof(config.lpcOrder)); EditorUtil.DrawProperty(serializedObject, nameof(config.frequencyResolution)); EditorUtil.DrawProperty(serializedObject, nameof(config.maxFrequency)); EditorUtil.DrawProperty(serializedObject, nameof(config.windowFunc)); EditorUtil.DrawProperty(serializedObject, nameof(config.checkSecondDerivative)); EditorUtil.DrawProperty(serializedObject, nameof(config.checkThirdFormant)); var newFilterH = EditorGUILayout.Slider("Filter H", config.filterH, 0f, 1f); if (newFilterH != config.filterH) { Undo.RecordObject(config, "Change FilterH"); config.filterH = newFilterH; } serializedObject.ApplyModifiedProperties(); }
void DrawConfig() { if (EditorUtil.Foldout("Calculation Config", false)) { ++EditorGUI.indentLevel; EditorUtil.DrawProperty(serializedObject, nameof(lipSync.config)); DrawSetConfigButtons(); if (lipSync.config) { CreateCachedEditor(lipSync.config, typeof(ConfigEditor), ref configEditor_); if (configEditor_) { configEditor_.OnInspectorGUI(); } } --EditorGUI.indentLevel; EditorGUILayout.Separator(); } }
void DrawProfile() { if (EditorUtil.Foldout("LipSync Profile", true)) { ++EditorGUI.indentLevel; EditorUtil.DrawProperty(serializedObject, nameof(lipSync.profile)); DrawSetProfileButtons(); if (lipSync.profile) { CreateCachedEditor(lipSync.profile, typeof(ProfileEditor), ref profileEditor_); var editor = profileEditor_ as ProfileEditor; if (editor) { editor.Draw(true, false); } } --EditorGUI.indentLevel; EditorGUILayout.Separator(); } }
public void Draw(bool drawTips, bool drawVisualizer) { serializedObject.Update(); bool isDefaultAsset = profile.name == Common.defaultProfileMan || profile.name == Common.defaultProfileWoman; if (EditorUtil.SimpleFoldout("Formant", true)) { ++EditorGUI.indentLevel; DrawFormant(ref profile.formantA, "A", isDefaultAsset); DrawFormant(ref profile.formantI, "I", isDefaultAsset); DrawFormant(ref profile.formantU, "U", isDefaultAsset); DrawFormant(ref profile.formantE, "E", isDefaultAsset); DrawFormant(ref profile.formantO, "O", isDefaultAsset); EditorGUILayout.Separator(); if (isDefaultAsset) { EditorGUILayout.Separator(); EditorGUILayout.HelpBox("Cannot change parameters in a default asset.", MessageType.Info); } else { DrawFormantResetButtons(); if (drawTips) { if (EditorUtil.SimpleFoldout("Tips", true)) { DrawTips(); EditorGUILayout.Separator(); } } } --EditorGUI.indentLevel; EditorGUILayout.Separator(); } if (drawVisualizer) { if (EditorUtil.SimpleFoldout("Visualizer", true)) { ++EditorGUI.indentLevel; EditorUtil.DrawFormants(profile); --EditorGUI.indentLevel; EditorGUILayout.Separator(); } } if (EditorUtil.SimpleFoldout("Settings", true)) { ++EditorGUI.indentLevel; EditorUtil.DrawProperty(serializedObject, nameof(profile.useErrorRange)); EditorUtil.DrawProperty(serializedObject, nameof(profile.maxErrorRange)); EditorUtil.DrawProperty(serializedObject, nameof(profile.minLog10H)); --EditorGUI.indentLevel; } serializedObject.ApplyModifiedProperties(); }
void DrawParameter() { if (EditorUtil.Foldout("Parameters", true)) { ++EditorGUI.indentLevel; if (EditorUtil.SimpleFoldout("Volume", true)) { ++EditorGUI.indentLevel; { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Normalized Volume"); var rect = EditorGUILayout.GetControlRect(true); rect.y += rect.height * 0.3f; rect.height *= 0.4f; Handles.DrawSolidRectangleWithOutline(rect, new Color(0f, 0f, 0f, 0.2f), new Color(0f, 0f, 0f, 0.5f)); rect.width -= 2; rect.width *= Mathf.Clamp(lipSync.result.volume, 0f, 1f); rect.height -= 2; rect.y += 1; rect.x += 1; Handles.DrawSolidRectangleWithOutline(rect, Color.green, new Color(0f, 0f, 0f, 0f)); EditorGUILayout.EndHorizontal(); } EditorUtil.DrawProperty(serializedObject, nameof(lipSync.autoVolume)); if (lipSync.autoVolume) { EditorUtil.DrawProperty(serializedObject, nameof(lipSync.minVolume)); EditorUtil.DrawProperty(serializedObject, nameof(lipSync.autoVolumeAmp)); EditorUtil.DrawProperty(serializedObject, nameof(lipSync.autoVolumeFilter)); } else { EditorUtil.DrawProperty(serializedObject, nameof(lipSync.minVolume)); EditorUtil.DrawProperty(serializedObject, nameof(lipSync.maxVolume)); } --EditorGUI.indentLevel; } if (EditorUtil.SimpleFoldout("Smoothness", true)) { ++EditorGUI.indentLevel; EditorUtil.DrawProperty(serializedObject, nameof(lipSync.openSmoothness)); EditorUtil.DrawProperty(serializedObject, nameof(lipSync.closeSmoothness)); EditorUtil.DrawProperty(serializedObject, nameof(lipSync.vowelTransitionSmoothness)); --EditorGUI.indentLevel; } if (EditorUtil.SimpleFoldout("Output", true)) { ++EditorGUI.indentLevel; EditorUtil.DrawProperty(serializedObject, nameof(lipSync.outputSoundGain)); --EditorGUI.indentLevel; } --EditorGUI.indentLevel; EditorGUILayout.Separator(); } }