Skip to content

Commit

Permalink
try matching old behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedh committed Dec 4, 2024
1 parent f2f079a commit 5d71ab1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions trimesh/exchange/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ def load(
# we are matching deprecated behavior here.
# gltf/glb always return a scene
# -
if len(loaded.geometry) == 1:
file_type = loaded.metadata["file_type"]
if len(loaded.geometry) == 1 and file_type in {"obj", "stl", "ply", "svg", "binvox"}:
# matching old behavior, you should probably use `load_scene`
return next(iter(loaded.geometry.values()))

Expand Down Expand Up @@ -556,7 +557,6 @@ def _parse_file_args(
metadata = {}
opened = False
file_path = None

if "metadata" in kwargs and isinstance(kwargs["metadata"], dict):
metadata.update(kwargs["metadata"])

Expand Down Expand Up @@ -624,9 +624,11 @@ def _parse_file_args(

# all our stored extensions reference in lower case
file_type = file_type.lower()

if file_path is not None:
metadata["file_path"] = file_path
metadata["file_name"] = os.path.basename(file_path)
metadata["file_type"] = file_type

# if we still have no resolver try using file_obj name
if (
Expand Down

0 comments on commit 5d71ab1

Please sign in to comment.