Commit Graph

82 Commits

Author SHA1 Message Date
a91aac1192 Fix Play button: unload sublevel + use full map path for OpenLevel
OpenLevel("test") was resolving to the streamed sublevel instance
(test_LevelInstance_5) instead of the actual map. Fix:
- Unload sublevel via LoadBaseLevelAsSublevel("None") before OpenLevel
- Use full path "/Game/{BaseLevel}" to avoid ambiguity

Also: all widget lambdas now get SpawnManager/SceneSerializer fresh from
PlayerController (critical fix for packaged builds where weak ptrs are null).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 18:35:52 +02:00
693cf143a3 Add Unreal/Build/ to gitignore and remove tracked build artifacts
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 18:20:33 +02:00
7a008c7e60 Fix packaged build: weak ptr timing, factory module, hard refs, brace fix
Critical fixes for packaged builds:
- Widget weak ptrs (SpawnManager/SceneSerializer) are null in packaged due to
  HUD deferred init. All button lambdas now get references fresh from
  PlayerController via GetOwningPlayer() cast instead of cached weak ptrs.
- HUD BeginPlay deferred by one tick (SetTimerForNextTick) to ensure
  PlayerController has initialized SpawnManager before wiring.

Module split:
- Factories moved to separate PS_EditorTools module (Type: Editor)
  to fix UHT error with UFactory in packaging builds.
- PS_Editor module no longer depends on UnrealEd for factories.

Asset references:
- TSoftObjectPtr/TSoftClassPtr changed to TObjectPtr/TSubclassOf for
  MasterCatalog, SpawnCatalogs, and ActorClass entries. Hard references
  ensure assets are cooked in packaged builds.

Other fixes:
- GetActorLabel() replaced with GetClass()->GetName() (editor-only API)
- Missing brace in Browse dialog BaseLevel sync code
- BaseLevel sync only when scenario specifies a LevelName (no more clearing on empty)
- Save As dialog with native Windows file picker
- Debug info in catalog UI when empty (shows chain: Master→Catalogs→Entries)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 18:17:52 +02:00
aa4313057c Fix editor restore: init order, combo callback, scenario name
- SceneSerializer created before subsystem check (was nullptr crash)
- ComboBox OnSelectionChanged ignores ESelectInfo::Direct (programmatic)
  to prevent NativeConstruct from clearing the just-loaded scenario
- SaveNameField restored from LastEditedScenarioName on return
- Added ReturnToEditor/OpenEditor to GameInstanceSubsystem
- EditorMapName auto-saved on Play for return navigation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 16:23:32 +02:00
9c43fd523a Standalone editor: scenario workflow, BaseLevel combo, ReturnToEditor
Editor workflow:
- Removed auto-detection of BaseLevel (strip _Editor). Editor is standalone.
- User selects BaseLevel from ComboBox (populated from MasterCatalog.BaseLevels)
- "None" option for editing without a base level
- Selecting BaseLevel: clears current scenario, hides persistent level actors,
  loads sublevel. Selecting "None" restores persistent level actors.

UI terminology: Scene → Scenario (save field, buttons, notifications)

GameInstanceSubsystem:
- Renamed PendingSceneName → PendingScenarioName
- Added LastEditedScenarioName/LastEditedBaseLevel (persist after Consume)
- SetPendingScenario() stores in both Pending and LastEdited
- ReturnToEditor() restores Pending from LastEdited, opens editor map
- EditorMapName auto-saved on first Play, used by ReturnToEditor
- OpenEditor() / ReturnToEditor() callable from gameplay BP

Play button: resets input mode before OpenLevel (fixes cursor in FirstPerson GM)

Test assets: FirstPerson template for testing Play/ReturnToEditor flow

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 16:12:10 +02:00
472811b858 Add PROSERVE integration: sublevel loading, Play button, GameInstance subsystem
Architecture for single editor map workflow:
- MasterCatalog.BaseLevels lists available base levels
- BaseLevel selector in UI (cycle button) loads selected level as sublevel
- Sublevel provides visual context only — save/load only touches PS_Editor objects
- No auto-load at startup: user picks via UI or PROSERVE sets via subsystem

