Dynamic palletes, brushes, tilesets, and other things - draft#35
Dynamic palletes, brushes, tilesets, and other things - draft#35karolak6612 wants to merge 34 commits into
Conversation
… tool improvements
Migrates all 10 commits from the private repository's 'GPT' branch:
- b73e7e1: specialized brush types and automated material system
- 821d85a: brush selection from map and wall logic
- f764953: brush ID system and enhanced smart selection logic
- b653afc: selection tool toggle with state persistence
- f972da2: disambiguate duplicate-named tilesets in UI and tests
- 0450fb4: xml cleanup
- 6f9a703: brush collection support and tool options panel
- 7fe0bed: item rotation, door switching, and WallDecorationBrush
- 25d68e8: refactor brush system and wall variant cycling
- 15ff221: Ctrl+erase mode, discrete size steps, and wx parity fixes
Highlights:
1. Brushes Architecture:
- Implemented new specialized brush types: GroundBrush, DoodadBrush, WallBrush, TableBrush, CarpetBrush, DoorBrush, OptionalBorderBrush, HouseExitBrush.
- Introduced Brush ID system for reliable reference tracking.
- Added WallDecorationBrush helper class.
- Integrated automated material lookup systems.
2. UI & Preview Engine:
- Added BrushPreviewRenderer and BrushPreviewResolver.
- Implemented dynamic doodad and multi-item brush preview providers.
- Refactored BrushSizePanel and TilesetGridWidget to support discrete size steps and tool options.
- Enhanced PaletteWindow and MapPanelInput with Ctrl+erase mode toggles.
3. Testing and Tools:
- Added a robust 'BrushSmoke' automated smoke test suite to validate brush mechanics.
- Added a lookup tables generator utility script ('generate_lookup_tables.py').
Refactored client data loading to support version-specific directories and added pulse animations to the UI. Removed obsolete sample data files. - `ImguiMapEditor/Brushes/BrushRegistry.h` — added `getBorderTemplateCount()` - `ImguiMapEditor/CMakeLists.txt` — updated copy command to use `../data` instead of `sample_data` - `ImguiMapEditor/Domain/ClientVersion.cpp` — updated `getItemMetadataPath()` to support versioned data directories - `ImguiMapEditor/Domain/ClientVersion.h` — added data directory normalization and auto-detection - `ImguiMapEditor/Services/ClientVersionRegistry.cpp` — added automatic data directory detection during registry loading - `ImguiMapEditor/Services/Map/MapLoadingService.cpp` — updated resource loading to use version-specific paths - `ImguiMapEditor/Services/Map/MapLoadingService.h` — updated `tryLoadCreatures` and `tryLoadItems` signatures - `ImguiMapEditor/UI/Widgets/TilesetGridWidget.cpp` — implemented `renderBrushCard` and added pulse animation for selected items - `ImguiMapEditor/UI/Widgets/TilesetGridWidget.h` — added `renderBrushCard` method declaration - `ImguiMapEditor/sample_data/background.jpg` — [deleted] - `ImguiMapEditor/sample_data/borders/borders.xml` — [deleted] - `ImguiMapEditor/sample_data/brushes/brushes.xml` — [deleted] - `ImguiMapEditor/sample_data/creatures/creatures.xml` — [deleted] - `ImguiMapEditor/sample_data/items/items.xml` — [deleted] - `ImguiMapEditor/sample_data/materials.xml` — [deleted] - `ImguiMapEditor/sample_data/palettes.xml` — [deleted]
Consolidated version-specific data path resolution logic into a central `resolveDataPath` helper and refactored TilesetGridWidget pulse animation logic for improved maintainability. Updated build system to conditionally handle data directory copying to prevent missing directory errors. - `ImguiMapEditor/CMakeLists.txt` — replaced absolute directory copy with a conditional `EXISTS` check for the data directory - `ImguiMapEditor/Domain/ClientVersion.cpp` — delegated path resolution to `resolveDataPath` - `ImguiMapEditor/Domain/ClientVersion.h` — added `resolveDataPath` helper method to encapsulate path resolution logic - `ImguiMapEditor/Services/Map/MapLoadingService.cpp` — utilized `resolveDataPath` to simplify resource loading paths - `ImguiMapEditor/UI/Widgets/TilesetGridWidget.cpp` — extracted pulse animation state to `computePulseState`, optimized label truncation - `ImguiMapEditor/UI/Widgets/TilesetGridWidget.h` — declared `computePulseState` helper
Implemented perimeter-only wall placement, added wall-specific preview provider, and introduced item 'hate' mechanic to break connections. - `ImguiMapEditor/Brushes/BrushController.cpp` — added logic to restrict wall brush placement to perimeter positions - `ImguiMapEditor/Brushes/Enums/BrushEnums.cpp` — added `untouchable` wall type - `ImguiMapEditor/Brushes/Types/WallBrush.cpp` — refactored neighbor calculation for two-pass alignment, implemented friend/redirect logic, added wall hate item handling - `ImguiMapEditor/Brushes/Types/WallBrush.h` — added `friendNames_`, `wallHateMeItems_`, and interface for connection logic - `ImguiMapEditor/CMakeLists.txt` — added `WallBrushPreviewProvider.cpp` and set VS debugger working directory - `ImguiMapEditor/IO/BrushXmlReader.cpp` — added support for 'hate' attribute and door type shortcuts - `ImguiMapEditor/Services/Preview/BrushPreviewFactory.cpp` — added `WallBrushPreviewProvider` to factory - `ImguiMapEditor/Services/Preview/BrushPreviewFactory.h` — removed redundant comments - `ImguiMapEditor/Services/Preview/IPreviewProvider.h` — added `updateFractionalPosition` interface - `ImguiMapEditor/Services/Preview/PreviewService.cpp` — implemented `updateFractional` forwarding - `ImguiMapEditor/Services/Preview/PreviewService.h` — added `updateFractional` declaration - `ImguiMapEditor/Services/Preview/WallBrushPreviewProvider.cpp` — implemented wall brush preview with perimeter logic [new] - `ImguiMapEditor/Services/Preview/WallBrushPreviewProvider.h` — declared wall brush preview provider [new] - `ImguiMapEditor/UI/Dialogs/Properties/ItemPropertiesDialog.cpp` — added null/garbage pointer check for item type - `ImguiMapEditor/UI/Map/MapPanel.cpp` — added fractional tile position calculation and update call to preview service
Optimized wall brush performance by introducing batch tile rebuilding and caching for brush lookups. Wall brushes now cache alignments and door configurations, significantly reducing redundant lookups during painting operations. - `ImguiMapEditor/Brushes/BrushController.cpp` — implemented `rebuildWallPositions` for batch processing, updated `continueWallLikeStroke` to use batch processing, and updated `paintRecordedPosition` to return status - `ImguiMapEditor/Brushes/BrushController.h` — updated `paintRecordedPosition` signature, added `rebuildWallPositions` method - `ImguiMapEditor/Brushes/Types/WallBrush.cpp` — added lookup caches (`itemAlignments_`, `doorNodesByItemId_`), implemented `rebuildTiles`, optimized `getRedirectBrushes` with caching, and normalized name comparisons - `ImguiMapEditor/Brushes/Types/WallBrush.h` — added lookup caches, `rebuildTiles` method, and cache management members
Implemented `buildPreviewTiles` for `WallBrush` to allow generating previews based on map context, and updated `BrushController` to support refreshing previews dynamically when dependencies change. - `ImguiMapEditor/Brushes/BrushController.cpp` — extracted preview provider creation to `refreshPreviewProvider()`, called it on session bind/unbind - `ImguiMapEditor/Brushes/BrushController.h` — added `refreshPreviewProvider` method - `ImguiMapEditor/Brushes/Types/WallBrush.cpp` — implemented `buildPreviewTiles` to determine correct wall/door items based on neighbors and existing map items - `ImguiMapEditor/Brushes/Types/WallBrush.h` — added `buildPreviewTiles` interface - `ImguiMapEditor/Controllers/WorkspaceController.cpp` — triggered preview refresh on session bind/unbind - `ImguiMapEditor/Services/Preview/BrushPreviewFactory.cpp` — added `ChunkedMap` parameter to `createProvider` - `ImguiMapEditor/Services/Preview/BrushPreviewFactory.h` — updated `createProvider` signature - `ImguiMapEditor/Services/Preview/WallBrushPreviewProvider.cpp` — updated to use `map` for contextual preview generation if available - `ImguiMapEditor/Services/Preview/WallBrushPreviewProvider.h` — stored `map` pointer and updated constructor
Introduced an `AutoborderEngine` to automatically handle edge cases for various brush types during drawing and erasing. Refactored `BrushController` to use this engine for planned operations and added a corresponding preview provider to visualize autobordering before application. - `ImguiMapEditor/Brushes/Behaviors/WeightedSelection.cpp` — added `ScopedSeed` RAII helper for deterministic operations - `ImguiMapEditor/Brushes/Behaviors/WeightedSelection.h` — declared `ScopedSeed` class - `ImguiMapEditor/Brushes/BrushController.cpp` — integrated `AutoborderEngine` into `applyRecordedPosition` and `eraseRecordedPosition` workflows, added `createDrawContext` helper - `ImguiMapEditor/Brushes/BrushController.h` — declared `createDrawContext`, removed `rebuildWallPositions` - `ImguiMapEditor/CMakeLists.txt` — added autoborder services and `AutoborderSmoke` test executable - `ImguiMapEditor/Services/Autoborder/AutoborderEngine.cpp` — implemented `AutoborderEngine` logic with resolvers for wall, ground, carpet, and table types - `ImguiMapEditor/Services/Autoborder/AutoborderEngine.h` — declared `AutoborderEngine` interface - `ImguiMapEditor/Services/Autoborder/AutoborderResolver.h` — defined abstract `AutoborderResolver` interface - `ImguiMapEditor/Services/Autoborder/PlacementIntent.h` — defined `PlacementIntent` and `PlacementMode` structures - `ImguiMapEditor/Services/Autoborder/TileDiff.cpp` — implemented helpers for applying tile differences with history support - `ImguiMapEditor/Services/Autoborder/TileDiff.h` — declared `TileDiff` structure and application helpers - `ImguiMapEditor/Services/Preview/AutoborderBrushPreviewProvider.cpp` — implemented `AutoborderBrushPreviewProvider` for visualization - `ImguiMapEditor/Services/Preview/AutoborderBrushPreviewProvider.h` — declared `AutoborderBrushPreviewProvider` class - `ImguiMapEditor/Services/Preview/BrushPreviewFactory.cpp` — updated factory to use `AutoborderBrushPreviewProvider` for relevant brush types - `ImguiMapEditor/Tests/AutoborderSmoke.cpp` — added smoke test for autobordering functionality - `ImguiMapEditor/UI/Widgets/TilesetGridWidget.cpp` — added brush type categorization to UI tooltips and visual card borders - `ImguiMapEditor/UI/Widgets/TilesetGridWidget.h` — updated `renderBrushCard` signature
…rokes Unified autoborder application logic into `applyPlannedIntentWithHistory` and refactored brush types to expose direct tile mutation methods. Added support for deferring wall rebuilds until the end of a stroke to improve performance during drawing. - `ImguiMapEditor/Brushes/BrushController.cpp` — added `finalizeAutoborderStroke` and integrated `applyPlannedIntentWithHistory` in paint/erase logic - `ImguiMapEditor/Brushes/BrushController.h` — declared new stroke management and mutation methods - `ImguiMapEditor/Brushes/Types/CarpetBrush.cpp` — extracted `placeCenterTile` and `eraseFromTile` - `ImguiMapEditor/Brushes/Types/CarpetBrush.h` — declared extraction methods - `ImguiMapEditor/Brushes/Types/GroundBrush.cpp` — extracted `placeGroundTile` and `eraseFromTile` - `ImguiMapEditor/Brushes/Types/GroundBrush.h` — declared extraction methods - `ImguiMapEditor/Brushes/Types/TableBrush.cpp` — extracted `placeAloneTile` and `eraseFromTile` - `ImguiMapEditor/Brushes/Types/TableBrush.h` — declared extraction methods - `ImguiMapEditor/Brushes/Types/WallBrush.cpp` — extracted `placeWallTile` and `eraseFromTile`, now returns `DirectPlacementResult` - `ImguiMapEditor/Brushes/Types/WallBrush.h` — declared extraction methods and `DirectPlacementResult` struct - `ImguiMapEditor/CMakeLists.txt` — added `PlannedMutation.cpp` - `ImguiMapEditor/Services/Autoborder/AutoborderEngine.cpp` — removed `applyDirectIntent`, implemented `applyIntent` in resolvers - `ImguiMapEditor/Services/Autoborder/AutoborderResolver.h` — added `applyIntent` interface - `ImguiMapEditor/Services/Autoborder/PlacementIntent.h` — added `PlacementMode::ResolveOnly` - `ImguiMapEditor/Services/Autoborder/PlannedMutation.cpp` — [new] implemented `applyPlannedIntentWithHistory` - `ImguiMapEditor/Services/Autoborder/PlannedMutation.h` — [new] declared mutation result and helper function - `ImguiMapEditor/Services/Preview/AutoborderBrushPreviewProvider.cpp` — [minor] adjusted default `isDragging` state - `ImguiMapEditor/Tests/AutoborderSmoke.cpp` — updated tests for new mutation and stroke handling
Refactored doodad brush system to utilize dedicated planners (`DoodadPlacementPlanner`, `DoodadRedoBorderPlanner`) for placement and erase operations, improving determinism via seeding and adding robust border handling. Implemented precise tile mutation notifications to improve rendering performance and session state tracking, and added configurable erase settings in the preferences dialog. - `.gitignore` — added `/data` to ignore patterns - `ImguiMapEditor/Application.cpp` — integrated brush settings with preference dialog and application shutdown - `ImguiMapEditor/Application/CallbackMediator.cpp` — implemented precise mutation notifications for improved rendering efficiency - `ImguiMapEditor/Brushes/BrushController.cpp` — updated brush application to use precise mutation notification and integrated doodad placement/erase planners - `ImguiMapEditor/Brushes/BrushController.h` — added callback and support for precise mutation notifications - `ImguiMapEditor/Brushes/BrushRegistry.cpp` — added item binding unregistration and improved border metadata management - `ImguiMapEditor/Brushes/BrushRegistry.h` — added item binding unregistration and metadata registration methods - `ImguiMapEditor/Brushes/BrushSystem.cpp` — implemented settings persistence - `ImguiMapEditor/Brushes/BrushSystem.h` — added `saveSettings` method - `ImguiMapEditor/Brushes/Data/BorderBlock.cpp` — switched to `WeightedSelection` for random item selection - `ImguiMapEditor/Brushes/Data/BorderBlock.h` — removed redundant `std::mt19937` rng - `ImguiMapEditor/Brushes/Data/DoodadAlternative.cpp` — switched to `WeightedSelection` for random selection - `ImguiMapEditor/Brushes/Data/DoodadAlternative.h` — removed redundant `std::mt19937` rng - `ImguiMapEditor/Brushes/Enums/BrushEnums.cpp` — added case-insensitive hatch window parsing - `ImguiMapEditor/Brushes/Types/CarpetBrush.h` — added `rebuildTile` method declaration - `ImguiMapEditor/Brushes/Types/DoodadBrush.cpp` — refactored to use `DoodadPlacementPlanner` and added sophisticated erase planning - `ImguiMapEditor/Brushes/Types/DoodadBrush.h` — added placement/erase planning structures and configuration options - `ImguiMapEditor/Brushes/Types/DoodadPlacementPlanner.cpp` — implemented deterministic doodad placement logic - `ImguiMapEditor/Brushes/Types/DoodadPlacementPlanner.h` — added interface for doodad placement planning - `ImguiMapEditor/Brushes/Types/DoodadRedoBorderPlanner.cpp` — implemented border rebuilding logic for doodad placement changes - `ImguiMapEditor/Brushes/Types/DoodadRedoBorderPlanner.h` — added interface for doodad border redo planning - `ImguiMapEditor/Brushes/Types/GroundBrush.cpp` — added logic for border rule management, friend/enemy clearing, and ground-equivalent item mapping - `ImguiMapEditor/Brushes/Types/GroundBrush.h` — added brush modification methods - `ImguiMapEditor/Brushes/Types/TableBrush.h` — added `rebuildTile` method declaration - `ImguiMapEditor/Brushes/Types/WallBrush.h` — added `rebuildTile` method declaration - `ImguiMapEditor/CMakeLists.txt` — added new source files and `DoodadPreviewSmoke` test target - `ImguiMapEditor/Controllers/MapInputController.cpp` — optimized session modification tracking via mutation notifications - `ImguiMapEditor/IO/BrushXmlReader.cpp` — expanded XML support for doodad settings and border manipulation - `ImguiMapEditor/Rendering/Frame/RenderState.cpp` — implemented `invalidateTiles` for targeted cache invalidation - `ImguiMapEditor/Rendering/Frame/RenderState.h` — added `invalidateTiles` interface - `ImguiMapEditor/Rendering/Frame/RenderingManager.cpp` — added `invalidateTiles` forwarding - `ImguiMapEditor/Rendering/Frame/RenderingManager.h` — added `invalidateTiles` interface - `ImguiMapEditor/Services/Autoborder/PlannedMutation.cpp` — updated to populate changed tile positions - `ImguiMapEditor/Services/Autoborder/PlannedMutation.h` — updated interface to support changed position tracking - `ImguiMapEditor/Services/BrushSettingsService.cpp` — implemented config serialization - `ImguiMapEditor/Services/BrushSettingsService.h` — added configuration settings - `ImguiMapEditor/Services/Preview/BrushPreviewFactory.cpp` — updated provider creation - `ImguiMapEditor/Services/Preview/DoodadBrushPreviewProvider.cpp` — integrated seeded placement planning - `ImguiMapEditor/Services/Preview/DoodadBrushPreviewProvider.h` — updated dependencies - `ImguiMapEditor/Tests/AutoborderSmoke.cpp` — added mutation notification validation to tests - `ImguiMapEditor/Tests/BrushSmoke.cpp` — added extensive new test coverage for border rules, specific cases, and brush behaviors - `ImguiMapEditor/Tests/DoodadPreviewSmoke.cpp` — added new smoke test suite for doodad placement and preview - `ImguiMapEditor/UI/PreferencesDialog.cpp` — added doodad erase configuration options - `ImguiMapEditor/UI/PreferencesDialog.h` — added brush settings dependency
Introduced `paintRecordedPositions` to support batch processing of multiple positions, and updated `BrushController` to maintain a persistent `autoborderEngine_` for improved performance and consistency. Cleaned up weighted item selection and border logic in `GroundBrush` to prevent accidental removal of border items. - `ImguiMapEditor/Brushes/BrushController.cpp` — added `paintRecordedPositions` for batched painting, switched to member `autoborderEngine_` - `ImguiMapEditor/Brushes/BrushController.h` — added `autoborderEngine_` and `paintRecordedPositions` declaration - `ImguiMapEditor/Brushes/Types/DoodadBrush.cpp` — removed redundant `rebuildBrush` call [minor] - `ImguiMapEditor/Brushes/Types/GroundBrush.cpp` — refactored weighted item selection, improved optional border logic - `ImguiMapEditor/Tests/AutoborderSmoke.cpp` — added `requireBatchedVsSequentialPlanParity` test - `ImguiMapEditor/Tests/BrushSmoke.cpp` — added batched placement tests and updated earth-border parity verification
Executed Phase 1 of the Brushes audit plan: removed dead code, unused headers, and forward declarations, while applying `noexcept` to destructors/constructors and fixing type-related magic numbers and encapsulation for better maintainability. - `ImguiMapEditor/Brushes/AUDIT_PLAN.md` — added initial audit and action plan - `ImguiMapEditor/Brushes/Behaviors/ItemPlacement.h` — removed unused `<memory>` include - `ImguiMapEditor/Brushes/Behaviors/WeightedSelection.cpp` — removed unused `passesThicknessCheck` - `ImguiMapEditor/Brushes/Behaviors/WeightedSelection.h` — removed unused `passesThicknessCheck` declaration - `ImguiMapEditor/Brushes/BrushController.cpp` — removed unused GLFW include, marked dtor `noexcept`, replaced GLFW modifier constant, added `noexcept` to `createDrawContext` and placement methods - `ImguiMapEditor/Brushes/BrushController.h` — removed unused includes and fwd decls, marked dtor `noexcept`, added `noexcept` to `isValid` - `ImguiMapEditor/Brushes/BrushRegistry.cpp` — removed unused header - `ImguiMapEditor/Brushes/BrushRegistry.h` — removed unused header, marked ctor/dtor `noexcept` - `ImguiMapEditor/Brushes/BrushSystem.cpp` — marked dtor `noexcept` - `ImguiMapEditor/Brushes/BrushSystem.h` — removed unused headers and fwd decls - `ImguiMapEditor/Brushes/Core/BrushBase.h` — marked ctor `explicit`, added `noexcept` to setter, encapsulated members - `ImguiMapEditor/Brushes/Core/IBrush.h` — removed unused `clientSprite` factory, defined `Modifiers::Alt`, updated `DrawContext`, marked `setVariation` param as `maybe_unused` - `ImguiMapEditor/Brushes/Data/BorderBlock.h` — fixed include path - `ImguiMapEditor/Brushes/Data/DoodadAlternative.cpp` — fixed include order - `ImguiMapEditor/Brushes/Data/DoodadAlternative.h` — used `int32_t` for coords, removed `getTotalChance` - `ImguiMapEditor/Brushes/Data/WallNode.cpp` — removed redundant comments - `ImguiMapEditor/Brushes/Data/WallNode.h` — fixed include path - `ImguiMapEditor/Brushes/Enums/BrushEnums.h` — fixed include path, removed `EdgeName` and `ZoneFlag` - `ImguiMapEditor/Brushes/Types/CarpetBrush.h` — replaced magic number with enum constant - `ImguiMapEditor/Brushes/Types/CreatureBrush.cpp` — marked unused param `[[maybe_unused]]` - `ImguiMapEditor/Brushes/Types/DoodadBrush.cpp` — updated position encoding call - `ImguiMapEditor/Brushes/Types/DoodadBrush.h` — moved/shared position encoding and sorting utilities - `ImguiMapEditor/Brushes/Types/DoodadPlacementPlanner.cpp` — updated position encoding and dedupe calls - `ImguiMapEditor/Brushes/Types/DoodadPlacementPlanner.h` — removed unused include - `ImguiMapEditor/Brushes/Types/DoorBrush.cpp` — removed GLFW include, updated modifier usage - `ImguiMapEditor/Brushes/Types/EraserBrush.cpp` — marked unused param `[[maybe_unused]]` - `ImguiMapEditor/Brushes/Types/FlagBrush.cpp` — marked unused param `[[maybe_unused]]` - `ImguiMapEditor/Brushes/Types/GroundBrush.cpp` — removed unused GLFW include, replaced constant, removed dead functions - `ImguiMapEditor/Brushes/Types/GroundBrush.h` — removed dead function declarations - `ImguiMapEditor/Brushes/Types/HouseBrush.cpp` — marked unused param `[[maybe_unused]]` - `ImguiMapEditor/Brushes/Types/PlaceholderBrush.h` — marked params `[[maybe_unused]]` - `ImguiMapEditor/Brushes/Types/RawBrush.cpp` — removed unused includes, marked unused params `[[maybe_unused]]` - `ImguiMapEditor/Brushes/Types/TableBrush.h` — replaced magic number with enum constant - `ImguiMapEditor/Brushes/Types/WallBrush.cpp` — updated accessor method call - `ImguiMapEditor/Brushes/Types/WallBrush.h` — replaced magic number with enum constant, moved accessor to public
Refactored brush services to use static instances to reduce allocations, replaced manual RNG logic with a unified WeightedSelection service, and applied minor performance improvements. Also added noexcept specifiers to constructors and corrected a bitwise operator in position encoding. - `ImguiMapEditor/Brushes/Data/WallNode.cpp` — migrated random item selection to `WeightedSelection` service - `ImguiMapEditor/Brushes/Data/WallNode.h` — removed `std::random` dependencies and unused members - `ImguiMapEditor/Brushes/Types/CarpetBrush.cpp` — switched to static `CarpetLookupService` instance - `ImguiMapEditor/Brushes/Types/DoodadBrush.h` — corrected bitwise XOR to OR for position encoding - `ImguiMapEditor/Brushes/Types/EraserBrush.cpp` — added `noexcept` to constructor - `ImguiMapEditor/Brushes/Types/EraserBrush.h` — added `noexcept` to constructor declaration - `ImguiMapEditor/Brushes/Types/GroundBrush.cpp` — switched to static `BorderLookupService`, minor pointer refinement - `ImguiMapEditor/Brushes/Types/HouseBrush.cpp` — added `noexcept` to constructor - `ImguiMapEditor/Brushes/Types/HouseBrush.h` — added `noexcept` to constructor declaration - `ImguiMapEditor/Brushes/Types/TableBrush.cpp` — switched to static `TableLookupService` instance
Refactored map editor brushes and services to ensure proper map change tracking, standardized const-correctness and noexcept specifications, and centralized common logic. - `ImguiMapEditor/Brushes/Behaviors/ItemPlacement.cpp` — added documentation about required map.markChanged() calls - `ImguiMapEditor/Brushes/Enums/BrushEnums.h` — added unpackEdgeTypes helper function - `ImguiMapEditor/Brushes/Types/BrushUtils.cpp` — refactored blocking item flag check to use constant - `ImguiMapEditor/Brushes/Types/CreatureBrush.cpp` — added map.markChanged() and used constant for search radius - `ImguiMapEditor/Brushes/Types/CreatureBrush.h` — marked constructor explicit, cleaned up style - `ImguiMapEditor/Brushes/Types/DoodadRedoBorderPlanner.cpp` — [minor] code reformatting - `ImguiMapEditor/Brushes/Types/DoorBrush.cpp` — added constants for lock preference - `ImguiMapEditor/Brushes/Types/WaypointBrush.cpp` — added map.markChanged() - `ImguiMapEditor/Services/Autoborder/AutoborderEngine.cpp` — improved seed mixing with FNV constants and noexcept - `ImguiMapEditor/Services/Autoborder/PlacementIntent.h` — marked isValid noexcept - `ImguiMapEditor/Services/Autoborder/PlannedMutation.cpp` — added missing PlacementIntent include - `ImguiMapEditor/Services/Autoborder/PlannedMutation.h` — removed unnecessary PlacementIntent include - `ImguiMapEditor/Services/Autoborder/TileDiff.h` — added missing Tile header include - `ImguiMapEditor/Services/BrushSettingsService.h` — added [[nodiscard]] and noexcept to various methods - `ImguiMapEditor/Services/Brushes/BorderLookupService.cpp` — used shared unpackEdgeTypes helper - `ImguiMapEditor/Services/Brushes/BorderLookupService.h` — marked methods noexcept and added [[nodiscard]] - `ImguiMapEditor/Services/Brushes/CarpetLookupService.cpp` — used shared unpackEdgeTypes helper - `ImguiMapEditor/Services/Brushes/CarpetLookupService.h` — marked methods noexcept and added [[nodiscard]] - `ImguiMapEditor/Services/Brushes/TableLookupService.cpp` — marked getTableType noexcept - `ImguiMapEditor/Services/Brushes/TableLookupService.h` — added [[nodiscard]] and noexcept - `ImguiMapEditor/Services/Brushes/WallLookupService.cpp` — marked methods noexcept - `ImguiMapEditor/Services/Brushes/WallLookupService.h` — added [[nodiscard]] and noexcept - `ImguiMapEditor/Services/Preview/BrushPreviewFactory.cpp` — centralized color constants - `ImguiMapEditor/Services/Preview/CreaturePreviewProvider.h` — cleaned up namespace formatting - `ImguiMapEditor/Services/Preview/DragPreviewProvider.cpp` — extracted relative position calculation to helper - `ImguiMapEditor/Services/Preview/DragPreviewProvider.h` — added relativeToDragStart helper method - `ImguiMapEditor/Services/Preview/PreviewTypes.h` — improved noexcept specifiers and used int32_t types - `ImguiMapEditor/Services/Preview/SpawnPreviewProvider.cpp` — used constant for default radius - `ImguiMapEditor/Services/Preview/SpawnPreviewProvider.h` — cleaned up namespaces and added default radius constant
Refactored `BrushController` by extracting door-related operations, stroke management, and variation logic into dedicated files. Optimized preview providers by moving state to `mutable` and updating `const` build methods to eliminate `const_cast` usage. - `ImguiMapEditor/Brushes/BrushController.cpp` — removed extracted logic for door operations, stroke handling, and variation management - `ImguiMapEditor/Brushes/BrushController.h` — added `altReplaceState_` member to support brush state tracking - `ImguiMapEditor/Brushes/BrushDoorOps.cpp` — [new] extracted door-related methods from `BrushController` - `ImguiMapEditor/Brushes/BrushStroke.cpp` — [new] extracted stroke management logic from `BrushController` - `ImguiMapEditor/Brushes/BrushVariationOps.cpp` — [new] extracted brush variation and application logic from `BrushController` - `ImguiMapEditor/Brushes/Core/IBrush.h` — added `AltGroundReplaceState` to `DrawContext` - `ImguiMapEditor/Brushes/Enums/BrushEnums.cpp` — migrated maps to `std::array` with `std::lower_bound` lookup, added warning for unknown values - `ImguiMapEditor/Brushes/Helpers/DoorResolveUtils.h` — [new] extracted door resolution helpers - `ImguiMapEditor/Brushes/Types/CarpetBrush.cpp` — [minor] updated item creation to use `makeBorderContext` helper - `ImguiMapEditor/Brushes/Types/GroundBorderUpdater.cpp` — [new] extracted border update logic for ground brushes - `ImguiMapEditor/Brushes/Types/GroundBrush.cpp` — removed extracted border logic and refactored alt-replace state handling - `ImguiMapEditor/Brushes/Types/GroundBrush.h` — removed `resetAltReplaceState` static method - `ImguiMapEditor/Brushes/Types/TableBrush.cpp` — [minor] updated item creation to use `makeBorderContext` helper - `ImguiMapEditor/Brushes/Types/WallBrush.cpp` — removed extracted preview and decoration logic, moved helper to class method - `ImguiMapEditor/Brushes/Types/WallBrush.h` — declared `resolveWallBrushForItem` as static - `ImguiMapEditor/Brushes/Types/WallBrushPreview.cpp` — [new] extracted preview logic for wall brushes - `ImguiMapEditor/Brushes/Types/WallDecorationBrush.cpp` — [new] extracted wall decoration logic - `ImguiMapEditor/CMakeLists.txt` — added newly created files to build system - `ImguiMapEditor/Services/Preview/CreaturePreviewProvider.cpp` — removed `const_cast` from lazy regeneration - `ImguiMapEditor/Services/Preview/CreaturePreviewProvider.h` — marked preview state as `mutable` - `ImguiMapEditor/Services/Preview/DoodadBrushPreviewProvider.cpp` — removed `const_cast` from lazy regeneration - `ImguiMapEditor/Services/Preview/DoodadBrushPreviewProvider.h` — marked preview state as `mutable` - `ImguiMapEditor/Services/Preview/MultiItemBrushPreviewProvider.cpp` — removed `const_cast` from lazy regeneration - `ImguiMapEditor/Services/Preview/MultiItemBrushPreviewProvider.h` — marked preview state as `mutable` - `ImguiMapEditor/Services/Preview/RawBrushPreviewProvider.cpp` — removed `const_cast` from lazy regeneration - `ImguiMapEditor/Services/Preview/RawBrushPreviewProvider.h` — marked preview state as `mutable` - `ImguiMapEditor/Services/Preview/SpawnPreviewProvider.cpp` — removed `const_cast` from lazy regeneration - `ImguiMapEditor/Services/Preview/SpawnPreviewProvider.h` — marked preview state as `mutable` - `ImguiMapEditor/Services/Preview/ZoneBrushPreviewProvider.cpp` — removed `const_cast` from lazy regeneration - `ImguiMapEditor/Services/Preview/ZoneBrushPreviewProvider.h` — marked preview state as `mutable`
Refactored brush system architecture to eliminate global state, improve parsing efficiency via sorted constexpr arrays, enforce component separation (new files for `WallDecorationBrush`), and split oversized files (`BrushController`, `WallBrush`, `GroundBrush`). Added utility modules, cleaned up redundant services/includes, and documented the updated ground brush pipeline. - `ImguiMapEditor/Brushes/AUDIT_PLAN.md` — updated audit plan - `ImguiMapEditor/Brushes/Behaviors/ItemPlacement.cpp` — [deleted] removed dead code - `ImguiMapEditor/Brushes/Behaviors/ItemPlacement.h` — [deleted] removed dead code - `ImguiMapEditor/Brushes/Behaviors/WeightedSelection.cpp` — [minor] updated helper - `ImguiMapEditor/Brushes/Behaviors/WeightedSelection.h` — [minor] updated header - `ImguiMapEditor/Brushes/BrushController.cpp` — refactored, split components - `ImguiMapEditor/Brushes/BrushController.h` — [minor] updated interface - `ImguiMapEditor/Brushes/BrushDoorOps.cpp` — [minor] cleanup - `ImguiMapEditor/Brushes/BrushRegistry.cpp` — [minor] cleanup - `ImguiMapEditor/Brushes/BrushRegistry.h` — [minor] cleanup - `ImguiMapEditor/Brushes/BrushStroke.cpp` — refactored, consolidated logic - `ImguiMapEditor/Brushes/BrushSystem.cpp` — [minor] updated wiring - `ImguiMapEditor/Brushes/BrushSystem.h` — [minor] updated wiring - `ImguiMapEditor/Brushes/BrushVariationOps.cpp` — [minor] cleanup - `ImguiMapEditor/Brushes/Core/IBrush.h` — [minor] updated constants - `ImguiMapEditor/Brushes/Data/WallNode.h` — [minor] added noexcept - `ImguiMapEditor/Brushes/Enums/BrushEnums.cpp` — replaced maps with sorted arrays for performance - `ImguiMapEditor/Brushes/Enums/BrushEnums.h` — removed unused enum helpers - `ImguiMapEditor/Brushes/Helpers/DoorResolveUtils.h` — added helper - `ImguiMapEditor/Brushes/Types/CreatureBrush.h` — [minor] updated header - `ImguiMapEditor/Brushes/Types/DoodadBrush.cpp` — updated utility usage - `ImguiMapEditor/Brushes/Types/DoodadBrush.h` — [minor] header updates - `ImguiMapEditor/Brushes/Types/DoodadPlacementPlanner.cpp` — updated utility usage - `ImguiMapEditor/Brushes/Types/DoorBrush.h` — [minor] header cleanup - `ImguiMapEditor/Brushes/Types/EraserBrush.h` — [minor] header cleanup - `ImguiMapEditor/Brushes/Types/FlagBrush.h` — [minor] header cleanup - `ImguiMapEditor/Brushes/Types/GroundBorderUpdater.cpp` — refactored border logic - `ImguiMapEditor/Brushes/Types/GroundBrush.cpp` — removed global state, consolidated border logic - `ImguiMapEditor/Brushes/Types/GroundBrush.h` — updated interface - `ImguiMapEditor/Brushes/Types/WallDecorationBrush.cpp` — created new file - `ImguiMapEditor/CMakeLists.txt` — updated source list - `ImguiMapEditor/IO/BrushXmlReader.cpp` — removed unused services - `ImguiMapEditor/IO/BrushXmlReader.h` — removed unused services - `ImguiMapEditor/IO/MaterialsXmlReader.cpp` — [minor] updated constructor - `ImguiMapEditor/Services/Autoborder/AutoborderEngine.cpp` — updated utility usage - `ImguiMapEditor/Services/Autoborder/PlannedMutation.cpp` — [minor] cleanup - `ImguiMapEditor/Services/Autoborder/TileDiff.h` — [minor] cleanup - `ImguiMapEditor/Services/BrushSettingsService.cpp` — [minor] cleanup - `ImguiMapEditor/Services/BrushSettingsService.h` — [minor] cleanup - `ImguiMapEditor/Services/Brushes/BorderLookupService.h` — [minor] cleanup - `ImguiMapEditor/Services/Brushes/CarpetLookupService.h` — [minor] cleanup - `ImguiMapEditor/Services/Brushes/TableLookupService.h` — [minor] cleanup - `ImguiMapEditor/Services/Preview/CreaturePreviewProvider.h` — [minor] cleanup - `ImguiMapEditor/Services/Preview/PreviewService.cpp` — [minor] cleanup - `ImguiMapEditor/Services/Preview/PreviewService.h` — [minor] cleanup - `ImguiMapEditor/Services/Preview/PreviewTypes.h` — [minor] cleanup - `ImguiMapEditor/Services/Preview/RawBrushPreviewProvider.h` — [minor] cleanup - `ImguiMapEditor/Services/Preview/SpawnPreviewProvider.h` — [minor] cleanup - `ImguiMapEditor/Services/Preview/WallBrushPreviewProvider.cpp` — [deleted] refactored - `ImguiMapEditor/Services/Preview/WallBrushPreviewProvider.h` — [deleted] refactored - `ImguiMapEditor/Utils/HashUtils.h` — added utility - `ImguiMapEditor/Utils/PositionUtils.h` — added utility - `ImguiMapEditor/build_ninja.bat` — [deleted] replaced - `build_ninja.bat` — updated build script - `docs/ground-brush-architecture.md` — added architecture docs
Implemented specific variation support for doodad brushes, allowing users to cycle through single and composite items. Added stable seeding mechanisms to ensure preview results deterministically match actual placement. - `ImguiMapEditor/Brushes/BrushVariationOps.cpp` — cycle variation after doodad placement - `ImguiMapEditor/Brushes/Types/DoodadBrush.cpp` — populate variants list and pass to planner - `ImguiMapEditor/Brushes/Types/DoodadBrush.h` — add Variant struct and helper methods - `ImguiMapEditor/Brushes/Types/DoodadPlacementPlanner.cpp` — implement specific candidate building - `ImguiMapEditor/Brushes/Types/DoodadPlacementPlanner.h` — add specificVariant to request - `ImguiMapEditor/Services/Preview/DoodadBrushPreviewProvider.cpp` — add stable seed logic for previews - `ImguiMapEditor/Services/Preview/DoodadBrushPreviewProvider.h` — add nonce and seed tracking - `ImguiMapEditor/Services/Preview/IPreviewProvider.h` — add virtual getCurrentSeed method - `ImguiMapEditor/Services/Preview/PreviewService.cpp` — implement getCurrentSeed - `ImguiMapEditor/Services/Preview/PreviewService.h` — declare getCurrentSeed
Refactored doodad placement logic to support scatter-mode placement using weighted shuffling and updated variation handling to properly cycle through doodad variants. - `ImguiMapEditor/Brushes/Behaviors/WeightedSelection.cpp` — added `shuffleIndices` to perform in-place vector shuffling - `ImguiMapEditor/Brushes/Behaviors/WeightedSelection.h` — declared `shuffleIndices` helper method - `ImguiMapEditor/Brushes/BrushController.cpp` — added variation bounds checking in `setBrush` - `ImguiMapEditor/Brushes/BrushController.h` — initialized `variation_` to -1 - `ImguiMapEditor/Brushes/BrushStroke.cpp` — integrated `PreviewService` for seed-based doodad placement, ensured consistent regeneration, and removed manual variation cycling from `BrushVariationOps` - `ImguiMapEditor/Brushes/BrushVariationOps.cpp` — removed redundant variation cycling logic - `ImguiMapEditor/Brushes/Types/DoodadBrush.cpp` — updated `buildPreviewTiles` and `draw` to enforce forced placement - `ImguiMapEditor/Brushes/Types/DoodadBrush.h` — updated `getMaxVariation` to include +1 for variants and updated `encodeDoodadPosition` to use a 64-bit encoding scheme - `ImguiMapEditor/Brushes/Types/DoodadPlacementPlanner.cpp` — implemented scatter-mode placement for single doodads using shuffled anchor indices
Extracted shared item ownership and selection logic from carpet/table brushes into `AlignedBrushHelpers`. Refactored `CarpetBrush` to use a declarative `planTile` model for both preview and commit, improving parity with RME. - `ImguiMapEditor/Brushes/Helpers/AlignedBrushHelpers.h` — created helper header for shared alignment, ownership, and selection utilities - `ImguiMapEditor/Brushes/Types/CarpetBrush.cpp` — refactored to use helper functions, extracted plan logic into `planTile`, and applied via `applyTilePlan` - `ImguiMapEditor/Brushes/Types/CarpetBrush.h` — added `PlannedItem` struct, `planTile`, and `applyTilePlan` method declarations - `ImguiMapEditor/Brushes/Types/TableBrush.cpp` — refactored to use `AlignedBrushHelpers` for ownership and item selection - `ImguiMapEditor/Brushes/Types/TableBrush.h` — updated methods to follow new refactored structure - `ImguiMapEditor/CMakeLists.txt` — added `CarpetSmoke` test executable target - `ImguiMapEditor/Services/Autoborder/AutoborderEngine.cpp` — updated resolution to call `rebuildTile` on affected tiles, matching RME's pass behaviour - `ImguiMapEditor/Services/Preview/AutoborderBrushPreviewProvider.h` — updated namespace qualification to match new structure - `ImguiMapEditor/Tests/CarpetSmoke.cpp` — created comprehensive suite for lookup parity, brush mechanics, and undo/redo
Extracted shared item ownership and selection logic from carpet/table brushes into `AlignedBrushHelpers`. Refactored `CarpetBrush` to use a declarative `planTile` model for both preview and commit, improving parity with RME. - `ImguiMapEditor/Brushes/Helpers/AlignedBrushHelpers.h` — created helper header for shared alignment, ownership, and selection utilities - `ImguiMapEditor/Brushes/Types/CarpetBrush.cpp` — refactored to use helper functions, extracted plan logic into `planTile`, and applied via `applyTilePlan` - `ImguiMapEditor/Brushes/Types/CarpetBrush.h` — added `PlannedItem` struct, `planTile`, and `applyTilePlan` method declarations - `ImguiMapEditor/Brushes/Types/TableBrush.cpp` — refactored to use `AlignedBrushHelpers` for ownership and item selection - `ImguiMapEditor/Brushes/Types/TableBrush.h` — updated methods to follow new refactored structure - `ImguiMapEditor/CMakeLists.txt` — added `CarpetSmoke` test executable target - `ImguiMapEditor/Services/Autoborder/AutoborderEngine.cpp` — updated resolution to call `rebuildTile` on affected tiles, matching RME's pass behaviour - `ImguiMapEditor/Services/Preview/AutoborderBrushPreviewProvider.h` — updated namespace qualification to match new structure - `ImguiMapEditor/Tests/CarpetSmoke.cpp` — created comprehensive suite for lookup parity, brush mechanics, and undo/redo
…ting - Fix GroundBrush::resolveGroundBrush early return to correctly fall back to registry bindings for ground items placed by doodad brushes (resolves sand dune grass-none borders issue). - Route initial clicks of erase stroke in BrushController::eraseBrush using action family switch, allowing doodad erasing to properly respect matchingBrushOnly option (resolves CTRL erasing all doodads issue).
…and RME stack ordering alignment
Doodad brush: - Synchronize preview seed with placement during click and drag strokes - Fix double placement on drag start by deferring onMouseMove to next frame - Skip lastStrokePos_ in line interpolation to prevent duplicate painting - Decouple BlockingTile from DuplicateOwnItem filtering in DoodadPlacementPlanner Arch/door/hatch walls: - Place both directional variants (west+east / north+south) via WallBrushDoor - Fix selection shading for arch items in TileRenderer RAW brush: - Classify as GroundLike action family for proper brush size expansion - Bypass wall outline preview in RawBrushPreviewProvider Input pipeline: - Skip onMouseMove on the frame that onLeftDragStart fires to prevent painting both starting tile and current cursor tile simultaneously
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| BestPractice | 3 medium |
| ErrorProne | 93 medium |
| Complexity | 4 medium |
🟢 Metrics 3449 complexity · 194 duplication
Metric Results Complexity 3449 Duplication 194
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the map editor's brush and rendering systems. It introduces a modular architecture for brush types, a dedicated autoborder engine for complex tile alignment, and a centralized item definition store. These changes improve performance, maintainability, and parity with RME's brush behavior while fixing several architectural issues like global state and inefficient lookups. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive refactor and expansion of the brush system, including the implementation of specialized brush types (Ground, Wall, Doodad, Carpet, Table, Door) and an autoborder engine. It addresses architectural issues by splitting large files, removing global state, and enforcing const-correctness. The changes also include improvements to the history system, item definition storage, and rendering invalidation logic. I have no feedback to provide as the changes align well with the provided architecture and style guidelines.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| size_t operator()(const std::tuple<int32_t, int32_t, int16_t> &p) const { | ||
| return std::hash<int64_t>()(static_cast<int64_t>(std::get<0>(p)) | | ||
| (static_cast<int64_t>(std::get<1>(p)) << 20) | | ||
| (static_cast<int64_t>(std::get<2>(p)) << 40)); | ||
| const uint64_t x = static_cast<uint64_t>(std::get<0>(p)) & 0xFFFFF; // 20 bits | ||
| const uint64_t y = static_cast<uint64_t>(std::get<1>(p)) & 0xFFFFF; // 20 bits | ||
| const uint64_t z = static_cast<uint64_t>(std::get<2>(p)) & 0xFFFF; // 16 bits | ||
| return std::hash<uint64_t>()(x | (y << 20) | (z << 40)); | ||
| } |
| EdgeType parseEdgeName(std::string_view name) { | ||
| static const std::unordered_map<std::string_view, EdgeType> map = { | ||
| {"n", EdgeType::N}, {"s", EdgeType::S}, | ||
| {"e", EdgeType::E}, {"w", EdgeType::W}, | ||
| {"cne", EdgeType::CNE}, {"cnw", EdgeType::CNW}, | ||
| {"cse", EdgeType::CSE}, {"csw", EdgeType::CSW}, | ||
| {"dne", EdgeType::DNE}, {"dnw", EdgeType::DNW}, | ||
| {"dse", EdgeType::DSE}, {"dsw", EdgeType::DSW}, | ||
| {"center", EdgeType::Center}}; | ||
| auto it = map.find(name); | ||
| return it != map.end() ? it->second : EdgeType::None; | ||
| } | ||
|
|
||
| std::string_view edgeTypeToString(EdgeType type) { | ||
| switch (type) { | ||
| case EdgeType::N: | ||
| return "n"; | ||
| case EdgeType::S: | ||
| return "s"; | ||
| case EdgeType::E: | ||
| return "e"; | ||
| case EdgeType::W: | ||
| return "w"; | ||
| case EdgeType::CNE: | ||
| return "cne"; | ||
| case EdgeType::CNW: | ||
| return "cnw"; | ||
| case EdgeType::CSE: | ||
| return "cse"; | ||
| case EdgeType::CSW: | ||
| return "csw"; | ||
| case EdgeType::DNE: | ||
| return "dne"; | ||
| case EdgeType::DNW: | ||
| return "dnw"; | ||
| case EdgeType::DSE: | ||
| return "dse"; | ||
| case EdgeType::DSW: | ||
| return "dsw"; | ||
| case EdgeType::Center: | ||
| return "center"; | ||
| default: | ||
| return ""; | ||
| } | ||
| static constexpr std::array<std::pair<std::string_view, EdgeType>, 13> kMap = {{ | ||
| {"center", EdgeType::Center}, | ||
| {"cne", EdgeType::CNE}, | ||
| {"cnw", EdgeType::CNW}, | ||
| {"cse", EdgeType::CSE}, | ||
| {"csw", EdgeType::CSW}, | ||
| {"dne", EdgeType::DNE}, | ||
| {"dnw", EdgeType::DNW}, | ||
| {"dse", EdgeType::DSE}, | ||
| {"dsw", EdgeType::DSW}, | ||
| {"e", EdgeType::E}, | ||
| {"n", EdgeType::N}, | ||
| {"s", EdgeType::S}, | ||
| {"w", EdgeType::W}, | ||
| }}; | ||
| auto it = std::lower_bound(kMap.begin(), kMap.end(), name, | ||
| [](const auto& entry, std::string_view key) { return entry.first < key; }); | ||
| if (it != kMap.end() && it->first == name) return it->second; | ||
| spdlog::warn("[BrushEnums] Unknown edge name: {}", name); | ||
| return EdgeType::None; | ||
| } |
| // Add BEFORE and AFTER tile snapshots only if they changed | ||
| for (auto& [pos, before_snapshot] : before_states_) { | ||
| entry->addBeforeSnapshot(std::move(before_snapshot)); | ||
|
|
||
| // Capture AFTER state from current map | ||
| const Tile* current_tile = map->getTile(pos); | ||
| entry->addAfterSnapshot(TileSnapshot::capture(current_tile, pos)); | ||
| TileSnapshot after_snapshot = TileSnapshot::capture(current_tile, pos); | ||
|
|
||
| if (before_snapshot.data() != after_snapshot.data()) { | ||
| entry->addBeforeSnapshot(std::move(before_snapshot)); | ||
| entry->addAfterSnapshot(std::move(after_snapshot)); | ||
| } | ||
| } |
| if (binding.action_id == "SHOW_SHADE" && | ||
| binding.key == GLFW_KEY_Q && binding.mods == 0) { | ||
| binding.key = GLFW_KEY_F9; | ||
| } |
| #ifdef _WIN32 | ||
| _wfopen_s(&file_, path.c_str(), L"wb"); | ||
| #else | ||
| file_ = std::fopen(path.c_str(), "wb"); | ||
| #endif |
| #ifndef STB_IMAGE_IMPLEMENTATION | ||
| #define STB_IMAGE_IMPLEMENTATION | ||
| #define STBI_ONLY_JPEG | ||
| #endif |
No description provided.