New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Camera: Fix GI camera provider crash when no texture is available after loading #7049
Conversation
Might seem a bit aggressive but since we can't assume the texture is assigned in I'm not sure that's a safe assumption either, so here we are. |
(FWIW I'm not quite sure how the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This indeed fixes the issue for me. My camera works again with master.
Happy to help 😊
|
def on_tex(self, *l): | ||
def on_tex(self, camera): | ||
self.texture = texture = camera.texture | ||
self.texture_size = list(texture.size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to convert to list
because texture_size
is a ListProperty
and assigning to it will convert texture.size
to ObservableList
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, you don't have to set texture_size
at all as it will be updated by on_texture
method from Image
class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can safely remove line self.texture_size = list(texture.size)
from on_tex
and _camera_loaded
methods.
@@ -90,7 +90,9 @@ def __init__(self, **kwargs): | |||
fbind('resolution', on_index) | |||
on_index() | |||
|
|||
def on_tex(self, *l): | |||
def on_tex(self, camera): | |||
self.texture = texture = camera.texture |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can still check and update only when texture is None or when camera.texture.size is not equal to self.texture_size, right ?
Seems to have been fixed in #7071. |
TFW ^^" anyway at least it's fixed. The line deletions I've made might still be a good idea though - mo' code mo' problems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems correct as a texture may not exist at on_load
.
It would be nice to only update if the texture object changed, but this is definitely working it shouldn't cause much performance loss.
And there you go 😊 thanks everyone !
|
Traceback:
Also see #6971.