KiCad PCB EDA Suite
Loading...
Searching...
No Matches
glb_utils.h File Reference
#include <wx/string.h>

Go to the source code of this file.

Functions

bool FixGlbLinesPrimitives (const wxString &aFilePath)
 Fix LINES primitives in a GLB file that have odd index counts.
 

Function Documentation

◆ FixGlbLinesPrimitives()

bool FixGlbLinesPrimitives ( const wxString & aFilePath)

Fix LINES primitives in a GLB file that have odd index counts.

OCCT 7.9+ can emit glTF LINES primitives with odd index counts for degenerate BSpline edges. The glTF spec requires LINES (mode 1) to have an even number of indices since each pair defines one line segment. Blender and other strict importers reject files that violate this constraint.

This function reads the GLB, adjusts any offending accessor counts to be even, and rewrites the file in place.

Parameters
aFilePathpath to the GLB file to fix
Returns
true if the file was processed successfully (or needed no changes)

Definition at line 42 of file glb_utils.cpp.

References KIPLATFORM::IO::AtomicWriteFile(), GLB_CHUNK_JSON, GLB_MAGIC, and GLTF_LINES_MODE.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and STEP_PCB_MODEL::WriteGLTF().