mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-21 00:25:44 +00:00
Fix StructuredDataDefDumper not dumping empty structs or arrays
This commit is contained in:
parent
8aba79faf9
commit
5327ce8ec9
@ -111,23 +111,23 @@ bool AssetDumperStructuredDataDefSet::ShouldDump(XAssetInfo<StructuredDataDefSet
|
|||||||
|
|
||||||
void AssetDumperStructuredDataDefSet::DumpEnum(StructuredDataDefDumper& dumper, const int enumIndex, const StructuredDataEnum* _enum)
|
void AssetDumperStructuredDataDefSet::DumpEnum(StructuredDataDefDumper& dumper, const int enumIndex, const StructuredDataEnum* _enum)
|
||||||
{
|
{
|
||||||
if (!_enum->entries || _enum->entryCount <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "ENUM_" << enumIndex;
|
ss << "ENUM_" << enumIndex;
|
||||||
|
|
||||||
dumper.BeginEnum(ss.str(), static_cast<size_t>(_enum->entryCount), static_cast<size_t>(_enum->reservedEntryCount));
|
dumper.BeginEnum(ss.str(), static_cast<size_t>(_enum->entryCount), static_cast<size_t>(_enum->reservedEntryCount));
|
||||||
|
|
||||||
for (auto i = 0; i < _enum->entryCount; i++)
|
if(_enum->entries && _enum->entryCount > 0)
|
||||||
{
|
{
|
||||||
const auto& entry = _enum->entries[i];
|
for (auto i = 0; i < _enum->entryCount; i++)
|
||||||
|
{
|
||||||
|
const auto& entry = _enum->entries[i];
|
||||||
|
|
||||||
assert(entry.string);
|
assert(entry.string);
|
||||||
if (!entry.string)
|
if (!entry.string)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dumper.WriteEnumEntry(entry.string, entry.index);
|
dumper.WriteEnumEntry(entry.string, entry.index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dumper.EndEnum();
|
dumper.EndEnum();
|
||||||
@ -244,9 +244,6 @@ void AssetDumperStructuredDataDefSet::DumpProperty(StructuredDataDefDumper& dump
|
|||||||
|
|
||||||
void AssetDumperStructuredDataDefSet::DumpStruct(StructuredDataDefDumper& dumper, const size_t structIndex, const StructuredDataStruct* _struct, const StructuredDataDef* def, const int rootStructIndex)
|
void AssetDumperStructuredDataDefSet::DumpStruct(StructuredDataDefDumper& dumper, const size_t structIndex, const StructuredDataStruct* _struct, const StructuredDataDef* def, const int rootStructIndex)
|
||||||
{
|
{
|
||||||
if (!_struct->properties || _struct->propertyCount <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::string structName;
|
std::string structName;
|
||||||
if (static_cast<int>(structIndex) == rootStructIndex)
|
if (static_cast<int>(structIndex) == rootStructIndex)
|
||||||
{
|
{
|
||||||
@ -263,11 +260,14 @@ void AssetDumperStructuredDataDefSet::DumpStruct(StructuredDataDefDumper& dumper
|
|||||||
dumper.WriteLineComment("Size: "s + std::to_string(_struct->size));
|
dumper.WriteLineComment("Size: "s + std::to_string(_struct->size));
|
||||||
dumper.BeginStruct(structName, static_cast<size_t>(_struct->propertyCount));
|
dumper.BeginStruct(structName, static_cast<size_t>(_struct->propertyCount));
|
||||||
|
|
||||||
for (auto i = 0; i < _struct->propertyCount; i++)
|
if(_struct->properties && _struct->propertyCount > 0)
|
||||||
{
|
{
|
||||||
const auto& property = _struct->properties[i];
|
for (auto i = 0; i < _struct->propertyCount; i++)
|
||||||
|
{
|
||||||
|
const auto& property = _struct->properties[i];
|
||||||
|
|
||||||
DumpProperty(dumper, property, def, rootStructIndex);
|
DumpProperty(dumper, property, def, rootStructIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dumper.EndStruct();
|
dumper.EndStruct();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user