commit
12629b3f3b
|
@ -50,13 +50,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
|
|
||||||
#include <assimp/GenericProperty.h>
|
#include <assimp/GenericProperty.h>
|
||||||
|
#include <assimp/Exceptional.h>
|
||||||
|
#include <assimp/BaseImporter.h>
|
||||||
|
|
||||||
#include "CInterfaceIOWrapper.h"
|
#include "CInterfaceIOWrapper.h"
|
||||||
#include "Importer.h"
|
#include "Importer.h"
|
||||||
#include <assimp/Exceptional.h>
|
|
||||||
#include "ScenePrivate.h"
|
#include "ScenePrivate.h"
|
||||||
#include <assimp/BaseImporter.h>
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -107,7 +108,6 @@ namespace Assimp {
|
||||||
static std::mutex gLogStreamMutex;
|
static std::mutex gLogStreamMutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Custom LogStream implementation for the C-API
|
// Custom LogStream implementation for the C-API
|
||||||
class LogToCallbackRedirector : public LogStream {
|
class LogToCallbackRedirector : public LogStream {
|
||||||
|
|
|
@ -505,7 +505,6 @@ ADD_ASSIMP_IMPORTER( XGL
|
||||||
XGLLoader.h
|
XGLLoader.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
ADD_ASSIMP_IMPORTER( FBX
|
ADD_ASSIMP_IMPORTER( FBX
|
||||||
FBXImporter.cpp
|
FBXImporter.cpp
|
||||||
FBXCompileConfig.h
|
FBXCompileConfig.h
|
||||||
|
@ -723,6 +722,12 @@ ADD_ASSIMP_IMPORTER( MMD
|
||||||
|
|
||||||
SET( Step_SRCS
|
SET( Step_SRCS
|
||||||
STEPFile.h
|
STEPFile.h
|
||||||
|
Importer/StepFile/StepFileImporter.h
|
||||||
|
Importer/StepFile/StepFileImporter.cpp
|
||||||
|
Importer/StepFile/StepFileGen1.cpp
|
||||||
|
Importer/StepFile/StepFileGen2.cpp
|
||||||
|
Importer/StepFile/StepFileGen3.cpp
|
||||||
|
Importer/StepFile/StepReaderGen.h
|
||||||
StepExporter.h
|
StepExporter.h
|
||||||
StepExporter.cpp
|
StepExporter.cpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -134,7 +134,7 @@ IFCImporter::~IFCImporter()
|
||||||
bool IFCImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
|
bool IFCImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
|
||||||
{
|
{
|
||||||
const std::string& extension = GetExtension(pFile);
|
const std::string& extension = GetExtension(pFile);
|
||||||
if (extension == "ifc" || extension == "ifczip" || extension == "stp" ) {
|
if (extension == "ifc" || extension == "ifczip" ) {
|
||||||
return true;
|
return true;
|
||||||
} else if ((!extension.length() || checkSig) && pIOHandler) {
|
} else if ((!extension.length() || checkSig) && pIOHandler) {
|
||||||
// note: this is the common identification for STEP-encoded files, so
|
// note: this is the common identification for STEP-encoded files, so
|
||||||
|
|
|
@ -85,16 +85,16 @@ STEP::TypeError::TypeError (const std::string& s,uint64_t entity /* = ENTITY_NOT
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *ISO_Token = "ISO-10303-21;";
|
||||||
|
static const char *FILE_SCHEMA_Token = "FILE_SCHEMA";
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
STEP::DB* STEP::ReadFileHeader(std::shared_ptr<IOStream> stream)
|
STEP::DB* STEP::ReadFileHeader(std::shared_ptr<IOStream> stream) {
|
||||||
{
|
|
||||||
std::shared_ptr<StreamReaderLE> reader = std::shared_ptr<StreamReaderLE>(new StreamReaderLE(stream));
|
std::shared_ptr<StreamReaderLE> reader = std::shared_ptr<StreamReaderLE>(new StreamReaderLE(stream));
|
||||||
std::unique_ptr<STEP::DB> db = std::unique_ptr<STEP::DB>(new STEP::DB(reader));
|
std::unique_ptr<STEP::DB> db = std::unique_ptr<STEP::DB>(new STEP::DB(reader));
|
||||||
|
|
||||||
LineSplitter &splitter = db->GetSplitter();
|
LineSplitter &splitter = db->GetSplitter();
|
||||||
if (!splitter || *splitter != "ISO-10303-21;") {
|
if (!splitter || *splitter != ISO_Token ) {
|
||||||
throw STEP::SyntaxError("expected magic token: ISO-10303-21",1);
|
throw STEP::SyntaxError("expected magic token: " + std::string( ISO_Token ), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
HeaderInfo& head = db->GetHeader();
|
HeaderInfo& head = db->GetHeader();
|
||||||
|
@ -109,7 +109,7 @@ STEP::DB* STEP::ReadFileHeader(std::shared_ptr<IOStream> stream)
|
||||||
// want one-based line numbers for human readers, so +1
|
// want one-based line numbers for human readers, so +1
|
||||||
const uint64_t line = splitter.get_index()+1;
|
const uint64_t line = splitter.get_index()+1;
|
||||||
|
|
||||||
if (s.substr(0,11) == "FILE_SCHEMA") {
|
if (s.substr(0,11) == FILE_SCHEMA_Token) {
|
||||||
const char* sz = s.c_str()+11;
|
const char* sz = s.c_str()+11;
|
||||||
SkipSpaces(sz,&sz);
|
SkipSpaces(sz,&sz);
|
||||||
std::shared_ptr< const EXPRESS::DataType > schema = EXPRESS::DataType::Parse(sz);
|
std::shared_ptr< const EXPRESS::DataType > schema = EXPRESS::DataType::Parse(sz);
|
||||||
|
@ -549,4 +549,3 @@ void STEP::LazyObject::LazyInit() const
|
||||||
// store the original id in the object instance
|
// store the original id in the object instance
|
||||||
obj->SetID(id);
|
obj->SetID(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,18 +48,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
namespace STEP {
|
namespace STEP {
|
||||||
|
|
||||||
// ### Parsing a STEP file is a twofold procedure ###
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// 1) read file header and return to caller, who checks if the
|
/// @brief Parsing a STEP file is a twofold procedure.
|
||||||
// file is of a supported schema ..
|
/// 1) read file header and return to caller, who checks if the
|
||||||
|
/// file is of a supported schema ..
|
||||||
DB* ReadFileHeader(std::shared_ptr<IOStream> stream);
|
DB* ReadFileHeader(std::shared_ptr<IOStream> stream);
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
// 2) read the actual file contents using a user-supplied set of
|
/// 2) read the actual file contents using a user-supplied set of
|
||||||
// conversion functions to interpret the data.
|
/// conversion functions to interpret the data.
|
||||||
void ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme, const char* const* types_to_track, size_t len, const char* const* inverse_indices_to_track, size_t len2);
|
void ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme, const char* const* types_to_track, size_t len, const char* const* inverse_indices_to_track, size_t len2);
|
||||||
template <size_t N, size_t N2> inline void ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme, const char* const (&arr)[N], const char* const (&arr2)[N2]) {
|
|
||||||
|
/// @brief Helper to read a file.
|
||||||
|
template <size_t N, size_t N2>
|
||||||
|
inline
|
||||||
|
void ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme, const char* const (&arr)[N], const char* const (&arr2)[N2]) {
|
||||||
return ReadFile(db,scheme,arr,N,arr2,N2);
|
return ReadFile(db,scheme,arr,N,arr2,N2);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ! STEP
|
} // ! STEP
|
||||||
} // ! Assimp
|
} // ! Assimp
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,114 @@
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006-2018, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer in the documentation and/or other
|
||||||
|
materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of the assimp team, nor the names of its
|
||||||
|
contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior
|
||||||
|
written permission of the assimp team.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ASSIMP_BUILD_NO_STEPFILE_IMPORTER
|
||||||
|
|
||||||
|
#include "StepFileImporter.h"
|
||||||
|
#include "../../Importer/IFC/STEPFileReader.h"
|
||||||
|
#include <assimp/importerdesc.h>
|
||||||
|
#include <assimp/DefaultIOSystem.h>
|
||||||
|
|
||||||
|
namespace Assimp {
|
||||||
|
namespace StepFile {
|
||||||
|
|
||||||
|
using namespace STEP;
|
||||||
|
|
||||||
|
static const aiImporterDesc desc = { "StepFile Importer",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
"stp" };
|
||||||
|
|
||||||
|
StepFileImporter::StepFileImporter()
|
||||||
|
: BaseImporter() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
StepFileImporter::~StepFileImporter() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StepFileImporter::CanRead(const std::string& file, IOSystem* pIOHandler, bool checkSig) const {
|
||||||
|
const std::string &extension = GetExtension(file);
|
||||||
|
if ( extension == "stp" || extension == "step" ) {
|
||||||
|
return true;
|
||||||
|
} else if ((!extension.length() || checkSig) && pIOHandler) {
|
||||||
|
const char* tokens[] = { "ISO-10303-21" };
|
||||||
|
const bool found(SearchFileHeaderForToken(pIOHandler, file, tokens, 1));
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const aiImporterDesc *StepFileImporter::GetInfo() const {
|
||||||
|
return &desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const std::string mode = "rb";
|
||||||
|
static const std::string StepFileSchema = "CONFIG_CONTROL_DESIGN";
|
||||||
|
|
||||||
|
void StepFileImporter::InternReadFile(const std::string &file, aiScene* pScene, IOSystem* pIOHandler) {
|
||||||
|
// Read file into memory
|
||||||
|
std::shared_ptr<IOStream> fileStream(pIOHandler->Open(file, mode));
|
||||||
|
if (!fileStream.get()) {
|
||||||
|
throw DeadlyImportError("Failed to open file " + file + ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<STEP::DB> db(STEP::ReadFileHeader(fileStream));
|
||||||
|
const STEP::HeaderInfo& head = static_cast<const STEP::DB&>(*db).GetHeader();
|
||||||
|
if (!head.fileSchema.size() || head.fileSchema != StepFileSchema) {
|
||||||
|
DeadlyImportError("Unrecognized file schema: " + head.fileSchema);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // Namespace StepFile
|
||||||
|
} // Namespace Assimp
|
||||||
|
|
||||||
|
#endif // ASSIMP_BUILD_NO_STEPFILE_IMPORTER
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Open Asset Import Library (assimp)
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006-2018, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer in the documentation and/or other
|
||||||
|
materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of the assimp team, nor the names of its
|
||||||
|
contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior
|
||||||
|
written permission of the assimp team.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef ASSIMP_BUILD_NO_STEPFILE_IMPORTER
|
||||||
|
|
||||||
|
#include <assimp/BaseImporter.h>
|
||||||
|
|
||||||
|
namespace Assimp {
|
||||||
|
namespace StepFile {
|
||||||
|
|
||||||
|
class StepFileImporter : public BaseImporter {
|
||||||
|
public:
|
||||||
|
StepFileImporter();
|
||||||
|
~StepFileImporter();
|
||||||
|
bool CanRead(const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const override;
|
||||||
|
const aiImporterDesc* GetInfo() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler ) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
} // Namespace StepFile
|
||||||
|
} // Namespace Assimp
|
||||||
|
|
||||||
|
#endif // ASSIMP_BUILD_NO_STEPFILE_IMPORTER
|
File diff suppressed because it is too large
Load Diff
|
@ -197,6 +197,9 @@ corresponding preprocessor flag to selectively disable formats.
|
||||||
#ifndef ASSIMP_BUILD_NO_MMD_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_MMD_IMPORTER
|
||||||
# include "MMDImporter.h"
|
# include "MMDImporter.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef ASSIMP_BUILD_NO_STEPFILE_IMPORTER
|
||||||
|
# include "Importer/StepFile/StepFileImporter.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
|
@ -352,6 +355,9 @@ void GetImporterInstanceList(std::vector< BaseImporter* >& out)
|
||||||
#ifndef ASSIMP_BUILD_NO_MMD_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_MMD_IMPORTER
|
||||||
out.push_back( new MMDImporter() );
|
out.push_back( new MMDImporter() );
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef ASSIMP_BUILD_NO_STEPFILE_IMPORTER
|
||||||
|
out.push_back(new StepFile::StepFileImporter());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/** will delete all registered importers. */
|
/** will delete all registered importers. */
|
||||||
|
|
106
code/STEPFile.h
106
code/STEPFile.h
|
@ -139,10 +139,10 @@ namespace STEP {
|
||||||
* error (i.e. an entity expects a string but receives a bool) occurs.
|
* error (i.e. an entity expects a string but receives a bool) occurs.
|
||||||
* It is typically coupled with both an entity id and a line number.*/
|
* It is typically coupled with both an entity id and a line number.*/
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
struct TypeError : DeadlyImportError
|
struct TypeError : DeadlyImportError {
|
||||||
{
|
|
||||||
enum {
|
enum {
|
||||||
ENTITY_NOT_SPECIFIED = 0xffffffffffffffffLL
|
ENTITY_NOT_SPECIFIED = 0xffffffffffffffffLL,
|
||||||
|
ENTITY_NOT_SPECIFIED_32 = -1u
|
||||||
};
|
};
|
||||||
|
|
||||||
TypeError (const std::string& s,uint64_t entity = ENTITY_NOT_SPECIFIED, uint64_t line = SyntaxError::LINE_NOT_SPECIFIED);
|
TypeError (const std::string& s,uint64_t entity = ENTITY_NOT_SPECIFIED, uint64_t line = SyntaxError::LINE_NOT_SPECIFIED);
|
||||||
|
@ -164,7 +164,6 @@ namespace STEP {
|
||||||
class DataType
|
class DataType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef std::shared_ptr<const DataType> Out;
|
typedef std::shared_ptr<const DataType> Out;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -357,14 +356,25 @@ namespace STEP {
|
||||||
MemberList members;
|
MemberList members;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class BINARY : public PrimitiveDataType<uint32_t> {
|
||||||
|
public:
|
||||||
|
BINARY(uint32_t val)
|
||||||
|
: PrimitiveDataType<uint32_t>(val) {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
BINARY()
|
||||||
|
: PrimitiveDataType<uint32_t>(TypeError::ENTITY_NOT_SPECIFIED_32) {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
/* Not exactly a full EXPRESS schema but rather a list of conversion functions
|
/* Not exactly a full EXPRESS schema but rather a list of conversion functions
|
||||||
* to extract valid C++ objects out of a STEP file. Those conversion functions
|
* to extract valid C++ objects out of a STEP file. Those conversion functions
|
||||||
* may, however, perform further schema validations. */
|
* may, however, perform further schema validations. */
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
class ConversionSchema
|
class ConversionSchema {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
struct SchemaEntry {
|
struct SchemaEntry {
|
||||||
SchemaEntry( const char *name, ConvertObjectProc func )
|
SchemaEntry( const char *name, ConvertObjectProc func )
|
||||||
|
@ -379,30 +389,27 @@ namespace STEP {
|
||||||
|
|
||||||
typedef std::map<std::string,ConvertObjectProc> ConverterMap;
|
typedef std::map<std::string,ConvertObjectProc> ConverterMap;
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
explicit ConversionSchema( const SchemaEntry (& schemas)[N]) {
|
explicit ConversionSchema( const SchemaEntry (& schemas)[N]) {
|
||||||
*this = schemas;
|
*this = schemas;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConversionSchema() {}
|
ConversionSchema() {
|
||||||
|
|
||||||
public:
|
}
|
||||||
|
|
||||||
ConvertObjectProc GetConverterProc(const std::string& name) const {
|
ConvertObjectProc GetConverterProc(const std::string& name) const {
|
||||||
ConverterMap::const_iterator it = converters.find(name);
|
ConverterMap::const_iterator it = converters.find(name);
|
||||||
return it == converters.end() ? NULL : (*it).second;
|
return it == converters.end() ? nullptr : (*it).second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool IsKnownToken(const std::string& name) const {
|
bool IsKnownToken(const std::string& name) const {
|
||||||
return converters.find(name) != converters.end();
|
return converters.find(name) != converters.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* GetStaticStringForToken(const std::string& token) const {
|
const char* GetStaticStringForToken(const std::string& token) const {
|
||||||
ConverterMap::const_iterator it = converters.find(token);
|
ConverterMap::const_iterator it = converters.find(token);
|
||||||
return it == converters.end() ? NULL : (*it).first.c_str();
|
return it == converters.end() ? nullptr : (*it).first.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -416,7 +423,6 @@ namespace STEP {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ConverterMap converters;
|
ConverterMap converters;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -451,8 +457,6 @@ namespace STEP {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// utilities to simplify casting to concrete types
|
// utilities to simplify casting to concrete types
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const T& To() const {
|
const T& To() const {
|
||||||
|
@ -474,7 +478,6 @@ namespace STEP {
|
||||||
return dynamic_cast<T*>(this);
|
return dynamic_cast<T*>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
uint64_t GetID() const {
|
uint64_t GetID() const {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -501,9 +504,11 @@ namespace STEP {
|
||||||
/** CRTP shared base class for use by concrete entity implementation classes */
|
/** CRTP shared base class for use by concrete entity implementation classes */
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
template <typename TDerived, size_t arg_count>
|
template <typename TDerived, size_t arg_count>
|
||||||
struct ObjectHelper : virtual Object
|
struct ObjectHelper : virtual Object {
|
||||||
{
|
ObjectHelper()
|
||||||
ObjectHelper() : aux_is_derived(0) {}
|
: aux_is_derived(0) {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
static Object* Construct(const STEP::DB& db, const EXPRESS::LIST& params) {
|
static Object* Construct(const STEP::DB& db, const EXPRESS::LIST& params) {
|
||||||
// make sure we don't leak if Fill() throws an exception
|
// make sure we don't leak if Fill() throws an exception
|
||||||
|
@ -532,10 +537,16 @@ namespace STEP {
|
||||||
/** Class template used to represent OPTIONAL data members in the converted schema */
|
/** Class template used to represent OPTIONAL data members in the converted schema */
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct Maybe
|
struct Maybe {
|
||||||
{
|
Maybe()
|
||||||
Maybe() : have() {}
|
: have() {
|
||||||
explicit Maybe(const T& ptr) : ptr(ptr), have(true) {
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit Maybe(const T& ptr)
|
||||||
|
: ptr(ptr)
|
||||||
|
, have(true) {
|
||||||
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -572,7 +583,6 @@ namespace STEP {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
template <typename T2> friend struct InternGenericConvert;
|
template <typename T2> friend struct InternGenericConvert;
|
||||||
|
|
||||||
operator T&() {
|
operator T&() {
|
||||||
|
@ -587,16 +597,13 @@ namespace STEP {
|
||||||
/** A LazyObject is created when needed. Before this happens, we just keep
|
/** A LazyObject is created when needed. Before this happens, we just keep
|
||||||
the text line that contains the object definition. */
|
the text line that contains the object definition. */
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
class LazyObject
|
class LazyObject {
|
||||||
{
|
|
||||||
friend class DB;
|
friend class DB;
|
||||||
public:
|
|
||||||
|
|
||||||
|
public:
|
||||||
LazyObject(DB& db, uint64_t id, uint64_t line, const char* type,const char* args);
|
LazyObject(DB& db, uint64_t id, uint64_t line, const char* type,const char* args);
|
||||||
~LazyObject();
|
~LazyObject();
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
Object& operator * () {
|
Object& operator * () {
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
LazyInit();
|
LazyInit();
|
||||||
|
@ -654,38 +661,37 @@ namespace STEP {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void LazyInit() const;
|
void LazyInit() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
mutable uint64_t id;
|
mutable uint64_t id;
|
||||||
const char* const type;
|
const char* const type;
|
||||||
DB& db;
|
DB& db;
|
||||||
|
|
||||||
mutable const char* args;
|
mutable const char* args;
|
||||||
mutable Object* obj;
|
mutable Object* obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool operator==( std::shared_ptr<LazyObject> lo, T whatever ) {
|
inline
|
||||||
|
bool operator==( std::shared_ptr<LazyObject> lo, T whatever ) {
|
||||||
return *lo == whatever; // XXX use std::forward if we have 0x
|
return *lo == whatever; // XXX use std::forward if we have 0x
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool operator==( const std::pair<uint64_t, std::shared_ptr<LazyObject> >& lo, T whatever ) {
|
inline
|
||||||
|
bool operator==( const std::pair<uint64_t, std::shared_ptr<LazyObject> >& lo, T whatever ) {
|
||||||
return *(lo.second) == whatever; // XXX use std::forward if we have 0x
|
return *(lo.second) == whatever; // XXX use std::forward if we have 0x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
/** Class template used to represent lazily evaluated object references in the converted schema */
|
/** Class template used to represent lazily evaluated object references in the converted schema */
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct Lazy
|
struct Lazy {
|
||||||
{
|
|
||||||
typedef Lazy Out;
|
typedef Lazy Out;
|
||||||
Lazy(const LazyObject* obj = NULL) : obj(obj) {
|
Lazy(const LazyObject* obj = nullptr)
|
||||||
|
: obj(obj) {
|
||||||
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
operator const T*() const {
|
operator const T*() const {
|
||||||
|
@ -711,19 +717,15 @@ namespace STEP {
|
||||||
/** Class template used to represent LIST and SET data members in the converted schema */
|
/** Class template used to represent LIST and SET data members in the converted schema */
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
template <typename T, uint64_t min_cnt, uint64_t max_cnt=0uL>
|
template <typename T, uint64_t min_cnt, uint64_t max_cnt=0uL>
|
||||||
struct ListOf : public std::vector<typename T::Out>
|
struct ListOf : public std::vector<typename T::Out> {
|
||||||
{
|
|
||||||
typedef typename T::Out OutScalar;
|
typedef typename T::Out OutScalar;
|
||||||
typedef ListOf Out;
|
typedef ListOf Out;
|
||||||
|
|
||||||
|
|
||||||
ListOf() {
|
ListOf() {
|
||||||
static_assert(min_cnt <= max_cnt || !max_cnt, "min_cnt <= max_cnt || !max_cnt");
|
static_assert(min_cnt <= max_cnt || !max_cnt, "min_cnt <= max_cnt || !max_cnt");
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
template <typename TOut>
|
template <typename TOut>
|
||||||
struct PickBaseType {
|
struct PickBaseType {
|
||||||
|
@ -735,7 +737,8 @@ namespace STEP {
|
||||||
typedef EXPRESS::ENTITY Type;
|
typedef EXPRESS::ENTITY Type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct PickBaseType< std::shared_ptr< const EXPRESS::DataType > >;
|
template<>
|
||||||
|
struct PickBaseType< std::shared_ptr< const EXPRESS::DataType > >;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -743,8 +746,7 @@ namespace STEP {
|
||||||
void operator()(T& out, const std::shared_ptr< const EXPRESS::DataType >& in, const STEP::DB& /*db*/) {
|
void operator()(T& out, const std::shared_ptr< const EXPRESS::DataType >& in, const STEP::DB& /*db*/) {
|
||||||
try{
|
try{
|
||||||
out = dynamic_cast< const typename PickBaseType<T>::Type& > ( *in );
|
out = dynamic_cast< const typename PickBaseType<T>::Type& > ( *in );
|
||||||
}
|
} catch(std::bad_cast&) {
|
||||||
catch(std::bad_cast&) {
|
|
||||||
throw TypeError("type error reading literal field");
|
throw TypeError("type error reading literal field");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -817,7 +819,6 @@ namespace STEP {
|
||||||
return InternGenericConvertList<T1,N1,N2>()(a,b,db);
|
return InternGenericConvertList<T1,N1,N2>()(a,b,db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
/** Lightweight manager class that holds the map of all objects in a
|
/** Lightweight manager class that holds the map of all objects in a
|
||||||
* STEP file. DB's are exclusively maintained by the functions in
|
* STEP file. DB's are exclusively maintained by the functions in
|
||||||
|
@ -834,7 +835,6 @@ namespace STEP {
|
||||||
friend class LazyObject;
|
friend class LazyObject;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// objects indexed by ID - this can grow pretty large (i.e some hundred million
|
// objects indexed by ID - this can grow pretty large (i.e some hundred million
|
||||||
// entries), so use raw pointers to avoid *any* overhead.
|
// entries), so use raw pointers to avoid *any* overhead.
|
||||||
typedef std::map<uint64_t,const LazyObject* > ObjectMap;
|
typedef std::map<uint64_t,const LazyObject* > ObjectMap;
|
||||||
|
@ -859,19 +859,16 @@ namespace STEP {
|
||||||
: reader(reader)
|
: reader(reader)
|
||||||
, splitter(*reader,true,true)
|
, splitter(*reader,true,true)
|
||||||
, evaluated_count()
|
, evaluated_count()
|
||||||
, schema( NULL )
|
, schema( nullptr )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
~DB() {
|
~DB() {
|
||||||
for(ObjectMap::value_type& o : objects) {
|
for(ObjectMap::value_type& o : objects) {
|
||||||
delete o.second;
|
delete o.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
uint64_t GetObjectCount() const {
|
uint64_t GetObjectCount() const {
|
||||||
return objects.size();
|
return objects.size();
|
||||||
}
|
}
|
||||||
|
@ -900,7 +897,6 @@ namespace STEP {
|
||||||
return refs;
|
return refs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool KeepInverseIndicesForType(const char* const type) const {
|
bool KeepInverseIndicesForType(const char* const type) const {
|
||||||
return inv_whitelist.find(type) != inv_whitelist.end();
|
return inv_whitelist.find(type) != inv_whitelist.end();
|
||||||
}
|
}
|
||||||
|
@ -912,7 +908,7 @@ namespace STEP {
|
||||||
if (it != objects.end()) {
|
if (it != objects.end()) {
|
||||||
return (*it).second;
|
return (*it).second;
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,11 +48,27 @@ if sys.version_info < (3, 0):
|
||||||
print("must use python 3.0 or greater")
|
print("must use python 3.0 or greater")
|
||||||
sys.exit(-2)
|
sys.exit(-2)
|
||||||
|
|
||||||
input_template_h = 'IFCReaderGen.h.template'
|
use_ifc_template = False
|
||||||
input_template_cpp = 'IFCReaderGen.cpp.template'
|
|
||||||
|
|
||||||
|
input_step_template_h = 'StepReaderGen.h.template'
|
||||||
|
input_step_template_cpp = 'StepReaderGen.cpp.template'
|
||||||
|
input_ifc_template_h = 'IFCReaderGen.h.template'
|
||||||
|
input_ifc_template_cpp = 'IFCReaderGen.cpp.template'
|
||||||
|
|
||||||
|
cpp_keywords = "class"
|
||||||
|
|
||||||
|
output_file_h = ""
|
||||||
|
output_file_cpp = ""
|
||||||
|
if (use_ifc_template ):
|
||||||
|
input_template_h = input_ifc_template_h
|
||||||
|
input_template_cpp = input_ifc_template_cpp
|
||||||
output_file_h = os.path.join('..','..','code','IFCReaderGen.h')
|
output_file_h = os.path.join('..','..','code','IFCReaderGen.h')
|
||||||
output_file_cpp = os.path.join('..','..','code','IFCReaderGen.cpp')
|
output_file_cpp = os.path.join('..','..','code','IFCReaderGen.cpp')
|
||||||
|
else:
|
||||||
|
input_template_h = input_step_template_h
|
||||||
|
input_template_cpp = input_step_template_cpp
|
||||||
|
output_file_h = os.path.join('..','..','code/Importer/StepFile','StepReaderGen.h')
|
||||||
|
output_file_cpp = os.path.join('..','..','code/Importer/StepFile','StepReaderGen.cpp')
|
||||||
|
|
||||||
template_entity_predef = '\tstruct {entity};\n'
|
template_entity_predef = '\tstruct {entity};\n'
|
||||||
template_entity_predef_ni = '\ttypedef NotImplemented {entity}; // (not currently used by Assimp)\n'
|
template_entity_predef_ni = '\ttypedef NotImplemented {entity}; // (not currently used by Assimp)\n'
|
||||||
|
@ -99,7 +115,6 @@ template_converter_epilogue = '\treturn base;'
|
||||||
|
|
||||||
import ExpressReader
|
import ExpressReader
|
||||||
|
|
||||||
|
|
||||||
def get_list_bounds(collection_spec):
|
def get_list_bounds(collection_spec):
|
||||||
start,end = [(int(n) if n!='?' else 0) for n in re.findall(r'(\d+|\?)',collection_spec)]
|
start,end = [(int(n) if n!='?' else 0) for n in re.findall(r'(\d+|\?)',collection_spec)]
|
||||||
return start,end
|
return start,end
|
||||||
|
@ -221,9 +236,11 @@ def work(filename):
|
||||||
schema = ExpressReader.read(filename,silent=True)
|
schema = ExpressReader.read(filename,silent=True)
|
||||||
entities, stub_decls, schema_table, converters, typedefs, predefs = '','',[],'','',''
|
entities, stub_decls, schema_table, converters, typedefs, predefs = '','',[],'','',''
|
||||||
|
|
||||||
|
entitylist = 'ifc_entitylist.txt'
|
||||||
|
if not use_ifc_template:
|
||||||
|
entitylist = 'step_entitylist.txt'
|
||||||
whitelist = []
|
whitelist = []
|
||||||
with open('entitylist.txt', 'rt') as inp:
|
with open(entitylist, 'rt') as inp:
|
||||||
whitelist = [n.strip() for n in inp.read().split('\n') if n[:1]!='#' and n.strip()]
|
whitelist = [n.strip() for n in inp.read().split('\n') if n[:1]!='#' and n.strip()]
|
||||||
|
|
||||||
schema.whitelist = set()
|
schema.whitelist = set()
|
||||||
|
@ -242,12 +259,14 @@ def work(filename):
|
||||||
schema.blacklist_partial -= schema.whitelist
|
schema.blacklist_partial -= schema.whitelist
|
||||||
schema.whitelist |= schema.blacklist_partial
|
schema.whitelist |= schema.blacklist_partial
|
||||||
|
|
||||||
|
# Generate list with reserved keywords from c++
|
||||||
|
cpp_types = cpp_keywords.split(',')
|
||||||
|
|
||||||
# uncomment this to disable automatic code reduction based on whitelisting all used entities
|
# uncomment this to disable automatic code reduction based on whitelisting all used entities
|
||||||
# (blacklisted entities are those who are in the whitelist and may be instanced, but will
|
# (blacklisted entities are those who are in the whitelist and may be instanced, but will
|
||||||
# only be accessed through a pointer to a base-class.
|
# only be accessed through a pointer to a base-class.
|
||||||
#schema.whitelist = set(schema.entities.keys())
|
#schema.whitelist = set(schema.entities.keys())
|
||||||
#schema.blacklist_partial = set()
|
#schema.blacklist_partial = set()
|
||||||
|
|
||||||
for ntype in schema.types.values():
|
for ntype in schema.types.values():
|
||||||
typedefs += gen_type_struct(ntype,schema)
|
typedefs += gen_type_struct(ntype,schema)
|
||||||
schema_table.append(template_schema_type.format(normalized_name=ntype.name.lower()))
|
schema_table.append(template_schema_type.format(normalized_name=ntype.name.lower()))
|
||||||
|
@ -256,6 +275,9 @@ def work(filename):
|
||||||
for entity in sorted_entities:
|
for entity in sorted_entities:
|
||||||
parent = entity.parent+',' if entity.parent else ''
|
parent = entity.parent+',' if entity.parent else ''
|
||||||
|
|
||||||
|
if ( entity.name in cpp_types ):
|
||||||
|
entity.name = entity.name + "_t"
|
||||||
|
print( "renaming " + entity.name)
|
||||||
if entity.name in schema.whitelist:
|
if entity.name in schema.whitelist:
|
||||||
converters += template_converter.format(type=entity.name,contents=gen_converter(entity,schema))
|
converters += template_converter.format(type=entity.name,contents=gen_converter(entity,schema))
|
||||||
schema_table.append(template_schema.format(type=entity.name,normalized_name=entity.name.lower(),argcnt=len(entity.members)))
|
schema_table.append(template_schema.format(type=entity.name,normalized_name=entity.name.lower(),argcnt=len(entity.members)))
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Open Asset Import Library (ASSIMP)
|
Open Asset Import Library (ASSIMP)
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2006-2010, ASSIMP Development Team
|
Copyright (c) 2006-2018, ASSIMP Development Team
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -40,7 +40,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
/** MACHINE-GENERATED by scripts/ICFImporter/CppGenerator.py */
|
/** MACHINE-GENERATED by scripts/ICFImporter/CppGenerator.py */
|
||||||
|
|
||||||
#include "AssimpPCH.h"
|
|
||||||
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
|
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
|
||||||
|
|
||||||
#include "IFCReaderGen.h"
|
#include "IFCReaderGen.h"
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
Open Asset Import Library (ASSIMP)
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006-2018, ASSIMP Development Team
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
with or without modification, are permitted provided that the
|
||||||
|
following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer in the documentation and/or other
|
||||||
|
materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of the ASSIMP team, nor the names of its
|
||||||
|
contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior
|
||||||
|
written permission of the ASSIMP Development Team.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** MACHINE-GENERATED by scripts/ICFImporter/CppGenerator.py */
|
||||||
|
|
||||||
|
#ifndef ASSIMP_BUILD_NO_STEPFILE_IMPORTER
|
||||||
|
|
||||||
|
#include "code/Importer/StepFile/StepReaderGen.h"
|
||||||
|
|
||||||
|
namespace Assimp {
|
||||||
|
using namespace StepFile;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
typedef EXPRESS::ConversionSchema::SchemaEntry SchemaEntry;
|
||||||
|
const SchemaEntry schema_raw[] = {
|
||||||
|
{schema-static-table}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------
|
||||||
|
void StepFile::GetSchema(EXPRESS::ConversionSchema& out)
|
||||||
|
{
|
||||||
|
out = EXPRESS::ConversionSchema(schema_raw);
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace STEP {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------
|
||||||
|
template <> size_t GenericFill<NotImplemented>(const STEP::DB& db, const LIST& params, NotImplemented* in)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{converter-impl}
|
||||||
|
|
||||||
|
} // ! STEP
|
||||||
|
} // ! Assimp
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
Open Asset Import Library (ASSIMP)
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2006-2018, ASSIMP Development Team
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
with or without modification, are permitted provided that the
|
||||||
|
following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the
|
||||||
|
following disclaimer in the documentation and/or other
|
||||||
|
materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of the ASSIMP team, nor the names of its
|
||||||
|
contributors may be used to endorse or promote products
|
||||||
|
derived from this software without specific prior
|
||||||
|
written permission of the ASSIMP Development Team.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** MACHINE-GENERATED by scripts/ICFImporter/CppGenerator.py */
|
||||||
|
|
||||||
|
#ifndef INCLUDED_STEPFILE_READER_GEN_H
|
||||||
|
#define INCLUDED_STEPFILE_READER_GEN_H
|
||||||
|
|
||||||
|
#include "code/STEPFile.h"
|
||||||
|
|
||||||
|
namespace Assimp {
|
||||||
|
namespace StepFile {
|
||||||
|
using namespace STEP;
|
||||||
|
using namespace STEP::EXPRESS;
|
||||||
|
|
||||||
|
|
||||||
|
struct NotImplemented : public ObjectHelper<NotImplemented,0> {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ******************************************************************************
|
||||||
|
// StepFile Custom data types
|
||||||
|
// ******************************************************************************
|
||||||
|
|
||||||
|
{types}
|
||||||
|
|
||||||
|
|
||||||
|
// ******************************************************************************
|
||||||
|
// StepFile Entities
|
||||||
|
// ******************************************************************************
|
||||||
|
|
||||||
|
{predefs}
|
||||||
|
{entities}
|
||||||
|
|
||||||
|
void GetSchema(EXPRESS::ConversionSchema& out);
|
||||||
|
|
||||||
|
} //! StepFile
|
||||||
|
namespace STEP {
|
||||||
|
|
||||||
|
// ******************************************************************************
|
||||||
|
// Converter stubs
|
||||||
|
// ******************************************************************************
|
||||||
|
|
||||||
|
#define DECL_CONV_STUB(type) template <> size_t GenericFill<IFC::type>(const STEP::DB& db, const EXPRESS::LIST& params, IFC::type* in)
|
||||||
|
|
||||||
|
{converter-decl}
|
||||||
|
|
||||||
|
#undef DECL_CONV_STUB
|
||||||
|
|
||||||
|
} //! STEP
|
||||||
|
} //! Assimp
|
||||||
|
|
||||||
|
#endif // INCLUDED_STEPFILE_READER_GEN_H
|
|
@ -0,0 +1,64 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- Coding: UTF-8 -*-
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Open Asset Import Library (ASSIMP)
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Copyright (c) 2006-2018, ASSIMP Development Team
|
||||||
|
#
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use of this software in source and binary forms,
|
||||||
|
# with or without modification, are permitted provided that the following
|
||||||
|
# conditions are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above
|
||||||
|
# copyright notice, this list of conditions and the
|
||||||
|
# following disclaimer.
|
||||||
|
#
|
||||||
|
# * Redistributions in binary form must reproduce the above
|
||||||
|
# copyright notice, this list of conditions and the
|
||||||
|
# following disclaimer in the documentation and/or other
|
||||||
|
# materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# * Neither the name of the ASSIMP team, nor the names of its
|
||||||
|
# contributors may be used to endorse or promote products
|
||||||
|
# derived from this software without specific prior
|
||||||
|
# written permission of the ASSIMP Development Team.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
Entity_token = "ENTITY"
|
||||||
|
Type_token = "TYPE"
|
||||||
|
token = []
|
||||||
|
file = open(sys.argv[1])
|
||||||
|
output = open("step_entitylist.txt", "a")
|
||||||
|
lines = file.readlines()
|
||||||
|
for line in lines:
|
||||||
|
pos = line.find(Entity_token)
|
||||||
|
if pos != -1:
|
||||||
|
token = line.split(" ")
|
||||||
|
if len(token) > 1:
|
||||||
|
name = token[1]
|
||||||
|
print( "Writing entity " + name)
|
||||||
|
output.write(name)
|
||||||
|
|
||||||
|
output.close()
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -347,6 +347,34 @@ TEST_F(utglTF2ImportExport, importglTF2PrimitiveModeTrianglesFan) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<char> ReadFile(const char* name) {
|
||||||
|
std::vector<char> ret;
|
||||||
|
|
||||||
|
FILE* p = ::fopen(name, "r");
|
||||||
|
if (nullptr == p) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
::fseek(p, 0, SEEK_END);
|
||||||
|
const auto size = ::ftell(p);
|
||||||
|
::fseek(p, 0, SEEK_SET);
|
||||||
|
|
||||||
|
ret.resize(size);
|
||||||
|
::fread(&ret[0], 1, size, p);
|
||||||
|
::fclose(p);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(utglTF2ImportExport, importglTF2FromMemory) {
|
||||||
|
/*const auto flags = aiProcess_CalcTangentSpace | aiProcess_Triangulate | aiProcess_RemoveComponent |
|
||||||
|
aiProcess_GenSmoothNormals | aiProcess_PreTransformVertices | aiProcess_FixInfacingNormals |
|
||||||
|
aiProcess_FindDegenerates | aiProcess_GenUVCoords | aiProcess_SortByPType;
|
||||||
|
const auto& buff = ReadFile("C:\\Users\\kimkulling\\Downloads\\camel\\camel\\scene.gltf");*/
|
||||||
|
/*const aiScene* Scene = ::aiImportFileFromMemory(&buff[0], buff.size(), flags, ".gltf");
|
||||||
|
EXPECT_EQ( nullptr, Scene );*/
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||||
TEST_F( utglTF2ImportExport, exportglTF2FromFileTest ) {
|
TEST_F( utglTF2ImportExport, exportglTF2FromFileTest ) {
|
||||||
EXPECT_TRUE( exporterTest() );
|
EXPECT_TRUE( exporterTest() );
|
||||||
|
|
Loading…
Reference in New Issue