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

Blender4 image constructor signature updates #292

Closed
wants to merge 2 commits into from
Closed
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
11 changes: 10 additions & 1 deletion addons/io_hubs_addon/io/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from io_scene_gltf2.blender.exp import gltf2_blender_gather_materials, gltf2_blender_gather_nodes, gltf2_blender_gather_joints
from io_scene_gltf2.blender.exp import gltf2_blender_gather_texture_info, gltf2_blender_export_keys
from io_scene_gltf2.blender.exp import gltf2_blender_image
if bpy.app.version >= (4, 0, 0):
from io_scene_gltf2.blender.exp.material import gltf2_blender_search_node_tree
from io_scene_gltf2.blender.exp.gltf2_blender_gather_cache import cached
from io_scene_gltf2.io.com import gltf2_io_extensions
from io_scene_gltf2.io.com import gltf2_io
Expand Down Expand Up @@ -47,7 +49,10 @@ def from_blender_image(image: bpy.types.Image):

def encode(self, mime_type: Optional[str], export_settings) -> Union[Tuple[bytes, bool], bytes]:
if mime_type == "image/vnd.radiance":
return self.encode_from_image_hdr(self.blender_image())
if bpy.app.version < (4, 0, 0):
return self.encode_from_image_hdr(self.blender_image())
else:
return self.encode_from_image_hdr(self.blender_image(export_settings))
if bpy.app.version < (3, 5, 0):
return super().encode(mime_type)
else:
Expand Down Expand Up @@ -366,6 +371,10 @@ def gather_lightmap_texture_info(blender_material, export_settings):
if bpy.app.version < (3, 2, 0):
tex_transform, tex_coord = gltf2_blender_gather_texture_info.__gather_texture_transform_and_tex_coord(
texture_socket, export_settings)
elif bpy.app.version >= (4, 0, 0):
socket = gltf2_blender_search_node_tree.NodeSocket(texture_socket, blender_material)
tex_transform, tex_coord = gltf2_blender_gather_texture_info.__gather_texture_transform_and_tex_coord(
socket, export_settings)
else:
tex_transform, tex_coord, _ = gltf2_blender_gather_texture_info.__gather_texture_transform_and_tex_coord(
texture_socket, export_settings)
Expand Down
Loading