Skip to content

Commit

Permalink
GLB timeline and material fixes
Browse files Browse the repository at this point in the history
The end timepoint for glb file scene timeline was not computed properly.
If the GLB material supports the ANSYS material extension, include it in the protobuffer.
  • Loading branch information
randallfrank committed Dec 5, 2024
1 parent 90d1e89 commit c653fcc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ansys/pyensight/core/utils/omniverse_glb_server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import io
import json
import logging
import os
import sys
Expand Down Expand Up @@ -108,6 +109,8 @@ def _map_material(self, glb_materialid: int, part_pb: Any) -> None:
part_pb.ambient = 1.0
part_pb.diffuse = 1.0
part_pb.specular_intensity = 1.0
if "ANSYS_material_details" in mat.extensions:
part_pb.material_name = json.dumps(mat.extensions["ANSYS_material_details"])
# if the material maps to a variable, set the variable id for coloring
glb_varid = self._find_variable_from_glb_mat(glb_materialid)
if glb_varid:
Expand Down Expand Up @@ -662,8 +665,7 @@ def _build_scene_timeline(self, scene_idx: int, input_timeline: List[float]) ->
try:
t0 = self._gltf.scenes[scene_idx].extensions["ANSYS_scene_timevalue"]["timevalue"]
idx = scene_idx + 1
if idx >= num_scenes:
idx = scene_idx
if idx < num_scenes:
t1 = self._gltf.scenes[idx].extensions["ANSYS_scene_timevalue"]["timevalue"]
else:
t1 = t0
Expand Down

0 comments on commit c653fcc

Please sign in to comment.