public void SetPortal(MCMloPortalDef portal)
        {
            CurrentPortal = portal;
            Tag           = portal;
            UpdateFormTitle();
            MloInstanceData instance = ProjectForm.TryGetMloInstance(portal?.OwnerMlo);

            //ProjectForm.WorldForm?.SelectMloPortal(portal, instance);
            UpdateControls();
        }
        public void SetRoom(MCMloRoomDef room)
        {
            CurrentRoom = room;
            Tag         = room;
            UpdateFormTitle();
            MloInstanceData instance = ProjectForm.TryGetMloInstance(room?.Archetype);

            ProjectForm.WorldForm?.SelectMloRoom(room, instance);
            UpdateControls();
        }
        public void SetEntity(YmapEntityDef entity)
        {
            CurrentEntity = entity;
            MloInstanceData instance = entity?.MloParent?.MloInstance;

            CurrentMCEntity = instance?.TryGetArchetypeEntity(entity);
            Tag             = entity;
            LoadEntity();
            UpdateFormTitle();
        }
        public void SetEntitySet(MCMloEntitySet entset)
        {
            CurrentEntitySet = entset;
            Tag = entset;
            UpdateFormTitle();
            MloInstanceData instance = ProjectForm.TryGetMloInstance(entset?.OwnerMlo);

            //ProjectForm.WorldForm?.SelectMloEntitySet(entset, instance);
            UpdateControls();
        }
        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);
                }
            }
        }