Title: Bonsai: skip out-of-view-layer spaces in toggle_hide_spaces (#5309) by petruconduraru · Pull Request #8535 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: Bonsai: skip out-of-view-layer spaces in toggle_hide_spaces (#5309) by petruconduraru · Pull Request #8535 · IfcOpenShell/IfcOpenShell
X Title: Bonsai: skip out-of-view-layer spaces in toggle_hide_spaces (#5309) by petruconduraru · Pull Request #8535 · IfcOpenShell/IfcOpenShell
Description: Closes #5309. Problem Toggling space visibility crashed with: RuntimeError: Object 'IfcSpace/0-2' cannot be hidden because it is not in View Layer 'ViewLayer'! tool.Spatial.toggle_hide_spaces called hide_get/hide_set unconditionally. Blender raises for any object not in the active view layer, e.g. an IfcSpace whose object lives in a collection excluded from the view layer. The rest of spatial.py already guards these calls with view_layer.objects.get(obj.name); this method was the outlier. Fix (src/bonsai/bonsai/tool/spatial.py) Filter the spaces to objects present in the active view layer, derive the toggle direction from the first surviving object, and apply hide_set only to those. Objects not in the view layer are skipped (they cannot be hidden anyway), and the method returns cleanly when nothing is toggleable. Matches the existing convention in the same file. Verification (live, headless Blender) Repro: two IfcSpaces, one object placed in a collection excluded from the view layer, then toggle_hide_spaces([space0, space1]). Before: RuntimeError: ... not in View Layer 'ViewLayer'! (matches the report). After: completes cleanly; the in-view-layer space is hidden (hide_get() == True), the excluded space is skipped. Core test_spatial.py: 12 passed. Generated with the assistance of an AI coding tool. 🤖 Generated with Claude Code
Open Graph Description: Closes #5309. Problem Toggling space visibility crashed with: RuntimeError: Object 'IfcSpace/0-2' cannot be hidden because it is not in View Layer 'ViewLayer'! tool.Spatial.toggle_...
X Description: Closes #5309. Problem Toggling space visibility crashed with: RuntimeError: Object 'IfcSpace/0-2' cannot be hidden because it is not in View Layer 'ViewLayer'! tool...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/pull/8535
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
| 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:f68ccbd4-a36f-0e00-3a75-a223eba7ab8e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C32E:194442:2A4CC7:388725:6B04B728 |
| html-safe-nonce | 0aa9e4716c849475526b3ca7648834316f95374af944ecb1bc119a28d0e32e2a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzJFOjE5NDQ0MjoyQTRDQzc6Mzg4NzI1OjZCMDRCNzI4IiwidmlzaXRvcl9pZCI6IjcwMzMzNjE1MzU3NDU3MDE2NzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1525f0ca57c58116065a797ec2223cf3504d85b0ef661d089e8978f6304e7308 |
| hovercard-subject-tag | pull_request:4038085802 |
| 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/8535/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 | Closes #5309. Problem Toggling space visibility crashed with: RuntimeError: Object 'IfcSpace/0-2' cannot be hidden because it is not in View Layer 'ViewLayer'! tool.Spatial.toggle_... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 378bd702ac792b3550e484ad39d9a898fcd25bb52ba6962b0c9cc457c1ea71c7 |
| 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 | b032e77f1ea437ede6c115446a0a467709b468e7 |
| 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