public virtual void Update() { FilterAddObjectTree(MyEditorGizmo.SelectedSnapPoint); // Get editor state and allowed context action var notDragging = !m_addObjectTreeViewdragDrop.Dragging; var editorState = MyEditor.GetCurrentState(); var contextHelper = MyGuiContextMenuHelpers.GetEditorContextMenuHelper(editorState); // Choose editor state dependent textures var cameraText = editorState == MyEditorStateEnum.ATTACHED ? MyTextsWrapperEnum.ToolbarDetachFromCamera : MyTextsWrapperEnum.ToolbarAttachToCamera; var enterPrefabContainerText = CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EXIT_EDITING_MODE) ? MyTextsWrapperEnum.ToolbarExitEditingMode : MyTextsWrapperEnum.ToolbarEnterPrefabContainer; var enterVoxelHandText = editorState == MyEditorStateEnum.VOXEL_HAND_ENABLED ? MyTextsWrapperEnum.ToolbarExitVoxelHand : MyTextsWrapperEnum.ToolbarEnterVoxelHand; var showSnapPointsText = MyEditor.Static.ShowSnapPoints ? MyTextsWrapperEnum.ToolbarHideSnapPoints : MyTextsWrapperEnum.ToolbarShowSnapPoints; var linkSnapPointsText = MyEditor.Static.CanUnlinkSnapPoints(MyEditorGizmo.SelectedSnapPoint) ? MyTextsWrapperEnum.ToolbarUnlinkSnapPoints : MyTextsWrapperEnum.ToolbarLinkSnapPoints; // Change look of editor state dependent buttons m_attachToCameraButton.SetTextEnum(cameraText); m_enterPrefabContainerButton.SetTextEnum(enterPrefabContainerText); m_enterVoxelHandButton.SetTextEnum(enterVoxelHandText); m_linkSnapPoints.SetTextEnum(linkSnapPointsText); // Enable/Disable buttons (context) m_addObjectButton.Enabled = notDragging && (CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.ADD_OBJECT) || CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EXIT_VOXEL_HAND)); //m_editObjectsButton.Enabled = notDragging && // ((CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EDIT_SELECTED) && MyEditor.Static.CanEditSelected()) || // CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EDIT_VOXEL_HAND)); m_editObjectsButton.Enabled = notDragging && (CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EDIT_SELECTED) && MyEditor.Static.CanEditSelected()); m_resetRotationButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.RESET_ROTATION); m_copySelectedButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.COPY_SELECTED); m_switchGizmoSpaceButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.SWITCH_GIZMO_SPACE); m_switchGizmoModeButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.SWITCH_GIZMO_MODE); m_linkSnapPoints.Enabled = notDragging && MyEditorGizmo.SelectedSnapPoint != null; m_toggleSnapPoints.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.TOGGLE_SNAP_POINTS); m_selectAllObjectsButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.SELECT_ALL_OBJECTS); m_exitSelectedButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EXIT_SELECTED); m_enterPrefabContainerButton.Enabled = notDragging && (CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.ENTER_PREFAB_CONTAINER) || CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EXIT_EDITING_MODE)); m_attachToCameraButton.Enabled = notDragging && (CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.ATTACH_TO_CAMERA) || CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.DETACH_FROM_CAMERA)); m_enterVoxelHandButton.Enabled = notDragging && (CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.ENTER_VOXEL_HAND) || CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EXIT_VOXEL_HAND)); m_clearWholeSectorButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.CLEAR_WHOLE_SECTOR); m_loadSectorButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.LOAD_SECTOR) && !m_isDemoUser; m_saveSectorButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.SAVE_SECTOR) && MySession.CanBeSaved(false, MyGuiScreenGamePlay.Static.GetSectorIdentifier(), true); MyTextsWrapperEnum?isDemoS = null; if (MyClientServer.LoggedPlayer != null && MyClientServer.LoggedPlayer.IsDemoUser()) { isDemoS = MyTextsWrapperEnum.NotAvailableInDemoMode; } m_saveSectorButton.AccessForbiddenReason = isDemoS; m_loadSectorButton.AccessForbiddenReason = isDemoS; //m_adjustGridButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.ADJUST_GRID); //m_sunSettingsButton.Enabled = false; // atm. disable, SUN_SETTINGS + FOG_SETTINGS m_groupsButton.Enabled = notDragging; m_copyToolButton.Enabled = notDragging; m_optionsButton.Enabled = notDragging; m_selectAndHideButton.Enabled = notDragging; m_editPropertiesButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EDIT_PROPERTIES) && MyGuiScreenEditorEditProperties.CanEditProperties(MyEditorGizmo.SelectedEntities); m_correctSnappedPrefabsButton.Enabled = notDragging && CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.CORRECT_SNAPPED_PREFABS); m_selectDeactivatedEntityButton.Enabled = notDragging; m_findEntityButton.Enabled = notDragging; if (!CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.ADD_OBJECT) && m_addObjectTreeView.Visible) { SetAddObjectVisibility(false); } SetEditVoxelHandVisibility(CheckContextAction(contextHelper, MyGuiContextMenuItemActionType.EDIT_VOXEL_HAND)); if (m_editVoxelHand.Visible && MyEditorGizmo.IsAnyEntitySelected()) { if (!MyFakes.MWBUILDER) { if (!(MyEditorVoxelHand.SelectedVoxelMap != null && MyEditorGizmo.SelectedEntities.Count == 1 && MyEditorGizmo.SelectedEntities[0] == MyEditorVoxelHand.SelectedVoxelMap)) { MyEditor.Static.PerformContextMenuAction(MyGuiContextMenuItemActionType.EXIT_SELECTED); if (MyEditorVoxelHand.SelectedVoxelMap != null) { MyEditorGizmo.AddEntityToSelection(MyEditorVoxelHand.SelectedVoxelMap); } } } } }