Does anyone know why I can’t store a videotexture image object in a custom class variable?
I can store a videotexture image in an object property or in bge.logic but when try to store it in a variable of a custom class the object texture doesn’t change.
Here is a example (you must unpack it)
dynamic texture.zip (88.2 KB)
Here is the important part of the code where you can switch between the 3 ways to store the image via comment/uncomment
[...]
"""
# Doesn't work
self.texture = bge.texture.Texture(self.ob, mat_id)
self.texture.source = bge.texture.ImageBuff()
self.texture.source.load(image_buffer, self.size[0], self.size[1])
self.texture.refresh(False)
"""
"""
# Work
logic.texture = bge.texture.Texture(self.ob, mat_id)
logic.texture.source = bge.texture.ImageBuff()
logic.texture.source.load(image_buffer, self.size[0], self.size[1])
logic.texture.refresh(False)
"""
#"""
# Work too
self.ob['texture'] = bge.texture.Texture(self.ob, mat_id)
self.ob['texture'].source = bge.texture.ImageBuff()
self.ob['texture'].source.load(image_buffer, self.size[0], self.size[1])
self.ob['texture'].refresh(False)
#"""