From 061b77e5e6c6e3f446734bf214e395e7e6f1a4b4 Mon Sep 17 00:00:00 2001 From: Gordon MacPherson Date: Tue, 30 Mar 2021 02:33:06 +0100 Subject: This stops using FBXPropertyTable as a pointer. The base object will inherit the property table, for every FBX object, if it doesn't exist it will be ignored. The previous code was dangerous and not simple to understand, this makes the code simpler and should result in no leaks with PropertyTable. Features/Fixes: Adds ability for multiple millions of polygons to be loaded. Fixes memory leaks with tokens Fixes memory leaks with property table Fixes loading some corrupt files Fixes meshes not having a unique name to the mesh node. Opens up loading for two more versions: 7100 and 7200, up to 2020. Preliminary support for Cinema4D files in parser now, before this was not possible it would cause memory corruption, which is gone now. FBXProperties not being pointers presented simpler challenges in the long run also, fixed a bunch of bugs. --- modules/fbx/fbx_parser/FBXDocumentUtil.cpp | 31 ------------------------------ 1 file changed, 31 deletions(-) (limited to 'modules/fbx/fbx_parser/FBXDocumentUtil.cpp') diff --git a/modules/fbx/fbx_parser/FBXDocumentUtil.cpp b/modules/fbx/fbx_parser/FBXDocumentUtil.cpp index df50a32c39..3930e005c3 100644 --- a/modules/fbx/fbx_parser/FBXDocumentUtil.cpp +++ b/modules/fbx/fbx_parser/FBXDocumentUtil.cpp @@ -137,36 +137,5 @@ void DOMWarning(const std::string &message, const std::shared_ptr eleme print_verbose("[FBX-DOM] warning:" + String(message.c_str())); } -// ------------------------------------------------------------------------------------------------ -// fetch a property table and the corresponding property template -const PropertyTable *GetPropertyTable(const Document &doc, - const std::string &templateName, - const ElementPtr element, - const ScopePtr sc, - bool no_warn /*= false*/) { - // todo: make this an abstraction - const ElementPtr Properties70 = sc->GetElement("Properties70"); - const PropertyTable *templateProps = static_cast(nullptr); - - if (templateName.length()) { - PropertyTemplateMap::const_iterator it = doc.Templates().find(templateName); - if (it != doc.Templates().end()) { - templateProps = (*it).second; - } - } - - if (!Properties70 || !Properties70->Compound()) { - if (!no_warn) { - DOMWarning("property table (Properties70) not found", element); - } - if (templateProps) { - return new const PropertyTable(templateProps); - } else { - return new const PropertyTable(); - } - } - - return new PropertyTable(Properties70, templateProps); -} } // namespace Util } // namespace FBXDocParser -- cgit v1.2.3