Skip to content

feat(asset): auto-import new asset files on filewatch#392

Merged
drsnuggles8 merged 2 commits into
masterfrom
feature/asset-filewatch-autoimport
Jun 25, 2026
Merged

feat(asset): auto-import new asset files on filewatch#392
drsnuggles8 merged 2 commits into
masterfrom
feature/asset-filewatch-autoimport

Conversation

@drsnuggles8

@drsnuggles8 drsnuggles8 commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added automatic processing of newly imported assets detected from filesystem changes.
    • Updated the content browser to refresh the affected directories when new assets are imported.
    • Introduced an editor “asset imported” notification event for listeners.
  • Bug Fixes

    • Improved file-watcher handling to correctly decide between ignoring, importing, or reloading assets based on state and file existence.
    • Ensured registry updates are coalesced to prevent excessive persistence work.
  • Tests

    • Added unit tests for the new file-watch decision logic and the asset imported event behavior.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4b2a684a-b232-4122-ac56-64f3388c6223

📥 Commits

Reviewing files that changed from the base of the PR and between 75a9d5c and 77124ae.

📒 Files selected for processing (2)
  • OloEngine/src/OloEngine/Asset/AssetManager/EditorAssetManager.cpp
  • OloEngine/src/OloEngine/Asset/AssetManager/EditorAssetManager.h

📝 Walkthrough

Walkthrough

The PR adds a file-watch decision policy, auto-imports newly discovered asset files, emits AssetImportedEvent, and updates the editor layer and content browser to react to imported assets.

Changes

Asset import pipeline

Layer / File(s) Summary
File-watch policy
OloEngine/src/OloEngine/Asset/AssetFileWatchPolicy.h, OloEngine/tests/AssetFileWatchPolicyTest.cpp, OloEngine/tests/CMakeLists.txt
FileWatchAction and FileWatchDecisionInput define the watcher decision model, DecideFileWatchAction implements the ignore/import/reload rules, and tests cover each branch.
Imported asset event
OloEngine/src/OloEngine/Events/Event.h, OloEngine/src/OloEngine/Core/Events/EditorEvents.h, OloEngine/tests/AssetLoadedEventTest.cpp
AssetImportedEvent adds the new event payload and metadata, and tests cover its accessors, type identity, category, and dispatcher behavior.
Auto-import dispatch
OloEngine/src/OloEngine/Asset/AssetManager/EditorAssetManager.h, OloEngine/src/OloEngine/Asset/AssetManager/EditorAssetManager.cpp
EditorAssetManager now accepts presence events, routes them through DecideFileWatchAction, reloads tracked assets, auto-imports new files, persists the registry, and dispatches AssetImportedEvent.
Editor refresh
OloEditor/src/EditorLayer.h, OloEditor/src/EditorLayer.cpp, OloEditor/src/Panels/ContentBrowserPanel.h, OloEditor/src/Panels/ContentBrowserPanel.cpp
EditorLayer forwards AssetImportedEvent to ContentBrowserPanel, and the panel maps the imported absolute path to a directory and marks the tree entry dirty.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: automatically importing newly detected asset files from filewatch.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@drsnuggles8

Copy link
Copy Markdown
Owner Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@OloEngine/src/OloEngine/Asset/AssetManager/EditorAssetManager.cpp`:
- Around line 1226-1230: The immediate SerializeAssetRegistry() call in
EditorAssetManager::OnAssetAdded causes a full registry rewrite for every
auto-imported file, which should be coalesced. Update the registry persistence
path in EditorAssetManager so bulk imports only mark the registry dirty and
flush it once per frame or on a short debounce timer, and ensure the actual disk
write still happens through SerializeAssetRegistry() from a single centralized
flush point.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6594135e-d19b-431c-abeb-110d7ee0e834

📥 Commits

Reviewing files that changed from the base of the PR and between 2ad66bb and 75a9d5c.

📒 Files selected for processing (12)
  • OloEditor/src/EditorLayer.cpp
  • OloEditor/src/EditorLayer.h
  • OloEditor/src/Panels/ContentBrowserPanel.cpp
  • OloEditor/src/Panels/ContentBrowserPanel.h
  • OloEngine/src/OloEngine/Asset/AssetFileWatchPolicy.h
  • OloEngine/src/OloEngine/Asset/AssetManager/EditorAssetManager.cpp
  • OloEngine/src/OloEngine/Asset/AssetManager/EditorAssetManager.h
  • OloEngine/src/OloEngine/Core/Events/EditorEvents.h
  • OloEngine/src/OloEngine/Events/Event.h
  • OloEngine/tests/AssetFileWatchPolicyTest.cpp
  • OloEngine/tests/AssetLoadedEventTest.cpp
  • OloEngine/tests/CMakeLists.txt

Comment thread OloEngine/src/OloEngine/Asset/AssetManager/EditorAssetManager.cpp Outdated
@drsnuggles8 drsnuggles8 merged commit 01d726f into master Jun 25, 2026
0 of 3 checks passed
@drsnuggles8 drsnuggles8 deleted the feature/asset-filewatch-autoimport branch June 25, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant