Esempio n. 1
0
        /// <summary>
        /// 指定フレームの値2を取得する処理
        /// </summary>
        /// <param name="inFrameNo">フレームNo</param>
        /// <returns>値2</returns>
        public object GetValue2(int inFrameNo)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                goto RETURN_DEFAULT2;
            }

            int inMaxFrameNum   = clMotion.GetMaxFrameNum();
            int inFrameNoBefore = 0;
            int inFrameNoAfter  = 0;

            this.GetKeyFrameNo(inFrameNo, inMaxFrameNum, out inFrameNoBefore, out inFrameNoAfter);

            //以下、キーフレーム存在チェック
            bool isExist = this.mDicKeyFrame.ContainsKey(inFrameNoBefore);

            if (!isExist)
            {
                goto RETURN_DEFAULT2;
            }
            isExist = this.mDicKeyFrame.ContainsKey(inFrameNoAfter);
            if (!isExist)
            {
                goto RETURN_DEFAULT2;
            }

            //以下、キーフレーム取得処理
            ClsDatKeyFrame clKeyFrameBefore = this.mDicKeyFrame[inFrameNoBefore];

            if (clKeyFrameBefore == null)
            {
                goto RETURN_DEFAULT2;
            }

            if (clKeyFrameBefore.mTween2 == null)
            {
                object clValueTmp = clKeyFrameBefore.mValue2;
                return(clValueTmp);
            }

            ClsDatKeyFrame clKeyFrameAfter = this.mDicKeyFrame[inFrameNoAfter];

            if (clKeyFrameAfter == null)
            {
                goto RETURN_DEFAULT2;
            }

            //以下、キーフレームの値取得処理
            object clValueBefore = clKeyFrameBefore.mValue2;

            if (clValueBefore == null)
            {
                goto RETURN_DEFAULT2;
            }

            if (clValueBefore is bool && clValueBefore is string)
            {
                return(clValueBefore);
            }

            object clValueAfter = clKeyFrameAfter.mValue2;

            if (clValueAfter == null)
            {
                goto RETURN_DEFAULT2;
            }

            if (clValueAfter is bool && clValueAfter is string)
            {
                goto RETURN_DEFAULT2;
            }

            //以下、現在フレームの値(トゥイーン込みの)計算処理
            if (clValueBefore is int && clValueAfter is int)
            {
                //Tweenを見て値を分割する処理
            }
            else if (clValueBefore is float && clValueAfter is float)
            {
                //Tweenを見て値を分割する処理
            }

RETURN_DEFAULT2:
            object clValue = ClsParam.GetDefaultValue2(this.mTypeOption);

            return(clValue);
        }
Esempio n. 2
0
        private void RefreshControl()
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            int        inSelectFrameNo = ClsSystem.GetSelectFrameNo();
            int        inMaxFrameNum   = clMotion.GetMaxFrameNum();
            int        inSelectLineNo  = ClsSystem.GetSelectLineNo();
            ClsDatItem clItem          = clMotion.GetItemFromLineNo(inSelectLineNo);

            //以下、削除ボタン有効化設定
            bool isEnable = false;

            if (clItem != null)
            {
                if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM)
                {
                    isEnable = true;
                }
                else if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.OPTION)
                {
                    ClsDatOption clOption = clItem as ClsDatOption;
                    isEnable = clOption.IsRemoveOK();
                }
            }
            this.button_ItemRemove.Enabled = isEnable;

            //以下、アトリビュートウィンドウ設定
            if (this.mFormMain != null)
            {
                if (this.mFormMain.mFormAttribute != null)
                {
                    ClsDatElem clElem = ClsSystem.GetElemFromSelectLineNo();
                    this.mFormMain.mFormAttribute.Init(clElem, inSelectFrameNo, inMaxFrameNum);
                }
            }

            //以下、上ボタン有効化設定
            isEnable = false;
            if (clItem != null)
            {
                ClsDatElem clElem = null;
                if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM)
                {
                    clElem = clItem as ClsDatElem;
                    if (clElem.mElem == null)
                    {
                        isEnable = clMotion.CanMoveUp(clElem);
                    }
                    else
                    {
                        //isEnable = clElem.mElem.CanMoveUp(clElem);    //自分が長男かチェックする
                    }
                }

