Maniphest T94122

Export to X3D Fails
Closed, Resolved

Assigned To
Bastien Montagne (mont29)
Authored By
Steven Frank (macrayblackhand)
Dec 15 2021, 7:45 PM
Tags
  • Add-ons (Community)
Subscribers
Andreas Plesch (andreasplesch)
Philipp Oeser (lichtwerk)
Pratik Borhade (PratikPB2123)
Steven Frank (macrayblackhand)
Tokens
"Love" token, awarded by ppinter2.

Description

System Information
Operating system: Windows 10
Graphics card: Nvidia GeForce GTX 1080

Blender Version
Broken: (version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash: f1cca3055776, type: release)
Worked: (version: 2.93.5, branch: master, commit date: 2021-10-05 12:04, hash: a791bdabd0b2, type: release)

Short description of error
When trying to export a .blend file to .X3D (using default options), this error occurs and a zero-length file is produced
Info: starting X3D export to 'S:\\MacraysKeep\\VR\\X3d\\ImogenTemult_EF.x3d'...
Python: Traceback (most recent call last):

File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\scripts\addons\io_scene_x3d\__init__.py", line 240, in execute
  return export_x3d.save(context, **keywords)
File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\scripts\addons\io_scene_x3d\export_x3d.py", line 1590, in save
  export(file,
File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\scripts\addons\io_scene_x3d\export_x3d.py", line 1523, in export
  export_main()
File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\scripts\addons\io_scene_x3d\export_x3d.py", line 1519, in export_main
  export_object(ident, None, obj_main, obj_main_children)
File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\scripts\addons\io_scene_x3d\export_x3d.py", line 1381, in export_object
  free, derived = create_derived_objects(scene, obj_main)
File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\scripts\modules\bpy_extras\io_utils.py", line 364, in create_derived_objects
  for ob in objects:

TypeError: 'Object' object is not iterable

location: <unknown location>:-1

Exact steps for others to reproduce the error
When trying to export a .blend file to .X3D (using default options)

Revisions and Commits

rBA Blender Add-ons
D13667
D13667

Related Objects

Mentioned In
T93479: 3.0 Potential candidates for corrective releases
D13667: fixes call of create_derived_objects() in x3d export in v. 3.0
Mentioned Here
T93479: 3.0 Potential candidates for corrective releases
rBa82c9e1e405c: Fix T91169: bpy_extras.io_utils.create_derived_objects -> duplis error
rBa791bdabd0b2: Versioin bump: 2.93.5-release
rBf1cca3055776: Blender 3.0 - version bump -> release

Event Timeline

Steven Frank (macrayblackhand) created this task.Dec 15 2021, 7:45 PM
Pratik Borhade (PratikPB2123) edited projects, added Add-ons (Community); removed BF Blender.Dec 16 2021, 12:14 PM
Pratik Borhade (PratikPB2123) added a subscriber: Pratik Borhade (PratikPB2123).
Pratik Borhade (PratikPB2123) changed the task status from Needs Triage to Confirmed.Dec 16 2021, 12:30 PM

Hi, thanks for the report. Can confirm on current master and 3.0.0.

I think problem appears because of the api changes (not sure)

Andreas Plesch (andreasplesch) added a subscriber: Andreas Plesch (andreasplesch).EditedDec 21 2021, 3:00 AM

This commit changed the signature and return value of the create_derived_objects function:

https://github.com/blender/blender/commit/a82c9e1e405c84b9ab8b5c1f31d7e135ab41c101

https://developer.blender.org/rBa82c9e1e405c84b9ab8b5c1f31d7e135ab41c101

(not sure what rB means in the commit hash, ok it refers to the Blender repo)

Andreas Plesch (andreasplesch) added a comment.EditedDec 21 2021, 3:59 AM

I had good success by adopting the new signature and converting the return value back to what was provided before the commit:

# -------------------------------------------------------------------------
# Export Object Hierarchy (recursively called)
# -------------------------------------------------------------------------
def export_object(ident, obj_main_parent, obj_main, obj_children):
    matrix_fallback = mathutils.Matrix()
    world = scene.world
    #import pdb; pdb.set_trace()
    #free, derived = create_derived_objects(scene, obj_main)
    derived_dict = create_derived_objects(depsgraph, [obj_main])
    derived = list(derived_dict.values())[0]

    if use_hierarchy:

I tested that with the default cube and a larger blend, generating the same .x3d as before.
Hopefully that can help somebody.

A more readable alternative is:

# -------------------------------------------------------------------------
# Export Object Hierarchy (recursively called)
# -------------------------------------------------------------------------
def export_object(ident, obj_main_parent, obj_main, obj_children):
    matrix_fallback = mathutils.Matrix()
    world = scene.world
    #import pdb; pdb.set_trace()
    #free, derived = create_derived_objects(scene, obj_main)
    derived_dict = create_derived_objects(depsgraph, [obj_main])
    derived = derived_dict.get(obj_main)

    if use_hierarchy:
Bastien Montagne (mont29) closed this task as Resolved by committing rBA1679f2fdbb13: Fix T94122: Export to X3D Fails..Dec 27 2021, 3:48 PM
Bastien Montagne (mont29) claimed this task.
Bastien Montagne (mont29) added a commit: rBA1679f2fdbb13: Fix T94122: Export to X3D Fails..
Steven Frank (macrayblackhand) added a comment.Jan 5 2022, 3:55 PM

Will this thread be notified when the version in which this fix resides is released?

Philipp Oeser (lichtwerk) added a subscriber: Philipp Oeser (lichtwerk).Jan 5 2022, 4:00 PM
In T94122#1283304, @Steven Frank (macrayblackhand) wrote:

Will this thread be notified when the version in which this fix resides is released?

It is in 3.1 daily builds from https://builder.blender.org/download/daily/ and on the list T93479: 3.0 Potential candidates for corrective releases
But no, no automatic notification here if 3.0.1 is released, please keep an eye on it.

Philipp Oeser (lichtwerk) added a commit: rBAc7be98348958: Fix T94122: Export to X3D Fails..Jan 11 2022, 10:45 AM
Pete Pinter (ppinter2) awarded a token.Dec 17 2022, 6:00 PM