Exemplo n.º 1
0
        private void FormControl_Load(object sender, EventArgs e)
        {
            //以下、ウィンドウの設定
            this.Location = ClsSystem.mSetting.mWindowControl.mLocation;
            this.Size     = ClsSystem.mSetting.mWindowControl.mSize;

            //以下、初期化処理
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion != null)
            {
                int inFrameNum = (int)this.numericUpDown_MaxFrame.Value;
                clMotion.SetMaxFrameNum(inFrameNum);
            }

            this.mFont             = new Font("MS ゴシック", 10.5f);
            this.panel_Time.Width  = CELL_WIDTH * (int)numericUpDown_MaxFrame.Value;
            this.panel_Time.Height = HEAD_HEIGHT * 5;

            this.ToolStripMenuItem_AddRotation.Tag     = EnmTypeOption.ROTATION;
            this.ToolStripMenuItem_AddScale.Tag        = EnmTypeOption.SCALE;
            this.ToolStripMenuItem_AddOffset.Tag       = EnmTypeOption.OFFSET;
            this.ToolStripMenuItem_AddFlip.Tag         = EnmTypeOption.FLIP;
            this.ToolStripMenuItem_AddTransparency.Tag = EnmTypeOption.TRANSPARENCY;
            this.ToolStripMenuItem_AddColor.Tag        = EnmTypeOption.COLOR;
            this.ToolStripMenuItem_AddUserDataText.Tag = EnmTypeOption.USER_DATA;
        }
