Skip to content

Commit

Permalink
Merge pull request #546 from UfoProjects/misc/max-2018
Browse files Browse the repository at this point in the history
max 2018 support added
  • Loading branch information
RemiArnaud authored Aug 30, 2017
2 parents a748c0e + 33a7e00 commit e1f8a40
Show file tree
Hide file tree
Showing 23 changed files with 4,899 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This is so people without core.autocrlf set could work properly with project files.
*.vcxproj text eol=crlf
318 changes: 318 additions & 0 deletions COLLADABaseUtils/scripts/COLLADABaseUtils.vcxproj

Large diffs are not rendered by default.

304 changes: 304 additions & 0 deletions COLLADAFramework/scripts/COLLADAFramework.vcxproj

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions COLLADAMax/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ Requirements:
- Autodesk 3ds Max
To build the COLLADAMax plug-in you need to have a version of 3ds Max, including the SDK, installed.
Supported versions are:
3ds Max 2011, 2012, 2013, 2014, 2015
3ds Max 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018

- MS Visual Studio 2013 for loading the solution (should work with 2012)
- MS Visual Studio 2015 for loading the solution
MS Visual Studio 2008 to compile for Max 2011/2012
MS Visual Studio 2010 to compile for Max 2013/2014
MS Visual Studio 2012 to compile for Max 2015
MS Visual Studio 2012 to compile for Max 2015/2016
MS Visual Studio 2015 to compile for Max 2017
MS Visual Studio 2015 update 3 with Windows SDK 10.0.10586 for Max 2018

IMPORTANT : DO NOT let visual studio convert the project files if it ask to when loading the solution.
It is normal that the solution references different toolchains.
Expand Down
190 changes: 190 additions & 0 deletions COLLADAMax/COLLADAMax.sln

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions COLLADAMax/include/COLLADAMaxPrerequisites.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@
# define MAX_2017
#endif

#if ( MAX_VERSION_MAJOR >= 20 )
# define MAX_2018_OR_NEWER
#endif
#if ( MAX_VERSION_MAJOR == 20 )
# define MAX_2018
#endif

