mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 08:05:45 +00:00
fix: calculate requiring marking for structs even when called recursively
This commit is contained in:
parent
c6c89140b2
commit
3fd17fc6d3
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
bool MarkingRequiredPostProcessor::RequiresMarking(std::unordered_set<const void*>& visitedStructures, const StructureInformation* info)
|
bool MarkingRequiredPostProcessor::CalculateRequiresMarking(std::unordered_set<const void*>& visitedStructures, StructureInformation* info)
|
||||||
{
|
{
|
||||||
if (visitedStructures.find(info) != visitedStructures.end())
|
if (visitedStructures.find(info) != visitedStructures.end())
|
||||||
return info->m_requires_marking;
|
return info->m_requires_marking;
|
||||||
@ -14,7 +14,10 @@ bool MarkingRequiredPostProcessor::RequiresMarking(std::unordered_set<const void
|
|||||||
visitedStructures.emplace(info);
|
visitedStructures.emplace(info);
|
||||||
|
|
||||||
if (info->m_asset_enum_entry)
|
if (info->m_asset_enum_entry)
|
||||||
|
{
|
||||||
|
info->m_requires_marking = true;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto& member : info->m_ordered_members)
|
for (const auto& member : info->m_ordered_members)
|
||||||
{
|
{
|
||||||
@ -43,12 +46,19 @@ bool MarkingRequiredPostProcessor::RequiresMarking(std::unordered_set<const void
|
|||||||
|
|
||||||
// Any ScriptStrings or Strings need to be processed.
|
// Any ScriptStrings or Strings need to be processed.
|
||||||
if (member->m_is_script_string || member->m_type && member->m_type->m_asset_enum_entry)
|
if (member->m_is_script_string || member->m_type && member->m_type->m_asset_enum_entry)
|
||||||
return true;
|
{
|
||||||
|
info->m_requires_marking = true;
|
||||||
if (member->m_type != nullptr && member->m_type != info && RequiresMarking(visitedStructures, member->m_type))
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (member->m_type != nullptr && member->m_type != info && CalculateRequiresMarking(visitedStructures, member->m_type))
|
||||||
|
{
|
||||||
|
info->m_requires_marking = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
info->m_requires_marking = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +69,7 @@ bool MarkingRequiredPostProcessor::PostProcess(IDataRepository* repository)
|
|||||||
std::unordered_set<const void*> visitedStructures;
|
std::unordered_set<const void*> visitedStructures;
|
||||||
for (const auto& info : allInfos)
|
for (const auto& info : allInfos)
|
||||||
{
|
{
|
||||||
info->m_requires_marking = RequiresMarking(visitedStructures, info);
|
CalculateRequiresMarking(visitedStructures, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
class MarkingRequiredPostProcessor final : public IPostProcessor
|
class MarkingRequiredPostProcessor final : public IPostProcessor
|
||||||
{
|
{
|
||||||
static bool RequiresMarking(std::unordered_set<const void*>& visitedStructures, const StructureInformation* info);
|
static bool CalculateRequiresMarking(std::unordered_set<const void*>& visitedStructures, StructureInformation* info);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool PostProcess(IDataRepository* repository) override;
|
bool PostProcess(IDataRepository* repository) override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user