Exemple #1
0
        private void OnUnselectGroup(MyGuiControlButton sender)
        {
            var group = GetFocusedGroup();

            if (group != null && group.GetCount() > 0)
            {
                var container = group.GetContainer();
                if (MyEditor.Static.IsEditingPrefabContainer() && MyEditor.Static.GetEditedPrefabContainer() == container)
                {
                    MyEditorGizmo.RemoveEntitiesFromSelection(group.GetEntities());
                }
            }
        }
Exemple #2
0
        public void OnOkClick(MyGuiControlButton sender)
        {
            // set hidden/selectable flags
            for (int i = 0; i < TYPE_COUNT; i++)
            {
                MyEntities.SetTypeHidden(types[i], !m_checkboxVisible[i].Checked);
                MyEntities.SetTypeSelectable(types[i], m_checkboxSelectable[i].Checked);
            }

            MyEntities.SafeAreasHidden       = !m_checkboxSafeAreasVisible.Checked;
            MyEntities.DetectorsHidden       = !m_checkboxDetectorsVisible.Checked;
            MyEntities.ParticleEffectsHidden = !m_checkboxParticleEffectsVisible.Checked;

            MyEntities.SafeAreasSelectable       = m_checkboxSafeAreasSelectable.Checked;
            MyEntities.DetectorsSelectable       = m_checkboxDetectorsSelectable.Checked;
            MyEntities.ParticleEffectsSelectable = m_checkboxParticleEffectsSelectable.Checked;

            MyEditor.Static.ShowSnapPoints          = m_checkboxSnapPointsVisible.Checked;
            MyEditor.Static.ShowGeneratorsRange     = m_checkboxGeneratorsRangeVisible.Checked;
            MyEditor.Static.ShowLargeWeaponsRange   = m_checkboxLargeWeaponsRangeVisible.Checked;
            MyEditor.Static.ShowDeactivatedEntities = m_checkboxDisplayDeactivatedEntities.Checked;

            // if a selected object became unselectable, remove it from selection
            var toRemove = new List <MyEntity>();

            foreach (var selected in MyEditorGizmo.SelectedEntities)
            {
                for (int i = 0; i < TYPE_COUNT; i++)
                {
                    if (!MyEntities.IsTypeSelectable(types[i]) && types[i].IsInstanceOfType(selected))
                    {
                        toRemove.Add(selected);
                    }
                }
                var dummy = selected as MyDummyPoint;
                if (dummy != null)
                {
                    switch (dummy.DummyFlags)
                    {
                    case MyDummyPointFlags.SAFE_AREA: if (!MyEntities.SafeAreasSelectable)
                        {
                            toRemove.Add(selected);
                        }
                        break;

                    case MyDummyPointFlags.DETECTOR: if (!MyEntities.DetectorsSelectable)
                        {
                            toRemove.Add(selected);
                        }
                        break;

                    case MyDummyPointFlags.PARTICLE: if (!MyEntities.ParticleEffectsSelectable)
                        {
                            toRemove.Add(selected);
                        }
                        break;

                    default: break;
                    }
                }
            }

            MyEditorGizmo.RemoveEntitiesFromSelection(toRemove);

            MyEditor.Static.RefreshSelectionSettings();

            // waypoints ignore depth?
            MyWayPointGraph.WaypointsIgnoreDepth = m_checkboxWaypointIgnoreDepth.Checked;

            SaveSettings();

            CloseScreen();
        }