Skip to content

Commit

Permalink
fix(material tools, mesh tools): remove compatibility checks for vers…
Browse files Browse the repository at this point in the history
…ions before 4.2
  • Loading branch information
NMC-TBone committed Dec 9, 2024
1 parent c051bc8 commit b50eb8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
5 changes: 1 addition & 4 deletions i3d_exporter_additionals/tools/material_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,7 @@ def setup_specular_map(self, nodes, links, image_path):
img_tex_spec = nodes.new("ShaderNodeTexImage")
img_tex_spec.location = (-510, 32)
if giants_i3d:
if bpy.app.version >= (4, 0, 0):
links.new(img_tex_spec.outputs["Color"], nodes.get("Principled BSDF").inputs["Specular IOR Level"])
else:
links.new(img_tex_spec.outputs["Color"], nodes.get("Principled BSDF").inputs["Specular"])
links.new(img_tex_spec.outputs["Color"], nodes.get("Principled BSDF").inputs["Specular IOR Level"])
elif stjerne_i3d:
sep_rgb = nodes.new("ShaderNodeSeparateRGB")
sep_rgb.name = "Glossmap"
Expand Down
18 changes: 6 additions & 12 deletions i3d_exporter_additionals/tools/mesh_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,16 @@ class I3DEA_OT_remove_doubles(bpy.types.Operator):
bl_options = {'REGISTER', 'UNDO'}

def execute(self, context):
smooth_angle = 180
merge_threshold = .0001
smooth_radians = math.radians(smooth_angle)
sel_obj = bpy.context.selected_objects
act_obj = bpy.context.active_object
sel_obj = context.selected_objects
act_obj = context.active_object

for obj in sel_obj:
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.select_all(action='DESELECT')
obj.select_set(True)
if obj.type == 'MESH':
bpy.context.view_layer.objects.active = obj
context.view_layer.objects.active = obj
bpy.ops.mesh.customdata_custom_splitnormals_clear()
bm = bmesh.new()
bm.from_mesh(obj.data)
Expand All @@ -58,15 +56,11 @@ def execute(self, context):
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.tris_convert_to_quads(uvs=True)
bpy.ops.object.mode_set(mode='OBJECT')
if bpy.app.version >= (4, 1, 0):
bpy.ops.object.shade_smooth()
else:
bpy.ops.object.shade_smooth(use_auto_smooth=True)
bpy.context.object.data.auto_smooth_angle = smooth_radians
self.report({'INFO'}, "Object(s) cleaned")
bpy.ops.object.shade_smooth()
for obj in sel_obj:
obj.select_set(True)
bpy.context.view_layer.objects.active = act_obj
context.view_layer.objects.active = act_obj
self.report({'INFO'}, "Object(s) cleaned")
return {'FINISHED'}


Expand Down

0 comments on commit b50eb8c

Please sign in to comment.