Skip to content

Commit 8d6ce2a

Browse files
authored
Merge pull request #1053 from compas-dev/glft_fix
GLTF fix
2 parents 58a9b31 + b7ef3c5 commit 8d6ce2a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3737
* Fixed uncentered viewbox in `Plotter.zoom_extents()`
3838
* Changed `RobotModelArtists.atteched_tool_models` to dictionary to support multiple tools.
3939
* Locked `sphinx` to 4.5.
40+
* Changed `GLTFExporter` such that generated gltfs can be viewed with webxr
4041
* Fixed source directory path in `compas_ghpython.uninstall` plugin.
4142
* Fixed bug in`compas_ghpython.components`that ignored input list of `.ghuser` objects to uninstall.
4243
* Fixed conversion bug of transformed `Box` in `compas_rhino.conversions`

src/compas/files/gltf/gltf_exporter.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from compas.files.gltf.constants import COMPONENT_TYPE_ENUM
1212
from compas.files.gltf.constants import COMPONENT_TYPE_FLOAT
1313
from compas.files.gltf.constants import COMPONENT_TYPE_UNSIGNED_INT
14+
from compas.files.gltf.constants import COMPONENT_TYPE_UNSIGNED_SHORT
1415
from compas.files.gltf.constants import NUM_COMPONENTS_BY_TYPE_ENUM
1516
from compas.files.gltf.constants import TYPE_MAT4
1617
from compas.files.gltf.constants import TYPE_SCALAR
@@ -283,6 +284,8 @@ def _add_scenes(self):
283284
return
284285
if self._content.default_scene_key is not None:
285286
self._gltf_dict['scene'] = self._scene_index_by_key[self._content.default_scene_key]
287+
else:
288+
self._gltf_dict['scene'] = list(self._content.scenes.values())[0].key
286289
scene_list = [None] * len(self._content.scenes.values())
287290
for key, scene in self._content.scenes.items():
288291
scene_list[self._scene_index_by_key[key]] = scene.to_data(self._node_index_by_key)
@@ -304,7 +307,7 @@ def _add_nodes(self):
304307
def _construct_primitives(self, mesh_data):
305308
primitives = []
306309
for primitive_data in mesh_data.primitive_data_list:
307-
indices_accessor = self._construct_accessor(primitive_data.indices, COMPONENT_TYPE_UNSIGNED_INT, TYPE_SCALAR)
310+
indices_accessor = self._construct_accessor(primitive_data.indices, COMPONENT_TYPE_UNSIGNED_SHORT, TYPE_SCALAR)
308311

309312
attributes = {}
310313
for attr in primitive_data.attributes:

0 commit comments

Comments
 (0)