Ejemplo n.º 1
0
        public void Viewport_Render(VBN skeleton)
        {
            if (skeleton == null || mvp.CurrentAnimation == null || mvp.acmdScript == null)
            {
                return;
            }

            ATKD.Entry entry = FindEntry(mvp.scriptId);
            float      frame = mvp.acmdScript.AnimationFrame;

            if (entry == null)
            {
                return;
            }
            if (frame < entry.startFrame || frame > entry.lastFrame)
            {
                return;
            }

            GL.Color4(renderColor);
            GL.LineWidth(2);
            GL.Begin(PrimitiveType.LineLoop);
            GL.Vertex3(0, entry.ymin, entry.xmin);
            GL.Vertex3(0, entry.ymax, entry.xmin);
            GL.Vertex3(0, entry.ymax, entry.xmax);
            GL.Vertex3(0, entry.ymin, entry.xmax);
            GL.End();
            isRendered = true;
        }
Ejemplo n.º 2
0
        public void ViewportEvent_SetSelection(float projX, float projY)
        {
            RectangleSelectionPart selection = RectangleSelectionPart.None;

            ATKD.Entry entry = FindEntry(mvp.scriptId);
            if (entry != null)
            {
                float xmax  = entry.xmax;
                float xmin  = entry.xmin;
                float ymax  = entry.ymax;
                float ymin  = entry.ymin;
                float delta = 0.5f;

                if (projX < xmax + delta && projX > xmin - delta && projY < ymax + delta && projY > ymin - delta)
                {
                    if (projX > xmax - delta && projX < xmax + delta)
                    {
                        selection |= RectangleSelectionPart.Right;
                    }
                    if (projX > xmin - delta && projX < xmin + delta)
                    {
                        selection |= RectangleSelectionPart.Left;
                    }
                    if (projY > ymax - delta && projY < ymax + delta)
                    {
                        selection |= RectangleSelectionPart.Top;
                    }
                    if (projY > ymin - delta && projY < ymin + delta)
                    {
                        selection |= RectangleSelectionPart.Bottom;
                    }
                }
            }
            selectedPart = (int)selection;
            if (selectedPart > 0)
            {
                renderColor = Color.PaleVioletRed;
            }
            else
            {
                renderColor = Color.MediumVioletRed;
            }
        }
Ejemplo n.º 3
0
        public void ViewportEvent_SetSelectedXY(float projX, float projY)
        {
            if (selectedPart == 0)
            {
                return;
            }
            ATKD.Entry entry = FindEntry(mvp.scriptId);
            DataRow    row   = FindDataRow(mvp.scriptId);

            if (entry != null && row != null)
            {
                float delta = 0.5f;

                if ((selectedPart & (int)RectangleSelectionPart.Right) > 0)
                {
                    float min = entry.xmin + delta;
                    if (projX > min)
                    {
                        row[4] = entry.xmax = projX;
                    }
                    else
                    {
                        row[4] = entry.xmax = min;
                    }
                }
                else if ((selectedPart & (int)RectangleSelectionPart.Left) > 0)
                {
                    float max = entry.xmax - delta;
                    if (projX < max)
                    {
                        row[3] = entry.xmin = projX;
                    }
                    else
                    {
                        row[3] = entry.xmin = max;
                    }
                }

                if ((selectedPart & (int)RectangleSelectionPart.Top) > 0)
                {
                    float min = entry.ymin + delta;
                    if (projY > min)
                    {
                        row[4] = entry.ymax = projY;
                    }
                    else
                    {
                        row[4] = entry.ymax = min;
                    }
                }
                else if ((selectedPart & (int)RectangleSelectionPart.Bottom) > 0)
                {
                    float max = entry.ymax - delta;
                    if (projY < max)
                    {
                        row[3] = entry.ymin = projY;
                    }
                    else
                    {
                        row[3] = entry.ymin = max;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void dataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            int row    = e.RowIndex;
            int column = e.ColumnIndex;

            ATKD.Entry entry = FindEntry((int)tbl.Rows[row][0]);
            ushort     shValue;
            float      flValue;

            if (ushort.TryParse((string)tbl.Rows[row][column], out shValue))
            {
                switch (column)
                {
                case 0:
                    entry.subaction = shValue;
                    break;

                case 1:
                    entry.startFrame = shValue;
                    break;

                case 2:
                    entry.lastFrame = shValue;
                    break;

                case 3:
                    entry.xmin = shValue;
                    break;

                case 4:
                    entry.xmax = shValue;
                    break;

                case 5:
                    entry.ymin = shValue;
                    break;

                case 6:
                    entry.ymax = shValue;
                    break;
                }
            }
            else
            {
                flValue = float.Parse((string)tbl.Rows[row][column]);
                if (column < 3 && flValue < 0)
                {
                    flValue = 0;
                }

                switch (column)
                {
                case 0:
                    tbl.Rows[row][column] = entry.subaction = (ushort)flValue;
                    break;

                case 1:
                    tbl.Rows[row][column] = entry.startFrame = (ushort)flValue;
                    break;

                case 2:
                    tbl.Rows[row][column] = entry.lastFrame = (ushort)flValue;
                    break;

                case 3:
                    entry.xmin = flValue;
                    break;

                case 4:
                    entry.xmax = flValue;
                    break;

                case 5:
                    entry.ymin = flValue;
                    break;

                case 6:
                    entry.ymax = flValue;
                    break;
                }
            }
        }