BGE texture module: Camera texture will always fail when the scene is restarted.
Open, NormalPublic

Description

Category: Python

The setup; Win7, an ATI HD 7xxxx GPU, 16 gigs of RAM, and an i7.

To reproduce; open the .blend file, press P and notice that the camera texture simulating a reflection works properly, press R to restart the scene though and the camera texture fails to reinitialize and instead show the base texture that it was supposed to overwrite.

Bug since; always, the video texture module, as far as I know, has always been unable to handle scene restarts. It gets even worse though, in some scenes, Blender will actually crash if you restart a scene using video textures. The videoTexture module as a result is practically useless, trying to work around it by replacing the scene restart with setting the scene to the same one does not work either, implying that you really can't use it in a game because it will fail when the scene changes. (only useful for pretty graphics demos to fly around in at the moment).

If a dev. here can look at this and fix this issue, then that would be great.

Thanks.

Details

Type
Bug

Hi Ace,

the problem is that the reflection and refraction variables are not freed when the scene end.
I have uploaded a blend showing how bypass this issue until the bug is fixed

@Benoit Bolsee (ben2610), Could you take a look to this report? Is it really a bug or the bypass I uploaded is the right way to restart the scene?.

Hi,

after investing a little bit more we have seen that it is the right procedure, we mean:

bge.logic module must not be freed at SCENE restart because it is useful to store variables after scene restart (maybe you want access to variables from other Scene), and also to store data at all moment during runtime.
bge.logic must only be freed in the case we use restart GAME with actuator or python API.

Therefore, you can use the method provided in the blend attached or you could check that the Texture into bge.logic is valid or not:

bge.logic.reflection.invalid

I will close this bug when I add a explanation in bge.logic documentation.

Thanks for your time.