public static CarRebakeAnimationWindow ShowWindow(CRAnimation crAnimation)
        {
            if (Instance == null)
            {
                Instance = (CarRebakeAnimationWindow)EditorWindow.GetWindow(typeof(CarRebakeAnimationWindow), true, "CaronteFX - Rebake active animation");
                Instance.crAnimation_ = crAnimation;
            }

            float width  = 320f;
            float height = 330f;

            Instance.minSize = new Vector2(width, height);
            Instance.maxSize = new Vector2(width, height);

            crAnimation.LoadAnimation(true);

            Instance.trimFrameStart_ = 0;
            Instance.trimFrameEnd_   = crAnimation.LastFrame;
            Instance.trimFrameLast_  = crAnimation.LastFrame;

            Instance.animationRebaker_ = new CarAnimationRebaker(crAnimation, Instance.BakeEventsHeaderData, Instance.BakeEventsFrameData, Instance.CreateAsset);

            Instance.Focus();
            return(Instance);
        }
        public void AssignTmpAnimationController(GameObject rootGameObject)
        {
            CarEditorUtils.GetRenderersFromRoot(rootGameObject, out arrNormalMeshRenderer_, out arrSkinnedMeshRenderer_);

            crAnimation_ = rootGameObject.GetComponent <CRAnimation>();
            crAnimation_.LoadAnimation(true);
        }
Example #3
0
        //----------------------------------------------------------------------------------
        private void SampleCaronteFX(GameObject go, out bool isVertexAnimated)
        {
            isVertexAnimated = false;
            if (!go.HasMesh())
            {
                return;
            }

            CRAnimation crAnimation = CarEditorUtils.GetFirstComponentInHierarhcy <CRAnimation>(go);

            if (crAnimation != null)
            {
                listBoneTransformTmp_.Clear();

                crAnimation.LoadAnimation(true);
                crAnimation.SetFrame(0.0f);

                isVertexAnimated = crAnimation.IsVertexAnimated(go);

                SkinnedMeshRenderer smr = go.GetComponent <SkinnedMeshRenderer>();
                if (smr != null)
                {
                    isVertexAnimated = true;
                    SetBonesLocalScateToOneIfApproximatelyZero(smr);
                }

                if (!listCRAnimation_.Contains(crAnimation))
                {
                    listCRAnimation_.Add(crAnimation);
                }
            }
        }
Example #4
0
 private void AnimationPreview(bool isPreview)
 {
     if (isPreview)
     {
         ac_.LoadAnimation(true);
         ac_.SetFrame(editorFrame_);
     }
     else
     {
         ac_.CloseAnimation();
     }
 }
        void Start()
        {
            if (cranimation != null)
            {
                cranimation.LoadAnimation(false);
                cranimation.SetFrame(0f);

                frameRate  = (int)cranimation.Fps;
                frameCount = (int)(cranimation.FrameCount / cranimation.speed);

                Time.captureFramerate = frameRate;
                currentFrame          = 0;
            }
        }
        private void SetAnimationPreviewMode()
        {
            if (!EditorApplication.isPlayingOrWillChangePlaymode)
            {
                if (ac_.PreviewInEditor && !ac_.IsPreviewing)
                {
                    ac_.LoadAnimation(true);
                    ac_.SetFrame(editorFrame_);
                    EditorUtility.SetDirty(ac_);

                    lastPreviewTime_          = EditorApplication.timeSinceStartup;
                    EditorApplication.update -= UpdatePreview;
                    EditorApplication.update += UpdatePreview;

                    ac_.IsPreviewing = true;
                }
                else if (!ac_.PreviewInEditor)
                {
                    ClosePreviewMode();
                }
            }
        }