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.
2 changed files with 23 additions and 10 deletions
Showing only changes of commit b7a36d80d5 - Show all commits

View File

@ -18,7 +18,7 @@ import bpy
bl_info = {
"name": "Autodesk 3DS format",
"author": "Bob Holcomb, Campbell Barton, Andreas Atteneder, Sebastian Schrand",
"version": (2, 4, 4),
"version": (2, 4, 5),
"blender": (3, 6, 0),
"location": "File > Import-Export",
"description": "3DS Import/Export meshes, UVs, materials, textures, "
@ -170,14 +170,14 @@ class Export3DS(bpy.types.Operator, ExportHelper):
)
scale_factor: FloatProperty(
name="Scale",
description="Scale factor for all objects",
name="Scale Factor",
description="Master scale factor for all objects",
min=0.0, max=100000.0,
soft_min=0.0, soft_max=100000.0,
default=1.0,
)
apply_unit: BoolProperty(
name="Apply Units",
name="Scene Units",
description="Take the scene unit length settings into account",
default=False,
)
@ -186,13 +186,23 @@ class Export3DS(bpy.types.Operator, ExportHelper):
description="Export selected objects only",
default=False,
)
object_filter: bpy.props.EnumProperty(
name="Object Filter", options={'ENUM_FLAG'},
items=(('MESH',"Mesh".rjust(11),"",'MESH_DATA',0x1),
('LIGHT',"Light".rjust(12),"",'LIGHT_DATA',0x2),
('CAMERA',"Camera".rjust(11),"",'CAMERA_DATA',0x4),
('EMPTY',"Empty".rjust(11),"",'EMPTY_DATA',0x8),
),
description="Object types to export",
default={'MESH', 'LIGHT', 'CAMERA', 'EMPTY'},
)
use_hierarchy: BoolProperty(
name="Export Hierarchy",
description="Export hierarchy chunks",
default=False,
)
write_keyframe: BoolProperty(
name="Write Keyframe",
name="Export Keyframes",
description="Write the keyframe data",
default=False,
)
@ -238,7 +248,10 @@ class MAX3DS_PT_export_include(bpy.types.Panel):
operator = sfile.active_operator
layout.prop(operator, "use_selection")
layout.prop(operator, "use_hierarchy")
laysub = layout.column(align=True)
laysub.enabled = (not operator.use_selection)
laysub.prop(operator, "object_filter")
layout.column().prop(operator, "use_hierarchy")
layout.prop(operator, "write_keyframe")

View File

@ -1489,8 +1489,8 @@ def make_ambient_node(world):
# EXPORT #
##########
def save(operator, context, filepath="", scale_factor=1.0, apply_unit=False,
use_selection=False, use_hierarchy=False, write_keyframe=False, global_matrix=None):
def save(operator, context, filepath="", scale_factor=1.0, apply_unit=False, use_selection=False,
object_filter=None, use_hierarchy=False, write_keyframe=False, global_matrix=None):
"""Save the Blender scene to a 3ds file."""
# Time the export
@ -1504,7 +1504,7 @@ def save(operator, context, filepath="", scale_factor=1.0, apply_unit=False,
unit_measure = 1.0
if apply_unit:
unit_length = sce.unit_settings.length_unit
unit_length = scene.unit_settings.length_unit
if unit_length == 'KILOMETERS':
unit_measure = 0.001
elif unit_length == 'CENTIMETERS':
@ -1566,7 +1566,7 @@ def save(operator, context, filepath="", scale_factor=1.0, apply_unit=False,
if use_selection:
objects = [ob for ob in scene.objects if ob.visible_get(view_layer=layer) and ob.select_get(view_layer=layer)]
else:
objects = [ob for ob in scene.objects if ob.visible_get(view_layer=layer)]
objects = [ob for ob in scene.objects if ob.type in object_filter and ob.visible_get(view_layer=layer)]
empty_objects = [ob for ob in objects if ob.type == 'EMPTY']
light_objects = [ob for ob in objects if ob.type == 'LIGHT']