コード例 #1
0
    void Start()
    {
        //Messenger<List<KeyframeInfo>>.AddListener("KeyframeLoaded", onKeyframeLoaded);
        keys    = new ArrayList();
        keyInfo = new List <KeyframeInfo>();

        updateFrameDisplay();
        labelBar   = new LabelBarTexture(530);
        labelBar.y = 1;

        containingRect = new Rect((Screen.width / 2) - 250, Screen.height - 75, 500, 52);

        Messenger.AddListener("TurnOffGui", onTurnOffGui);
        Messenger.AddListener("TurnOnGui", onTurnOnGui);
        Messenger <List <KeyframeInfo> > .AddListener("KeyframeLoaded", onKeyframeLoaded);

        Messenger <int> .AddListener("KeyframeResize", respawnWithFrameCount);
    }
コード例 #2
0
    void Start()
    {
        //Messenger<List<KeyframeInfo>>.AddListener("KeyframeLoaded", onKeyframeLoaded);
        keys = new ArrayList();
        keyInfo = new List<KeyframeInfo>();

        updateFrameDisplay();
        labelBar = new LabelBarTexture(530);
        labelBar.y = 1;

        containingRect = new Rect((Screen.width / 2) - 250, Screen.height - 75, 500, 52);

        Messenger.AddListener("TurnOffGui", onTurnOffGui);
        Messenger.AddListener("TurnOnGui", onTurnOnGui);
        Messenger<List<KeyframeInfo>>.AddListener("KeyframeLoaded", onKeyframeLoaded);
        Messenger<int>.AddListener("KeyframeResize", respawnWithFrameCount);
    }
コード例 #3
0
    // When new data is loaded in, rebuild the frames and the text labels over the timeline
    // to appropriate size
    public void respawnWithFrameCount(int count)
    {
        UpdateKeyInfoList();

        if (count == 0)
        {
            count = 55;
        }

        if (hasBeenResized == false)
        {
            hasBeenResized = true;
        }

        //Updated by Chengde to reserve keyframe data when changing total number of frames
        ArrayList           oldKeys    = new ArrayList();
        List <KeyframeInfo> oldKeyInfo = new List <KeyframeInfo>();

        /////////////// 12.09.2013 //////////////////////

        if (keys != null)
        {
            //saveKeyframeData()

            //Updated by CHENGDE to reserve keyframe data when changing total number of frames
            for (int i = 0; i < keys.Count; i++)
            {
                oldKeys.Add(keys[i]);
            }
            /////////////// 12.09.2013 //////////////////////

            maxScrollLength = count;
            for (int i = 0; i < keys.Count; i++)
            {
                keys[i] = null;
            }
        }

        //Updated by CHENGDE to reserve keyframe data when changing total number of frames
        if (keyInfo.Count > 0)
        {
            for (int i = 0; i < keyInfo.Count; i++)
            {
                oldKeyInfo.Add(keyInfo[i]);
            }
        }
        /////////////// 12.09.2013 //////////////////////

        keyInfo = new List <KeyframeInfo>(count);

        keys = new ArrayList();
        for (int i = 0; i < count; i++)
        {
            KeyframeTexture keyTexture = new KeyframeTexture();
            keyTexture.x = i * 8;
            keyTexture.y = 20;
            if (i % 5 == 0)
            {
                keyTexture.isMultipleFive = true;
            }

            keys.Add(keyTexture);
            keyInfo.Add(new KeyframeInfo());
        }


        currentFrame = 1;
        labelBar     = new LabelBarTexture(count);

        keyInfo[0] = new KeyframeInfo();
        keyInfo[0].position(new Vector3(150f, 50f, 0f));
        keyInfo[0].rotation(new Quaternion(0.0f, 0.0f, 0.0f, 0.0f));
        keyInfo[0].isKeyed = true;
        keyInfo[count - 1] = new KeyframeInfo();
        keyInfo[count - 1].position(new Vector3(0f, 0f, 0f));
        keyInfo[count - 1].rotation(new Quaternion(0.0f, 0.0f, 0.0f, 0.0f));
        keyInfo[count - 1].isKeyed = true;

        //Updated by CHENGDE to reserve keyframe data when changing total number of frames
        if (keys != null)
        {
            int keyInfoCnt = (oldKeyInfo.Count < keyInfo.Count)?oldKeyInfo.Count:keyInfo.Count;
            for (int i = 0; i < keyInfoCnt; i++)
            {
                keyInfo[i] = oldKeyInfo[i];
            }

            int keyCnt = (oldKeys.Count < keys.Count)? oldKeys.Count: keys.Count;
            for (int i = 0; i < keyCnt; i++)
            {
                keys[i] = oldKeys[i];
            }
        }
        /////////////// 12.09.2013 //////////////////////


        gotoFrame(1);
        updateFrameDisplay();
        //Debug.Log("Rebuilding the Keyframebar took: " + (startTime - endTime) + " ms");
    }
