Skip to content
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

Fix blender 4.2 reflection probe baking and image importing #313

Merged
merged 2 commits into from
Oct 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions addons/io_hubs_addon/components/definitions/reflection_probe.py
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 @@ -338,14 +338,15 @@ def restore_render_props(self):

def setup_probe_render(self, context):
probe = self.probes[self.probe_index]
cycles_settings = self.camera_data.cycles if bpy.app.version < (4, 2, 0) else self.camera_data

self.camera_data.type = "PANO"
self.camera_data.cycles.panorama_type = "EQUIRECTANGULAR"
cycles_settings.panorama_type = "EQUIRECTANGULAR"

self.camera_data.cycles.longitude_min = -math.pi
self.camera_data.cycles.longitude_max = math.pi
self.camera_data.cycles.latitude_min = -math.pi / 2
self.camera_data.cycles.latitude_max = math.pi / 2
cycles_settings.longitude_min = -math.pi
cycles_settings.longitude_max = math.pi
cycles_settings.latitude_min = -math.pi / 2
cycles_settings.latitude_max = math.pi / 2

self.camera_data.clip_start = probe.data.clip_start
self.camera_data.clip_end = probe.data.clip_end
Expand Down Expand Up @@ -448,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
Loading