Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Unity plugin] Throw exception if OBJ file is referenced in MJCF when loading in Unity #2248

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions unity/Editor/Importer/MjImporterWithAssets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ private void ParseMesh(XmlElement parentNode) {
parentNode.GetStringAttribute("name", defaultValue: string.Empty);
var assetReferenceName = MjEngineTool.Sanitize(unsanitizedAssetReferenceName);
var sourceFilePath = Path.Combine(_sourceMeshesDir, fileName);

if (Path.GetExtension(sourceFilePath) == ".obj") {
throw new NotImplementedException("OBJ mesh file loading is not yet implemented. " +
"Please convert to binary STL. " +
$"Attempted to load: {sourceFilePath}");
}

var targetFilePath = Path.Combine(_targetMeshesDir, assetReferenceName + ".stl");
if (File.Exists(targetFilePath)) {
File.Delete(targetFilePath);
Expand Down
Loading