Skip to content

fix(export_utils): return output_obj_path from export_to_obj - #15507

Open
2422725977 wants to merge 1 commit into
huggingface:mainfrom
2422725977:fix/export-to-obj-return-path
Open

2422725977 wants to merge 1 commit into
huggingface:mainfrom
2422725977:fix/export-to-obj-return-path

Conversation

@2422725977

Copy link
Copy Markdown

What does this PR do?

export_to_obj (src/diffusers/utils/export_utils.py) creates a temporary .obj file when output_obj_path is None, writes the mesh data to disk, and exits without returning output_obj_path (always returning None). Because the caller has no reference to the temporary path, the generated .obj file is unreachable when output_obj_path is omitted, and the return behavior is inconsistent with sibling exporters (export_to_ply, export_to_gif, export_to_video).

Summary of changes

  • Add -> str return type annotation and return output_obj_path to export_to_obj in src/diffusers/utils/export_utils.py.
  • Add TestExportToObj (2 unit tests) in tests/others/test_utils.py verifying both the temporary-path (output_obj_path=None) and explicit-path (output_obj_path=...) return values and written OBJ contents.

Verification

  • PYTHONPATH=src pytest -v tests/others/test_utils.py -k export_to_obj — 2 passed
  • ruff check --no-cache src/diffusers/utils/export_utils.py tests/others/test_utils.py — passed
  • ruff format --check --no-cache src/diffusers/utils/export_utils.py tests/others/test_utils.py — passed

Before submitting

  • Did you use an AI agent (Claude Code, Codex, Cursor, etc.) to help with this PR? If so:
    • Did you read the Coding with AI agents guide?
    • Did you run the self-review skill on the diff?
    • Did you share the final self-review notes in the PR description or a comment?
  • Did you read the contributor guideline?
  • Did you read our philosophy doc? (important for complex PRs)
  • Was this discussed/approved via a GitHub issue or GitHub Discussions? Please add a link to it if that's the case.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?
  • Are you the author (or part of the team we work with) of the model/pipeline this PR relates to?

Self-review notes

  • Blocking issues: None.
  • Non-blocking / Leave for actual review:
    1. Legacy duplicate export_to_obj definitions also exist in src/diffusers/utils/testing_utils.py:824 and tests/testing_utils.py:1136; left untouched to keep this PR scoped to the public diffusers.utils.export_utils API, happy to update them as well if desired.
  • Dead code (advisory): None introduced (output_obj_path is already constructed and written within export_to_obj).
  • Verdict: READY.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant