示例#1
0
        void OnEnable()
        {
            ac_ = (CRAnimation)target;

            editorFrame_     = ac_.lastReadFrame_;
            previewInEditor_ = false;
        }
        public CarCRAnimationSampler(GameObject rootGameObject)
        {
            crAnimation_ = rootGameObject.GetComponent <CRAnimation>();

            CarEditorUtils.GetRenderersFromRoot(rootGameObject, out arrNormalMeshRenderer_, out arrSkinnedMeshRenderer_);
            AssignBodyIds();
        }
        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);
        }
示例#5
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);
                }
            }
        }
示例#6
0
        //----------------------------------------------------------------------------------
        private void RestoreCaronteFX()
        {
            for (int i = 0; i < listCRAnimation_.Count; i++)
            {
                CRAnimation crAnimation = listCRAnimation_[i];
                crAnimation.PreviewInEditor = false;
                crAnimation.CloseAnimation();

                RestoreBonesState();
            }

            listCRAnimation_.Clear();
        }
        void OnEnable()
        {
            decondeInGPUProp_       = serializedObject.FindProperty("decodeInGPU_");
            bufferAllFramesProp_    = serializedObject.FindProperty("bufferAllFrames_");
            gpuFrameBufferSizeProp_ = serializedObject.FindProperty("gpuFrameBufferSize_");
            overrideShaderForVertexAnimationProp_ = serializedObject.FindProperty("overrideShaderForVertexAnimation_");
            useDoubleSidedShaderProp_             = serializedObject.FindProperty("useDoubleSidedShader_");
            recomputeNormalsProp_ = serializedObject.FindProperty("recomputeNormals_");

            ac_          = (CRAnimation)target;
            editorFrame_ = Mathf.Max(ac_.LastReadFrame, 0);
            SetAnimationPreviewMode();

            LoadCaronteIcon();
        }
        public static CarFbxExporterWindow ShowWindow(CRAnimation crAnimation)
        {
            if (Instance == null)
            {
                Instance = (CarFbxExporterWindow)EditorWindow.GetWindow(typeof(CarFbxExporterWindow), true, "CaronteFX - Fbx Exporter");
                Instance.crAnimation_ = crAnimation;
            }

            float width  = 300f;
            float height = 100f;

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

            Instance.Focus();
            return(Instance);
        }
示例#9
0
        public static CarAddDefaultParticleSystemWindow ShowWindow(CRAnimation crAnimation)
        {
            if (Instance == null)
            {
                Instance = (CarAddDefaultParticleSystemWindow)EditorWindow.GetWindow(typeof(CarAddDefaultParticleSystemWindow), true, "CaronteFX - Add default particle system");
                Instance.crAnimation_ = crAnimation;
            }

            float width  = 200f;
            float height = 35f;

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

            Instance.Focus();
            return(Instance);
        }
示例#10
0
        public static CarMakeScreenshotsWindow ShowWindow(CRAnimation crAnimation)
        {
            if (Instance == null)
            {
                Instance = (CarMakeScreenshotsWindow)EditorWindow.GetWindow(typeof(CarMakeScreenshotsWindow), true, "CaronteFX - Make screenshots");
                Instance.crAnimation_ = crAnimation;
            }

            float width  = 250f;
            float height = 60f;

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

            Instance.Focus();
            return(Instance);
        }