Skip to content

Instantly share code, notes, and snippets.

@pasmat
Created June 5, 2018 17:58
Show Gist options
  • Save pasmat/282f56a2b18b1e2fa2fdd26121f22062 to your computer and use it in GitHub Desktop.
Save pasmat/282f56a2b18b1e2fa2fdd26121f22062 to your computer and use it in GitHub Desktop.
Fix MineWays white textures/alpha for blender
'''
This script goes through every textureSlot setting settings such that the blocks are rendered correctly in the scene
beware, this sets those properties for ALL objects, so this script should when theres only the world on the scene
also, I've only programmed in python for blender scripting, so the code may be substandard for other pythonists out there
'''
import bpy
objects = bpy.data.objects
for i in range(0, len(objects)):
object = objects[i]
materialSlots = object.material_slots
for j in range(0, len(materialSlots)):
materialSlot = materialSlots[j]
if materialSlot:
material = materialSlot.material
textureSlots = material.texture_slots
for k in range(0, len(textureSlots)):
textureSlot = textureSlots[k]
if textureSlot:
texture = textureSlot.texture
if isinstance(texture, bpy.types.ImageTexture):
texture.use_filter_size_min = True
texture.use_mipmap = False
texture.use_interpolation = False
textureSlot.use_map_alpha = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment