New Addon: Import Autodesk .max #105013

Closed
Sebastian Sille wants to merge 136 commits from (deleted):nrgsille-import_max into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

Created a new addon for importing Autodesk .max files. The intention for this was because a lot of users asked if there is a way to import .max files and there is no option for this in Blender yet.
Usage: After installing the addon the option can be found in File ‣ Import ‣ Autodesk MAX (.max)

I added some .max files for testing purpose

Created a new addon for importing Autodesk .max files. The intention for this was because a lot of users asked if there is a way to import .max files and there is no option for this in Blender yet. Usage: After installing the addon the option can be found in `File ‣ Import ‣ Autodesk MAX (.max)` I added some .max files for testing purpose
Sebastian Sille added the
Interest
Import and Export
Module
Add-ons (Community)
labels 2023-11-19 16:32:19 +01:00
Sebastian Sille self-assigned this 2023-11-19 16:32:20 +01:00
Sebastian Sille added 101 commits 2023-11-19 16:32:23 +01:00
0f795e2dab New Addon: Import Autodesk .max
Created a new addon for importing meshes and materials from Autodesk .max files
Sebastian Sille added this to the Import/Export project 2023-11-19 16:32:33 +01:00
Sebastian Sille requested review from Jacques Lucke 2023-11-19 16:32:58 +01:00
Author
Member

@ideasman42 - If you are back, can you also have a look on this? thanks^^

@ideasman42 - If you are back, can you also have a look on this? thanks^^
Sebastian Sille added 1 commit 2023-11-19 22:25:04 +01:00
d927216d83 Import_max: Added code documentation
Added class descriptions and code documentation
Sebastian Sille added 1 commit 2023-11-21 02:50:25 +01:00
ab6139b6a4 Import_max: Removed unused definitions
Removed unused definitions
Some cleanup
Sebastian Sille added 1 commit 2023-11-21 03:02:15 +01:00
049a6fb932 Import_max: Removed unused code
Removed unused definition
Sebastian Sille added 1 commit 2023-11-21 10:26:25 +01:00
8578642860 Import_max: Added material float value
Added definition for material float value
Some cleanup

The add-on should still go to contrib first, stay there for a few weeks so users can test it. Once that is done and there are no serious issues, it can go to main.

  1. Finish review
  2. Commit to contrib once review is accepted.
  3. Test for a few weeks, then check with Campbell (module owner) if it can go to main repo.
The add-on should still go to contrib first, stay there for a few weeks so users can test it. Once that is done and there are no serious issues, it can go to main. 1) Finish review 2) Commit to contrib once review is accepted. 3) Test for a few weeks, then check with Campbell (module owner) if it can go to main repo.
Jacques Lucke reviewed 2023-11-21 12:17:00 +01:00
Jacques Lucke left a comment
Member

The code generally looks reasonable and works in my tests.

You say that the code here is based on information from the olefile source code. I can't say whether their license is GPL compatible or not. Someone with more knowledge about this will have to check that.

You also mention ImportMAX which is GNU GPL itself, so that should be fine.

The code generally looks reasonable and works in my tests. You say that the code here is based on information from the `olefile` source code. I can't say whether their [license](https://olefile.readthedocs.io/en/latest/License.html) is GPL compatible or not. Someone with more knowledge about this will have to check that. You also mention [ImportMAX](https://github.com/jmplonka/Importer3D) which is GNU GPL itself, so that should be fine.
Author
Member

The add-on should still go to contrib first, stay there for a few weeks so users can test it. Once that is done and there are no serious issues, it can go to main.

  1. Finish review
  2. Commit to contrib once review is accepted.
  3. Test for a few weeks, then check with Campbell (module owner) if it can go to main repo.

@ThomasDinges I copied and modified the import part from three classes of olefileIO, for finishing review the License has to be checked for compability, do you know if it does?
(It is a creative commons license under CC BY-NC-SA 3.0 DEED )

