Skip to content

crash with fbx importer if it contains armature #16

@francoisgfx

Description

@francoisgfx

Describe the bug
if you try to import a fbx file with one bones in it from the loader, Blender will crash. If the fbx doesnt have bones, it works. If you try to import the fbx containing bones outside of the loader (directly in the script editor), it works.

this is the code used to import it. same code works from the script editor.

import bpy

def get_view3d_operator_context():
    """Adapted from several sources.

    It seems like  io ops needs a
    specific context that if run external to the Blender console needs to
    be specified
    """
    for window in bpy.context.window_manager.windows:
        for area in window.screen.areas:
            if area.type == "VIEW_3D":
                for region in area.regions:
                    if region.type == "WINDOW":
                        context_override = {
                            "window": window,
                            "screen": window.screen,
                            "area": area,
                            "region": region,
                            "scene": bpy.context.scene,
                        }
                        return context_override
    return None

context = get_view3d_operator_context()
path = r"//path/to//scene.v006.fbx"
bpy.ops.import_scene.fbx(
                context,
                filepath=path,
                use_manual_orientation=False,
                global_scale=1.0,
                use_custom_normals=True,
                use_image_search=True,
                use_alpha_decals=False,
                decal_offset=0.0,
                use_anim=False,
                anim_offset=1.0,
                use_subsurf=False,
                use_custom_props=True,
                use_custom_props_enum_as_string=True,
                ignore_leaf_bones=True,
                force_connect_children=False,
                automatic_bone_orientation=True,
                primary_bone_axis="Y",
                secondary_bone_axis="X",
                use_prepost_rot=True,
                axis_forward="-Z",
                axis_up="Y",
            )

using debugpy, I noticed the crash is happening inside the following function
root_helper.build_hierarchy(fbx_tmpl, settings, scene, view_layer)
...../Blender 3.3/3.3/scripts/addons/io_scene_fbx/import_fbx.py -> line 2845

To Reproduce
Steps to reproduce the behavior:

  1. export fbx of a cube with 1 bones
  2. open loader, select the fbx
  3. import into collection
  4. crash...

Desktop (please complete the following information):

  • OS: windows 10
  • Blender 3.3.1 and Blender 3.4.1
  type: app_store
  name: tk-core
  version: v0.20.14

frameworks:
  tk-framework-adminui_v0.x.x:
    location:
      version: v0.7.2
      type: app_store
      name: tk-framework-adminui
  tk-framework-desktopserver_v1.x.x:
    location:
      type: app_store
      name: tk-framework-desktopserver
      version: v1.5.3
  tk-framework-qtwidgets_v2.x.x:
    location:
      type: app_store
      name: tk-framework-qtwidgets
      version: v2.10.5
  tk-framework-shotgunutils_v4.x.x:
    location:
      version: v4.4.15
      type: app_store
      name: tk-framework-shotgunutils
  tk-framework-shotgunutils_v5.x.x:
    location:
      version: v5.8.5
      type: app_store
      name: tk-framework-shotgunutils
  tk-framework-widget_v0.2.x:
    location:
      version: v0.2.8
      type: app_store
      name: tk-framework-widget
  tk-framework-widget_v1.x.x:
    location:
      version: v1.1.1
      type: app_store
      name: tk-framework-widget
  tk-framework-desktopclient_v0.x.x:
    location:
      version: v0.3.2
      type: app_store
      name: tk-framework-desktopclient
  tk-framework-unrealqt_v1.x.x:
    location:
      organization: ue4plugins
      repository: tk-framework-unrealqt
      version: v1.2.3
      type: github_release
  tk-framework-adobe_v1.x.x:
    location:
      type: app_store
      name: tk-framework-adobe
      version: v1.1.6

engines.tk-desktop.location:
  type: app_store
  name: tk-desktop
  version: v2.6.6
engines.tk-desktop2.location:
  type: app_store
  name: tk-desktop2
  version: v1.5.1
engines.tk-maya.location:
  type: app_store
  name: tk-maya
  version: v0.11.4
engines.tk-photoshopcc.location:
  type: app_store
  name: tk-photoshopcc
  version: v1.9.4
engines.tk-shell.location:
  type: app_store
  name: tk-shell
  version: v0.9.2
engines.tk-shotgun.location:
  type: app_store
  name: tk-shotgun
  version: v0.10.2
engines.tk-unreal.location:
  version: v1.2.0
  type: github_release
  organization: ue4plugins
  repository: tk-unreal
engines.tk-blender.location:
  type: git
  path: https://github.com/diegogarciahuerta/tk-blender
  version: v1.1.1

apps.tk-multi-about.location:
  type: app_store
  name: tk-multi-about
  version: v0.4.2
apps.tk-multi-breakdown.location:
  type: app_store
  name: tk-multi-breakdown
  version: v1.8.1
apps.tk-multi-breakdown2.location:
  type: app_store
  name: tk-multi-breakdown2
  version: v0.2.3
apps.tk-multi-demo.location:
  type: app_store
  name: tk-multi-demo
  version: v1.3.5
apps.tk-multi-launchapp.location:
  type: app_store
  name: tk-multi-launchapp
  version: v0.12.2
apps.tk-multi-loader2.location:
  type: app_store
  name: tk-multi-loader2
  version: v1.22.1
apps.tk-multi-publish2.location:
  type: app_store
  name: tk-multi-publish2
  version: v2.6.3
# temporary fork of publish2 for blender with python 3.10 compatibility
apps.tk-multi-publish2.blender.location:
  type: git
  path: git@gitlab.dwarf.studio:dwarf/rnd/pipeline/bld/sgtk-apps/tk-multi-publish2.git
  version: v3.6.3_dw
apps.tk-multi-pythonconsole.location:
  type: app_store
  name: tk-multi-pythonconsole
  version: v1.3.1
apps.tk-multi-reviewsubmission.location:
  type: app_store
  name: tk-multi-reviewsubmission
  version: v1.2.1
apps.tk-multi-screeningroom.location:
  type: app_store
  name: tk-multi-screeningroom
  version: v0.5.1
apps.tk-multi-setframerange.location:
  type: app_store
  name: tk-multi-setframerange
  version: v0.5.1
apps.tk-multi-shotgunpanel.location:
  type: app_store
  name: tk-multi-shotgunpanel
  version: v1.8.4
apps.tk-multi-snapshot.location:
  type: app_store
  name: tk-multi-snapshot
  version: v0.9.1
apps.tk-multi-workfiles2.location:
  type: app_store
  name: tk-multi-workfiles2
  version: v0.13.2
apps.tk-multi-devutils.location:
  type: app_store
  name: tk-multi-devutils
  version: v1.2.1
apps.tk-shotgun-folders.location:
  type: app_store
  name: tk-shotgun-folders
  version: v0.3.1
apps.tk-shotgun-launchfolder.location:
  type: app_store
  name: tk-shotgun-launchfolder
  version: v0.3.1
apps.tk-shotgun-launchpublish.location:
  type: app_store
  name: tk-shotgun-launchpublish
  version: v0.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions