private void addEntryToolStripMenuItem_Click(object sender, EventArgs e) { SB.SBEntry newEntry = new SB.SBEntry(); swag.bones.Add(newEntry); listBox1.Items.Add(newEntry); Edited = true; }
private void BoneChange(object sender, EventArgs e) { SB.SBEntry sbEntry = (SB.SBEntry)listBox1.SelectedItem; if (sbEntry == null) { return; } sbEntry.hash = boneButton1.boneId; for (int i = 0; i < 8; i++) { sbEntry.boneHashes[i] = buttons[i].boneId; } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { dontChange = true; SB.SBEntry sbEntry = (SB.SBEntry)listBox1.SelectedItem; if (sbEntry == null) { return; } boneButton1.vbn = vbn; boneButton1.SetBone(vbn.GetBone(sbEntry.hash)); for (int i = 0; i < buttons.Length; i++) { buttons[i].vbn = vbn; Bone bone = vbn.GetBone(sbEntry.boneHashes[i]); buttons[i].SetBone(bone); } xMin.Value = (Decimal)sbEntry.rx1; xMax.Value = (Decimal)sbEntry.rx2; yMin.Value = (Decimal)sbEntry.ry1; yMax.Value = (Decimal)sbEntry.ry2; zMin.Value = (Decimal)sbEntry.rz1; zMax.Value = (Decimal)sbEntry.rz2; weightBox.Value = (Decimal)sbEntry.factor; numericUpDown1.Value = (Decimal)sbEntry.param1_1; numericUpDown2.Value = (Decimal)sbEntry.param1_2; numericUpDown3.Value = (Decimal)sbEntry.param1_3; numericUpDown4.Value = (Decimal)sbEntry.param2_1; numericUpDown5.Value = (Decimal)sbEntry.param2_2; numericUpDown6.Value = (Decimal)sbEntry.param2_3; numericUpDown7.Value = (Decimal)sbEntry.unks1[0]; numericUpDown8.Value = (Decimal)sbEntry.unks1[1]; numericUpDown9.Value = (Decimal)sbEntry.unks1[2]; numericUpDown10.Value = (Decimal)sbEntry.unks1[3]; numericUpDown11.Value = (Decimal)sbEntry.unks2[0]; numericUpDown12.Value = (Decimal)sbEntry.unks2[1]; numericUpDown13.Value = (Decimal)sbEntry.unks2[2]; numericUpDown14.Value = (Decimal)sbEntry.unks2[3]; numericUpDown15.Value = (Decimal)sbEntry.unks2[4]; numericUpDown16.Value = (Decimal)sbEntry.ints[0]; numericUpDown17.Value = (Decimal)sbEntry.ints[1]; numericUpDown18.Value = (Decimal)sbEntry.ints[2]; numericUpDown19.Value = (Decimal)sbEntry.ints[3]; dontChange = false; }
private void valueChanged(object sender, EventArgs e) { if (!dontChange) { SB.SBEntry sbEntry = (SB.SBEntry)listBox1.SelectedItem; if (sbEntry == null) { return; } sbEntry.rx1 = (float)xMin.Value; sbEntry.rx2 = (float)xMax.Value; sbEntry.ry1 = (float)yMin.Value; sbEntry.ry2 = (float)yMax.Value; sbEntry.rz1 = (float)zMin.Value; sbEntry.rz2 = (float)zMax.Value; sbEntry.factor = (float)weightBox.Value; sbEntry.param1_1 = (float)numericUpDown1.Value; sbEntry.param1_2 = (int)numericUpDown2.Value; sbEntry.param1_3 = (int)numericUpDown3.Value; sbEntry.param2_1 = (float)numericUpDown4.Value; sbEntry.param2_2 = (int)numericUpDown5.Value; sbEntry.param2_3 = (int)numericUpDown6.Value; sbEntry.unks1[0] = (float)numericUpDown7.Value; sbEntry.unks1[1] = (float)numericUpDown8.Value; sbEntry.unks1[2] = (float)numericUpDown9.Value; sbEntry.unks1[3] = (float)numericUpDown10.Value; sbEntry.unks2[0] = (float)numericUpDown11.Value; sbEntry.unks2[1] = (float)numericUpDown12.Value; sbEntry.unks2[2] = (float)numericUpDown13.Value; sbEntry.unks2[3] = (float)numericUpDown14.Value; sbEntry.unks2[4] = (float)numericUpDown15.Value; sbEntry.ints[0] = (int)numericUpDown16.Value; sbEntry.ints[1] = (int)numericUpDown17.Value; sbEntry.ints[2] = (int)numericUpDown18.Value; sbEntry.ints[3] = (int)numericUpDown19.Value; } }
public static void DrawVBN(VBN vbn) { if (vbn != null && Runtime.renderBones) { foreach (Bone bone in vbn.bones) { // first calcuate the point and draw a point if (bone == BoneTreePanel.selectedBone) { GL.Color3(Color.Red); } else { GL.Color3(Color.GreenYellow); } Vector3 pos_c = Vector3.Transform(Vector3.Zero, bone.transform); RenderTools.drawCube(pos_c, .085f); // if swing bones then draw swing radius if (vbn.swingBones.bones.Count > 0 && Runtime.renderSwag) { SB.SBEntry sb = null; vbn.swingBones.TryGetEntry(bone.boneId, out sb); if (sb != null) { // draw if (bone.ParentBone != null) { int i = bone.parentIndex; float degtorad = (float)(Math.PI / 180); Vector3 pos_sb = Vector3.Transform(Vector3.Zero, Matrix4.CreateTranslation(new Vector3(3, 3, 3)) * Matrix4.CreateScale(bone.sca) * Matrix4.CreateFromQuaternion(VBN.FromEulerAngles(sb.rx1 * degtorad, sb.ry1 * degtorad, sb.rz1 * degtorad)) * Matrix4.CreateTranslation(bone.pos) * vbn.bones[i].transform); Vector3 pos_sb2 = Vector3.Transform(Vector3.Zero, Matrix4.CreateTranslation(new Vector3(3, 3, 3)) * Matrix4.CreateScale(bone.sca) * Matrix4.CreateFromQuaternion(VBN.FromEulerAngles(sb.rx2 * degtorad, sb.ry2 * degtorad, sb.rz2 * degtorad)) * Matrix4.CreateTranslation(bone.pos) * vbn.bones[i].transform); GL.Color3(Color.ForestGreen); GL.Begin(PrimitiveType.LineLoop); GL.Vertex3(pos_c); GL.Vertex3(pos_sb); GL.Vertex3(pos_sb2); GL.End(); } } } // now draw line between parent GL.Color3(Color.LightBlue); GL.LineWidth(2f); GL.Begin(PrimitiveType.Lines); if (bone.ParentBone != null) { Vector3 pos_p = Vector3.Transform(Vector3.Zero, bone.ParentBone.transform); GL.Vertex3(pos_c); GL.Color3(Color.Blue); GL.Vertex3(pos_p); } GL.End(); } } }