mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 09:32:37 +00:00
a4a806147db47d297ebdf6dd03571d019511142f
22 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4962e3256d |
Promote idle-row icons into the slot system
The toggle_openings icon lived outside the IconSlot layout — each host (wall, roof) declared an ad-hoc setup_pen_row_toggle_openings_icon + update_pen_row_toggle_openings_icon pair, and GizmoArrayEdition queried a hardcoded _FEATURE_IDLE_MAX_X dict to position past it. On an arrayed wall the dict was shadowed: find_for_element returns "array" before "wall" in EDIT_TYPES order, the wall reservation was never consulted, and the first per-layer ARRAY icon (local X=0.37) landed 13cm from the wall's toggle_openings (X=0.50) — visually on top of each other. Promote idle-row icons into the slot system instead of patching the dict: * IconSlot gains an Optional visible_when predicate for state-driven visibility (toggle_openings only when the host carries openings). * BaseParametricGizmoGroup gains idle_slots: ClassVar[tuple[IconSlot]] + _idle_slot_x_positions() + _idle_row_right_edge() helpers; the setup + idle-branch positioning loops mirror the existing feature_slots path. * Wall and roof declare toggle_openings as an idle_slot and drop their ad-hoc setup/update calls. * GizmoArrayEdition's _resolve_feature_idle_max_x walks BaseParametricGizmoGroup.REGISTRY and takes the max _idle_row_right_edge() across peers whose poll passes — no more hardcoded dict, no more find_for_element-order shadowing. * setup_pen_row_toggle_openings_icon + update_pen_row_toggle_openings_icon helpers deleted from drawing/gizmos.py. * 3 forward-compat AST guards pin the new contract. Also bundles an unrelated array-test fix: TestUsingArrays in test/tool/test_model.py was asserting against bpy.context.selected_objects which is a fragile signal after remove_array / apply_array. A new _array_objects() helper filters bpy.data.objects via the BIM_Array pset's IfcActuator type instead. Layout on an arrayed wall after the fix: pen X = 0.00 toggle X = 0.50 (idle_slot 0) array[0] X = 0.87 (one ICON_ARRAY_GAP past idle row) array[1] X = 1.27 All separated by the standard inter-icon spacing. Generated with the assistance of an AI coding tool. |
||
|
|
25651a1507 |
Fix demo preset crash + scope header refresh
bpy.ops.bim.new_project(preset='demo') crashed in refresh_bim_tool_headers: the post-commit hook fired for every nested bpy.ops.bim.append_library_element during template loading, and the operator context Blender hands to programmatically-invoked nested operators is stripped of the view-layer attributes the refresh reads. Two changes resolve it. Gate the header refresh in tool.Parametric.refresh_post_commit on operator.bl_idname being one of the EDIT_TYPES finish_op idnames. Only validate-gizmo commits (bim.finish_editing_<name>) now trigger the refresh; demo-loader and other non-edit operators skip it. Querying the registry directly is the canonical signal — string-prefix matching would silently drift if ParametricObject.finish_op changes derivation. Harden tool.Blender.get_active_object so its view_layer fallback also uses getattr; the 150+ callers routed through it now tolerate stripped contexts. _resolve_bim_tool_context applies the same defensive pattern to mode / workspace. Tests: - test_handler_restricted_context covers get_active_object's defensive path and the BimTool-family whitelist (excludes annotation, spatial, structural). - test_handler_forward_compat AST-pins that the gate consults EDIT_TYPES (not a string prefix). - test_wall_header_refresh rewritten — three tests cover the gated-by-registry contract: counter bumps for every commit, finish_op operators refresh headers, others don't. Hotkey-driven in-place edits (S_E / C_E) no longer trigger the refresh — they were caught by the pre-refactor "every commit" design. Left out of scope; the new skip-non-finish test pins this as intentional. Generated with the assistance of an AI coding tool. |
||
|
|
de4c394b50 |
Add host-wall offset gizmos for door/window edit
When entering parametric edit on a door or window that fills a wall opening, four dimension gizmos now measure the distances from the wall edges to the filling's jambs and from the wall's base/top to the sill/header. Dragging any gizmo translates the filling along the wall's local axis; 180°-flipped fillings and slanted LAYER2 walls round-trip correctly. The has_host_wall predicate hides all four when the filling → opening → wall chain cannot be resolved. Generated with the assistance of an AI coding tool. |
||
|
|
99bb1e30ad |
Generalise opening gizmos + DRY toolbar plumbing
Add openings — GizmoWallAddOpening only fired when a wall was active + co-selected with a non-host; slabs and roofs got no in-viewport handle. GizmoHostAddOpening covers all three host types via is_supported_host, dispatching walls to the axis-projection anchor and slabs/roofs to a world-Z anchor lifted just above the host's top face (predictable height regardless of the void's vertical position). Show openings on hosts with their own parametric-edit toolbar — GizmoRoofEdition gains an idle-row toggle_openings_gizmo parallel to the wall's, parked at the cancel-slot X next to the pen. Visible only when the host carries HasOpenings and the edit triad is idle. Roof overrides get_element_height to return the mesh's world-AABB top in object-local Z, so the WHOLE pen-row anchors visibly above sloped or stepped roof bodies. The wall's idle-row toggle now also hides when HasOpenings is empty. Show openings on hosts WITHOUT a parametric-edit toolbar — GizmoHostToggleOpenings scoped strictly to the fallback case: a single host selected, HasOpenings non-empty, NOT a path-connectable wall, NOT a parametric roof. Covers slabs today plus any foreign-authored IfcRoof without BBIM_Roof. Anchored at object origin XY + world-AABB top Z. When slab parametric-edit eventually lands, the slab predicate joins the exclusion list and this gizmo's poll narrows automatically. Operator move — ToggleWallOpenings was already host-agnostic; renamed to ToggleHostOpenings in opening.py (bl_idname bim.toggle_host_openings). Three callers (the wall idle-row binding, GizmoWallFilletToggleOpenings, and workspace.py's hotkey_A_O for Alt+O) now route through the renamed operator. The Alt+O binding is surfaced in the operator's bl_description so it appears in F3 search and hover tooltips. DRY refactors — * GizmoWallAddOpening deleted (subsumed by GizmoHostAddOpening) * tool.Blender.get_object_world_bounding_box added as the world-AABB sibling of the existing local helper; 3 inline call sites in tool/misc.py (set_object_origin_to_bottom, scale_object_to_height) and gizmos.py adopt it (2 other sites in drawing/operator.py and project/operator.py inherently need raw transformed corners for per-corner plane / NDC tests — not AABB candidates) * BaseParametricGizmoGroup gains setup_pen_row_toggle_openings_icon + update_pen_row_toggle_openings_icon; wall + roof + any future host gizmo wire up the idle-row toggle with two one-line calls * _resolve_active_host shared poll prologue between the two host gizmos (gate + selection count + active-in-selected + entity lookup + supported-host check) * HasOpenings non-empty checks at 3 sites route through tool.Geometry.has_openings * hotkey_A_O body collapsed to bpy.ops.bim.toggle_host_openings() The forward-compat AST guard pinning "must accept fillet-corner walls" retargets from GizmoWallAddOpening.poll to is_supported_host. Generated with the assistance of an AI coding tool. |
||
|
|
ed7b2fc233 |
Stack wall-join trio along screen-up + L/T glyphs
GizmoWallJoinIntersection used to place its icons at state-specific world points: join at floor Z, extend-to-wall at the active wall's top Z, fillet stacked screen-up above join. Same XY at different Z collapses to a single screen pixel in plan / top view, so two icons became one hit target — invisible from above. * position_gizmos now always-stacks along screen-up at a wall-top anchor in both the joined (unjoin + fillet) and the intersecting (extend + join + fillet) states. Order bottom-up is extend / L / fillet. Collinear-merge keeps its single boundary icon (no stack needed). * New _stack_anchor_z picks the active wall's top Z (or the taller of the two on mid-selection-transition frames). New _stack_at lays a tuple of icons along screen-up at the resolved anchor. * Glyph swap: join_icon -> VIEW3D_GT_wall_corner (L), extend_to_wall_icon -> VIEW3D_GT_wall_tee (T). Both classes already existed in bim/module/drawing/gizmos.py from an earlier commit; only the setup() bl_idname strings changed. The previous arrow-merge / arrow-extend pair read as the same direction once stacked. Forward-compat AST contracts in test_wall_gizmos_forward_compat.py pin the new invariants: the L and T bl_idnames must appear in setup(), and position_gizmos must route through _stack_at so a regression that reintroduces a direct billboarded_at write for any state-specific icon fails CI before it flattens the stack again. Also folds in a one-line typo fix in core/spatial.py: assign_container's per-element can_contain check iterated `e` but predicate-tested `root_element` (the outer for-loop variable), so every element in the comprehension was tested against the same container/element pair. Switch the argument to `e`. Generated with the assistance of an AI coding tool. |
||
|
|
ac11044261 |
Add GizmoRoofEdition + fix low-slope normals + cancel restore
Ports roof parametric edit gizmo group from gizmos-8088 and folds in
three roof-mesh bug fixes surfaced during live testing.
Port:
* ``CycleRoofGenerationMethod`` operator (bim.cycle_roof_generation_method)
cycles props.generation_method between "HEIGHT" and "ANGLE". Shift+click
cycles in reverse via the ``CycleTypeMixin`` contract.
* ``GizmoRoofEdition`` gizmo group: 3 dimension gizmos for height
(visible in HEIGHT mode) / slope angle with tan/atan2 rise round-trip
+ degree formatter (ANGLE mode) / roof_thickness. All three handles
anchor at the object's local origin and separate visually via their
declared axes (height/slope +Z, thickness -Z) — height + slope are
mutually exclusive via ``visibility_condition`` so they never paint
at the same time. Anchoring at the origin sidesteps the first-click
default-identity-matrix symptom that footprint-derived anchoring
would have hit on a stale ``RoofData`` cache.
* Lifecycle factory swap: explicit ``EnableEditingRoof / CancelEditingRoof
/ FinishEditingRoof`` classes replaced by ``tool.Parametric.build_edit_lifecycle("roof", _RoofEditMixin, ...)``.
Same bl_idnames out, no external caller changes.
* Registration: ``CycleRoofGenerationMethod`` + ``GizmoRoofEdition``
added to ``bim/module/model/__init__.py`` classes tuple.
* Tests: ``test_roof_gizmos.py`` covering slope round-trip, visibility
gates, cycle operator metadata, and origin-anchored positioning.
Bug fixes:
* ``generate_hipped_roof_bmesh`` flipped the bottom slab face's normal
at low slope angles. The kernel's outward-inference becomes
ambiguous on near-flat geometry once ``remove_doubles`` and
internal-face deletion run, and the early ``recalc_face_normals``
pass at line 389 ran BEFORE the topology was final. A second pass
on the final closed mesh fixes the eave plane (now reliably points
down regardless of slope).
* ``bpypolyskel.polygonize`` can emit a face whose vertex list
contains the same index twice on certain footprint/slope
combinations (a straight-skeleton ridge collapse). ``bm.faces.new``
rejects those with ``found the same (BMVert) used multiple times``,
aborting the whole rebuild. Filter the degenerate faces out so the
rest of the roof renders.
* ``_RoofEditMixin._restore_viewport_after_cancel`` now rebuilds the
bmesh from the just-restored draft via ``update_roof_modifier_bmesh``.
The hook was abstract on ``PathPreservingEditMixin`` and raised
``NotImplementedError`` on cancel-after-edit, leaving the user
stranded.
Also folds in a parallel ``tool/loader.py`` swap from
``tool.Blender.Modifier.is_railing`` to ``tool.Parametric.is_railing``
(consistent with the rest of the loader using ``tool.Parametric.*``).
Verified: headless smoke green, test_parametric_registry.py 8/8,
test_roof_gizmos.py 15/15. ruff + black clean on the touched files.
Generated with the assistance of an AI coding tool.
|
||
|
|
ab9152e32d |
Fix fillet preview crash + surface openings on fillet walls
Three wall-gizmo fixes: * GizmoWallFilletPreview crashed on every draw_prepare after the DRY-colors refactor moved decoration lookups onto self.get_decoration_colors() — that method lives on BillboardingGizmoGroupMixin / BaseParametricGizmoGroup, but GizmoWallFilletPreview inherited only from bpy.types.GizmoGroup. setup() AttributeError'd silently, leaving radius_dim and friends unset. Add the mixin to the bases; rename _position_gizmos to position_gizmos so the mixin's refresh/draw_prepare dispatch lands correctly and drop the now-redundant overrides. * GizmoWallAddOpening's poll gated on the strict is_wall predicate, which rejects fillet-corner walls (no LAYER2 usage by IFC spec). Switch to is_path_connectable_wall on both the active and the partner-exclusion checks so the add-opening icon surfaces over curved corners — matching every other wall-state gizmo's host gate. * Show / hide openings was only available on LAYER2 walls because GizmoWallEdition's parametric edit pipeline (which carries the toggle) refuses fillet bodies. Add GizmoWallFilletToggleOpenings, a dedicated single-icon group that polls on is_fillet_corner_wall and reuses bim.toggle_wall_openings — the body stays untouched. Forward-compat AST guards in test_wall_gizmos_forward_compat.py pin both invariants: every wall GizmoGroup that calls self.get_decoration_colors() must inherit a mixin that provides it, and GizmoWallAddOpening.poll must keep using the looser predicate. Generated with the assistance of an AI coding tool. |
||
|
|
ba6cfe9c24 |
Fix door swing arcs + declarative SwingArcConfig
The recent per-gizmo-prefs cleanup left ``update_swing_gizmos`` with a stale ``prefs`` reference that raised NameError mid-refresh, so the flip arc's ``matrix_basis`` was never reassigned and the gizmo drifted to the world origin. SINGLE_SWING_RIGHT also lacked an X-mirror on the primary arc, so the swing extended past the door's right edge instead of sweeping back over the panel. Five related fixes / additions: * Drop the leftover ``prefs.decorations_colour[:3]`` per-frame colour override (the setup-time ``decorator_color_special`` is the durable contract — there's no reason to overwrite it every refresh). * Add X-mirror to RIGHT-hinged single-panel transforms so the arc sweeps back over the door rather than past the right edge. * Treat DOUBLE_DOOR_SINGLE_SWING as a two-panel layout: 4 arcs total (left + right panels, each with its own Y-mirrored flip) scaled to ``overall_width / 2``. * Hide all swing arcs for SLIDING_TO_LEFT / SLIDING_TO_RIGHT / DOUBLE_DOOR_SLIDING — sliding doors don't swing. A slide-direction indicator is deferred to a separate change. * Pin ``select_bias = -1000.0`` on every arc gizmo so the big quarter-arc hit shapes don't steal clicks from the smaller dimension and edit gizmos drawn on top. Architectural cleanup driven by the same diff: the imperative 4-create + 50-line update block is replaced by a declarative ``swing_arc_props`` list of ``SwingArcConfig`` entries (mirrors the existing ``dimension_gizmo_props`` pattern). Setup iterates the list and creates one (main, flip) pair per entry under ``gizmo_swing_arc_<name>`` / ``gizmo_swing_arc_<name>_flip``; update iterates the same list and positions each pair via the lambdas. Adding a hypothetical multi-panel variant becomes a config entry rather than two more attribute names plus a transform branch. ``ToggleDoorSwing`` gets a ``description`` classmethod that returns user-facing wording per ``flip_geometry`` branch so the tooltip on hover stops reading like operator internals. ``test/bim/module/model/test_door_gizmos.py`` (new) pins the per-door-type contract: 11 cases covering LEFT / RIGHT hinge positions, DOUBLE_SWING parity with SINGLE_SWING, DOUBLE_DOOR 4-arc layout, the sliding-types hide invariant, ``is_editing=False`` hide invariant, flip-arc matrix re-assignment, and world-matrix pre-multiplication. Verified: ``pytest test/bim/module/model/test_door_gizmos.py`` 11/11 green; combined wall + stair + door gizmo lanes 37/37 green; ruff + black clean on the three touched files. Generated with the assistance of an AI coding tool. |
||
|
|
b154cadf3b |
Add IconSlot placeholders + stair xN tread label
Add a clickable "xN" badge to GizmoStairEdition's edit row, mirroring the array's popup-input UX: click opens a number dialog (no more shift+click-into-modal). Text-only — no 2x2 grid glyph. Structural changes that enable this cleanly: * IconSlot.placeholder=True: slots reserve an X position in the row without auto-creating a gizmo. Subclasses resolve the reserved X via _slot_x_positions()[name] to place their own dynamic gizmos. Drops the brittle "remember to add extra_gap_before" workaround that would silently rot on slot reorders. * Array bug fix: the count badge collided with the "-" icon because the slot manager placed count_minus at the cycle position (X=0.87) where ICON_NUMBER_X also lives. Migrating the badge to a placeholder slot lets the manager allocate the X naturally and the "-" no longer overlaps. ICON_NUMBER_X constant removed. * IntegerInputDialogMixin in parametric_lifecycle.py: extracts the popup-dialog plumbing shared between InputArrayCount and the new InputStairTreads. Subclasses declare an IntProperty + attr_name + props_getter; the mixin owns invoke/execute. _resolve_props helper factors the common obj/props/requires_editing prologue. Tests: BIM_GT_count_label registration; IconSlot placeholder contract (no gizmo_idname required; gizmo_attrs() returns empty); the stair edit-row slot layout reserves the label position between tread_lock and plus at one ICON_ARRAY_GAP each; visibility propagates from props.is_editing. Partly generated with the assistance of an AI coding tool. |
||
|
|
1ba9341201 |
Drop per-gizmo preferences + fix dynamic-wall face normals + DRY colors
Three related cleanups in one pass: * **Per-gizmo preferences removed.** The ``visibility_pref`` field on IconSlot, the ``prefs.gizmos.<feature>.<icon>`` PropertyGroups, and the dispatcher that surfaced them in the addon preferences UI are all gone. ``update_gizmo_visibility`` loses its ``pref_enabled`` parameter — visibility is now driven purely by editing state and modal gating. bim/ui.py drops ~257 lines of dead PropertyGroup definitions; bim/__init__.py and tool/parametric.py shed their matching wiring; door / wall slot declarations stop referencing the now-nonexistent prefs. * **Dynamic-wall face normals fixed.** ``regenerate_wall_mesh_from_props`` in wall.py now calls ``bmesh.ops.recalc_face_normals`` before writing the mesh. Without it, walls regenerated from the parametric edit draft could ship with inward-facing normals on some faces, which rendered as visual holes under any backface-cull or normal-aware shading. ``test/bim/module/model/test_wall_preview_mesh.py`` pins the invariant (every face's normal points away from the wall centre). * **Color constants DRY.** ``COLOR_RED`` / ``COLOR_GREEN`` / ``COLOR_BLUE`` / ``COLOR_NEUTRAL`` now live at module scope in gizmos.py; the BaseParametricGizmoGroup class attributes alias the same tuples so ``self.COLOR_GREEN`` keeps working. IconSlot declarations in stair.py (plus / minus) and array.py (count_minus / count_plus / delete) now reference the named constants instead of duplicating the RGB tuples inline. Verified: headless smoke green at 1267 BIM_OT_ classes, test_parametric_registry.py 8/8, wall lane 31/31 (includes the new preview-mesh test). ruff + black clean on the touched files. Generated with the assistance of an AI coding tool. |
||
|
|
f0aec7b38e |
Highlight partner wall on link-toggle hover
Hovering a wall-junction link-toggle icon today only swaps the icon shape — the user doesn't see which wall the click will disconnect from until after they click. ATPATH (T-junction) configurations especially make the partner ambiguous when multiple connections sit close together. On hover, paint a wireframe bbox around the partner wall using the same shader, constants and color the array module already established for its layer-children highlight (POLYLINE_UNIFORM_COLOR, decorator_color_special, line width 1.8, alpha 0.8). The line-width / alpha constants in decorator.py are renamed from _ARRAY_LAYER_BBOX_LINE_* to _BBOX_HIGHLIGHT_LINE_* and shared between draw_array_layer_children_bbox and the new draw_wall_partner_bbox so the two highlights stay in lockstep. The trigger lives in a new GizmoWallLinkToggle subclass in wall.py which keeps the base gizmos.GizmoLinkToggle generic (per the generic-naming convention for shared widgets). The subclass's draw() calls super().draw(context) then on self.is_highlight outlines its partner_obj via the shared decorator helper. Same trigger pattern as GizmoArrayLayerIndicator. Blender's Gizmo API exposes target_set_operator but no symmetric getter, so the partner reference can't be read back from the bound operator handle. Instead GizmoWallUnjoinSingle.position_gizmos mirrors the resolved partner_obj onto each visible icon every frame next to the existing other_wall_guid write — the icon's draw() reads from its own __slots__-declared attribute. A forward-compat AST test pins the contract: GizmoWallLinkToggle.draw must reference is_highlight and call draw_wall_partner_bbox. Catches the regression where someone tidies the draw() override into super() or replaces the shared helper with an ad-hoc draw call. Generated with the assistance of an AI coding tool. |
||
|
|
de29d12b00 |
Fix fillet partner missing from wall unjoin gizmo
GizmoWallUnjoinSingle.poll accepts fillet-corner walls via the looser tool.Parametric.is_path_connectable_wall predicate (fillet corners have no LAYER2 usage by IFC spec, but they still participate in IfcRelConnectsPathElements). The partner filter inside _iter_path_connections used the stricter tool.Blender.Modifier.is_wall (LAYER2-only), so adjacent LAYER2 walls silently dropped their fillet-corner partners from the connection list — the unjoin icon appeared when the fillet wall itself was selected but not on either of its LAYER2 neighbours. Switch the partner filter to is_path_connectable_wall so host and partner predicates match. Add a regression test for the fillet case and an AST forward-compat guard pinning the predicate symbol so a future "tidy the imports" can't silently re-introduce the asymmetry. Generated with the assistance of an AI coding tool. |
||
|
|
a3f92eb427 |
Merge pull request #8133 from Gorgious56/bonsai/parametric-framework-features
Bonsai/parametric framework features |
||
|
|
453e6dc1cc |
Add behaviour-contract tests for PR4 surfaces
Three test files covering PR4's new surfaces — preview registry,
wall-gizmo poll behaviour, fillet operator registration. Every test
walks the live registry or class hierarchy instead of hard-coding
preview keys, operator names, or helper function names, so adding a
new preview / wall gizmo group / fillet operator exercises the same
invariants without test edits.
test_preview_base.py (6 tests):
* RegistryContract: every PREVIEW_CANCEL_OPS entry resolves to a
callable cancel operator on bpy.ops.bim.
* GetPreviewPropsTolerance: get_preview_props returns None for
contexts without a scene (regression guard for the SimpleNamespace
bug fixed in commit
|
||
|
|
ee63137c6c |
Discard previews on IFC save + harden preview-active gate
Save-path:
* SaveProject._execute (project/operator.py) now calls
preview_base.discard_pending_previews(context.scene) right after
tool.Parametric.commit_pending_edits(). Previews are session-
transient — discard rather than commit. Sibling gizmo polls gate
on each preview's is_active flag; a stuck flag persisted through
the save would silently hide them on reload. Mirrors the pattern
already in gizmos-8088.
Preview-active gate hardening:
* preview_base.get_preview_props tolerates contexts without a
``scene`` attribute. Pre-existing tests use SimpleNamespace mocks
for the context; the previous getattr(context.scene, ...) raised
AttributeError before the inner default kicked in.
Test update:
* test_wall_header_refresh.test_geom_generation_invalidates_wall_geom_cache
patches tool.Wall.read_geometry instead of the now-deleted local
wall._read_wall_geometry (commit
|
||
|
|
97e8deb069 |
Cache opening previews + dissolve fill
DecorationsHandler now caches dissolved edges (mesh-keyed), world-space draw payload, and GPUBatch objects with per-object epoch invalidation — moving one wall doesn't wipe 50 opening caches. Object-mode dissolve removes triangulation noise; 2-pass depth-test split dims occluded lines instead of hiding them. Edit-mode behavior unchanged. Also: disable viewport shadows for IfcFeatureElementSubtraction objects, and wire DecorationsHandler.uninstall() into the model module's unregister() so the new persistent handlers don't leak on addon disable. Generated with the assistance of an AI coding tool. |
||
|
|
70845e4dd4 |
Add wall path-connection inverse-walk helpers
The single-wall unjoin gizmo needs to enumerate every IfcRelConnectsPathElements a wall participates in, regardless of which side of the rel the wall was authored on, and place an icon at each join's physical location. Two helpers carry that work: _path_connection_location_world wraps core.compute_path_connection_location at the Vector boundary. _iter_path_connections walks ConnectedTo + ConnectedFrom, normalises orientation to (other, self_ct, other_ct), and filters non-wall partners + None refs so per-frame gizmo positioning survives malformed IFC. Generated with the assistance of an AI coding tool. |
||
|
|
cb2f20b2b6 |
Add tests for decorator_cache + undo-resync dispatch
Two paired test files for the framework infrastructure landed earlier in this PR. test_decorator_cache.py (11 tests): * The 4-hook invalidation list (depsgraph_update_post + undo_post + redo_post + load_post) is symmetrically managed by install_decorator_cache_handlers / uninstall_decorator_cache_handlers. A future edit that drops a hook from one side without the other would land as a Blender segfault when a cached bpy.types.Object ref outlives its underlying ID block — the regression must surface as a test failure first. * install is idempotent (calling twice doesn't double-register). * uninstall when not installed doesn't raise. * The bump handler accepts Blender's variadic args. * The depsgraph predicate gates correctly: bumps on Object geometry or transform updates, silently skips on Material / NodeTree / Image updates (which would otherwise rebuild every cache on every node edit). * TokenCache.get_or_compute short-circuits on key+token match and recomputes when the token bumps. test_undo_resync_parametric_drafts.py (3 tests): * UNDO_REGENERATORS keys must all be in tool.Parametric.EDIT_TYPES. A typo would silently no-op on Ctrl+Z, restoring the desync the helper is meant to prevent. * The dispatcher skips objects with no active parametric edit (undo_post fires for every undo, most of which touch zero drafts). * The dispatcher silently skips parametric types that have no UNDO_REGENERATORS entry (door / window / array are IFC-derived with no draft preview mesh — they don't need a regenerator). Mocks use spec=bpy.types.Depsgraph / spec=bpy.types.DepsgraphUpdate / spec=tool.parametric.ParametricObject so typos in mocked-attribute access fail loudly (CLAUDE.md test discipline). Generated with the assistance of an AI coding tool. |
||
|
|
1855e4c019 |
Fix wall split: keep straddling openings on both walls
DumbWallJoiner.split assigned openings by projecting the opening's centre-point onto the wall axis, so any opening whose footprint straddled the cut was silently dropped from whichever wall its centre missed. Now the full axis-projected extent (via ifcopenshell.geom. create_shape) drives the assignment; for filled openings whose void straddles the cut, a pure-void copy is added back to the neighbour wall so its body is also cut. Generated with the assistance of an AI coding tool. |
||
|
|
b3f482e0fa |
Defer mathutils imports in stair gizmo tests
Aligns with the test/bim/ convention: heavy imports go inside test functions so the autouse _require_real_bpy fixture skips cleanly when bpy is mocked, rather than module-level imports failing at collection time and erroring out the whole file. Generated with the assistance of an AI coding tool. |
||
|
|
f582d0230c |
Fix set_icon_gizmo_position so billboard ignores object rotation
set_icon_gizmo_position computed ``mw @ (Translation @ billboard_rot @ Scale)`` — the object's world matrix was applied AFTER the billboard rotation, so any non-trivial object rotation (e.g. a wall rotated in plan, a stair rotated to match a corridor) carried over into the icon's transform and tilted it edge-on to the camera instead of facing it. Switch to ``billboarded_at(world_pos, billboard_rot, scale)`` where ``world_pos = mw @ local_pos``: translate to world space first, then apply the billboard rotation independently of the object's rotation. This matches the manual pattern the base class's ``update_editing_gizmos`` already uses for validate/cancel/cycle for exactly this reason. Drops the now-stale workaround docstring on ``GizmoWallEdition._update_icon_row_extras`` that documented why it bypassed ``set_icon_gizmo_position`` — the helper does the right thing now. Adds ``test/bim/module/model/test_stair_gizmos.py`` as the regression guard: parametrised over six rotation angles, asserts that the rotation part of the resulting matrix equals ``billboard_rot`` (no contribution from ``mw``'s rotation) and that the translation lands at ``world_pos``. Also exercises ``set_icon_gizmo_position`` end-to-end via a stub gizmo to catch the exact shape of the previously-broken call site. Generated with the assistance of an AI coding tool. |
||
|
|
26eef20eb5 |
Add wall parametric editing and gizmos
Walls gain in-viewport parametric editing matching the door/window/stair
UX: drag handles for length, height, slope (x-angle), layer baseline
cycle, plus cursor-anchored quality-of-life operators (split at cursor,
extend to cursor, extend height, rotate 90, toggle openings) and
two-object state-machine gizmos (unjoin / merge / join-corner /
extend-to-wall / extend-vertically / add-opening).
Wall enters tool.Parametric.EDIT_TYPES, so save-time auto-commit,
GizmoPreferencesWall registration, and the in-progress-edit predicates
all light up automatically through the registry plumbing landed two
commits back.
The three-layer commit model (drag -> BIMWallProperties -> bmesh
preview -> Finish -> single ifc.run) means dragging a handle through
hundreds of intermediate values produces zero extra IFC entities. A
no-op enable->finish round-trip is byte-identical. The snapshot diff
in FinishEditingWall skips unchanged params.
_commit_active_wall_edit_if_any ensures cursor-anchored operators see
committed geometry, not the draft preview box.
Also lands the `prompt_auto_commit_parametric_edits` BoolProperty on
BIM_ADDON_preferences (consumed by the auto-commit dialog landed in
the framework commit) and refactors
`draw_{door,window,stair}_gizmo_parameters` into a shared
`_draw_parametric_gizmo_parameters` helper that the new
`draw_wall_gizmo_parameters` reuses. This commit and the framework
commit are stacked - the framework commit references the BoolProperty
defined here, so they must land together.
Tests cover pure math (core/test_model.py), DimensionGizmoConfig text
formatter, GizmoWallExtendVertically.poll() preconditions, and the
refresh_post_commit cache-invalidation regression. BDD scenarios in
model.feature cover the edit triad, auto-commit on save, and the
two-object gizmos. Documentation added to creating_walls.rst.
Generated with the assistance of an AI coding tool.
|