> The add-on should still go to contrib first, stay there for a few weeks so users can test it. Once that is done and there are no serious issues, it can go to main. > > 1) Finish review > 2) Commit to contrib once review is accepted. > 3) Test for a few weeks, then check with Campbell (module owner) if it can go to main repo. @ThomasDinges I copied and modified the import part from three classes of olefileIO, for finishing review the [License](https://olefile.readthedocs.io/en/latest/License.html) has to be checked for compability, do you know if it does? (It is a creative commons license under [CC BY-NC-SA 3.0 DEED](https://creativecommons.org/licenses/by-nc-sa/3.0/) )
Member

The license for olefile is the BSD 2-clause, compatible with the GPL. It also includes the CMU license for the PIL dependency, a flavour of the MIT license also GPL-compatible but probably not even necessary to consider if no code from PIL is used in this add-on.

The license for olefile is the [BSD 2-clause](https://directory.fsf.org/wiki/License:BSD-2-Clause-FreeBSD), compatible with the GPL. It also includes the [CMU license](https://spdx.org/licenses/MIT-CMU.html) for the PIL dependency, a flavour of the MIT license also GPL-compatible but probably not even necessary to consider if no code from PIL is used in this add-on.
Author
Member

The license for olefile is the BSD 2-clause, compatible with the GPL. It also includes the CMU license for the PIL dependency, a flavour of the MIT license also GPL-compatible but probably not even necessary to consider if no code from PIL is used in this add-on.

@pioverfour Thanks, the addon will be then commited to addons-contrib for testing^^

> The license for olefile is the [BSD 2-clause](https://directory.fsf.org/wiki/License:BSD-2-Clause-FreeBSD), compatible with the GPL. It also includes the [CMU license](https://spdx.org/licenses/MIT-CMU.html) for the PIL dependency, a flavour of the MIT license also GPL-compatible but probably not even necessary to consider if no code from PIL is used in this add-on. @pioverfour Thanks, the addon will be then commited to addons-contrib for testing^^

@NRGSille Please wait until the code review is finished and maintainers had a chance to give the green light. I reverted the commit from the contrib repo and I ask you to follow our guidelines and processes. If in doubt about something, please ask.

Your contributions are welcome but I am asking you to take it slow with this add-on and wait for the green light from Jacques and Campbell (as module owner).

@NRGSille Please wait until the code review is finished and maintainers had a chance to give the green light. I reverted the commit from the contrib repo and I ask you to follow our guidelines and processes. If in doubt about something, please ask. Your contributions are welcome but I am asking you to take it slow with this add-on and wait for the green light from Jacques and Campbell (as module owner).
Sebastian Sille added 1 commit 2023-11-21 21:29:50 +01:00
2bcb045779 Import_max: Removed unnessecary zeros
Removed unnessecary zeros in chunk definition
Jacques Lucke approved these changes 2023-11-22 14:56:38 +01:00
Jacques Lucke left a comment
Member

LGTM for the contrib repository.

LGTM for the contrib repository.
Jacques Lucke requested review from Campbell Barton 2023-11-22 14:56:47 +01:00
Sebastian Sille added 1 commit 2023-11-27 02:41:30 +01:00
b0e40301ce Import_max: Added import options
Added import options for scale and transformation
Fixed axis conversion
Sebastian Sille added 1 commit 2023-11-27 11:38:41 +01:00
718f8f1104 Import_max: Updated user interface design
Updated UI design to blender standard
Sebastian Sille added 1 commit 2023-11-27 13:23:37 +01:00
364dfe1e20 Import_max: Fixed matrix variable
Changed variable for matrix chunk to avoid confusion with real matrix
Removed debug keyword
Sebastian Sille added 1 commit 2023-11-27 13:56:57 +01:00
ebb9cfac13 Import_max: Fixed keyword order
Fixed mismatched keyword order
Sebastian Sille added 1 commit 2023-11-27 15:25:56 +01:00
59a70e946b Import_max: Removed write mode
Removed write mode from data import
Sebastian Sille added 1 commit 2023-11-27 15:59:59 +01:00
62edd34edf Import_max: Changed definition order
Changed definition order for better overview
Sebastian Sille added 1 commit 2023-11-27 20:43:48 +01:00
a6c89df258 Import_max: Added additional import options
Changed definition order for better overview
Sebastian Sille added 1 commit 2023-11-28 01:31:01 +01:00
Sebastian Sille added 1 commit 2023-11-28 02:05:06 +01:00
Sebastian Sille added 1 commit 2023-11-28 02:10:32 +01:00
Sebastian Sille added 1 commit 2023-11-28 02:27:52 +01:00
Sebastian Sille added 1 commit 2023-11-29 01:29:11 +01:00
42345234c6 Import_max: Fixed poly import
Check if mesh is a editable poly
Some Cleanup
Sebastian Sille added 1 commit 2023-11-29 14:24:21 +01:00
20a27c72b7 Import_max: Added principled BSDF
Added node_shader_utils principled BSDF wrapper
Removed parameters wich are incompatible for blender
Sebastian Sille added 1 commit 2023-11-29 14:27:40 +01:00
24d74b9abb Import_max: Fixed specularity
Changed specularity default
Sebastian Sille added 1 commit 2023-11-29 22:27:18 +01:00
54f35f8a53 Import_max: Avoid struct error
Ensure there are enough bytes to read
First-time contributor

@NRGSille Hi Sebastian. I have tested your importer and firstly I thank you for your hard work and respect you! I have some kind of issue with importing model with textures and materials and also with UV maps. It does not imported not UV not materials with textures and also unexpected parented relationships. Is it known issues?

Tnx,
Odilkhan

@NRGSille Hi Sebastian. I have tested your importer and firstly I thank you for your hard work and respect you! I have some kind of issue with importing model with textures and materials and also with UV maps. It does not imported not UV not materials with textures and also unexpected parented relationships. Is it known issues? Tnx, Odilkhan
Author
Member

@NRGSille Hi Sebastian. I have tested your importer and firstly I thank you for your hard work and respect you! I have some kind of issue with importing model with textures and materials and also with UV maps. It does not imported not UV not materials with textures and also unexpected parented relationships. Is it known issues?

Tnx,
Odilkhan

@odil24 By now the importer can only import meshes and standard, corona or vray materials, UV maps can only be imported as mesh objects because the vertex index of the UV map is not the same as the origin mesh. Also 3dsmax seems to use 3 dimensional vectors for the UV map. Textures are not supported because the assignment depends on the renderer wich can be vray, corona or arnold

> @NRGSille Hi Sebastian. I have tested your importer and firstly I thank you for your hard work and respect you! I have some kind of issue with importing model with textures and materials and also with UV maps. It does not imported not UV not materials with textures and also unexpected parented relationships. Is it known issues? > > Tnx, > Odilkhan @odil24 By now the importer can only import meshes and standard, corona or vray materials, UV maps can only be imported as mesh objects because the vertex index of the UV map is not the same as the origin mesh. Also 3dsmax seems to use 3 dimensional vectors for the UV map. Textures are not supported because the assignment depends on the renderer wich can be vray, corona or arnold
Sebastian Sille added 1 commit 2023-12-01 20:36:06 +01:00
Sebastian Sille added 1 commit 2023-12-01 20:50:21 +01:00
Sebastian Sille added 1 commit 2023-12-01 22:42:19 +01:00
4db63f4d4d Cleanup: Import_max
Changed blender version to last compatible version
Cleanup unused code
Sebastian Sille added 1 commit 2023-12-02 12:35:57 +01:00
Sebastian Sille added 1 commit 2023-12-02 13:13:49 +01:00
28c6317302 Cleanup: Import_max
Cleanup tabs and spaces
Sebastian Sille added 1 commit 2023-12-03 23:10:21 +01:00
f50fc1533e Import_max: Removed unused code
Added additional arch material parameter
Removed unused code
First-time contributor

I have got another issue:
ChunksID, no have attribute 'get_...'

I have got another issue: ChunksID, no have attribute 'get_...'
Author
Member

I have got another issue:
ChunksID, no have attribute 'get_...'

@odil24 I tested a lot of .max files without issues. Can you upload the file wich caused the issue? Otherwise I am not able to reproduce this error...

> I have got another issue: > ChunksID, no have attribute 'get_...' @odil24 I tested a lot of .max files without issues. Can you upload the file wich caused the issue? Otherwise I am not able to reproduce this error...
First-time contributor

Hello, I have a file that throws different errors. (tested it with the latest addon version)
Could it be a issue with the max version?

Hello, I have a file that throws different errors. (tested it with the latest addon version) Could it be a issue with the max version?
Author
Member

Hello, I have a file that throws different errors. (tested it with the latest addon version)
Could it be a issue with the max version?

@jc4d thank you, seems to be the latest .max version. I was able to find the problem and will fix it now ;)

EDIT: It is fixed now^^

> Hello, I have a file that throws different errors. (tested it with the latest addon version) > Could it be a issue with the max version? @jc4d thank you, seems to be the latest .max version. I was able to find the problem and will fix it now ;) EDIT: It is fixed now^^
Sebastian Sille added 1 commit 2023-12-04 20:15:55 +01:00
876fe8f278 Import_max: Update for newer max files
Fixed crash with files from latest version
Removed unnessecary code
Removed unused imports
Sebastian Sille added 1 commit 2023-12-04 22:21:07 +01:00
Sebastian Sille added 1 commit 2023-12-04 22:23:18 +01:00
642eea7cb8 Cleanup: Import_max
Fixed variables and cleanup
Sebastian Sille added 1 commit 2023-12-04 23:26:16 +01:00
Sebastian Sille added 1 commit 2023-12-05 01:18:32 +01:00
19c67a2af6 Import_max: Added corona material
Added material properties for corona renderer
Sebastian Sille added 1 commit 2023-12-05 02:16:57 +01:00
c56dcef5a3 Cleanup: Import_max
Cleanup code and style
First-time contributor

@NRGSille here file which has an issue with parenting/relationship for example

@NRGSille here file which has an issue with parenting/relationship for example
Author
Member

@NRGSille here file which has an issue with parenting/relationship for example

@odil24 I tested the file and everything works as expected. The parenting relationship is not supported, I have no idea how it works because there are multiple ways of parenting like object hierarchy, animation hierarchy and skeleton hierarchy. If someone knows the correct chunks for parenting then I would implement it but Autodesk provides no API for this.
The meshes may have more vertices than polygons in this case you can simply use the Mesh -> Cleanup -> Loose Vertices option

> @NRGSille here file which has an issue with parenting/relationship for example @odil24 I tested the file and everything works as expected. The parenting relationship is not supported, I have no idea how it works because there are multiple ways of parenting like object hierarchy, animation hierarchy and skeleton hierarchy. If someone knows the correct chunks for parenting then I would implement it but Autodesk provides no API for this. The meshes may have more vertices than polygons in this case you can simply use the Mesh -> Cleanup -> Loose Vertices option
First-time contributor

@NRGSille here file which has an issue with parenting/relationship for example

@odil24 I tested the file and everything works as expected. The parenting relationship is not supported, I have no idea how it works because there are multiple ways of parenting like object hierarchy, animation hierarchy and skeleton hierarchy. If someone knows the correct chunks for parenting then I would implement it but Autodesk provides no API for this.
The meshes may have more vertices than polygons in this case you can simply use the Mesh -> Cleanup -> Loose Vertices option

Which version of Blender are you using?

> > @NRGSille here file which has an issue with parenting/relationship for example > > @odil24 I tested the file and everything works as expected. The parenting relationship is not supported, I have no idea how it works because there are multiple ways of parenting like object hierarchy, animation hierarchy and skeleton hierarchy. If someone knows the correct chunks for parenting then I would implement it but Autodesk provides no API for this. > The meshes may have more vertices than polygons in this case you can simply use the Mesh -> Cleanup -> Loose Vertices option Which version of Blender are you using?
First-time contributor

@NRGSille here also another file imported incorrectly with lose of parenting:

@NRGSille here also another file imported incorrectly with lose of parenting:
Author
Member

Which version of Blender are you using?

Version 4.0 and 4.1

@NRGSille here also another file imported incorrectly with lose of parenting:

@odil24 As I said above, parenting is not supported yet

> Which version of Blender are you using? > Version 4.0 and 4.1 > @NRGSille here also another file imported incorrectly with lose of parenting: > @odil24 As I said above, parenting is not supported yet
Sebastian Sille added 1 commit 2023-12-06 23:07:25 +01:00
First-time contributor

@NRGSille Thank you for the hard work :)
I tried to open the file I shared previously and it opens, but I see some objects are distorded, looks like the vertex order is somehow different and it gives starnge results.
Since I don't have 3dmax I'm using Autodesk viewer to compare the scene https://viewer.autodesk.com/. If this is related with parenting, then I will wait for the hierarchy implementation.
image

