fix(ui): smooth B-spline section/waterline curves + 3D ready-signal sync
- viewer_3d.py: add `ready` Signal emitted once QtInteractor finishes init - main_window.py: connect ready signal to sync active hull into 3D viewer on startup - viewer_lines.py: add _smooth_pts helper; replace straight polylines in BodyPlanViewer and PlanViewer CAPA 3 with B-spline interpolated curves (80 sample points) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -841,6 +841,7 @@ class MainWindow(QMainWindow):
|
||||
from arshipdesign.ui.widgets.viewer_3d import Viewer3DWidget, _PYVISTA_OK
|
||||
if _PYVISTA_OK:
|
||||
self._viewer_3d = Viewer3DWidget()
|
||||
self._viewer_3d.ready.connect(self._on_3d_viewer_ready)
|
||||
vp = self._module_area.four_viewport.viewport("perspective")
|
||||
if vp is not None:
|
||||
vp.set_canvas(self._viewer_3d)
|
||||
@@ -1357,6 +1358,15 @@ class MainWindow(QMainWindow):
|
||||
self._load_hull_viewers(hull, _skip_offsets_editor=True)
|
||||
self.statusBar().showMessage(f"Offsets actualizados — {hull.name}")
|
||||
|
||||
def _on_3d_viewer_ready(self) -> None:
|
||||
"""El plotter 3D terminó de inicializarse — sincronizar con el casco activo."""
|
||||
if self._current_hull is not None and self._viewer_3d is not None:
|
||||
try:
|
||||
self._current_hull.invalidate()
|
||||
self._viewer_3d.load_hull(self._current_hull)
|
||||
except Exception as exc:
|
||||
logger.warning("Error al sincronizar 3D tras init: %s", exc)
|
||||
|
||||
def _on_offsets_edited_from_viewer(self, offsets_table) -> None:
|
||||
"""Slot: fin del drag — persistir + actualizar 3D + hidrostáticos.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user