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.
Showing only changes of commit 718f8f1104 - Show all commits

View File

@ -14,7 +14,7 @@
bl_info = {
"name": "Import Autodesk MAX (.max)",
"author": "Sebastian Sille, Philippe Lagadec, Jens M. Plonka",
"version": (1, 0, 0),
"version": (1, 1, 0),
"blender": (4, 0, 0),
"location": "File > Import",
"description": "Import 3DSMAX meshes & materials",
@ -42,7 +42,7 @@ from bpy_extras.io_utils import orientation_helper
class Import_max(bpy.types.Operator, bpy_extras.io_utils.ImportHelper):
"""Import Autodesk MAX"""
bl_idname = "import_autodesk.max"
bl_label = "Import Autodesk MAX (.max)"
bl_label = "Import MAX (.max)"
bl_options = {'PRESET', 'UNDO'}
filename_ext = ".max"
@ -54,10 +54,9 @@ class Import_max(bpy.types.Operator, bpy_extras.io_utils.ImportHelper):
soft_min=0.0, soft_max=10000.0,
default=1.0,
)
use_apply_matrix: bpy.props.BoolProperty(name="Apply Matrix",
description="Use matrix to transform the objects",
default=True,
default=False,
)
def execute(self, context):
@ -67,16 +66,51 @@ class Import_max(bpy.types.Operator, bpy_extras.io_utils.ImportHelper):
return load(self, context, **keywords)
def draw(self, context):
pass
class MAX_PT_import_transform(bpy.types.Panel):
bl_space_type = 'FILE_BROWSER'
bl_region_type = 'TOOL_PROPS'
bl_label = "Transform"
bl_parent_id = "FILE_PT_operator"
@classmethod
def poll(cls, context):
sfile = context.space_data
operator = sfile.active_operator
return operator.bl_idname == "IMPORT_AUTODESK_OT_max"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
sfile = context.space_data
operator = sfile.active_operator
layout.prop(operator, "scale_objects")
layrow = layout.row(align=True)
layrow.prop(operator, "use_apply_matrix")
layrow.label(text="", icon='VIEW_ORTHO' if operator.use_apply_matrix else 'MESH_GRID')
layout.prop(operator, "axis_forward")
layout.prop(operator, "axis_up")
### REGISTER ###
def menu_func(self, context):
self.layout.operator(Import_max.bl_idname, text="Autodesk MAX (.max)")
def register():
bpy.utils.register_class(Import_max)
bpy.utils.register_class(MAX_PT_import_transform)
bpy.types.TOPBAR_MT_file_import.append(menu_func)
def unregister():
bpy.types.TOPBAR_MT_file_import.remove(menu_func)
bpy.utils.unregister_class(MAX_PT_import_transform)
bpy.utils.unregister_class(Import_max)