void SetupRecorders()
    {
        recordObjs          = gameObject.GetComponentsInChildren <Transform> ();
        objRecorders        = new UnityObjectAnimation[recordObjs.Length];
        blendShapeRecorders = new List <UnityBlendShapeAnimation> ();

        frameIndex = 0;
        nowTime    = 0.0f;

        for (int i = 0; i < recordObjs.Length; i++)
        {
            string path = AnimationRecorderHelper.GetTransformPathName(transform, recordObjs [i]);
            objRecorders [i] = new UnityObjectAnimation(path, recordObjs [i]);

            // check if theres blendShape
            if (recordBlendShape)
            {
                if (recordObjs [i].GetComponent <SkinnedMeshRenderer> ())
                {
                    SkinnedMeshRenderer tempSkinMeshRenderer = recordObjs [i].GetComponent <SkinnedMeshRenderer> ();

                    // there is blendShape exist
                    if (tempSkinMeshRenderer.sharedMesh.blendShapeCount > 0)
                    {
                        blendShapeRecorders.Add(new UnityBlendShapeAnimation(path, tempSkinMeshRenderer));
                    }
                }
            }
        }

        if (changeTimeScale)
        {
            Time.timeScale = timeScaleOnStart;
        }
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        recordObjs   = gameObject.GetComponentsInChildren <Transform> ();
        objRecorders = new UnityObjectAnimation[recordObjs.Length];

        for (int i = 0; i < recordObjs.Length; i++)
        {
            string path = AnimationRecorderHelper.GetTransformPathName(transform, recordObjs [i]);
            objRecorders [i] = new UnityObjectAnimation(path, recordObjs [i]);
        }

        if (changeTimeScale)
        {
            Time.timeScale = timeScaleOnStart;
        }
    }
예제 #3
0
    // Use this for initialization
    void SettingRecordItems()
    {
        // get all record objs
        observeObjs = gameObject.GetComponentsInChildren <Transform> ();
        objAnims    = new ObjAnimationContainer[observeObjs.Length];

        objNums = objAnims.Length;

        for (int i = 0; i < observeObjs.Length; i++)
        {
            string namePath = AnimationRecorderHelper.GetTransformPathName(transform, observeObjs [i]);
            objAnims[i] = new ObjAnimationContainer(observeObjs[i], namePath, saveFolderPath, true, true, true);
        }

        ShowLog("Setting complete");
    }
예제 #4
0
    private void RecordObject()
    {
        AnimationClip clip = wAnimationWindowHelper.GetAnimationWindowCurrentClip();

        if (clip == null)
        {
            return;
        }
        if (PlayManually.IsPlaying() && clip.length < wAnimationWindowHelper.GetCurrentTime())
        {
            return;
        }                                                                                                  //クリップが終了してたら

        Transform rootObjectTransform = wAnimationWindowHelper.GetAnimationWindowCurrentRootGameObject().transform;
        string    path = AnimationRecorderHelper.GetTransformPathName(rootObjectTransform, followTarget.transform);

        //今編集中のアニメーターと無関係なオブジェクトならレコードしない
        if (path == null)
        {
            return;
        }

        float time;

        if (PlayManually.IsPlaying())
        {
            time = PlayManually.nowFrameTime;
        }
        else
        {
            time = wAnimationWindowHelper.GetCurrentTime();
        }

        AnimationWindowController.SetCurve(time, path, followTarget.transform, clip);

        /*
         * if (generateNodes.RecordAllChildObjects)
         * {
         *  generateNodes.RecordAllUngrab();
         * }*/

        //Grabする前のtransformを記録しておく

        /*savedPosition = followTarget.localPosition;
         * savedQuaternion = followTarget.localRotation;
         * savedScale = followTarget.localScale;*/
    }