GameInstanceSubsystem (survives OpenLevel):
- PendingSceneName + PendingBaseLevel set by PROSERVE before opening editor
- Editor reads them at BeginPlay: loads sublevel + scene automatically
- ConsumePendingScene() for gameplay side to read and clear

Play button:
- Auto-saves current scene
- Stores scene name in GameInstanceSubsystem
- Opens the BaseLevel via OpenLevel

SceneLoader:
- bStripEditorComponents parameter (default true) removes Spawnable/Editable
  components after load for clean gameplay actors

SceneData v3: LevelName field associates scenes with base levels.
Scene list filtered by selected BaseLevel.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 15:32:43 +02:00
aafcbbb7f9 Add BaseLevelNameOverride for dedicated editor maps
PlayerController gets a BaseLevelNameOverride property. When set (e.g. "Warehouse"),
scenes are tagged with that level name instead of the auto-detected map name.

Use case: editing on "Warehouse_Editor" map but scenes should be associated
with the "Warehouse" base level for PROSERVE runtime loading.

Save, load list, and scene filtering all respect this override.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 12:01:43 +02:00
4dc0f400b4 Add level-based scene organization and filtering
SceneData now includes LevelName field (auto-detected from current map on save).
Version bumped to 3. Backward compatible (empty LevelName for old files).

SceneLoader:
- GetSavedSceneNames(LevelFilter) filters by associated level
- GetSceneLevelName() reads level association without full parse
- GetSavedSceneNamesForCurrentLevel() convenience for game code

Editor UI:
- Scene list grouped: "This level" (highlighted) + "Other levels" (dimmed)
- Shows current level name above the list

PROSERVE integration pattern:
  // List scenarios for current level
  auto Scenes = UPS_Editor_SceneLoader::GetSavedSceneNamesForCurrentLevel(this);
  // Load a specific scenario
  UPS_Editor_SceneLoader::LoadScene(this, "Scenario_A", OutActors);

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 11:43:00 +02:00
77f2da027e Add standalone SceneLoader for game runtime initialization
UPS_Editor_SceneLoader is a BlueprintFunctionLibrary that loads PS_Editor
JSON scenes without any editor infrastructure (no PlayerController, Gizmo,
SelectionManager, or UI required).

Usage from any GameMode:
  TArray<AActor*> Actors;
  UPS_Editor_SceneLoader::LoadScene(this, "MyScene", Actors);

Handles: class loading (BP + C++), transforms, custom editable properties
via reflection (ImportText), and spline point data. All functions are
BlueprintCallable for BP GameMode usage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 11:32:09 +02:00
861c15c193 Unify spline creation/editing into single seamless mode
Major UX simplification:
- Removed SplineEditing mode — single SplinePlacement mode handles both
  creation and editing with identical behavior
- Actor spawned and tracked on first click (no "finish" step needed)
- Each point add/insert/move has individual undo
- Right-click always = camera fly (no special handling during creation)
- Escape/Done just exits edit mode, nothing to "finish"

Catalog system:
- MasterCatalog DataAsset groups multiple SpawnCatalogs (Tools, Characters, Props)
- PlayerController references one MasterCatalog instead of single catalog
- SpawnManager.AddCatalog() loads sub-catalogs incrementally
- Factory for MasterCatalog creation in Content Browser

Spline polish:
- SplineActor has built-in SpawnableComponent + EditableComponent
- SplineColor/SplineSelectedColor/SplineTag as UPROPERTY for BP variants
- All spline point operations use World coordinate space (fixes snap-to-ground)
- Snap-to-ground ignores gizmo actor (was hitting gizmo guide lines)
- Tube mesh collision forced with UpdateBounds after CreateMeshSection
- Tube insert and handle selection include active placement actor (not just selected)
- Notification bar shows contextual Delete Point button when CP selected

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 11:06:04 +02:00
ca4f7ee355 Refactor spline system with IPS_Editor_PointPlaceable interface
Architecture:
- New IPS_Editor_PointPlaceable interface for any actor using click-to-place-
  points placement. Decouples the placement system from SplineActor so future
  actors (patrol routes, area polygons) can reuse the same flow.
