Title: ifcgeom: emit mtllib in OBJ output so materials are linked (#4846) by petruconduraru · Pull Request #8467 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: ifcgeom: emit mtllib in OBJ output so materials are linked (#4846) by petruconduraru · Pull Request #8467 · IfcOpenShell/IfcOpenShell
X Title: ifcgeom: emit mtllib in OBJ output so materials are linked (#4846) by petruconduraru · Pull Request #8467 · IfcOpenShell/IfcOpenShell
Description: Fixes #4846. Problem Converting to OBJ produces a .mtl file with the correct materials, but the .obj never references it, so viewers show no materials. WavefrontObjSerializer emits the mtllib line only when mtl_stream.filename() is set: if (mtl_stream.filename()) { std::string mtl_basename = *mtl_stream.filename(); ... } But stream_or_filename's filename constructor (GeometrySerializer.h) opened the ofstream without ever assigning filename_, so filename() always returned an empty optional. The mtllib line was therefore dead code for every file-based OBJ export. Fix Store the filename in the constructor: stream_or_filename(const std::string& fn) : ofs_(new std::ofstream(...)) , filename_(fn) , stream(*ofs_) {} The in-memory (ostringstream) constructor still leaves filename_ empty, and filename() is read only by the OBJ serializer's mtllib guard, so nothing else changes. Verification Confirmed on the issue sample with the current build: the .mtl contained the newmtl entry and the .obj had usemtl but zero mtllib lines. The filename() accessor is used at exactly one site (the OBJ mtllib guard), so this restores the reference with no other behavioral change. Not compile-tested locally; CI's build-ifcopenshell compile-checks it. 🤖 Generated with Claude Code
Open Graph Description: Fixes #4846. Problem Converting to OBJ produces a .mtl file with the correct materials, but the .obj never references it, so viewers show no materials. WavefrontObjSerializer emits the mtllib line ...
X Description: Fixes #4846. Problem Converting to OBJ produces a .mtl file with the correct materials, but the .obj never references it, so viewers show no materials. WavefrontObjSerializer emits the mtllib line ...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/pull/8467
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:6886a774-0b27-2f84-c0c4-aef291b67eb9 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 910C:229AD2:1AA025B:23EDFEF:6B054E63 |
| html-safe-nonce | 1494c3362ca6b319925e9ee6014c79109050cd93050f3245d7af32347a3cecec |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTBDOjIyOUFEMjoxQUEwMjVCOjIzRURGRUY6NkIwNTRFNjMiLCJ2aXNpdG9yX2lkIjoiMzcwNDEyMjcyNTc4NzU4NjE0NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 07da83bfae5dc57b6b57f52b79955098374912faa08a88c9bb586097b466ad83 |
| hovercard-subject-tag | pull_request:4029588664 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/IfcOpenShell/IfcOpenShell/pull/8467/files |
| twitter:image | https://avatars.githubusercontent.com/u/139251053?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/139251053?s=400&v=4 |
| og:image:alt | Fixes #4846. Problem Converting to OBJ produces a .mtl file with the correct materials, but the .obj never references it, so viewers show no materials. WavefrontObjSerializer emits the mtllib line ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 854d880890b5e847b3fce9d1b31f032107baeddeebad2aa379c48aa4f1451f6b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git |
| octolytics-dimension-user_id | 13692563 |
| octolytics-dimension-user_login | IfcOpenShell |
| octolytics-dimension-repository_id | 40473201 |
| octolytics-dimension-repository_nwo | IfcOpenShell/IfcOpenShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 40473201 |
| octolytics-dimension-repository_network_root_nwo | IfcOpenShell/IfcOpenShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 220e980097d94ce616d5d11fbd5316d208e3fc93 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width