fix blender import path 4.3+
This commit is contained in:
parent
9c77139dcd
commit
e21ecaef0a
1 changed files with 17 additions and 12 deletions
29
bimport.py
29
bimport.py
|
@ -4,11 +4,10 @@ from bpy.props import (
|
||||||
BoolProperty,
|
BoolProperty,
|
||||||
EnumProperty,
|
EnumProperty,
|
||||||
IntProperty,
|
IntProperty,
|
||||||
FloatProperty,
|
|
||||||
CollectionProperty,
|
CollectionProperty,
|
||||||
)
|
)
|
||||||
from bpy.types import Operator
|
from bpy.types import Operator
|
||||||
from bpy_extras.io_utils import ImportHelper, ExportHelper
|
from bpy_extras.io_utils import ImportHelper
|
||||||
from io_scene_gltf2 import ConvertGLTF2_Base
|
from io_scene_gltf2 import ConvertGLTF2_Base
|
||||||
import importlib
|
import importlib
|
||||||
|
|
||||||
|
@ -16,7 +15,7 @@ import importlib
|
||||||
if "Font" in locals():
|
if "Font" in locals():
|
||||||
importlib.reload(Font)
|
importlib.reload(Font)
|
||||||
else:
|
else:
|
||||||
from .common import Font
|
pass
|
||||||
|
|
||||||
if "utils" in locals():
|
if "utils" in locals():
|
||||||
importlib.reload(utils)
|
importlib.reload(utils)
|
||||||
|
@ -50,7 +49,7 @@ def get_font_faces_in_file(filepath):
|
||||||
out.append(node.extras)
|
out.append(node.extras)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
except ImportError as e:
|
except ImportError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,7 +59,7 @@ def get_font_faces_in_file(filepath):
|
||||||
class GetFontFacesInFile(Operator, ImportHelper):
|
class GetFontFacesInFile(Operator, ImportHelper):
|
||||||
"""Load a glTF 2.0 font and check which faces are in there"""
|
"""Load a glTF 2.0 font and check which faces are in there"""
|
||||||
|
|
||||||
bl_idname = f"abc3d.check_font_gltf"
|
bl_idname = "abc3d.check_font_gltf"
|
||||||
bl_label = "Check glTF 2.0 Font"
|
bl_label = "Check glTF 2.0 Font"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
|
@ -77,7 +76,6 @@ class GetFontFacesInFile(Operator, ImportHelper):
|
||||||
|
|
||||||
def check_gltf2(self, context):
|
def check_gltf2(self, context):
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
|
|
||||||
if self.files:
|
if self.files:
|
||||||
# Multiple file check
|
# Multiple file check
|
||||||
|
@ -100,7 +98,7 @@ class GetFontFacesInFile(Operator, ImportHelper):
|
||||||
class ImportGLTF2(Operator, ConvertGLTF2_Base, ImportHelper):
|
class ImportGLTF2(Operator, ConvertGLTF2_Base, ImportHelper):
|
||||||
"""Load a glTF 2.0 font"""
|
"""Load a glTF 2.0 font"""
|
||||||
|
|
||||||
bl_idname = f"abc3d.import_font_gltf"
|
bl_idname = "abc3d.import_font_gltf"
|
||||||
bl_label = "Import glTF 2.0 Font"
|
bl_label = "Import glTF 2.0 Font"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
|
@ -285,11 +283,18 @@ class ImportGLTF2(Operator, ConvertGLTF2_Base, ImportHelper):
|
||||||
|
|
||||||
def unit_import(self, filename, import_settings):
|
def unit_import(self, filename, import_settings):
|
||||||
import time
|
import time
|
||||||
from io_scene_gltf2.io.imp.gltf2_io_gltf import glTFImporter, ImportError
|
try:
|
||||||
from io_scene_gltf2.blender.imp.gltf2_blender_gltf import BlenderGlTF
|
from io_scene_gltf2.io.imp.gltf2_io_gltf import glTFImporter, ImportError
|
||||||
from io_scene_gltf2.blender.imp.gltf2_blender_vnode import VNode, compute_vnodes
|
from io_scene_gltf2.blender.imp.gltf2_blender_gltf import BlenderGlTF
|
||||||
from io_scene_gltf2.blender.com.gltf2_blender_extras import set_extras
|
from io_scene_gltf2.blender.imp.gltf2_blender_vnode import VNode, compute_vnodes
|
||||||
from io_scene_gltf2.blender.imp.gltf2_blender_node import BlenderNode
|
from io_scene_gltf2.blender.com.gltf2_blender_extras import set_extras
|
||||||
|
from io_scene_gltf2.blender.imp.gltf2_blender_node import BlenderNode
|
||||||
|
except (ModuleNotFoundError, ImportError):
|
||||||
|
from io_scene_gltf2.io.imp.blender_gltf import glTFImporter, ImportError
|
||||||
|
from io_scene_gltf2.blender.imp.blender_gltf import BlenderGlTF
|
||||||
|
from io_scene_gltf2.blender.imp.vnode import VNode, compute_vnodes
|
||||||
|
from io_scene_gltf2.blender.com.extras import set_extras
|
||||||
|
from io_scene_gltf2.blender.imp.node import BlenderNode
|
||||||
|
|
||||||
try:
|
try:
|
||||||
gltf = glTFImporter(filename, import_settings)
|
gltf = glTFImporter(filename, import_settings)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue