diff --git a/README.md b/README.md index 975e64e..3cbfd98 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,10 @@ --- -- [SWTOR Granny2 (.gr2) Import/Export Add-on for Blender 2.8 to 4.0](#swtor-granny2-gr2-importexport-add-on-for-blender-28-to-40) - - [WARNING: not yet compatible with Blender 4.1.x and higher. We are working on that.](#warning-not-yet-compatible-with-blender-41x-and-higher-we-are-working-on-that) +- [SWTOR Granny2 (.gr2) Import/Export Add-on for Blender 2.8 to 4.2](#swtor-granny2-gr2-importexport-add-on-for-blender-28-to-42) + - [WE ARE FINALLY BLENDER 4.1/4.2-COMPATIBLE!!! 🙂](#we-are-finally-blender-4142-compatible-) - [New version with new features:](#new-version-with-new-features) - - **[Download](#download)** + - [Download](#download) - [Installation](#installation) - [Description](#description) - [Import/export tools:](#importexport-tools) @@ -30,8 +30,6 @@ - [Available Operators.](#available-operators) - [Custom Scene Property with feedback about the calls' results.](#custom-scene-property-with-feedback-about-the-calls-results) - [Current state of the project.](#current-state-of-the-project) - - [The Blender 4.1 showstopper.](#the-blender-41-showstopper) - - [Other than that.](#other-than-that) ### New version with new features: * **Up to Blender 4.2 compatibility**. diff --git a/io_scene_gr2.zip b/io_scene_gr2.zip index dcc9585..33646cb 100644 Binary files a/io_scene_gr2.zip and b/io_scene_gr2.zip differ diff --git a/io_scene_gr2/__init__.py b/io_scene_gr2/__init__.py index 3216eea..3d7b7d0 100644 --- a/io_scene_gr2/__init__.py +++ b/io_scene_gr2/__init__.py @@ -3,7 +3,7 @@ bl_info = { "name": "Star Wars: The Old Republic (.gr2)", "author": "Darth Atroxa, SWTOR Slicers", - "version": (4, 0, 2), + "version": (4, 0, 3), "blender": (2, 82, 0), "location": "File > Import-Export", "description": "Import-Export SWTOR skeleton, or model with bone weights, UV's and materials", diff --git a/io_scene_gr2/ops/import_gr2.py b/io_scene_gr2/ops/import_gr2.py index b7ab661..52d9c94 100644 --- a/io_scene_gr2/ops/import_gr2.py +++ b/io_scene_gr2/ops/import_gr2.py @@ -582,16 +582,10 @@ def build(gr2, if mesh.bit_flag2 & 2: # 0x02 # NOTE: We store 'temp' normals in loops, since validate() may alter final mesh, # we can only set custom loop normals *after* calling it. - # We use a custom attribute to store them because we can't use # the "normal" attribute: blend_mesh.loops[loop_index].normal is # read-only in 4.1 and higher. - temp_custom_normals = blend_mesh.attributes.new( - name="temp_custom_normals", - type='FLOAT_VECTOR', - domain='CORNER' - ).data - + # UV stuff blend_mesh.uv_layers.new(do_init=False) if mesh.bit_flag2 & 64: # 0x40 @@ -599,6 +593,15 @@ def build(gr2, if mesh.bit_flag2 & 128: # 0x80 blend_mesh.uv_layers.new(do_init=False) + # For some reason, the creation of extra UV map layers for + # multiUvExtraction objects blitzes the temp normals custom attribute, + # so, we are creating it AFTER the creation of UV layers. + temp_custom_normals = blend_mesh.attributes.new( + name="temp_custom_normals", + type='FLOAT_VECTOR', + domain='CORNER' + ).data + for j, polygon in enumerate(blend_mesh.polygons): loop_indices = polygon.loop_indices @@ -610,6 +613,9 @@ def build(gr2, # doesn't normalize them for free the way mesh.loops[loop_index].normal used to. # As we are using for the normals data the mathutils' Vector type, # we use its normalized() method (instead of normalize() which might be slower?). + # blend_mesh.loops[loop_index].normal = [v.normals.x, v.normals.y, v.normals.z] + + # temp_custom_normals[loop_index].vector = v.normals.xyz.normalized() temp_custom_normals[loop_index].vector = v.normals.xyz.normalized() # UV stuff