Texture, materials , UV and stuff is really the thing im noob with. …
How can i set my image material back once i played a video ? My video plays fine but once it’s finish, it sticks to the last frame of the video and doesnt put the image texture back …
matID = bge.texture.materialID(obj, "MADisplay")
video = bge.texture.Texture(obj, matID)
movieName = "video.avi"
movie = bge.logic.expandPath('//' + movieName)
video.source = bge.texture.VideoFFmpeg(movie)
Its the same as if you were replacing a static texture, you can just delete the new texture and the old one will return. Described in the API Reference example:
def removeTexture(cont):
""" Delete the Dynamic Texture, reversing back the final to its original state. """
try:
del logic.texture
except:
pass
Of course in your code your texture is called ‘video’ so you would change the delete line to: del video
This only works if you still have access to ‘video’ which is why you need to save a reference to it. And having access to it allows you to check the status of the source.
video.source.status should return -1 through 3 depending on what its currently doing.
If the status is 3, the video is stopped so you can delete your video texture and return the old texture. Just make sure your code knows what to do after deleting it (for example you can turn off positive pulse mode, load a new video, shut down the interface, etc.).