FBX: Subdivision crease data fails to be imported/exported in 4.0 (API change) #104707

Closed
opened 2023-06-20 06:26:26 +02:00 by Jesse Yurkovich · 2 comments

System Information
Operating system: Windows-10-10.0.22621-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 4090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 528.24

Blender Version
Broken: version: 4.0.0 Alpha, branch: main.
Worked: 3.6

Addon Information
Name: FBX format (5, 3, 4)
Author: Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem

Short description of error
The FBX importer and exporter need to be adjusted to the Python API changes in 4.0: https://wiki.blender.org/wiki/Reference/Release_Notes/4.0/Python_API

The "crease" data has been moved to attributes etc.

This was originally blender/blender#109122

Exact steps for others to reproduce the error

  • Load the attached .blend
  • Try to Export the selected object with Subdivision data toggled [1]
  • Once that's fixed, try to Import [2]

[1] Error on Export

FBX export starting... 'T:\\untitled.fbx'
Traceback (most recent call last):
  File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\__init__.py", line 663, in execute
    return export_fbx_bin.save(self, context, **keywords)
  File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 3511, in save
    ret = save_single(operator, context.scene, depsgraph, filepath, **kwargs_mod)
  File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 3394, in save_single
    fbx_objects_elements(root, scene_data)
  File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 3191, in fbx_objects_elements
    fbx_data_mesh_elements(objects, me_obj, scene_data, done_meshes)
  File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 1113, in fbx_data_mesh_elements
    me.edges.foreach_get('crease', t_ec_raw)
AttributeError: foreach_get/set 'Mesh.
                                                     edges[...]' elements have no attribute 'crease'

[2] Error on Import

Traceback (most recent call last):
  File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\__init__.py", line 209, in execute
    if import_fbx.load(self, context, filepath=path, **keywords) == {'FINISHED'}:
  File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\import_fbx.py", line 2837, in load
    _(); del _
  File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\import_fbx.py", line 2836, in _
    fbx_item[1] = blen_read_geom(fbx_tmpl, fbx_obj, settings)
  File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\import_fbx.py", line 1536, in blen_read_geom
    blen_read_geom_layer_edge_crease(fbx_obj, mesh)
  File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\import_fbx.py", line 1364, in blen_read_geom_layer_edge_crease
    return blen_read_geom_array_mapped_edge(
  File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\import_fbx.py", line 1090, in blen_read_geom_array_mapped_edge
    blen_read_geom_array_foreach_set_direct(blen_data, blen_attr, blen_dtype, fbx_layer_data, stride, item_size,
  File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\import_fbx.py", line 936, in blen_read_geom_array_foreach_set_direct
    blen_data.foreach_set(blen_attr, buffer.ravel())
AttributeError: foreach_get/set 'Mesh.
                                                     edges[...]' elements have no attribute 'crease'
**System Information** Operating system: Windows-10-10.0.22621-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 4090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 528.24 **Blender Version** Broken: version: 4.0.0 Alpha, branch: main. Worked: 3.6 **Addon Information** Name: FBX format (5, 3, 4) Author: Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem **Short description of error** The FBX importer and exporter need to be adjusted to the Python API changes in 4.0: https://wiki.blender.org/wiki/Reference/Release_Notes/4.0/Python_API The "crease" data has been moved to attributes etc. This was originally https://projects.blender.org/blender/blender/issues/109122 **Exact steps for others to reproduce the error** - Load the attached .blend - Try to Export the selected object with Subdivision data toggled [1] - Once that's fixed, try to Import [2] [1] Error on Export ``` FBX export starting... 'T:\\untitled.fbx' Traceback (most recent call last): File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\__init__.py", line 663, in execute return export_fbx_bin.save(self, context, **keywords) File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 3511, in save ret = save_single(operator, context.scene, depsgraph, filepath, **kwargs_mod) File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 3394, in save_single fbx_objects_elements(root, scene_data) File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 3191, in fbx_objects_elements fbx_data_mesh_elements(objects, me_obj, scene_data, done_meshes) File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 1113, in fbx_data_mesh_elements me.edges.foreach_get('crease', t_ec_raw) AttributeError: foreach_get/set 'Mesh. edges[...]' elements have no attribute 'crease' ``` [2] Error on Import ``` Traceback (most recent call last): File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\__init__.py", line 209, in execute if import_fbx.load(self, context, filepath=path, **keywords) == {'FINISHED'}: File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\import_fbx.py", line 2837, in load _(); del _ File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\import_fbx.py", line 2836, in _ fbx_item[1] = blen_read_geom(fbx_tmpl, fbx_obj, settings) File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\import_fbx.py", line 1536, in blen_read_geom blen_read_geom_layer_edge_crease(fbx_obj, mesh) File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\import_fbx.py", line 1364, in blen_read_geom_layer_edge_crease return blen_read_geom_array_mapped_edge( File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\import_fbx.py", line 1090, in blen_read_geom_array_mapped_edge blen_read_geom_array_foreach_set_direct(blen_data, blen_attr, blen_dtype, fbx_layer_data, stride, item_size, File "C:\Users\jesse\source\blender-git\build-full\bin\RelWithDebInfo\4.0\scripts\addons\io_scene_fbx\import_fbx.py", line 936, in blen_read_geom_array_foreach_set_direct blen_data.foreach_set(blen_attr, buffer.ravel()) AttributeError: foreach_get/set 'Mesh. edges[...]' elements have no attribute 'crease' ```
Jesse Yurkovich added the
Type
Report
Priority
Normal
Status
Confirmed
labels 2023-06-20 06:26:42 +02:00
Member

I have made a PR to fix this.

I have made a PR to fix this.
Bastien Montagne added
Type
Bug
and removed
Type
Report
labels 2023-06-21 15:46:05 +02:00

Looks like FBX was forgotten from 6e83949a13 :'(

@Mysteryem thanks for the super-quick fix!

Looks like FBX was forgotten from 6e83949a13 :'( @Mysteryem thanks for the super-quick fix!
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-06-21 15:46:54 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#104707
No description provided.