Build Assimp from source

This commit is contained in:
Dane Johnson
2021-03-15 13:46:19 -05:00
parent b7a83a2876
commit a41fcbe7f4
2126 changed files with 1385127 additions and 40 deletions

View File

@@ -0,0 +1,4 @@
code/*.{%{cpp}}
contrib/**/*.{%{cpp}}
include/**/*.{%{cpp}}
test/**/*.{%{cpp}}

View File

@@ -0,0 +1,177 @@
#!/usr/bin/env ruby
#
# mtime_cache
# Copyright (c) 2016 Borislav Stanimirov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
require 'digest/md5'
require 'json'
require 'fileutils'
VERSION = "1.0.2"
VERSION_TEXT = "mtime_cache v#{VERSION}"
USAGE = <<ENDUSAGE
Usage:
mtime_cache [<globs>] [-g globfile] [-d] [-q|V] [-c cache]
ENDUSAGE
HELP = <<ENDHELP
Traverse through globbed files, making a json cache based on their mtime.
If a cache exists, changes the mtime of existing unchanged (based on MD5
hash) files to the one in the cache.
Options:
globs Ruby-compatible glob strings (ex some/path/**/*.java)
A extension pattern is allowd in the form %{pattern}
(ex some/path/*.{%{pattern1},%{pattern2}})
The globs support the following patterns:
%{cpp} - common C++ extensions
-g, --globfile A file with list of globs to perform (one per line)
-?, -h, --help Show this help message.
-v, --version Show the version number (#{VERSION})
-q, --quiet Don't log anything to stdout
-V, --verbose Show extra logging
-d, --dryrun Don't change any files on the filesystem
-c, --cache Specify the cache file for input and output.
[Default is .mtime_cache.json]
ENDHELP
param_arg = nil
ARGS = { :cache => '.mtime_cache.json', :globs => [] }
ARGV.each do |arg|
case arg
when '-g', '--globfile' then param_arg = :globfile
when '-h', '-?', '--help' then ARGS[:help] = true
when '-v', '--version' then ARGS[:ver] = true
when '-q', '--quiet' then ARGS[:quiet] = true
when '-V', '--verbose' then ARGS[:verbose] = true
when '-d', '--dryrun' then ARGS[:dry] = true
when '-c', '--cache' then param_arg = :cache
else
if param_arg
ARGS[param_arg] = arg
param_arg = nil
else
ARGS[:globs] << arg
end
end
end
def log(text, level = 0)
return if ARGS[:quiet]
return if level > 0 && !ARGS[:verbose]
puts text
end
if ARGS[:ver] || ARGS[:help]
log VERSION_TEXT
exit if ARGS[:ver]
log USAGE
log HELP
exit
end
if ARGS[:globs].empty? && !ARGS[:globfile]
log 'Error: Missing globs'
log USAGE
exit 1
end
EXTENSION_PATTERNS = {
:cpp => "c,cc,cpp,cxx,h,hpp,hxx,inl,ipp,inc,ixx"
}
cache_file = ARGS[:cache]
cache = {}
if File.file?(cache_file)
log "Found #{cache_file}"
cache = JSON.parse(File.read(cache_file))
log "Read #{cache.length} entries"
else
log "#{cache_file} not found. A new one will be created"
end
globs = ARGS[:globs].map { |g| g % EXTENSION_PATTERNS }
globfile = ARGS[:globfile]
if globfile
File.open(globfile, 'r').each_line do |line|
line.strip!
next if line.empty?
globs << line % EXTENSION_PATTERNS
end
end
if globs.empty?
log 'Error: No globs in globfile'
log USAGE
exit 1
end
files = {}
num_changed = 0
globs.each do |glob|
Dir[glob].each do |file|
next if !File.file?(file)
mtime = File.mtime(file).to_i
hash = Digest::MD5.hexdigest(File.read(file))
cached = cache[file]
if cached && cached['hash'] == hash && cached['mtime'] < mtime
mtime = cached['mtime']
log "mtime_cache: changing mtime of #{file} to #{mtime}", 1
File.utime(File.atime(file), Time.at(mtime), file) if !ARGS[:dry]
num_changed += 1
else
log "mtime_cache: NOT changing mtime of #{file}", 1
end
files[file] = { 'mtime' => mtime, 'hash' => hash }
end
end
log "Changed mtime of #{num_changed} of #{files.length} files"
log "Writing #{cache_file}"
if !ARGS[:dry]
dirname = File.dirname(cache_file)
unless File.directory?(dirname)
FileUtils.mkdir_p(dirname)
end
File.open(cache_file, 'w').write(JSON.pretty_generate(files))
end

View File

@@ -0,0 +1,56 @@
/*
Open Asset Import Library (ASSIMP)
----------------------------------------------------------------------
Copyright (c) 2006-2016, 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.
----------------------------------------------------------------------
*/
/** @file BlenderScene.cpp
* @brief MACHINE GENERATED BY ./scripts/BlenderImporter/genblenddna.py
*/
#include "AssimpPCH.h"
#ifndef AI_BUILD_NO_BLEND_IMPORTER
#include "BlenderDNA.h"
#include "BlenderScene.h"
#include "BlenderSceneGen.h"
using namespace Assimp;
using namespace Assimp::Blender;
<HERE>
#endif

View File

@@ -0,0 +1,55 @@
/*
Open Asset Import Library (ASSIMP)
----------------------------------------------------------------------
Copyright (c) 2006-2016, 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.
----------------------------------------------------------------------
*/
/** @file BlenderSceneGen.h
* @brief MACHINE GENERATED BY ./scripts/BlenderImporter/genblenddna.py
*/
#ifndef INCLUDED_AI_BLEND_SCENEGEN_H
#define INCLUDED_AI_BLEND_SCENEGEN_H
namespace Assimp {
namespace Blender {
<HERE>
}
}
#endif

View File

@@ -0,0 +1,299 @@
#!/usr/bin/env python3
# -*- Coding: UTF-8 -*-
# ---------------------------------------------------------------------------
# Open Asset Import Library (ASSIMP)
# ---------------------------------------------------------------------------
#
# Copyright (c) 2006-2016, 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.
# ---------------------------------------------------------------------------
"""Generate BlenderSceneGen.h and BlenderScene.cpp from the
data structures in BlenderScene.h to map from *any* DNA to
*our* DNA"""
import sys
import os
import re
inputfile = os.path.join("..","..","code","BlenderScene.h")
outputfile_gen = os.path.join("..","..","code","BlenderSceneGen.h")
outputfile_src = os.path.join("..","..","code","BlenderScene.cpp")
template_gen = "BlenderSceneGen.h.template"
template_src = "BlenderScene.cpp.template"
# workaround for stackoverflowing when reading the linked list of scene objects
# with the usual approach. See embedded notes for details.
Structure_Convert_Base_fullcode = """
template <> void Structure::Convert<Base>( Base& dest, const FileDatabase& db ) const {
// note: as per https://github.com/assimp/assimp/issues/128,
// reading the Object linked list recursively is prone to stack overflow.
// This structure converter is therefore an hand-written exception that
// does it iteratively.
const int initial_pos = db.reader->GetCurrentPos();
std::pair<Base*, int> todo = std::make_pair(&dest, initial_pos);
Base* saved_prev = NULL;
while(true) {
Base& cur_dest = *todo.first;
db.reader->SetCurrentPos(todo.second);
// we know that this is a double-linked, circular list which we never
// traverse backwards, so don't bother resolving the back links.
cur_dest.prev = NULL;
ReadFieldPtr<ErrorPolicy_Warn>(cur_dest.object,"*object",db);
// just record the offset of the blob data and allocate storage.
// Does _not_ invoke Convert() recursively.
const int old = db.reader->GetCurrentPos();
// the return value of ReadFieldPtr indicates whether the object
// was already cached. In this case, we don't need to resolve
// it again.
if(!ReadFieldPtr<ErrorPolicy_Warn>(cur_dest.next,"*next",db, true) && cur_dest.next) {
todo = std::make_pair(&*cur_dest.next, db.reader->GetCurrentPos());
continue;
}
break;
}
db.reader->SetCurrentPos(initial_pos + size);
}
"""
Structure_Convert_decl = """
template <> void Structure :: Convert<{a}> (
{a}& dest,
const FileDatabase& db
) const
"""
Structure_Convert_ptrdecl = """
ReadFieldPtr<{policy}>({destcast}dest.{name_canonical},"{name_dna}",db);"""
Structure_Convert_rawptrdecl = """
{{
boost::shared_ptr<{type}> {name_canonical};
ReadFieldPtr<{policy}>({destcast}{name_canonical},"{name_dna}",db);
dest.{name_canonical} = {name_canonical}.get();
}}"""
Structure_Convert_arraydecl = """
ReadFieldArray<{policy}>({destcast}dest.{name_canonical},"{name_dna}",db);"""
Structure_Convert_arraydecl2d = """
ReadFieldArray2<{policy}>({destcast}dest.{name_canonical},"{name_dna}",db);"""
Structure_Convert_normal = """
ReadField<{policy}>({destcast}dest.{name_canonical},"{name_dna}",db);"""
DNA_RegisterConverters_decl = """
void DNA::RegisterConverters() """
DNA_RegisterConverters_add = """
converters["{a}"] = DNA::FactoryPair( &Structure::Allocate<{a}>, &Structure::Convert<{a}> );"""
map_policy = {
"" : "ErrorPolicy_Igno"
,"IGNO" : "ErrorPolicy_Igno"
,"WARN" : "ErrorPolicy_Warn"
,"FAIL" : "ErrorPolicy_Fail"
}
#
def main():
# -----------------------------------------------------------------------
# Parse structure definitions from BlenderScene.h
input = open(inputfile,"rt").read()
#flags = re.ASCII|re.DOTALL|re.MULTILINE
flags = re.DOTALL|re.MULTILINE
#stripcoms = re.compile(r"/\*(.*?)*\/",flags)
getstruct = re.compile(r"struct\s+(\w+?)\s*(:\s*ElemBase)?\s*\{(.*?)^\}\s*;",flags)
getsmartx = re.compile(r"(std\s*::\s*)?(vector)\s*<\s*(boost\s*::\s*)?shared_(ptr)\s*<\s*(\w+)\s*>\s*>\s*",flags)
getsmartp = re.compile(r"(boost\s*::\s*)?shared_(ptr)\s*<\s*(\w+)\s*>\s*",flags)
getrawp = re.compile(r"(\w+)\s*\*\s*",flags)
getsmarta = re.compile(r"(std\s*::\s*)?(vector)\s*<\s*(\w+)\s*>\s*",flags)
getpolicy = re.compile(r"\s*(WARN|FAIL|IGNO)",flags)
stripenum = re.compile(r"enum\s+(\w+)\s*{.*?\}\s*;",flags)
assert getsmartx and getsmartp and getsmarta and getrawp and getpolicy and stripenum
enums = set()
#re.sub(stripcoms," ",input)
#print(input)
hits = {}
while 1:
match = re.search(getstruct,input)
if match is None:
break
tmp = match.groups()[2]
while 1:
match2 = re.search(stripenum,tmp)
if match2 is None:
break
tmp = tmp[match2.end():]
enums.add(match2.groups()[0])
hits[match.groups()[0]] = list(
filter(lambda x:x[:2] != "//" and len(x),
map(str.strip,
re.sub(stripenum," ",match.groups()[2]).split(";")
)))
input = input[match.end():]
for e in enums:
print("Enum: "+e)
for k,v in hits.items():
out = []
for line in v:
policy = "IGNO"
py = re.search(getpolicy,line)
if not py is None:
policy = py.groups()[0]
line = re.sub(getpolicy,"",line)
ty = re.match(getsmartx,line) or re.match(getsmartp,line) or\
re.match(getsmarta,line) or re.match(getrawp,line)
if ty is None:
ty = line.split(None,1)[0]
else:
if len(ty.groups()) == 1:
ty = ty.groups()[-1] + "$"
elif ty.groups()[1] == "ptr":
ty = ty.groups()[2] + "*"
elif ty.groups()[1] == "vector":
ty = ty.groups()[-1] + ("*" if len(ty.groups()) == 3 else "**")
else:
assert False
#print(line)
sp = line.split(',')
out.append((ty,sp[0].split(None)[-1].strip(),policy))
for m in sp[1:]:
out.append((ty,m.strip(),policy))
v[:] = out
print("Structure {0}".format(k))
for elem in out:
print("\t"+"\t".join(elem))
print("")
output = open(outputfile_gen,"wt")
templt = open(template_gen,"rt").read()
s = ""
# -----------------------------------------------------------------------
# Structure::Convert<T> declarations for all supported structures
for k,v in hits.items():
s += Structure_Convert_decl.format(a=k)+";\n";
output.write(templt.replace("<HERE>",s))
output = open(outputfile_src,"wt")
templt = open(template_src,"rt").read()
s = ""
# -----------------------------------------------------------------------
# Structure::Convert<T> definitions for all supported structures
for k,v in hits.items():
s += "//" + "-"*80
if k == 'Base':
s += Structure_Convert_Base_fullcode
continue
s += Structure_Convert_decl.format(a=k)+ "{ \n";
for type, name, policy in v:
splits = name.split("[",1)
name_canonical = splits[0]
#array_part = "" if len(splits)==1 else "["+splits[1]
is_raw_ptr = not not type.count("$")
ptr_decl = "*"*(type.count("*") + (1 if is_raw_ptr else 0))
name_dna = ptr_decl+name_canonical #+array_part
#required = "false"
policy = map_policy[policy]
destcast = "(int&)" if type in enums else ""
# POINTER
if is_raw_ptr:
type = type.replace('$','')
s += Structure_Convert_rawptrdecl.format(**locals())
elif ptr_decl:
s += Structure_Convert_ptrdecl.format(**locals())
# ARRAY MEMBER
elif name.count('[')==1:
s += Structure_Convert_arraydecl.format(**locals())
elif name.count('[')==2:
s += Structure_Convert_arraydecl2d.format(**locals())
# NORMAL MEMBER
else:
s += Structure_Convert_normal.format(**locals())
s += "\n\n\tdb.reader->IncPtr(size);\n}\n\n"
# -----------------------------------------------------------------------
# DNA::RegisterConverters - collect all available converter functions
# in a std::map<name,converter_proc>
#s += "#if 0\n"
s += "//" + "-"*80 + DNA_RegisterConverters_decl + "{\n"
for k,v in hits.items():
s += DNA_RegisterConverters_add.format(a=k)
s += "\n}\n"
#s += "#endif\n"
output.write(templt.replace("<HERE>",s))
# we got here, so no error
return 0
if __name__ == "__main__":
sys.exit(main())

View File

@@ -0,0 +1,10 @@
material %_materialName
{
set $specular %_specular
set $diffuse %_diffuse
set $ambient %_ambient
set $colormap %color._texture
set $normalmap %normal._texture
}

View File

@@ -0,0 +1,304 @@
#!/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.
# ---------------------------------------------------------------------------
"""Generate the C++ glue code needed to map EXPRESS to C++"""
import sys, os, re
if sys.version_info < (3, 0):
print("must use python 3.0 or greater")
sys.exit(-2)
use_ifc_template = False
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_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_ni = '\ttypedef NotImplemented {entity}; // (not currently used by Assimp)\n'
template_entity = r"""
// C++ wrapper for {entity}
struct {entity} : {parent} ObjectHelper<{entity},{argcnt}> {{ {entity}() : Object("{entity}") {{}}
{fields}
}};"""
template_entity_ni = ''
template_type = r"""
// C++ wrapper type for {type}
typedef {real_type} {type};"""
template_stub_decl = '\tDECL_CONV_STUB({type});\n'
template_schema = '\t\tSchemaEntry("{normalized_name}",&STEP::ObjectHelper<{type},{argcnt}>::Construct )\n'
template_schema_type = '\t\tSchemaEntry("{normalized_name}",nullptr )\n'
template_converter = r"""
// -----------------------------------------------------------------------------------------------------------
template <> size_t GenericFill<{type}>(const DB& db, const LIST& params, {type}* in)
{{
{contents}
}}"""
template_converter_prologue_a = '\tsize_t base = GenericFill(db,params,static_cast<{parent}*>(in));\n'
template_converter_prologue_b = '\tsize_t base = 0;\n'
template_converter_check_argcnt = '\tif (params.GetSize() < {max_arg}) {{ throw STEP::TypeError("expected {max_arg} arguments to {name}"); }}'
template_converter_code_per_field = r""" do {{ // convert the '{fieldname}' argument
std::shared_ptr<const DataType> arg = params[base++];{handle_unset}{convert}
}} while(0);
"""
template_allow_optional = r"""
if (dynamic_cast<const UNSET*>(&*arg)) break;"""
template_allow_derived = r"""
if (dynamic_cast<const ISDERIVED*>(&*arg)) {{ in->ObjectHelper<Assimp::IFC::{type},{argcnt}>::aux_is_derived[{argnum}]=true; break; }}"""
template_convert_single = r"""
try {{ GenericConvert( in->{name}, arg, db ); break; }}
catch (const TypeError& t) {{ throw TypeError(t.what() + std::string(" - expected argument {argnum} to {classname} to be a `{full_type}`")); }}"""
template_converter_omitted = '// this data structure is not used yet, so there is no code generated to fill its members\n'
template_converter_epilogue = '\treturn base;'
import ExpressReader
def get_list_bounds(collection_spec):
start,end = [(int(n) if n!='?' else 0) for n in re.findall(r'(\d+|\?)',collection_spec)]
return start,end
def get_cpp_type(field,schema):
isobjref = field.type in schema.entities
base = field.type
if isobjref:
base = 'Lazy< '+(base if base in schema.whitelist else 'NotImplemented')+' >'
if field.collection:
start,end = get_list_bounds(field.collection)
base = 'ListOf< {0}, {1}, {2} >'.format(base,start,end)
if not isobjref:
base += '::Out'
if field.optional:
base = 'Maybe< '+base+' >'
return base
def generate_fields(entity,schema):
fields = []
for e in entity.members:
fields.append('\t\t{type} {name};'.format(type=get_cpp_type(e,schema),name=e.name))
return '\n'.join(fields)
def handle_unset_args(field,entity,schema,argnum):
n = ''
# if someone derives from this class, check for derived fields.
if any(entity.name==e.parent for e in schema.entities.values()):
n += template_allow_derived.format(type=entity.name,argcnt=len(entity.members),argnum=argnum)
if not field.optional:
return n+''
return n+template_allow_optional.format()
def get_single_conversion(field,schema,argnum=0,classname='?'):
name = field.name
return template_convert_single.format(name=name,argnum=argnum,classname=classname,full_type=field.fullspec)
def count_args_up(entity,schema):
return len(entity.members) + (count_args_up(schema.entities[entity.parent],schema) if entity.parent else 0)
def resolve_base_type(base,schema):
if base in ('INTEGER','REAL','STRING','ENUMERATION','BOOLEAN','NUMBER', 'SELECT','LOGICAL'):
return base
if base in schema.types:
return resolve_base_type(schema.types[base].equals,schema)
print(base)
return None
def gen_type_struct(typen,schema):
base = resolve_base_type(typen.equals,schema)
if not base:
return ''
if typen.aggregate:
start,end = get_list_bounds(typen.aggregate)
base = 'ListOf< {0}, {1}, {2} >'.format(base,start,end)
return template_type.format(type=typen.name,real_type=base)
def gen_converter(entity,schema):
max_arg = count_args_up(entity,schema)
arg_idx = arg_idx_ofs = max_arg - len(entity.members)
code = template_converter_prologue_a.format(parent=entity.parent) if entity.parent else template_converter_prologue_b
if entity.name in schema.blacklist_partial:
return code+template_converter_omitted+template_converter_epilogue;
if max_arg > 0:
code +=template_converter_check_argcnt.format(max_arg=max_arg,name=entity.name)
for field in entity.members:
code += template_converter_code_per_field.format(fieldname=field.name,
handle_unset=handle_unset_args(field,entity,schema,arg_idx-arg_idx_ofs),
convert=get_single_conversion(field,schema,arg_idx,entity.name))
arg_idx += 1
return code+template_converter_epilogue
def get_base_classes(e,schema):
def addit(e,out):
if e.parent:
out.append(e.parent)
addit(schema.entities[e.parent],out)
res = []
addit(e,res)
return list(reversed(res))
def get_derived(e,schema):
def get_deriv(e,out): # bit slow, but doesn't matter here
s = [ee for ee in schema.entities.values() if ee.parent == e.name]
for sel in s:
out.append(sel.name)
get_deriv(sel,out)
res = []
get_deriv(e,res)
return res
def get_hierarchy(e,schema):
return get_derived(e, schema)+[e.name]+get_base_classes(e,schema)
def sort_entity_list(schema):
deps = []
entities = schema.entities
for e in entities.values():
deps += get_base_classes(e,schema)+[e.name]
checked = []
for e in deps:
if e not in checked:
checked.append(e)
return [entities[e] for e in checked]
def work(filename):
schema = ExpressReader.read(filename,silent=True)
entities, stub_decls, schema_table, converters, typedefs, predefs = '','',[],'','',''
entitylist = 'ifc_entitylist.txt'
if not use_ifc_template:
entitylist = 'step_entitylist.txt'
whitelist = []
with open(entitylist, 'rt') as inp:
whitelist = [n.strip() for n in inp.read().split('\n') if n[:1]!='#' and n.strip()]
schema.whitelist = set()
schema.blacklist_partial = set()
for ename in whitelist:
try:
e = schema.entities[ename]
except KeyError:
# type, not entity
continue
for base in [e.name]+get_base_classes(e,schema):
schema.whitelist.add(base)
for base in get_derived(e,schema):
schema.blacklist_partial.add(base)
schema.blacklist_partial -= schema.whitelist
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
# (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.
#schema.whitelist = set(schema.entities.keys())
#schema.blacklist_partial = set()
for ntype in schema.types.values():
typedefs += gen_type_struct(ntype,schema)
schema_table.append(template_schema_type.format(normalized_name=ntype.name.lower()))
sorted_entities = sort_entity_list(schema)
for entity in sorted_entities:
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:
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)))
entities += template_entity.format(entity=entity.name,argcnt=len(entity.members),parent=parent,fields=generate_fields(entity,schema))
predefs += template_entity_predef.format(entity=entity.name)
stub_decls += template_stub_decl.format(type=entity.name)
else:
entities += template_entity_ni.format(entity=entity.name)
predefs += template_entity_predef_ni.format(entity=entity.name)
schema_table.append(template_schema.format(type="NotImplemented",normalized_name=entity.name.lower(),argcnt=0))
schema_table = ','.join(schema_table)
with open(input_template_h,'rt') as inp:
with open(output_file_h,'wt') as outp:
# can't use format() here since the C++ code templates contain single, unescaped curly brackets
outp.write(inp.read().replace('{predefs}',predefs).replace('{types}',typedefs).replace('{entities}',entities).replace('{converter-decl}',stub_decls))
with open(input_template_cpp,'rt') as inp:
with open(output_file_cpp,'wt') as outp:
outp.write(inp.read().replace('{schema-static-table}',schema_table).replace('{converter-impl}',converters))
# Finished without error, so return 0
return 0
if __name__ == "__main__":
sys.exit(work(sys.argv[1] if len(sys.argv)>1 else 'schema.exp'))