コード例 #4
0
    // When new data is loaded in, rebuild the frames and the text labels over the timeline
    // to appropriate size
    public void respawnWithFrameCount(int count)
    {
        UpdateKeyInfoList();

        if(count == 0)
            count = 55;

        if(hasBeenResized == false)
        {
            hasBeenResized = true;
        }

        //Updated by Chengde to reserve keyframe data when changing total number of frames
        ArrayList oldKeys = new ArrayList();
        List<KeyframeInfo> oldKeyInfo = new List<KeyframeInfo>();
        /////////////// 12.09.2013 //////////////////////

        if(keys != null)
        {
            //saveKeyframeData()

            //Updated by CHENGDE to reserve keyframe data when changing total number of frames
            for(int i = 0; i < keys.Count; i++)
                oldKeys.Add(keys[i]);
            /////////////// 12.09.2013 //////////////////////

            maxScrollLength = count;
            for(int i = 0; i < keys.Count; i++)
            {
                keys[i] = null;
            }
        }

        //Updated by CHENGDE to reserve keyframe data when changing total number of frames
        if(keyInfo.Count > 0)
            for(int i=0; i<keyInfo.Count; i++)
                oldKeyInfo.Add (keyInfo[i]);
        /////////////// 12.09.2013 //////////////////////

        keyInfo = new List<KeyframeInfo>(count);

        keys = new ArrayList();
        for(int i = 0; i < count; i++)
        {
            KeyframeTexture keyTexture = new KeyframeTexture();
            keyTexture.x = i * 8;
            keyTexture.y = 20;
            if(i % 5 == 0)
                keyTexture.isMultipleFive = true;

            keys.Add(keyTexture);
            keyInfo.Add(new KeyframeInfo());
        }

        currentFrame = 1;
        labelBar = new LabelBarTexture(count);

        keyInfo[0] = new KeyframeInfo();
        keyInfo[0].position(new Vector3(150f, 50f, 0f));
        keyInfo[0].rotation(new Quaternion(0.0f, 0.0f, 0.0f, 0.0f));
        keyInfo[0].isKeyed = true;
        keyInfo[count-1 ] = new KeyframeInfo();
        keyInfo[count-1].position(new Vector3(0f, 0f, 0f));
        keyInfo[count-1].rotation(new Quaternion(0.0f, 0.0f, 0.0f, 0.0f));
        keyInfo[count-1].isKeyed = true;

        //Updated by CHENGDE to reserve keyframe data when changing total number of frames
        if(keys != null)
        {
            int keyInfoCnt = (oldKeyInfo.Count<keyInfo.Count)?oldKeyInfo.Count:keyInfo.Count;
            for(int i=0; i<keyInfoCnt; i++)
                keyInfo[i] = oldKeyInfo[i];

            int keyCnt = (oldKeys.Count<keys.Count)? oldKeys.Count: keys.Count;
            for(int i=0; i<keyCnt; i++)
                keys[i] = oldKeys[i];
        }
        /////////////// 12.09.2013 //////////////////////

        gotoFrame(1);
        updateFrameDisplay();
        //Debug.Log("Rebuilding the Keyframebar took: " + (startTime - endTime) + " ms");
    }