[studio] FileInfo: Rename ID to Asset ID, allow for no value of fields
All checks were successful
Build / build (push) Successful in 1m12s
All checks were successful
Build / build (push) Successful in 1m12s
This commit is contained in:
@@ -15,10 +15,10 @@ ox::Error FileInfo::open(ox::StringParam filePath) noexcept {
|
|||||||
auto &fs = m_sctx.project->romFs();
|
auto &fs = m_sctx.project->romFs();
|
||||||
auto const fileBuff = fs.read(m_filePath).or_value({});
|
auto const fileBuff = fs.read(m_filePath).or_value({});
|
||||||
auto hdr = keel::readAssetHeader(fileBuff).or_value({});
|
auto hdr = keel::readAssetHeader(fileBuff).or_value({});
|
||||||
m_fileInfo.id = hdr.uuid.toString();
|
m_fileInfo.assetId.emplace(hdr.uuid.toString());
|
||||||
m_fileInfo.typeName = std::move(hdr.clawHdr.typeName);
|
m_fileInfo.typeName.emplace(std::move(hdr.clawHdr.typeName));
|
||||||
m_fileInfo.typeVersion = hdr.clawHdr.typeVersion;
|
m_fileInfo.typeVersion.emplace(hdr.clawHdr.typeVersion);
|
||||||
m_fileInfo.format = [&hdr] {
|
m_fileInfo.format.emplace([&hdr] {
|
||||||
switch (hdr.clawHdr.fmt) {
|
switch (hdr.clawHdr.fmt) {
|
||||||
case ox::ClawFormat::Metal:
|
case ox::ClawFormat::Metal:
|
||||||
return ox::StringLiteral{"Metal Claw"};
|
return ox::StringLiteral{"Metal Claw"};
|
||||||
@@ -27,8 +27,8 @@ ox::Error FileInfo::open(ox::StringParam filePath) noexcept {
|
|||||||
default:
|
default:
|
||||||
return ox::StringLiteral{"Other"};
|
return ox::StringLiteral{"Other"};
|
||||||
}
|
}
|
||||||
}();
|
}());
|
||||||
m_fileInfo.dataSize = hdr.clawHdr.dataSize;
|
m_fileInfo.dataSize.emplace(hdr.clawHdr.dataSize);
|
||||||
Popup::open();
|
Popup::open();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -81,37 +81,56 @@ void FileInfo::drawTable() const noexcept {
|
|||||||
ImGuiTableFlags_RowBg)) {
|
ImGuiTableFlags_RowBg)) {
|
||||||
ImGui::TableSetupColumn("Field", ImGuiTableColumnFlags_WidthFixed, 70);
|
ImGui::TableSetupColumn("Field", ImGuiTableColumnFlags_WidthFixed, 70);
|
||||||
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_NoHide);
|
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_NoHide);
|
||||||
// id
|
bool somethingDrew = false;
|
||||||
ImGui::TableNextRow();
|
// asset id
|
||||||
ImGui::TableSetColumnIndex(0);
|
if (m_fileInfo.assetId) {
|
||||||
ImGui::Text("ID:");
|
ImGui::TableNextRow();
|
||||||
ImGui::TableSetColumnIndex(1);
|
ImGui::TableSetColumnIndex(0);
|
||||||
ImGui::Text("%s", m_fileInfo.id.c_str());
|
ImGui::Text("Asset ID:");
|
||||||
|
ImGui::TableSetColumnIndex(1);
|
||||||
|
ImGui::Text("%s", m_fileInfo.assetId->c_str());
|
||||||
|
somethingDrew = true;
|
||||||
|
}
|
||||||
// typeName
|
// typeName
|
||||||
ImGui::TableNextRow();
|
if (m_fileInfo.typeName) {
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableNextRow();
|
||||||
ImGui::Text("Type Name:");
|
ImGui::TableSetColumnIndex(0);
|
||||||
ImGui::TableSetColumnIndex(1);
|
ImGui::Text("Type Name:");
|
||||||
ImGui::Text("%s", m_fileInfo.typeName.c_str());
|
ImGui::TableSetColumnIndex(1);
|
||||||
|
ImGui::Text("%s", m_fileInfo.typeName->c_str());
|
||||||
|
somethingDrew = true;
|
||||||
|
}
|
||||||
// typeVersion
|
// typeVersion
|
||||||
ImGui::TableNextRow();
|
if (m_fileInfo.typeVersion) {
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableNextRow();
|
||||||
ImGui::Text("Type Version:");
|
ImGui::TableSetColumnIndex(0);
|
||||||
ImGui::TableSetColumnIndex(1);
|
ImGui::Text("Type Version:");
|
||||||
ImGui::Text("%d", m_fileInfo.typeVersion);
|
ImGui::TableSetColumnIndex(1);
|
||||||
|
ImGui::Text("%d", *m_fileInfo.typeVersion);
|
||||||
|
somethingDrew = true;
|
||||||
|
}
|
||||||
// format
|
// format
|
||||||
ImGui::TableNextRow();
|
if (m_fileInfo.format) {
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableNextRow();
|
||||||
ImGui::Text("Format:");
|
ImGui::TableSetColumnIndex(0);
|
||||||
ImGui::TableSetColumnIndex(1);
|
ImGui::Text("Format:");
|
||||||
ImGui::Text("%s", m_fileInfo.format.c_str());
|
ImGui::TableSetColumnIndex(1);
|
||||||
|
ImGui::Text("%s", m_fileInfo.format->c_str());
|
||||||
|
somethingDrew = true;
|
||||||
|
}
|
||||||
// size
|
// size
|
||||||
ImGui::TableNextRow();
|
if (m_fileInfo.dataSize) {
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableNextRow();
|
||||||
ImGui::Text("Data Size:");
|
ImGui::TableSetColumnIndex(0);
|
||||||
ImGui::TableSetColumnIndex(1);
|
ImGui::Text("Data Size:");
|
||||||
ImGui::Text("%lluB", m_fileInfo.dataSize);
|
ImGui::TableSetColumnIndex(1);
|
||||||
|
ImGui::Text("%lluB", *m_fileInfo.dataSize);
|
||||||
|
somethingDrew = true;
|
||||||
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
|
if (!somethingDrew) {
|
||||||
|
ImGui::Text("No information available");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ class FileInfo: public ig::Popup {
|
|||||||
Context &m_sctx;
|
Context &m_sctx;
|
||||||
ox::String m_filePath;
|
ox::String m_filePath;
|
||||||
struct {
|
struct {
|
||||||
ox::UUIDStr id;
|
ox::Optional<ox::UUIDStr> assetId;
|
||||||
ox::String typeName;
|
ox::Optional<ox::String> typeName;
|
||||||
int typeVersion{};
|
ox::Optional<int> typeVersion{};
|
||||||
ox::StringLiteral format;
|
ox::Optional<ox::StringLiteral> format;
|
||||||
// use manual sizing to work with %ull
|
// use manual sizing to work with %ull
|
||||||
unsigned long long dataSize{};
|
ox::Optional<unsigned long long> dataSize{};
|
||||||
} m_fileInfo;
|
} m_fileInfo;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user