feat(studio): 三维视图接入产品(阶段 4:界面、生命周期与记录隔离)
- What: `Scene3DView` 装配(widget/相机/渲染器/合成器/协调器/适配器),`asset_source` 只查找并后台加载已编译的 `.oryscene` 包,`scene3d/prefs` 持久化并**修复**显示设置, `ui/mesh3d_panel` 用真实容器替换占位标签(无 GL/无包/包被拒/传感器不匹配各显示一行原因), `main.py` 在 `QApplication` 之前选定 GL profile,`app_window` 接线:3D 作为采集线程上的 第二个 sink、`_on_run_tick` 驱动 `tick()`、视图切换与 `closeEvent` 释放、preferences 落盘。 - Why: 阶段 4 的验收要求"三维开关不影响采集/记录/力曲线",并把阶段 1 留下的 "开/关三维 CSV 一致"这条补上;同时把"没有 context"从"看起来像在工作"变成可显示的终态。 - Verification: app 侧 test_scene3d_view 28 项、test_scene3d_gl_smoke 14 项(真实 GPU)、 adapters 17 项、skeleton 4 项、stage1 24 项、coordinator 13 项、ui_smoke 86 项; shared 侧 contract 26 / assets 33 / package 19 / live 25;`ui_check.py` 566 项检查 0 失败 (新增 "3D pane" 段 12 项);`locale_check.py` 302 个字面 key 0 缺失、中英各 377 key 对齐; 记录隔离:同一 96 帧会话挂/不挂 3D 消费者,`forces.csv` 逐字节相同、有效样本数与记录问题数相同; 生产者预算:合成器放慢到 50 ms 时 `submit_packet` p99 < 1 ms。 - Not in this change: 示意位移(`displacement_sensor_m`)仍未接入(需 SDK lift 与已确认尺度); ARM 板卡适配(按用户要求暂缓);包签名/AES-GCM 与长时性能报告(阶段 5); 仓库中仍未提供 `.oryscene` 包(发布产物,且其单位与变换必须由人声明)。
This commit is contained in:
@@ -21,6 +21,35 @@ from orisys_studio.app_window import StudioMainWindow
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
#: The GL profiles the 3D view can be started with. One per process: the surface
|
||||
#: format is a start-up decision, so it is read from the preferences here rather
|
||||
#: than switched at runtime (design document §11.1).
|
||||
GL_PROFILES = ("desktop33", "gles30")
|
||||
DEFAULT_GL_PROFILE = "desktop33"
|
||||
|
||||
|
||||
def _configure_gl(prefs: dict) -> str:
|
||||
"""Select the default GL surface format. Must run before ``QApplication``.
|
||||
|
||||
Optional and failure-tolerant on purpose: a machine without PyOpenGL, or with a
|
||||
preference that names a profile this build does not know, still gets the whole
|
||||
two-dimensional application. The 3D pane reports its own state; a start-up that
|
||||
refused to run because a picture might not appear would be the worse bug.
|
||||
"""
|
||||
profile = str(prefs.get("gl_profile") or DEFAULT_GL_PROFILE)
|
||||
if profile not in GL_PROFILES:
|
||||
logger.warning("Unknown gl_profile %r; using %s", profile, DEFAULT_GL_PROFILE)
|
||||
profile = DEFAULT_GL_PROFILE
|
||||
try:
|
||||
from orisys_studio.scene3d.gl_backend import configure_surface_format
|
||||
|
||||
configure_surface_format(profile) # type: ignore[arg-type]
|
||||
except Exception: # noqa: BLE001 - 3D is optional, the window is not
|
||||
logger.exception("Could not configure the OpenGL surface format")
|
||||
return profile
|
||||
logger.info("OpenGL surface format requested: profile=%s", profile)
|
||||
return profile
|
||||
|
||||
|
||||
def main() -> int:
|
||||
init_logging("orisys-studio")
|
||||
@@ -41,6 +70,7 @@ def main() -> int:
|
||||
language = str(prefs.get("language") or "zh_CN")
|
||||
theme = str(prefs.get("theme") or "dark")
|
||||
set_locale(language)
|
||||
gl_profile = _configure_gl(prefs)
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
app.setApplicationName("Orisys Studio")
|
||||
@@ -49,7 +79,12 @@ def main() -> int:
|
||||
|
||||
window = StudioMainWindow(prefs=prefs)
|
||||
window.show()
|
||||
logger.info("Studio shell started (theme=%s, language=%s)", theme, language)
|
||||
logger.info(
|
||||
"Studio shell started (theme=%s, language=%s, gl_profile=%s)",
|
||||
theme,
|
||||
language,
|
||||
gl_profile,
|
||||
)
|
||||
code = int(app.exec_())
|
||||
|
||||
# Leave the process immediately.
|
||||
|
||||
Reference in New Issue
Block a user