private void EntitySetsListBox_ItemCheck(object sender, ItemCheckEventArgs e) { if (CurrentArchetype is MloArchetype MloArchetype) { var inst = ProjectForm.TryGetMloInstance(MloArchetype); if (inst != null) { MloInstanceEntitySet mloInstanceEntitySet = inst.EntitySets[MloArchetype.entitySets[e.Index]._Data.name]; mloInstanceEntitySet.Visible = e.NewValue == CheckState.Checked; return; } } e.NewValue = CheckState.Unchecked; }
private void UpdateControls() { if (CurrentArchetype != null) { ArchetypeDeleteButton.Enabled = ProjectForm.YtypExistsInProject(CurrentArchetype.Ytyp); ArchetypeNameTextBox.Text = CurrentArchetype.Name; AssetNameTextBox.Text = CurrentArchetype.AssetName; LodDistNumericUpDown.Value = (decimal)CurrentArchetype._BaseArchetypeDef.lodDist; HDTextureDistNumericUpDown.Value = (decimal)CurrentArchetype._BaseArchetypeDef.hdTextureDist; SpecialAttributeNumericUpDown.Value = CurrentArchetype._BaseArchetypeDef.specialAttribute; ArchetypeFlagsTextBox.Text = CurrentArchetype._BaseArchetypeDef.flags.ToString(); TextureDictTextBox.Text = CurrentArchetype._BaseArchetypeDef.textureDictionary.ToCleanString(); ClipDictionaryTextBox.Text = CurrentArchetype._BaseArchetypeDef.clipDictionary.ToCleanString(); PhysicsDictionaryTextBox.Text = CurrentArchetype._BaseArchetypeDef.physicsDictionary.ToCleanString(); AssetTypeComboBox.Text = CurrentArchetype._BaseArchetypeDef.assetType.ToString(); BBMinTextBox.Text = FloatUtil.GetVector3String(CurrentArchetype._BaseArchetypeDef.bbMin); BBMaxTextBox.Text = FloatUtil.GetVector3String(CurrentArchetype._BaseArchetypeDef.bbMax); BSCenterTextBox.Text = FloatUtil.GetVector3String(CurrentArchetype._BaseArchetypeDef.bsCentre); BSRadiusTextBox.Text = CurrentArchetype._BaseArchetypeDef.bsRadius.ToString(CultureInfo.InvariantCulture); EntitySetsListBox.Items.Clear(); if (CurrentArchetype is MloArchetype MloArchetype) { if (!TabControl.TabPages.Contains(MloArchetypeTabPage)) { TabControl.TabPages.Add(MloArchetypeTabPage); } MloInstanceData mloinstance = ProjectForm.TryGetMloInstance(MloArchetype); if (mloinstance != null) { EntitySetsListBox.Enabled = true; foreach (var sets in mloinstance.EntitySets) { MloInstanceEntitySet set = sets.Value; EntitySetsListBox.Items.Add(set.EntitySet.ToString(), set.Visible); } } else { EntitySetsListBox.Enabled = false; } } else { TabControl.TabPages.Remove(MloArchetypeTabPage); } } }
private void MiloEntitySetsListBox_ItemCheck(object sender, ItemCheckEventArgs e) { if (populatingui) { return; } var inst = CurrentEntity?.MloInstance; var mloarch = CurrentEntity?.Archetype as MloArchetype; if ((inst != null) && (mloarch != null)) { MloInstanceEntitySet mloInstanceEntitySet = inst.EntitySets[mloarch.entitySets[e.Index]._Data.name]; mloInstanceEntitySet.Visible = e.NewValue == CheckState.Checked; return; } e.NewValue = CheckState.Unchecked; }
private void LoadEntity() { if (CurrentEntity == null) { //EntityPanel.Enabled = false; EntityAddToProjectButton.Enabled = false; EntityDeleteButton.Enabled = false; EntityArchetypeTextBox.Text = string.Empty; EntityArchetypeHashLabel.Text = "Hash: 0"; EntityFlagsTextBox.Text = string.Empty; EntityGuidTextBox.Text = string.Empty; EntityPositionTextBox.Text = string.Empty; EntityRotationTextBox.Text = string.Empty; EntityScaleXYTextBox.Text = string.Empty; EntityScaleZTextBox.Text = string.Empty; EntityParentIndexTextBox.Text = string.Empty; EntityLodDistTextBox.Text = string.Empty; EntityChildLodDistTextBox.Text = string.Empty; EntityLodLevelComboBox.SelectedIndex = 0; // Math.Max(EntityLodLevelComboBox.FindString(), 0); EntityNumChildrenTextBox.Text = string.Empty; EntityPriorityLevelComboBox.SelectedIndex = 0; //Math.Max(.. EntityAOMultiplierTextBox.Text = string.Empty; EntityArtificialAOTextBox.Text = string.Empty; EntityTintValueTextBox.Text = string.Empty; EntityPivotEditCheckBox.Checked = false; EntityPivotPositionTextBox.Text = string.Empty; EntityPivotRotationTextBox.Text = string.Empty; foreach (int i in EntityFlagsCheckedListBox.CheckedIndices) { EntityFlagsCheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } } else { populatingui = true; var e = CurrentEntity._CEntityDef; var po = CurrentEntity.PivotOrientation; //EntityPanel.Enabled = true; EntityAddToProjectButton.Enabled = CurrentEntity.Ymap != null ? !ProjectForm.YmapExistsInProject(CurrentEntity.Ymap) : !ProjectForm.YtypExistsInProject(CurrentEntity.MloParent?.Archetype?.Ytyp); EntityDeleteButton.Enabled = !EntityAddToProjectButton.Enabled; EntityArchetypeTextBox.Text = e.archetypeName.ToString(); EntityArchetypeHashLabel.Text = "Hash: " + e.archetypeName.Hash.ToString(); EntityFlagsTextBox.Text = e.flags.ToString(); EntityGuidTextBox.Text = e.guid.ToString(); EntityPositionTextBox.Text = FloatUtil.GetVector3String(e.position); EntityRotationTextBox.Text = FloatUtil.GetVector4String(e.rotation); EntityScaleXYTextBox.Text = FloatUtil.ToString(e.scaleXY); EntityScaleZTextBox.Text = FloatUtil.ToString(e.scaleZ); EntityParentIndexTextBox.Text = e.parentIndex.ToString(); EntityLodDistTextBox.Text = FloatUtil.ToString(e.lodDist); EntityChildLodDistTextBox.Text = FloatUtil.ToString(e.childLodDist); EntityLodLevelComboBox.SelectedIndex = Math.Max(EntityLodLevelComboBox.FindString(e.lodLevel.ToString()), 0); EntityNumChildrenTextBox.Text = e.numChildren.ToString(); EntityPriorityLevelComboBox.SelectedIndex = Math.Max(EntityPriorityLevelComboBox.FindString(e.priorityLevel.ToString()), 0); EntityAOMultiplierTextBox.Text = e.ambientOcclusionMultiplier.ToString(); EntityArtificialAOTextBox.Text = e.artificialAmbientOcclusion.ToString(); EntityTintValueTextBox.Text = e.tintValue.ToString(); EntityPivotPositionTextBox.Text = FloatUtil.GetVector3String(CurrentEntity.PivotPosition); EntityPivotRotationTextBox.Text = FloatUtil.GetVector4String(new Vector4(po.X, po.Y, po.Z, po.W)); for (int i = 0; i < EntityFlagsCheckedListBox.Items.Count; i++) { var cv = ((e.flags & (1u << i)) > 0); EntityFlagsCheckedListBox.SetItemCheckState(i, cv ? CheckState.Checked : CheckState.Unchecked); } MiloEntitySetsListBox.Items.Clear(); if (CurrentEntity.MloInstance != null) { var milo = CurrentEntity.MloInstance._Instance; MiloGroupIDTextBox.Text = milo.groupId.ToString(); MiloFloorIDTextBox.Text = milo.floorId.ToString(); MiloNumExitPortalsTextBox.Text = milo.numExitPortals.ToString(); MiloFlagsTextBox.Text = milo.MLOInstflags.ToString(); foreach (var sets in CurrentEntity.MloInstance.EntitySets) { MloInstanceEntitySet set = sets.Value; MiloEntitySetsListBox.Items.Add(set.EntitySet.ToString(), set.Visible); } } else { MiloGroupIDTextBox.Text = string.Empty; MiloFloorIDTextBox.Text = string.Empty; MiloNumExitPortalsTextBox.Text = string.Empty; MiloFlagsTextBox.Text = string.Empty; } populatingui = false; UpdateTabVisibility(); ProjectForm.WorldForm?.SelectEntity(CurrentEntity); //hopefully the drawable is already loaded - this will try get from cache ////struct CEntityDef: //MetaHash archetypeName { get; set; } //8 8: Hash: 0: archetypeName //uint flags { get; set; } //12 12: UnsignedInt: 0: flags //uint guid { get; set; } //16 16: UnsignedInt: 0: guid //Vector3 position { get; set; } //32 32: Float_XYZ: 0: position //Vector4 rotation { get; set; } //48 48: Float_XYZW: 0: rotation //float scaleXY { get; set; } //64 64: Float: 0: 2627937847 //float scaleZ { get; set; } //68 68: Float: 0: 284916802 //int parentIndex { get; set; } //72 72: SignedInt: 0: parentIndex //float lodDist { get; set; } //76 76: Float: 0: lodDist //float childLodDist { get; set; } //80 80: Float: 0: childLodDist//3398912973 //Unk_1264241711 lodLevel { get; set; } //84 84: IntEnum: 1264241711: lodLevel //LODTYPES_DEPTH_ //uint numChildren { get; set; } //88 88: UnsignedInt: 0: numChildren//2793909385 //Unk_648413703 priorityLevel { get; set; } //92 92: IntEnum: 648413703: priorityLevel//647098393 //Array_StructurePointer extensions { get; set; } //96 96: Array: 0: extensions {0: StructurePointer: 0: 256} //int ambientOcclusionMultiplier { get; set; } //112 112: SignedInt: 0: ambientOcclusionMultiplier//415356295 //int artificialAmbientOcclusion { get; set; } //116 116: SignedInt: 0: artificialAmbientOcclusion//599844163 //uint tintValue { get; set; } //120 120: UnsignedInt: 0: tintValue//1015358759 } }