Exemplo n.º 2
0
        private void panel_Control_MouseUp(object sender, MouseEventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            //以下、エレメントをドロップする処理
            if (e.Button == MouseButtons.Left)
            {
                if (this.mFormDragLabel != null)
                {
                    if (!this.mFormDragLabel.IsDisposed)
                    {
                        bool isHit = false;

                        //以下、子供として登録する処理
                        ClsDatElem clElemBase = clMotion.FindElemFromMark(EnmMarkElement.IN);
                        if (clElemBase != null)
                        {
                            ClsDatElem clElem = this.mFormDragLabel.GetElem();
                            clElemBase.AddElemChild(clElem);

                            isHit = true;
                        }

                        //以下、自分の兄として登録する処理
                        clElemBase = clMotion.FindElemFromMark(EnmMarkElement.UP);
                        if (clElemBase != null)
                        {
                            ClsDatElem clElem = this.mFormDragLabel.GetElem();
                            clElemBase.AddElemBigBrother(clElem);

                            isHit = true;
                        }

                        //以下、行番号割り振り処理
                        if (isHit)
                        {
                            clMotion.RefreshLineNo();
                        }
                    }

                    this.mFormDragLabel.Close();
                    this.mFormDragLabel.Dispose();
                    this.mFormDragLabel = null;
                }

                //以下、マークをクリアする処理
                clMotion.ClearInsertMark();

                //以下、コントロール更新処理
                this.RefreshControl();
                this.panel_Control.Refresh();
                this.panel_Time.Refresh();
                this.mFormMain.Refresh();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 現在選択中のアイテムを削除する
        /// </summary>
        private void RemoveItemFromSelectLineNo()
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            int inLineNo = ClsSystem.GetSelectLineNo();

            if (inLineNo < 0)
            {
                return;
            }

            //以下、アイテム削除処理
            clMotion.RemoveItemFromLineNo(inLineNo, false, true);

            //以下、行番号振り直し処理
            clMotion.RefreshLineNo();

            //以下、コントロール更新処理
            this.RefreshControl();
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
Exemplo n.º 4
0
        private void ToolStripMenuItem_Add_Click(object sender, EventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            ClsDatElem clElem = ClsSystem.GetElemFromSelectLineNo();

            if (clElem == null)
            {
                return;
            }

            //以下、オプション追加処理
            ToolStripMenuItem clITem       = sender as ToolStripMenuItem;
            EnmTypeOption     enTypeOption = (EnmTypeOption)clITem.Tag;
            object            clValue1     = ClsParam.GetDefaultValue1(enTypeOption);
            object            clValue2     = ClsParam.GetDefaultValue2(enTypeOption);

            clElem.SetOption(enTypeOption, false, false, null, null, clValue1, clValue2);

            //以下、行番号振り直し処理
            clMotion.RefreshLineNo();

            //以下、コントロール更新処理
            this.RefreshControl();
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
Exemplo n.º 5
0
        private void panel_Control_MouseDown(object sender, MouseEventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            //以下、テキストボックス削除処理
            this.RemoveTextBoxName();

            //以下、アイテム選択処理
            int inLineNo = this.GetLineNoFromPositionY(e.Y);

            ClsSystem.SetSelectFromLineNo(inLineNo);

            if (e.Button == MouseButtons.Left)
            {
                //以下、掴んでいるエレメントを別ウィンドウで表示する処理
                ClsDatItem clItem = clMotion.GetItemFromLineNo(inLineNo);
                if (clItem != null && clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM)
                {
                    int inX = Cursor.Position.X;
                    int inY = Cursor.Position.Y;
                    this.mCatchPosStart = new Point(inX, inY);
                }
            }

            //以下、コントロール更新処理
            this.RefreshControl();
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
Exemplo n.º 6
0
        private void panel_Control_MouseClick(object sender, MouseEventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            //以下、アイテム選択処理
            int inLineNo = this.GetLineNoFromPositionY(e.Y);

            ClsSystem.SetSelectFromLineNo(inLineNo);

            ClsDatElem clElem = ClsSystem.GetElemFromLineNo(inLineNo);

            if (clElem != null)
            {
                if (inLineNo == clElem.mLineNo)
                {
                    //Click Eye
                    if (0 <= e.X && e.X < 17)
                    {
                        clElem.isDisplay = !clElem.isDisplay;
                    }

                    //Click Parent
                    if (17 <= e.X && e.X < 34)
                    {
                        if (clElem.mElem != null)
                        {
                            clElem.isParent = !clElem.isParent;
                        }
                    }

                    //Click Locked
                    if (34 <= e.X && e.X < 51)
                    {
                        clElem.isLocked = !clElem.isLocked;
                    }

                    //Attribute Open
                    if (51 <= e.X && e.X < 68)
                    {
                        clElem.isOpen = !clElem.isOpen;

                        clMotion.RefreshLineNo();    //行番号とタブを割り振る処理
                    }
                }
            }

            //以下、コントロール更新処理
            this.RefreshControl();
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
Exemplo n.º 7
0
        /// <summary>
        /// オプションの情報を修正する処理
        /// </summary>
        /// <param name="clParam">パラメーター情報</param>
        public void ChangeElemFromParam(ClsParam clParam)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            ClsDatElem clElem = ClsSystem.GetElemFromSelectLineNo();

            if (clElem == null)
            {
                return;
            }

            int inSelectFrameNo = ClsSystem.GetSelectFrameNo();

            //以下、表示設定
            object clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.DISPLAY);

            this.ChangeElem(clElem, EnmTypeOption.DISPLAY, inSelectFrameNo, clParam.mDisplayKeyFrame, false, false, null, null, clParam.mDisplay, clValue2);

            //以下、座標設定
            this.ChangeElem(clElem, EnmTypeOption.POSITION, inSelectFrameNo, clParam.mPositionKeyFrame, clParam.mPositionXTween, clParam.mPositionYTween, clParam.mTweenPositionX, clParam.mTweenPositionY, clParam.mX, clParam.mY);

            //以下、回転設定
            clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.ROTATION);
            this.ChangeElem(clElem, EnmTypeOption.ROTATION, inSelectFrameNo, clParam.mRotationKeyFrame, clParam.mRotationTween, false, clParam.mTweenRotation, null, clParam.mRZ, clValue2);

            //以下、スケール設定
            this.ChangeElem(clElem, EnmTypeOption.SCALE, inSelectFrameNo, clParam.mScaleKeyFrame, clParam.mScaleXTween, clParam.mScaleYTween, clParam.mTweenScaleX, clParam.mTweenScaleY, clParam.mSX, clParam.mSY);

            //以下、オフセット設定
            this.ChangeElem(clElem, EnmTypeOption.OFFSET, inSelectFrameNo, clParam.mOffsetKeyFrame, clParam.mOffsetXTween, clParam.mOffsetYTween, clParam.mTweenOffsetX, clParam.mTweenOffsetY, clParam.mCX, clParam.mCY);

            //以下、反転設定
            this.ChangeElem(clElem, EnmTypeOption.FLIP, inSelectFrameNo, clParam.mFlipKeyFrame, false, false, null, null, clParam.mFlipH, clParam.mFlipV);

            //以下、透明設定
            clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.TRANSPARENCY);
            this.ChangeElem(clElem, EnmTypeOption.TRANSPARENCY, inSelectFrameNo, clParam.mTransKeyFrame, clParam.mTransTween, false, clParam.mTweenTrans, null, clParam.mTrans, clValue2);

            //以下、カラー設定
            clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.COLOR);
            this.ChangeElem(clElem, EnmTypeOption.COLOR, inSelectFrameNo, clParam.mColorKeyFrame, clParam.mColorTween, false, clParam.mTweenColor, null, clParam.mColor, clValue2);

            //以下、ユーザーデータ設定
            clValue2 = ClsParam.GetDefaultValue2(EnmTypeOption.USER_DATA);
            this.ChangeElem(clElem, EnmTypeOption.USER_DATA, inSelectFrameNo, clParam.mUserDataKeyFrame, false, false, null, null, clParam.mUserData, clValue2);

            //以下、行番号を振り直す処理
            clMotion.RefreshLineNo();

            //以下、メインウィンドウ更新処理
            this.mFormMain.RefreshAll();
        }