- SplineActor implements the interface. BP subclasses with SpawnableComponent
  appear in the catalog and automatically enter placement mode when spawned.
- PlayerController methods renamed: BeginPointPlacement/FinishPointPlacement/
  CancelPointPlacement (generic, interface-driven).

Features added:
- SplineColor, SplineSelectedColor, SplineTag as UPROPERTY for BP overrides
- UpdateSplineMaterials() for runtime color changes
- Tube visualization (8-segment cylinder) replacing cross-ribbon
- Spline editing mode with Edit/Done buttons in notification bar
- Delete spline point (Del key or Delete Point button, min 2 points)
- Insert point by clicking on tube mesh in edit mode
- Snap spline point to ground (End key)
- Append points to existing spline (S key or catalog when spline selected)
- Notification bar: contextual messages and buttons per mode
- Auto-generated M_PS_Editor_SplineLine material (unlit opaque, depth tested)
- Material swap: opaque when deselected, no-depth-test when selected
- Serialization of SplineColor/SplineTag in CustomProperties

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 09:44:26 +02:00
1f4b3994ff Add runtime spline creation and editing (WIP)
Spline placement: New Spline button (S key) enters placement mode where clicks
add control points. Right-click/Enter finishes, Escape cancels. Min 2 points.
Spline visualization as cross-shaped quad strip (vertical + horizontal ribbons).

Point editing: select spline to show handles, click a handle to position gizmo
on it, then use translate gizmo to move individual points. Undo supported via
full-state snapshots (SplinePointAction).

Visual feedback: auto-generated M_PS_Editor_SplineLine material (unlit opaque
with depth test) for normal state. Gizmo material (no depth test) for selected
state. Center cube at centroid for whole-spline selection. Handles highlight
on selection.

Serialization: spline points exported to CustomProperties (PointCount + Point_N).
C++ class fallback via FindObject for LoadScene. Spline appears in scene outliner.

Still WIP: depth material swap on selection, serialization edge cases, and
point editing polish to be refined.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 22:44:04 +02:00
50087e5dfb Add runtime property editing, scene outliner, and spawned-only selection
Property Editing:
- New EditableComponent with two-step dropdown (Select Component → Add Property)
  to declare which properties are exposed in the runtime editor
- Dynamic property panel below Transform: supports float, bool, string, FVector,
  FRotator, FLinearColor with per-tick refresh and keyboard focus guard
- PropertyAction undo/redo via ExportText/ImportText reflection
- Custom properties serialized to JSON (TMap in ActorData, version 2)
- Copy/paste/duplicate propagate custom property values

Scene Outliner:
- Scrollable list of spawned actors in the right panel
- Click to select, selected actor highlighted in blue
- Auto-refreshes when actors are added/removed

Selection Filter:
- Only actors spawned by the editor (catalogue, duplicate, paste, load)
  are selectable — static scene geometry is no longer clickable

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 21:15:07 +02:00
11945e90d2 Add duplicate (Ctrl+D) and copy/paste (Ctrl+C/V) with undo support
Duplicate clones selected actors with a small offset and selects the copies.
Copy stores actor class and relative transforms in an internal clipboard.
Paste spawns clipboard contents in front of the camera preserving relative positions.
All operations are tracked by SpawnManager and fully undoable/redoable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 13:08:13 +02:00
7ef566f3f3 Update test level and engine config
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 12:51:13 +02:00
b33b7cf9d3 Revert rotation to simple perpendicular approach
The magnitude+sign approach caused confusing direction changes.
Back to perpendicular-only: only the mouse axis perpendicular to
the projected rotation axis drives rotation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 12:46:49 +02:00
76d2ccd249 Update project memory with Phase 2 gizmo details
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 12:46:02 +02:00
8dba2ab0fc Add World/Local space toggle, snap system, and gizmo polish
World/Local:
- Toggle button in toolbar (World/Local)
- Local mode: translate/rotate gizmo aligns with actor's local axes
- Rotation arcs dynamically follow local orientation during drag
- Scale always in local space
- RefreshGizmoOrientation after every drag completion

