Skip to content

Commit

Permalink
material creation refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Michaelschnabel-DM committed Feb 11, 2020
1 parent 3b4b3f8 commit 27c54ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 27 deletions.
2 changes: 2 additions & 0 deletions io_mesh_w3d/common/utils/material_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
##########################################################################

def create_vertex_materials(context, struct, mesh, triangles, prelit_type=None):
if struct is None:
return
materials = []
principleds = []
for vertMat in struct.vert_materials:
Expand Down
34 changes: 7 additions & 27 deletions io_mesh_w3d/common/utils/mesh_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,13 @@ def create_mesh(context, mesh_struct, hierarchy, coll):
if mesh_struct.is_hidden():
mesh_ob.hide_set(True)

# vertex material stuff
if mesh_struct.vert_materials:
create_vertex_materials(context, mesh_struct, mesh, triangles)

if mesh_struct.prelit_unlit is not None:
print('create prelit unlit')
prelit = mesh_struct.prelit_unlit
create_vertex_materials(context, prelit, mesh, triangles, prelit_type='PRELIT_UNLIT')

if mesh_struct.prelit_vertex is not None:
print('create prelit vertex')
prelit = mesh_struct.prelit_vertex
create_vertex_materials(context, prelit, mesh, triangles, prelit_type='PRELIT_VERTEX')

if mesh_struct.prelit_lightmap_multi_pass is not None:
print('create prelit lightmap multi pass')
prelit = mesh_struct.prelit_lightmap_multi_pass
create_vertex_materials(context, prelit, mesh, triangles, prelit_type='PRELIT_LIGHTMAP_MULTI_PASS')

if mesh_struct.prelit_lightmap_multi_texture is not None:
print('create prelit lightmap multi texture')
prelit = mesh_struct.prelit_lightmap_multi_texture
create_vertex_materials(context, prelit, mesh, triangles, prelit_type='PRELIT_LIGHTMAP_MULTI_TEXTURE')

# shader material stuff
if mesh_struct.shader_materials:
create_shader_materials(context, mesh_struct, mesh, triangles)
create_shader_materials(context, mesh_struct, mesh, triangles)

create_vertex_materials(context, mesh_struct, mesh, triangles)
create_vertex_materials(context, mesh_struct.prelit_unlit, mesh, triangles, prelit_type='PRELIT_UNLIT')
create_vertex_materials(context, mesh_struct.prelit_vertex, mesh, triangles, prelit_type='PRELIT_VERTEX')
create_vertex_materials(context, mesh_struct.prelit_lightmap_multi_pass, mesh, triangles, prelit_type='PRELIT_LIGHTMAP_MULTI_PASS')
create_vertex_materials(context, mesh_struct.prelit_lightmap_multi_texture, mesh, triangles, prelit_type='PRELIT_LIGHTMAP_MULTI_TEXTURE')


def rig_mesh(mesh_struct, hierarchy, rig, sub_object=None):
Expand Down

0 comments on commit 27c54ac

Please sign in to comment.