Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package blender for openSUSE:Factory checked 
in at 2023-06-06 19:55:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/blender (Old)
 and      /work/SRC/openSUSE:Factory/.blender.new.15902 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "blender"

Tue Jun  6 19:55:40 2023 rev:175 rq:1090938 version:3.5.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/blender/blender.changes  2023-04-16 
16:07:47.245063259 +0200
+++ /work/SRC/openSUSE:Factory/.blender.new.15902/blender.changes       
2023-06-06 19:56:32.078571223 +0200
@@ -1,0 +2,65 @@
+Tue May 30 21:39:50 UTC 2023 - Hans-Peter Jansen <h...@urpla.net>
+
+- Update to 3.5.1:
+  + Active/default UV map legacy conversion with name conflict #106584
+  + Add support for OpenPGL 0.5.0 85c7cc898d
+  + Add-ons: X3D & BVH import error with Python 3.11 8038d3c3b0
+  + bpy.types.Text (region_as_string/region_from_string) crash #107261
+  + Color picker broken with Wayland & AMD GPU #106264
+  + Crash when canceling Sky Resize with mesh symmetry #107020
+  + Crash when loading files with custom node groups #106467
+  + Crash when OpenEXR IO fails #106977
+  + Crash with muted node#106982
+  + Cycles importance sampling with multiple suns works poorly #106293
+  + Cycles multi GPU crash with vertex color baking #106405
+  + Cycles shadow caustics not working with area lights #107004
+  + EEVEE: World lighting does not affect volumetrics #106440
+  + Entering Grease Pencil Vertex Paint mode crashes #107125
+  + Fireflies with Nishita sky sun sampling at certain angles #106706
+  + Fix source_archive ignoring addons dd3aaa3dd0
+  + Fix buffer overflow in BLI_path_frame_strip with long extensions 56b9df86f8
+  + Fix Crash calling asset_generate_preview() in backgound mode #105325
+  + Fix CUdeviceptr and hipDeviceptr_t build error on ppc64le architecture 
98a999a811
+  + Fix missing assets in the source archive 8f3faae18b
+  + Fix Snap package error on startup in older Linux version 4f2ed42a18
+  + Fix unnecessary edge pan updates ce2de91510
+  + Fix: Iteration for BMLayerCollection was broken 9a5a3da2b0
+  + Fix: Metal null buffer initialization #106807
+  + Fix: Remove unsupported data types in extrude and split edges nodes #106926
+  + Fix: Show 'Exit group' menu entry also for non group nodes. #106643
+  + Fix: Transform geometry node doesn't translate volumes correctly 9e5f1d06cb
+  + Fix: VSE channel buttons invisible in Light theme #107113
+  + GPencil Paste stroke duplicates to the next selected #106590
+  + Handle exceptions in add fur operator #106366
+  + ImageEngine: Improve Performance and Quality. #106092
+  + Inconsistent display of active filters for import/export file dialogs 
#90159
+  + Incorrect modifier deform evaluation result #106802
+  + Index the right UVmap in BMesh #106430
+  + Intel iGPU Crashes When Switching to Eevee #106278
+  + MacOS/OpenGL doesn't draw anything Eevee related. #106672
+  + Metal: Resolve high memory pressure on EEVEE render #107221
+  + Missing xray check in snapping #106478
+  + Motion tracking data lost on recovering autosave #106722
+  + Motion triangles could have unnormalized normals #106394
+  + Moving frame node jittering while cursor is still #106043
+  + Overlay: Resolve motion path rendering in Metal #106568
+  + Pose library does not autokey mirrored poses #106856
+  + Pose library: fix context menu d4d32b3731
+  + Properly clear CD_FLAG_ACTIVE/DEFAULT_COLOR flags #107067
+  + Resolve box selection issue in Metal #105450
+  + Resolve flashing Metal viewport #106704
+  + Resolve Metal grease pencil fill #106773
+  + Resolve Metal workload dependency #106431
+  + Resolve texture paint selection in Metal #106103
+  + Selection of bones in grease pencil weightpaint mode fails#106998
+  + Selection offset in timeline when NLA track is offset #106771
+  + Sharp edge attribute removed when all edges are sharp #105926
+  + "Shift to extend" doesn't work in 3D View Collections panel #106251
+  + Snap curves to surface operator does not update geometry #106094
+  + Subdivision surface crash with more than 8 UV maps #106745
+  + Texture paint removes evaluated mesh attributes #105912
+  + Use correct function to get active uv layer #106628
+  + UV stitch crash with hidden faces #106396
+- addons are included again
+
+-------------------------------------------------------------------

Old:
----
  blender-3.5.0.tar.xz
  blender-3.5.0.tar.xz.md5sum
  blender-addons-3.5.0.tar.xz
  blender-addons-contrib-3.5.0.tar.xz

New:
----
  blender-3.5.1.tar.xz
  blender-3.5.1.tar.xz.md5sum
  blender-addons-contrib-3.5.1.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ blender.spec ++++++
--- /var/tmp/diff_new_pack.UN07Wi/_old  2023-06-06 19:56:33.222578005 +0200
+++ /var/tmp/diff_new_pack.UN07Wi/_new  2023-06-06 19:56:33.226578029 +0200
@@ -77,7 +77,7 @@
 %bcond_with openxr
 
 Name:           blender
-Version:        3.5.0
+Version:        3.5.1
 Release:        0
 Summary:        A 3D Modelling And Rendering Package
 License:        GPL-2.0-or-later
@@ -86,10 +86,10 @@
 # Please leave the source url intact
 Source0:        https://download.blender.org/source/%{name}-%{version}.tar.xz
 Source1:        
