Quick fix for Blender 2.80 texture loading
The `Image.gl_load()` call was changed in Blender commit 7ad802cf3ae500bc72863b6dba0f28a488fce3d1; the two parameters we were using were removed. This commit fixes the exception and makes the texture browser usable again, but doesn't properly fix everything. The textures are drawn in the wrong colour space, which will be fixed in another commit once I know how.
This commit is contained in:
parent
01541f181e
commit
e74e014c66
@ -105,3 +105,8 @@ def bind_texture(texture: bpy.types.Image):
|
|||||||
"""Bind a Blender image to a GL texture slot."""
|
"""Bind a Blender image to a GL texture slot."""
|
||||||
bgl.glActiveTexture(bgl.GL_TEXTURE0)
|
bgl.glActiveTexture(bgl.GL_TEXTURE0)
|
||||||
bgl.glBindTexture(bgl.GL_TEXTURE_2D, texture.bindcode)
|
bgl.glBindTexture(bgl.GL_TEXTURE_2D, texture.bindcode)
|
||||||
|
|
||||||
|
|
||||||
|
def load_texture(texture: bpy.types.Image) -> int:
|
||||||
|
"""Load the texture, return OpenGL error code."""
|
||||||
|
return texture.gl_load()
|
||||||
|
@ -88,3 +88,8 @@ def aabox_with_texture(v1: Float2, v2: Float2):
|
|||||||
def bind_texture(texture: bpy.types.Image):
|
def bind_texture(texture: bpy.types.Image):
|
||||||
"""Bind a Blender image to a GL texture slot."""
|
"""Bind a Blender image to a GL texture slot."""
|
||||||
bgl.glBindTexture(bgl.GL_TEXTURE_2D, texture.bindcode[0])
|
bgl.glBindTexture(bgl.GL_TEXTURE_2D, texture.bindcode[0])
|
||||||
|
|
||||||
|
|
||||||
|
def load_texture(texture: bpy.types.Image) -> int:
|
||||||
|
"""Load the texture, return OpenGL error code."""
|
||||||
|
return texture.gl_load(filter=bgl.GL_NEAREST, mag=bgl.GL_NEAREST)
|
||||||
|
@ -164,7 +164,7 @@ class MenuItem:
|
|||||||
|
|
||||||
texture = self.icon
|
texture = self.icon
|
||||||
if texture:
|
if texture:
|
||||||
err = texture.gl_load(filter=bgl.GL_NEAREST, mag=bgl.GL_NEAREST)
|
err = draw.load_texture(texture)
|
||||||
assert not err, 'OpenGL error: %i' % err
|
assert not err, 'OpenGL error: %i' % err
|
||||||
|
|
||||||
# ------ TEXTURE ---------#
|
# ------ TEXTURE ---------#
|
||||||
|
Reference in New Issue
Block a user