From fd17d3b5c9c22a71d2c856f35c7d6349ba9d5932 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Tue, 14 Nov 2023 21:37:29 +0800 Subject: [PATCH] revert some changes about prev commit --- bbp_ng/PROP_virtools_material.py | 3 ++- bbp_ng/UTIL_blender_mesh.py | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bbp_ng/PROP_virtools_material.py b/bbp_ng/PROP_virtools_material.py index 480cec2..aac95e3 100644 --- a/bbp_ng/PROP_virtools_material.py +++ b/bbp_ng/PROP_virtools_material.py @@ -481,7 +481,8 @@ def apply_to_blender_material(mtl: bpy.types.Material): mtl.specular_color = rawdata.mSpecular.to_const_rgb() - bnode.inputs["Emission"].default_value = rawdata.mEmissive.to_const_rgba() + # too shiny, disabled. + # bnode.inputs["Emission"].default_value = rawdata.mEmissive.to_const_rgba() mtl.specular_intensity = rawdata.mSpecularPower bnode.inputs["Specular"].default_value = UTIL_functions.clamp_float( diff --git a/bbp_ng/UTIL_blender_mesh.py b/bbp_ng/UTIL_blender_mesh.py index 92dc8de..5b2fe52 100644 --- a/bbp_ng/UTIL_blender_mesh.py +++ b/bbp_ng/UTIL_blender_mesh.py @@ -480,15 +480,15 @@ class MeshWriter(): # validate mesh. # it is IMPORTANT that do NOT delete custom data # because we need use these data to set custom split normal later - validation_err: bool = self.__mAssocMesh.validate(clean_customdata = False) + self.__mAssocMesh.validate(clean_customdata = False) # update mesh without mesh calc self.__mAssocMesh.update(calc_edges = False, calc_edges_loose = False) # set custom split normal data - # if the validate() change the mesh, skip this and output error. - # this should not happend in normal case, - # just a stupid patch for "线框Level1.Level.NMO" loading. - if not validation_err: + # if the validate() change the mesh, skip this and output error. + # this change is detected by the loops count changes, not the return value of validate(). because only the changes of loops can let following throw errors. + # this should not happend in normal case, just a stupid patch for "线框Level1.Level.NMO" loading. + if len(self.__mAssocMesh.loops) == len(self.__mFacePosIndices): self.__mAssocMesh.normals_split_custom_set( tuple(_nest_custom_split_normal(self.__mFaceNmlIndices, self.__mVertexNormal)) )