Engine → Assets → asset_importer.h
import_context
| Type | Class |
| Namespace | conjure::assets |
| Include File Path | engine/include/conjure/assets/asset_importer.h |
| Source File Path | engine/src/assets/asset_importer.cpp |
| API ↗ | Database, importers and hot reload, Assets |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | import_context(
core::vfs::file_system &fileSystem,
std::string assetPath,
std::string filePath,
std::span<const std::byte> sourceBytes,
core::json::value settings,
std::string platform,
const asset_id &primaryId,
sub_asset_table &subAssets,
asset_path_resolver resolver); |
Important
Copy constructor and assignment has been deleted.
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~import_context(); |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mAssetPath | std::string | {} | |
| private | mFilePath | std::string | {} | |
| private | mFileSystem | core::vfs::file_system * | nullptr | |
| private | mPlatform | std::string | {} | |
| private | mPrimaryId | asset_id | {} | |
| private | mResolver | asset_path_resolver | {} | |
| private | mSettings | core::json::value | {} | |
| private | mSideFiles | std::vector<std::string> | {} | |
| private | mSourceBytes | std:: | {} | |
| private | mSubAssets | sub_asset_table * | nullptr | |
| private | mWarnings | std::vector<std::string> | {} |
Functions
Public
add_warning
add_warningvoid add_warning(
std::string message);Records a non-fatal message that ends up in the import report and the import log.
find_asset_by_path
find_asset_by_path[[nodiscard]] std::optional<asset_id> find_asset_by_path(
std::string_view path) const;Uuid of another source of the project by asset path ("assets://textures/a.png") or by a path relative to this source's directory ("textures/a.png").
platform
platform[[nodiscard]] std::string_view platform() const noexcept;Target platform: "windows", "linux" or "macos".
primary_id
primary_id[[nodiscard]] const asset_id &primary_id() const noexcept;Uuid of the primary asset (the source file itself).
read_side_file
read_side_file[[nodiscard]] core::result<std::vector<std::byte>> read_side_file(
std::string_view relativePath);Reads a file next to the source (relative to the source's directory) and records it as a side file (even when the read fails, so a missing side file is watched): hashed into the source hash and watched for changes.
settings
settings[[nodiscard]] const core::json::value &settings() const noexcept;The importer settings from the .meta (an object; invalid when the meta had none).
side_files
side_files[[nodiscard]] std::span<const std::string> side_files() const noexcept;Asset paths of every side file asked for so far, including ones that could not be read.
source_bytes
source_bytes[[nodiscard]] std::span<const std::byte> source_bytes() const noexcept;The whole source file.
source_path
source_path[[nodiscard]] std::string_view source_path() const noexcept;The source's asset path, "assets://models/robot.gltf".
sub_asset_id
sub_asset_id[[nodiscard]] asset_id sub_asset_id(
std::string_view subPath);Stable uuid for a named sub-asset; allocated on first use, persisted to the meta.
warnings
warnings[[nodiscard]] std::span<const std::string> warnings() const noexcept;