예제 #5
0
    // 表示された
    public void Show()
    {
        GameObject rootObject = wAnimationWindowHelper.GetAnimationWindowCurrentRootGameObject();

        if (rootObject == null)
        {
            Debug.Log("アニメーションビューで編集オブジェクトが選択されてません");
            return;
        }
        Transform rootObjectTransform = rootObject.transform;

        gameObject.SetActive(true); //表示

        foreach (var obj in otherCanvasObjects)
        {
            obj.SetActive(false);
        }

        //ターゲットを検出。Humanoid形式のAnimatorを探す
        TexFacialController[] texFacialControllers = rootObjectTransform.GetComponentsInChildren <TexFacialController>();
        targetTexFacial = null;
        if (texFacialControllers.Length > 0)
        {
            targetTexFacial = texFacialControllers[0];
        }

        if (targetTexFacial == null)
        {
            Debug.Log("アニメーションビューで編集中のオブジェクトにTexFacialControllerが見つかりません");
        }
        else
        {
            targetPath = AnimationRecorderHelper.GetTransformPathName(rootObjectTransform, targetTexFacial.transform);

            //スクロールビューに表示するボタン更新
            ResetScrollViews();

            //現在選択中のフェイシャルに合わせてトグル選択
            UpdateScrollViewToggles();
        }

        animationTime = wAnimationWindowHelper.GetCurrentTime();
    }
    public void OnButtonShow()
    {
        GameObject rootObject = wAnimationWindowHelper.GetAnimationWindowCurrentRootGameObject();

        if (rootObject == null)
        {
            Debug.Log("アニメーションビューで編集オブジェクトが選択されてません");
            return;
        }
        Transform rootObjectTransform = rootObject.transform;

        handControllerParent.SetActive(true);
        uiParent.SetActive(false);

        //ターゲットを検出。Humanoid形式のAnimatorを探す
        Animator[] humanoidAnimatorTransforms = rootObjectTransform.GetComponentsInChildren <Animator>();
        targetAnimator = null;
        foreach (var animator in humanoidAnimatorTransforms)
        {
            if (animator.isHuman)
            {
                targetAnimator = animator;
                break;
            }
        }

        if (targetAnimator == null)
        {
            Debug.Log("アニメーションビューで編集中のオブジェクトにヒューマノイドのアニメーターが見つかりません");
        }
        else
        {
            targetPath = AnimationRecorderHelper.GetTransformPathName(rootObjectTransform, targetAnimator.transform);

            targetHandler = new HumanPoseHandler(targetAnimator.avatar, targetAnimator.transform);
            //ターゲットモデルからハンドモデルに手のポーズをコピーする
            CopyHandPoseTargetToHandModel();
        }

        animationTime = wAnimationWindowHelper.GetCurrentTime();
    }
예제 #7
0
    void SetupRecordItems()
    {
        // get all record objs
        observeTargets = gameObject.GetComponentsInChildren <Transform> ();
        trackers       = new TransformTracker[observeTargets.Length];

        objNums = trackers.Length;

        for (int i = 0; i < objNums; i++)
        {
            string namePath = observeTargets [i].name;

            // if there are some nodes with same names, include path
            if (includePathName)
            {
                namePath = AnimationRecorderHelper.GetTransformPathName(transform, observeTargets [i]);
                Debug.Log("get name: " + namePath);
            }
            trackers [i] = new TransformTracker(observeTargets [i], recordPos, recordRot, recordScale);
        }
        Debug.Log("setting complete");
    }
    // Use this for initialization
    void SettingRecordItems()
    {
        // get all record objs
        observeObjs = gameObject.GetComponentsInChildren <Transform> ();
        objAnims    = new ObjAnimationContainer[observeObjs.Length];

        objNums = objAnims.Length;

        for (int i = 0; i < observeObjs.Length; i++)
        {
            string namePath = observeObjs [i].name;

            // if there are some nodes with same names, include path
            if (includePathName)
            {
                namePath = AnimationRecorderHelper.GetTransformPathName(transform, observeObjs [i]);
                Debug.Log("get name: " + namePath);
            }
            objAnims[i] = new ObjAnimationContainer(observeObjs[i], namePath, saveFolderPath, true, true, true);
        }

        ShowLog("Setting complete");
    }