Skip to content

Fix window/door preview alignment regression in ProductDecorator#7659

Open
jaliste wants to merge 2 commits intoIfcOpenShell:v0.8.0from
jaliste:fix/decorator-preview
Open

Fix window/door preview alignment regression in ProductDecorator#7659
jaliste wants to merge 2 commits intoIfcOpenShell:v0.8.0from
jaliste:fix/decorator-preview

Conversation

@jaliste
Copy link
Contributor

@jaliste jaliste commented Feb 10, 2026

Summary

  • Fix preview position offset for windows/doors on walls not at origin
  • Fix undefined 'context' variable (use bpy.context instead)
  • Recalculate type object's inverted matrix each frame to handle representation switches

These are regressions introduced in e55955b ("Fix unusable lag due to dense meshes with product preview").

Test plan

  • Select Window Tool, hover over walls at different positions - preview should follow mouse correctly
  • Test with walls at origin and walls far from origin - both should work
  • Test window placement on both sides of a wall

🤖 Generated with Claude Code

jaliste and others added 2 commits February 10, 2026 11:23
Fixes two issues introduced in e55955b:

1. Extract only rotation from wall matrix when calculating preview
   orientation, avoiding position offset for walls not at origin

2. Recalculate type object's inverted matrix each frame instead of
   using cached value, as representation switches can change it

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The get_generic_preview_data method referenced 'context' but the
variable was never defined. This was a copy-paste error from the old
code where the function received context as a parameter.

Use bpy.context instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
jaliste referenced this pull request Feb 10, 2026
Previously, when the add occurrence modal operator was executed, on
every modal loop (i.e. every mouse movement) it would fetch the mesh
geometry to be previewed, store the verts / edges / faces in mesh
collections, then the decorator would fetch that geometry, the clear the
collections, in a loop.

I've removed the Blender collections. Instead the same strategy is used
as in ItemDecorator i.e. the mesh and verts are fetched once during
decorator installation, then on each draw call only a single vertex loop
to multiply by the transformation matrix for snapping and mouse
position.

You can test with the LOD400 model in #7566. On my machine it would
cause lag on anything with >500 faces. Now it seems to work without lag
on a 26k polygon mesh.
@Moult
Copy link
Contributor

Moult commented Feb 11, 2026

The regression seems to have existed prior to the optimisation in e55955b. I had noticed it at the time but didn't have the time to address. I think this is something best for @brunoperdigao to check.

@brunoperdigao brunoperdigao self-requested a review February 12, 2026 01:33
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.

2 participants