Skip to content

Commit

Permalink
Blender 4.0 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
korobetski committed May 29, 2024
1 parent aa55028 commit 7f2cef5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion MPD.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ def buildGeometry(self, znd = None, bool_build_collision = False):

# maybe i should consider using a simpler material... VS doesn't need a PBR Material :D
bsdf = mat.node_tree.nodes["Principled BSDF"]
bsdf.inputs["Specular"].default_value = 0
bsdf.inputs["Roughness"].default_value = 0
bsdf.inputs["Metallic"].default_value = 0
bsdf.inputs[12].default_value = 0 # specular
texImage = mat.node_tree.nodes.new("ShaderNodeTexImage")
texImage.image = bpy.data.images.new(str(ref+"_TEX"), 256, 256)
texImage.image.pixels = znd.getPixels(ref, translucent)
Expand Down
10 changes: 5 additions & 5 deletions SHP.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,10 @@ def buildGeometry(self):
armature = bpy.data.armatures.new("Armature")
arm_obj = bpy.data.objects.new("Armature", armature)
view_layer.active_layer_collection.collection.objects.link(arm_obj)
armature_data = arm_obj
# Must make armature active and in edit mode to create a bone
view_layer.objects.active = armature_data
bpy.ops.object.mode_set(mode="EDIT", toggle=False)
edit_bones = armature_data.data.edit_bones
view_layer.objects.active = arm_obj
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
edit_bones = arm_obj.data.edit_bones
for vs_bone in self.bones:
blender_bone = edit_bones.new(vs_bone.name)
blender_bone.use_relative_parent = False
Expand Down Expand Up @@ -221,8 +220,9 @@ def buildGeometry(self):
mat.blend_method = "CLIP" # to handle alpha cutout
# maybe i should consider using a simpler material... VS doesn't need a PBR Material :D
bsdf = mat.node_tree.nodes["Principled BSDF"]
bsdf.inputs["Specular"].default_value = 0
bsdf.inputs["Roughness"].default_value = 0
bsdf.inputs["Metallic"].default_value = 0
bsdf.inputs[12].default_value = 0 # specular
texImage = mat.node_tree.nodes.new("ShaderNodeTexImage")
texImage.image = bpy.data.images.new(str(self.name + "_Tex"+str(i)), self.tim.textureWidth, self.tim.textureHeigth)
texImage.image.pixels = self.tim.textures[i]
Expand Down
13 changes: 7 additions & 6 deletions WEP.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ def buildGeometry(self, material_index = 0):

# https://docs.blender.org/api/current/bpy.types.Mesh.html#bpy.types.Mesh.polygon_layers_int
# we can't store datas on faces, so we store face datas in mesh polygon layers instead
side_layer = blender_mesh.polygon_layers_int.new(name='side')
flag_layer = blender_mesh.polygon_layers_int.new(name='flag')
for face in self.faces:
side_layer.data[face.index].value = face.side
flag_layer.data[face.index].value = face.flag
#side_layer = blender_mesh.polygon_layers_int.new(name='side')
#flag_layer = blender_mesh.polygon_layers_int.new(name='flag')
#for face in self.faces:
# side_layer.data[face.index].value = face.side
# flag_layer.data[face.index].value = face.flag

# Creating Materials & Textures for Blender
# https://docs.blender.org/api/current/bpy.types.Material.html
Expand Down Expand Up @@ -210,8 +210,9 @@ def buildGeometry(self, material_index = 0):

# maybe i should consider using a simpler material... VS doesn't need a PBR Material :D
bsdf = mat.node_tree.nodes["Principled BSDF"]
bsdf.inputs["Specular"].default_value = 0
bsdf.inputs["Roughness"].default_value = 0
bsdf.inputs["Metallic"].default_value = 0
bsdf.inputs[12].default_value = 0 # specular
texImage = mat.node_tree.nodes.new("ShaderNodeTexImage")
texImage.image = bpy.data.images.new(str(self.name + "_"+vs_weapon_materials[i]+"_Tex"), self.tim.textureWidth, self.tim.textureHeigth)
texImage.image.pixels = self.tim.textures[i]
Expand Down

0 comments on commit 7f2cef5

Please sign in to comment.