private void ClosePreviewMode()
        {
            EditorApplication.update -= UpdatePreview;

            if (ac_ != null)
            {
                ac_.PreviewInEditor = false;
                ac_.IsPreviewing    = false;
                ac_.CloseAnimation();
                EditorUtility.SetDirty(ac_);
            }
        }
Пример #2
0
        //----------------------------------------------------------------------------------
        private void RestoreCaronteFX()
        {
            for (int i = 0; i < listCRAnimation_.Count; i++)
            {
                CRAnimation crAnimation = listCRAnimation_[i];
                crAnimation.PreviewInEditor = false;
                crAnimation.CloseAnimation();

                RestoreBonesState();
            }

            listCRAnimation_.Clear();
        }
Пример #3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            if (ac_.activeAnimation != ac_.animationLastLoaded_)
            {
                previewInEditor_ = false;
                ac_.CloseAnimation();
            }

            DrawDefaultInspector();
            CRGUIUtils.Splitter();

            /*
             * EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
             * EditorGUI.BeginChangeCheck();
             * previewInEditor_ = EditorGUILayout.Toggle("Preview", previewInEditor_);
             * if ( EditorGUI.EndChangeCheck() )
             * {
             * AnimationPreview( previewInEditor_ );
             * }
             * EditorGUI.EndDisabledGroup();
             */


            bool isPlayingOrPreviewInEditor = EditorApplication.isPlayingOrWillChangePlaymode || previewInEditor_;

            EditorGUI.BeginDisabledGroup(!isPlayingOrPreviewInEditor);
            EditorGUI.BeginChangeCheck();

            editorFrame_ = Mathf.Clamp(ac_.lastReadFrame_, 0, ac_.lastFrame_);
            editorFrame_ = EditorGUILayout.Slider(new GUIContent("Frame"), editorFrame_, ac_.firstFrame_, ac_.lastFrame_);
            if (EditorGUI.EndChangeCheck() && isPlayingOrPreviewInEditor)
            {
                ac_.SetFrame(editorFrame_);
                SceneView.RepaintAll();
            }

            EditorGUI.EndDisabledGroup();
            EditorGUILayout.LabelField(new GUIContent("Time"), new GUIContent(ac_.time_.ToString("F3")));
            EditorGUILayout.LabelField(new GUIContent("Frame Count"), new GUIContent(ac_.frameCount_.ToString()));
            EditorGUILayout.LabelField(new GUIContent("FPS"), new GUIContent(ac_.fps_.ToString()));
            EditorGUILayout.LabelField(new GUIContent("Animation Length"), new GUIContent(ac_.animationLength_.ToString()));
            CRGUIUtils.Splitter();

            EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);

            CRGUIUtils.Splitter();
            if (GUILayout.Button(new GUIContent("Record screenshots in play mode")))
            {
                MakeCameraScreenshots();
            }

            if (GUILayout.Button(new GUIContent("Remove camera recorder component")))
            {
                RemoveCameraRecorder();
            }

            EditorGUI.EndDisabledGroup();

            Repaint();
        }