internal void RenderAddBlendshape(EePreviewAvatar?dummy, EeEditableBlendshape editableBlendshape, AnimationClip currentClip, int cameraIndex) { if (!dummy.HasValue) { return; } _renderingCommands.GenerateSpecificFastMode( new List <EeRenderingSample> { new EeRenderingSample( CreateAnimationClipForBinding(currentClip, editableBlendshape.Binding), BufferTexture2D(), preview => { EnsureBasedInitialized(); EeRenderingSupport.MutateMultilevelHighlightDifferences(editableBlendshape.BoundaryTexture, preview.RenderTexture, BasedTexture(editableBlendshape.Property)); EeAnimationEditorWindow.Obtain().Repaint(); } ) }, dummy.Value, cameraIndex ); RenderMain(dummy.Value); }
private void RenderEditables(EePreviewAvatar dummy) { if (_state.EditableBlendshapes.Count == 0) { return; } if (_state.Maintain && _state.ScenePreviewMode == EeAnimationEditorScenePreviewMode.Never) { return; } _renderingCommands.GenerateSpecificFastMode( _state.EditableBlendshapes.Select(current => new EeRenderingSample( CreateAnimationClipForBinding(_state.CurrentClip, current.Binding), BufferTexture2D(), preview => { EnsureBasedInitialized(); EeRenderingSupport.MutateMultilevelHighlightDifferences(current.BoundaryTexture, preview.RenderTexture, BasedTexture(current.Property)); EeAnimationEditorWindow.Obtain().Repaint(); } )).ToList(), dummy, _state.CameraIndex ); }
private void RenderMain(EePreviewAvatar dummy) { EnsureActivePreviewInitialized(); var clipBeingGenerated = _state.CurrentClip; _renderingCommands.GenerateSpecificFastMode( new List <EeRenderingSample> { new EeRenderingSample(AnimationUtility.GetCurveBindings(clipBeingGenerated).Length == 0 ? NothingClip() : clipBeingGenerated, _bufferActive, preview => { _state.ActivePreview.SetPixels(preview.RenderTexture.GetPixels()); _state.ActivePreview.Apply(); EeAnimationEditorWindow.Obtain().Repaint(); Ee.Get().Hooks.PushOnMainRendered(new EeHookOnMainRendered { Clip = clipBeingGenerated, OutputTexture = preview.RenderTexture }); }) }, dummy, _state.CameraIndex, EeRenderingCommands.EeDummyAutoHide.Default, EeRenderingCommands.EePriority.High ); }
public void SelectCurrentClip(AnimationClip activeNonNull) { if (_state.CurrentClip == activeNonNull) { return; } _state.Altered(_previewHandler).NewClipSelected(activeNonNull); // FIXME: Backward dependency, this should be a listener EeAnimationEditorWindow.Obtain().OnNewClipSelected(_state.CurrentClip); }
private void OnGUI() { if (_editorEffector.GetCurrentlyEditing() == CurrentlyEditing.Nothing) { return; } if (_editorEffector.IsFirstTimeSetup() && _editorEffector.IsPreviewSetupValid()) { _editorEffector.ClearFirstTimeSetup(); } GUILayout.BeginArea(new Rect(position.width - 320, CgeLayoutCommon.SingleLineHeight * 2 + 5, 200, CgeLayoutCommon.SingleLineHeight + 2)); if (GUILayout.Button(new GUIContent("❈ ExpressionsEditor"), GUILayout.Width(170), GUILayout.Height(CgeLayoutCommon.SingleLineHeight + 2))) { EeAnimationEditorWindow.Obtain().Show(); } GUILayout.EndArea(); GUILayout.BeginArea(new Rect(position.width - 130, CgeLayoutCommon.SingleLineHeight * 2 + 5, 100, CgeLayoutCommon.SingleLineHeight + 2)); if (GUILayout.Button(new GUIContent(" " + CgeLocale.CGEE_Tutorials, _helpIcon16), GUILayout.Width(100), GUILayout.Height(CgeLayoutCommon.SingleLineHeight + 2))) { Application.OpenURL(CgeLocale.DocumentationUrl()); } GUILayout.EndArea(); switch (_editorEffector.GetCurrentlyEditing()) { case CurrentlyEditing.Nothing: break; case CurrentlyEditing.Activity: EditingAnActivity(); break; case CurrentlyEditing.Puppet: EditingAPuppet(); break; default: throw new ArgumentOutOfRangeException(); } }
internal void Throttle(EePreviewAvatar?dummy, EeEditableBlendshape info, AnimationClip currentClip, int cameraIndex, bool stateMaintain, EeAnimationEditorScenePreviewMode stateScenePreviewMode) { if (!dummy.HasValue) { return; } _throttleFinishedAction = () => { RenderMain(dummy.Value); _renderingCommands.GenerateSpecificFastMode( new List <EeRenderingSample> { new EeRenderingSample( CreateAnimationClipForBinding(currentClip, info.Binding), BufferTexture2D(), preview => { EnsureBasedInitialized(); EeRenderingSupport.MutateMultilevelHighlightDifferences(info.BoundaryTexture, preview.RenderTexture, BasedTexture(info.Property)); EeAnimationEditorWindow.Obtain().Repaint(); } ) }, dummy.Value, cameraIndex ); }; if (stateMaintain && stateScenePreviewMode != EeAnimationEditorScenePreviewMode.Always) { Maintain(dummy.Value); } else if (!_isCalling) { EditorApplication.delayCall += () => { _isCalling = false; _throttleFinishedAction(); }; _isCalling = true; } }
private void CreateNewAnimation(string propertyPath) { var animations = _editorEffector.AllDistinctAnimations(); var folder = animations.Count > 0 ? AssetDatabase.GetAssetPath(animations[0]).Replace(Path.GetFileName(AssetDatabase.GetAssetPath(animations[0])), "") : "Assets/"; var finalFilename = "CGE_NewAnimation__" + DateTime.Now.ToString("yyyy'-'MM'-'dd'_'HHmmss") + ".anim"; var finalPath = folder + finalFilename; var clip = new AnimationClip(); AssetDatabase.CreateAsset(clip, finalPath); AssetDatabase.LoadAssetAtPath <AnimationClip>(finalPath); _editorEffector.SpProperty(propertyPath).objectReferenceValue = clip; _editorEffector.ApplyModifiedProperties(); EeAnimationEditorWindow.Obtain().Show(); EditorGUIUtility.PingObject(clip); Selection.SetActiveObjectWithContext(clip, null); }