diff --git a/io_scene_niftools/modules/nif_import/geometry/vertex/__init__.py b/io_scene_niftools/modules/nif_import/geometry/vertex/__init__.py index d3c4ee0c6..2ceca42d8 100644 --- a/io_scene_niftools/modules/nif_import/geometry/vertex/__init__.py +++ b/io_scene_niftools/modules/nif_import/geometry/vertex/__init__.py @@ -78,7 +78,9 @@ def map_normals(b_mesh, normals): # the normals need to be pre-normalized or blender will do it inconsistely, leading to marked sharp edges no_array = Vertex.normalize(no_array) # use normals_split_custom_set_from_vertices to set the loop custom normals from the per-vertex normals - b_mesh.use_auto_smooth = True + if bpy.app.version < (4,0,0): + b_mesh.use_auto_smooth = True + b_mesh.normals_split_custom_set_from_vertices(no_array) @staticmethod diff --git a/io_scene_niftools/modules/nif_import/property/nodes_wrapper/__init__.py b/io_scene_niftools/modules/nif_import/property/nodes_wrapper/__init__.py index de7daa682..e983b04b8 100644 --- a/io_scene_niftools/modules/nif_import/property/nodes_wrapper/__init__.py +++ b/io_scene_niftools/modules/nif_import/property/nodes_wrapper/__init__.py @@ -299,10 +299,16 @@ def link_normal_node(self, b_texture_node): node_group = bpy.data.node_groups.new(group_name, "ShaderNodeTree") group_nodes = node_group.nodes # add the in/output nodes - input_node = group_nodes.new('NodeGroupInput') - node_group.inputs.new('NodeSocketColor', "Input") - output_node = group_nodes.new('NodeGroupOutput') - node_group.outputs.new('NodeSocketColor', "Output") + if bpy.app.version < (4,0,0): + input_node = group_nodes.new('NodeGroupInput') + node_group.inputs.new('NodeSocketColor', "Input") + output_node = group_nodes.new('NodeGroupOutput') + node_group.outputs.new('NodeSocketColor', "Output") + else: + input_node = group_nodes.new('NodeGroupInput') + node_group.interface.new_socket(name='NodeSocketColor', in_out="INPUT") + output_node = group_nodes.new('NodeGroupOutput') + node_group.interface.new_socket(name='NodeSocketColor', in_out="OUTPUT") # create the converting nodes separate_node = group_nodes.new("ShaderNodeSeparateRGB") invert_node = group_nodes.new("ShaderNodeInvert")