From c653fccd6f791c4f63de2e8236c6ca699bb8749a Mon Sep 17 00:00:00 2001 From: Randy Frank Date: Thu, 5 Dec 2024 14:59:23 -0500 Subject: [PATCH] GLB timeline and material fixes 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. --- src/ansys/pyensight/core/utils/omniverse_glb_server.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ansys/pyensight/core/utils/omniverse_glb_server.py b/src/ansys/pyensight/core/utils/omniverse_glb_server.py index 2a75482696d..f2b955c8d4d 100644 --- a/src/ansys/pyensight/core/utils/omniverse_glb_server.py +++ b/src/ansys/pyensight/core/utils/omniverse_glb_server.py @@ -1,4 +1,5 @@ import io +import json import logging import os import sys @@ -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: @@ -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