DiscussionsIssue archiveOCCT:Data Exchange

Archived issue #0032540

RWGltf_CafReader - optional "scene" parameter encoded as mandatory

CommunityOCCT:Data Exchangeclosed9 public notes

Search issues

Description

When reading the included file, with RWGltf_CafReader or OCCT CAD Assistant , error "Member 'scene' is not found" is returned.

The gltf file format has the scene parameter as not required: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-scene

File can be opened in this online gltf validator: https://github.khronos.org/glTF-Validator/ without error

Parameter is flagged as mandatory in RWGltf_GltfJsonParser.cxx at line 240

Steps to reproduce

Opening the file with OCCT CAD Assistant or using sample code:

opencascade::handle<TDocStd_Application> aTDFApplication = XCAFApp_Application::GetApplication();
opencascade::handle<TDocStd_Document> aTDFDocument;
aTDFApplication->NewDocument("IMPORTGLTF", aTDFDocument);

RWGltf_CafReader aGLTFReader;
aGLTFReader.SetFileLengthUnit(1.);
aGLTFReader.SetSystemLengthUnit(1e-3);
aGLTFReader.SetDocument(aTDFDocument);
aGLTFReader.Perform(aFilename, Standard_ProgressDialog::ProgressIndicator()->Start())

Public activity

9 archived notes

Participants are labeled by their role within this record.

01Commenter 2
> When scene is undefined, runtime is not required to render anything at load time.
Based on this item in specs, one would expect an empty document being loaded, which looks kind of useless to me.
It is strange that other viewers display a sphere for attached file instead of an empty model.

I guess we may modify OCCT to follow a common behavior, probably with a strict option or a warning message.
It is currently not possible asking RWGltf_CafReader to import non-default scene into XCAF document.

02Author
The glb file still contains a scenes array. The first item scenes[0] could be loaded by default, if present, when there is no default scene specified. This is probably what the other viewer does.
03Commenter 2
Sure, I see what other viewers do.
I'm just saying that current behavior of RWGltf_CafReader doesn't contradict to glTF specification (returning error or importing an empty scene will give no particular difference) - in fact reader is trying to follow specs more strictly here.

04Commenter 3
Branch [archived branch] has been created by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
Date: Thu Sep 9 21:59:18 2021 +0300

    0032540: RWGltf_CafReader - optional "scene" parameter encoded as mandatory
    
    First scene is now loaded when default one is undefined.
05Commenter 3
Branch [archived branch] has been updated forcibly by Commenter 2.

[revision removed]
06Commenter 2
Patch is ready for review
- OCCT: branch CR32540.
07Commenter 7
The patch was reviewed
08Commenter 8
Combination -
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 17358.54000000042 / 17496.500000000422 [-0.79%]
Products
Total CPU difference: 11397.800000000112 / 11567.680000000111 [-1.47%]
Windows-64-VC14:
OCCT
Total CPU difference: 19328.109375 / 19307.609375 [+0.11%]
Products
Total CPU difference: 12733.328125 / 12920.953125 [-1.45%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
09Commenter 3
Branch [archived branch] has been deleted by Participant.

[revision removed]

Related records