> For the complete documentation index, see [llms.txt](https://gregorigin.gitbook.io/safesave/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gregorigin.gitbook.io/safesave/the-traffic-light/integrations.md).

# Technical Specs

SafeSave is built as a native C++ module (FModuleInterface) that strictly adheres to the Unreal Engine Source Control Abstraction Layer (ISourceControlProvider). It does not rely on external Python scripts, hacked binaries, or screen scraping.

This section outlines the performance characteristics and execution logic for Systems Engineers and Technical Leads.

#### **1. Performance & Tick Policy** <a href="#refheading___toc1129_779260450" id="refheading___toc1129_779260450"></a>

SafeSave **does not** use the standard Tick() for its logic loop. To minimize main-thread overhead, the widget utilizes Slate’s **Active Timer** system.

* **Logic Loop:** RegisterActiveTimer with a **1.0s (1Hz)** interval.
* **Cost:** < 0.05ms per interval on standard hardware.
* **Idle Behavior:** If the Editor is not in focus or slate is sleeping, SafeSave suspends polling automatically.

#### **2. The "Deep Scan" Memory Iterator** <a href="#refheading___toc1131_779260450" id="refheading___toc1131_779260450"></a>

Unlike Content Browser filters which scan the Asset Registry (Disk), SafeSave scans **Memory** to determine the "Dirty" state. This ensures we detect changes to maps and assets the moment they are modified in RAM, even before a file exists on disk.

* **Mechanism:** TObjectIterator\<UPackage>
* **Filtering Strategy:** The scan aggressively culls iteration to prevent scope creep.
  * **Ignores:** /Engine/, /Script/, /Memory/ namespaces.
  * **Ignores:** PKG\_CompiledIn (Code modules) and GetTransientPackage().
  * **Ignores:** World Partition HLODs and WP Editor Cells (\_InstanceOf\_ regex match).
  * **Target:** Only strictly User Content (/Game/, /Plugins/) loaded in the Active World or Content Browser is evaluated.

#### **3. Source Control Agnosticism (API Layer)** <a href="#refheading___toc1133_779260450" id="refheading___toc1133_779260450"></a>

SafeSave is not a Git Client; it is an ISourceControlModule Wrapper.\
It binds to the abstract interface ISourceControlProvider defined in SourceControl module.

<br>

* **EStateCacheUsage::Use:** For 99% of frames, we read from the Provider's local cache (Zero latency).
* **EStateCacheUsage::ForceUpdate:** We force a synchronous update only on user interaction (Click) or periodically (every 3-5s) to validate IsCurrent() status against the remote server.

#### **4. Threading Model** <a href="#refheading___toc1135_779260450" id="refheading___toc1135_779260450"></a>

SafeSave respects the Unreal Engine main thread requirements while offloading network operations.

* **UI Paint:** Runs on Main Thread (Slate).
* **Memory Scan:** Runs on Main Thread (Required for UObject safety).
* **Network Operations:** All calls to CheckForUpdates (git fetch, p4 sync -n) are dispatched using EConcurrency::Asynchronous.
  * This prevents the Editor from "hitching" or freezing while the plugin waits for a slow Git server to respond.

#### **5. Conflict Resolution Pipeline (The Red Light)** <a href="#refheading___toc1137_779260450" id="refheading___toc1137_779260450"></a>

When the "Safe Update" protocol is triggered, SafeSave orchestrates a multi-step dependency chain via FEditorFileUtils:

1. **Flush:** FEditorFileUtils::SaveDirtyPackages() is called with bPromptToSave=false (Implicit Save).
2. **Sync:** FSync operation is dispatched via the Provider.
3. **Merge:** Unreal Engine's native conflict logic (FAssetMergeUtility) detects the binary mismatch between the Local Head and Remote Head.
4. **UI:** The Engine spawns the standard **Visual Merge Tool**, allowing the user to diff properties.

**SafeSave does not implement a custom merging algorithm.** It relies entirely on the Engine's deterministic merge behavior to ensure data integrity.

#### **6. Module Injection** <a href="#refheading___toc1139_779260450" id="refheading___toc1139_779260450"></a>

The UI is injected via UToolMenus into LevelEditor.LevelEditorToolBar.User.

* **Clean Unload:** The module implements ShutdownModule to explicitly unregister the Slate Widget and unbind delegates.
* **No Garbage:** Disabling the plugin completely removes it from the Slate hierarchy; no ghost widgets remain in memory.

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gregorigin.gitbook.io/safesave/the-traffic-light/integrations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
