RaptorModelStore
RAPTOR's built-in model store, used when no model provider fills the RaptorModelStorageSlots slots.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.EditorTools | Raptor.Editor | class | preview, since 0.1.0 |
A model provider replaces whole actions but can call the low-level helpers here, which the built-in store also uses.
public static class RaptorModelStoreFields
NoProvider
public const string NoProvider;The refusal message shown when the project is set to "Provider only" and no provider fills the action.
ProviderOnlyKey
public const string ProviderOnlyKey;The project settings key for the Model storage setting. The value is true for Provider only. A missing key means Built-in.
Properties
ModelsRoot
public static string ModelsRoot { get; }The folder for saved models, stored as <ModelsRoot>/<name>/<name>.prefab. Same as RaptorModelStorageSlots.ModelsRoot.
ProviderOnly
public static bool ProviderOnly { get; set; }Whether the Model storage setting is "Provider only". When true, an empty RaptorModelStorageSlots slot refuses its action instead of using the built-in store. Read from the project settings, and false when the key is missing. Setting it changes the in-memory value only. Call RaptorProjectSettings.Save to persist it.
Methods
ConfirmReplace
public static bool ConfirmReplace(string name, out string notice)Asks the user before a save replaces a different model saved under name. A model provider's save calls this after finding that the saved model is a different one. In batch mode, returns false without asking.
| Parameter | Type | Description |
|---|---|---|
name | string | The model's name. |
notice | out string | A short message for the user, or null when the user cancelled. |
Returns: True when the save should go ahead and replace the saved model.
Load
public static GameObject Load(string prefabPath, out string notice)Loads the saved model at prefabPath as one undo step. The model is unpacked, placed at the origin and selected. If a room with that name is already in the scene, that room is selected instead.
| Parameter | Type | Description |
|---|---|---|
prefabPath | string | The saved prefab. |
notice | out string | A short message for the user, or null. |
Returns: The scene object, or null.
PrefabPath
public static string PrefabPath(string root, string name)Gets the saved prefab path of name under root.
| Parameter | Type | Description |
|---|---|---|
root | string | The models folder. |
name | string | The model's name. |
Returns: The path.
Rename
public static bool Rename(string oldName, string newName, out string notice)Renames a saved or loaded room everywhere its name is used as a key: the saved prefab and its folder, the baked meshes (Baked/<name>_*) and their folder, and the scene copy. All moves are checked before any is made. If a move still fails, the earlier moves are reverted. The prefab keeps its GUID, so it stays in its category. The scene copy's undo history is cleared, because undoing to the old name would separate the room from its renamed saved source.
| Parameter | Type | Description |
|---|---|---|
oldName | string | The current name. |
newName | string | The new name. |
notice | out string | A short message for the user, or null. |
Returns: False when refused.
RenameRefusal
public static string RenameRefusal(string oldName, string newName)Gets a short reason why oldName cannot be renamed to newName, or null when it can.
| Parameter | Type | Description |
|---|---|---|
oldName | string | The current name. |
newName | string | The new name. |
Returns: The reason, or null when it can.
RequireProvider
public static void RequireProvider()Call once from a model provider's load hook. If the Model storage setting has never been set, this sets the project to "Provider only" and saves it. After that, if the provider's code fails to load, Save and Load are refused instead of falling back to the built-in store, which lacks the provider's steps. A choice already made on the settings page is kept. Runs on EditorApplication.delayCall, waits until Play mode ends, and does nothing in batch mode. Safe to call more than once.
Save
public static bool Save(RaptorModel model, out string notice)Saves model to ModelsRoot. Bakes the model if it is stale, verifies and heals its colliders, writes the prefab and checks it on disk. Asks first if a different model is already saved under this name. If the user cancels a dialog, returns false and leaves notice null.
| Parameter | Type | Description |
|---|---|---|
model | RaptorModel | The model. |
notice | out string | A short message for the user, or null. |
Returns: False when not saved.
SaveAndUnload
public static bool SaveAndUnload(RaptorModel model, out string notice)Saves the model, then removes the scene copy. The removal cannot be undone. If the save fails, the scene copy is kept.
| Parameter | Type | Description |
|---|---|---|
model | RaptorModel | The model. |
notice | out string | A short message for the user, or null. |
Returns: False when not saved.
VerifyOrHealColliders
public static bool VerifyOrHealColliders(GameObject root, string context)Checks that every baked mesh collider under the model has its mesh, and restores any missing mesh from the canonical mesh. A saved model without collider meshes renders but has no collision.
| Parameter | Type | Description |
|---|---|---|
root | GameObject | The model's root object. |
context | string | A label for the log. |
Returns: True when every collider has its mesh.
Related types
- RaptorModelStorageSlots: Slots a model provider fills to replace Save, Save & unload, Load and Rename.
- RaptorProjectSettings: RAPTOR's per-project settings file and the section registry for Project Settings → RAPTOR.