X3D export fails on exporting a scene with a light #105235

Closed
opened 2024-03-14 11:29:35 +01:00 by Vincent Marchetti · 10 comments

System Information
Operating system: macOS-14.3.1-arm64-arm-64bit 64 Bits
Graphics card: Metal API Apple M1 Pro 1.2

Blender Version
Broken: version: 4.0.2, branch: blender-v4.0-release, commit date: 2023-12-05 07:41, hash: 9be62e85b727
Worked: 3.6

Addon Information
Name: Web3D X3D/VRML2 format (2, 3, 1)
Author: Campbell Barton, Bart, Bastien Montagne, Seva Alekseyev

Short description of error
Exporting to X3D a scene with a light fails, there is an exception thrown in Python script, empty X3D file created on filesystem, Blender application does not quit or crash as a result of failure

Exact steps for others to reproduce the error
From the initial startup screen choose the File > Export > X3D Extensible 3D add-on , file name, orientation immaterial

********. Additional *************

  1. Python exception trace:
    Info: starting X3D export to '/Users/vmarchetti/Desktop/untitled.x3d'...
    Traceback (most recent call last):
    File "/Applications/Blender.app/Contents/Resources/4.0/scripts/addons/io_scene_x3d/init.py", line 224, in execute
    return export_x3d.save(context, **keywords)
    File "/Applications/Blender.app/Contents/Resources/4.0/scripts/addons/io_scene_x3d/export_x3d.py", line 1575, in save
    export(file,
    File "/Applications/Blender.app/Contents/Resources/4.0/scripts/addons/io_scene_x3d/export_x3d.py", line 1508, in export
    export_main()
    File "/Applications/Blender.app/Contents/Resources/4.0/scripts/addons/io_scene_x3d/export_x3d.py", line 1504, in export_main
    export_object(ident, None, obj_main, obj_main_children)
    File "/Applications/Blender.app/Contents/Resources/4.0/scripts/addons/io_scene_x3d/export_x3d.py", line 1446, in export_object
    writePointLight(ident, obj, obj_matrix, data, world)
    File "/Applications/Blender.app/Contents/Resources/4.0/scripts/addons/io_scene_x3d/export_x3d.py", line 482, in writePointLight
    fw(ident_step + 'radius="%.4f" \n' % light.distance)
    AttributeError: 'PointLight' object has no attribute 'distance'
    Info: starting X3D export to '/Users/vmarchetti/Desktop/untitled2.x3d'...
    Info: finished X3D export to '/Users/vmarchetti/Desktop/untitled2.x3d'
    Saved session recovery to "/var/folders/b5/rdxvnr2j6tj69lzzl2q38nl40000gn/T/quit.blend"

  2. Source sleuthing in git repository shows that the parameter 'distance' was removed in the source file blender/source/blender/makesrna/intern/rna_light.cc at c4ddf16 (July 5 2023) : c4ddf16950

**System Information** Operating system: macOS-14.3.1-arm64-arm-64bit 64 Bits Graphics card: Metal API Apple M1 Pro 1.2 **Blender Version** Broken: version: 4.0.2, branch: blender-v4.0-release, commit date: 2023-12-05 07:41, hash: `9be62e85b727` Worked: 3.6 **Addon Information** Name: Web3D X3D/VRML2 format (2, 3, 1) Author: Campbell Barton, Bart, Bastien Montagne, Seva Alekseyev **Short description of error** Exporting to X3D a scene with a light fails, there is an exception thrown in Python script, empty X3D file created on filesystem, Blender application does not quit or crash as a result of failure **Exact steps for others to reproduce the error** From the initial startup screen choose the File > Export > X3D Extensible 3D add-on , file name, orientation immaterial ********. Additional ************* 1. Python exception trace: Info: starting X3D export to '/Users/vmarchetti/Desktop/untitled.x3d'... Traceback (most recent call last): File "/Applications/Blender.app/Contents/Resources/4.0/scripts/addons/io_scene_x3d/init.py", line 224, in execute return export_x3d.save(context, **keywords) File "/Applications/Blender.app/Contents/Resources/4.0/scripts/addons/io_scene_x3d/export_x3d.py", line 1575, in save export(file, File "/Applications/Blender.app/Contents/Resources/4.0/scripts/addons/io_scene_x3d/export_x3d.py", line 1508, in export export_main() File "/Applications/Blender.app/Contents/Resources/4.0/scripts/addons/io_scene_x3d/export_x3d.py", line 1504, in export_main export_object(ident, None, obj_main, obj_main_children) File "/Applications/Blender.app/Contents/Resources/4.0/scripts/addons/io_scene_x3d/export_x3d.py", line 1446, in export_object writePointLight(ident, obj, obj_matrix, data, world) File "/Applications/Blender.app/Contents/Resources/4.0/scripts/addons/io_scene_x3d/export_x3d.py", line 482, in writePointLight fw(ident_step + 'radius="%.4f" \n' % light.distance) AttributeError: 'PointLight' object has no attribute 'distance' Info: starting X3D export to '/Users/vmarchetti/Desktop/untitled2.x3d'... Info: finished X3D export to '/Users/vmarchetti/Desktop/untitled2.x3d' Saved session recovery to "/var/folders/b5/rdxvnr2j6tj69lzzl2q38nl40000gn/T/quit.blend" 2. Source sleuthing in git repository shows that the parameter 'distance' was removed in the source file blender/source/blender/makesrna/intern/rna_light.cc at c4ddf16 (July 5 2023) : https://github.com/blender/blender/commit/c4ddf169509e44d09f716983f6fe9691d8b939cc
Vincent Marchetti added the
Status
Needs Triage
Priority
Normal
Type
Report
labels 2024-03-14 11:29:35 +01:00

@vmarchetti Can confirm this, the definition for radius should be shadow_soft_size instead of distance
Fixed with 7717c30fc3

@vmarchetti Can confirm this, the definition for radius should be `shadow_soft_size` instead of `distance` Fixed with 7717c30fc3
Sebastian Sille added
Status
Resolved
and removed
Status
Needs Triage
labels 2024-03-14 20:10:34 +01:00
Member

Thanks @NRGSille , closing.

Thanks @NRGSille , closing.

The term 'radius' is used in a different way for X3D lights (PointLight and Spotlight) than it is for Blender lights. In X3D, the lights illuminates objects that are closer to the light than the value of 'radius'. Pertinent X3D specification is https://www.web3d.org/documents/specifications/19775-1/V4.0/Part01/components/lighting.html#PointLight

The parameter cutoff_distance from the bpy light structure seems to be a closer match to the meaning of 'radius' for X3D lights.https://docs.blender.org/api/current/bpy.types.Light.html#bpy.types.Light.cutoff_distance

I'd also propose that the change of the export to X3D to use either shadow_soft_size or cutoff_distance, be matched by the corresponding change in the Import of an X3D Spotlight or PointLight

The term 'radius' is used in a different way for X3D lights (PointLight and Spotlight) than it is for Blender lights. In X3D, the lights illuminates objects that are closer to the light than the value of 'radius'. Pertinent X3D specification is https://www.web3d.org/documents/specifications/19775-1/V4.0/Part01/components/lighting.html#PointLight The parameter cutoff_distance from the bpy light structure seems to be a closer match to the meaning of 'radius' for X3D lights.https://docs.blender.org/api/current/bpy.types.Light.html#bpy.types.Light.cutoff_distance I'd also propose that the change of the export to X3D to use either shadow_soft_size or cutoff_distance, be matched by the corresponding change in the Import of an X3D Spotlight or PointLight
Blender Bot added
Status
Needs Triage
and removed
Status
Resolved
labels 2024-03-15 11:23:53 +01:00

@vmarchetti thanks for the detailed explanation, cutoff_distance seems to be closer to the .x3d definition, will change it to that parameter.

@vmarchetti thanks for the detailed explanation, `cutoff_distance` seems to be closer to the .x3d definition, will change it to that parameter.

Should be fixed now with 487b433e6e and 2a9e718930

Should be fixed now with 487b433e6e and 2a9e718930
Sebastian Sille added
Status
Resolved
and removed
Status
Needs Triage
labels 2024-03-15 11:56:50 +01:00

Hello, I have the exact same error message using Import > "X3D Extensible 3D (.x3d)" out of the box Blender feature on 4.0.2 (win64).
Is this solved problem with export also have impact on import or is it unrelated?

The file I am trying to open is the attached one.

Hello, I have the exact same error message using Import > "X3D Extensible 3D (.x3d)" out of the box Blender feature on 4.0.2 (win64). Is this solved problem with export also have impact on import or is it unrelated? The file I am trying to open is the attached one.

@Full-Name-38 The error regarding the pointlight import is fixed in 4.2 but your file caused another error regarding texture coordinates

@Full-Name-38 The error regarding the pointlight import is fixed in 4.2 but your file caused another error regarding texture coordinates

Ok, great, thanks. I was unsure this issue was also concerning import.

I am indeed aware of the texture problem and it doesn't seem to be a Blender issue as Chisel (https://www2.hrp.no/vr/tools/chisel/install.htm) returns the same error when it tries to validate the VRML file. It seems I need to contact Compusoft to understand why their Winner design software produces invalid VRML files (and why it doesn't produce anything newer than VRML) ;)

Ok, great, thanks. I was unsure this issue was also concerning import. I am indeed aware of the texture problem and it doesn't seem to be a Blender issue as Chisel (https://www2.hrp.no/vr/tools/chisel/install.htm) returns the same error when it tries to validate the VRML file. It seems I need to contact Compusoft to understand why their Winner design software produces invalid VRML files (and why it doesn't produce anything newer than VRML) ;)
Member

@NRGSille hi, AFAICS you've pushed fix to main. I think this should also go to 4.1 release branch.
You can cherry-pick these commits to 4.1 branch: https://developer.blender.org/docs/handbook/release_process/release_branch_merge_playbook/#fix-committed-to-main-should-have-been-in-release-branch

@ThomasDinges ^

@NRGSille hi, AFAICS you've pushed fix to main. I think this should also go to 4.1 release branch. You can `cherry-pick` these commits to 4.1 branch: https://developer.blender.org/docs/handbook/release_process/release_branch_merge_playbook/#fix-committed-to-main-should-have-been-in-release-branch @ThomasDinges ^
@PratikPB2123 done
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 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#105235
No description provided.