View File

@@ -0,0 +1,123 @@
#!/usr/bin/env python3
# -*- Coding: UTF-8 -*-
# ---------------------------------------------------------------------------
# Open Asset Import Library (ASSIMP)
# ---------------------------------------------------------------------------
#
# Copyright (c) 2006-2010, 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.
# ---------------------------------------------------------------------------
"""Parse an EXPRESS file and extract basic information on all
entities and data types contained"""
import sys
import re
from collections import OrderedDict
re_match_entity = re.compile(r"""
ENTITY\s+(\w+)\s* # 'ENTITY foo'
.*? # skip SUPERTYPE-of
(?:SUBTYPE\s+OF\s+\((\w+)\))?; # 'SUBTYPE OF (bar);' or simply ';'
(.*?) # 'a : atype;' (0 or more lines like this)
(?:(?:INVERSE|UNIQUE|WHERE)\s*$.*?)? # skip the INVERSE, UNIQUE, WHERE clauses and everything behind
END_ENTITY;
""",re.VERBOSE|re.DOTALL|re.MULTILINE)
re_match_type = re.compile(r"""
TYPE\s+(\w+?)\s*=\s*((?:LIST|SET)\s*\[\d+:[\d?]+\]\s*OF)?(?:\s*UNIQUE)?\s*(\w+) # TYPE foo = LIST[1:2] of blub
(?:(?<=ENUMERATION)\s*OF\s*\((.*?)\))?
.*? # skip the WHERE clause
END_TYPE;
""",re.VERBOSE|re.DOTALL)
re_match_field = re.compile(r"""
\s+(\w+?)\s*:\s*(OPTIONAL)?\s*((?:LIST|SET)\s*\[\d+:[\d?]+\]\s*OF)?(?:\s*UNIQUE)?\s*(\w+?);
""",re.VERBOSE|re.DOTALL)
class Schema:
def __init__(self):
self.entities = OrderedDict()
self.types = OrderedDict()
class Entity:
def __init__(self,name,parent,members):
self.name = name
self.parent = parent
self.members = members
class Field:
def __init__(self,name,type,optional,collection):
self.name = name
self.type = type
self.optional = optional
self.collection = collection
self.fullspec = (self.collection+' ' if self.collection else '') + self.type
class Type:
def __init__(self,name,aggregate,equals,enums):
self.name = name
self.aggregate = aggregate
self.equals = equals
self.enums = enums
def read(filename, silent=False):
schema = Schema()
print( "Try to read EXPRESS schema file" + filename)
with open(filename,'rt') as inp:
contents = inp.read()
types = re.findall(re_match_type,contents)
for name,aggregate,equals,enums in types:
schema.types[name] = Type(name,aggregate,equals,enums)
entities = re.findall(re_match_entity,contents)
for name,parent,fields_raw in entities:
print('process entity {0}, parent is {1}'.format(name,parent)) if not silent else None
fields = re.findall(re_match_field,fields_raw)
members = [Field(name,type,opt,coll) for name, opt, coll, type in fields]
print(' got {0} fields'.format(len(members))) if not silent else None
schema.entities[name] = Entity(name,parent,members)
return schema
if __name__ == "__main__":
sys.exit(read(sys.argv[1] if len(sys.argv)>1 else 'schema.exp'))