@NRGSille Thank you for the hard work :) I tried to open the file I shared previously and it opens, but I see some objects are distorded, looks like the vertex order is somehow different and it gives starnge results. Since I don't have 3dmax I'm using Autodesk viewer to compare the scene [https://viewer.autodesk.com/](url). If this is related with parenting, then I will wait for the hierarchy implementation. ![image](/attachments/8972ff7b-8792-4500-bb10-3599d5a53074)
562 KiB
First-time contributor

@jc4d Yes, this is known big limitation I think for now. I hope @NRGSille will fix it asap

@jc4d Yes, this is known big limitation I think for now. I hope @NRGSille will fix it asap
Author
Member

@NRGSille Thank you for the hard work :)
I tried to open the file I shared previously and it opens, but I see some objects are distorded, looks like the vertex order is somehow different and it gives starnge results.
Since I don't have 3dmax I'm using Autodesk viewer to compare the scene https://viewer.autodesk.com/. If this is related with parenting, then I will wait for the hierarchy implementation.
image

@jc4d The distortion has nothing to do with the parenting, the hierarchy only has an effect to the position, rotation and scale transformation. There is a known issue with ngons with more than 6 vertices or vertices surrounding a hole. The script will never be perfect because there is no API available and there are huge differences between various 3dsMax versions. I will try to fix the hierarchy part but I have no idea how to fix the ngon problem.
The script works best with meshes wich have applied transform and only includes quads or triangles

