private void gvTPONodes_SelectionChanged(object sender, EventArgs e) { int tpofile_row = tpoFileBindingSource.Position; TPOFile tpo = TPOList[tpofile_row]; int tponode_row = tpoNodeBindingSource.Position; TPONode tponode = tpo.nodes[tponode_row]; tpoCommandBindingSource.DataSource = tponode.commands; gvCommands.Rows.Clear(); bool inv_scale_on_children; Vector3 scaling = tponode.GetScaling(out inv_scale_on_children); gvCommands.Rows.Add(new string[] { "Scale", scaling.X.ToString(), scaling.Y.ToString(), scaling.Z.ToString() }); cbInverseScaleOnChildren.Checked = inv_scale_on_children; Vector3 angle = tponode.GetAngle(); gvCommands.Rows.Add(new string[] { "Rotate", angle.X.ToString(), angle.Y.ToString(), angle.Z.ToString() }); Vector3 translation = tponode.GetTranslation(); gvCommands.Rows.Add(new string[] { "Move", translation.X.ToString(), translation.Y.ToString(), translation.Z.ToString() }); }
private void gvCommands_CellEndEdit(object sender, DataGridViewCellEventArgs e) { int tpofile_row = tpoFileBindingSource.Position; TPOFile tpo = TPOList[tpofile_row]; int tponode_row = tpoNodeBindingSource.Position; TPONode tponode = tpo.nodes[tponode_row]; UpdateTpoNodeFactor(e.RowIndex, tponode); tpoCommandBindingSource.ResetBindings(false); Transform(); }
private void cbInverseScaleOnChildren_CheckedChanged(object sender, EventArgs e) { int tpofile_row = tpoFileBindingSource.Position; TPOFile tpo = TPOList[tpofile_row]; int tponode_row = tpoNodeBindingSource.Position; TPONode tponode = tpo.nodes[tponode_row]; bool inv_scale_on_children; tponode.SetScaling(tponode.GetScaling(out inv_scale_on_children), cbInverseScaleOnChildren.Checked); tpoCommandBindingSource.ResetBindings(false); Transform(); }
private void gvCommands_MouseWheel(object sender, MouseEventArgs e) { DataGridView.HitTestInfo hit = gvCommands.HitTest(e.X, e.Y); if (hit.Type == DataGridViewHitTestType.Cell) { IncrementGridViewCell(hit.RowIndex, hit.ColumnIndex, e.Delta); int tpofile_row = tpoFileBindingSource.Position; TPOFile tpo = TPOList[tpofile_row]; int tponode_row = tpoNodeBindingSource.Position; TPONode tponode = tpo.nodes[tponode_row]; UpdateTpoNodeFactor(hit.RowIndex, tponode); tpoCommandBindingSource.ResetBindings(false); Transform(); } }
private void UpdateTpoNodeFactor(int row, TPONode tponode) { DataGridViewRow gvrow = gvCommands.Rows[row]; switch (row) { case 0: tponode.SetScaling(GetVector3FromGridViewRow(gvrow), cbInverseScaleOnChildren.Checked); break; case 1: tponode.SetAngle(GetVector3FromGridViewRow(gvrow)); break; case 2: tponode.SetTranslation(GetVector3FromGridViewRow(gvrow)); break; } }