Skip to content

Commit

Permalink
Add 3ds Max 2024 support (#1090)
Browse files Browse the repository at this point in the history
* Add 3ds Max 2024 project
fix 3ds Max 2024 incompatibilities

* add 3ds Max 2024 ref assemblies
add addional 2024 cs project files

---------

Co-authored-by: Josef Wienerroither <josef.wienerroither@amrax.ai>
  • Loading branch information
FrogsInSpace and Josef Wienerroither committed Jun 8, 2023
1 parent 2d0e43c commit dcf163f
Show file tree
Hide file tree
Showing 27 changed files with 913 additions and 99 deletions.
138 changes: 91 additions & 47 deletions 3ds Max/Max2Babylon.sln

Large diffs are not rendered by default.

435 changes: 435 additions & 0 deletions 3ds Max/Max2Babylon/2024/Max2Babylon2024.csproj

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions 3ds Max/Max2Babylon/2024/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Max2Babylon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Max2Babylon")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2d621b1c-3661-49bd-8dd3-4c5de51fce94")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
113 changes: 113 additions & 0 deletions 3ds Max/Max2Babylon/2024/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

136 changes: 136 additions & 0 deletions 3ds Max/Max2Babylon/2024/Properties/Resources.resx
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="ARNOLD_MATERIAL_CAT_DEF" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\..\Scripts\ARNOLD_MATERIAL_CAT_DEF.ms;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="BUMP_MAP_CAT_DEF" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\..\Scripts\BUMP_MAP_CAT_DEF.ms;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="MaxExporter" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\MaxExporter.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="PHYSICAL_MATERIAL_CAT_DEF" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\..\Scripts\PHYSICAL_MATERIAL_CAT_DEF.ms;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="STANDARD_MATERIAL_CAT_DEF" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\..\Scripts\STANDARD_MATERIAL_CAT_DEF.ms;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
Binary file added 3ds Max/Max2Babylon/2024/Refs/Autodesk.Max.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added 3ds Max/Max2Babylon/2024/Refs/SceneExplorer.dll
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions 3ds Max/Max2Babylon/2024/packages.config
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.WindowsAPICodePack-Core" version="1.1.0.0" targetFramework="net47" />
<package id="Microsoft.WindowsAPICodePack-Shell" version="1.1.0.0" targetFramework="net47" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net47" />
<package id="SharpDX" version="3.1.1" targetFramework="net45" />
<package id="SharpDX.Mathematics" version="3.1.1" targetFramework="net45" />
</packages>
2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/Descriptor.cs
Expand Up @@ -49,7 +49,7 @@ public override string Category
}
}

#if MAX2022 || MAX2023
#if MAX2022 || MAX2023 || MAX2024
public override string NonLocalizedClassName => "Babylon File Exporter";
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/Exporter/BabylonExporter.Animation.cs
Expand Up @@ -299,7 +299,7 @@ private List<BabylonAnimationKey> ExportBabylonKeysFromGameController(IIGameCont
var keys = new List<BabylonAnimationKey>();
for (int indexKey = 0; indexKey < gameKeyTab.Count; indexKey++)
{
#if MAX2017 || MAX2018 || MAX2019 || MAX2020 || MAX2021|| MAX2022 || MAX2023
#if MAX2017 || MAX2018 || MAX2019 || MAX2020 || MAX2021|| MAX2022 || MAX2023 || MAX2024
var gameKey = gameKeyTab[indexKey];
#else
var gameKey = gameKeyTab[new IntPtr(indexKey)];
Expand Down
Expand Up @@ -16,7 +16,7 @@ partial class BabylonExporter
public Dictionary<string, object> ExportExtraAttributes(IIGameMaterial gameMaterial, BabylonScene babylonScene, List<string> excludeAttributes = null)
{
// Retreive the max object
#if MAX2022 || MAX2023
#if MAX2022 || MAX2023 || MAX2024
ManagedServices.MaxscriptSDK.ExecuteMaxscriptCommand("obj = sceneMaterials[\"" + gameMaterial.MaterialName + "\"];", ManagedServices.MaxscriptSDK.ScriptSource.NotSpecified);
#else
ManagedServices.MaxscriptSDK.ExecuteMaxscriptCommand("obj = sceneMaterials[\"" + gameMaterial.MaterialName + "\"];");
Expand All @@ -34,12 +34,11 @@ partial class BabylonExporter
public Dictionary<string, object> ExportExtraAttributes(IIGameNode gameNode, BabylonScene babylonScene, List<string> excludeAttributes = null)
{
// Retreive the max object
#if MAX2022 || MAX2023
#if MAX2022 || MAX2023 || MAX2024
ManagedServices.MaxscriptSDK.ExecuteMaxscriptCommand("obj = maxOps.getNodeByHandle " + gameNode.MaxNode.Handle + ";", ManagedServices.MaxscriptSDK.ScriptSource.NotSpecified);
#else
ManagedServices.MaxscriptSDK.ExecuteMaxscriptCommand("obj = maxOps.getNodeByHandle " + gameNode.MaxNode.Handle + ";");
#endif

return _ExportExtraAttributes(gameNode.IGameObject.IPropertyContainer, babylonScene, excludeAttributes);
}

Expand Down Expand Up @@ -79,7 +78,7 @@ partial class BabylonExporter
+ "\r\n" + ")"
+ "\r\n" + ")"
+ "\r\n" + "s";
#if MAX2022 || MAX2023
#if MAX2022 || MAX2023 || MAX2024
string result = ManagedServices.MaxscriptSDK.ExecuteStringMaxscriptQuery(cmd, ManagedServices.MaxscriptSDK.ScriptSource.NotSpecified);
#else
string result = ManagedServices.MaxscriptSDK.ExecuteStringMaxscriptQuery(cmd);
Expand Down
4 changes: 2 additions & 2 deletions 3ds Max/Max2Babylon/Exporter/BabylonExporter.Light.cs
Expand Up @@ -185,8 +185,8 @@ private BabylonNode ExportLight(IIGameScene scene, IIGameNode lightNode, Babylon

foreach (var meshNode in maxScene.NodesListBySuperClass(SClass_ID.Geomobject))
{
#if MAX2017 || MAX2018 || MAX2019 || MAX2020 || MAX2021 || MAX2022 || MAX2023
if (meshNode.CastShadows)
#if MAX2017 || MAX2018 || MAX2019 || MAX2020 || MAX2021 || MAX2022 || MAX2023 || MAX2024
if(meshNode.CastShadows)
#else
if (meshNode.CastShadows == 1)
#endif
Expand Down
2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/Exporter/BabylonExporter.Logger.cs
Expand Up @@ -88,7 +88,7 @@ public void Print(IIParamBlock2 paramBlock, int logRank)
{
ParamType2 paramType = paramBlock.GetParameterType(i);

#if MAX2022 || MAX2023
#if MAX2022 || MAX2023 || MAX2024
RaiseVerbose("paramBlock.GetLocalName(" + i + ")=" + paramBlock.GetLocalName(i, 0, false) + ", type=" + paramType, logRank + 1);
#else
RaiseVerbose("paramBlock.GetLocalName(" + i + ")=" + paramBlock.GetLocalName(i, 0) + ", type=" + paramType, logRank + 1);
Expand Down

0 comments on commit dcf163f

Please sign in to comment.