Skip to content

Commit 8a197a6

Browse files
committed
Work on 3ds max plug-in
1 parent 91d10a1 commit 8a197a6

File tree

3 files changed

+31
-13
lines changed

3 files changed

+31
-13
lines changed

cmake/CMakeLists.txt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # not necessary, but encouraged
2323

2424
project (IfcOpenShell)
2525

26+
foreach(max_year RANGE 2014 2030)
27+
set(max_sdk "$ENV{ADSK_3DSMAX_SDK_${max_year}}")
28+
if (NOT "${max_sdk}" STREQUAL "")
29+
MESSAGE(STATUS "Autodesk 3ds Max SDK found at ${max_sdk}")
30+
set(HAS_MAX TRUE)
31+
endif()
32+
endforeach()
33+
2634
OPTION(UNICODE_SUPPORT "Build IfcOpenShell with Unicode support (requires ICU)." ON)
2735
OPTION(COLLADA_SUPPORT "Build IfcConvert with COLLADA support (requires OpenCOLLADA)." ON)
2836
OPTION(IFCXML_SUPPORT "Build IfcParse with ifcXML support (requires libxml2)." ON)
@@ -35,8 +43,11 @@ OPTION(BUILD_GEOMSERVER "Build IfcGeomServer executable." ON)
3543
OPTION(BUILD_CONVERT "Build IfcConvert executable." ON)
3644
OPTION(USE_VLD "Use Visual Leak Detector for debugging memory leaks, MSVC-only." OFF)
3745
OPTION(USE_MMAP "Adds a command line options to parse IFC files from memory mapped files using Boost.Iostreams" OFF)
38-
OPTION(BUILD_IFCMAX "Build IfcMax, a 3ds Max plug-in, Windows-only." OFF)
46+
if (${HAS_MAX})
47+
OPTION(BUILD_IFCMAX "Build IfcMax, a 3ds Max plug-in, Windows-only." ON)
48+
endif()
3949
OPTION(BUILD_SHARED_LIBS "Build IfcParse and IfcGeom as shared libs (SO/DLL)." OFF)
50+
4051
# TODO QtViewer is deprecated ATM as it uses the 0.4 API
4152
# OPTION(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer (requires Qt 4 framework)." OFF)
4253

@@ -100,10 +111,6 @@ UNIFY_ENVVARS_AND_CACHE(LIBXML2_INCLUDE_DIR)
100111
UNIFY_ENVVARS_AND_CACHE(LIBXML2_LIBRARIES)
101112
UNIFY_ENVVARS_AND_CACHE(PCRE_LIBRARY_DIR)
102113
UNIFY_ENVVARS_AND_CACHE(PYTHON_EXECUTABLE)
103-
IF(WIN32)
104-
UNIFY_ENVVARS_AND_CACHE(THREEDS_MAX_SDK_HOME)
105-
ENDIF()
106-
107114

108115
# Set INSTALL_RPATH for target
109116
MACRO(SET_INSTALL_RPATHS _target _paths)

src/ifcmax/CMakeLists.txt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,32 @@
1616
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
1717
# #
1818
################################################################################
19+
foreach(max_year RANGE 2014 2030)
20+
21+
set(max_sdk "$ENV{ADSK_3DSMAX_SDK_${max_year}}")
22+
if (NOT "${max_sdk}" STREQUAL "")
1923

2024
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${OCC_INCLUDE_DIR} ${OPENCOLLADA_INCLUDE_DIRS} ${ICU_INCLUDE_DIR}
21-
${Boost_INCLUDE_DIRS} ${THREEDS_MAX_SDK_HOME}/include
25+
${Boost_INCLUDE_DIRS} ${max_sdk}/include
2226
)
2327

2428
# All recent versions of 3ds Max (2014 and newer) are 64-bit only so assume lib/x64 directory
2529
LINK_DIRECTORIES(${LINK_DIRECTORIES} ${IfcOpenShell_BINARY_DIR} ${OCC_LIBRARY_DIR} ${OPENCOLLADA_LIBRARY_DIR}
26-
${ICU_LIBRARY_DIR} ${Boost_LIBRARY_DIRS} ${THREEDS_MAX_SDK_HOME}/lib/x64/Release
30+
${ICU_LIBRARY_DIR} ${Boost_LIBRARY_DIRS} ${max_sdk}/lib/x64/Release
2731
)
2832

29-
ADD_LIBRARY(IfcMax SHARED IfcMax.h IfcMax.cpp)
33+
ADD_LIBRARY(IfcMax_${max_year} SHARED IfcMax.h IfcMax.cpp)
3034

3135
# TODO: find the minimal subset of 3dsmax libraries to reference
32-
TARGET_LINK_LIBRARIES(IfcMax ${IFCOPENSHELL_LIBRARIES} Comctl32.lib zlibdll.lib bmm.lib core.lib CustDlg.lib edmodel.lib expr.lib
36+
TARGET_LINK_LIBRARIES(IfcMax_${max_year} ${IFCOPENSHELL_LIBRARIES} Comctl32.lib zlibdll.lib bmm.lib core.lib CustDlg.lib edmodel.lib expr.lib
3337
flt.lib geom.lib gfx.lib gup.lib imageViewers.lib ManipSys.lib maxnet.lib Maxscrpt.lib
3438
maxutil.lib MenuMan.lib menus.lib mesh.lib MNMath.lib Paramblk2.lib particle.lib Poly.lib RenderUtil.lib
3539
tessint.lib viewfile.lib ${OPENCASCADE_LIBRARIES}
3640
)
3741

38-
SET_TARGET_PROPERTIES(IfcMax PROPERTIES SUFFIX ".dli")
42+
SET_TARGET_PROPERTIES(IfcMax_${max_year} PROPERTIES SUFFIX ".dli")
43+
44+
INSTALL(TARGETS IfcMax_${max_year} RUNTIME DESTINATION ${BINDIR})
3945

40-
INSTALL(TARGETS IfcMax RUNTIME DESTINATION ${BINDIR})
46+
endif()
47+
endforeach()

src/ifcmax/IfcMax.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
#include <istdplug.h>
2525

2626
#include "IfcMax.h"
27-
#include "../ifcgeom/IfcGeomIterator.h"
27+
28+
#include "../ifcgeom_schema_agnostic/IfcGeomIterator.h"
29+
#include "../ifcgeom_schema_agnostic/IfcGeomMaterial.h"
30+
#include "../ifcgeom/IfcGeomElement.h"
2831

2932
static const int NUM_MATERIAL_SLOTS = 24;
3033

@@ -226,7 +229,8 @@ int IFCImp::DoImport(const TCHAR *name, ImpInterface *impitfc, Interface *itfc,
226229
const char* fn_mb = name;
227230
#endif
228231

229-
IfcGeom::Iterator<float> iterator(settings, fn_mb);
232+
IfcParse::IfcFile file(fn_mb);
233+
IfcGeom::Iterator<float> iterator(settings, &file);
230234
delete fn_mb;
231235
if (!iterator.initialize()) return false;
232236

0 commit comments

Comments
 (0)