Skip to content

Commit

Permalink
Fix reflection probe image assignment in Blender 4.2
Browse files Browse the repository at this point in the history
Blender 4.2 no longer allows images (or possibly anything) to be assigned to uninitialized Group IDProperties via key access, e.g. `probe_component['envMapTexture'] = img` isn't allowed anymore.
Images are now assigned directly to the property without going through the key, e.g. `probe_component.envMapTexture = img`.
Note: `setattr` also works because it also directly assigns without going through the key.
  • Loading branch information
Exairnous committed Oct 15, 2024
1 parent c09fc5e commit f54d164
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def modal(self, context, event):
else:
update_image_editors(old_img, img)

probe_component['envMapTexture'] = img
probe_component.envMapTexture = img

# Pack image and update filepaths so that it displays/unpacks nicely for the user.
# Note: updating the filepaths prints an error to the terminal, but otherwise seems to work fine.
Expand Down Expand Up @@ -449,11 +449,11 @@ def execute(self, context):
for probe in probes:
if f.name.startswith(f"{probe.name} - EnvMap"):
probe_component = probe.hubs_component_reflection_probe
old_img = probe_component['envMapTexture']
old_img = probe_component.envMapTexture

img = bpy.data.images.load(
filepath=os.path.join(dirname, f.name))
probe_component['envMapTexture'] = img
probe_component.envMapTexture = img

if old_img:
if self.overwrite_images:
Expand Down

0 comments on commit f54d164

Please sign in to comment.