Exemplo n.º 8
0
        public void RemoveElementFromKey(int inElementKey)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            clMotion.RemoveElemFromIndex(inElementKey);

            this.RefreshAll();
        }
Exemplo n.º 9
0
        private void panel_Time_Paint(object sender, PaintEventArgs e)
        {
            //以下、モーションのコントロール描画処理
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion != null)
            {
                int inSelectFrameNo = (int)this.numericUpDown_NowFlame.Value;
                ClsSystem.SetSelectFrameNo(inSelectFrameNo);

                clMotion.DrawTime(e.Graphics, this.panel_Time.Width, this.panel_Time.Height);
            }
        }
Exemplo n.º 10
0
        private void panel_Control_Paint(object sender, PaintEventArgs e)
        {
            int inWidth  = this.panel_Control.Width;
            int inHeight = this.panel_Control.Height;

            //以下、モーションのコントロール描画処理
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion != null)
            {
                clMotion.DrawControl(e.Graphics, this.panel_Control.Width, this.panel_Control.Height, this.mFont);
            }
        }
Exemplo n.º 11
0
        private void button_ItemDown_Click(object sender, EventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            int inLineNo = ClsSystem.GetSelectLineNo();

            if (inLineNo < 0)
            {
                return;
            }

            ClsDatItem clItem = clMotion.GetItemFromLineNo(inLineNo);

            if (clItem == null)
            {
                return;
            }
            if (clItem.mTypeItem != ClsDatItem.TYPE_ITEM.ELEM)
            {
                return;
            }

            //以下、一つ下に移動する処理
            ClsDatElem clElem = clItem as ClsDatElem;

            if (clElem.mElem == null)
            {
                clMotion.MoveDown(clElem);
            }
            else
            {
                clElem.mElem.MoveElemDown(clElem);
            }

            //以下、行番号振り直し処理
            clMotion.RefreshLineNo();

            //以下、改めてアイテムを選択する処理
            ClsSystem.SetSelectFromLineNo(clItem.mLineNo);   //上記の RefreshLineNo 関数内でmLineNoが変わっているはず

            //以下、コントロール更新処理
            this.RefreshControl();
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
Exemplo n.º 12
0
        private void panel_Time_MouseDown(object sender, MouseEventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            int inFrameNo = this.GetFrameNoFromPositionX(e.X);
            int inLineNo  = this.GetLineNoFromPositionY(e.Y);

            //以下、現在位置を設定する処理
            ClsSystem.SetSelectFromLineNo(inLineNo);
            ClsSystem.SetSelectFrameNo(inFrameNo);

            //以下、フレーム選択処理
            if (inFrameNo <= this.numericUpDown_MaxFrame.Value)
            {
                this.numericUpDown_NowFlame.Value = inFrameNo;
            }
            else
            {
                this.numericUpDown_NowFlame.Value = this.numericUpDown_MaxFrame.Value - 1;
            }

            /* 一旦コメントアウト 2017/01/31 comment out by yoshi
             * if (e.Button == MouseButtons.Left)
             * {
             *  //以下、座標情報初期化処理
             *  mMouseDownL = true;
             *  mSelect_Pos_End.X = 0;
             *  mSelect_Pos_End.Y = 0;
             * }
             */

            /* 一旦コメントアウト 2017/01/31 comment out by yoshi
             * //if (e.Button == MouseButtons.Right) { mMouseDownR = true; }
             * //if (e.Button == MouseButtons.Middle) { mMouseDownM = true; }
             * mSelect_Pos_Start.X = e.X / FormControl.CELL_WIDTH;
             * mSelect_Pos_Start.Y = e.Y / FormControl.CELL_HEIGHT;
             */

            //以下、コントロール更新処理
            this.RefreshControl();
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
Exemplo n.º 13
0
        private void panel_Control_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            //Item選択
            int inLineNo = this.GetLineNoFromPositionY(e.Y);

            //以下、エレメント選択処理
            ClsSystem.SetSelectFromLineNo(inLineNo);

            //Item最大数を確認
            ClsDatElem clElem = ClsSystem.GetElemFromLineNo(inLineNo);

            if (clElem != null)
            {
                if (e.X > 69)
                {
                    //以下、テキストボックス削除処理
                    this.RemoveTextBoxName();

                    //以下、テキストボックス生成処理
                    this.mTextBox           = new TextBox();
                    this.mTextBox.Location  = new System.Drawing.Point(69, inLineNo * FormControl.CELL_HEIGHT - 1);
                    this.mTextBox.Font      = new System.Drawing.Font("MS ゴシック", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
                    this.mTextBox.MaxLength = ClsDatElem.MAX_NAME;
                    this.mTextBox.Text      = clElem.GetName();
                    this.mTextBox.Name      = "textBox_Name";
                    this.mTextBox.Size      = new System.Drawing.Size(80, 19);
                    this.mTextBox.Tag       = inLineNo;
                    this.mTextBox.TabIndex  = 0;
                    this.mTextBox.Leave    += new System.EventHandler(this.textBox_Name_Leave);
                    this.mTextBox.KeyDown  += new System.Windows.Forms.KeyEventHandler(this.textBox_Name_KeyDown);
                    this.panel_Control.Controls.Add(this.mTextBox);

                    this.mTextBox.Focus();
                }
            }

            //以下、コントロール更新処理
            this.RefreshControl();
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
Exemplo n.º 14
0
        private void MaxFrame_ValueChanged(object sender, EventArgs e)
        {
            int inFrameNum = (int)this.numericUpDown_MaxFrame.Value;

            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion != null)
            {
                clMotion.SetMaxFrameNum(inFrameNum);
            }

            int inWidth = inFrameNum * FormControl.CELL_WIDTH + 1;

            this.panel_Time.Width = inWidth;
            this.panel_Time.Refresh();
        }
Exemplo n.º 15
0
        /// <summary>
        /// 行番号からアイテムを取得する
        /// </summary>
        /// <param name="inLineNo">行番号</param>
        /// <returns>行番号のアイテム</returns>
        public static ClsDatItem GetItemFromLineNo(int inLineNo)
        {
            if (inLineNo < 0)
            {
                return(null);
            }

            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return(null);
            }

            ClsDatItem clItem = clMotion.GetItemFromLineNo(inLineNo);

            return(clItem);
        }
Exemplo n.º 16
0
        private void contextMenuStrip_Opening(object sender, CancelEventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            bool isRemoveElementEnable = false;
            bool isAddOptionEnable     = false;
            bool isRemoveOptionEnable  = false;

            int inLineNo = ClsSystem.GetSelectLineNo();

            if (inLineNo >= 0)
            {
                ClsDatItem clItem = clMotion.GetItemFromLineNo(inLineNo);
                if (clItem != null)
                {
                    isRemoveElementEnable = true;
                    isAddOptionEnable     = true;
                }

                ClsDatOption clOption = ClsSystem.GetOptionFromLineNo(inLineNo);
                if (clOption != null)
                {
                    bool isRemoveOK = clOption.IsRemoveOK();
                    if (isRemoveOK)
                    {
                        isRemoveOptionEnable = true;
                    }
                }
            }

            this.ToolStripMenuItem_RemoveElement.Enabled = isRemoveElementEnable;
            this.ToolStripMenuItem_AddOption.Enabled     = isAddOptionEnable;
            this.ToolStripMenuItem_RemoveOption.Enabled  = isRemoveOptionEnable;
        }
Exemplo n.º 17
0
        private void ToolStripMenuItem_AddKeyFrame_Click(object sender, EventArgs e)
        {
            int inIndex = (int)this.numericUpDown_NowFlame.Value;

            if (inIndex <= 0)
            {
                return;                 //0フレーム目には作成できない
            }
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            ClsDatOption clOption = ClsSystem.GetOptionFromSelectLineNo();

            if (clOption == null)
            {
                return;
            }

            //以下、キーフレーム作成・更新処理
            ClsDatElem clElem       = clOption.mElemParent;
            bool       isParentFlag = ClsParam.GetDefaultParentFlag(clElem.mElem, clOption.mTypeOption);

            //以下、現在の値を取得する処理
            object         clValue1   = clOption.GetValue1(inIndex);
            object         clValue2   = clOption.GetValue2(inIndex);
            ClsDatKeyFrame clKeyFrame = new ClsDatKeyFrame(clOption.mTypeOption, inIndex, false, false, null, null, clValue1, clValue2);

            clOption.SetKeyFrame(inIndex, false, false, null, null, clValue1, clValue2);    //存在していたら更新、存在していなかったら追加

            //以下、コントロール更新処理
            this.RefreshControl();
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
Exemplo n.º 18
0
        private void RemoveTextBoxName()
        {
            if (this.mTextBox == null)
            {
                return;
            }

            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            //以下、名前設定処理
            int        inLineNo = (int)this.mTextBox.Tag;
            ClsDatElem clElem   = ClsSystem.GetElemFromLineNo(inLineNo);

            if (clElem != null)
            {
                string clName = this.mTextBox.Text;
                if (!string.IsNullOrEmpty(clName))
                {
                    clElem.SetName(clName);
                }
            }

            //以下、テキストボックス削除処理
            this.panel_Control.Controls.Remove(this.mTextBox);
            this.mTextBox = null;

            //以下、コントロール更新処理
            this.panel_Control.Refresh();
            this.panel_Time.Refresh();
            this.mFormMain.Refresh();
        }
Exemplo n.º 19
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);
        }
