Skip to content

Commit

Permalink
gltf2 changed filenames in Blender 4.2 - Fixed the import calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Spiderguy-F committed Dec 21, 2024
1 parent 188d61f commit a3c7524
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 23 deletions.
8 changes: 6 additions & 2 deletions addons/io_hubs_addon/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from .utils import create_prefs_dir
import sys
import bpy
from .io import gltf_exporter, gltf_importer, panels
from . import (nodes, components)
from .io import gltf_exporter
from .io import gltf_importer
from .io import panels
from . import nodes
from . import components

from . import preferences
from . import third_party
from . import debugger
Expand Down
18 changes: 14 additions & 4 deletions addons/io_hubs_addon/io/gltf_importer.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import bpy
from bpy.props import BoolProperty, PointerProperty
from io_scene_gltf2.blender.imp.gltf2_blender_node import BlenderNode
from io_scene_gltf2.blender.imp.gltf2_blender_material import BlenderMaterial
from io_scene_gltf2.blender.imp.gltf2_blender_scene import BlenderScene
from io_scene_gltf2.blender.imp.gltf2_blender_image import BlenderImage


if bpy.app.version >= (4, 3, 0):
from io_scene_gltf2.blender.imp.node import BlenderNode
from io_scene_gltf2.blender.imp.material import BlenderMaterial
from io_scene_gltf2.blender.imp.scene import BlenderScene
from io_scene_gltf2.blender.imp.image import BlenderImage

else:
from io_scene_gltf2.blender.imp.gltf2_blender_node import BlenderNode
from io_scene_gltf2.blender.imp.gltf2_blender_material import BlenderMaterial
from io_scene_gltf2.blender.imp.gltf2_blender_scene import BlenderScene
from io_scene_gltf2.blender.imp.gltf2_blender_image import BlenderImage

from .utils import HUBS_CONFIG, import_image, import_all_textures
from ..components.components_registry import get_component_by_name
import traceback
Expand Down
55 changes: 38 additions & 17 deletions addons/io_hubs_addon/io/utils.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
import os
import bpy
from io_scene_gltf2.blender.com import gltf2_blender_extras
if bpy.app.version >= (3, 6, 0):
from io_scene_gltf2.blender.exp import gltf2_blender_gather_nodes, gltf2_blender_gather_joints
from io_scene_gltf2.blender.exp.material import gltf2_blender_gather_materials, gltf2_blender_gather_texture_info
from io_scene_gltf2.blender.exp.material.extensions import gltf2_blender_image


if bpy.app.version >= (4, 3, 0):
#global gltf2_io_image_data, gltf2_blender_extras, gltf2_blender_gather_joints, gltf2_blender_gather_nodes, gltf2_blender_gather_materials, gltf2_blender_gather_texture_info, gltf2_blender_search_node_tree, gltf2_io_binary_data, gltf2_blender_image
#gltf2_blender_extras = io_scene_gltf2.blender.com.extras
from io_scene_gltf2.blender.exp import joints as gltf2_blender_gather_joints
from io_scene_gltf2.blender.exp import nodes as gltf2_blender_gather_nodes
from io_scene_gltf2.blender.exp.material import materials as gltf2_blender_gather_materials
from io_scene_gltf2.blender.exp.material import texture_info as gltf2_blender_gather_texture_info
from io_scene_gltf2.blender.exp.material import search_node_tree as gltf2_blender_search_node_tree
from io_scene_gltf2.blender.exp.material import image as gltf2_blender_image
from io_scene_gltf2.blender.exp.cache import cached
from io_scene_gltf2.blender.imp import image #.BlenderImage #this fails somehow
BlenderImage = image.BlenderImage
from io_scene_gltf2.io.exp import binary_data as gltf2_io_binary_data
from io_scene_gltf2.io.exp import image_data as gltf2_io_image_data

else:
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
from io_scene_gltf2.blender.exp.gltf2_blender_gather_cache import cached
if bpy.app.version >= (4, 1, 0):
from io_scene_gltf2.blender.exp.material import gltf2_blender_search_node_tree
from io_scene_gltf2.io.com import gltf2_io_extensions
from io_scene_gltf2.io.com import gltf2_io
from io_scene_gltf2.io.exp import gltf2_io_binary_data
from io_scene_gltf2.io.exp import gltf2_io_image_data
from io_scene_gltf2.blender.imp.gltf2_blender_image import BlenderImage
from io_scene_gltf2.blender.com import gltf2_blender_extras
if bpy.app.version >= (3, 6, 0):
from io_scene_gltf2.blender.exp import gltf2_blender_gather_nodes, gltf2_blender_gather_joints
from io_scene_gltf2.blender.exp.material import gltf2_blender_gather_materials, gltf2_blender_gather_texture_info
from io_scene_gltf2.blender.exp.material.extensions import gltf2_blender_image
else:
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
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
from io_scene_gltf2.io.exp import gltf2_io_binary_data
from io_scene_gltf2.io.exp import gltf2_io_image_data
from io_scene_gltf2.blender.imp.gltf2_blender_image import BlenderImage
if bpy.app.version >= (4, 1, 0):
from io_scene_gltf2.blender.exp.material import gltf2_blender_search_node_tree

from typing import Optional, Tuple, Union
from ..nodes.lightmap import MozLightmapNode
import re
Expand All @@ -30,7 +50,8 @@

# gather_texture/image with HDR support via MOZ_texture_rgbe


print("gather_joints:", gltf2_blender_gather_joints)
print("gltf2_blender_image.ExportImage:", gltf2_blender_image.ExportImage)
class HubsImageData(gltf2_io_image_data.ImageData):
@property
def file_extension(self):
Expand Down

0 comments on commit a3c7524

Please sign in to comment.