3
11

New addon: Import_max #19

Closed
Sebastian Sille wants to merge 19 commits from (deleted):main 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 701a084d26 - Show all commits

View File

@ -2,10 +2,10 @@
# Copyright 2005 Bob Holcomb # Copyright 2005 Bob Holcomb
import os import os
import time
import struct
import bpy import bpy
import time
import math import math
import struct
import mathutils import mathutils
from bpy_extras.image_utils import load_image from bpy_extras.image_utils import load_image
from bpy_extras.node_shader_utils import PrincipledBSDFWrapper from bpy_extras.node_shader_utils import PrincipledBSDFWrapper
@ -293,16 +293,12 @@ def add_texture_to_material(image, contextWrapper, pct, extend, alpha, scale, of
img_wrap.rotation[2] = angle img_wrap.rotation[2] = angle
if extend == 'mirror': if extend == 'mirror':
# 3DS mirror flag can be emulated by these settings (at least so it seems) img_wrap.extension = 'MIRROR'
# TODO: bring back mirror
pass
# texture.repeat_x = texture.repeat_y = 2
# texture.use_mirror_x = texture.use_mirror_y = True
elif extend == 'decal': elif extend == 'decal':
# 3DS' decal mode maps best to Blenders EXTEND
img_wrap.extension = 'EXTEND' img_wrap.extension = 'EXTEND'
elif extend == 'noWrap': elif extend == 'noWrap':
img_wrap.extension = 'CLIP' img_wrap.extension = 'CLIP'
if alpha == 'alpha': if alpha == 'alpha':
for link in links: for link in links:
if link.from_node.type == 'TEX_IMAGE' and link.to_node.type == 'MIX_RGB': if link.from_node.type == 'TEX_IMAGE' and link.to_node.type == 'MIX_RGB':
@ -386,6 +382,7 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, CONSTRAI
for v1, v2, v3 in myContextMesh_facels: for v1, v2, v3 in myContextMesh_facels:
eekadoodle_faces.extend((v3, v1, v2) if v3 == 0 else (v1, v2, v3)) eekadoodle_faces.extend((v3, v1, v2) if v3 == 0 else (v1, v2, v3))
bmesh.polygons.foreach_set("loop_start", range(0, nbr_faces * 3, 3)) bmesh.polygons.foreach_set("loop_start", range(0, nbr_faces * 3, 3))
bmesh.polygons.foreach_set("loop_total", (3,) * nbr_faces)
bmesh.loops.foreach_set("vertex_index", eekadoodle_faces) bmesh.loops.foreach_set("vertex_index", eekadoodle_faces)
if bmesh.polygons and contextMeshUV: if bmesh.polygons and contextMeshUV: