Skip to content

Commit

Permalink
Update for use with Blender 4.0 and above
Browse files Browse the repository at this point in the history
Principled BSDF shader changed a bit in the Python API, see
https://developer.blender.org/docs/release_notes/4.0/python_api/
  • Loading branch information
kugelrund committed Sep 12, 2024
1 parent 87ee127 commit d6b685e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
bl_info = {
"name": "PoP map",
"author": "Sphere",
"version": (0, 2),
"blender": (2, 80, 0),
"version": (0, 3),
"blender": (4, 0, 0),
"location": "File > Import > PoP map",
"description": "Import PoP map",
"category": "Import"}
Expand Down
7 changes: 4 additions & 3 deletions popmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def blender_add_material(blend_data, name, texture_name):
material.use_nodes = True
material.blend_method = 'CLIP'
bsdf_node = material.node_tree.nodes['Principled BSDF']
bsdf_node.inputs['Specular'].default_value = 0.0
bsdf_node.inputs['Specular IOR Level'].default_value = 0.0


def blender_add_mesh(blend_data, name, vertices, faces, uvs, uv_indices,
Expand Down Expand Up @@ -180,8 +180,9 @@ def add_bounding_box_material(blend_data, mesh, group_name):
material.roughness = 0.5
bsdf_node = material.node_tree.nodes['Principled BSDF']
bsdf_node.inputs['Base Color'].default_value = (0, 0, 0, 1)
bsdf_node.inputs['Specular'].default_value = 0.0
bsdf_node.inputs['Emission'].default_value = color + (1,)
bsdf_node.inputs['Specular IOR Level'].default_value = 0.0
bsdf_node.inputs['Emission Color'].default_value = color + (1,)
bsdf_node.inputs['Emission Strength'].default_value = 0.5
bsdf_node.inputs['Alpha'].default_value = 0.2
mesh.materials.append(material)
return True
Expand Down

0 comments on commit d6b685e

Please sign in to comment.