> @NRGSille Thank you for the hard work :) > I tried to open the file I shared previously and it opens, but I see some objects are distorded, looks like the vertex order is somehow different and it gives starnge results. > Since I don't have 3dmax I'm using Autodesk viewer to compare the scene [https://viewer.autodesk.com/](url). If this is related with parenting, then I will wait for the hierarchy implementation. > ![image](/attachments/8972ff7b-8792-4500-bb10-3599d5a53074) > @jc4d The _distortion_ has nothing to do with the parenting, the hierarchy only has an effect to the position, rotation and scale transformation. There is a known issue with ngons with more than 6 vertices or vertices surrounding a hole. The script will never be perfect because there is no API available and there are huge differences between various 3dsMax versions. I will try to fix the hierarchy part but I have no idea how to fix the ngon problem. The script works best with meshes wich have applied transform and only includes quads or triangles
First-time contributor

@NRGSille Thank you for the detailed explanation, now I understand :)
If there is a place that I can take a look to see if I can help you in any way, let me know.

@NRGSille Thank you for the detailed explanation, now I understand :) If there is a place that I can take a look to see if I can help you in any way, let me know.
Sebastian Sille added 1 commit 2023-12-07 16:56:19 +01:00
6226e30ab8 Delete: io_import_max
Remove to package
Sebastian Sille added 1 commit 2023-12-07 16:57:13 +01:00
Campbell Barton approved these changes 2023-12-08 07:24:56 +01:00