Snap System:
- Toggle button + configurable value field in toolbar
- Translation: snaps displacement along axis (no world-grid staircase)
- Rotation: snaps accumulated angle to nearest increment
- Scale: snaps scale values

Rotation improvements:
- Screen-space direction with magnitude-based speed (all mouse axes contribute)
- Fixed axis direction stored at drag start (prevents feedback loop)
- Smooth fallback when camera looks along rotation axis
- Keyboard shortcuts: Z/E/R (AZERTY convention)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 12:45:12 +02:00
48505bfb82 Add rotation arc rings, scale cubes, and gizmo improvements
Rotation gizmo:
- Quarter-arc rings via UProceduralMeshComponent (3D solid with depth)
- Dynamic arc facing: arcs flip to face camera based on octant
- Grey guide lines from center to arc endpoints
- Screen-space rotation direction (correct from any camera angle)

Scale gizmo:
- Arrow shafts + cube tips for per-axis scale
- Center cube (grey) for uniform XYZ scale
- Local space orientation (gizmo aligns with actor rotation)

Other:
- Runtime confirmation dialog (replaces FMessageDialog)
- ProceduralMeshComponent plugin dependency added

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 11:47:03 +02:00
03c79a2610 Add auto-generated selection outline post-process and gizmo polish
Selection Outline:
- Post-process material auto-generated in C++ (no manual UE editor work)
- 8-neighbor edge detection on CustomStencil buffer
- Dynamic pixel-accurate offsets via SceneTexture InvSize (any resolution/ratio)
- Lerp blending (no overexposure), color AF1500, 1px thickness
- BL_SceneColorAfterDOF placement (before TAA, matches stencil resolution)
- Deferred creation via OnPostEngineInit (no startup crash)
- Material saved as persistent .uasset, loaded at runtime

Gizmo Polish:
- Arrow shaft thickness halved (0.03), cone tips halved (0.075x0.1)
- Gizmo stays at initial position during rotation/scale (no jitter)
- Gizmo follows selection during translation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 10:36:53 +02:00
88544c4c85 Update project memory and CLAUDE.md to reflect Phases 1-4 completion
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 22:31:08 +02:00
5be3a777f9 Add selection outline post-process setup (material pending)
- PostProcessComponent on Pawn (unbound, applies to entire scene)
- Auto-loads M_PS_Editor_SelectionOutline material at BeginPlay
- Removed debug bounding box from Tick
- Custom depth stencil already toggled on selected actors
- Material needs to be created in UE editor (edge detection on CustomStencil)
- Instructions: use TexCoord + Constant2Vector offsets for 4-neighbor sampling

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 21:28:24 +02:00
36b04bee61 Add Phase 4: JSON scene save/load system
Serialization:
- SceneData USTRUCT with Version, SceneName, Timestamp, Actors array
- ActorData: ClassPath, Location, Rotation, Scale per spawned actor
- SceneSerializer: SaveScene/LoadScene/ClearScene/GetSavedSceneNames
- Files stored in Saved/PS_Editor/Scenes/{name}.json
- Uses FJsonObjectConverter for clean USTRUCT-to-JSON conversion

SpawnManager:
- Tracks all spawned actors in SpawnedActors array
- SpawnActorDirect: spawn from class/transform (used by scene loading)
- DestroyAllSpawnedActors: clean scene clear

UI:
- Save field + button in toolbar area
- New Scene button to clear all spawned actors
- Saved scenes list with click-to-load
- Auto-refreshes scene list after save
- Clears selection on load/new

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 20:31:15 +02:00
9f1604f57c Add Phase 3: object spawn system with catalogue UI
Spawn System:
- SpawnableComponent: marker component for Blueprint actors (name, category, thumbnail)
- SpawnCatalog DataAsset: lists all spawnable Blueprints with Factory for easy creation
- SpawnManager: loads catalog, spawns actors in front of camera, ensures Movable mobility
- Reads metadata from Blueprint component templates (no temp spawn needed)