View File

@@ -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_IFC_IMPORTER
#include "IFCReaderGen.h"
namespace Assimp {
using namespace IFC;
namespace {
typedef EXPRESS::ConversionSchema::SchemaEntry SchemaEntry;
const SchemaEntry schema_raw[] = {
{schema-static-table}
};
}
// -----------------------------------------------------------------------------------------------------------
void IFC::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

View File

@@ -0,0 +1,91 @@
/*
Open Asset Import Library (ASSIMP)
----------------------------------------------------------------------
Copyright (c) 2006-2010, 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_IFC_READER_GEN_H
#define INCLUDED_IFC_READER_GEN_H
#include "STEPFile.h"
namespace Assimp {
namespace IFC {
using namespace STEP;
using namespace STEP::EXPRESS;
struct NotImplemented : public ObjectHelper<NotImplemented,0> {
};
// ******************************************************************************
// IFC Custom data types
// ******************************************************************************
{types}
// ******************************************************************************
// IFC Entities
// ******************************************************************************
{predefs}
{entities}
void GetSchema(EXPRESS::ConversionSchema& out);
} //! IFC
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_IFC_READER_GEN_H

View File

@@ -0,0 +1,78 @@
/*
Open Asset Import Library (ASSIMP)
----------------------------------------------------------------------
Copyright (c) 2006-2019, 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_STEP_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 0u;
}
{converter-impl}
} // ! STEP
} // ! Assimp
#endif

View File

@@ -0,0 +1,90 @@
/*
Open Asset Import Library (ASSIMP)
----------------------------------------------------------------------
Copyright (c) 2006-2019, 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

View File

@@ -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()

View File

@@ -0,0 +1,3 @@
#!/bin/sh
cd ../../code
grep -E 'Ifc([A-Z][a-z]*)+' -o IFCLoader.cpp IFCGeometry.cpp IFCCurve.cpp IFCProfile.cpp IFCMaterial.cpp | uniq | sed s/.*:// > ../scripts/IFCImporter/output.txt

View File

@@ -0,0 +1,111 @@
# ==============================================================================
# List of IFC structures needed by Assimp
# ==============================================================================
# use genentitylist.sh to update this list
# This machine-generated list is not complete, it lacks many intermediate
# classes in the inheritance hierarchy. Those are magically augmented by the
# code generator. Also, the names of all used entities need to be present
# in the source code for this to work.
IfcAnnotation
IfcArbitraryClosedProfileDef
IfcArbitraryOpenProfileDef
IfcArbitraryProfileDefWithVoids
IfcAxis1Placement
IfcAxis2Placement
IfcAxis2Placement2D
IfcAxis2Placement3D
IfcBooleanClippingResult
IfcBooleanResult
IfcBoundedCurve
IfcBoundingBox
IfcBSplineCurve
IfcBuilding
IfcCartesianPoint
IfcCartesianTransformationOperator
IfcCartesianTransformationOperator3D
IfcCartesianTransformationOperator3DnonUniform
IfcCircle
IfcCircleHollowProfileDef
IfcCircleProfileDef
IfcClosedShell
IfcColourOrFactor
IfcColourRgb
IfcCompositeCurve
IfcCompositeCurveSegment
IfcConic
IfcConnectedFaceSet
IfcConversionBasedUnit
IfcCurve
IfcDirection
IfcDoor
IfcEllipse
IfcExtrudedAreaSolid
IfcFace
IfcFaceBasedSurfaceModel
IfcFaceBound
IfcFaceOuterBound
IfcFeatureElementSubtraction
IfcGeometricRepresentationContext
IfcGeometricRepresentationItem
IfcHalfSpaceSolid
IfcLine
IfcLocalPlacement
IfcManifoldSolidBrep
IfcMappedItem
IfcMeasureWithUnit
IfcNamedUnit
IfcObjectDefinition
IfcObjectPlacement
IfcOpeningElement
IfcParameterizedProfileDef
IfcPlane
IfcPolygonalBoundedHalfSpace
IfcPolyline
IfcPolyLoop
IfcPresentationStyleAssignment
IfcPresentationStyleSelect
IfcProduct
IfcProductRepresentation
IfcProfileDef
IfcProject
IfcRectangleProfileDef
IfcRelAggregates
IfcRelContainedInSpatialStructure
IfcRelFillsElement
IfcRelVoidsElement
IfcRepresentation
IfcRepresentationContext
IfcRepresentationItem
IfcRepresentationMap
IfcRevolvedAreaSolid
IfcShell
IfcShellBasedSurfaceModel
IfcSite
IfcSIUnit
IfcSomething
IfcSpace
IfcSpatialStructureElement
IfcSpatialStructureElements
IfcStyledItem
IfcSurfaceStyle
IfcSurfaceStyleElementSelect
IfcSurfaceStyleRendering
IfcSurfaceStyleShading
IfcSurfaceStyleWithTextures
IfcSweptAreaSolid
IfcSweptDiskSolid
IfcTopologicalRepresentationItem
IfcTrimmedCurve
IfcUnit
IfcUnitAssignment
IfcVector
IfcIShapeProfileDef
IfcPropertyListValue
IfcRelDefinesByProperties
IfcPropertySet
IfcPropertySingleValue
IfcProperty
IfcComplexProperty
IfcElementQuantity

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
declare -a headers=("fast_atof.h"
"qnan.h"
"BaseImporter.h"
"Hash.h"
"MemoryIOWrapper.h"
"ParsingUtils.h"
"StreamReader.h"
"StreamWriter.h"
"StringComparison.h"
"StringUtils.h"
"SGSpatialSort.h"
"GenericProperty.h"
"SpatialSort.h"
"SkeletonMeshBuilder.h"
"SmoothingGroups.h"
"StandardShapes.h"
"RemoveComments.h"
"Subdivision.h"
"Vertex.h"
"LineSplitter.h"
"TinyFormatter.h"
"Profiler.h"
"LogAux.h"
"Bitmap.h"
"XMLTools.h"
"IOStreamBuffer.h"
"CreateAnimMesh.h"
"irrXMLWrapper.h"
"BlobIOSystem.h"
"MathFunctions.h"
"Macros.h"
"Exceptional.h"
"ByteSwapper.h")
for i in "${headers[@]}"
do
find . -type f -exec sed -i "s,<../code/$i>,<assimp/$i>,g" {} \;
done

View File

@@ -0,0 +1,28 @@
@echo off
set ASSIMP_PATH=D:\projects\asset-importer-lib\assimp
set CMAKE_PATH="C:\Program Files\CMake\bin\cmake.exe"
set ANDROID_NDK_PATH=C:\Users\kimkulling\AppData\Local\Android\Sdk\ndk-bundle
set ANDROID_CMAKE_PATH=contrib\android-cmake
pushd %ASSIMP_PATH%
rmdir /s /q build
mkdir build
cd build
%CMAKE_PATH% .. ^
-G"MinGW Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_TOOLCHAIN_FILE=%ANDROID_CMAKE_PATH%\android.toolchain.cmake ^
-DCMAKE_MAKE_PROGRAM=%ANDROID_NDK_PATH%\prebuilt\windows-x86_64\bin\make.exe ^
-DANDROID_NDK=%ANDROID_NDK_PATH% ^
-DANDROID_NATIVE_API_LEVEL=android-9 ^
-DASSIMP_ANDROID_JNIIOSYSTEM=ON ^
-DANDROID_ABI=arm64-v8a ^
-DASSIMP_BUILD_ZLIB=ON ^
-DASSIMP_BUILD_TESTS=OFF
%CMAKE_PATH% --build .
popd