/*
 *              else if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.OPTION)
 *              {
 *                  ClsDatOption clOption = clItem as ClsDatOption;
 *                  clElem = clOption.mElem;
 * //                  isEnable = clElem.CanMoveUp(clOption);
 *              }
 */
            }
            this.button_ItemUp.Enabled = isEnable;

            //以下、下ボタン有効化設定
            isEnable = false;
            if (clItem != null)
            {
                ClsDatElem clElem = null;
                if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM)
                {
                    clElem = clItem as ClsDatElem;
                    if (clElem.mElem == null)
                    {
                        isEnable = clMotion.CanMoveDown(clElem);
                    }
                    else
                    {
                    }
                }

/*
 *              else if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.OPTION)
 *              {
 *                  ClsDatOption clOption = clItem as ClsDatOption;
 *                  clElem = clOption.mElem;
 * //                  isEnable = clElem.CanMoveDown(clOption);
 *              }
 */
            }
            this.button_ItemDown.Enabled = isEnable;
        }
Esempio n. 3
0
        /// <summary>
        /// 指定フレームの値1を取得する処理
        /// </summary>
        /// <param name="inFrameNo">フレームNo</param>
        /// <returns>値1</returns>
        public object GetValue1(int inFrameNo)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                goto RETURN_DEFAULT1;
            }

            int inMaxFrameNum   = clMotion.GetMaxFrameNum();
            int inFrameNoBefore = 0;
            int inFrameNoAfter  = 0;

            this.GetKeyFrameNo(inFrameNo, inMaxFrameNum, out inFrameNoBefore, out inFrameNoAfter);

            ClsDatKeyFrame clKeyFrameBefore = this.mDicKeyFrame[inFrameNoBefore];

            if (clKeyFrameBefore == null)
            {
                goto RETURN_DEFAULT1;
            }

            if (clKeyFrameBefore.mTween1 == null)
            {
                object clValueTmp = clKeyFrameBefore.mValue1;
                return(clValueTmp);
            }

            bool isExist = this.mDicKeyFrame.ContainsKey(inFrameNoAfter);

            if (!isExist)
            {
                goto RETURN_DEFAULT1;
            }

            ClsDatKeyFrame clKeyFrameAfter = this.mDicKeyFrame[inFrameNoAfter];

            if (clKeyFrameAfter == null)
            {
                goto RETURN_DEFAULT1;
            }

            object clValueBefore = clKeyFrameBefore.mValue1;

            if (clValueBefore == null)
            {
                goto RETURN_DEFAULT1;
            }

            if (clValueBefore is bool && clValueBefore is string)
            {
                return(clValueBefore);
            }

            object clValueAfter = clKeyFrameAfter.mValue1;

            if (clValueAfter == null)
            {
                goto RETURN_DEFAULT1;
            }

            if (clValueAfter is bool && clValueAfter is string)
            {
                goto RETURN_DEFAULT1;
            }

            //以下、現在フレームの値(トゥイーン込みの)計算処理
            if (clValueBefore is int && clValueAfter is int)
            {
                //Tweenを見て値を分割する処理
                //clKeyFrameBefore.mTween1.GetRate //←中でその場で256の重みリストを作成してない?
                //もしそうなら、そのリストをメンバ内に保持するようにする
            }
            else if (clValueBefore is float && clValueAfter is float)
            {
                //Tweenを見て値を分割する処理
                //clKeyFrameBefore.mTween1.GetRate //←中でその場で256の重みリストを作成してない?
                //もしそうなら、そのリストをメンバ内に保持するようにする
            }

RETURN_DEFAULT1:
            object clValue = ClsParam.GetDefaultValue1(this.mTypeOption);

            return(clValue);
        }
