public DecorPaintObjectPlacementBrushDatabaseView(DecorPaintObjectPlacementBrushDatabase database) { _database = database; SurroundWithBox = true; ToggleVisibilityBeforeRender = true; VisibilityToggleLabel = "Decor Paint Brushes"; }
public bool IsVisible() { if (DecorPaintObjectPlacementSettings.Get().DecorPaintMode != DecorPaintMode.Brush || DecorPaintObjectPlacementBrushDatabase.Get().ActiveBrush == null) { return(false); } return(true); }
private void AdjustCircleRadiusIfNecessary() { float desiredCircleRadius = DecorPaintObjectPlacementBrushDatabase.Get().ActiveBrush.Radius; if (_circleShape.MaxModelSpaceRadius != desiredCircleRadius) { _circleShape.ModelSpaceRadii = new Vector2(desiredCircleRadius, desiredCircleRadius); } }
private void RenderControlsForDecorPaintPlacementMode() { if (DecorPaintObjectPlacementSettings.Get().DecorPaintMode == DecorPaintMode.Brush) { DecorPaintObjectPlacementBrushDatabase.Get().View.Render(); EditorGUILayout.Separator(); } DecorPaintObjectPlacement.Get().DecorPaintMask.View.Render(); }
private void RenderNameChangeField() { string newString = EditorGUILayout.TextField(GetContentForNameChangeField(), _brush.Name); if (newString != _brush.Name) { UndoEx.RecordForToolAction(_brush); DecorPaintObjectPlacementBrushDatabase.Get().RenameBrush(_brush, newString); } }
private void AdjustBrushShapeSizeForMouseWheelScroll(Event e) { DecorPaintObjectPlacementBrush activeBrush = DecorPaintObjectPlacementBrushDatabase.Get().ActiveBrush; if (activeBrush != null) { BrushDecorPaintModeObjectPlacementSettings brushDecorPaintSettings = ObjectPlacementSettings.Get().DecorPaintObjectPlacementSettings.BrushDecorPaintModeSettings; int sizeAdjustAmount = (int)(-e.delta.y * brushDecorPaintSettings.ScrollWheelCircleRadiusAdjustmentSpeed); UndoEx.RecordForToolAction(activeBrush); activeBrush.Radius += sizeAdjustAmount; Octave3DWorldBuilder.ActiveInstance.Inspector.EditorWindow.Repaint(); SceneView.RepaintAll(); } }
public void RemoveNullPrefabReferences() { if (PrefabPreviewTextureCache.Get() == null) { return; } if (PrefabCategoryDatabase.Get() == null) { return; } if (DecorPaintObjectPlacementBrushDatabase.Get() == null) { return; } if (ObjectPlacement.Get() == null) { return; } PrefabPreviewTextureCache.Get().DestroyTexturesForNullPrefabEntries(); PrefabCategoryDatabase.Get().RemoveNullPrefabEntriesInAllCategories(); DecorPaintObjectPlacementBrushDatabase.Get().RemoveNullPrefabsFromAllBrushElements(); ObjectPlacement.Get().PathObjectPlacement.PathSettings.TileConnectionSettings.RemoveNullPrefabReferences(); }
protected override void OnStrokeStarted(Event e) { _objectsPlacedWhileDragging.Clear(); _objectPlacementDataCalculator.BeginSession(_brushCircle, DecorPaintObjectPlacementBrushDatabase.Get().ActiveBrush); PlaceObjects(); }
private void RenderPrefabPreviewRows() { for (int prefabIndex = 0; prefabIndex < _filteredPrefabs.Count; ++prefabIndex) { // Start a new row? if (prefabIndex % ViewData.NumberOfPrefabsPerRow == 0) { if (prefabIndex != 0) { EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); } // Render the prefab entry Prefab prefab = _filteredPrefabs[prefabIndex]; var previewButtonRenderData = new PrefabPreviewButtonRenderData(); previewButtonRenderData.ExtractFromPrefab(prefab, ViewData.PrefabPreviewScale); EditorGUILayout.BeginVertical(GUILayout.Width(previewButtonRenderData.ButtonWidth)); // Render the prefab preview button EditorGUIColor.Push(prefab == _prefabCategory.ActivePrefab ? ViewData.ActivePrefabTint : Color.white); if (EditorGUILayoutEx.PrefabPreview(prefab, true, previewButtonRenderData)) { ObjectPlacementSettings placementSettings = ObjectPlacementSettings.Get(); if (placementSettings.ObjectPlacementMode == ObjectPlacementMode.DecorPaint && placementSettings.DecorPaintObjectPlacementSettings.DecorPaintMode == DecorPaintMode.Brush && DecorPaintObjectPlacementBrushDatabase.Get().ActiveBrush != null && Event.current.button == (int)MouseButton.Right) { UndoEx.RecordForToolAction(DecorPaintObjectPlacementBrushDatabase.Get().ActiveBrush); DecorPaintObjectPlacementBrushElement brushElement = DecorPaintObjectPlacementBrushDatabase.Get().ActiveBrush.CreateNewElement(); brushElement.Prefab = prefab; Octave3DWorldBuilder.ActiveInstance.RepaintAllEditorWindows(); Octave3DWorldBuilder.ActiveInstance.Inspector.Repaint(); } else if (Octave3DWorldBuilder.ActiveInstance.Inspector.ActiveInspectorGUIIdentifier == InspectorGUIIdentifier.ObjectSelection && AllShortcutCombos.Instance.ReplacePrefabsForSelectedObjects.IsActive()) { ObjectSelection.Get().ReplaceSelectedObjectsWithPrefab(prefab); } else { UndoEx.RecordForToolAction(_prefabCategory); _prefabCategory.SetActivePrefab(prefab); } } EditorGUIColor.Pop(); // Render the prefab name labels if necessary if (ViewData.ShowPrefabNames) { Rect previewRectangle = GUILayoutUtility.GetLastRect(); EditorGUILayoutEx.LabelInMiddleOfControlRect(previewRectangle, prefab.Name, previewButtonRenderData.ButtonHeight, GetStyleForPrefabNameLabel()); } // Render the remove prefab button if (GUILayout.Button(GetRemovePrefabButtonContent())) { UndoEx.RecordForToolAction(_prefabCategory); _prefabCategory.RemoveAndDestroyPrefab(prefab); Octave3DWorldBuilder.ActiveInstance.Inspector.Repaint(); } EditorGUILayout.EndVertical(); } // End the last row (if any) if (_filteredPrefabs.Count != 0) { EditorGUILayout.EndHorizontal(); } }