From 87b3b2980fe00b81cddef2546104e6672e754d01 Mon Sep 17 00:00:00 2001 From: Michael Schnabel Date: Sat, 8 Feb 2020 20:56:20 +0100 Subject: [PATCH] added some prints --- io_mesh_w3d/common/utils/material_import.py | 5 +++++ io_mesh_w3d/common/utils/mesh_export.py | 7 +++++++ io_mesh_w3d/common/utils/mesh_import.py | 4 ++++ tests/common/cases/test_utils.py | 3 ++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/io_mesh_w3d/common/utils/material_import.py b/io_mesh_w3d/common/utils/material_import.py index c45ed226..ad2c0127 100644 --- a/io_mesh_w3d/common/utils/material_import.py +++ b/io_mesh_w3d/common/utils/material_import.py @@ -19,6 +19,11 @@ def create_vertex_material(context, principleds, materials, struct, mesh, name, context, name, vertMat) mesh.materials.append(material) principleds.append(principled) + + if prelit_type is not None: + material.material_type = 'PRELIT_MATERIAL' + material.prelit_type = prelit_type + materials.append(material) if struct.material_passes: diff --git a/io_mesh_w3d/common/utils/mesh_export.py b/io_mesh_w3d/common/utils/mesh_export.py index 245649ab..6e35b3f4 100644 --- a/io_mesh_w3d/common/utils/mesh_export.py +++ b/io_mesh_w3d/common/utils/mesh_export.py @@ -215,6 +215,7 @@ def retrieve_meshes(context, hierarchy, rig, container_name, force_vertex_materi file=filepath, texture_info=info) + #print('material type: ' + material.material_type) if material.material_type == 'VERTEX_MATERIAL': mat_pass.shader_ids = [i] mat_pass.vertex_material_ids = [i] @@ -224,6 +225,7 @@ def retrieve_meshes(context, hierarchy, rig, container_name, force_vertex_materi if tex is not None: mesh_struct.textures.append(tex) else: + #print('prelit type: ' + material.prelit_type) if material.prelit_type == 'PRELIT_UNLIT': if mesh_struct.prelit_unlit is None: mesh_struct.prelit_unlit = PrelitBase( @@ -299,6 +301,7 @@ def retrieve_meshes(context, hierarchy, rig, container_name, force_vertex_materi mesh_struct.bitangents = [] if mesh_struct.prelit_unlit is not None: + # print('prelit unlit') mesh_struct.header.attrs |= PRELIT_UNLIT prelit = mesh_struct.prelit_unlit prelit.mat_info = MaterialInfo( @@ -308,6 +311,7 @@ def retrieve_meshes(context, hierarchy, rig, container_name, force_vertex_materi texture_count=len(prelit.textures)) if mesh_struct.prelit_vertex is not None: + # print('prelit vertex') mesh_struct.header.attrs |= PRELIT_VERTEX prelit = mesh_struct.prelit_vertex prelit.mat_info = MaterialInfo( @@ -317,6 +321,7 @@ def retrieve_meshes(context, hierarchy, rig, container_name, force_vertex_materi texture_count=len(prelit.textures)) if mesh_struct.prelit_lightmap_multi_pass is not None: + # print('prelit lightmap multi pass') mesh_struct.header.attrs |= PRELIT_LIGHTMAP_MULTI_PASS prelit = mesh_struct.prelit_lightmap_multi_pass prelit.mat_info = MaterialInfo( @@ -326,6 +331,7 @@ def retrieve_meshes(context, hierarchy, rig, container_name, force_vertex_materi texture_count=len(prelit.textures)) if mesh_struct.prelit_lightmap_multi_texture is not None: + # print('prelit lightmap multi texture') mesh_struct.header.attrs |= PRELIT_LIGHTMAP_MULTI_TEXTURE prelit = mesh_struct.prelit_lightmap_multi_texture prelit.mat_info = MaterialInfo( @@ -337,6 +343,7 @@ def retrieve_meshes(context, hierarchy, rig, container_name, force_vertex_materi if mesh_struct.prelit_unlit is None and mesh_struct.prelit_vertex is None \ and mesh_struct.prelit_lightmap_multi_pass is None and mesh_struct.prelit_lightmap_multi_texture is None: + # print('NO PRELIT') mesh_struct.mat_info = MaterialInfo( pass_count=len(mesh_struct.material_passes), vert_matl_count=len(mesh_struct.vert_materials), diff --git a/io_mesh_w3d/common/utils/mesh_import.py b/io_mesh_w3d/common/utils/mesh_import.py index d42494df..18db806c 100644 --- a/io_mesh_w3d/common/utils/mesh_import.py +++ b/io_mesh_w3d/common/utils/mesh_import.py @@ -39,6 +39,7 @@ def create_mesh(context, mesh_struct, hierarchy, coll): set_shader_properties(materials[i], shader) if mesh_struct.prelit_unlit is not None: + print('create prelit unlit') materials = [] prelit = mesh_struct.prelit_unlit create_vertex_material(context, principleds, materials, prelit, mesh, name, triangles, prelit_type='PRELIT_UNLIT') @@ -46,6 +47,7 @@ def create_mesh(context, mesh_struct, hierarchy, coll): set_shader_properties(materials[i], shader) if mesh_struct.prelit_vertex is not None: + print('create prelit vertex') materials = [] prelit = mesh_struct.prelit_vertex create_vertex_material(context, principleds, materials, prelit, mesh, name, triangles, prelit_type='PRELIT_VERTEX') @@ -53,6 +55,7 @@ def create_mesh(context, mesh_struct, hierarchy, coll): set_shader_properties(materials[i], shader) if mesh_struct.prelit_lightmap_multi_pass is not None: + print('create prelit lightmap multi pass') materials = [] prelit = mesh_struct.prelit_lightmap_multi_pass create_vertex_material(context, principleds, materials, prelit, mesh, name, triangles, prelit_type='PRELIT_LIGHTMAP_MULTI_PASS') @@ -60,6 +63,7 @@ def create_mesh(context, mesh_struct, hierarchy, coll): set_shader_properties(materials[i], shader) if mesh_struct.prelit_lightmap_multi_texture is not None: + print('create prelit lightmap multi texture') materials = [] prelit = mesh_struct.prelit_lightmap_multi_texture create_vertex_material(context, principleds, materials, prelit, mesh, name, triangles, prelit_type='PRELIT_LIGHTMAP_MULTI_TEXTURE') diff --git a/tests/common/cases/test_utils.py b/tests/common/cases/test_utils.py index 7b3294f8..c291b903 100644 --- a/tests/common/cases/test_utils.py +++ b/tests/common/cases/test_utils.py @@ -2,6 +2,7 @@ # Written by Stephan Vedder and Michael Schnabel from shutil import copyfile +from os.path import dirname as up from io_mesh_w3d.export_utils import * from io_mesh_w3d.import_utils import * @@ -16,7 +17,6 @@ from tests.w3d.helpers.dazzle import * from tests.w3d.helpers.mesh_structs.shader import * from tests.w3d.helpers.mesh_structs.vertex_material import * -from os.path import dirname as up class TestUtils(TestCase): @@ -582,6 +582,7 @@ def test_prelit_meshes_roundtrip(self): print('################# Prelit test') create_data(self, meshes) + print('##### created data') self.compare_data(meshes) def test_animation_roundtrip(self):