为二维与三维深度色标增加每帧自适应选项。
默认仍锁定本会话首帧,勾选后两视图按当前帧有效深度共用同一范围。已用深度色标与显示设置测试验证。
This commit is contained in:
@@ -383,11 +383,17 @@ class ArrowPanel(QFrame):
|
||||
self._theme = str(theme)
|
||||
self.colorbar.set_theme(self._theme)
|
||||
|
||||
def set_depth_scale(self, text: str | None) -> None:
|
||||
"""Show the fixed depth colour-scale range (``None`` hides it)."""
|
||||
def set_depth_scale(
|
||||
self, text: str | None, *, tip_key: str = "panels.depth_scale_tip"
|
||||
) -> None:
|
||||
"""Show the depth colour-scale range (``None`` hides it).
|
||||
|
||||
``tip_key`` names which rule produced the numbers: the session latch, the
|
||||
per-frame adaptive bar, or typed fixed bounds.
|
||||
"""
|
||||
self._depth_scale_text = str(text or "")
|
||||
self.depth_scale_label.setText(self._depth_scale_text)
|
||||
self.depth_scale_label.setToolTip(t("panels.depth_scale_tip"))
|
||||
self.depth_scale_label.setToolTip(t(tip_key))
|
||||
self._refresh_footer_visibility()
|
||||
|
||||
def _refresh_scale_label(self) -> None:
|
||||
|
||||
@@ -114,7 +114,7 @@ class Mesh3dPanel(QFrame):
|
||||
#: The session's island latch, shared with the 2D canvas (see
|
||||
#: ``set_domain_latch``). Held until the view exists.
|
||||
self._domain_latch = None
|
||||
#: The 2D canvas's latched depth colour span (see ``set_shared_depth_scale``).
|
||||
#: The 2D canvas's latched depth colour span, held until the view exists.
|
||||
self._shared_depth_scale: tuple[float, float] | None = None
|
||||
|
||||
# Reserve this top-level window's native handle *now*, before the window is
|
||||
@@ -230,10 +230,25 @@ class Mesh3dPanel(QFrame):
|
||||
self._view.set_theme(self._theme)
|
||||
|
||||
def set_shared_depth_scale(self, span: tuple[float, float] | None) -> None:
|
||||
"""Share the 2D depth colour span with the 3D surface (and hold it until built)."""
|
||||
self._shared_depth_scale = None if span is None else (float(span[0]), float(span[1]))
|
||||
"""Share the 2D canvas's latched depth colour span with the 3D surface.
|
||||
|
||||
Held until the view exists, the same way the island latch is: the view is
|
||||
built on first use, and a span decided before then still has to colour the
|
||||
first depth frame.
|
||||
"""
|
||||
normalized: tuple[float, float] | None
|
||||
if span is None:
|
||||
normalized = None
|
||||
else:
|
||||
normalized = (float(span[0]), float(span[1]))
|
||||
if normalized == self._shared_depth_scale:
|
||||
return
|
||||
self._shared_depth_scale = normalized
|
||||
if self._view is not None and hasattr(self._view, "set_shared_depth_scale"):
|
||||
self._view.set_shared_depth_scale(self._shared_depth_scale)
|
||||
self._view.set_shared_depth_scale(normalized)
|
||||
|
||||
def shared_depth_scale(self) -> tuple[float, float] | None:
|
||||
return self._shared_depth_scale
|
||||
|
||||
def set_domain_latch(self, latch) -> None:
|
||||
"""Share the 2D canvas's island latch with the 3D pane (see ``Scene3DView``).
|
||||
@@ -329,7 +344,7 @@ class Mesh3dPanel(QFrame):
|
||||
view.set_theme(self._theme)
|
||||
if self._domain_latch is not None and hasattr(view, "set_domain_latch"):
|
||||
view.set_domain_latch(self._domain_latch)
|
||||
if hasattr(view, "set_shared_depth_scale"):
|
||||
if self._shared_depth_scale is not None and hasattr(view, "set_shared_depth_scale"):
|
||||
view.set_shared_depth_scale(self._shared_depth_scale)
|
||||
if self._pending_settings is not None:
|
||||
view.restore_settings(self._pending_settings)
|
||||
|
||||
Reference in New Issue
Block a user