Thanks, pushed 225aaeaac2 with very minor edits (ran autopep8 & updated copyright header).

Thanks, pushed https://projects.blender.org/blender/blender-addons-contrib/commit/225aaeaac2da4dd0d8b7b54c428a85cf0c07721c with very minor edits (ran autopep8 & updated copyright header).
Campbell Barton closed this pull request 2023-12-08 07:26:31 +01:00
First-time contributor
@NRGSille Is this helps you fix an issue with hierarchy? https://github.com/jmplonka/Importer3D File data info: https://github.com/jmplonka/Importer3D/blob/master/documentation/fileformat_3DS.txt
Author
Member

@NRGSille Is this helps you fix an issue with hierarchy?
https://github.com/jmplonka/Importer3D

File data info:
https://github.com/jmplonka/Importer3D/blob/master/documentation/fileformat_3DS.txt

@odil24 Those are the chunk definitions for the .3ds format. There is no information about the .max format in the internet. I already used the information from that importer

> @NRGSille Is this helps you fix an issue with hierarchy? > https://github.com/jmplonka/Importer3D > > File data info: > https://github.com/jmplonka/Importer3D/blob/master/documentation/fileformat_3DS.txt @odil24 Those are the chunk definitions for the .3ds format. There is no information about the .max format in the internet. I already used the information from that importer
First-time contributor

@NRGSille thanks for the great work on this contribution. I'd like to ask if you have any plans to work on texture support for vray and corona? Both renders are the most used especially when importing assets

@Roggii I already know how to get the textures from a max file put do not know how to unpack them, also the vertex index of the textures UV coordinates does not match with the vertex index of the mesh. Autodesk uses 3 dimensional vectors for UV coordinates where X and Y matches with U and V. I was able to get the coordinates as mesh objects but without the possibility to add them to the mesh objects it does not make sense to import the textures becuse there will be no mapping for it.

@NRGSille thanks for the great work on this contribution. I'd like to ask if you have any plans to work on texture support for vray and corona? Both renders are the most used especially when importing assets @Roggii I already know how to get the textures from a max file put do not know how to unpack them, also the vertex index of the textures UV coordinates does not match with the vertex index of the mesh. Autodesk uses 3 dimensional vectors for UV coordinates where X and Y matches with U and V. I was able to get the coordinates as mesh objects but without the possibility to add them to the mesh objects it does not make sense to import the textures becuse there will be no mapping for it.

Pull request closed

Sign in to join this conversation.
No Milestone
No project
No Assignees
8 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#105013
No description provided.