Skip to content

Commit

Permalink
Ignored name property while loading components from dumps.
Browse files Browse the repository at this point in the history
  • Loading branch information
pboechat committed Dec 3, 2024
1 parent 5a62b9f commit 209e8b9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions FastCG/src/World/GameObjectLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ namespace
void LoadInspectable(const GenericObjectT &, const std::string &,
const std::unordered_map<std::string, std::shared_ptr<FastCG::Material>> &,
const std::unordered_map<std::string, std::shared_ptr<FastCG::Mesh>> &,
const std::unordered_map<std::string, FastCG::Texture *> &, FastCG::Inspectable *);
const std::unordered_map<std::string, FastCG::Texture *> &, FastCG::Inspectable *,
const std::vector<std::string> &);

template <typename GenericValueT>
void LoadInspectableProperty(const GenericValueT &rGenericValue, const std::string &rBasePath,
Expand Down Expand Up @@ -389,11 +390,16 @@ namespace
const std::unordered_map<std::string, std::shared_ptr<FastCG::Material>> &rMaterials,
const std::unordered_map<std::string, std::shared_ptr<FastCG::Mesh>> &rMeshes,
const std::unordered_map<std::string, FastCG::Texture *> &rTextures,
FastCG::Inspectable *pInspectable)
FastCG::Inspectable *pInspectable, const std::vector<std::string> &rPropertiesToIgnore = {})
{
for (auto it = rInspectableObj.MemberBegin(); it != rInspectableObj.MemberEnd(); ++it)
{
std::string propertyName = it->name.GetString();
if (std::find(rPropertiesToIgnore.begin(), rPropertiesToIgnore.end(), propertyName) !=
rPropertiesToIgnore.end())
{
continue;
}
auto *pInspectableProperty = pInspectable->GetInspectableProperty(propertyName);
// ignore non-existing inspectable properties
if (pInspectableProperty == nullptr)
Expand Down Expand Up @@ -472,7 +478,7 @@ namespace
if (pComponentRegistry != nullptr)
{
auto *pComponent = pComponentRegistry->Instantiate(pGameObject);
LoadInspectable(componentObj, rBasePath, rMaterials, rMeshes, rTextures, pComponent);
LoadInspectable(componentObj, rBasePath, rMaterials, rMeshes, rTextures, pComponent, {"name"});
}
else
{
Expand Down

0 comments on commit 209e8b9

Please sign in to comment.