private void loadFromStream(Stream input) { BinaryReader reader = new BinaryReader(input); this.version = reader.ReadUInt32(); this.keytable.offset = reader.ReadUInt32(); this.keytable.size = reader.ReadUInt32(); byte nameLength = reader.ReadByte(); this.partName = MadScience.StreamHelpers.ReadStringUTF16(input, false, (uint)nameLength); this.blendType = reader.ReadUInt32(); this.blendTgi = new MadScience.Wrappers.ResourceKey(input, (int)MadScience.Wrappers.ResourceKeyOrder.TGI); uint geomCount = reader.ReadUInt32(); for (int i = 0; i < geomCount; i++) { FacialBlendGeomBoneEntry geomBoneEntry = new FacialBlendGeomBoneEntry(input); this.geomBoneEntries.Add(geomBoneEntry); geomBoneEntry = null; } this.keytable.Load(input); reader = null; }
private void btnGeomBoneCommit_Click(object sender, EventArgs e) { // Figure out the current maximum int curMax = faceblend.geomBoneEntries.Count; int toAdd = (cmbChooseGeomEntry.SelectedIndex + 1) - curMax; for (int i = 0; i < toAdd; i++) { MadScience.Wrappers.FacialBlendGeomBoneEntry gbEntryT = new MadScience.Wrappers.FacialBlendGeomBoneEntry(); faceblend.geomBoneEntries.Add(gbEntryT); gbEntryT = null; } // Commit MadScience.Wrappers.FacialBlendGeomBoneEntry gbEntry = faceblend.geomBoneEntries[cmbChooseGeomEntry.SelectedIndex]; gbEntry.amount = Convert.ToUInt32(txtAmount.Text); gbEntry.amount2 = Convert.ToUInt32(txtAmount2.Text); //gbEntry.boneIndex = Convert.ToUInt32(txtBoneIndex.Text); gbEntry.boneIndex = Convert.ToUInt32(cmbTGIlist.SelectedIndex); gbEntry.geomEntryIndex = Convert.ToUInt32(txtGeomIndex.Text); gbEntry.hasBoneEntry = Convert.ToUInt32(chkHasBone.Checked); gbEntry.hasGeomAndBone = Convert.ToUInt32(chkHasGeomAndBone.Checked); gbEntry.hasGeomEntry = Convert.ToUInt32(chkHasGeom.Checked); switch (cmbRegionType.SelectedIndex) { case 0: gbEntry.regionFlag = (uint)FacialRegions.Body; break; case 1: gbEntry.regionFlag = (uint)FacialRegions.Brow; break; case 2: gbEntry.regionFlag = (uint)FacialRegions.Ears; break; case 3: gbEntry.regionFlag = (uint)FacialRegions.Eyelashes; break; case 4: gbEntry.regionFlag = (uint)FacialRegions.Eyes; break; case 5: gbEntry.regionFlag = (uint)FacialRegions.Face; break; case 6: gbEntry.regionFlag = (uint)FacialRegions.Head; break; case 7: gbEntry.regionFlag = (uint)FacialRegions.Jaw; break; case 8: gbEntry.regionFlag = (uint)FacialRegions.Mouth; break; case 9: gbEntry.regionFlag = (uint)FacialRegions.Nose; break; case 10: gbEntry.regionFlag = (uint)FacialRegions.TranslateEyes; break; case 11: gbEntry.regionFlag = (uint)FacialRegions.TranslateMouth; break; } uint ageGenderFlag = 0; if (checkedListAge.GetItemChecked(0)) { ageGenderFlag += 0x2; } if (checkedListAge.GetItemChecked(1)) { ageGenderFlag += 0x4; } if (checkedListAge.GetItemChecked(2)) { ageGenderFlag += 0x8; } if (checkedListAge.GetItemChecked(3)) { ageGenderFlag += 0x10; } if (checkedListAge.GetItemChecked(4)) { ageGenderFlag += 0x20; } if (checkedListAge.GetItemChecked(5)) { ageGenderFlag += 0x40; } if (checkedListGender.GetItemChecked(0)) { ageGenderFlag += 0x1000; } if (checkedListGender.GetItemChecked(1)) { ageGenderFlag += 0x2000; } ageGenderFlag += 0x10000; uint ageGenderFlag2 = 0; if (checkedListAge2.GetItemChecked(0)) { ageGenderFlag2 += 0x2; } if (checkedListAge2.GetItemChecked(1)) { ageGenderFlag2 += 0x4; } if (checkedListAge2.GetItemChecked(2)) { ageGenderFlag2 += 0x8; } if (checkedListAge2.GetItemChecked(3)) { ageGenderFlag2 += 0x10; } if (checkedListAge2.GetItemChecked(4)) { ageGenderFlag2 += 0x20; } if (checkedListAge2.GetItemChecked(5)) { ageGenderFlag2 += 0x40; } if (checkedListGender2.GetItemChecked(0)) { ageGenderFlag2 += 0x1000; } if (checkedListGender2.GetItemChecked(1)) { ageGenderFlag2 += 0x2000; } ageGenderFlag2 += 0x10000; gbEntry.ageGenderFlags = ageGenderFlag; gbEntry.ageGenderFlags2 = ageGenderFlag2; }
private void showGbEntry(int index) { if (index == -1) { return; } MadScience.Wrappers.FacialBlendGeomBoneEntry gbEntry = faceblend.geomBoneEntries[index]; if (gbEntry.hasGeomAndBone == 1) { chkHasGeomAndBone.Checked = true; } else { chkHasGeomAndBone.Checked = false; } if (gbEntry.hasBoneEntry == 1) { chkHasBone.Checked = true; } else { chkHasBone.Checked = false; } if (gbEntry.hasGeomEntry == 1) { chkHasGeom.Checked = true; } else { chkHasGeom.Checked = false; } MadScienceSmall.Helpers.resetControl(checkedListAge); MadScienceSmall.Helpers.resetControl(checkedListAge2); MadScienceSmall.Helpers.resetControl(checkedListGender); MadScienceSmall.Helpers.resetControl(checkedListGender2); txtAmount.Text = gbEntry.amount.ToString(); txtAmount2.Text = gbEntry.amount2.ToString(); txtGeomIndex.Text = gbEntry.geomEntryIndex.ToString(); txtBoneIndex.Text = gbEntry.boneIndex.ToString(); cmbTGIlist.Items.Clear(); for (int i = 0; i < faceblend.keytable.keys.Count; i++) { cmbTGIlist.Items.Add(faceblend.keytable.keys[i].ToString()); } if (gbEntry.geomEntryIndex > 0) { if (gbEntry.geomEntryIndex < cmbTGIlist.Items.Count) { cmbTGIlist.SelectedIndex = (int)gbEntry.geomEntryIndex; } } else { if (gbEntry.boneIndex < cmbTGIlist.Items.Count) { cmbTGIlist.SelectedIndex = (int)gbEntry.boneIndex; } } //txtTGILink.Text = faceblend.tgiList[(int)gbEntry.geomEntryIndex].ToString(); if ((gbEntry.ageGenderFlags & 0x2) == 0x2) { checkedListAge.SetItemChecked(0, true); // Toddler } if ((gbEntry.ageGenderFlags & 0x4) == 0x4) { checkedListAge.SetItemChecked(1, true); // Child } if ((gbEntry.ageGenderFlags & 0x8) == 0x8) { checkedListAge.SetItemChecked(2, true); // Teen } if ((gbEntry.ageGenderFlags & 0x10) == 0x10) { checkedListAge.SetItemChecked(3, true); // YoungAdult } if ((gbEntry.ageGenderFlags & 0x20) == 0x20) { checkedListAge.SetItemChecked(4, true); // Adult } if ((gbEntry.ageGenderFlags & 0x40) == 0x40) { checkedListAge.SetItemChecked(5, true); // Elder } if ((gbEntry.ageGenderFlags & 0x1000) == 0x1000) { checkedListGender.SetItemChecked(0, true); // Male } if ((gbEntry.ageGenderFlags & 0x2000) == 0x2000) { checkedListGender.SetItemChecked(1, true); // Female } if ((gbEntry.ageGenderFlags2 & 0x2) == 0x2) { checkedListAge2.SetItemChecked(0, true); // Toddler } if ((gbEntry.ageGenderFlags2 & 0x4) == 0x4) { checkedListAge2.SetItemChecked(1, true); // Child } if ((gbEntry.ageGenderFlags2 & 0x8) == 0x8) { checkedListAge2.SetItemChecked(2, true); // Teen } if ((gbEntry.ageGenderFlags2 & 0x10) == 0x10) { checkedListAge2.SetItemChecked(3, true); // YoungAdult } if ((gbEntry.ageGenderFlags2 & 0x20) == 0x20) { checkedListAge2.SetItemChecked(4, true); // Adult } if ((gbEntry.ageGenderFlags2 & 0x40) == 0x40) { checkedListAge2.SetItemChecked(5, true); // Elder } if ((gbEntry.ageGenderFlags2 & 0x1000) == 0x1000) { checkedListGender2.SetItemChecked(0, true); // Male } if ((gbEntry.ageGenderFlags2 & 0x2000) == 0x2000) { checkedListGender2.SetItemChecked(1, true); // Female } //txtNewTGI.Text = gbEntry.regionFlag.ToString(); switch (gbEntry.regionFlag) { case 0x400: cmbRegionType.SelectedIndex = 0; break; case 0x100: cmbRegionType.SelectedIndex = 1; break; case 0x10: cmbRegionType.SelectedIndex = 2; break; case 0x800: cmbRegionType.SelectedIndex = 3; break; case 0x1: cmbRegionType.SelectedIndex = 4; break; case 0x40: cmbRegionType.SelectedIndex = 5; break; case 0x80: cmbRegionType.SelectedIndex = 6; break; case 0x200: cmbRegionType.SelectedIndex = 7; break; case 0x4: cmbRegionType.SelectedIndex = 8; break; case 0x2: cmbRegionType.SelectedIndex = 9; break; case 0x20: cmbRegionType.SelectedIndex = 10; break; case 0x8: cmbRegionType.SelectedIndex = 11; break; } }
private void btnGeomBoneCommit_Click(object sender, EventArgs e) { // Figure out the current maximum int curMax = faceblend.geomBoneEntries.Count; int toAdd = (cmbChooseGeomEntry.SelectedIndex + 1) - curMax; for (int i = 0; i < toAdd; i++) { MadScience.Wrappers.FacialBlendGeomBoneEntry gbEntryT = new MadScience.Wrappers.FacialBlendGeomBoneEntry(); faceblend.geomBoneEntries.Add(gbEntryT); gbEntryT = null; } // Commit MadScience.Wrappers.FacialBlendGeomBoneEntry gbEntry = faceblend.geomBoneEntries[cmbChooseGeomEntry.SelectedIndex]; gbEntry.amount = Convert.ToUInt32(txtAmount.Text); gbEntry.amount2 = Convert.ToUInt32(txtAmount2.Text); //gbEntry.boneIndex = Convert.ToUInt32(txtBoneIndex.Text); gbEntry.boneIndex = Convert.ToUInt32(cmbTGIlist.SelectedIndex); gbEntry.geomEntryIndex = Convert.ToUInt32(txtGeomIndex.Text); gbEntry.hasBoneEntry = Convert.ToUInt32(chkHasBone.Checked); gbEntry.hasGeomAndBone = Convert.ToUInt32(chkHasGeomAndBone.Checked); gbEntry.hasGeomEntry = Convert.ToUInt32(chkHasGeom.Checked); switch (cmbRegionType.SelectedIndex) { case 0: gbEntry.regionFlag = (uint)FacialRegions.Body; break; case 1: gbEntry.regionFlag = (uint)FacialRegions.Brow; break; case 2: gbEntry.regionFlag = (uint)FacialRegions.Ears; break; case 3: gbEntry.regionFlag = (uint)FacialRegions.Eyelashes; break; case 4: gbEntry.regionFlag = (uint)FacialRegions.Eyes; break; case 5: gbEntry.regionFlag = (uint)FacialRegions.Face; break; case 6: gbEntry.regionFlag = (uint)FacialRegions.Head; break; case 7: gbEntry.regionFlag = (uint)FacialRegions.Jaw; break; case 8: gbEntry.regionFlag = (uint)FacialRegions.Mouth; break; case 9: gbEntry.regionFlag = (uint)FacialRegions.Nose; break; case 10: gbEntry.regionFlag = (uint)FacialRegions.TranslateEyes; break; case 11: gbEntry.regionFlag = (uint)FacialRegions.TranslateMouth; break; } uint ageGenderFlag = 0; if (checkedListAge.GetItemChecked(0)) ageGenderFlag += 0x2; if (checkedListAge.GetItemChecked(1)) ageGenderFlag += 0x4; if (checkedListAge.GetItemChecked(2)) ageGenderFlag += 0x8; if (checkedListAge.GetItemChecked(3)) ageGenderFlag += 0x10; if (checkedListAge.GetItemChecked(4)) ageGenderFlag += 0x20; if (checkedListAge.GetItemChecked(5)) ageGenderFlag += 0x40; if (checkedListGender.GetItemChecked(0)) ageGenderFlag += 0x1000; if (checkedListGender.GetItemChecked(1)) ageGenderFlag += 0x2000; ageGenderFlag += 0x10000; uint ageGenderFlag2 = 0; if (checkedListAge2.GetItemChecked(0)) ageGenderFlag2 += 0x2; if (checkedListAge2.GetItemChecked(1)) ageGenderFlag2 += 0x4; if (checkedListAge2.GetItemChecked(2)) ageGenderFlag2 += 0x8; if (checkedListAge2.GetItemChecked(3)) ageGenderFlag2 += 0x10; if (checkedListAge2.GetItemChecked(4)) ageGenderFlag2 += 0x20; if (checkedListAge2.GetItemChecked(5)) ageGenderFlag2 += 0x40; if (checkedListGender2.GetItemChecked(0)) ageGenderFlag2 += 0x1000; if (checkedListGender2.GetItemChecked(1)) ageGenderFlag2 += 0x2000; ageGenderFlag2 += 0x10000; gbEntry.ageGenderFlags = ageGenderFlag; gbEntry.ageGenderFlags2 = ageGenderFlag2; }
private void button4_Click(object sender, EventArgs e) { int maxEntry = faceblend.geomBoneEntries.Count; FacialBlendGeomBoneEntry gbEntry = new FacialBlendGeomBoneEntry(); faceblend.geomBoneEntries.Add(gbEntry); cmbChooseGeomEntry.Items.Add("Entry #" + (maxEntry + 1).ToString()); cmbChooseGeomEntry.SelectedIndex = maxEntry; }
private FacialBlendGeomBoneEntry makeFBEntry(uint gender, uint boneIndex) { FacialBlendGeomBoneEntry gbEntry = new FacialBlendGeomBoneEntry(); gbEntry.ageGenderFlags = gender + allFlags; gbEntry.ageGenderFlags2 = gbEntry.ageGenderFlags; gbEntry.amount = 1; gbEntry.amount2 = 1; gbEntry.boneIndex = boneIndex; gbEntry.geomEntryIndex = 0; gbEntry.hasGeomAndBone = 1; gbEntry.hasGeomEntry = 0; gbEntry.hasBoneEntry = 1; gbEntry.regionFlag = getRegionFlag(); return gbEntry; }