Esempio n. 4
0
        /// <summary>
        /// 描画処理
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaint(PaintEventArgs e)
        {
            //以下、時間計測処理
            TimeSpan stDiff = DateTime.Now - this.mTimeOld;

            this.mTimeOld = DateTime.Now;
            double doTimeDiff = stDiff.TotalMilliseconds;
            double doFPS      = 1000.0 / doTimeDiff;

            //以下、モーション描画処理
            int          inFrameNoNow  = 0;
            int          inMaxFrameNum = ClsSystem.DEFAULT_FRAME_NUM;
            ClsDatMotion clMotion      = ClsSystem.GetSelectMotion();

            if (clMotion != null)
            {
                inFrameNoNow  = ClsSystem.GetSelectFrameNo();
                inMaxFrameNum = clMotion.GetMaxFrameNum();
                clMotion.DrawPreview(this, inFrameNoNow, inMaxFrameNum);
            }

            //以下、キャンバスサイズ設定処理
            this.mCanvasWidth  = this.Width;
            this.mCanvasHeight = this.Height;
            int inWidth  = this.Width;
            int inHeight = this.Height;

            //以下、一番引きのスクリーンでのグリッド表示処理を決める
            //(一番引きのスクリーンでは、グリッド間隔を最大にしても密度が濃くてラインで描く必要がないのと、ラインを大量に描画する必要があり重いため)
            bool isDammyGrid = false;

            if (this.mGridVisible)
            {
                if (this.mScale <= 0.125f)
                {
                    isDammyGrid = true;
                }
            }

            //以下、OpenGL初期化処理
            Wgl.wglMakeCurrent(this.hDC, this.hRC); //レンダリングコンテキストをカレントにする
            Gl.glLineWidth(1);                      //ラインの太さを1dotにする

            //以下、背景色設定処理
            if (isDammyGrid)
            {
                Gl.glClearColor(this.mGridColor.R / 255.0f, this.mGridColor.G / 255.0f, this.mGridColor.B / 255.0f, 1.0f);
            }
            else
            {
                Gl.glClearColor(this.mBackColor.R / 255.0f, this.mBackColor.G / 255.0f, this.mBackColor.B / 255.0f, 1.0f);
            }

            //以下、バッファをクリアする処理
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);

            //以下、ビューポートの設定処理
            Gl.glViewport(0, 0, inWidth, inHeight);

            /*
             * if (this.Width > this.Height)
             * {
             *  int inY = -(this.Width - this.Height) / 2;
             *  Gl.glViewport(0, inY, this.Width, this.Width);
             * }
             * else
             * {
             *  int inX = -(this.Height - this.Width) / 2;
             *  Gl.glViewport(inX, 0, this.Height, this.Height);
             * }
             */

            //以下、射影行列の設定処理
            Gl.glMatrixMode(Gl.GL_PROJECTION);
            Gl.glLoadIdentity();
            Gl.glOrtho(-inWidth / 2, inWidth / 2, -inHeight / 2, inHeight / 2, 0.0, 4.0);

            //以下、カメラの位置を設定する処理
            Glu.gluLookAt(0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); //視点の設定

            //以下、モデルビュー行列の設定
            Gl.glMatrixMode(Gl.GL_MODELVIEW);
            Gl.glLoadIdentity();

            //以下、グリッドライン描画処理
            if (this.mGridVisible)
            {
                if (!isDammyGrid)
                {
                    this.DrawGridLine(this.mGridColor, this.mGridSpan * this.mScale);
                }
            }

            //以下、中心ライン描画処理
            if (this.mCrossBarVisible)
            {
                this.DrawCrossBarLine(this.mCrossColor);
            }

            //以下、モーション描画処理
            if (clMotion != null)
            {
                clMotion.DrawPreview(this, inFrameNoNow, inMaxFrameNum);
            }

            //以下、FPSのライン表示
            {
                Gl.glLoadIdentity();    //マトリクス設定
                Gl.glLineWidth(5);

                float flX1    = -(inWidth / 2.0f) + 0;
                float flY     = (inHeight / 2.0f) - 5;
                float flX2    = (float)(flX1 + (doFPS / 60.0f) * inWidth);
                Color stColor = Color.Red;
                if (doFPS > 30.0)
                {
                    stColor = Color.LimeGreen;
                }
                else if (doFPS > 15.0)
                {
                    stColor = Color.Yellow;
                }
                this.DrawLine(stColor, flX1, flY, flX2, flY);
            }

            //以下、FPS描画処理
            if (this.mImageFont != null)
            {
                string clFPS = doFPS.ToString("F1");
                this.DrawFont(0, 0, "FPS " + clFPS, inWidth, inHeight);
            }

            //ダブルバッファ
            Wgl.wglSwapBuffers(this.hDC);
        }