载入中...
搜索中...
未找到
EvaAssetDatabaseProjection.cpp
浏览该文件的文档.
2
3#include <algorithm>
4
5namespace eve::editor {
6namespace {
7
9 switch (kind) {
16 }
18}
19
20AssetGuid guid(const AssetRef& asset) { return AssetGuid(asset.id().format()); }
21
22} // namespace
23
25 MemoryAssetDatabase& database, const asset::EvaManifest& manifest, std::string archiveUri,
26 std::string importerId) {
27 if (archiveUri.empty() || importerId.empty())
28 return eve::editing::failed<std::vector<AssetRecord>>(
29 EditorStatus::Rejected, RuleId("editor.asset.eva-projection.invalid-source"),
30 "Eva projection requires an archive URI and importer identity");
31 std::vector<AssetPublication> publications;
32 publications.reserve(manifest.assets.size());
33 for (const asset::EvaAssetEntry& source : manifest.assets) {
34 AssetPublication publication;
35 publication.record.guid = guid(source.asset);
36 publication.record.logicalUri = source.asset.format();
37 publication.record.typeId = source.type;
38 publication.record.schemaVersion = static_cast<std::uint32_t>(source.schemaVersion.value());
39 publication.record.sourceUri = archiveUri + "#" + source.definition;
40 publication.record.sourceHash = source.contentHash;
41 publication.record.importerId = importerId;
42 publication.record.importerVersion = 1;
43 publication.record.tags = source.tags;
45 {"packageId", EditorValue(manifest.packageId.format())},
46 {"packageName", EditorValue(manifest.packageName)},
47 {"packageVersion", EditorValue(manifest.packageVersion)},
48 {"definition", EditorValue(source.definition)},
49 };
50 for (const asset::EvaDependency& sourceDependency : manifest.dependencies) {
51 if (sourceDependency.from != source.asset) continue;
52 publication.dependencies.push_back(
53 {guid(sourceDependency.from), guid(sourceDependency.to), projectionKind(sourceDependency.kind),
54 PropertyPath(sourceDependency.path.empty() ? "dependency" : sourceDependency.path)});
55 }
56 std::sort(publication.dependencies.begin(), publication.dependencies.end(),
57 [](const AssetDependency& left, const AssetDependency& right) {
58 if (left.to != right.to) return left.to < right.to;
59 return left.sourceProperty < right.sourceProperty;
60 });
61 publications.push_back(std::move(publication));
62 }
63 return database.publishBatch(std::move(publications));
64}
65
66} // namespace eve::editor
Editor-side atomic projection of canonical .eva manifests.
HexVec3 left
HexVec3 right
TokenKind kind
const UnitySourceAsset & source
Move-only operation result carrying either a value or Status.
Definition Result.h:155
std::string format() const
Formats the ID in lower-case canonical UUID text.
Definition Identity.h:173
std::map< std::string, Value > Object
Thread-neutral in-memory asset index used by editor hosts and tests.
Result< std::vector< AssetRecord > > publishBatch(std::vector< AssetPublication > publications)
Validate and atomically publish an entire package projection as one index generation.
EvaDependencyKind
Dependency role recorded by a source asset archive.
Definition EvaManifest.h:21
DependencyKind
Semantic relationship used for dependency closure and deletion planning.
eve::editing::Value EditorValue
Compatibility alias for the UI-independent authoring value tree.
Definition EditorValue.h:8
eve::editing::PropertyPath PropertyPath
Definition EditorIds.h:37
eve::editing::RuleId RuleId
Definition EditorIds.h:32
Result< std::vector< AssetRecord > > publishEvaAssetProjection(MemoryAssetDatabase &database, const asset::EvaManifest &manifest, std::string archiveUri, std::string importerId)
Project every asset and dependency in one validated .eva manifest as one database generation.
eve::editing::AssetGuid AssetGuid
Definition EditorIds.h:39
One typed asset definition in an .eva archive.
Definition EvaManifest.h:34
One directed dependency between stable asset identities.
Definition EvaManifest.h:44
Validated, owning .eva manifest.
Definition EvaManifest.h:62
std::vector< EvaAssetEntry > assets
Definition EvaManifest.h:69
std::vector< EvaDependency > dependencies
Definition EvaManifest.h:70
std::string packageVersion
Definition EvaManifest.h:68
Directed dependency between two stable asset identities.
One owning record/dependency unit staged for an atomic index generation.
std::vector< AssetDependency > dependencies
std::vector< std::string > tags