https://download.blender.org/source/%{name}-%{version}.tar.xz.md5sum
-# addons are no longer included in the source tarball
-# repos do not provide any released files
+# addons are included again in the source tarball
 # https://projects.blender.org/blender/blender-addons.git
-Source2:        %{name}-addons-%{version}.tar.xz
+#Source2:        %{name}-addons-%{version}.tar.xz
+# addon contrib is not included in the source tarball
 # https://projects.blender.org/blender/blender-addons-contrib.git
 Source3:        %{name}-addons-contrib-%{version}.tar.xz
 Source4:        geeko.blend
@@ -307,12 +307,12 @@
 md5sum -c %{SOURCE1}
 popd
 
-%setup -q -a2 -a3
+%setup -q -a3
 %autopatch -p1
 
 # integrate addons in source tree
-mkdir scripts/addons
-for d in addons addons-contrib; do
+#mkdir scripts/addons
+for d in addons-contrib; do
     mv blender-$d-%{version}/* scripts/addons
     # wipe .gitea and .github
     rm -r blender-$d-%{version}

++++++ _service ++++++
--- /var/tmp/diff_new_pack.UN07Wi/_old  2023-06-06 19:56:33.346578740 +0200
+++ /var/tmp/diff_new_pack.UN07Wi/_new  2023-06-06 19:56:33.350578764 +0200
@@ -2,7 +2,7 @@
   <service name="tar_scm" mode="disabled">
     <param name="scm">git</param>
     <param 
name="url">https://projects.blender.org/blender/blender-addons.git</param>
-    <param name="revision">v3.5.0</param>
+    <param name="revision">v3.5.1</param>
     <param name="versionformat">@PARENT_TAG@</param>
     <param name="versionrewrite-pattern">v(.*)</param>
   </service>
@@ -14,7 +14,7 @@
   <service name="tar_scm" mode="disabled">
     <param name="scm">git</param>
     <param 
name="url">https://projects.blender.org/blender/blender-addons-contrib.git</param>
-    <param name="revision">v3.5.0</param>
+    <param name="revision">v3.5.1</param>
     <param name="versionformat">@PARENT_TAG@</param>
     <param name="versionrewrite-pattern">v(.*)</param>
   </service>

++++++ blender-3.5.0.tar.xz -> blender-3.5.1.tar.xz ++++++
/work/SRC/openSUSE:Factory/blender/blender-3.5.0.tar.xz 
/work/SRC/openSUSE:Factory/.blender.new.15902/blender-3.5.1.tar.xz differ: char 
17, line 1

++++++ blender-3.5.0.tar.xz.md5sum -> blender-3.5.1.tar.xz.md5sum ++++++
--- /work/SRC/openSUSE:Factory/blender/blender-3.5.0.tar.xz.md5sum      
2023-04-16 16:07:47.173062844 +0200
+++ /work/SRC/openSUSE:Factory/.blender.new.15902/blender-3.5.1.tar.xz.md5sum   
2023-06-06 19:56:32.046571033 +0200
@@ -1 +1 @@
-bdfdd9b76b27853411c29d3eb22d9066  blender-3.5.0.tar.xz
+283cfa14da7791e4e3ca96c41fa9b7df  blender-3.5.1.tar.xz

++++++ blender-addons-contrib-3.5.0.tar.xz -> 
blender-addons-contrib-3.5.1.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/blender-addons-contrib-3.5.0/.gitea/default_merge_message/REBASE_TEMPLATE.md
 
new/blender-addons-contrib-3.5.1/.gitea/default_merge_message/REBASE_TEMPLATE.md
--- 
old/blender-addons-contrib-3.5.0/.gitea/default_merge_message/REBASE_TEMPLATE.md
    2023-03-27 00:23:43.000000000 +0200
+++ 
new/blender-addons-contrib-3.5.1/.gitea/default_merge_message/REBASE_TEMPLATE.md
    2023-02-18 19:27:47.000000000 +0100
@@ -2,4 +2,4 @@
 
 ${CommitBody}
 
-Pull Request: 
https://projects.blender.org/blender/blender-addons-contrib/pulls/${PullRequestIndex}
+Pull Request #${PullRequestIndex}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/blender-addons-contrib-3.5.0/.gitea/default_merge_message/SQUASH_TEMPLATE.md
 
new/blender-addons-contrib-3.5.1/.gitea/default_merge_message/SQUASH_TEMPLATE.md
--- 
old/blender-addons-contrib-3.5.0/.gitea/default_merge_message/SQUASH_TEMPLATE.md
    2023-03-27 00:23:43.000000000 +0200
+++ 
new/blender-addons-contrib-3.5.1/.gitea/default_merge_message/SQUASH_TEMPLATE.md
    2023-02-18 19:27:47.000000000 +0100
@@ -1,3 +1,3 @@
 ${PullRequestTitle}
 
-Pull Request: 
https://projects.blender.org/blender/blender-addons-contrib/pulls/${PullRequestIndex}
+Pull Request #${PullRequestIndex}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/blender-addons-contrib-3.5.0/io_scene_3ds/__init__.py 
new/blender-addons-contrib-3.5.1/io_scene_3ds/__init__.py
--- old/blender-addons-contrib-3.5.0/io_scene_3ds/__init__.py   2023-03-27 
00:23:43.000000000 +0200
+++ new/blender-addons-contrib-3.5.1/io_scene_3ds/__init__.py   2023-02-18 
19:27:47.000000000 +0100
@@ -32,7 +32,7 @@
 bl_info = {
     "name": "Autodesk 3DS format",
     "author": "Bob Holcomb, Campbell Barton, Andreas Atteneder, Sebastian 
Schrand",
-    "version": (2, 3, 1),
+    "version": (2, 2, 0),
     "blender": (3, 0, 0),
     "location": "File > Import",
     "description": "Import 3DS, meshes, uvs, materials, textures, "
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/blender-addons-contrib-3.5.0/io_scene_3ds/export_3ds.py 
new/blender-addons-contrib-3.5.1/io_scene_3ds/export_3ds.py
--- old/blender-addons-contrib-3.5.0/io_scene_3ds/export_3ds.py 2023-03-27 
00:23:43.000000000 +0200
+++ new/blender-addons-contrib-3.5.1/io_scene_3ds/export_3ds.py 2023-02-18 
19:27:47.000000000 +0100
@@ -108,7 +108,6 @@
 
 # >------ sub defines of OBJECT_MESH
 OBJECT_VERTICES = 0x4110  # The objects vertices
-OBJECT_VERTFLAGS = 0x4111  # The objects vertex flags
 OBJECT_FACES = 0x4120  # The objects faces
 OBJECT_MATERIAL = 0x4130  # This is found if the object has a material, either 
texture map or color
 OBJECT_UV = 0x4140  # The UV texture coordinates
@@ -328,11 +327,10 @@
 
 class _3ds_face(object):
     """Class representing a face for a 3ds file."""
-    __slots__ = ("vindex", "flag")
+    __slots__ = ("vindex", )
 
-    def __init__(self, vindex, flag):
+    def __init__(self, vindex):
         self.vindex = vindex
-        self.flag = flag
 
     def get_size(self):
         return 4 * SZ_SHORT
@@ -341,11 +339,11 @@
     # catch this problem
 
     def write(self, file):
-        # The last short is used for face flags
-        file.write(struct.pack("<4H", self.vindex[0], self.vindex[1], 
self.vindex[2], self.flag))
+        # The last zero is only used by 3d studio
+        file.write(struct.pack("<4H", self.vindex[0], self.vindex[1], 
self.vindex[2], 0))
 
     def __str__(self):
-        return "[%d %d %d %d]" % (self.vindex[0], self.vindex[1], 
self.vindex[2], self.flag)
+        return "[%d %d %d]" % (self.vindex[0], self.vindex[1], self.vindex[2])
 
 
 class _3ds_array(object):
@@ -668,22 +666,19 @@
         material_chunk.add_subchunk(make_material_subchunk(MATAMBIENT, 
wrap.emission_color[:3]))
         material_chunk.add_subchunk(make_material_subchunk(MATDIFFUSE, 
wrap.base_color[:3]))
         material_chunk.add_subchunk(make_material_subchunk(MATSPECULAR, 
material.specular_color[:]))
-        material_chunk.add_subchunk(make_percent_subchunk(MATSHINESS, 1 - 
wrap.roughness))
+        material_chunk.add_subchunk(make_percent_subchunk(MATSHINESS, 
wrap.roughness))
         material_chunk.add_subchunk(make_percent_subchunk(MATSHIN2, 
wrap.specular))
         material_chunk.add_subchunk(make_percent_subchunk(MATSHIN3, 
wrap.metallic))
         material_chunk.add_subchunk(make_percent_subchunk(MATTRANS, 1 - 
wrap.alpha))
         material_chunk.add_subchunk(make_percent_subchunk(MATSELFILPCT, 
wrap.emission_strength))
         material_chunk.add_subchunk(shading)
 
-        primary_tex = False
-
         if wrap.base_color_texture:
             d_pct = 0.7 + sum(wrap.base_color[:]) * 0.1
             color = [wrap.base_color_texture]
             matmap = make_material_texture_chunk(MAT_DIFFUSEMAP, color, d_pct)
             if matmap:
                 material_chunk.add_subchunk(matmap)
-                primary_tex = True
 
         if wrap.specular_texture:
             spec = [wrap.specular_texture]
@@ -708,7 +703,8 @@
 
         if wrap.normalmap_texture:
             normal = [wrap.normalmap_texture]
-            b_pct = wrap.normalmap_strength
+            bump = wrap.normalmap_strength
+            b_pct = min(bump, 1)
             matmap = make_material_texture_chunk(MAT_BUMPMAP, normal, b_pct)
             if matmap:
                 material_chunk.add_subchunk(matmap)
@@ -716,7 +712,7 @@
 
         if wrap.roughness_texture:
             roughness = [wrap.roughness_texture]
-            r_pct = 1 - material.roughness
+            r_pct = material.roughness
             matmap = make_material_texture_chunk(MAT_SHINMAP, roughness, r_pct)
             if matmap:
                 material_chunk.add_subchunk(matmap)
@@ -733,14 +729,11 @@
         diffuse = []
 
         for link in wrap.material.node_tree.links:
-            if link.from_node.type == 'TEX_IMAGE' and link.to_node.type == 
'MIX_RGB':
-                diffuse = [link.from_node.image]
+            if link.from_node.type == 'TEX_IMAGE' and link.to_node.type != 
'BSDF_PRINCIPLED':
+                diffuse = [link.from_node.image] if not wrap.normalmap_texture 
else None
 
         if diffuse:
-            if primary_tex == False:
-                matmap = make_texture_chunk(MAT_DIFFUSEMAP, diffuse)
-            else:
-                matmap = make_texture_chunk(MAT_TEX2MAP, diffuse)
+            matmap = make_texture_chunk(MAT_TEX2MAP, diffuse)
             if matmap:
                 material_chunk.add_subchunk(matmap)
 
@@ -749,7 +742,7 @@
         material_chunk.add_subchunk(make_material_subchunk(MATAMBIENT, 
material.line_color[:3]))
         material_chunk.add_subchunk(make_material_subchunk(MATDIFFUSE, 
material.diffuse_color[:3]))
         material_chunk.add_subchunk(make_material_subchunk(MATSPECULAR, 
material.specular_color[:]))
-        material_chunk.add_subchunk(make_percent_subchunk(MATSHINESS, 1 - 
material.roughness))
+        material_chunk.add_subchunk(make_percent_subchunk(MATSHINESS, 
material.roughness))
         material_chunk.add_subchunk(make_percent_subchunk(MATSHIN2, 
material.specular_intensity))
         material_chunk.add_subchunk(make_percent_subchunk(MATSHIN3, 
material.metallic))
         material_chunk.add_subchunk(make_percent_subchunk(MATTRANS, 1 - 
material.diffuse_color[3]))
@@ -765,17 +758,17 @@
 
 class tri_wrapper(object):
     """Class representing a triangle.
+
     Used when converting faces to triangles"""
 
-    __slots__ = "vertex_index", "ma", "image", "faceuvs", "offset", "flag", 
"group"
+    __slots__ = "vertex_index", "ma", "image", "faceuvs", "offset", "group"
 
-    def __init__(self, vindex=(0, 0, 0), ma=None, image=None, faceuvs=None, 
flag=0, group=0):
+    def __init__(self, vindex=(0, 0, 0), ma=None, image=None, faceuvs=None, 
group=0):
         self.vertex_index = vindex
         self.ma = ma
         self.image = image
         self.faceuvs = faceuvs
         self.offset = [0, 0, 0]  # offset indices
-        self.flag = flag
         self.group = group
 
 
@@ -791,7 +784,7 @@
     img = None
     for i, face in enumerate(mesh.loop_triangles):
         f_v = face.vertices
-        v1, v2, v3 = f_v[0], f_v[1], f_v[2]
+
         uf = mesh.uv_layers.active.data if do_uv else None
 
         if do_uv:
@@ -800,37 +793,13 @@
                 img = get_uv_image(ma) if uf else None
                 if img is not None:
                     img = img.name
-            uv1, uv2, uv3 = f_uv[0], f_uv[1], f_uv[2]
-
-        """Flag 0x1 sets CA edge visible, Flag 0x2 sets BC edge visible, Flag 
0x4 sets AB edge visible
-        Flag 0x8 indicates a U axis texture wrap and Flag 0x10 indicates a V 
axis texture wrap
-        In Blender we use the edge CA, BC, and AB flags for sharp edges 
flags"""
-        a_b = mesh.edges[mesh.loops[face.loops[0]].edge_index]
-        b_c = mesh.edges[mesh.loops[face.loops[1]].edge_index]
-        c_a = mesh.edges[mesh.loops[face.loops[2]].edge_index]
-
-        if v3 == 0:
-            a_b, b_c, c_a = c_a, a_b, b_c
-
-        faceflag = 0
-        if c_a.use_edge_sharp:
-            faceflag = faceflag + 0x1
-        if b_c.use_edge_sharp:
-            faceflag = faceflag + 0x2
-        if a_b.use_edge_sharp:
-            faceflag = faceflag + 0x4
 
         smoothgroup = polygroup[face.polygon_index]
 
-        if len(f_v)==3:
-            if v3 == 0:
-                v1, v2, v3 = v3, v1, v2
-                if do_uv:
-                    uv1, uv2, uv3 = uv3, uv1, uv2
-            new_tri = tri_wrapper((v1, v2, v3), face.material_index, img)
+        if len(f_v) == 3:
+            new_tri = tri_wrapper((f_v[0], f_v[1], f_v[2]), 
face.material_index, img)
             if (do_uv):
-                new_tri.faceuvs = uv_key(uv1), uv_key(uv2), uv_key(uv3)
-            new_tri.flag = faceflag
+                new_tri.faceuvs = uv_key(f_uv[0]), uv_key(f_uv[1]), 
uv_key(f_uv[2])
             new_tri.group = smoothgroup if face.use_smooth else 0
             tri_list.append(new_tri)
 
@@ -839,6 +808,7 @@
 
 def remove_face_uv(verts, tri_list):
     """Remove face UV coordinates from a list of triangles.
+
     Since 3ds files only support one pair of uv coordinates for each vertex, 
face uv coordinates
     need to be converted to vertex uv coordinates. That means that vertices 
need to be duplicated when
     there are multiple uv coordinates per vertex."""
@@ -921,7 +891,8 @@
         # Gather materials used in this mesh - mat/image pairs
         unique_mats = {}
         for i, tri in enumerate(tri_list):
-            face_list.add(_3ds_face(tri.vertex_index, tri.flag))
+
+            face_list.add(_3ds_face(tri.vertex_index))
 
             if materials:
                 ma = materials[tri.ma]
@@ -951,6 +922,7 @@
             face_chunk.add_subchunk(obj_material_chunk)
 
     else:
+
         obj_material_faces = []
         obj_material_names = []
         for m in materials:
@@ -960,7 +932,7 @@
         n_materials = len(obj_material_names)
 
         for i, tri in enumerate(tri_list):
-            face_list.add(_3ds_face(tri.vertex_index, tri.flag))
+            face_list.add(_3ds_face(tri.vertex_index))
             if (tri.ma < n_materials):
                 obj_material_faces[tri.ma].add(_3ds_ushort(i))
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/blender-addons-contrib-3.5.0/io_scene_3ds/import_3ds.py 
new/blender-addons-contrib-3.5.1/io_scene_3ds/import_3ds.py
--- old/blender-addons-contrib-3.5.0/io_scene_3ds/import_3ds.py 2023-03-27 
00:23:43.000000000 +0200
+++ new/blender-addons-contrib-3.5.1/io_scene_3ds/import_3ds.py 2023-02-18 
19:27:47.000000000 +0100
@@ -63,9 +63,8 @@
 MAT_SHIN3 = 0xA042  # Reflection of the object/material (percent)
 MAT_TRANSPARENCY = 0xA050  # Transparency value of material (percent)
 MAT_SELF_ILLUM = 0xA080  # Self Illumination value of material
-MAT_SELF_ILPCT = 0xA084  # Self illumination strength (percent)
+MATSELFILPCT = 0xA084  # Self illumination strength (percent)
 MAT_WIRE = 0xA085  # Only render's wireframe
-MAT_SHADING = 0xA100  # Material shading method
 
 MAT_TEXTURE_MAP = 0xA200  # This is a header for a new texture map
 MAT_SPECULAR_MAP = 0xA204  # This is a header for a new specular map
@@ -123,7 +122,6 @@
 
 # >------ sub defines of OBJECT_MESH
 OBJECT_VERTICES = 0x4110  # The objects vertices
-OBJECT_VERTFLAGS = 0x4111  # The objects vertex flags
 OBJECT_FACES = 0x4120  # The objects faces
 OBJECT_MATERIAL = 0x4130  # This is found if the object has a material, either 
texture map or color
 OBJECT_UV = 0x4140  # The UV texture coordinates
@@ -247,7 +245,7 @@
         mixer = nodes.new(type='ShaderNodeMixRGB')
         mixer.label = "Mixer"
         mixer.inputs[0].default_value = pct / 100
-        mixer.inputs[1].default_value = tintcolor[:3] + [1] if tintcolor else 
shader.inputs['Base Color'].default_value[:]
+        mixer.inputs[1].default_value = tintcolor[:3] + [1] if tintcolor else 
(0, 0, 0, 0)
         contextWrapper._grid_to_location(1, 2, dst_node=mixer, ref_node=shader)
         img_wrap = contextWrapper.base_color_texture
         links.new(img_wrap.node_image.outputs['Color'], mixer.inputs[2])
@@ -303,21 +301,7 @@
     elif extend == 'noWrap':
         img_wrap.extension = 'CLIP'
     if alpha == 'alpha':
-        for link in links:
-            if link.from_node.type == 'TEX_IMAGE' and link.to_node.type == 
'MIX_RGB':
-                tex = link.from_node.image.name
-                own_node = img_wrap.node_image
-                own_map = img_wrap.node_mapping
-                if tex == image.name:
-                    links.new(link.from_node.outputs['Alpha'], 
img_wrap.socket_dst)
-                    nodes.remove(own_map)
-                    nodes.remove(own_node)
-                    for imgs in bpy.data.images:
-                        if imgs.name[-3:].isdigit():
-                            if not imgs.users:
-                                bpy.data.images.remove(imgs)
-                else:
-                    links.new(img_wrap.node_image.outputs['Alpha'], 
img_wrap.socket_dst)
+        links.new(img_wrap.node_image.outputs['Alpha'], img_wrap.socket_dst)
 
     shader.location = (300, 300)
     contextWrapper._grid_to_location(1, 0, dst_node=contextWrapper.node_out, 
ref_node=shader)
@@ -334,12 +318,11 @@
     contextMatrix = None
     contextMesh_vertls = None
     contextMesh_facels = None
-    contextMesh_flag = None
     contextMeshMaterials = []
     contextMesh_smooth = None
     contextMeshUV = None
 
-    #TEXTURE_DICT = {}
+    TEXTURE_DICT = {}
     MATDICT = {}
 
     # Localspace variable names, faster.
@@ -359,7 +342,7 @@
             context,
             myContextMesh_vertls,
             myContextMesh_facels,
-            myContextMesh_flag,
+
             myContextMeshMaterials,
             myContextMesh_smooth,
     ):
@@ -395,10 +378,23 @@
                 else:
                     bmat = MATDICT.get(matName)
                     # in rare cases no materials defined.
+                    if bmat:
+                        img = TEXTURE_DICT.get(bmat.name)
+                    else:
+                        print("    warning: material %r not defined!" % 
matName)
+                        bmat = MATDICT[matName] = 
bpy.data.materials.new(matName)
+                        img = None
 
                 bmesh.materials.append(bmat)  # can be None
-                for fidx in faces:
-                    bmesh.polygons[fidx].material_index = mat_idx
+
+                if uv_faces and img:
+                    for fidx in faces:
+                        bmesh.polygons[fidx].material_index = mat_idx
+                        # TODO: How to restore this?
+                        # uv_faces[fidx].image = img
+                else:
+                    for fidx in faces:
+                        bmesh.polygons[fidx].material_index = mat_idx
 
             if uv_faces:
                 uvl = bmesh.uv_layers.active.data[:]
@@ -423,37 +419,6 @@
         context.view_layer.active_layer_collection.collection.objects.link(ob)
         imported_objects.append(ob)
 
-        if myContextMesh_flag:
-            # Bit 0 (0x1) sets edge CA visible, Bit 1 (0x2) sets edge BC 
visible and Bit 2 (0x4) sets edge AB visible
-            # In Blender we use sharp edges for those flags
-            for f, pl in enumerate(bmesh.polygons):
-                face = myContextMesh_facels[f]
-                faceflag = myContextMesh_flag[f]
-                edge_ab = bmesh.edges[bmesh.loops[pl.loop_start].edge_index]
-                edge_bc = bmesh.edges[bmesh.loops[pl.loop_start + 
1].edge_index]
-                edge_ca = bmesh.edges[bmesh.loops[pl.loop_start + 
2].edge_index]
-                if face[2] == 0:
-                    edge_ab, edge_bc, edge_ca = edge_ca, edge_ab, edge_bc
-                if faceflag == 1:
-                    edge_ca.use_edge_sharp = True
-                elif faceflag == 2:
-                    edge_bc.use_edge_sharp = True
-                elif faceflag == 3:
-                    edge_ca.use_edge_sharp = True
-                    edge_bc.use_edge_sharp = True
-                elif faceflag == 4:
-                    edge_ab.use_edge_sharp = True
-                elif faceflag == 5:
-                    edge_ca.use_edge_sharp = True
-                    edge_ab.use_edge_sharp = True
-                elif faceflag == 6:
-                    edge_bc.use_edge_sharp = True
-                    edge_ab.use_edge_sharp = True
-                elif faceflag == 7:
-                    edge_bc.use_edge_sharp = True
-                    edge_ab.use_edge_sharp = True
-                    edge_ca.use_edge_sharp = True
-
         if myContextMesh_smooth:
             for f, pl in enumerate(bmesh.polygons):
                 smoothface = myContextMesh_smooth[f]
@@ -515,7 +480,7 @@
 
             elif temp_chunk.ID == MAT_MAP_FILEPATH:
                 texture_name, read_str_len = read_string(file)
-                img = load_image(texture_name, dirname, place_holder=False, 
recursive=IMAGE_SEARCH, check_existing=True)
+                img = TEXTURE_DICT[contextMaterial.name] = 
load_image(texture_name, dirname, recursive=IMAGE_SEARCH)
                 temp_chunk.bytes_read += read_str_len  # plus one for the null 
character that gets removed
 
             elif temp_chunk.ID == MAT_MAP_USCALE:
@@ -594,14 +559,12 @@
                     context,
                     contextMesh_vertls,
                     contextMesh_facels,
-                    contextMesh_flag,
                     contextMeshMaterials,
                     contextMesh_smooth,
                 )
                 contextMesh_vertls = []
                 contextMesh_facels = []
                 contextMeshMaterials = []
-                contextMesh_flag = None
                 contextMesh_smooth = None
                 contextMeshUV = None
                 # Reset matrix
@@ -706,7 +669,7 @@
                 print("Cannot read material transparency")
             new_chunk.bytes_read += temp_chunk.bytes_read
 
-        elif new_chunk.ID == MAT_SELF_ILPCT:
+        elif new_chunk.ID == MATSELFILPCT:
             read_chunk(file, temp_chunk)
             if temp_chunk.ID == PERCENTAGE_SHORT:
                 temp_data = file.read(SZ_U_SHORT)
@@ -718,21 +681,6 @@
                 contextMaterial.line_priority = (float(struct.unpack('f', 
temp_data)[0]) * 100)
             new_chunk.bytes_read += temp_chunk.bytes_read
 
-        elif new_chunk.ID == MAT_SHADING:
-            shading = read_short(new_chunk)
-            if shading >= 2:
-                contextWrapper.use_nodes = True
-                contextWrapper.emission_color = contextMaterial.line_color[:3]
-                contextWrapper.emission_strength = 
contextMaterial.line_priority / 100
-                contextWrapper.base_color = contextMaterial.diffuse_color[:3]
-                contextWrapper.specular = contextMaterial.specular_intensity
-                contextWrapper.roughness = contextMaterial.roughness
-                contextWrapper.metallic = contextMaterial.metallic
-                contextWrapper.alpha = contextMaterial.diffuse_color[3]
-                contextWrapper.use_nodes = False
-                if shading >= 3:
-                    contextWrapper.use_nodes = True
-
         elif new_chunk.ID == MAT_TEXTURE_MAP:
             read_texture(new_chunk, temp_chunk, "Diffuse", "COLOR")
 
@@ -759,8 +707,6 @@
                 temp_data = file.read(SZ_FLOAT)
                 temp_chunk.bytes_read += SZ_FLOAT
                 contextWrapper.normalmap_strength = float(struct.unpack('f', 
temp_data)[0])
-            else:
-                skip_to_end(file, temp_chunk)
             new_chunk.bytes_read += temp_chunk.bytes_read
 
         elif new_chunk.ID == MAT_SHIN_MAP:
@@ -772,64 +718,6 @@
         elif new_chunk.ID == MAT_TEX2_MAP:
             read_texture(new_chunk, temp_chunk, "Tex", "TEXTURE")
 
-        # mesh chunk
-        elif new_chunk.ID == OBJECT_MESH:
-            pass
-
-        elif new_chunk.ID == OBJECT_VERTICES:
-            """Worldspace vertex locations"""
-
-            temp_data = file.read(SZ_U_SHORT)
-            num_verts = struct.unpack('<H', temp_data)[0]
-            new_chunk.bytes_read += 2
-            contextMesh_vertls = struct.unpack('<%df' % (num_verts * 3), 
file.read(SZ_3FLOAT * num_verts))
-            new_chunk.bytes_read += SZ_3FLOAT * num_verts
-            # dummyvert is not used atm!
-
-        elif new_chunk.ID == OBJECT_FACES:
-            temp_data = file.read(SZ_U_SHORT)
-            num_faces = struct.unpack('<H', temp_data)[0]
-            new_chunk.bytes_read += 2
-            temp_data = file.read(SZ_4U_SHORT * num_faces)
-            new_chunk.bytes_read += SZ_4U_SHORT * num_faces  # 4 short ints x 
2 bytes each
-            contextMesh_facels = struct.unpack('<%dH' % (num_faces * 4), 
temp_data)
-            contextMesh_flag = [contextMesh_facels[i] for i in range(3, 
(num_faces * 4) + 3, 4)]
-            contextMesh_facels = [contextMesh_facels[i - 3:i] for i in 
range(3, (num_faces * 4) + 3, 4)]
-
-        elif new_chunk.ID == OBJECT_MATERIAL:
-            material_name, read_str_len = read_string(file)
-            new_chunk.bytes_read += read_str_len  # remove 1 null character.
-            temp_data = file.read(SZ_U_SHORT)
-            num_faces_using_mat = struct.unpack('<H', temp_data)[0]
-            new_chunk.bytes_read += SZ_U_SHORT
-            temp_data = file.read(SZ_U_SHORT * num_faces_using_mat)
-            new_chunk.bytes_read += SZ_U_SHORT * num_faces_using_mat
-            temp_data = struct.unpack("<%dH" % (num_faces_using_mat), 
temp_data)
-            contextMeshMaterials.append((material_name, temp_data))
-            # look up the material in all the materials
-
-        elif new_chunk.ID == OBJECT_SMOOTH:
-            temp_data = file.read(struct.calcsize('I') * num_faces)
-            smoothgroup = struct.unpack('<%dI' % (num_faces), temp_data)
-            new_chunk.bytes_read += struct.calcsize('I') * num_faces
-            contextMesh_smooth = smoothgroup
-
-        elif new_chunk.ID == OBJECT_UV:
-            temp_data = file.read(SZ_U_SHORT)
-            num_uv = struct.unpack('<H', temp_data)[0]
-            new_chunk.bytes_read += 2
-            temp_data = file.read(SZ_2FLOAT * num_uv)
-            new_chunk.bytes_read += SZ_2FLOAT * num_uv
-            contextMeshUV = struct.unpack('<%df' % (num_uv * 2), temp_data)
-
-        elif new_chunk.ID == OBJECT_TRANS_MATRIX:
-            # How do we know the matrix size? 54 == 4x4 48 == 4x3
-            temp_data = file.read(SZ_4x3MAT)
-            data = list(struct.unpack('<ffffffffffff', temp_data))
-            new_chunk.bytes_read += SZ_4x3MAT
-            contextMatrix = mathutils.Matrix(
-                (data[:3] + [0], data[3:6] + [0], data[6:9] + [0], data[9:] + 
[1])).transposed()
-
         elif contextObName and new_chunk.ID == OBJECT_LIGHT:  # Basic lamp 
support.
             # no lamp in dict that would be confusing
             # ...why not? just set CreateBlenderObject to False
@@ -837,7 +725,6 @@
             contextLamp = bpy.data.objects.new(contextObName, newLamp)
             
context.view_layer.active_layer_collection.collection.objects.link(contextLamp)
             imported_objects.append(contextLamp)
-            object_dictionary[contextObName] = contextLamp
             temp_data = file.read(SZ_3FLOAT)
             contextLamp.location = struct.unpack('<3f', temp_data)
             new_chunk.bytes_read += SZ_3FLOAT
@@ -851,7 +738,7 @@
             new_chunk.bytes_read += SZ_3FLOAT
         elif CreateLightObject and new_chunk.ID == OBJECT_LIGHT_MULTIPLIER:  # 
intensity
             temp_data = file.read(SZ_FLOAT)
-            contextLamp.data.energy = (float(struct.unpack('f', temp_data)[0]) 
* 1000)
+            contextLamp.data.energy = float(struct.unpack('f', temp_data)[0])
             new_chunk.bytes_read += SZ_FLOAT
 
         elif CreateLightObject and new_chunk.ID == OBJECT_LIGHT_SPOT:  # 
spotlight
@@ -883,7 +770,6 @@
             contextCamera = bpy.data.objects.new(contextObName, camera)
             
context.view_layer.active_layer_collection.collection.objects.link(contextCamera)
             imported_objects.append(contextCamera)
-            object_dictionary[contextObName] = contextCamera
             temp_data = file.read(SZ_3FLOAT)
             contextCamera.location = struct.unpack('<3f', temp_data)
             new_chunk.bytes_read += SZ_3FLOAT
@@ -900,12 +786,75 @@
             contextCamera.rotation_euler[2] = -1 * (math.radians(90) - 
math.acos(cam[0] / focus))
             new_chunk.bytes_read += SZ_FLOAT
             temp_data = file.read(SZ_FLOAT)
-            contextCamera.data.lens = float(struct.unpack('f', temp_data)[0])
+            contextCamera.data.lens = (float(struct.unpack('f', temp_data)[0]) 
* 10)
             new_chunk.bytes_read += SZ_FLOAT
             contextMatrix = None  # Reset matrix
             CreateBlenderObject = False
             CreateCameraObject = True
 
+        elif new_chunk.ID == OBJECT_MESH:
+            pass
+
+        elif new_chunk.ID == OBJECT_VERTICES:
+            """Worldspace vertex locations"""
+
+            temp_data = file.read(SZ_U_SHORT)
+            num_verts = struct.unpack('<H', temp_data)[0]
+            new_chunk.bytes_read += 2
+            contextMesh_vertls = struct.unpack('<%df' % (num_verts * 3), 
file.read(SZ_3FLOAT * num_verts))
+            new_chunk.bytes_read += SZ_3FLOAT * num_verts
+            # dummyvert is not used atm!
+
+        elif new_chunk.ID == OBJECT_FACES:
+            temp_data = file.read(SZ_U_SHORT)
+            num_faces = struct.unpack('<H', temp_data)[0]
+            new_chunk.bytes_read += 2
+            temp_data = file.read(SZ_4U_SHORT * num_faces)
+            new_chunk.bytes_read += SZ_4U_SHORT * num_faces  # 4 short ints x 
2 bytes each
+            contextMesh_facels = struct.unpack('<%dH' % (num_faces * 4), 
temp_data)
+            contextMesh_facels = [contextMesh_facels[i - 3:i] for i in 
range(3, (num_faces * 4) + 3, 4)]
+
+        elif new_chunk.ID == OBJECT_MATERIAL:
+            material_name, read_str_len = read_string(file)
+            new_chunk.bytes_read += read_str_len  # remove 1 null character.
+            temp_data = file.read(SZ_U_SHORT)
+            num_faces_using_mat = struct.unpack('<H', temp_data)[0]
+            new_chunk.bytes_read += SZ_U_SHORT
+            temp_data = file.read(SZ_U_SHORT * num_faces_using_mat)
+            new_chunk.bytes_read += SZ_U_SHORT * num_faces_using_mat
+            temp_data = struct.unpack("<%dH" % (num_faces_using_mat), 
temp_data)
+            contextMeshMaterials.append((material_name, temp_data))
+            # look up the material in all the materials
+
+        elif new_chunk.ID == OBJECT_SMOOTH:
+            temp_data = file.read(struct.calcsize('I') * num_faces)
+            smoothgroup = struct.unpack('<%dI' % (num_faces), temp_data)
+            new_chunk.bytes_read += struct.calcsize('I') * num_faces
+            contextMesh_smooth = smoothgroup
+
+        elif new_chunk.ID == OBJECT_UV:
+            temp_data = file.read(SZ_U_SHORT)
+            num_uv = struct.unpack('<H', temp_data)[0]
+            new_chunk.bytes_read += 2
+            temp_data = file.read(SZ_2FLOAT * num_uv)
+            new_chunk.bytes_read += SZ_2FLOAT * num_uv
+            contextMeshUV = struct.unpack('<%df' % (num_uv * 2), temp_data)
+
+        elif new_chunk.ID == OBJECT_TRANS_MATRIX:
+            # How do we know the matrix size? 54 == 4x4 48 == 4x3
+            temp_data = file.read(SZ_4x3MAT)
+            data = list(struct.unpack('<ffffffffffff', temp_data))
+            new_chunk.bytes_read += SZ_4x3MAT
+            contextMatrix = mathutils.Matrix(
+                (data[:3] + [0], data[3:6] + [0], data[6:9] + [0], data[9:] + 
[1])).transposed()
+
+        elif (new_chunk.ID == MAT_MAP_FILEPATH):
+            texture_name, read_str_len = read_string(file)
+            if contextMaterial.name not in TEXTURE_DICT:
+                TEXTURE_DICT[contextMaterial.name] = load_image(
+                    texture_name, dirname, place_holder=False, 
recursive=IMAGE_SEARCH)
+
+            new_chunk.bytes_read += read_str_len  # plus one for the null 
character that gets removed
         elif new_chunk.ID == EDITKEYFRAME:
             pass
 
@@ -921,7 +870,7 @@
 
         # including these here means their EK_OB_NODE_HEADER are scanned
         # another object is being processed
-        elif new_chunk.ID in {KFDATA_OBJECT, KFDATA_AMBIENT, KFDATA_CAMERA, 
KFDATA_OBJECT, KFDATA_TARGET, KFDATA_LIGHT, KFDATA_L_TARGET, }:
+        elif new_chunk.ID in {KFDATA_AMBIENT, KFDATA_CAMERA, KFDATA_OBJECT, 
KFDATA_TARGET, KFDATA_LIGHT, KFDATA_L_TARGET, }:
             child = None
 
         elif new_chunk.ID == OBJECT_NODE_HDR:
@@ -934,7 +883,7 @@
             new_chunk.bytes_read += 2
             child = object_dictionary.get(object_name)
 
-            if child is None: # and object_name != '$AMBIENT$':
+            if child is None and object_name != '$AMBIENT$':
                 child = bpy.data.objects.new(object_name, None)  # create an 
empty object
                 
context.view_layer.active_layer_collection.collection.objects.link(child)
                 imported_objects.append(child)
@@ -1085,10 +1034,7 @@
     # FINISHED LOOP
     # There will be a number of objects still not added
     if CreateBlenderObject:
-        if CreateLightObject or CreateCameraObject:
-            pass
-        else:
-            putContextMesh(context, contextMesh_vertls, contextMesh_facels, 
contextMesh_flag, contextMeshMaterials, contextMesh_smooth)
+        putContextMesh(context, contextMesh_vertls, contextMesh_facels, 
contextMeshMaterials, contextMesh_smooth)
 
     # Assign parents to objects
     # check _if_ we need to assign first because doing so recalcs the depsgraph
@@ -1096,7 +1042,7 @@
         parent = object_parent[ind]
         if parent == ROOT_OBJECT:
             if ob.parent is not None:
-                ob.parent = ROOT_OBJECT
+                ob.parent = None
         else:
             if ob.parent != object_list[parent]:
                 if ob == object_list[parent]:

Reply via email to