// Max 2009 requires RTTI to be enabled
#ifdef MAX_2009_OR_NEWER
#ifndef _CPPRTTI
Expand Down
2 changes: 2 additions & 0 deletions COLLADAMax/include/COLLADAMaxStableHeaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
# pragma message ("Compiling for Max2016")
#elif defined MAX_2017
# pragma message ("Compiling for Max2017")
#elif defined MAX_2018
# pragma message ("Compiling for Max2018")
#else
# error( "Unsupported Max version" )
#endif
Expand Down
533 changes: 533 additions & 0 deletions COLLADAMax/scripts/COLLADAMax.vcxproj

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion COLLADAMax/src/COLLADAMaxGeometryExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ namespace COLLADAMax
//---------------------------------------------------------------
void GeometryExporter::doExportMesh()
{

if( !mMorphControllerHelperGeometry && !(mExportNode->getIsInVisualScene() || mExportNode->getIsReferenced()) )
return;

Expand Down
49 changes: 31 additions & 18 deletions COLLADAMax/src/COLLADAMaxGeometryExtra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
Portions of the code are:
Copyright (c) 2005-2007 Feeling Software Inc.
Copyright (c) 2005-2007 Sony Computer Entertainment America
Based on the 3dsMax COLLADASW Tools:
Copyright (c) 2005-2006 Autodesk Media Entertainment
Licensed under the MIT Open Source License,
for details please see LICENSE file or the website
http://www.opensource.org/licenses/mit-license.php
Expand All @@ -24,15 +24,19 @@
#include <simpobj.h>

// class ids of the non standard primitives
#define CHAMFERBOX_CLASS_ID Class_ID( 0x1AD73F40,0x48EA0F97 )

#ifndef MAX_2018_OR_NEWER
#define CHAMFERBOX_CLASS_ID Class_ID( 0x1AD73F40,0x48EA0F97 )
#define PRISM_CLASS_ID Class_ID( 0x63705FAC,0x5C1F553F )
#define CHAMFERCYL_CLASS_ID Class_ID( 0x7B9A546E,0x21A446A1 )
#define CAPSULE_CLASS_ID Class_ID( 0x6D3D77AC,0x79C939A9 )
#endif

#define OILTANK_CLASS_ID Class_ID( 0x210E642A,0x22F11EF8 )
#define SPINDLE_CLASS_ID Class_ID( 0x130B141B,0x04B35AFE )
#define GENGON_CLASS_ID Class_ID( 0x49BF599F,0x35F945AB )
#define RINGWAVE_CLASS_ID Class_ID( 0x28E41F64,0x124B5312 )
#define PRISM_CLASS_ID Class_ID( 0x63705FAC,0x5C1F553F )
#define TORUSKNOT_CLASS_ID Class_ID( 0x00000720,0x00000000 )
#define CHAMFERCYL_CLASS_ID Class_ID( 0x7B9A546E,0x21A446A1 )
#define CAPSULE_CLASS_ID Class_ID( 0x6D3D77AC,0x79C939A9 )
#define L_EXT_CLASS_ID Class_ID( 0x09E73A08,0x08693067 )
#define C_EXT_CLASS_ID Class_ID( 0x33B1284D,0x7AF0200D )
#define HOSE_CLASS_ID Class_ID( 0x69F96A5D,0x235C430A )
Expand All @@ -41,14 +45,8 @@
#define SPIRALSTAIR_CLASS_ID Class_ID( 0x589D2C12,0x3D713EC9 )
#define UTYPESTAIR_CLASS_ID Class_ID( 0x5D56671C,0x20264CEB )



namespace COLLADAMax
{




const String GeometryExtra::ELEMENT_BOX = "max_box";
const String GeometryExtra::ELEMENT_SPHERE = "max_sphere";
const String GeometryExtra::ELEMENT_CYLINDER = "max_cylinder";
Expand Down Expand Up @@ -388,18 +386,20 @@ namespace COLLADAMax
//---------------------------------------------------------------
GeometryExtra::GeometryExtra ( COLLADASW::StreamWriter * streamWriter, DocumentExporter * documentExporter, Object * object, const String& geometryId )
: Extra ( streamWriter, documentExporter),
mStreamWriter(streamWriter),
mStreamWriter(streamWriter),
mObject ( object ),
mGeometryId(geometryId)
mGeometryId(geometryId)
{}

//---------------------------------------------------------------
void GeometryExtra::doExport()
{
Class_ID id = mObject->ClassID();

setExtraTechnique(this);
setExtraTechnique(this);

//TODO: At least on 3DS MAX 2018 many parameters are no longer exported
// e.g. radiuses on cone
if ( id == Class_ID ( BOXOBJ_CLASS_ID, 0 ) )
exportParamBlock ( ELEMENT_BOX, BOXPARAMETERS, BOXPARAMETERSCOUNT );
else if ( id == Class_ID ( SPHERE_CLASS_ID, 0 ) )
Expand All @@ -409,6 +409,8 @@ namespace COLLADAMax
else if ( id == Class_ID ( TORUS_CLASS_ID, 0 ) )
exportParamBlock ( ELEMENT_TORUS, TORUSPARAMETERS, TORUSPARAMETERSCOUNT );
else if ( id == Class_ID ( TEAPOT_CLASS_ID1, TEAPOT_CLASS_ID2 ) )
// Note that teapot class ID consists of two parts - ID1 & ID2.
// Thats one long ID...
exportParamBlock ( ELEMENT_TEAPOT, TEAPOTPARAMETERS, TEAPOTPARAMETERSCOUNT );
else if ( id == Class_ID ( CONE_CLASS_ID, 0 ) )
exportParamBlock ( ELEMENT_CONE, CONEPARAMETERS, CONEPARAMETERSCOUNT );
Expand Down Expand Up @@ -535,22 +537,33 @@ namespace COLLADAMax
fb.close();

#endif
addExtraTechniques(mStreamWriter);
addExtraTechniques(mStreamWriter);
}


//---------------------------------------------------------------
void GeometryExtra::exportParamBlock ( const String & elementName, const ExtraParameter extraParameters[], int extraParametersCount )
{
#ifdef MAX_2018_OR_NEWER
// For some reason on 3DS MAX 2018 all info required for extras is in
// same block. Separate methods are still required for older 3DS MAXes.
exportParamBlock2(elementName, extraParameters, extraParametersCount);
return;
#else
IParamBlock * paramBlock = mObject->GetParamBlock() ->GetParamBlock();
addParamBlockAnimatedExtraParameters(elementName, extraParameters, extraParametersCount, paramBlock, mGeometryId);
addParamBlockAnimatedExtraParameters(elementName, extraParameters, extraParametersCount, paramBlock, mGeometryId);
#endif
}

//---------------------------------------------------------------
void GeometryExtra::exportParamBlock2 ( const String & elementName, const ExtraParameter extraParameters[], int extraParametersCount )
{
#ifdef MAX_2018_OR_NEWER
IParamBlock2 * paramBlock = ( ( SimpleObject2 * ) mObject ) ->GetParamBlock(0);
#else
IParamBlock2 * paramBlock = ( ( SimpleObject2 * ) mObject ) ->pblock2;
addParamBlockAnimatedExtraParameters(elementName, extraParameters, extraParametersCount, paramBlock, mGeometryId);
#endif
addParamBlockAnimatedExtraParameters(elementName, extraParameters, extraParametersCount, paramBlock, mGeometryId);
}

}
13 changes: 10 additions & 3 deletions COLLADAMax/src/COLLADAMaxGoogleWarehouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ namespace COLLADAMax
, mFileMenu(mMenuManager ? mMenuManager->GetMainMenuBar()->GetItem(0)->GetSubMenu() : 0)
, mWarehouseItem(0)
{

}

const ActionTableId googleWarehouseTableActions = 0x7ff73cb5;
Expand All @@ -51,7 +50,6 @@ namespace COLLADAMax
//------------------------------
DWORD GoogleWarehouse::Start()
{

if ( !mWarehouseItem )
{
mWarehouseItem= GetIMenuItem();
Expand Down Expand Up @@ -90,8 +88,17 @@ namespace COLLADAMax
mWarehouseItem->SetVisible( true );
mWarehouseItem->SetEnabled( true );

// add warehouse item before import
// Add warehouse item before import, note that changing order of menu
// items after menu has been edited at least once requires removal of
// Workspace*.mnux from UI\Workspaces and UI\Workspaces\usersave to see
// the changes.
//TODO: Inserting at hardcoded index is fragile. Code should instead
// search for menu item (by ID) over which to insert.
#ifdef MAX_2018_OR_NEWER
mFileMenu->AddItem(mWarehouseItem, 12);
#else
mFileMenu->AddItem(mWarehouseItem, 29);
#endif

mMenuManager->RegisterMenu(mFileMenu, 0);

Expand Down
2 changes: 1 addition & 1 deletion COLLADAMax/src/COLLADAMaxOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ namespace COLLADAMax
{
// record exp instance pointer for subsequent callbacks
exp = (Options*) lParam;
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG)lParam);
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)lParam);
}
else
{
Expand Down
Loading

0 comments on commit e1f8a40

Please sign in to comment.