Exemplo n.º 20
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);
        }
Exemplo n.º 21
0
        private void panel_Control_MouseMove(object sender, MouseEventArgs e)
        {
            ClsDatMotion clMotion = ClsSystem.GetSelectMotion();

            if (clMotion == null)
            {
                return;
            }

            //以下、エレメント移動処理
            if (e.Button == MouseButtons.Left)
            {
                bool isExist = false;
                if (this.mFormDragLabel != null)
                {
                    if (!this.mFormDragLabel.IsDisposed)
                    {
                        isExist = true;
                    }
                }

                //以下、挿入マーククリア処理
                clMotion.ClearInsertMark();

                if (isExist)
                {
                    int inSelectLineNo = ClsSystem.GetSelectLineNo();
                    int inLineNo       = this.GetLineNoFromPositionY(e.Y);
                    if (inSelectLineNo != inLineNo)
                    {
                        //以下、挿入先チェック処理
                        ClsDatItem clItem = clMotion.GetItemFromLineNo(inLineNo);
                        if (clItem != null)
                        {
                            //以下、挿入先のエレメントに通知する処理
                            ClsDatElem     clElem = null;
                            EnmMarkElement enMark = EnmMarkElement.NONE;
                            if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.ELEM)
                            {
                                clElem = clItem as ClsDatElem;

                                int  inY  = e.Y % FormControl.CELL_HEIGHT;
                                bool isUp = (inY < FormControl.CELL_HEIGHT / 2);
                                enMark = (isUp) ? EnmMarkElement.UP : EnmMarkElement.IN;
                            }
                            else if (clItem.mTypeItem == ClsDatItem.TYPE_ITEM.OPTION)
                            {
                                ClsDatOption clOption = clItem as ClsDatOption;
                                clElem = clOption.mElemParent;
                                if (inSelectLineNo == clElem.mLineNo)
                                {
                                    clElem = null;
                                }

                                enMark = EnmMarkElement.IN;
                            }

                            if (clElem != null)
                            {
                                //以下、挿入可能な旨をエレメントに通知する処理
                                clElem.SetInsertMark(enMark);
                            }
                        }
                    }
                }
                else
                {
                    //以下、掴んでいるエレメントを別ウィンドウで表示する処理
                    int        inLineNo = ClsSystem.GetSelectLineNo();
                    ClsDatItem clItem   = clMotion.FindItemFromLineNo(inLineNo);
                    if (clItem != null)
                    {
                        int    inXDiff = (Cursor.Position.X - this.mCatchPosStart.X);
                        int    inYDiff = (Cursor.Position.Y - this.mCatchPosStart.Y);
                        double doLen   = Math.Sqrt(inXDiff * inXDiff + inYDiff * inYDiff);
                        if (doLen >= 5.0)
                        {
                            ClsDatElem clElem = clItem as ClsDatElem;
                            this.mFormDragLabel = new FormDragLabel(clElem);
                            this.mFormDragLabel.Show();
                        }
                    }
                }

                //以下、コントロール更新処理
                this.RefreshControl();
                this.panel_Control.Refresh();
                this.panel_Time.Refresh();
                this.mFormMain.Refresh();
            }
        }
Exemplo n.º 22
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;
        }
Exemplo n.º 23
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);
        }