Catalogue UI:
- Left panel with scrollable list grouped by category
- Thumbnail cards (80x80) with name below, click to spawn
- "Capture All Thumbnails" button on DataAsset: auto-generates from UE thumbnails

Undo/Redo improvements:
- SpawnAction: undo hides spawned actor, redo shows it
- Delete confirmation dialog (Yes/No) before soft-delete
- Undo/redo auto-deselects hidden actors and refreshes gizmo
- Proper cleanup of hidden actors when actions pruned from stack

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 20:17:57 +02:00
ccb154c44f Add undo/redo system, properties panel, and toolbar UI
Undo/Redo:
- Custom runtime UndoManager (UE transaction system is editor-only)
- Ctrl+Z / Ctrl+Y hotkeys, action stack with 50 history limit
- Records: gizmo translate/rotate/scale, snap to ground, UI edits
- Soft-delete on Delete key (hide actor, undo restores it)
- Gizmo follows restored position on undo/redo

UI:
- Properties panel (right side): editable Location/Rotation/Scale fields
- Real-time updates during gizmo drag, manual input with Enter to apply
- Toolbar: Translate(E)/Rotate(R)/Scale(T) buttons + Snap Ground
- Mode indicator in title bar, updated help text with all shortcuts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 19:11:40 +02:00
20017ff3fd Add snap to ground, screen-space rotate/scale, and input refinements
- End key snaps selected actors to ground (downward trace + bounds offset)
- Rotate/Scale now use screen-space mouse delta (X+Y combined) for intuitive control
- Accumulator-based drag for smooth incremental rotation and scaling
- Fixed rotation drag plane (perpendicular to axis instead of parallel)
- Movement: arrows + A (up) / Q (down), letter keys freed for hotkeys

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 18:49:04 +02:00
30c0078a1d Add rotate/scale gizmo modes, hotkeys, and delete
- E/R/T hotkeys to switch Translate/Rotate/Scale modes
- Rotate: drag gizmo axis to rotate selection around that axis
- Scale: drag gizmo axis to scale selection on that axis
- Delete key to destroy selected actors
- Movement keys: arrows only + A (up) / Q (down)
- Removed ZQSD movement to free letter keys for hotkeys

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 15:47:20 +02:00
7884d1de59 Add gizmo drag interaction and hover highlighting
- Click+drag on gizmo arrows to translate selected actors along axis
- Drag plane computation based on axis direction and camera orientation
- Axis-constrained movement with initial transform preservation
- Hover highlighting: gizmo arrows turn yellow on mouse-over
- Sphere sweep for easier gizmo clicking (generous hit radius)
- UE editor-style gizmo colors (dark red/green/blue)
- Fixed gizmo visibility toggle (component-level instead of actor-level)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 15:31:40 +02:00
8b2609669f Add Phase 2 selection system and translate gizmo
- Click-to-select with raycast (Movable actors only)
- Ctrl+click for multi-select, click empty to deselect
- Click vs drag detection (pixel threshold) to avoid accidental selection
- SelectionManager owned by PlayerController with OnSelectionChanged delegate
- Custom depth stencil toggling on selected actors
- Debug bounding box visualization for selection
- Custom translate gizmo actor with colored arrows (R/G/B) and cone tips
- Gizmo renders on top of scene (SDPG_Foreground + Translucent depth test disabled)
- Constant screen-size gizmo scaling based on camera distance
- Unlit gizmo material with Color vector parameter (M_PS_Editor_Gizmo)
- r.CustomDepth=3 enabled for future outline post-process

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 15:06:11 +02:00
cf1e2f8ccf Add .gitignore for plugin build artifacts and remove tracked binaries
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 12:34:42 +02:00
b089a20512 Add PS_Editor plugin Phase 1: GameMode + Camera navigation
Runtime editor plugin with UE viewport-style camera controls:
- ZQSD/Arrows movement (always active), E/A for up/down
- LMB: pan (horizontal move + yaw), RMB: free fly look
- Alt+LMB / MMB: orbit around focal point, scroll: zoom
- HUD with controls help, cursor auto-hide during camera ops

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 12:33:55 +02:00
17e8d5b194 Initial Commit 2026-04-10 11:40:15 +02:00