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.
3 changed files with 15 additions and 11 deletions
Showing only changes of commit fe7747c1a4 - Show all commits

View File

@ -263,19 +263,19 @@ def add_texture_to_material(image, contextWrapper, pct, extend, alpha, scale, of
img_wrap = contextWrapper.base_color_texture
links.new(img_wrap.node_image.outputs['Color'], mixer.inputs[2])
links.new(mixer.outputs['Color'], shader.inputs['Base Color'])
elif mapto == 'SPECULARITY':
img_wrap = contextWrapper.specular_tint_texture
elif mapto == 'ALPHA':
shader.location = (0, -300)
img_wrap = contextWrapper.alpha_texture
elif mapto == 'ROUGHNESS':
img_wrap = contextWrapper.roughness_texture
elif mapto == 'METALLIC':
shader.location = (300,300)
img_wrap = contextWrapper.metallic_texture
elif mapto == 'ROUGHNESS':
shader.location = (300, 0)
img_wrap = contextWrapper.roughness_texture
elif mapto == 'SPECULARITY':
shader.location = (0,-300)
img_wrap = contextWrapper.specular_tint_texture
elif mapto == 'ALPHA':
shader.location = (300,300)
img_wrap = contextWrapper.alpha_texture
elif mapto == 'EMISSION':
shader.location = (-300, -600)
shader.location = (0,-900)
img_wrap = contextWrapper.emission_color_texture
elif mapto == 'NORMAL':
shader.location = (300, 300)

View File

@ -5,7 +5,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (4, 0, 32),
"version": (4, 1, 1),
'blender': (4, 0, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -187,6 +187,9 @@ class BlenderNode():
arma_mat = vnode.editbone_arma_mat
editbone.head = arma_mat @ Vector((0, 0, 0))
editbone.tail = arma_mat @ Vector((0, 1, 0))
if gltf.import_settings['bone_heuristic'] == "BLENDER":
editbone.length = vnode.bone_length / max(blender_arma.scale)
else:
editbone.length = vnode.bone_length
editbone.align_roll(arma_mat @ Vector((0, 0, 1)) - editbone.head)
@ -225,7 +228,8 @@ class BlenderNode():
if gltf.import_settings['bone_heuristic'] == "BLENDER":
pose_bone.custom_shape = bpy.data.objects[gltf.bone_shape]
pose_bone.custom_shape_scale_xyz = Vector([0.1, 0.1, 0.1])
armature_max_dim = max([blender_arma.dimensions[0] / blender_arma.scale[0], blender_arma.dimensions[1] / blender_arma.scale[1], blender_arma.dimensions[2] / blender_arma.scale[2]])
pose_bone.custom_shape_scale_xyz = Vector([armature_max_dim * 0.2] * 3)
@staticmethod
def create_mesh_object(gltf, vnode):