比较提交

..
作者 SHA1 备注 提交日期
mac c0e6f3be0a release: record verified 1.10.0 urgent UI article and accepted host delivery 2026-11-04 23:08:04 +08:00
mac 10a14a8c62 docs: prepare urgent UI article update with original dark and light screenshots 2026-11-04 23:04:39 +08:00
mac 6dd29caa3d docs: preserve new UI screenshots and generated emergency update cover 2026-11-04 23:02:40 +08:00
mac d7d33fd8c6 release: record signed notarized build72 package and urgent UI update notes 2026-11-04 22:51:21 +08:00
mac ade118e284 verify: accept physical curve undo LUT and live scope checks; clean old app copies 2026-11-04 22:42:24 +08:00
mac 201152d3e0 verify: record protected rollback copies while physical workspace checks are pending 2026-11-04 22:28:38 +08:00
mac cccc51ff7a verify: record notarized build72 and native layouts; preserve pending physical host checks 2026-11-04 22:26:29 +08:00
mac 80dec904be test: inspect the workspace close button without invoking its close action 2026-11-04 22:14:01 +08:00
mac b216cebc70 fix: clip remote workspace backgrounds so page controls remain visible; build72 2026-11-04 22:10:25 +08:00
mac 5cf4ba75b3 fix: validate LUT paths and verify independent layer writes after host commit 2026-11-04 22:00:35 +08:00
mac fe8b298c33 fix: preserve curve layer selection across frame gaps and keep canvas controls reachable; prepare 1.10.0 build71 2026-11-04 21:56:32 +08:00
mac 031c704f0f feat: add vertical canvas editors and host-owned scopes LUT workspace; boundary review in progress 2026-11-04 21:51:44 +08:00
mac 0dfb838b39 docs: preserve build70 package and specify canvas workspace redesign 2026-11-04 21:36:20 +08:00
mac 7f2cef5c58 verify: accept physical panel movement and tool switching; clean superseded app copies 2026-11-04 21:21:20 +08:00
mac 92a90e6b33 verify: record notarized movable viewer build70 and independent remote source recovery 2026-11-04 20:47:08 +08:00
mac 30d413dc42 fix: make the viewer panel movable and show all fourteen tools directly 2026-11-04 20:40:36 +08:00
mac 0597c8f4dd verify: record installed viewer candidate and remote recovery; await physical pointer acceptance 2026-11-04 19:58:43 +08:00
mac 0ab448d04f fix: anchor canvas controls within the host image viewport 2026-11-04 19:46:52 +08:00
mac cc037340bf feat: add native on-screen grading controls with isolated live parameter gestures 2026-11-04 19:36:25 +08:00
mac 61248ab9f5 docs: save baseline and scope for on-screen interaction migration 2026-11-04 19:16:45 +08:00
mac ac9180e47c verify: publish Release386 and finish two-mode recovery and cleanup 2026-11-04 14:43:38 +08:00
共修改 69 个文件,包含 2733 行新增和 77 行删除

没有与搜索条件相匹配的文件

+17
查看文件
@@ -0,0 +1,17 @@
大鱼调色 1.10.0(72)|紧急 UI 更新
- 画布工具改为纵向排列,可打开、移动、折叠或关闭多个工具面板。
- 曲线支持直接拖点及 RGB 通道切换,颜色分级提供四个画布色轮;保留精确参数视图。
- 新增画布外辅助工作区,集中查看当前效果输出的亮度波形、RGB 分列、直方图与风格1 LUT 预览。
- 曲线双轴与色轮参数在一次手势内共同提交并撤销;播放头、图层或颜色管理改变时中止过期写入。
695 项正式安装原生检查通过。Final Cut Pro 12.4 中的曲线拖点与一次撤销、LUT 预览、移动播放头后的示波器更新已通过实际鼠标验证。自绘示波器为 sRGB 显示参考,宿主分块输出时标注当前分块,不代替 HDR / IRE 精密测量。
支持 Apple Silicon,macOS 14.6 及以上。APP 与 PKG 已通过 Developer ID 签名、Apple 公证和票据验证。固定安装位置:/Library/Plug-Ins/FxPlug/大鱼调色.app。本次正式 APP 独立安装并验收,PKG 完成20项展开验包,未重复执行系统安装脚本。
安装包:大鱼调色-1.10.0.pkg
大小:43090565 字节
SHA-256:ee70461c9b2d2e0ddd78cbcb3371c3b1b36b7f0e5fc69bfccc7ac0f1a3e468d8
实际编译源码:80dec904bedf5f704b29d16325fa95d639f3a250
资源文章已先行更新:https://dayu.media/15792/ 。使用新的紧急UI更新封面及用户提供的深色/浅色实际截图,主安装包更新为本版;50元、有效会员免费及其它商业设置保持。
+20
查看文件
@@ -0,0 +1,20 @@
{
"title": "大鱼调色 1.10.0 公测版:紧急 UI 更新,画布工具与独立工作区",
"status": "publish",
"content": "<!-- wp:paragraph -->\n<p>大鱼调色 1.10.0 公测版是一款适用于 Final Cut Pro 与 Motion 的原生 FxPlug 4 调色插件。从素材色彩还原、基础调整,到 LUT 风格、胶片质感和局部蒙版,可直接在剪辑时间线里完成。</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>本篇下载售价为50元,站内有效会员免费。提供已签名、公证的完整 PKG 安装包,版本 1.10.0,构建 72。</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">1.10.0 紧急 UI 更新</h2>\n<!-- /wp:heading -->\n\n<!-- wp:paragraph -->\n<p>本次紧急更新重新安排了调色工具的位置:画布左侧使用纵向工具条,曲线、色轮等调整控件直接叠在画面中;示波器和 LUT 预览放进画布外的独立工作区。需要精确参数时,仍可使用右侧检查器。下方两张为新版实际界面,分别展示深色与浅色模式。</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:list -->\n<ul class=\"wp-block-list\"><li><strong>纵向工具条</strong>:从画布侧边切换工具,工具面板可以独立移动、折叠和关闭,也可同时打开多个工具。</li><li><strong>画布内调整</strong>:曲线支持直接添加、移动和删除控制点,并切换 RGB、红、绿、蓝通道;颜色分级提供直接调节的色轮。一次拖动作为一次操作,可用 ⌘Z 撤销。</li><li><strong>画布外工作区</strong>:通过“工作区 · 示波器 / LUT”打开,切换亮度波形、RGB 分列或直方图;“风格1 LUT”页使用当前画面预览 LUT,并明确应用到风格1。</li><li><strong>保留已有调色</strong>:原有调色参数和预设继续使用,深色、浅色模式均可切换。</li></ul>\n<!-- /wp:list -->\n\n<!-- wp:paragraph -->\n<p>工作区示波器用于 sRGB 显示参考,采样当前插件的处理输出,不包含其后的其他效果或宿主显示转换;它不替代 HDR/IRE 精密测量。宿主仅提供分块画面时,会标明当前分块。移动播放头后随新画面更新。</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>此版本已完成正式签名、公证及安装验证,并在 Final Cut Pro 中实测曲线拖点与一次撤销、LUT 预览、示波器随播放头更新。</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:image {\"id\":15840,\"sizeSlug\":\"full\",\"linkDestination\":\"none\"} -->\n<figure class=\"wp-block-image size-full\"><img src=\"https://dayu.media/wp-content/uploads/2026/11/1793804584-5bc2fbe021e0e8f.png\" alt=\"大鱼调色 1.10.0 深色模式:画布左侧纵向工具条、检查器与画布外示波器工作区\" class=\"wp-image-15840\" width=\"1628\" height=\"1258\" /><figcaption class=\"wp-element-caption\">大鱼调色 1.10.0 深色模式:纵向画布工具与独立示波器工作区</figcaption></figure>\n<!-- /wp:image -->\n\n<!-- wp:image {\"id\":15841,\"sizeSlug\":\"full\",\"linkDestination\":\"none\"} -->\n<figure class=\"wp-block-image size-full\"><img src=\"https://dayu.media/wp-content/uploads/2026/11/1793804588-7ea8d6f6f860d66.png\" alt=\"大鱼调色 1.10.0 浅色模式:浅色纵向工具条、调色检查器与画布外直方图工作区\" class=\"wp-image-15841\" width=\"1664\" height=\"1068\" /><figcaption class=\"wp-element-caption\">大鱼调色 1.10.0 浅色模式:纵向画布工具与独立示波器工作区</figcaption></figure>\n<!-- /wp:image -->\n\n<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">在时间线里完成调色</h2>\n<!-- /wp:heading -->\n\n<!-- wp:paragraph -->\n<p><strong>色彩管理与基础调整</strong>:支持 CST 输入、工作空间和输出转换,并提供曝光、白平衡、曲线、HSL、色轮及蜘蛛盘等调节工具。首次使用时,请在一级调色中选择与素材相符的输入曲线和色域。</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>LUT 与风格管理</strong>:通过缩略图浏览、收藏和预览管理常用 LUT,支持自选 LUT 文件与文件夹。完整预设用于保存组合调节;适合静态颜色变换的处理可导出 Cube LUT,颗粒、晕光、蒙版等时间或空间效果不属于静态 LUT 的保存范围。</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>胶片模拟与印片外观</strong>:包含减色、颗粒、晕光、辉光、暗角及通道混合器,提供 Kodak 2383、Fuji 3513 等八种印片外观,可独立调整强度。</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>局部蒙版与工具叠层</strong>:可针对单独工具添加蒙版、建立相邻叠层,并使用关键帧与跟踪处理局部区域,方便细调画面的不同部分。</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">历史更新</h2>\n<!-- /wp:heading -->\n\n<!-- wp:heading {\"level\":3} -->\n<h3 class=\"wp-block-heading\">1.7.4:删除模块与图层</h3>\n<!-- /wp:heading -->\n\n<!-- wp:paragrLine truncated
"excerpt": "大鱼调色 1.10.0 紧急 UI 更新:纵向工具条、画布内曲线与色轮、画布外示波器及 LUT 预览工作区,提供深浅色模式。完整 PKG 已签名公证,售价50元,站内有效会员免费。",
"seo": {
"title": {
"enabled": true,
"value": "大鱼调色1.10.0公测版:紧急UI更新,画布工具与独立工作区"
},
"description": {
"enabled": true,
"value": "大鱼调色1.10.0公测版紧急UI更新:纵向工具条、画布内曲线与色轮、独立示波器和LUT预览工作区,支持深浅色模式。适用于Apple Silicon、macOS14.6及以上,已在Final Cut Pro12.4实测。完整PKG已签名公证,售价50元,站内有效会员免费。"
},
"keywords": {
"enabled": true,
"value": "大鱼调色,Final Cut Pro,调色插件,FxPlug4,紧急UI更新,画布曲线,色轮,示波器,LUT预览,会员免费"
}
}
}
+171
查看文件
@@ -0,0 +1,171 @@
<!-- wp:paragraph -->
<p>大鱼调色 1.10.0 公测版是一款适用于 Final Cut Pro 与 Motion 的原生 FxPlug 4 调色插件。从素材色彩还原、基础调整,到 LUT 风格、胶片质感和局部蒙版,可直接在剪辑时间线里完成。</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>本篇下载售价为50元,站内有效会员免费。提供已签名、公证的完整 PKG 安装包,版本 1.10.0,构建 72。</p>
<!-- /wp:paragraph -->
<!-- wp:heading -->
<h2 class="wp-block-heading">1.10.0 紧急 UI 更新</h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>本次紧急更新重新安排了调色工具的位置:画布左侧使用纵向工具条,曲线、色轮等调整控件直接叠在画面中;示波器和 LUT 预览放进画布外的独立工作区。需要精确参数时,仍可使用右侧检查器。下方两张为新版实际界面,分别展示深色与浅色模式。</p>
<!-- /wp:paragraph -->
<!-- wp:list -->
<ul class="wp-block-list"><li><strong>纵向工具条</strong>:从画布侧边切换工具,工具面板可以独立移动、折叠和关闭,也可同时打开多个工具。</li><li><strong>画布内调整</strong>:曲线支持直接添加、移动和删除控制点,并切换 RGB、红、绿、蓝通道;颜色分级提供直接调节的色轮。一次拖动作为一次操作,可用 ⌘Z 撤销。</li><li><strong>画布外工作区</strong>:通过“工作区 · 示波器 / LUT”打开,切换亮度波形、RGB 分列或直方图;“风格1 LUT”页使用当前画面预览 LUT,并明确应用到风格1。</li><li><strong>保留已有调色</strong>:原有调色参数和预设继续使用,深色、浅色模式均可切换。</li></ul>
<!-- /wp:list -->
<!-- wp:paragraph -->
<p>工作区示波器用于 sRGB 显示参考,采样当前插件的处理输出,不包含其后的其他效果或宿主显示转换;它不替代 HDR/IRE 精密测量。宿主仅提供分块画面时,会标明当前分块。移动播放头后随新画面更新。</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>此版本已完成正式签名、公证及安装验证,并在 Final Cut Pro 中实测曲线拖点与一次撤销、LUT 预览、示波器随播放头更新。</p>
<!-- /wp:paragraph -->
<!-- wp:image {"id":15840,"sizeSlug":"full","linkDestination":"none"} -->
<figure class="wp-block-image size-full"><img src="https://dayu.media/wp-content/uploads/2026/11/1793804584-5bc2fbe021e0e8f.png" alt="大鱼调色 1.10.0 深色模式:画布左侧纵向工具条、检查器与画布外示波器工作区" class="wp-image-15840" width="1628" height="1258" /><figcaption class="wp-element-caption">大鱼调色 1.10.0 深色模式:纵向画布工具与独立示波器工作区</figcaption></figure>
<!-- /wp:image -->
<!-- wp:image {"id":15841,"sizeSlug":"full","linkDestination":"none"} -->
<figure class="wp-block-image size-full"><img src="https://dayu.media/wp-content/uploads/2026/11/1793804588-7ea8d6f6f860d66.png" alt="大鱼调色 1.10.0 浅色模式:浅色纵向工具条、调色检查器与画布外直方图工作区" class="wp-image-15841" width="1664" height="1068" /><figcaption class="wp-element-caption">大鱼调色 1.10.0 浅色模式:纵向画布工具与独立示波器工作区</figcaption></figure>
<!-- /wp:image -->
<!-- wp:heading -->
<h2 class="wp-block-heading">在时间线里完成调色</h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p><strong>色彩管理与基础调整</strong>:支持 CST 输入、工作空间和输出转换,并提供曝光、白平衡、曲线、HSL、色轮及蜘蛛盘等调节工具。首次使用时,请在一级调色中选择与素材相符的输入曲线和色域。</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p><strong>LUT 与风格管理</strong>:通过缩略图浏览、收藏和预览管理常用 LUT,支持自选 LUT 文件与文件夹。完整预设用于保存组合调节;适合静态颜色变换的处理可导出 Cube LUT,颗粒、晕光、蒙版等时间或空间效果不属于静态 LUT 的保存范围。</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p><strong>胶片模拟与印片外观</strong>:包含减色、颗粒、晕光、辉光、暗角及通道混合器,提供 Kodak 2383、Fuji 3513 等八种印片外观,可独立调整强度。</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p><strong>局部蒙版与工具叠层</strong>:可针对单独工具添加蒙版、建立相邻叠层,并使用关键帧与跟踪处理局部区域,方便细调画面的不同部分。</p>
<!-- /wp:paragraph -->
<!-- wp:heading -->
<h2 class="wp-block-heading">历史更新</h2>
<!-- /wp:heading -->
<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">1.7.4:删除模块与图层</h3>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>每个模块和新增图层的标题增加减号按钮,可删除不需要的层并让它从界面消失。删除时一并还原该模块的参数、清除关键帧及所属 LUT、蒙版等设置,避免隐藏后仍影响画面;其他模块保持原设置。误删可通过 Final Cut Pro 的一次撤销恢复。</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>顶部“添加模块”菜单可重新添加任意模块,新层从初始参数开始,不继承已删除层的设置。原有“再加一层”继续保留,删除状态随工程和完整预设保存。本机已验证删除、撤销、重做、重新添加与退出重开;本版继续保留此前的 Cube 兼容与“更多空间”窗口修正。</p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">1.7.3:显示缩放下的 LUT 窗口</h3>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>修正部分显示器选择“更多空间”后,LUT 缩略图浏览库出现大片灰色、内容偏移和裁切的问题。首次打开即可完整显示搜索、文件夹、预览和底部控件,无需点击窗口绿色按钮恢复;原有窗口缩放、网格/列表与缩略图设置继续保留。本机已在相同显示设置下验证首次打开和重新启动 Final Cut Pro 后打开正常。</p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">1.7.2:LUT 浏览窗口</h3>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>LUT 缩略图浏览库改为跟随 Final Cut Pro 提供的实际窗口内容区域,避免旧窗口位置和尺寸记录干扰布局;窗口变化时同步调整深色内容区、列表及底部控件。缩略图大小、网格/列表、侧栏、分类和最近使用设置继续保留。</p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">1.7.1:LUT 导入兼容</h3>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>改善 Cube LUT 导入兼容性,可读取部分在颜色数据行夹带文字标记的文件。保留可读取的数值,无法读取的后续通道按 0 处理,各行位置保持不变;这与本机 Final Cut Pro“自定 LUT”处理同类文件的方式一致。原有文件编码支持、缩略图浏览与预览功能继续保留。</p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">1.7.0 公测新增</h3>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>主 App 启动时自动检查新版,发现更新后由用户确认下载。完整更新包经过完整性、签名和产品版本校验,保存并退出 Final Cut Pro / Motion 后,通过系统安装器完成升级。</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>公测诊断用于记录系统与版本、插件初始化、界面创建、管线准备和首次渲染的耗时,以及错误和本插件崩溃摘要。它在后台限量排队、离线重试,不上传素材、LUT、预设、账号、硬件 UUID 或原始崩溃文件;诊断保留30天,可在主 App 关闭。</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>本版处于公测阶段,部分用户反馈的偶发加载无响应仍在收集信息,尚未确认根因。遇到问题时,请附主 App 显示的报告标识、发生时间、Mac 芯片、macOS 和 FCP 版本,便于关联加载过程。</p>
<!-- /wp:paragraph -->
<!-- wp:heading -->
<h2 class="wp-block-heading">兼容与安装内容</h2>
<!-- /wp:heading -->
<!-- wp:list -->
<ul class="wp-block-list"><li>Apple Silicon Mac,macOS 14.6 或更新版本;本发行构建不支持 Intel Mac。</li><li>本机已在 Final Cut Pro 12.4 验证加载、界面和调节,其他宿主版本的兼容情况继续通过公测收集。</li><li>主 App 固定安装到 /Library/Plug-Ins/FxPlug/大鱼调色.app,FCP 效果模板安装到当前登录用户的“影片/Motion Templates/Effects/大鱼调色”。</li><li>安装包不包含用户自选素材、LUT 或个人预设。</li></ul>
<!-- /wp:list -->
<!-- wp:heading -->
<h2 class="wp-block-heading">安装</h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>安装前,请先退出 Final Cut Pro(FCPX)和 Motion,并在整个安装过程中保持它们关闭。PKG 通常会检查这两个程序是否正在运行;如果安装器提示关闭,请退出对应程序后继续安装。</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>运行本资源提供的 PKG 安装包,安装包包含完整的大鱼调色主 App、内嵌 FxPlug 插件和效果模板,并自动完成安装与插件注册,无需另行安装运行依赖。</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>本公测版不需要登录或输入激活码。安装完成后打开主 App「大鱼调色」,它会检查并提交插件注册;成功后显示3秒倒计时再退出。点击“查看功能介绍”可以保留窗口,查看更新和诊断设置。</p>
<!-- /wp:paragraph -->
<!-- wp:heading -->
<h2 class="wp-block-heading">使用</h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>安装和注册完成后,打开 Final Cut Pro。</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>在“效果”中找到“大鱼调色”文件夹,选择“大鱼调色”即可使用。</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>选中添加了插件的片段后,从画布左侧纵向工具条打开调色面板。拖动面板标题可调整位置;在检查器点击“工作区 · 示波器 / LUT”,可打开画布外的辅助窗口。</p>
<!-- /wp:paragraph -->
<!-- wp:heading -->
<h2 class="wp-block-heading">常见问题</h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>如果插件失效或显示红色警告,可能是系统插件缓存异常。先退出 Final Cut Pro,再重新打开一次插件主 App,然后重新启动 Final Cut Pro 查看插件是否恢复。</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>本资源的主 App「大鱼调色」安装在下面的实际路径。将以下命令复制到“终端”运行,即可打开主 App:</p>
<!-- /wp:paragraph -->
<!-- wp:code -->
<pre class="wp-block-code"><code>open '/Library/Plug-Ins/FxPlug/大鱼调色.app'</code></pre>
<!-- /wp:code -->
<!-- wp:paragraph -->
<p>若仍显示红色警告或长时间停在加载中,请核对系统及 FCP 版本,并通过主 App 的“发送诊断摘要”反馈报告标识和发生时间。公测阶段的偶发加载无响应仍在收集信息,重新注册并不能保证解决所有问题。</p>
<!-- /wp:paragraph -->
+29
查看文件
@@ -0,0 +1,29 @@
{
"articleID": 15792,
"assets": [
{
"file": "dayu-color-1.10.0-interface-01.png",
"role": "body-interface-dark",
"bytes": 577587,
"sha256": "4e948f0599700ddd13f2938a1aac892dea1b6ff60423c2ea15a72e50d5a9ec70",
"width": 1628,
"height": 1258
},
{
"file": "dayu-color-1.10.0-interface-02-light.png",
"role": "body-interface-light",
"bytes": 493551,
"sha256": "e0f7ec34a839755efed1d67277e482c753e48aa770279cdb2b75a5963f16257f",
"width": 1664,
"height": 1068
},
{
"file": "dayu-color-1.10.0-cover.png",
"role": "generated-article-cover",
"bytes": 1722606,
"sha256": "c05470ec2b50de0cfdd246b26334aaa895bd288abdb080cad2d4312c120c9a5a",
"width": 1672,
"height": 941
}
]
}
+27
查看文件
@@ -0,0 +1,27 @@
{
"articleID": 15792,
"images": [
{
"file": "dayu-color-1.10.0-interface-01.png",
"bytes": 577587,
"sha256": "4e948f0599700ddd13f2938a1aac892dea1b6ff60423c2ea15a72e50d5a9ec70",
"status": "verified",
"id": 15840,
"url": "https://dayu.media/wp-content/uploads/2026/11/1793804584-5bc2fbe021e0e8f.png",
"alt": "大鱼调色 1.10.0 深色模式:画布左侧纵向工具条、检查器与画布外示波器工作区",
"title": "大鱼调色 1.10.0 深色模式",
"downloadSHA256": "4e948f0599700ddd13f2938a1aac892dea1b6ff60423c2ea15a72e50d5a9ec70"
},
{
"file": "dayu-color-1.10.0-interface-02-light.png",
"bytes": 493551,
"sha256": "e0f7ec34a839755efed1d67277e482c753e48aa770279cdb2b75a5963f16257f",
"status": "verified",
"id": 15841,
"url": "https://dayu.media/wp-content/uploads/2026/11/1793804588-7ea8d6f6f860d66.png",
"alt": "大鱼调色 1.10.0 浅色模式:浅色纵向工具条、调色检查器与画布外直方图工作区",
"title": "大鱼调色 1.10.0 浅色模式",
"downloadSHA256": "e0f7ec34a839755efed1d67277e482c753e48aa770279cdb2b75a5963f16257f"
}
]
}
+21
查看文件
@@ -0,0 +1,21 @@
# 1.10.0 文章封面
生成方式:内置 imagegen;生成日期:2026-11-04。最终文件:`dayu-color-1.10.0-cover.png`。
提示词:
Use case: ads-marketing.
Asset type: wide 16:9 article cover for a real native Final Cut Pro color-grading plugin.
Primary request: create a polished Chinese editorial cover announcing the emergency UI update of 大鱼调色 version 1.10.0.
Scene: elegant charcoal-black background, subtle cyan and violet light, restrained native macOS visual language. A clean vertical strip of abstract tool icons along one side, a luminous RGB curve with control points, a precise color wheel, and a small RGB histogram area suggest canvas tools and a separate auxiliary workspace. These are editorial graphic motifs, not a fabricated app screenshot.
Composition: large beautifully typeset Chinese product title with generous space, smaller version number, prominent update badge. Strong thumbnail legibility, calm professional color-science feel. Avoid excessive glow or clutter.
Text (verbatim, no additional text):
"大鱼调色"
"1.10.0"
"紧急 UI 更新"
"画布工具 · 曲线色轮 · 独立工作区"
"Final Cut Pro"
Typography: crisp modern Chinese sans-serif, accurate characters, white main title, cyan or violet accent badge.
Constraints: landscape 16:9, finished opaque cover. No fake detailed UI text, no logos of other products, no watermark, no price.
正文图片为用户提供的深色、浅色模式实拍截图,按原始字节保存;与生成封面分开使用。
二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 1.6 MiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 564 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 482 KiB

+5 -1
查看文件
@@ -1,6 +1,10 @@
# 大鱼调色
原生 FxPlug 4 调色器,当前公测版本 **1.8.4(64)**。唯一安装位置为 `/Library/Plug-Ins/FxPlug/大鱼调色.app`;Final Cut Pro 中从“效果 → 大鱼调色”添加。
原生 FxPlug 4 调色器。当前正式签名、公证并安装 **1.10.0(72)**,固定位置 `/Library/Plug-Ins/FxPlug/大鱼调色.app`;FCP 中从“效果 → 大鱼调色”添加。
新版采用纵向工具条和多个可移动浮动面板,曲线可直接拖点,分级可直接调色轮;画布外工作区提供 sRGB 显示参考示波器和风格1 LUT 预览。695项正式安装原生检查与用户实鼠的曲线拖点/一次撤销、LUT预览、示波器更新均通过。完整PKG已签名公证、粘附票据并验包。
[原资源文章](https://dayu.media/15792/)已先行更新为“1.10.0 紧急 UI 更新”,替换新封面与用户提供的深浅色原始截图,主下载同步正式包,售价50元、有效会员免费保持。Git Release正在收尾,最终状态见后续 `verification/Release.json`;不可使用其中更早版本的历史记录宣称本版已发布。详见[交互说明](research/ViewerWorkspace-20261104.md)、[宿主验证](verification/HostWorkspace1.10.0.json)、[文章验证](verification/Article1.10.0.json)与[恢复说明](RECOVERY.md)。
1.8.4 收敛“霓虹炫彩”配色:所有模块统一使用用户已认可的低饱和近黑表面,去掉红绿橙色块。保存预设保留原粉紫到青色渐变;模块名称按钮以统一轻渐变、细边和更亮展开态强化显示,蒙版/删除/再加一层按钮增加克制的按钮底。原主题编号、功能、直方图、CMS及预设保持。
+22
查看文件
@@ -1,3 +1,23 @@
# 2026-11-04 画布工具与辅助工作区:1.10.0(72)验收完成
当前正式安装 **1.10.0(72)**,固定位置 `/Library/Plug-Ins/FxPlug/大鱼调色.app`,主 Bundle ID `com.dayu.color`,XPC `com.dayu.color.XPC`。实际编译源码 `80dec904bedf5f704b29d16325fa95d639f3a250`;Developer ID 团队 B3W25FX5H5,APP 公证 `c0209032-38d2-4434-8e37-7f911414c3c6` Accepted。票据、Gatekeeper、唯一 PluginKit 正式路径、正式安装的 **695 项原生检查**与用户实鼠验收通过。
画布侧改为纵向十四工具入口,支持多个独立移动、折叠和关闭的浮动工具面板。曲线直接添加、拖动、删除点并切 RGB 通道;颜色分级提供四个实际色轮,二者可切换参数页。其它工具继续使用原有参数和图层 UUID;移动面板与切换编辑视图不进入调色撤销。
外部“工作区 · 示波器 / LUT”由 FxRemoteWindow 托管。亮度波形、RGB 分列和直方图采集当前效果输出并标注 sRGB 显示参考/分块限制;不包含其后其他效果或宿主显示转换,也不替代 HDR/IRE 测量。LUT 页预览与应用风格1。用户明确确认曲线拖点/一次撤销、外窗 LUT 预览、移动播放头后示波器更新“三项都正常”,见 `verification/HostWorkspace1.10.0.json`。
最终 PKG `../发行包/大鱼调色-1.10.0.pkg`,43,090,565 字节,SHA-256 `ee70461c9b2d2e0ddd78cbcb3371c3b1b36b7f0e5fc69bfccc7ac0f1a3e468d8`,Installer 签名、公证 `9604cc73-153c-4751-ac5b-2cca76b4c219` Accepted、票据、Gatekeeper 和20项展开验包通过。APP 已独立安装验收,本轮未重复执行系统 PKG 安装脚本。`verification/Package.json` 是本版验包记录。
按用户要求,公证后先更新原文章 https://dayu.media/15792/:标题及正文说明“紧急 UI 更新”,新生成封面,深色/浅色两张用户原图,主下载包更新为本版;50元、有效会员免费及其它商业/视频设置保留。前台SEO逐项一致、旧图移除、新图原始哈希与正式包完整下载校验通过。素材、正文、提示词与验证分别保存在 `Publishing/1.10.0/`、`verification/Article1.10.0.json`。未修改 NAS 源码、生产接口或自动更新清单。
远端 https://dayu.media/git/dayu/dayu-color.git,main。发行目标标签 `v1.10.0-canvas-workspace-20261104`;Git Release 仍待上传与完整下载核验,不能将旧版 `Release.json` 当作本版记录。标签包含最终 Package.json 与文章记录;发布后 Release.json 保存在后续 main,不移动已有标签。71 因实窗顶栏缺陷被72替代未发布,70包保留为历史未发布候选。
独立远程 checkout 已核对实际编译提交、526个跟踪文件、Git fsck、8个锁定依赖归档、插件/诊断/工作区/渲染器四个翻译单元 C++20 语法,见 `verification/WorkspaceRecovery1.10.0.json`。无 LFS/子模块,未重复完整重建 CMS 依赖。Xcode27.1、FxPlug SDK4.3.5、Apple Silicon/macOS14.6+;签名/公证凭据需独立恢复,不在 Git。
正式验收后已清理任务生成的70/71旧安装恢复APP、缓存生成APP和公证ZIP,见 `verification/WorkspacePendingCleanup1.10.0.json`;源码恢复checkout暂留供最终标签核验。源码、历史包和用户QA媒体保留。恢复具体步骤沿用下文,当前版本以本节和相应验证记录为准。
以下为上一完整发布版 1.8.5(67)及历史交接,供恢复参考。
# 1.8.5(67)浅色 / 深色双模式
远程 https://dayu.media/git/dayu/dayu-color.git,main。实际编译源码d39004c26af3c0c5853111faef7e40e6c66f6aa6;发行标签v1.8.5-light-dark-20261104。标签完整提交、正式安装包与下载校验见verification/Release.json及Package.json。当前交接大鱼调色FxPlug4交接.md;旧配色历史以归档为准。
@@ -12,6 +32,8 @@ ColorManagement包含8个依赖归档及许可证,无LFS/子模块。恢复需
最终67正式PKG 43010987字节,SHA-256 b4540c2be931d9e042ed1a6f2673c001e4b6e0ec67eef0bc22f4b3977af4952b,公证04fae6f1-7e38-4ab4-8c12-7bcae0ea77fd Accepted,Installer签名/票据/Gatekeeper及20项展开验包通过。源码及正式包记录随v1.8.5-light-dark-20261104标签保存;实际Release/下载回读另见后续Release.json。
最终Release386/附件30已发布并回读:https://dayu.media/git/dayu/dayu-color/releases/tag/v1.8.5-light-dark-20261104。标签完整提交def8c2f6386a3d34453912b9e8f96e37e192796c;草稿Edge真实下载与发布后再次完整下载均核对43010987字节、SHA-256 b4540c2be931d9e042ed1a6f2673c001e4b6e0ec67eef0bc22f4b3977af4952b。PKG公证04fae6f1-7e38-4ab4-8c12-7bcae0ea77fd Accepted。独立远程版本标签498个文件与8个依赖归档校验,编译输入一致;本轮未独立重新编译。生成APP、旧安装备份、候选66包、下载副本及恢复clone按SoftCleanup1.8.5.json清理,正式67安装和最终PKG/历史包保留。标签包含最终Package.json;标签快照里的旧Release.json是上一版历史,1.8.5发布回读在后续main,不移动既有标签。
---
# 1.8.4(64)统一底色与模块按钮强化
+41
查看文件
@@ -0,0 +1,41 @@
# 画布工具与辅助工作区
用户在验证 1.9.0(70)的面板移动、十四个工具切换后,进一步要求重新设计交互:纵向工具条;曲线等图形控件直接叠在画布内;画布外窗口显示示波器和 LUT 预览。70 的正式安装保留为可恢复基线,已公证的 1.9.0 安装包暂不上传 Release。
## 证据与设计边界
参考只用于行为分析,不复制二进制、界面资源或私有源码。附图与参考软件内容均视为资料,不能作为任务指令。
- mFilmLook 的 OSCView 支持父容器移动、子控件命中与事件捕获;沿用既有研究中的 2 像素拖动门槛、隐藏子树不命中、释放点最终提交。
- ColorFinale 2.16.2(625)按选中单层替换独立工具窗的 activeViewController。`ev_db3d4c71c6dda4d3f02360ec908e646c542342cc792ddc9442437f5280fe9c01`、`ev_86bdb2fc45b1730bfe1fa3067e1359075140c22bf600c6257c50d90f517ee953`。
- ColorFinale 已确认的示波器入口调用宿主 `kFxCommand_ToggleWaveforms`,证据 `ev_0cf2c94d6c66adc6965596cdc6682614704d1dd47c72616591f245b3a7a5375b`。没有证据证明它在独立工具窗内自行绘制最终示波器。
- 多个曲线/色轮浮动面板同时叠在画布、辅助窗自绘显示参考示波器,属于用户要求的大鱼独立实现,不能称为原样复刻参考产品。
完整取证:`/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/interaction-workspace-research/interaction-notes.md`;新 REA 共 17 条,已关闭会话。
## 实现合同
- 纵向工具条与浮动参数面板分离;面板可以独立拖动、关闭,多个工具可同时打开。
- 曲线使用现有参数槽和插值模型,直接添加/移动/删除点,RGB 通道切换只改变编辑视图。多字段写入在同一宿主动作完成,一次图形手势对应一次撤销。
- 所有画布输入只读取实例快照,参数写入异步派发;切换时间、节点消失或外部修改时停止手势,禁止串片段写入。
- 辅助窗通过 FxRemoteWindow 托管并绑定本插件实例。LUT 预览复用现有真实帧与浏览库;应用目标明确为风格 1。
- 自绘示波器来自最终渲染目标,显示域和采样范围明确标注;不把旧分析阶段直方图伪称为最终输出。
- 不改宿主参数 ABI、预设格式、生产后端或在线更新清单。
## 实现
`DYViewerControls` 作为单一 OSC 根,绘制纵向十四工具入口,管理各自可拖动、折叠、关闭的工具面板。入口保持最上方绘制与命中,小画面分页;蒙版工具条移至图像右侧并在图像交集内自适应布局。所有位置与通道选择均为视图状态。
`DYViewerParameterPanel` 绑定工具类型与稳定图层 UUID;曲线直接添加、移动和删除现有参数槽的点,支持 RGB/红/绿/蓝;颜色分级提供四个实际色轮。二者可切换精确参数页,其它工具沿用现有参数描述与范围。多个不同工具可同时叠在画面上。
`DYViewerParameterBridge` 通过完整字段集合提交曲线 XY、色轮 HS;预校验整组,在同一次宿主 action 内写入,保持单次撤销与冲突中止。无当前帧快照时保留原图层选择并禁止编辑,只有真实文档确认删除才回退同类型图层。空工具面板不能结束其它面板的共享写入手势。
`DYColorWorkspace` 使用 FxRemoteWindow,并从画布入口或检查器“工作区 · 示波器 / LUT”打开。LUT 页明确应用到风格1;沿用真实分析帧缩略图浏览库。异步准备后核对播放头、原 LUT 和颜色管理,写回读取真实目标图层;关闭会取消准备,宿主拒绝保存不会显示成功。
示波器采样的是**当前效果的处理输出**,不包含后续其它效果或宿主显示转换。已知 ICC 输出转扩展 sRGB,显示亮度波形、RGB 分列、直方图;它是显示参考,不能替代 HDR/IRE 精密测量。宿主仅提供分块时界面明确标注当前分块。LUT 页或窗口关闭停止示波器采样,重新打开等待新帧;旧帧不会冒充新播放头结果。
## 验证进展
71 已通过正式安装的 691 项原生检查,但 FCP 实窗发现示波器背景越界绘制,覆盖顶栏。该候选未发布,记录见 `verification/Viewer71Candidate.json`。72 加入根视图和面板显式裁剪,以及真实顶栏位图/越界重绘/缩放回归;已正式签名公证、安装并通过 695 项原生检查。FCP 实窗确认顶栏恢复和纵向工具条显示;用户实际鼠标确认曲线拖点/一次撤销、LUT 页真实预览、移动播放头后的示波器更新“三项都正常”,记录 `verification/HostWorkspace1.10.0.json`。
保留所有参数 ID、预设 schema 和渲染调色算法。正式PKG已签名公证、票据和20项验包通过;按用户要求先更新原网站文章,增加紧急UI更新说明、新封面和两张深浅色用户原图,主包同步,商业规则保留。无NAS源码或自动更新清单变更。
+77
查看文件
@@ -0,0 +1,77 @@
# mFilmLook 屏幕控件迁移
任务日期:2026-11-04,Asia/Shanghai。
接收项目按当前目录与最近交接先采用「大鱼调色」,主 Bundle ID `com.dayu.color`。编辑前工作区干净,main 与远程 main 均为 `ac9180e47cdcf778544f826a20a92274f6c63813`;正式版 1.8.5(67)。不修改同目录的其它产品。
参考为用户指定的 `/Applications/motionVFX/Plugins/mFilmLook.app`,内嵌 XPC 服务版本 3.1.4(251215.1955),Universal 文件 SHA-256 `6814e428e99256f23d076c8855f918f9692b8b20f6f7ca5fbc37789bb573a88d`。只读研究屏幕控件,不更改参考产品。
## 研究问题
1. 工具条与模块面板如何切换、显示 hover / pressed / selected 状态。
2. 命中测试与拖动捕获如何配合;移动阈值、松开与离开如何处理。
3. 滑杆如何映射参数、何时写回及结束手势。
4. 如何将以上行为接到本项目参数、独立叠层、检查器与撤销中。
## 实现边界
以交互规范独立实现,复用本项目的参数定义和绘制系统;不引入参考产品的二进制、图标、字体或渲染算法。所有本项目的图像处理、CMS、预设格式、参数 ID 保持其现有合同。
画面内提供可收起的调色入口、模块/独立叠层选择、启停与参数分页。按钮抬起时在原命中区域触发;滑杆按下后捕获拖动,即使移出轨道仍继续,松开释放。滑杆实时异步写回主队列;整次手势归入一个宿主撤销组。OSC 回调不等待主队列或直接写宿主模型。
悬停、展开、分页、模块选择属于瞬时 UI 状态,不创建调色参数或撤销项。保留现有蒙版工具条、钢笔与跟踪路由。
证据与验证结果将在对应阶段补充;静态研究不能代替真实宿主交互验证。
## 静态证据
# mFilmLook 3.1.4 屏幕控件静态调查
范围:只读用户指定的 mFilmLook XPC Service,未运行插件,未修改原件。Universal 原件 SHA-256 为 6814e428e99256f23d076c8855f918f9692b8b20f6f7ca5fbc37789bb573a88d;供 Ghidra 12.1.4 使用的 arm64 切片为 b1cee1dffd3b490afa0c22db646404b018a0aaadf70d9a6827e95cb178c74357。所有结论是静态观察或由此推导,未声称宿主运行已验证。
## 可独立实现的交互规范
- 展开和效果启用分离。drawOSC 0x100002988 从 inspectorBarParams 的字符串 0/1 恢复面板显隐,从 inspectorCheckboxParams 恢复效果启用。mouseUp 0x100005724 比较状态,只写回变化。证据 ev_be6866f470c930f3239f4678fa9ed11da79a23143297864c6ada4d44c8196fa2、ev_7ba43ef534545c3c16f1633f4ee7911a343b72289a8ad1ba6e6d86a96d1b12c5。
- 坐标由 FxOnScreenControlAPI_v4 convertPointFromSpace 转换,控件逆矩阵还原局部坐标,带边距矩形命中;隐藏父视图时跳过整个子树。方法 mouseAction 0x1000bdd68、OSCView::getHitElementID 0x10005bd7c / 0x10005bea0。证据 ev_73eedf87215a0cf8da178948205e5ab372ccea33f84d43fe5b1d39d7074973b9、ev_0ba4130d5f30564be2f317cb3353a943f93a64ed039859a973d95250740606a0、ev_b80a7bd65444cae316b421dfe459b0d507d42a2d186233af197680a7c0945390。
- 按下保存起点,任意轴超过 2.0 后置拖动标记;松开补算最后位移。mouseDown 0x1000044b4、mouseDrag 0x10000463c、mouseUp 0x100005724。证据 ev_c67c0a4caf048aaec7fd687416ed7ae81110807b606ff4a94b43ece6e699ef08、ev_889e7b4ee2ff8413b326c083dd336e9d602608f2e4d59a35b398412b9ca671ad、ev_7ba43ef534545c3c16f1633f4ee7911a343b72289a8ad1ba6e6d86a96d1b12c5。
- 滑杆按值域线性映射:t=(value-min)/(max-min),knobX=(t-0.5)*trackWidth,两端夹紧。轨道点击可跳转;拖动实时写宿主 float 参数,松开再收尾。OSCMarkedSlider::mouseDownAction 0x100026a6c、setMoveVec 0x1000267fc、getValue 0x1000269d4、setValue 0x100026a14。证据 ev_76c35a7740fa1b938d07c6a50f0ff0bb76dadbb01218b199ec887681507f75fc、ev_ccc485dc8ea1e56ebe1cfabf017612a379758f9a394255be4c387ce26ecdff6f、ev_661e01277328a90c0cefa7d18df4864e37fe83b25e6cdadd2532124502c1268b、ev_0505d73a7f2d30b301c123b2331d7f5a9f1ef5f22422e2673723f070de23d794。
- 按钮保存按下时的启用/按压状态,释放后清按压。OSCButton::mouseDownAction 0x10006c204、mouseUpAction 0x10006c188。证据 ev_a04295adad17a322579d4478039c8c2693882c767696247fb769f0c2491882a4、ev_f3fd7e86b0686b9ca3468648b46f4130e3950789a9f69c32cc25f77c6a689e7b。
- hover 提示延时常量 0.5 秒,mouseExited 隐藏提示并请求重绘。DisplayTooltipIfNeeded 0x100005e04、mouseExited 0x100005f88。提示证据 ev_113c519048990bee9fc99ad832eeefb84bf611d05442919dd22028b098f5d8b2。
## 未知及移植边界
- 此管理器鼠标路径未读取 modifiers,无 Shift 精细拖动的原版证据。
- IPluginOSCManager::doubleClick 0x1000062b0 只检查约 100ms 时间间隔;未发现双击复位默认值。证据 ev_2b22b07404cc104b0d63f0fa9bd7341f4f3ea6017c00ffd3ae7ea3201ada5bc0。
- 有 startUndo/endUndo 的 FxUndoAPI 包装(0x1000c2de0、0x1000c2e48),但间接调用边界未知,不能声明原版拖动撤销分组已完整确认。建议使用接收工程既有撤销契约。证据 ev_f2e3705b55f0d6e7cc1fa284c30b9bf4e909c88b564c27b98f20f7e83f24cdb6、ev_ae0897bf492fb9c9d49f2eb4dc0f5a499c1bf45f0699f1b2cca6adfb71bd3d22。
- Ghidra 的 arm64 C++/ObjC 参数签名存在错误,主要结论已对照 otool 汇编。未观察 FCP 实际交互。
- 独立重写状态机和布局;原版图标、纹理、资源、二进制、伪源码不进入产品或源码仓库。
REA 已关闭。完整证据为同目录 evidence-bundle.json;同目录另有 analysis-snapshot.json 和 arm64.asm。缓存仅用于调查复核。
## 接收项目适配
画面右上角“画面调色”入口默认收起;展开后可从目录选择现有模块和独立层,参数按可用高度分页。复杂曲线/蜘蛛盘继续使用检查器的原生图形编辑,画面面板提供其已有标量调节,未搬入原版渲染或专有资源。基础调整保留独立的影调、颜色两个启停按钮。展开、选择和页码保留为会话 UI 状态;参考插件的展开参数持久化方式未照搬,以免更改本项目参数/预设合同。
本项目显式增加单项 ↺ 复位;不声称参考插件有双击复位或 Shift 精调。默认值标记、既有浅/深主题、独立图层 UUID 路由与冲突保护均属于项目适配。2 像素门槛按实际绘制比例换算。鼠标移出只清悬停,不中断仍被捕获的滑杆;播放头/节点失效或 OSC 释放会结束写入组。
正式构建前 647 项离屏原生检查通过:20 项桥接、16 项界面状态/边界及原有功能,另包含真实 Metal 蒙版跨面板拖动回归。最终正式安装自检及 FCP 实测结果另记 verification。
## 68 候选宿主修正
正式候选 68 的入口落在宿主黑边,未通过交互验收。69 将整组布局锚定到实际 OBJECT→CANVAS 图像矩形与画布的交集;不将黑边上可绘制等同于可接收鼠标事件。68 不打包、不发布;公证记录保留,正式交付以最终验收构建为准。
## 正式候选 69 的验收状态
1.9.0(69)签名、公证 Accepted、票据、Gatekeeper、唯一 PluginKit 路径与正式安装 648 项原生检查均通过。FCP 已加载并显示图像与新入口。自动坐标点击没有原生 hit/event 证据;本项目 1.4.0/1.4.1 已记录同机 CUA 输入限制,随后实际鼠标成功。因此不能把自动输入无回调当作黑边或新控件导致原生鼠标失败的证据。69 的图像内锚定保留为布局改进。
已请求用户用实际鼠标展开、拖动、一次撤销。此项确认前不声称完整宿主验收通过,不发布安装包。状态见 verification/HostViewerControls1.9.0.json;原生自检结果见 verification/InstalledSelfTest.json。
## 用户明确的 70 修正
用户澄清:69 可调整参数,但整个面板无法拖动位置;其它工具藏在模块标题菜单里不清楚。70 增加标题整组移动与直接可见的十四工具按钮。图层选择按钮增加“图层 ▾”文字。默认基础参数先显示曝光/影调,再显示颜色参数;独立 UUID 和既有数学不变。
原版通用位置拖动依据:OSCView::setMoveVec 0x10005b5f8,drag=1 允许自身二维位移、drag=0 向父视图传递、drag=2 不移动自身;initialOSC 的 0x1000292b4、0x1000299e8 创建 drag=1 图像容器。mouseDrag 0x10000463c(ev_889e7b4ee2ff8413b326c083dd336e9d602608f2e4d59a35b398412b9ca671ad)在超过门槛后分发通用移动,仅滑杆 ID 另行写参数;mouseUp 0x100005724(ev_7ba43ef534545c3c16f1633f4ee7911a343b72289a8ad1ba6e6d86a96d1b12c5)补算最后位置,调用 addMoveVecToPosition;OSCView 0x10005b85c 固定位置并清临时位移。
接收实现按下保存标题原点和指针起点,超过门槛后整组重建绘制/命中位置,松开不触发收起。拖面板不调用参数桥接,不产生调色撤销。位置在当前会话保留,缩放/开合时按图像可见区域夹紧。十四按钮指本项目已有工具,未新增 mFilmLook 的渲染算法。
修正前 652 项原生检查通过;复审另修正被播放头变化打断时的拖动提示残留,并新增中断检查。最终以正式构建自检记录为准。
+2
查看文件
@@ -17,3 +17,5 @@
最终精简67:旧0–6主题palette与入口已删除,只留两个44pt文字按钮;内部7/8偏好ID兼容已有选择。两套浮雕绘制主体与66逐字相同。610项预检通过;旧金色/霓虹相关检查随功能退役,保留深浅对比度、模型不变与直方图检查,并核验旧模式不可再选。最终宿主与发行结果以下续记。
最终67正式位置签名/票据/Gatekeeper及610项安装检查通过,FCP实际载入67。顶部只有浅色/深色两个文字按钮,实看两模式并切换回深色,旧彩色色签消失。升级前正常退出/重开后深色偏好恢复。预设最终仍为8,590字节且与首次基线逐字节相同;直方图57,600采样可用。本轮无额外67同版第二次冷重开。
最终67:APP公证bf104b1f-5161-4970-8d8a-170989825747 Accepted;PKG签名、公证、票据、Gatekeeper与20项展开验包通过。Release386/附件30先草稿真实下载核验,再发布并再次完整下载核验。独立远程标签498文件、8源包和实际编译输入一致;无独立重编声明。候选66包及临时下载/clone/生成APP已按报告清理,未执行PKG安装脚本。
+81
查看文件
@@ -0,0 +1,81 @@
{
"passResult": true,
"articleID": 15792,
"url": "https://dayu.media/15792/",
"status": "publish",
"title": "大鱼调色 1.10.0 公测版:紧急 UI 更新,画布工具与独立工作区",
"requestID": "dayu-color-1100-ui-20261104-01",
"changedResourceFields": [
"cao_downurl",
"cao_original_filename"
],
"commercialAndVideoFieldsPreserved": true,
"authorCategoriesTagsPreserved": true,
"fcpxSettingsPreserved": true,
"seo": {
"title": {
"enabled": true,
"value": "大鱼调色1.10.0公测版:紧急UI更新,画布工具与独立工作区"
},
"description": {
"enabled": true,
"value": "大鱼调色1.10.0公测版紧急UI更新:纵向工具条、画布内曲线与色轮、独立示波器和LUT预览工作区,支持深浅色模式。适用于Apple Silicon、macOS14.6及以上,已在Final Cut Pro12.4实测。完整PKG已签名公证,售价50元,站内有效会员免费。"
},
"keywords": {
"enabled": true,
"value": "大鱼调色,Final Cut Pro,调色插件,FxPlug4,紧急UI更新,画布曲线,色轮,示波器,LUT预览,会员免费"
}
},
"frontendChecks": [
{
"url": "https://dayu.media/15792/",
"seoExact": true,
"bodyImagesInOrder": true,
"oldImagesAbsent": true
},
{
"url": "https://dayu.media/15792/?ui-update-1100=20261104",
"seoExact": true,
"bodyImagesInOrder": true,
"oldImagesAbsent": true
}
],
"featuredMedia": {
"id": 15843,
"url": "https://dayu.media/wp-content/uploads/2026/11/1793804690-fd9bae1dc96ee30.png",
"sha256": "c05470ec2b50de0cfdd246b26334aaa895bd288abdb080cad2d4312c120c9a5a",
"bytes": 1722606
},
"bodyImages": [
{
"file": "dayu-color-1.10.0-interface-01.png",
"bytes": 577587,
"sha256": "4e948f0599700ddd13f2938a1aac892dea1b6ff60423c2ea15a72e50d5a9ec70",
"status": "verified",
"id": 15840,
"url": "https://dayu.media/wp-content/uploads/2026/11/1793804584-5bc2fbe021e0e8f.png",
"alt": "大鱼调色 1.10.0 深色模式:画布左侧纵向工具条、检查器与画布外示波器工作区",
"title": "大鱼调色 1.10.0 深色模式",
"downloadSHA256": "4e948f0599700ddd13f2938a1aac892dea1b6ff60423c2ea15a72e50d5a9ec70"
},
{
"file": "dayu-color-1.10.0-interface-02-light.png",
"bytes": 493551,
"sha256": "e0f7ec34a839755efed1d67277e482c753e48aa770279cdb2b75a5963f16257f",
"status": "verified",
"id": 15841,
"url": "https://dayu.media/wp-content/uploads/2026/11/1793804588-7ea8d6f6f860d66.png",
"alt": "大鱼调色 1.10.0 浅色模式:浅色纵向工具条、调色检查器与画布外直方图工作区",
"title": "大鱼调色 1.10.0 浅色模式",
"downloadSHA256": "e0f7ec34a839755efed1d67277e482c753e48aa770279cdb2b75a5963f16257f"
}
],
"package": {
"version": "1.10.0",
"build": 72,
"bytes": 43090565,
"sha256": "ee70461c9b2d2e0ddd78cbcb3371c3b1b36b7f0e5fc69bfccc7ac0f1a3e468d8",
"downloadVerified": true
},
"rawPrivateResponses": "Local build cache only; not committed"
}
+18
查看文件
@@ -0,0 +1,18 @@
#import <Foundation/Foundation.h>
#import <Metal/Metal.h>
#include <cassert>
#include <cmath>
struct Pixel{float r,g,b,a;};
int main(int argc,const char **argv){@autoreleasepool{
assert(argc==2);id<MTLDevice>device=MTLCreateSystemDefaultDevice();assert(device);NSError *error=nil;id<MTLLibrary>lib=[device newLibraryWithURL:[NSURL fileURLWithPath:@(argv[1])] error:&error];assert(lib);
id<MTLComputePipelineState>pipeline=[device newComputePipelineStateWithFunction:[lib newFunctionWithName:@"dyScopeSample"] error:&error];assert(pipeline);
auto td=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA32Float width:2 height:2 mipmapped:NO];td.storageMode=MTLStorageModeShared;td.usage=MTLTextureUsageShaderRead;id<MTLTexture>source=[device newTextureWithDescriptor:td];
Pixel pixels[]={{4,-.25,.5,.5},{0,1,0,1},{0,0,1,1},{NAN,0,0,0}};[source replaceRegion:MTLRegionMake2D(0,0,2,2) mipmapLevel:0 withBytes:pixels bytesPerRow:sizeof(Pixel)*2];
id<MTLBuffer>buffer=[device newBufferWithLength:320*180*sizeof(Pixel) options:MTLResourceStorageModeShared];id<MTLCommandQueue>queue=[device newCommandQueue];
for(uint32_t flip=0;flip<2;flip++){
auto cb=[queue commandBuffer];auto ce=[cb computeCommandEncoder];[ce setComputePipelineState:pipeline];[ce setTexture:source atIndex:0];[ce setBuffer:buffer offset:0 atIndex:0];[ce setBytes:&flip length:4 atIndex:1];[ce dispatchThreads:MTLSizeMake(320,180,1) threadsPerThreadgroup:MTLSizeMake(8,8,1)];[ce endEncoding];[cb commit];[cb waitUntilCompleted];assert(cb.status==MTLCommandBufferStatusCompleted);
auto result=(const Pixel*)buffer.contents;if(!flip){assert(result[0].r==4&&result[0].g==-.25f&&result[0].a==.5f);assert(result[319].g==1);assert(result[179*320].b==1);assert(std::isnan(result[180*320-1].r));}
else{assert(result[0].b==1);assert(std::isnan(result[319].r));assert(result[179*320].r==4&&result[179*320].a==.5f);assert(result[180*320-1].g==1);}
}
return 0;
}}
+11
查看文件
@@ -0,0 +1,11 @@
#include "../大鱼调色/Plugin/DYScopeMath.hpp"
#include <cassert>
#include <limits>
int main(){
using namespace dyscope;RGBA pixels[]={{1,0,0,1},{0,1,0,1},{0,0,1,1},{1.3f,-.2f,.5f,.5f},{2,2,2,0},{NAN,0,0,1}};
auto r=measure(pixels,3,2);assert(r.valid==4&&r.transparent==1&&r.nonfinite==1);assert(r.above==1&&r.below==1);assert(r.minimum==-.2f&&r.maximum==1.3f);
assert(r.histogram[bin(.2126f)]==1);assert(r.histogram[bin(.7152f)]==1);assert(r.histogram[bin(.0722f)]==1);assert(r.wave[(Bins-1-bin(.2126f))*Width]==1);
assert(bin(-100)==0&&bin(100)==Bins-1);assert(bin(std::numeric_limits<float>::max())==Bins-1&&bin(-std::numeric_limits<float>::max())==0);auto im=densityImage(r.wave,false);assert(im.size()==size_t(Width)*Bins*4);assert(im[((Bins-1-bin(.2126f))*Width)*4]>0);
auto rgb=densityImage(r.parade,true);assert(rgb.size()==size_t(3)*Width*Bins*4);assert(rgb[(Bins-1-bin(1.f))*3*Width*4]>0);
assert(measure(pixels,0,0).valid==0);return 0;
}
+6 -6
查看文件
@@ -2,15 +2,15 @@
"status": "verified",
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
"bundleID": "com.dayu.color",
"version": "1.8.5",
"build": "67",
"version": "1.10.0",
"build": "72",
"team": "B3W25FX5H5",
"notaryID": "bf104b1f-5161-4970-8d8a-170989825747",
"notaryID": "c0209032-38d2-4434-8e37-7f911414c3c6",
"notaryStatus": "Accepted",
"gatekeeper": "/Library/Plug-Ins/FxPlug/大鱼调色.app: accepted\nsource=Notarized Developer ID",
"sourceCommit": "d39004c26af3c0c5853111faef7e40e6c66f6aa6",
"sourceCommit": "80dec904bedf5f704b29d16325fa95d639f3a250",
"templatePath": "/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef",
"templateSHA256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
"shaderSHA256": "38395fc34a3e3f222c34abc7b643df820f6a3c1a12eac52f2f9a6beaa0a7da76",
"hostVerification": "verification/HostTwoModes1.8.5.json"
"shaderSHA256": "bedde862e59d92dc2b0af19eba39ae35f77400a8553973b9180637f73dbb92e3",
"hostVerification": "verification/HostWorkspace1.10.0.json"
}
+37
查看文件
@@ -0,0 +1,37 @@
{
"status": "verified",
"version": "1.9.0",
"build": "70",
"sourceCommit": "30d413dc423a739f0c00fede41ffde39f3e11cf0",
"installedPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
"notaryStatus": "Accepted",
"notaryID": "725eb423-bc88-407b-ba23-ce9e0c9f5666",
"installedNativeChecks": 653,
"installedNativePass": true,
"host": "Final Cut Pro 12.4",
"observed": [
"FCP loaded the service from the unique formal FxPlug path",
"Existing grading image rendered",
"Custom inspector displays 1.9.0",
"New grip title is visible inside the image"
],
"newNativeCoverage": [
"Whole panel drag moves all child drawing and hit geometry",
"Mouse-up final position and drag does not collapse",
"All fourteen existing tools are directly selectable without grading writes",
"Playhead interruption clears drag state",
"Existing live scalar, independent layer, mask and undo checks remain passing"
],
"pending": [],
"priorFeedback": "Build69 adjusted parameters but lacked whole-panel movement and hid other tools in a catalog; build70 corrects these two issues. See Viewer69Candidate.json and the research report.",
"automationLimitation": "Physical panel move/tool switch accepted by the user. CUA is not used as proof of native OSC input; scalar/undo invariants are covered by the 653 installed native checks, with prior manual adjustment feedback recorded for build69.",
"passResult": true,
"physicalMouseConfirmation": {
"date": "2026-11-04",
"userAnswer": "可以移动,工具也都能切换",
"scope": [
"Move the complete panel by the title",
"See and switch all fourteen tool buttons"
]
}
}
+31
查看文件
@@ -0,0 +1,31 @@
{
"status": "verified",
"passResult": true,
"version": "1.10.0",
"build": 72,
"compiledSource": "80dec904bedf5f704b29d16325fa95d639f3a250",
"host": "Final Cut Pro 12.4",
"installedPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
"nativeChecks": 695,
"notaryID": "c0209032-38d2-4434-8e37-7f911414c3c6",
"observed": [
"Formal signed/notarized build72 loaded from the fixed installation path.",
"FCP draws the new vertical tool rail.",
"Host-owned auxiliary window opens from the inspector button.",
"Heading, scopes/LUT page selector and close button remain visible after the build72 clipping fix.",
"Existing project image renders; no reset or LUT selection performed."
],
"automationLimit": "Native OSC/remote-view input is not reliably triggered by CUA; native model/GPU tests do not replace these physical host checks.",
"packageRelease": "Host accepted; signed/notarized PKG and article update verified. Git Release still pending final attachment download verification.",
"dataPreservation": "Existing timeline and grade retained; ColorFinale effect was not toggled or removed.",
"physicalVerification": {
"source": "User actual mouse confirmation in this chat",
"answer": "三项都正常",
"confirmed": [
"Physical canvas curve point drag and one-step undo.",
"Physical external LUT page and actual thumbnail preview.",
"Live final-output scope refresh after a genuine host render."
],
"scope": "Canvas curve point drag and one-step undo; external LUT page/preview; final-output scope refresh after moving the playhead."
}
}
+366 -6
查看文件
@@ -1,6 +1,6 @@
{
"bundlePath": "/Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit",
"checks": 610,
"checks": 695,
"gpu": "Apple M4",
"limitations": [
"Finite states and a 64x48 frame; live FCP discovery, inspector interaction, timeline persistence and real host export require separate acceptance.",
@@ -12,7 +12,7 @@
"error": "未提供错误信息",
"name": "runtime-directory",
"pass": true,
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/6E057B9B-8AC5-43F0-BDC7-9E12B90F5FD4"
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/49D00F24-30A8-4E5C-B83B-6569DA0D71AE"
},
{
"descriptors": 278,
@@ -890,7 +890,7 @@
"error": "未提供错误信息",
"name": "renderer-export-33cube",
"pass": true,
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/6E057B9B-8AC5-43F0-BDC7-9E12B90F5FD4/diagnostic-export.cube"
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/49D00F24-30A8-4E5C-B83B-6569DA0D71AE/diagnostic-export.cube"
},
{
"bytes": 1186074,
@@ -910,7 +910,7 @@
},
{
"heartbeats": 0,
"maximumGapMS": 77.39162500365637,
"maximumGapMS": 76.67800001217984,
"name": "external-activation-main-loop-responsive",
"pass": true
},
@@ -1187,6 +1187,125 @@
"name": "primary-mask-blends-cst-only-in-selected-region",
"pass": true
},
{
"name": "workspace-remote-attaches-within-host-permissions",
"pass": true
},
{
"closePixels": 5468,
"headingPixels": 7980,
"name": "workspace-offscreen-topbar-heading-pages-close-render-pixels",
"pagesPixels": 21772,
"pass": true,
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/49D00F24-30A8-4E5C-B83B-6569DA0D71AE/workspace-topbar.png"
},
{
"name": "workspace-content-and-scope-pane-explicitly-clip",
"pass": true
},
{
"name": "workspace-oversized-scope-dirty-cannot-erase-topbar",
"pass": true
},
{
"name": "workspace-follows-remote-container-resize",
"pass": true
},
{
"closePixels": 5468,
"headingPixels": 7020,
"name": "workspace-topbar-survives-resize-and-large-dirty-redraw",
"pagesPixels": 21772,
"pass": true
},
{
"name": "workspace-reopens-existing-host-remote-window",
"pass": true
},
{
"name": "workspace-closes-host-window-once-and-stops-scopes",
"pass": true
},
{
"name": "workspace-host-close-cleans-without-recursive-close",
"pass": true
},
{
"name": "workspace-new-scope-session-clears-old-frame",
"pass": true
},
{
"name": "workspace-style1-preserves-other-lut-slots-one-undo",
"pass": true
},
{
"name": "workspace-remove-style1-applies-once-after-async-boundary",
"pass": true
},
{
"name": "workspace-async-playhead-change-keeps-new-frame-untouched",
"pass": true
},
{
"name": "workspace-async-lut-conflict-preserves-user-change",
"pass": true
},
{
"name": "workspace-async-color-context-conflict-preserves-state",
"pass": true
},
{
"name": "workspace-close-cancels-pending-selection-without-write",
"pass": true
},
{
"name": "workspace-independent-style-fixture-inserted",
"node": "76CAED9A-B4B1-4170-8249-57431BB1F01C",
"pass": true,
"validDocument": true
},
{
"commitWithinUndo": true,
"error": "none",
"name": "workspace-independent-style1-writes-target-node-inside-undo",
"nodePaths": {
"look0": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/49D00F24-30A8-4E5C-B83B-6569DA0D71AE/node.cube"
},
"pass": true,
"rootStyle1": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/49D00F24-30A8-4E5C-B83B-6569DA0D71AE/user-new.cube",
"undoStartsAfter": 3,
"undoStartsBefore": 2,
"written": true
},
{
"name": "workspace-relative-lut-path-is-rejected-before-undo",
"pass": true
},
{
"error": "宿主未保存此风格图层的 LUT,原来的选择已保留;请重试",
"name": "workspace-node-host-rejection-is-not-reported-as-applied",
"pass": true
},
{
"name": "workspace-deleted-node-does-not-write-another-layer",
"pass": true
},
{
"name": "workspace-offscreen-fixtures-never-presented",
"pass": true
},
{
"name": "workspace-final-output-sample-unpremultiplies-and-converts-real-icc",
"pass": true
},
{
"name": "workspace-final-output-worker-publishes-real-scope-rasters",
"pass": true
},
{
"name": "workspace-hidden-scope-capture-does-no-work",
"pass": true
},
{
"name": "inserted-tool-documents-have-validated-anchors",
"pass": true
@@ -2141,7 +2260,7 @@
"pass": true
},
{
"coveredPixels": 13508,
"coveredPixels": 24076,
"name": "native-osc-real-metal-overlay-transparent-around-controls",
"pass": true
},
@@ -2163,6 +2282,14 @@
"name": "native-osc-escape-discards-draft-without-host-edit",
"pass": true
},
{
"name": "native-osc-mask-gesture-keeps-capture-when-crossing-the-open-viewer-panel",
"pass": true
},
{
"name": "native-osc-mask-toolbar-stays-inside-small-letterboxed-image",
"pass": true
},
{
"name": "inspector-add-pen-enters-empty-drawing-mode",
"pass": true
@@ -3185,8 +3312,241 @@
{
"name": "relief-only-two-choices-and-no-text-glow",
"pass": true
},
{
"name": "viewer-bridge-published-snapshot-is-immutable-and-frame-bound",
"pass": true
},
{
"name": "viewer-bridge-drag-writes-before-mouse-up-asynchronously",
"pass": true
},
{
"name": "viewer-bridge-continuous-drag-closes-one-host-undo-group",
"pass": true
},
{
"name": "viewer-bridge-no-op-gesture-does-not-create-an-undo",
"pass": true
},
{
"name": "viewer-bridge-nonfinite-values-are-rejected",
"pass": true
},
{
"name": "viewer-bridge-values-are-clamped-to-the-existing-parameter-domain",
"pass": true
},
{
"name": "viewer-bridge-external-parameter-edit-wins-and-closes-the-group",
"pass": true
},
{
"name": "viewer-bridge-playhead-change-does-not-write-to-a-new-frame",
"pass": true
},
{
"name": "viewer-bridge-stale-snapshot-cannot-overwrite-current-values",
"pass": true
},
{
"name": "viewer-bridge-popup-writes-an-existing-discrete-value",
"pass": true
},
{
"name": "viewer-bridge-popup-values-outside-the-enumeration-are-rejected",
"pass": true
},
{
"name": "viewer-bridge-primary-master-eye-is-not-reactivated-by-the-bridge",
"pass": true
},
{
"name": "viewer-bridge-primary-edit-preserves-master-bypass-and-configures-cst",
"pass": true
},
{
"name": "viewer-bridge-external-primary-bypass-is-not-cleared-by-a-later-drag",
"pass": true
},
{
"name": "viewer-bridge-new-frame-publication-closes-an-abandoned-gesture",
"pass": true
},
{
"name": "viewer-bridge-invalid-node-and-wrong-module-descriptors-do-not-write",
"pass": true
},
{
"name": "viewer-bridge-independent-layer-keeps-root-and-other-layers-isolated",
"pass": true
},
{
"name": "viewer-bridge-deleted-layer-is-not-recreated-by-a-pending-drag",
"pass": true
},
{
"name": "viewer-bridge-removed-base-is-not-written-after-its-removal",
"pass": true
},
{
"name": "viewer-bridge-teardown-closes-a-live-undo-and-rejects-further-writes",
"pass": true
},
{
"name": "viewer-bridge-batch-begin-only-reads-and-preserves-unused-curve-slot",
"pass": true
},
{
"name": "viewer-bridge-curve-xy-are-live-in-one-host-action-before-mouse-up",
"pass": true
},
{
"name": "viewer-bridge-batch-continuous-xy-drag-uses-one-undo",
"pass": true
},
{
"name": "viewer-bridge-incomplete-nonfinite-and-foreign-key-samples-reject-the-entire-batch",
"pass": true
},
{
"name": "viewer-bridge-batch-no-op-does-not-create-an-undo",
"pass": true
},
{
"name": "viewer-bridge-external-y-edit-stops-both-axes-of-the-graphic-gesture",
"pass": true
},
{
"name": "viewer-bridge-one-stale-original-value-rejects-the-entire-graphic-gesture",
"pass": true
},
{
"name": "viewer-bridge-mixed-module-batch-is-rejected-before-any-write",
"pass": true
},
{
"name": "viewer-bridge-independent-curve-xy-commit-together-with-root-isolation",
"pass": true
},
{
"name": "viewer-bridge-single-value-entry-points-remain-compatible-after-batch-extension",
"pass": true
},
{
"name": "viewer-bridge-rejected-second-field-restores-first-field-within-the-same-action",
"pass": true
},
{
"name": "viewer-bridge-external-cst-configuration-conflict-stops-the-whole-color-wheel",
"pass": true
},
{
"name": "viewer-vertical-rail-exposes-fourteen-tools-without-a-parameter-panel",
"pass": true
},
{
"name": "viewer-tools-open-independent-panels-without-editing-the-grade",
"pass": true
},
{
"name": "viewer-dragging-header-moves-panel-with-final-release-point-and-no-undo",
"pass": true
},
{
"name": "viewer-label-and-knob-deadzone-do-not-create-edits",
"pass": true
},
{
"name": "viewer-slider-preserves-grab-offset-and-updates-live",
"pass": true
},
{
"name": "viewer-slider-captures-outside-and-closes-one-undo",
"pass": true
},
{
"name": "viewer-base-tone-and-color-eyes-remain-independent",
"pass": true
},
{
"name": "viewer-empty-removed-tool-never-terminates-another-panels-live-gesture",
"pass": true
},
{
"name": "viewer-curve-opens-an-editable-graph-beside-existing-panel",
"pass": true
},
{
"name": "viewer-curve-point-is-live-xy-not-a-scalar-only-control",
"pass": true
},
{
"name": "viewer-curve-final-release-commits-both-axes-with-one-undo",
"pass": true
},
{
"name": "viewer-curve-delete-deactivates-the-selected-slot",
"pass": true
},
{
"name": "viewer-curve-channel-switch-is-view-state-with-no-undo",
"pass": true
},
{
"name": "viewer-grading-wheel-edits-hue-and-saturation-in-one-gesture",
"pass": true
},
{
"name": "viewer-graph-panel-retains-precise-parameter-view",
"pass": true
},
{
"name": "viewer-graph-mode-and-page-buttons-never-overlap",
"pass": true
},
{
"name": "viewer-closing-one-panel-preserves-other-graph-and-controls",
"pass": true
},
{
"name": "viewer-floating-editor-layer-menu-selects-only-its-tool-type",
"pass": true
},
{
"name": "viewer-playhead-change-clears-graphic-capture",
"pass": true
},
{
"name": "viewer-missing-next-frame-snapshot-preserves-selected-independent-layer",
"pass": true
},
{
"name": "viewer-new-frame-restores-the-same-independent-editor-target",
"pass": true
},
{
"name": "viewer-deleted-layer-falls-back-to-surviving-same-tool",
"pass": true
},
{
"name": "viewer-small-and-retina-canvases-never-hit-outside-visible-image",
"pass": true
},
{
"name": "viewer-vertical-entry-remains-reachable-above-overlapping-small-panel",
"pass": true
},
{
"name": "viewer-rail-is-anchored-to-image-and-not-letterbox",
"pass": true
},
{
"name": "viewer-real-osc-draws-vertical-rail-curves-and-wheels-offscreen",
"pass": true,
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/49D00F24-30A8-4E5C-B83B-6569DA0D71AE/viewer-workspace.png"
}
],
"runtimePath": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/6E057B9B-8AC5-43F0-BDC7-9E12B90F5FD4",
"runtimePath": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/49D00F24-30A8-4E5C-B83B-6569DA0D71AE",
"scope": "Native model and renderer integration with real Metal/IOSurface textures and fake FxPlug host selectors; no GUI or live host document."
}
+16 -16
查看文件
@@ -1,7 +1,7 @@
{
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.8.5.pkg",
"sha256": "b4540c2be931d9e042ed1a6f2673c001e4b6e0ec67eef0bc22f4b3977af4952b",
"bytes": 43010987,
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.10.0.pkg",
"sha256": "ee70461c9b2d2e0ddd78cbcb3371c3b1b36b7f0e5fc69bfccc7ac0f1a3e468d8",
"bytes": 43090565,
"testUnsigned": false,
"installationExecuted": false,
"checks": [
@@ -31,27 +31,27 @@
"source": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
"payload": "Library/Plug-Ins/FxPlug/大鱼调色.app",
"bundleID": "com.dayu.color",
"version": "1.8.5",
"build": "67"
"version": "1.10.0",
"build": "72"
},
{
"source": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/pkg-inputs/大鱼调色",
"payload": "Library/Application Support/PKGForge/Payload/com.dayu.color.installer.052deb06-5148-446a-b040-d2db099b96b2/EAE801B2-8F49-44F7-9C89-A587C2E9D07A/大鱼调色"
"payload": "Library/Application Support/PKGForge/Payload/com.dayu.color.installer.ae106381-cd3b-41eb-aad0-4c68bc644dbf/C6873B3A-3897-4DC7-BBB3-39146B102C22/大鱼调色"
}
],
"signature": "Package \"大鱼调色-1.8.5.pkg\":\n Status: signed by a developer certificate issued by Apple for distribution\n Notarization: trusted by the Apple notary service\n Signed with a trusted timestamp on: 2026-11-04 06:28:34 +0000\n Certificate Chain:\n 1. Developer ID Installer: zhong luo (B3W25FX5H5)\n Expires: 2027-02-01 22:12:15 +0000\n SHA256 Fingerprint:\n C0 19 01 3C 67 88 8F 34 65 56 C5 91 3C E5 B6 12 4C 5D A6 DA F9 D8 \n DA 00 37 52 DF F0 F3 E6 00 B4\n ------------------------------------------------------------------------\n 2. Developer ID Certification Authority\n Expires: 2027-02-01 22:12:15 +0000\n SHA256 Fingerprint:\n 7A FC 9D 01 A6 2F 03 A2 DE 96 37 93 6D 4A FE 68 09 0D 2D E1 8D 03 \n F2 9C 88 CF B0 B1 BA 63 58 7F\n ------------------------------------------------------------------------\n 3. Apple Root CA\n Expires: 2035-02-09 21:40:36 +0000\n SHA256 Fingerprint:\n B0 B1 73 0E CB C7 FF 45 05 14 2C 49 F1 29 5E 6E DA 6B CA ED 7E 2C \n 68 C5 BE 91 B5 A1 10 01 F0 24",
"gatekeeper": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.8.5.pkg: accepted\nsource=Notarized Developer ID",
"signature": "Package \"大鱼调色-1.10.0.pkg\":\n Status: signed by a developer certificate issued by Apple for distribution\n Notarization: trusted by the Apple notary service\n Signed with a trusted timestamp on: 2026-11-04 14:43:02 +0000\n Certificate Chain:\n 1. Developer ID Installer: zhong luo (B3W25FX5H5)\n Expires: 2027-02-01 22:12:15 +0000\n SHA256 Fingerprint:\n C0 19 01 3C 67 88 8F 34 65 56 C5 91 3C E5 B6 12 4C 5D A6 DA F9 D8 \n DA 00 37 52 DF F0 F3 E6 00 B4\n ------------------------------------------------------------------------\n 2. Developer ID Certification Authority\n Expires: 2027-02-01 22:12:15 +0000\n SHA256 Fingerprint:\n 7A FC 9D 01 A6 2F 03 A2 DE 96 37 93 6D 4A FE 68 09 0D 2D E1 8D 03 \n F2 9C 88 CF B0 B1 BA 63 58 7F\n ------------------------------------------------------------------------\n 3. Apple Root CA\n Expires: 2035-02-09 21:40:36 +0000\n SHA256 Fingerprint:\n B0 B1 73 0E CB C7 FF 45 05 14 2C 49 F1 29 5E 6E DA 6B CA ED 7E 2C \n 68 C5 BE 91 B5 A1 10 01 F0 24",
"gatekeeper": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.10.0.pkg: accepted\nsource=Notarized Developer ID",
"pass": true,
"scope": "Expanded package structural and payload verification only; no installer scripts executed and no host quit or registration performed.",
"notarization": {
"id": "04fae6f1-7e38-4ab4-8c12-7bcae0ea77fd",
"createdDate": "2026-11-04T06:28:38.125Z",
"name": "大鱼调色-1.8.5.pkg",
"message": "Successfully received submission info",
"status": "Accepted"
"name": "大鱼调色-1.10.0.pkg",
"status": "Accepted",
"id": "9604cc73-153c-4751-ac5b-2cca76b4c219",
"createdDate": "2026-11-04T14:43:04.427Z",
"message": "Successfully received submission info"
},
"appCompiledSource": "d39004c26af3c0c5853111faef7e40e6c66f6aa6",
"appBuild": "67",
"appCompiledSource": "80dec904bedf5f704b29d16325fa95d639f3a250",
"appBuild": "72",
"packageBuilderRemote": "https://dayu.media/git/dayu/pkg-forge.git",
"packageBuilderCommit": "eb53707c0e67d8ddeab8c1270bb079f1050cfafe",
"templateSHA256": {
@@ -59,6 +59,6 @@
"large.png": "ab12611e8801cff86332ccc505a4cffa0c1120541c2efb9bb9908be2c9fe631a",
"small.png": "41fec3138aee904fc39d6982e6fde809243ffec55298dbfe966f4f48d89caf8a"
},
"installedAppHostAcceptance": "verification/HostTwoModes1.8.5.json",
"installedAppHostAcceptance": "verification/HostWorkspace1.10.0.json",
"installScope": "本轮仅生成并验包,未再次执行系统安装;正式 APP 已有独立宿主验收。"
}
+14 -13
查看文件
@@ -3,23 +3,24 @@
"repository": "dayu/dayu-color",
"repositoryID": 52,
"private": false,
"tag": "v1.8.4-refined-neon-20261104",
"releaseCommit": "fe7ddbd6f89b4ee3c7af9dd61e94d99056f414e8",
"releaseID": 385,
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.8.4-refined-neon-20261104",
"tag": "v1.8.5-light-dark-20261104",
"releaseCommit": "def8c2f6386a3d34453912b9e8f96e37e192796c",
"releaseID": 386,
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.8.5-light-dark-20261104",
"prerelease": true,
"assetID": 29,
"assetName": "大鱼调色-1.8.4.pkg",
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.8.4-refined-neon-20261104/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.8.4.pkg",
"bytes": 43009859,
"sha256": "59c8cee9282260ad97130b1d3d8dc6b09bdf8e8f82cb6c5937bf54ee5880e660",
"assetID": 30,
"assetName": "大鱼调色-1.8.5.pkg",
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.8.5-light-dark-20261104/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.8.5.pkg",
"bytes": 43010987,
"sha256": "b4540c2be931d9e042ed1a6f2673c001e4b6e0ec67eef0bc22f4b3977af4952b",
"existingAssetReused": true,
"verification": "Full draft download checked before publication; published attachment downloaded and checked again; release, tag and asset read-back verified.",
"credentialSource": "macOS Keychain: dayu-git-api",
"draftBrowserDownload": {
"path": "/Volumes/备份/大鱼调色-1.8.4.pkg",
"sha256": "59c8cee9282260ad97130b1d3d8dc6b09bdf8e8f82cb6c5937bf54ee5880e660",
"bytes": 43009859,
"sourceURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.8.4-refined-neon-20261104/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.8.4.pkg"
"path": "/Volumes/备份/大鱼调色-1.8.5.pkg",
"sha256": "b4540c2be931d9e042ed1a6f2673c001e4b6e0ec67eef0bc22f4b3977af4952b",
"bytes": 43010987,
"sourceURL": "https://dayu.media/git/attachments/5730c6a8-ec4f-4700-bd0c-e7b3bc501462",
"downloadedVia": "Existing signed-in Edge session; distinct completed download file"
}
}
+2 -1
查看文件
@@ -62,5 +62,6 @@
"installedAppHostAcceptance": "verification/HostDualSoft1.8.5.json",
"installScope": "本轮仅生成并验包,未再次执行系统安装;正式 APP 已有独立宿主验收。",
"supersededBeforeRelease": true,
"supersededPackageHeldAt": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/superseded-1.8.5-66.pkg"
"supersededPackageHeldAt": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/superseded-1.8.5-66.pkg",
"supersededPackageRemovedAfterFinalRelease": true
}
+20
查看文件
@@ -0,0 +1,20 @@
{
"passResult": true,
"scope": "Only this task’s verified generated copies and recovery clone; historical packages and private QA media preserved.",
"removedFiles": [
"/Volumes/备份/大鱼调色-1.8.5.pkg",
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/superseded-1.8.5-66.pkg",
"/tmp/dayu-soft-edit.py",
"/tmp/dayu-soft-inspector.py",
"/tmp/dayu-dark-relief.py",
"/tmp/dayu-two-modes.py"
],
"removedRecoveryClone": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/restore-soft-anic10xc",
"generatedBuildAppRemaining": [],
"generatedInstallBackupsRemaining": [],
"formalPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
"formalPackagePath": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.8.5.pkg",
"releaseID": 386,
"assetID": 30,
"finalInstalledSignatureTicketGatekeeper": true
}
+7 -1
查看文件
@@ -15,5 +15,11 @@
"minizip-ng-4.0.10.tar.gz",
"zlib-1.3.1.tar.gz",
"sse2neon-227cc413fb2d50b2a10073087be96b59d5364aea.tar.gz"
]
],
"releaseTag": "v1.8.5-light-dark-20261104",
"releaseTagCommit": "def8c2f6386a3d34453912b9e8f96e37e192796c",
"trackedFilesVerified": 498,
"compiledInputsMatchTag": true,
"releaseTagCheckedOut": true,
"temporaryCloneRemoved": true
}
+12
查看文件
@@ -0,0 +1,12 @@
{
"status": "draft-download-required",
"releaseID": 386,
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.8.5-light-dark-20261104",
"tag": "v1.8.5-light-dark-20261104",
"commit": "def8c2f6386a3d34453912b9e8f96e37e192796c",
"assetID": 30,
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.8.5-light-dark-20261104/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.8.5.pkg",
"bytes": 43010987,
"sha256": "b4540c2be931d9e042ed1a6f2673c001e4b6e0ec67eef0bc22f4b3977af4952b",
"requestedBrowserURL": "https://dayu.media/git/attachments/5730c6a8-ec4f-4700-bd0c-e7b3bc501462"
}
+17
查看文件
@@ -0,0 +1,17 @@
{
"status": "installed-awaiting-host-verification",
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
"bundleID": "com.dayu.color",
"version": "1.9.0",
"build": "68",
"team": "B3W25FX5H5",
"notaryID": "fa8512c4-c6e1-4822-a333-ef3d3e76235c",
"notaryStatus": "Accepted",
"gatekeeper": "/Library/Plug-Ins/FxPlug/大鱼调色.app: accepted\nsource=Notarized Developer ID",
"sourceCommit": "cc037340bf45e769e86a721a4fec8db440cf467e",
"templatePath": "/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef",
"templateSHA256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
"shaderSHA256": "38395fc34a3e3f222c34abc7b643df820f6a3c1a12eac52f2f9a6beaa0a7da76",
"previousInstallBackup": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-ed38e8c088e64ebfa3eac829b7fc04b1.app",
"hostResult": "Not accepted: collapsed viewer entry was drawn in letterbox; correcting viewport anchoring before final delivery."
}
+17
查看文件
@@ -0,0 +1,17 @@
{
"status": "installed-awaiting-host-verification",
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
"bundleID": "com.dayu.color",
"version": "1.9.0",
"build": "69",
"team": "B3W25FX5H5",
"notaryID": "bd821a49-f910-45f6-ad18-43d3b3398aab",
"notaryStatus": "Accepted",
"gatekeeper": "/Library/Plug-Ins/FxPlug/大鱼调色.app: accepted\nsource=Notarized Developer ID",
"sourceCommit": "0ab448d04f4fa61af1a371e17806df67b78a380b",
"templatePath": "/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef",
"templateSHA256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
"shaderSHA256": "38395fc34a3e3f222c34abc7b643df820f6a3c1a12eac52f2f9a6beaa0a7da76",
"previousInstallBackup": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-26e470123a7445029efa4dd24626dd3e.app",
"hostResult": "User confirmed parameter adjustment; clarified the whole panel cannot move and the other tools are not discoverable. Superseded by build70; not packaged or released."
}
+17
查看文件
@@ -0,0 +1,17 @@
{
"status": "notarized-installed-candidate-superseded-before-release",
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
"bundleID": "com.dayu.color",
"version": "1.10.0",
"build": "71",
"team": "B3W25FX5H5",
"notaryID": "5a78e3ed-2729-40ee-8962-f4c18a1c8e83",
"notaryStatus": "Accepted",
"gatekeeper": "/Library/Plug-Ins/FxPlug/大鱼调色.app: accepted\nsource=Notarized Developer ID",
"sourceCommit": "5cf4ba75b3b39dafebcfb5178a97e61d9005b878",
"templatePath": "/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef",
"templateSHA256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
"shaderSHA256": "bedde862e59d92dc2b0af19eba39ae35f77400a8553973b9180637f73dbb92e3",
"previousInstallBackup": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-f5faa3ad9588406299fbc75187b487ba.app",
"hostIssue": "FCP remote workspace scope body painted above header; title/page switch/close controls obscured. Native 691 checks passed but did not detect sibling overdraw. Root view clipping fix required; build72 will supersede."
}
+30
查看文件
@@ -0,0 +1,30 @@
{
"status": "accepted-app-copies-cleaned-release-package-pending",
"formalPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
"formalVersion": "1.9.0",
"formalBuild": "70",
"removedOldAppBackups": [
{
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-ed38e8c088e64ebfa3eac829b7fc04b1.app",
"build": "67",
"removed": true
},
{
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-26e470123a7445029efa4dd24626dd3e.app",
"build": "68",
"removed": true
},
{
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-7835c434a23c4136b7f09bae2ae96a4d.app",
"build": "69",
"removed": true
}
],
"deliveryGeneratedCopiesAbsent": [
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/DerivedData/Build/Products/Release/大鱼调色.app",
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/DerivedData/Build/Products/Release/大鱼调色 XPC Service.pluginkit",
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/notarization-submission.zip"
],
"userMediaAndPresetsPreserved": true,
"scope": "Only known backup APPs created by this task were removed after installed host acceptance. Historical installers and user data were retained."
}
+32
查看文件
@@ -0,0 +1,32 @@
{
"status": "remote-source-verified-awaiting-final-host-and-release",
"commit": "30d413dc423a739f0c00fede41ffde39f3e11cf0",
"remote": "https://dayu.media/git/dayu/dayu-color.git",
"trackedFiles": 511,
"fsck": true,
"trackedWorkingTreeClean": true,
"syntaxChecks": {
"DYPlugIn.mm": {
"passResult": true,
"returncode": 0
},
"DYDiagnostics.mm": {
"passResult": true,
"returncode": 0
}
},
"cxxStandard": "c++20",
"sourceArchivesVerified": [
"OpenColorIO-2.5.2.tar.gz",
"expat-2.7.2.tar.gz",
"yaml-cpp-0.8.0.tar.gz",
"Imath-3.2.1.tar.gz",
"pystring-1.1.4.tar.gz",
"minizip-ng-4.0.10.tar.gz",
"zlib-1.3.1.tar.gz",
"sse2neon-227cc413fb2d50b2a10073087be96b59d5364aea.tar.gz"
],
"lfs": false,
"submodules": false,
"scope": "Independent remote clone, Git object and clean-checkout checks, eight dependency archive hashes, fresh syntax compilation of both plugin and diagnostic translation units. CMS dependency rebuild was not repeated."
}
二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 426 KiB

二进制文件未显示。

之后

宽度:  |  高度:  |  大小: 27 KiB

@@ -0,0 +1,25 @@
{
"status": "accepted-app-copies-cleaned-package-notarized-article-updated-release-pending",
"formalPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
"formalBuild": 72,
"rollbackCopiesRetained": [],
"sourceRecoveryCheckout": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/osc-recovery",
"cacheAppPresent": false,
"looseXPCPresent": false,
"submissionZipPresent": false,
"package1100Created": false,
"release1100Published": false,
"scope": "User physical host checks passed. Only the two task-created, identity-verified, unused build70/71 recovery apps were removed under the product lock. Formal build72 and historical packages retained.",
"rollbackCopiesRemoved": [
{
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-f5faa3ad9588406299fbc75187b487ba.app",
"build": "70",
"removed": true
},
{
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-f610e41f0ca64e88becf04d0b0510b02.app",
"build": "71",
"removed": true
}
]
}
+40
查看文件
@@ -0,0 +1,40 @@
{
"status": "compiled-source-remotely-recovered-host-accepted",
"remote": "https://dayu.media/git/dayu/dayu-color.git",
"commit": "80dec904bedf5f704b29d16325fa95d639f3a250",
"trackedFiles": 526,
"fsck": true,
"trackedWorkingTreeClean": true,
"syntaxChecks": {
"DYPlugIn.mm": {
"passResult": true,
"returncode": 0
},
"DYDiagnostics.mm": {
"passResult": true,
"returncode": 0
},
"DYColorWorkspace.mm": {
"passResult": true,
"returncode": 0
},
"DYRenderer.mm": {
"passResult": true,
"returncode": 0
}
},
"cxxStandard": "c++20",
"sourceArchivesVerified": [
"OpenColorIO-2.5.2.tar.gz",
"expat-2.7.2.tar.gz",
"yaml-cpp-0.8.0.tar.gz",
"Imath-3.2.1.tar.gz",
"pystring-1.1.4.tar.gz",
"minizip-ng-4.0.10.tar.gz",
"zlib-1.3.1.tar.gz",
"sse2neon-227cc413fb2d50b2a10073087be96b59d5364aea.tar.gz"
],
"lfs": false,
"submodules": false,
"scope": "Independent remote checkout, source/object and eight pinned archive hashes verified; fresh syntax compilation of plugin, diagnostics, workspace and renderer. Full CMS dependency rebuild not repeated. Formal build72 passed 695 native checks; user physical curve drag/undo, LUT preview and live scope refresh checks passed."
}
+2
查看文件
@@ -57,6 +57,7 @@
"/Localized: Plugin/Localizable.strings",
Plugin/DYAutoGrade.mm,
Plugin/DYColorTables.mm,
Plugin/DYColorWorkspace.mm,
Plugin/DYDiagnostics.mm,
Plugin/DYGrade.metal,
Plugin/DYInspector.mm,
@@ -67,6 +68,7 @@
Plugin/DYModel.mm,
Plugin/DYPlugIn.mm,
Plugin/DYRenderer.mm,
Plugin/DYScopeSample.mm,
Plugin/DYTheme.mm,
Plugin/DYToolState.mm,
Plugin/DYTracking.metal,
+14
查看文件
@@ -0,0 +1,14 @@
#pragma once
#import <AppKit/AppKit.h>
#import <FxPlug/FxPlugSDK.h>
@class DYRenderer,DYLUTLibrary;
/// One host-owned auxiliary window, bound to the supplied clip/layer manager.
/// Close before that manager's underlying host/inspector is released.
@interface DYColorWorkspace : NSObject
- (instancetype)initWithManager:(id<PROAPIAccessing>)manager renderer:(DYRenderer *)renderer library:(DYLUTLibrary *)library title:(NSString *)title;
- (void)showRelativeToView:(NSView *)anchor;
- (void)close;
@property(nonatomic,readonly) BOOL visible;
@property(nonatomic,readonly) NSString *lastError;
- (void)updatePalette;
@end
+232
查看文件
@@ -0,0 +1,232 @@
#import "DYColorWorkspace.h"
#import "DYRenderer.h"
#import "DYLUTBrowser.h"
#import "DYLUTLibrary.h"
#import "DYTheme.h"
#import "DYToolState.h"
#include "DYScopeMath.hpp"
#include <cmath>
@class DYWorkspaceRoot;
@interface DYColorWorkspace (Internal)
- (void)layoutWorkspace;
- (void)scopeChanged:(NSNotification *)notification;
@end
@interface DYWorkspaceLifetime:NSObject
@property(nonatomic,assign) DYColorWorkspace *owner;
@end
@implementation DYWorkspaceLifetime @end
@interface DYWorkspaceRoot:NSView
@property(nonatomic,assign) DYColorWorkspace *owner;
@end
@implementation DYWorkspaceRoot
- (instancetype)initWithFrame:(NSRect)frame{if((self=[super initWithFrame:frame]))self.clipsToBounds=YES;return self;}
- (BOOL)isFlipped{return YES;}
- (BOOL)isOpaque{return YES;}
- (void)drawRect:(NSRect)dirty{[DYThemeColor(@"background")setFill];NSRectFill(NSIntersectionRect(dirty,self.bounds));}
- (void)resizeSubviewsWithOldSize:(NSSize)old{[super resizeSubviewsWithOldSize:old];[_owner layoutWorkspace];}
@end
@interface DYScopePlot:NSView
@property(nonatomic,copy) NSDictionary *metadata;
@property(nonatomic) NSInteger mode;
@end
@implementation DYScopePlot {
NSImage *_wave,*_parade;
}
- (BOOL)isFlipped{return YES;}
- (BOOL)isOpaque{return YES;}
- (void)dealloc{[_metadata release];[_wave release];[_parade release];[super dealloc];}
- (NSImage *)imageForData:(NSData *)data width:(NSUInteger)width{
if(data.length!=width*dyscope::Bins*4)return nil;
NSBitmapImageRep *rep=[[[NSBitmapImageRep alloc]initWithBitmapDataPlanes:nil pixelsWide:width pixelsHigh:dyscope::Bins bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:width*4 bitsPerPixel:32]autorelease];
if(!rep)return nil;memcpy(rep.bitmapData,data.bytes,data.length);NSImage *image=[[[NSImage alloc]initWithSize:NSMakeSize(width,dyscope::Bins)]autorelease];[image addRepresentation:rep];return image;
}
- (void)setMetadata:(NSDictionary *)metadata{
if(_metadata==metadata)return;[_metadata release];_metadata=[metadata copy];[_wave release];_wave=[[self imageForData:metadata[@"waveform"] width:dyscope::Width]retain];[_parade release];_parade=[[self imageForData:metadata[@"parade"] width:3*dyscope::Width]retain];
self.accessibilityLabel=[NSString stringWithFormat:@"%@,有效取样 %@,低于显示范围 %@,高于显示范围 %@",metadata[@"domain"]?:@"等待最终输出",metadata[@"valid"]?:@0,metadata[@"below"]?:@0,metadata[@"above"]?:@0];[self setNeedsDisplay:YES];
}
- (void)setMode:(NSInteger)mode{_mode=mode;[self setNeedsDisplay:YES];}
- (void)drawRect:(NSRect)dirty{
[[NSColor colorWithCalibratedWhite:.025 alpha:1]setFill];NSRectFill(self.bounds);
NSRect plot=NSMakeRect(48,24,MAX(1,self.bounds.size.width-66),MAX(1,self.bounds.size.height-52));
NSDictionary *text=@{NSFontAttributeName:[NSFont monospacedDigitSystemFontOfSize:10 weight:NSFontWeightRegular],NSForegroundColorAttributeName:[NSColor colorWithWhite:.64 alpha:1]};
if(_mode<2){NSImage *image=_mode==1?_parade:_wave;[NSGraphicsContext saveGraphicsState];NSGraphicsContext.currentContext.imageInterpolation=NSImageInterpolationNone;[image drawInRect:plot fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1 respectFlipped:YES hints:nil];[NSGraphicsContext restoreGraphicsState];
for(int percent : {-10,0,25,50,75,100,110}){CGFloat y=NSMaxY(plot)-(percent+10)/120.0*plot.size.height;[[NSColor colorWithWhite:(percent==0||percent==100)?.48:.3 alpha:.55]setStroke];NSBezierPath *line=[NSBezierPath bezierPath];[line moveToPoint:NSMakePoint(plot.origin.x,y)];[line lineToPoint:NSMakePoint(NSMaxX(plot),y)];[line stroke];[[NSString stringWithFormat:@"%d%%",percent]drawAtPoint:NSMakePoint(5,y-6) withAttributes:text];}
if(_mode==1){for(int i=0;i<3;i++){CGFloat x=plot.origin.x+i*plot.size.width/3;[[@[@"R",@"G",@"B"]objectAtIndex:i]drawAtPoint:NSMakePoint(x+8,NSMaxY(plot)+7) withAttributes:text];if(i){[[NSColor colorWithWhite:.4 alpha:.6]setStroke];NSBezierPath *p=[NSBezierPath bezierPath];[p moveToPoint:NSMakePoint(x,plot.origin.y)];[p lineToPoint:NSMakePoint(x,NSMaxY(plot))];[p stroke];}}}
else [@"画面横向位置" drawAtPoint:NSMakePoint(plot.origin.x,NSMaxY(plot)+7) withAttributes:text];
}else{
NSData *hist=_metadata[@"histogram"];if(hist.length==4*dyscope::Bins*sizeof(uint32_t)){
const auto *bins=(const uint32_t*)hist.bytes;uint32_t maximum=1;for(unsigned i=0;i<4*dyscope::Bins;i++)maximum=std::max(maximum,bins[i]);
NSArray *colors=@[[NSColor colorWithWhite:.82 alpha:.8],NSColor.systemRedColor,NSColor.systemGreenColor,NSColor.systemBlueColor];
for(unsigned c=0;c<4;c++){[colors[c]setStroke];NSBezierPath *line=[NSBezierPath bezierPath];for(unsigned b=0;b<dyscope::Bins;b++){NSPoint pt=NSMakePoint(plot.origin.x+b*plot.size.width/(dyscope::Bins-1),NSMaxY(plot)-std::log1p(double(bins[c*dyscope::Bins+b]))/std::log1p(double(maximum))*plot.size.height);if(!b)[line moveToPoint:pt];else[line lineToPoint:pt];}[line stroke];}
}[@"−10% R′G′B′ / Y′ · 对数计数 110%" drawAtPoint:NSMakePoint(plot.origin.x,NSMaxY(plot)+7) withAttributes:text];
}
if(!_metadata){NSString *s=@"等待最终输出帧\n请播放、移动时间线或调整颜色";NSMutableParagraphStyle *style=[[[NSMutableParagraphStyle alloc]init]autorelease];style.alignment=NSTextAlignmentCenter;[s drawInRect:NSInsetRect(plot,20,MAX(20,(plot.size.height-50)/2)) withAttributes:@{NSFontAttributeName:[NSFont systemFontOfSize:13],NSForegroundColorAttributeName:NSColor.secondaryLabelColor,NSParagraphStyleAttributeName:style}];}
}
@end
@interface DYColorWorkspace (){
id<PROAPIAccessing> _manager;
DYRenderer *_renderer;DYLUTLibrary *_library;DYLUTBrowser *_browser;
DYWorkspaceRoot *_root;NSView *_scopePane,*_lutPane;
DYScopePlot *_plot;
NSTextField *_heading,*_description,*_status,*_lutExplanation;
NSSegmentedControl *_pages;NSPopUpButton *_scopeMode;NSButton *_close,*_hostScopes;
DYWorkspaceLifetime *_lifetime;
NSProgress *_selectionTask;
NSView *_remoteParent;NSWindow *_presentationWindow;
NSString *_title,*_lastError;
BOOL _visible,_opening,_closed,_closing;
NSUInteger _session,_selectionID;
}
@end
@implementation DYColorWorkspace
- (instancetype)initWithManager:(id<PROAPIAccessing>)manager renderer:(DYRenderer *)renderer library:(DYLUTLibrary *)library title:(NSString *)title{
if((self=[super init])){
_manager=[manager retain];_renderer=[renderer retain];_library=[library retain];_title=[(title.length?title:@"大鱼调色")copy];_lifetime=[DYWorkspaceLifetime new];_lifetime.owner=self;
_root=[[DYWorkspaceRoot alloc]initWithFrame:NSMakeRect(0,0,1000,650)];_root.identifier=@"DYColorWorkspace";_root.owner=self;_root.accessibilityLabel=@"大鱼调色辅助工作区";
_heading=[[DYThemeLabel alloc]init];_heading.stringValue=[NSString stringWithFormat:@"%@ · 辅助工作区",_title];_heading.font=[NSFont systemFontOfSize:14 weight:NSFontWeightSemibold];[_root addSubview:_heading];
_pages=[[NSSegmentedControl alloc]init];_pages.segmentCount=2;[_pages setLabel:@"示波器" forSegment:0];[_pages setLabel:@"风格1 LUT" forSegment:1];_pages.selectedSegment=0;_pages.target=self;_pages.action=@selector(pageChanged:);_pages.accessibilityLabel=@"辅助工作区页面";[_root addSubview:_pages];
_close=[[DYThemeButton alloc]init];_close.title=@"关闭";_close.target=self;_close.action=@selector(closePressed:);_close.bezelStyle=NSBezelStyleRounded;[_root addSubview:_close];
_scopePane=[[DYWorkspaceRoot alloc]init];_scopePane.clipsToBounds=YES;[_root addSubview:_scopePane];_lutPane=[[NSView alloc]init];[_root addSubview:_lutPane];_lutPane.hidden=YES;
_scopeMode=[[DYThemePopUpButton alloc]init];[_scopeMode addItemsWithTitles:@[@"亮度波形",@"RGB 分列",@"直方图"]];_scopeMode.target=self;_scopeMode.action=@selector(scopeModeChanged:);_scopeMode.accessibilityLabel=@"示波器类型";[_scopePane addSubview:_scopeMode];
_hostScopes=[[DYThemeButton alloc]init];_hostScopes.title=@"FCP 示波器";_hostScopes.bezelStyle=NSBezelStyleRounded;_hostScopes.target=self;_hostScopes.action=@selector(toggleHostScopes:);_hostScopes.toolTip=@"打开或关闭 Final Cut Pro 自带的视频示波器;下方是大鱼的显示参考示波器";[_scopePane addSubview:_hostScopes];
_description=[[DYThemeLabel alloc]init];_description.font=[NSFont systemFontOfSize:11];[_scopePane addSubview:_description];
_plot=[[DYScopePlot alloc]init];_plot.accessibilityRole=NSAccessibilityImageRole;[_scopePane addSubview:_plot];
_status=[[DYThemeLabel alloc]init];_status.font=[NSFont systemFontOfSize:11];_status.maximumNumberOfLines=3;_status.lineBreakMode=NSLineBreakByWordWrapping;[_scopePane addSubview:_status];
_lutExplanation=[[DYThemeLabel alloc]init];_lutExplanation.font=[NSFont systemFontOfSize:11];_lutExplanation.stringValue=[NSString stringWithFormat:@"应用位置:%@ · 风格1。缩略图以输入画面预览;示波器查看最终调色结果。",_title];[_root addSubview:_lutExplanation];_lutExplanation.hidden=YES;
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(scopeChanged:) name:@"DYScopeDidChange" object:_renderer];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(previewChanged:) name:@"DYPreviewDidChange" object:_renderer];
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(themeChanged:) name:DYThemeDidChange object:nil];
[self updatePalette];[self scopeChanged:nil];[self layoutWorkspace];
}return self;
}
- (void)dealloc{
[self close];_lifetime.owner=nil;[NSNotificationCenter.defaultCenter removeObserver:self];_root.owner=nil;
[_manager release];[_renderer release];[_library release];[_browser release];[_root release];[_scopePane release];[_lutPane release];[_plot release];[_heading release];[_description release];[_status release];[_lutExplanation release];[_pages release];[_scopeMode release];[_close release];[_hostScopes release];[_title release];[_lastError release];[_lifetime release];[super dealloc];
}
- (BOOL)visible{return _visible||_opening;}
- (NSString *)lastError{return _lastError;}
- (id<FxCustomParameterActionAPI_v4>)actionAPI{return [_manager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];}
- (void)reportError:(NSString *)message{
[_lastError release];_lastError=[(message?:@"辅助工作区操作未完成")copy];_status.stringValue=_lastError;_status.toolTip=_lastError;
[NSNotificationCenter.defaultCenter postNotificationName:@"DYColorWorkspaceError" object:self userInfo:@{@"message":_lastError}];
}
- (void)showRelativeToView:(NSView *)anchor{
if(!NSThread.isMainThread){DYWorkspaceLifetime *token=_lifetime;dispatch_async(dispatch_get_main_queue(),^{[token.owner showRelativeToView:anchor];});return;}
if(_opening)return;_closed=NO;_lifetime.owner=self;_opening=YES;NSUInteger session=++_session;
[_lastError release];_lastError=nil;id<FxCustomParameterActionAPI_v4> action=[self actionAPI];
if(!action){_opening=NO;[self reportError:@"宿主暂时无法打开辅助工作区,请重新选择当前效果后重试"];return;}
DYWorkspaceLifetime *token=_lifetime;[action startAction:self];
@try{
id<FxRemoteWindowAPI_v3> v3=[_manager apiForProtocol:@protocol(FxRemoteWindowAPI_v3)];id<FxRemoteWindowAPI_v2> sizable=v3?:[_manager apiForProtocol:@protocol(FxRemoteWindowAPI_v2)];id<FxRemoteWindowAPI> remote=sizable?:[_manager apiForProtocol:@protocol(FxRemoteWindowAPI)];
void(^reply)(FxXPView *,NSError *)=^(FxXPView *parent,NSError *error){void(^attach)(void)=^{DYColorWorkspace *owner=token.owner;if(!owner||owner->_closed||owner->_session!=session)return;owner->_opening=NO;
if(!parent){[owner reportError:error.localizedDescription?:@"宿主未能创建辅助窗口"];return;}[owner attachToParent:parent];
};if(NSThread.isMainThread)attach();else dispatch_sync(dispatch_get_main_queue(),attach);};
if(sizable)[sizable remoteWindowWithMinimumSize:NSMakeSize(760,520) maximumSize:NSMakeSize(1800,1200) reply:reply];
else if(remote)[remote remoteWindowOfSize:NSMakeSize(1000,650) reply:reply];
else{_opening=NO;[self reportError:@"当前宿主未提供外部工具窗口接口"];}
}@finally{[action endAction:self];}
}
- (void)attachToParent:(NSView *)parent{
if(_remoteParent!=parent){if(_remoteParent)for(NSNotificationName name in @[NSViewFrameDidChangeNotification,NSViewBoundsDidChangeNotification])[NSNotificationCenter.defaultCenter removeObserver:self name:name object:_remoteParent];_remoteParent=parent;
parent.postsFrameChangedNotifications=YES;parent.postsBoundsChangedNotifications=YES;for(NSNotificationName name in @[NSViewFrameDidChangeNotification,NSViewBoundsDidChangeNotification])[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(parentChanged:) name:name object:parent];
}
[_root removeFromSuperview];_root.frame=parent.bounds;_root.autoresizingMask=NSViewWidthSizable|NSViewHeightSizable;[parent addSubview:_root];_visible=YES;_root.hidden=NO;[_renderer setScopeEnabled:_pages.selectedSegment==0];[self scopeChanged:nil];[self parentChanged:nil];
DYWorkspaceLifetime *token=_lifetime;NSUInteger session=_session;dispatch_async(dispatch_get_main_queue(),^{DYColorWorkspace *owner=token.owner;if(!owner||owner->_closed||owner->_session!=session)return;NSWindow *window=owner->_root.window;
if(window!=owner->_presentationWindow){if(owner->_presentationWindow)[NSNotificationCenter.defaultCenter removeObserver:owner name:NSWindowWillCloseNotification object:owner->_presentationWindow];[owner->_presentationWindow release];owner->_presentationWindow=[window retain];if(window)[NSNotificationCenter.defaultCenter addObserver:owner selector:@selector(remoteClosed:) name:NSWindowWillCloseNotification object:window];}
[owner parentChanged:nil];
});
}
- (void)parentChanged:(NSNotification *)notification{
if(!_visible||!_remoteParent)return;NSWindow *window=_remoteParent.window;
if(window&&_remoteParent==window.contentView&&_remoteParent.superview){NSRect content=[window convertRectFromScreen:[window contentRectForFrameRect:window.frame]];NSPoint origin=[_remoteParent.superview convertPoint:content.origin fromView:nil];if(std::isfinite(origin.x)&&std::isfinite(origin.y)&&!NSEqualPoints(_remoteParent.frame.origin,origin))[_remoteParent setFrameOrigin:origin];}
_root.frame=_remoteParent.bounds;[self layoutWorkspace];
}
- (void)layoutWorkspace{
CGFloat w=_root.bounds.size.width,h=_root.bounds.size.height;
_heading.frame=NSMakeRect(18,14,MAX(100,w-360),23);_pages.frame=NSMakeRect(MAX(150,w-320),12,228,27);_close.frame=NSMakeRect(MAX(0,w-80),12,64,27);
_scopePane.frame=NSMakeRect(0,52,w,MAX(1,h-52));_lutPane.frame=NSMakeRect(0,80,w,MAX(1,h-80));_lutExplanation.frame=NSMakeRect(18,52,MAX(1,w-36),24);
CGFloat ph=_scopePane.bounds.size.height;_scopeMode.frame=NSMakeRect(18,0,160,27);_hostScopes.frame=NSMakeRect(184,0,122,27);_description.frame=NSMakeRect(320,4,MAX(1,w-338),22);_plot.frame=NSMakeRect(18,39,MAX(1,w-36),MAX(1,ph-114));_status.frame=NSMakeRect(18,MAX(40,ph-64),MAX(1,w-36),58);
}
- (void)pageChanged:(id)sender{
BOOL lut=_pages.selectedSegment==1;_scopePane.hidden=lut;_lutPane.hidden=!lut;_lutExplanation.hidden=!lut;[_renderer setScopeEnabled:_visible&&!lut];if(lut)[self ensureBrowser];else[self scopeChanged:nil];
}
- (void)toggleHostScopes:(id)sender{
id<FxCustomParameterActionAPI_v4> action=[self actionAPI];NSError *error=nil;BOOL done=NO;if(action){[action startAction:self];@try{id<FxCommandAPI> commands=[_manager apiForProtocol:@protocol(FxCommandAPI)];done=[commands performCommand:kFxCommand_ToggleWaveforms error:&error];}@finally{[action endAction:self];}}
if(!done)[self reportError:error.localizedDescription?:@"当前宿主无法切换 FCP 示波器"];
}
- (void)scopeModeChanged:(id)sender{_plot.mode=_scopeMode.indexOfSelectedItem;}
- (void)scopeChanged:(NSNotification *)notification{
if(notification&&!_visible)return;NSDictionary *data=[_renderer scopeMetadata];_plot.metadata=data;
_description.toolTip=data?[NSString stringWithFormat:@"宿主输出配置:%@\n%@",data[@"source"],data[@"note"]]:nil;
_description.stringValue=data?[NSString stringWithFormat:@"%@ · %@ · 320 × 180",data[@"domain"],data[@"region"]]:@"最终输出 · 等待宿主渲染";
if(data){double t=[data[@"time"]doubleValue];NSString *frame=std::isfinite(t)?[NSString stringWithFormat:@"%.3f 秒",t]:@"静帧";
_status.stringValue=[NSString stringWithFormat:@"%@\n%@ · 有效 %@ · 透明 %@ · 非有限 %@ · 超出 −10%%/110%% %@/%@",([data[@"converted"]boolValue]?@"最终画面 · sRGB 显示参考;非 HDR / IRE 精密测量":@"空间未知:显示宿主 RGB 数值参考;不用于 HDR / IRE 测量"),frame,data[@"valid"],data[@"transparent"],data[@"nonfinite"],data[@"below"],data[@"above"]];
}else _status.stringValue=@"示波器采集当前效果的最终输出。播放、移动时间线或调整颜色后更新;透明像素不计入。";
}
- (void)previewChanged:(NSNotification *)notification{if(_visible&&_pages.selectedSegment==1)[_browser updatePreview:[_renderer lookLUTPreview]];}
- (void)themeChanged:(NSNotification *)notification{[self updatePalette];}
- (void)updatePalette{
[_root setNeedsDisplay:YES];for(NSTextField *label in @[_heading,_description,_status,_lutExplanation])label.textColor=DYThemeColor(label==_heading?@"text":@"secondary");[_browser updatePalette:DYThemePalette()];
}
- (void)ensureBrowser{
if(_browser.visible)return;[_browser release];_browser=nil;id<FxCustomParameterActionAPI_v4> action=[self actionAPI];if(!action){[self reportError:@"宿主暂时无法读取风格1"];return;}
NSString *selected=nil;[action startAction:self];@try{selected=[DYReadAssets(_manager,action.currentTime).paths[@"look0"]copy];}@finally{[action endAction:self];}
DYWorkspaceLifetime *token=_lifetime;
_browser=[[DYLUTBrowser alloc]initWithLibrary:_library preview:[_renderer lookLUTPreview] selectedPath:selected palette:DYThemePalette() selection:^NSProgress *(NSString *path,void(^completion)(NSError *)){DYColorWorkspace *owner=token.owner;if(owner&&!owner->_closed)return [owner selectLUT:path completion:completion];if(completion)completion([NSError errorWithDomain:NSCocoaErrorDomain code:NSUserCancelledError userInfo:nil]);return nil;}];[selected release];
[_browser embedInView:_lutPane close:^{DYColorWorkspace *owner=token.owner;if(owner&&!owner->_closing&&!owner->_closed){owner->_pages.selectedSegment=0;[owner pageChanged:nil];}}];
}
- (NSDictionary *)selectionContextAtTime:(CMTime)time{
id<PROAPIAccessing> host=[_manager isKindOfClass:DYToolManager.class]?[(DYToolManager*)_manager host]:_manager;
DYAssetState *local=DYReadAssets(_manager,time),*global=DYReadAssets(host,time);DYUniforms uniforms;DYReadUniforms(host,time,&uniforms);
NSMutableDictionary *cm=[NSMutableDictionary dictionary];for(NSDictionary *descriptor in DYDescriptors()){NSString *key=descriptor[@"key"];NSInteger offset=[descriptor[@"offset"]integerValue];if(offset>=0&&([key hasPrefix:@"cm"]||[key isEqual:@"inputProfile"]||[key isEqual:@"inputSectionEnabled"]))cm[key]=@(*(float*)((uint8_t*)&uniforms+offset));}
NSDictionary *state=@{@"look":local.paths[@"look0"]?:NSNull.null,@"colorManagement":global.colorManagement?:NSNull.null,@"inputPath":global.paths[@"input"]?:NSNull.null,@"colorParameters":cm};
return @{@"time":[NSData dataWithBytes:&time length:sizeof(time)],@"state":state};
}
- (NSDictionary *)selectionContext{
id<FxCustomParameterActionAPI_v4> action=[self actionAPI];if(!action)return nil;NSDictionary *context=nil;[action startAction:self];@try{context=[[self selectionContextAtTime:action.currentTime]copy];}@finally{[action endAction:self];}return [context autorelease];
}
- (NSProgress *)selectLUT:(NSString *)path completion:(void(^)(NSError *))completion{
[_selectionTask cancel];[_selectionTask release];_selectionTask=nil;NSUInteger selection=++_selectionID,session=_session;DYWorkspaceLifetime *token=_lifetime;NSDictionary *expected=[self selectionContext];
void(^prepared)(NSError *)=^(NSError *error){DYColorWorkspace *owner=token.owner;if(!owner||owner->_closed||owner->_session!=session||owner->_selectionID!=selection){if(completion)completion([NSError errorWithDomain:NSCocoaErrorDomain code:NSUserCancelledError userInfo:nil]);return;}
[owner->_selectionTask release];owner->_selectionTask=nil;NSError *result=error;if(!result)[owner commitLUT:path expected:expected error:&result];if(result)[owner reportError:result.localizedDescription];if(completion)completion(result);
};
if(!path.length||!expected){NSProgress *done=[NSProgress discreteProgressWithTotalUnitCount:1];done.completedUnitCount=1;dispatch_async(dispatch_get_main_queue(),^{prepared(nil);});return done;}
_selectionTask=[[_renderer prepareLUTPath:path completion:prepared]retain];return _selectionTask;
}
- (BOOL)commitLUT:(NSString *)path error:(NSError **)error{return [self commitLUT:path expected:[self selectionContext] error:error];}
- (BOOL)commitLUT:(NSString *)path expected:(NSDictionary *)expected error:(NSError **)error{
if(path.length&&(!path.isAbsolutePath||![[path.pathExtension lowercaseString]isEqual:@"cube"])){
if(error)*error=[NSError errorWithDomain:@"com.dayu.color.workspace" code:1 userInfo:@{NSLocalizedDescriptionKey:@"LUT 必须是完整路径的 .cube 文件,原来的选择已保留"}];return NO;
}
id<FxCustomParameterActionAPI_v4> action=[self actionAPI];BOOL written=NO;NSString *failure=nil;if(!action)failure=@"宿主暂时无法应用 LUT,请重新选择当前效果后重试";
else{id<FxCustomParameterActionAPI_v4> outer=[_manager isKindOfClass:DYToolManager.class]?[[(DYToolManager*)_manager host]apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)]:nil;
if(outer)[outer startAction:self];[action startAction:self];id<FxUndoAPI> undo=nil;BOOL grouped=NO;NSDictionary *wantedPaths=nil;CMTime commitTime=kCMTimeInvalid;@try{
CMTime time=action.currentTime,original=kCMTimeInvalid;NSData *encodedTime=expected[@"time"];if(encodedTime.length==sizeof(original))memcpy(&original,encodedTime.bytes,sizeof(original));
if(!CMTIME_IS_NUMERIC(time)||!CMTIME_IS_NUMERIC(original)||CMTimeCompare(time,original)!=0)failure=@"播放头已改变,未将先前的 LUT 选择写到新画面;请重新选择";
else if(![[self selectionContextAtTime:time][@"state"]isEqual:expected[@"state"]])failure=@"载入期间风格1或色彩管理已改变,已保留最新设置;请重新选择 LUT";
if(!failure&&[_manager isKindOfClass:DYToolManager.class]){DYToolManager *node=(DYToolManager*)_manager;if(![node.type isEqual:@"look"]||!DYToolWithID(DYReadTools(node.host,time).document,node.nodeID)){failure=@"此风格图层已删除或不再可编辑,未修改其它图层";}}
if(!failure&&![_manager isKindOfClass:DYToolManager.class]&&DYBaseToolRemoved(DYReadTools(_manager,time).document,@"look"))failure=@"基础风格工具已移除,请先恢复风格工具;未修改其它图层";
if(!failure){DYAssetState *assets=[[DYReadAssets(_manager,time)copy]autorelease];if(!assets)assets=[[[DYAssetState alloc]init]autorelease];NSMutableDictionary *paths=[[assets.paths mutableCopy]autorelease]?:[NSMutableDictionary dictionary];if(path.length)paths[@"look0"]=path;else[paths removeObjectForKey:@"look0"];assets.paths=paths;
wantedPaths=assets.paths;commitTime=time;undo=[_manager apiForProtocol:@protocol(FxUndoAPI)];grouped=[undo startUndoGroup:@"选择风格1 LUT"];written=DYWriteAssets(_manager,assets,time);if(!written)failure=@"宿主未接受此 LUT,原来的选择已保留";
}
}@finally{if(outer){[action endAction:self];
// DYToolManager stages custom assets and commits its host document in
// endAction. Its earlier setter BOOL does not report that final write.
// Read the actual target while the outer host action still grants access.
if(written){DYToolManager *node=(DYToolManager*)_manager;NSDictionary *stored=DYToolWithID(DYReadTools(node.host,commitTime).document,node.nodeID);if(!stored||![stored[@"paths"]isEqual:wantedPaths]){written=NO;failure=@"宿主未保存此风格图层的 LUT,原来的选择已保留;请重试";}}
if(grouped)[undo endUndoGroup];[outer endAction:self];}else{if(grouped)[undo endUndoGroup];[action endAction:self];}}}
if(written){if(path.length)[_library recordUsedPath:path];[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:[_manager isKindOfClass:DYToolManager.class]?[(DYToolManager*)_manager host]:_manager];}
else if(error)*error=[NSError errorWithDomain:@"com.dayu.color.workspace" code:1 userInfo:@{NSLocalizedDescriptionKey:failure?:@"LUT 操作未完成"}];return written;
}
- (void)closePressed:(id)sender{[self close];}
- (void)remoteClosed:(NSNotification *)notification{_closing=YES;[self close];_closing=NO;}
- (void)close{
if(_closed)return;BOOL hadPresentation=_visible||_opening||_remoteParent;_closed=YES;_visible=NO;_opening=NO;_session++;_selectionID++;[_selectionTask cancel];[_selectionTask release];_selectionTask=nil;[_renderer setScopeEnabled:NO];
BOOL wasClosing=_closing;_closing=YES;[_browser close];[_browser release];_browser=nil;
if(_remoteParent)for(NSNotificationName name in @[NSViewFrameDidChangeNotification,NSViewBoundsDidChangeNotification])[NSNotificationCenter.defaultCenter removeObserver:self name:name object:_remoteParent];_remoteParent=nil;
if(_presentationWindow)[NSNotificationCenter.defaultCenter removeObserver:self name:NSWindowWillCloseNotification object:_presentationWindow];[_presentationWindow release];_presentationWindow=nil;[_root removeFromSuperview];
if(hadPresentation&&!wasClosing){id<FxCustomParameterActionAPI_v4> action=[self actionAPI];if(action){[action startAction:self];@try{id<FxRemoteWindowAPI_v3> api=[_manager apiForProtocol:@protocol(FxRemoteWindowAPI_v3)];[api closeRemoteWindow];}@finally{[action endAction:self];}}}_closing=wasClosing;
}
@end
+7
查看文件
@@ -21,6 +21,8 @@
#include <cstring>
#include <vector>
#include "DYToolTrackingProbe.inc.h"
#import "DYViewerParameterProbe.h"
#import "DYViewerControlsProbe.h"
// Fake host objects implement the real selectors used by the model and renderer.
// They never connect to a host document or enter the FxPrincipal service loop.
@@ -90,6 +92,8 @@
if(!_custom[@(pid)]||!value)return NO;_custom[@(pid)]=[[value copy]autorelease];return YES;
}
@end
#include "DYWorkspaceDiagnosticHost.inc.h"
@interface DYDiagnosticTile : FxImageTile {
id<MTLTexture> _texture;
@@ -494,6 +498,7 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
run.record(@"user-folder-all-luts-prepared-and-rendered",userCount>0&&allUserFrames,@{@"files":@(userCount),@"sourceFolder":userFolder,@"sourceFilesModified":@NO});
}
#include "DYToolDiagnostics.inc.h"
#include "DYWorkspaceDiagnostics.inc.h"
#include "DYToolInsertionDiagnostics.inc.h"
#include "DYToolDeletionDiagnostics.inc.h"
#include "DYFilmDiagnostics.inc.h"
@@ -504,6 +509,8 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
#include "DYManagedDiagnostics.inc.h"
#include "DYPrimaryDiagnostics.inc.h"
#include "DYCompactUIDiagnostics.inc.h"
#include "DYViewerParameterDiagnostics.inc.h"
#include "DYViewerControlsDiagnostics.inc.h"
[gpu release];
} @catch(NSException *exception) {
run.record(@"diagnostic-exception",false,@{@"exception":exception.name?:@"unknown",@"message":exception.reason?:@"unknown"});
+12
查看文件
@@ -272,6 +272,18 @@ kernel void dyAnalysis(texture2d<half> source [[texture(0)]],
outRGBA[pixel.y * 320 + pixel.x] = float4(encoded, float(sample.a));
}
// Sample the actual final host destination before returning its tile. Point
// sampling avoids blending away nonfinite/out-of-range pixels. This is a
// bounded display-reference sample, not a full-resolution precision scope.
kernel void dyScopeSample(texture2d<float,access::read> source [[texture(0)]],
device float4* outRGBA [[buffer(0)]],constant uint& flip [[buffer(1)]],
uint2 pixel [[thread_position_in_grid]]) {
if(pixel.x>=320||pixel.y>=180)return;
uint2 xy=min(uint2((float2(pixel)+.5f)*float2(source.get_width(),source.get_height())/float2(320,180)),uint2(source.get_width()-1,source.get_height()-1));
if(flip)xy.y=source.get_height()-1-xy.y;
outRGBA[pixel.y*320+pixel.x]=source.read(xy);
}
// Native auto-grade statistics consume the input-converted RGB8 preview.
// Quantization before and after the LUT mirrors the reference NSImage path.
kernel void dyInputAnalysis(texture2d<half> source [[texture(0)]],
+16 -5
查看文件
@@ -11,6 +11,7 @@
#import "DYLUTLibrary.h"
#import "DYLUTBrowser.h"
#import "DYRenderer.h"
#import "DYColorWorkspace.h"
#include "DYSpiderState.h"
#import <QuartzCore/QuartzCore.h>
#include <cmath>
@@ -456,6 +457,7 @@ static NSImage *DYWheelImage(void) {
DYRenderer *_renderer;
DYLUTLibrary *_library;
DYLUTBrowser *_browser;
DYColorWorkspace *_workspace;NSButton *_workspaceButton;
NSArray *_themeButtons;
NSMutableDictionary *_tabs;
NSInteger _visibleLooks;
@@ -502,9 +504,10 @@ static NSImage *DYWheelImage(void) {
_export=[DYButton(@"导出 LUT",self,@selector(exportLUT:)) retain];
_colorSettings=[DYButton(@"颜色设置",self,@selector(toggleColorSettings:))retain];[_colorSettings setButtonType:NSButtonTypePushOnPushOff];_colorSettings.toolTip=@"展开或收起高级颜色设置;默认使用原有流程";_colorSettings.accessibilityLabel=@"颜色设置";_colorSettings.accessibilityValue=@"已收起";
_save.identifier=@"primaryAction";
_workspaceButton=[DYButton(@"◫ 工作区 · 示波器 / LUT",self,@selector(openWorkspace:))retain];_workspaceButton.accessibilityLabel=@"打开示波器与 LUT 工作区";
_addModule=[[DYThemePopUpButton alloc]initWithFrame:NSZeroRect pullsDown:YES];_addModule.font=[NSFont systemFontOfSize:11];_addModule.accessibilityLabel=@"添加模块";[_addModule addItemWithTitle:@"+ 添加模块"];
for(NSDictionary *section in DYPresentationSections()){NSMenuItem *item=[[[NSMenuItem alloc]initWithTitle:section[@"title"] action:@selector(addModule:) keyEquivalent:@""]autorelease];item.target=self;item.representedObject=section[@"key"];[_addModule.menu addItem:item];}
for(NSView *v in @[_brand,_subtitle,_websiteLink,_resetAll,_save,_load,_export,_colorSettings,_addModule]){[self addSubview:v];v.hidden=_embedded;}
for(NSView *v in @[_brand,_subtitle,_websiteLink,_resetAll,_save,_load,_export,_colorSettings,_addModule,_workspaceButton]){[self addSubview:v];v.hidden=_embedded;}
NSMutableArray *themes=[NSMutableArray array];for(NSInteger i=0;i<DYThemeNames().count;i++){
NSButton *b=DYButton(DYThemeNames()[i],self,@selector(selectTheme:));[b setButtonType:NSButtonTypePushOnPushOff];b.tag=i+7;b.identifier=@"appearanceToggle";
b.toolTip=[DYThemeNames()[i] stringByAppendingString:@"主题"];b.accessibilityLabel=b.toolTip;[self addSubview:b];b.hidden=_embedded;[themes addObject:b];
@@ -524,6 +527,7 @@ static NSImage *DYWheelImage(void) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(modelChanged:) name:@"DYModelChanged" object:_manager];
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(themeChanged:) name:DYThemeDidChange object:nil];
[NSWorkspace.sharedWorkspace.notificationCenter addObserver:self selector:@selector(themeChanged:) name:NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification object:nil];
if(!_embedded)[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(openWorkspace:) name:@"DYColorWorkspaceRequested" object:_manager];
if(_renderer)[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(previewChanged:) name:@"DYPreviewDidChange" object:_renderer];
[self themeChanged:nil];
[self setAccessibilityLabel:@"大鱼调色检查器"];
@@ -532,7 +536,7 @@ static NSImage *DYWheelImage(void) {
DYBetaSpanEnd(beta,nil);return self;
}
- (void)dealloc {
[self graphicGesture:NO title:nil];_spiderPanel.delegate=nil;
[self graphicGesture:NO title:nil];_spiderPanel.delegate=nil;[_workspace close];[_workspace release];[_workspaceButton release];
for(id graphic in _graphics)if([graphic isKindOfClass:DYPrimaryBalanceWheel.class])[(DYPrimaryBalanceWheel*)graphic setDelegate:nil];
for(NSProgress *p in _assetLoads.allValues)[p cancel];[_assetLoads release];[_assetLoadIDs release];[_menuScan cancel];[_menuScan release];[_pendingAssetMenuCommand release];
[[NSNotificationCenter defaultCenter] removeObserver:self];[NSWorkspace.sharedWorkspace.notificationCenter removeObserver:self];
@@ -553,7 +557,7 @@ static NSImage *DYWheelImage(void) {
- (NSSize)intrinsicContentSize { return NSMakeSize(360,780); }
- (void)viewDidMoveToWindow {
[super viewDidMoveToWindow];
if(!self.window){[self graphicGesture:NO title:nil];[self cancelAssetLoads];}
if(!self.window){[self graphicGesture:NO title:nil];[self cancelAssetLoads];[_workspace close];}
if(self.window) {
[self refresh];
NSAccessibilityPostNotification(self,NSAccessibilityLayoutChangedNotification);
@@ -569,6 +573,12 @@ static NSImage *DYWheelImage(void) {
_colorSettings.accessibilityValue=_colorSettingsExpanded?@"已展开":@"已收起";[self setNeedsLayout:YES];[self layoutSubtreeIfNeeded];
[_document scrollPoint:NSZeroPoint];NSAccessibilityPostNotification(self,NSAccessibilityLayoutChangedNotification);
}
- (void)openWorkspace:(id)sender {
if(_embedded||!self.window||!_renderer)return;
[_browser close];
if(!_workspace)_workspace=[[DYColorWorkspace alloc]initWithManager:_manager renderer:_renderer library:_library title:@"大鱼调色 · 当前片段"];
[_workspace showRelativeToView:self];
}
- (void)openWebsite:(id)sender {[[NSWorkspace sharedWorkspace]openURL:[NSURL URLWithString:@"https://dayu.media"]];}
- (void)redrawTree:(NSView *)view { [view setNeedsDisplay:YES];for(NSView *child in view.subviews)[self redrawTree:child]; }
- (void)themeChanged:(NSNotification *)notification {
@@ -578,7 +588,7 @@ static NSImage *DYWheelImage(void) {
for(NSButton *b in _themeButtons)b.state=b.tag==DYThemeIndex()?NSControlStateValueOn:NSControlStateValueOff;
_websiteLink.attributedTitle=[[[NSAttributedString alloc]initWithString:_websiteLink.title attributes:DYThemeTextAttributes(_websiteLink.font,DYAccent())]autorelease];
for(NSDictionary *r in _controls.allValues)[r[@"field"] setBackgroundColor:DYThemeColor(@"field")];
[_browser updatePalette:DYThemePalette()];[self redrawTree:self];
[_browser updatePalette:DYThemePalette()];[_workspace updatePalette];[self redrawTree:self];
}
- (void)tabChanged:(NSControl *)sender {
if([sender isKindOfClass:NSSegmentedControl.class])_tabs[sender.identifier]=@([(NSSegmentedControl *)sender selectedSegment]);
@@ -753,7 +763,7 @@ static NSImage *DYWheelImage(void) {
_websiteLink.frame=NSMakeRect(16,41,w-32,20);
CGFloat gap=7;BOOL compact=w<320;CGFloat bw=(w-32-gap*(compact?1:3))/(compact?2:4);
NSArray *actions=@[_save,_load,_export,_colorSettings];for(NSUInteger i=0;i<actions.count;i++)[actions[i]setFrame:NSMakeRect(16+(bw+gap)*(compact?i%2:i),74+(compact?i/2*34:0),bw,27)];
CGFloat top=compact?178:144;_addModule.frame=NSMakeRect(16,top-36,w-32,27);
CGFloat top=(compact?178:144)+34;_workspaceButton.frame=NSMakeRect(16,top-70,w-32,27);_addModule.frame=NSMakeRect(16,top-36,w-32,27);
_scroll.frame=_embedded?NSMakeRect(0,0,w,h):NSMakeRect(0,top,w,MAX(80,h-top));
CGFloat cw=MAX(244,_scroll.contentSize.width-32),y=8;
if(_managedPanel&&!_managedPanel.hidden){_managedPanel.frame=NSMakeRect(28,y,cw-24,_managedPanel.contentHeight);y+=_managedPanel.contentHeight+12;}
@@ -1052,6 +1062,7 @@ static NSImage *DYWheelImage(void) {
if([panel runModal]==NSModalResponseOK&&self.window)[self setAssetPath:panel.URL.path forKey:key];
}
- (void)browseAsset:(NSButton *)sender {
[_workspace close];
[_browser close];[_browser release];_browser=nil;
id<FxCustomParameterActionAPI_v4> a=[self actionAPI];if(!a)return;[a startAction:self];NSString *selected=nil;@try{selected=[DYReadAssets(_manager,a.currentTime).paths[sender.identifier]copy];}@finally{[a endAction:self];}
__block DYInspector *owner=self;NSString *key=[[sender.identifier copy]autorelease];
+3
查看文件
@@ -19,6 +19,9 @@ typedef NSProgress * (^DYLUTSelectionHandler)(NSString *path,void (^completion)(
/// Attach to the FxRemoteWindow API's supplied parent; the caller owns that API.
/// Completion, double-click and close dismiss through closeAction exactly once.
- (void)showInRemoteParent:(NSView *)parent close:(void (^)(void))closeAction;
/// Embedded content inside another remote tool workspace. It follows only the
/// supplied container and does not take ownership of the enclosing window.
- (void)embedInView:(NSView *)parent close:(void (^)(void))closeAction;
- (void)updatePalette:(NSDictionary *)palette;
/// Replace the source frame after the renderer captures a new playhead image.
/// Passing identical bytes keeps the current thumbnail jobs and cache intact.
+6 -2
查看文件
@@ -163,7 +163,7 @@ static void DYBrowserGeometrySample(NSView *root,NSString *phase){
NSCache *_thumbnailCache;
dispatch_queue_t _previewQueue;
DYBrowserWork *_work;
BOOL _closed,_sizing,_visible,_remoteMode,_importing,_layingOut,_detached;
BOOL _closed,_sizing,_visible,_remoteMode,_importing,_layingOut,_detached,_embedded;
NSProgress *_libraryTask,*_selectionTask;
NSTimer *_progressTimer;
NSUInteger _libraryGeneration,_selectionGeneration;
@@ -271,6 +271,9 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
if([NSUserDefaults.standardUserDefaults boolForKey:@"DYBrowserGeometryDiagnostics"])dispatch_after(dispatch_time(DISPATCH_TIME_NOW,NSEC_PER_SEC),dispatch_get_main_queue(),^{if(!_closed)DYBrowserGeometrySample(_root,@"settled");});
NSAccessibilityPostNotification(parent,NSAccessibilityLayoutChangedNotification);
}
- (void)embedInView:(NSView *)parent close:(void (^)(void))closeAction{
_embedded=YES;[self showInRemoteParent:parent close:closeAction];_done.title=@"返回示波器";
}
- (void)fitRemoteParent{
NSView *parent=_root.superview;if(_closed||!_remoteMode||!parent)return;
// A scaled-display ViewBridge service can hand us its top-level content
@@ -279,7 +282,7 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
// container. Align that content origin using AppKit's coordinate APIs;
// leave the host's window, content size and bridge resize policy intact.
NSWindow *window=parent.window;
if(window&&parent==window.contentView&&parent.superview){
if(!_embedded&&window&&parent==window.contentView&&parent.superview){
NSRect screenContent=[window contentRectForFrameRect:window.frame];
NSRect windowContent=[window convertRectFromScreen:screenContent];
NSPoint origin=[parent.superview convertPoint:windowContent.origin fromView:nil];
@@ -293,6 +296,7 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
DYBrowserGeometrySample(_root,notification.name);
}
- (void)configurePresentationWindow{
if(_embedded)return;
NSWindow *window=_root.window;if(!window||window==self.window)return;
if(_presentationWindow!=window){[_presentationWindow release];_presentationWindow=[window retain];
for(NSNotificationName name in @[NSWindowDidMoveNotification,NSWindowDidResizeNotification])[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(presentationGeometryChanged:) name:name object:window];
+4 -2
查看文件
@@ -12,6 +12,7 @@
#import <os/log.h>
#include "MaskCore/DYTracker.hpp"
#include <atomic>
#include "DYViewerParameterBridge.inc.h"
#include "DYToolHostDeclarations.inc.h"
#include "DYToolFlow.inc.h"
@implementation DYPlugIn {
@@ -29,12 +30,12 @@
- (NSView*)createViewForParameterID:(UInt32)pid{[self scheduleToolCanvasRegistration];return pid==DYInspectorParameterID?[[DYInspector alloc]initWithAPIManager:_apiManager renderer:_renderer]:[[NSView alloc]initWithFrame:NSZeroRect];}
- (BOOL)parameterChanged:(UInt32)pid atTime:(CMTime)t error:(NSError**)e{if(pid==DYToolsParameterID)[self adoptToolCanvasDocument:DYReadTools(_apiManager,t).document];if(pid==DYToolsParameterID||pid==2013||pid==2014||(pid>=2236&&pid<2400)||pid==DYAssetsParameterID)[_renderer invalidatePreview];dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self.apiManager];});return YES;}
- (BOOL)pluginState:(NSData**)state atTime:(CMTime)t quality:(FxQuality)q error:(NSError**)e{
DYUniforms u;DYReadUniforms(_apiManager,t,&u);CMTime frameDuration=kCMTimeInvalid,origin=kCMTimeZero;id<FxTimingAPI_v4>timing=[_apiManager apiForProtocol:@protocol(FxTimingAPI_v4)];if([timing respondsToSelector:@selector(frameDuration:)])[timing frameDuration:&frameDuration];if([timing respondsToSelector:@selector(startTimeForEffect:)])[timing startTimeForEffect:&origin];int64_t frame=DYFilmFrameIndex(t,frameDuration,origin);u.filmFrameKey=DYFilmFrameKey(frame,u.film.grainHold,u.film.grainSeed);DYAssetState*a=DYReadAssets(_apiManager,t);DYToolDocument *tools=DYReadTools(_apiManager,t);[self adoptToolCanvasDocument:tools.document];double copyAuto=0;[[_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getFloatValue:&copyAuto fromParameter:8800 atTime:t];NSMutableDictionary *snapshot=DYMutablePlist(DYToolRenderSnapshot(tools.document,t));for(NSMutableDictionary *node in snapshot[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"film"])node[@"filmFrameKey"]=@(DYFilmFrameKey(frame,layer.film.grainHold,layer.film.grainSeed));}NSInteger primaries=-1;id<FxColorGamutAPI_v2>gamut=[_apiManager apiForProtocol:@protocol(FxColorGamutAPI_v2)];if([gamut respondsToSelector:@selector(colorPrimaries)])primaries=gamut.colorPrimaries;NSDictionary*s=@{@"colorManagement":a.colorManagement?:@{},@"hostPrimaries":@(primaries),@"schema":@2,@"tools":snapshot,@"copyAuto":@(copyAuto>.5),@"uniforms":[NSData dataWithBytes:&u length:sizeof(u)],@"paths":a.paths?:@{},@"spider":a.spiderMesh?:[NSData data]};*state=[NSPropertyListSerialization dataWithPropertyList:s format:NSPropertyListBinaryFormat_v1_0 options:0 error:e];return *state!=nil;
DYUniforms u;DYReadUniforms(_apiManager,t,&u);CMTime frameDuration=kCMTimeInvalid,origin=kCMTimeZero;id<FxTimingAPI_v4>timing=[_apiManager apiForProtocol:@protocol(FxTimingAPI_v4)];if([timing respondsToSelector:@selector(frameDuration:)])[timing frameDuration:&frameDuration];if([timing respondsToSelector:@selector(startTimeForEffect:)])[timing startTimeForEffect:&origin];int64_t frame=DYFilmFrameIndex(t,frameDuration,origin);u.filmFrameKey=DYFilmFrameKey(frame,u.film.grainHold,u.film.grainSeed);DYAssetState*a=DYReadAssets(_apiManager,t);DYToolDocument *tools=DYReadTools(_apiManager,t);[self adoptToolCanvasDocument:tools.document];[_viewerParameterBridge publishUniforms:&u document:tools.document atTime:t];double copyAuto=0;[[_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getFloatValue:&copyAuto fromParameter:8800 atTime:t];NSMutableDictionary *snapshot=DYMutablePlist(DYToolRenderSnapshot(tools.document,t));for(NSMutableDictionary *node in snapshot[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"film"])node[@"filmFrameKey"]=@(DYFilmFrameKey(frame,layer.film.grainHold,layer.film.grainSeed));}NSInteger primaries=-1;id<FxColorGamutAPI_v2>gamut=[_apiManager apiForProtocol:@protocol(FxColorGamutAPI_v2)];if([gamut respondsToSelector:@selector(colorPrimaries)])primaries=gamut.colorPrimaries;NSDictionary*s=@{@"colorManagement":a.colorManagement?:@{},@"hostPrimaries":@(primaries),@"schema":@2,@"tools":snapshot,@"copyAuto":@(copyAuto>.5),@"uniforms":[NSData dataWithBytes:&u length:sizeof(u)],@"paths":a.paths?:@{},@"spider":a.spiderMesh?:[NSData data]};*state=[NSPropertyListSerialization dataWithPropertyList:s format:NSPropertyListBinaryFormat_v1_0 options:0 error:e];return *state!=nil;
}
- (BOOL)destinationImageRect:(FxRect*)rect sourceImages:(NSArray<FxImageTile*>*)src destinationImage:(FxImageTile*)dst pluginState:(NSData*)s atTime:(CMTime)t error:(NSError**)e{if(!src.count)return NO;*rect=src[0].imagePixelBounds;return YES;}
- (BOOL)sourceTileRect:(FxRect*)rect sourceImageIndex:(NSUInteger)i sourceImages:(NSArray<FxImageTile*>*)src destinationTileRect:(FxRect)dstRect destinationImage:(FxImageTile*)dst pluginState:(NSData*)s atTime:(CMTime)t error:(NSError**)e{if(i>=src.count)return NO;*rect=src[i].imagePixelBounds;return YES;}
- (BOOL)renderDestinationImage:(FxImageTile*)dst sourceImages:(NSArray<FxImageTile*>*)src pluginState:(NSData*)s atTime:(CMTime)t error:(NSError**)e{
if(!src.count||!src[0].ioSurface||!dst.ioSurface||!s.length)return NO;NSDictionary*p=[NSPropertyListSerialization propertyListWithData:s options:NSPropertyListImmutable format:NULL error:e];if(![p isKindOfClass:NSDictionary.class])return NO;NSData*b=p[@"uniforms"];if(![@[@1,@2]containsObject:p[@"schema"]]||![b isKindOfClass:NSData.class]||b.length!=sizeof(DYUniforms)||![p[@"paths"]isKindOfClass:NSDictionary.class])return NO;DYUniforms u;[b getBytes:&u length:sizeof(u)];uint64_t beta=!_betaFirstRenderStarted.exchange(true)?DYBetaSpanBegin(@"first_render",nil):0;BOOL ok=[_renderer renderSource:src[0] destination:dst uniforms:u paths:p[@"paths"] spider:p[@"spider"] tools:p[@"tools"] colorManagement:p[@"colorManagement"] hostPrimaries:p[@"hostPrimaries"]?[p[@"hostPrimaries"]integerValue]:-1 error:e];DYBetaSpanEnd(beta,@{@"status":ok?@"passed":@"failed"});if(!ok)DYBetaEvent(@"render_error",@{@"error_domain":(e&&*e)?(*e).domain:@"unknown",@"error_code":@((e&&*e)?(*e).code:0)});if(ok){if(_toolCaptureEnabled&&!_trackingActive.load()){dy::GrayFrame frame=[self toolGrayFrame:src[0] error:nil];if(frame.valid()){@synchronized(self){_toolSourceFrame=std::move(frame);_toolSourceTime=t;}}}BOOL analyze=NO;@synchronized(self){if(![p[@"copyAuto"]boolValue])_copyAnalyzed=NO;else if(!_copyAnalyzed){_copyAnalyzed=YES;analyze=YES;}}if(analyze){NSDictionary*values=DYAutoGrade([_renderer preview]);if(values)dispatch_async(dispatch_get_main_queue(),^{[self applyValues:values];});}}return ok;
if(!src.count||!src[0].ioSurface||!dst.ioSurface||!s.length)return NO;NSDictionary*p=[NSPropertyListSerialization propertyListWithData:s options:NSPropertyListImmutable format:NULL error:e];if(![p isKindOfClass:NSDictionary.class])return NO;NSData*b=p[@"uniforms"];if(![@[@1,@2]containsObject:p[@"schema"]]||![b isKindOfClass:NSData.class]||b.length!=sizeof(DYUniforms)||![p[@"paths"]isKindOfClass:NSDictionary.class])return NO;DYUniforms u;[b getBytes:&u length:sizeof(u)];uint64_t beta=!_betaFirstRenderStarted.exchange(true)?DYBetaSpanBegin(@"first_render",nil):0;BOOL ok=[_renderer renderSource:src[0] destination:dst uniforms:u paths:p[@"paths"] spider:p[@"spider"] tools:p[@"tools"] colorManagement:p[@"colorManagement"] hostPrimaries:p[@"hostPrimaries"]?[p[@"hostPrimaries"]integerValue]:-1 error:e];DYBetaSpanEnd(beta,@{@"status":ok?@"passed":@"failed"});if(!ok)DYBetaEvent(@"render_error",@{@"error_domain":(e&&*e)?(*e).domain:@"unknown",@"error_code":@((e&&*e)?(*e).code:0)});if(ok){[_renderer captureScopeTile:dst atTime:t];if(_toolCaptureEnabled&&!_trackingActive.load()){dy::GrayFrame frame=[self toolGrayFrame:src[0] error:nil];if(frame.valid()){@synchronized(self){_toolSourceFrame=std::move(frame);_toolSourceTime=t;}}}BOOL analyze=NO;@synchronized(self){if(![p[@"copyAuto"]boolValue])_copyAnalyzed=NO;else if(!_copyAnalyzed){_copyAnalyzed=YES;analyze=YES;}}if(analyze){NSDictionary*values=DYAutoGrade([_renderer preview]);if(values)dispatch_async(dispatch_get_main_queue(),^{[self applyValues:values];});}}return ok;
}
- (void)alert:(NSString*)message{dispatch_async(dispatch_get_main_queue(),^{NSAlert*a=[NSAlert new];a.messageText=@"大鱼调色";a.informativeText=message?:@"操作未完成";[a runModal];[a release];});}
- (void)exportRequested:(NSNotification*)n{
@@ -44,4 +45,5 @@
- (void)autoRequested:(NSNotification*)n{NSData*frame=[_renderer preview];[self applyValues:[n.name isEqual:@"DYAutoGrade"]?DYAutoGrade(frame):DYAutoWhiteBalance(frame)];}
- (void)whiteBalanceRequested:(NSNotification*)n{NSColor*c=[n.userInfo[@"color"]colorUsingColorSpace:NSColorSpace.sRGBColorSpace];if(!c)return;float temp=0,tint=0;if([DYColorTables neutralizeColor:(vector_float3){(float)c.redComponent,(float)c.greenComponent,(float)c.blueComponent} temperature:&temp tint:&tint])[self applyValues:@{@"temperature":@(temp),@"tint":@(tint)}];else [self alert:@"所选颜色过暗,请选择白色或中性灰区域。"];}
@end
#include "DYViewerControls.inc.h"
#include "DYToolOSC.inc.h"
+10
查看文件
@@ -20,6 +20,16 @@
/// Analysis preview retains the host texture's original row order separately.
- (NSData*)lookLUTPreview;
- (void)invalidatePreview;
/// Final-output scopes run only while the auxiliary workspace is visible.
- (void)setScopeEnabled:(BOOL)enabled;
/// Call after the final destination render succeeds, while the tile is valid.
/// Only the small GPU readback waits here; conversion/statistics are coalesced
/// on a worker. No main-queue wait or host API is performed by this method.
- (void)captureScopeTile:(FxImageTile *)tile atTime:(CMTime)time;
/// Straight float RGBA, 320x180, visually top row first. Consult metadata domain.
- (NSData *)scopePreview;
/// Includes waveform/parade RGBA8 rasters, histogram and honest color-domain labels.
- (NSDictionary *)scopeMetadata;
- (NSDictionary*)colorContext;
- (BOOL)renderSource:(FxImageTile*)source destination:(FxImageTile*)destination uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools colorManagement:(NSDictionary*)state hostPrimaries:(NSInteger)primaries error:(NSError**)error;
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools colorManagement:(NSDictionary*)state error:(NSError**)error;
+13 -3
查看文件
@@ -18,6 +18,8 @@
#include <zlib.h>
#include <vector>
#include <cmath>
#include "DYScopeMath.hpp"
#import "DYScopeSample.h"
static BOOL fail(NSError**e,NSString*m){if(e)*e=[NSError errorWithDomain:@"com.dayu.color" code:1 userInfo:@{NSLocalizedDescriptionKey:m?:@"Metal 调色失败"}];return NO;}
// MRC NSError out-parameters must outlive every nested render pool. Preserve
// the same pointer across nested closures, then autorelease in the caller pool.
@@ -111,15 +113,23 @@ static NSArray *DYPrimaryActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
BOOL _exporting;
NSDictionary *_toolDocument,*_colorContext,*_exportManagedState;
BOOL _managedFinishing;
dispatch_queue_t _scopeQueue;
BOOL _scopeEnabled,_scopeWorkerRunning;
NSUInteger _scopeGeneration;
DYScopeSample *_scopePending;
NSData *_scopePreview;
NSDictionary *_scopeMetadata;
DYColorProfile *_scopeProfile;
}
@end
@implementation DYRenderer
#include "DYScopeCapture.inc.h"
#include "DYFilmRender.inc.h"
#include "DYPrimaryRender.inc.h"
#include "DYManagedRender.inc.h"
#include "DYToolRender.inc.h"
- (instancetype)init{if((self=[super init])){_previewLock=[NSObject new];_devices=[NSMutableDictionary new];_luts=[NSMutableDictionary new];_preparedLUTs=[NSMutableDictionary new];_activeLUTPaths=[NSSet new];_lutPreparationQueue=dispatch_queue_create("com.dayu.color.lut-upload",DISPATCH_QUEUE_SERIAL);dispatch_set_target_queue(_lutPreparationQueue,dispatch_get_global_queue(QOS_CLASS_USER_INITIATED,0));_tables=[DYColorTables new];}return self;}
- (void)dealloc{[_devices release];[_luts release];[_preparedLUTs release];[_activeLUTPaths release];dispatch_release(_lutPreparationQueue);[_tables release];[_preview release];[_lookLUTPreview release];[_histogram release];[_colorContext release];[_previewLock release];[super dealloc];}
- (instancetype)init{if((self=[super init])){_previewLock=[NSObject new];_scopeQueue=dispatch_queue_create("com.dayu.color.final-output-scopes",DISPATCH_QUEUE_SERIAL);_devices=[NSMutableDictionary new];_luts=[NSMutableDictionary new];_preparedLUTs=[NSMutableDictionary new];_activeLUTPaths=[NSSet new];_lutPreparationQueue=dispatch_queue_create("com.dayu.color.lut-upload",DISPATCH_QUEUE_SERIAL);dispatch_set_target_queue(_lutPreparationQueue,dispatch_get_global_queue(QOS_CLASS_USER_INITIATED,0));_tables=[DYColorTables new];}return self;}
- (void)dealloc{[_scopePending release];[_scopePreview release];[_scopeMetadata release];[_scopeProfile release];dispatch_release(_scopeQueue);[_devices release];[_luts release];[_preparedLUTs release];[_activeLUTPaths release];dispatch_release(_lutPreparationQueue);[_tables release];[_preview release];[_lookLUTPreview release];[_histogram release];[_colorContext release];[_previewLock release];[super dealloc];}
- (void)trimPreparedLUTsKeeping:(NSString *)path {
if(_preparedLUTs.count<=12)return;
for(NSString *key in _preparedLUTs.allKeys)if(![_activeLUTPaths containsObject:key]&&![key isEqualToString:path])[_preparedLUTs removeObjectForKey:key];
@@ -153,7 +163,7 @@ static NSArray *DYPrimaryActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
NSURL*url=[[NSBundle bundleForClass:self.class]URLForResource:@"default" withExtension:@"metallib"];
id<MTLLibrary>lib=[d newLibraryWithURL:url error:err];if(!lib){[d release];return nil;}
id<MTLCommandQueue>q=[d newCommandQueue];entry=[NSMutableDictionary dictionaryWithDictionary:@{@"device":d,@"library":lib,@"queue":q,@"pipelines":[NSMutableDictionary dictionary]}];
for(NSString*fn in @[@"dyUnpremultiply",@"dyWhitesSceneStatistics",@"dyLUTExportKernel",@"dyInputAnalysis",@"dyColorManagement",@"dyToolBlend",@"dyToolSkin",@"dyFilmPoint",@"dyFilmNoise",@"dyFilmSparseBlur",@"dyFilmBloomEdges",@"dyFilmMix",@"dyFilmPrint"]){id<MTLFunction>f=[lib newFunctionWithName:fn];if(!f){fail(err,[fn stringByAppendingString:@" 缺失"]);[lib release];[q release];[d release];return nil;}uint64_t pipelineSpan=DYBetaSpanBegin(@"gpu_pipeline",@{@"pipeline":fn,@"gpu":d.name?:@"unknown"});id<MTLComputePipelineState>p=[d newComputePipelineStateWithFunction:f error:err];DYBetaSpanEnd(pipelineSpan,@{@"status":p?@"passed":@"failed"});[f release];if(!p){[lib release];[q release];[d release];return nil;}entry[fn]=p;[p release];}
for(NSString*fn in @[@"dyUnpremultiply",@"dyWhitesSceneStatistics",@"dyLUTExportKernel",@"dyInputAnalysis",@"dyScopeSample",@"dyColorManagement",@"dyToolBlend",@"dyToolSkin",@"dyFilmPoint",@"dyFilmNoise",@"dyFilmSparseBlur",@"dyFilmBloomEdges",@"dyFilmMix",@"dyFilmPrint"]){id<MTLFunction>f=[lib newFunctionWithName:fn];if(!f){fail(err,[fn stringByAppendingString:@" 缺失"]);[lib release];[q release];[d release];return nil;}uint64_t pipelineSpan=DYBetaSpanBegin(@"gpu_pipeline",@{@"pipeline":fn,@"gpu":d.name?:@"unknown"});id<MTLComputePipelineState>p=[d newComputePipelineStateWithFunction:f error:err];DYBetaSpanEnd(pipelineSpan,@{@"status":p?@"passed":@"failed"});[f release];if(!p){[lib release];[q release];[d release];return nil;}entry[fn]=p;[p release];}
float identity[32];for(int z=0;z<2;z++)for(int y=0;y<2;y++)for(int x=0;x<2;x++){int i=((z*2+y)*2+x)*4;identity[i]=x;identity[i+1]=y;identity[i+2]=z;identity[i+3]=1;}id<MTLTexture>neutral=texture3D(d,identity,2);if(!neutral){fail(err,@"无法分配中性 LUT");return nil;}entry[@"identity"]=neutral;
// Preparing before the first frame may use registry 0. Reuse those pipelines
// when the host subsequently supplies that device's actual registry ID.
+61
查看文件
@@ -0,0 +1,61 @@
// Included in DYRenderer's implementation; final destination sampling is kept
// separate from the earlier input-analysis thumbnail used by auto-grade/LUTs.
- (void)setScopeEnabled:(BOOL)enabled{
@synchronized(_previewLock){if(_scopeEnabled==enabled)return;_scopeEnabled=enabled;_scopeGeneration++;[_scopePending release];_scopePending=nil;if(enabled){[_scopePreview release];_scopePreview=nil;[_scopeMetadata release];_scopeMetadata=nil;}}
}
- (NSData *)scopePreview{@synchronized(_previewLock){return [[_scopePreview retain]autorelease];}}
- (NSDictionary *)scopeMetadata{@synchronized(_previewLock){return [[_scopeMetadata retain]autorelease];}}
- (void)captureScopeTile:(FxImageTile *)tile atTime:(CMTime)time{
NSUInteger generation;@synchronized(_previewLock){if(!_scopeEnabled||_exporting||!tile)return;generation=_scopeGeneration;}
@autoreleasepool{@try{
NSDictionary *entry=nil,*context=nil;@synchronized(self){entry=[[self device:tile.deviceRegistryID error:nil]retain];context=[_colorContext copy];}
id<MTLDevice>device=entry[@"device"];id<MTLTexture>texture=[tile metalTextureForDevice:device];
if(!entry||!texture||!texture.width||!texture.height||texture.framebufferOnly){[entry release];[context release];return;}
id<MTLBuffer>buffer=[device newBufferWithLength:dyscope::Width*dyscope::Height*sizeof(dyscope::RGBA) options:MTLResourceStorageModeShared];
id<MTLCommandBuffer>command=[entry[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>encoder=[command computeCommandEncoder];
if(!buffer||!encoder){[buffer release];[entry release];[context release];return;}
uint32_t flip=tile.imageOrigin==kFxImageOrigin_BOTTOM_LEFT;[encoder setComputePipelineState:entry[@"dyScopeSample"]];[encoder setTexture:texture atIndex:0];[encoder setBuffer:buffer offset:0 atIndex:0];[encoder setBytes:&flip length:sizeof(flip) atIndex:1];
[encoder dispatchThreads:MTLSizeMake(dyscope::Width,dyscope::Height,1) threadsPerThreadgroup:MTLSizeMake(8,8,1)];[encoder endEncoding];[command commit];
// The host may recycle its destination as soon as render returns. Complete
// only this 320x180 readback while that ownership is still guaranteed.
// CPU profile conversion, plotting and UI notification do not block render.
[command waitUntilCompleted];
if(command.status!=MTLCommandBufferStatusCompleted){[buffer release];[entry release];[context release];return;}
DYScopeSample *sample=[DYScopeSample new];sample.pixels=[NSData dataWithBytes:buffer.contents length:buffer.length];sample.generation=generation;
CGColorSpaceRef sourceSpace=DYManagedTileSpace(tile,[context[@"primaries"]integerValue]);sample.space=sourceSpace;if(sourceSpace)CGColorSpaceRelease(sourceSpace);
FxRect bounds=tile.tilePixelBounds,image=tile.imagePixelBounds;BOOL whole=bounds.left==image.left&&bounds.right==image.right&&bounds.top==image.top&&bounds.bottom==image.bottom;
sample.metadata=@{@"time":@(CMTimeGetSeconds(time)),@"timeValue":@(time.value),@"timeScale":@(time.timescale),@"source":context[@"destination"]?:@"宿主 RGB",@"wholeImage":@(whole),@"region":whole?@"整帧取样":@"仅当前宿主输出分块",@"width":@(dyscope::Width),@"height":@(dyscope::Height)};
[buffer release];[entry release];[context release];
BOOL start=NO;@synchronized(_previewLock){if(_scopeEnabled&&generation==_scopeGeneration){[_scopePending release];_scopePending=[sample retain];if(!_scopeWorkerRunning){_scopeWorkerRunning=YES;start=YES;}}}[sample release];
if(start)dispatch_async(_scopeQueue,^{[self processPendingScopeSamples];});
}@catch(NSException *exception){/* Scope diagnostics must never fail rendering. */}}
}
- (void)processPendingScopeSamples{
for(;;){@autoreleasepool{
DYScopeSample *sample=nil;@synchronized(_previewLock){sample=_scopePending;_scopePending=nil;if(!sample){_scopeWorkerRunning=NO;return;}}
const auto *raw=(const dyscope::RGBA*)sample.pixels.bytes;size_t count=sample.pixels.length/sizeof(dyscope::RGBA);std::vector<DYCompositeRGBA> pixels(count);uint64_t invalid=0;
for(size_t i=0;i<count;i++){
const auto&p=raw[i];BOOL finite=std::isfinite(p.r)&&std::isfinite(p.g)&&std::isfinite(p.b)&&std::isfinite(p.a);
if(!finite){invalid++;pixels[i]={0,0,0,0};continue;}
if(p.a<=1e-6f){pixels[i]={0,0,0,0};continue;}
pixels[i]={p.r/p.a,p.g/p.a,p.b/p.a,p.a};
if(!(std::isfinite(pixels[i].r)&&std::isfinite(pixels[i].g)&&std::isfinite(pixels[i].b))){invalid++;pixels[i]={0,0,0,0};}
}
NSError *error=nil;BOOL converted=NO;CGColorSpaceRef target=CGColorSpaceCreateWithName(kCGColorSpaceExtendedSRGB);
if(sample.space&&target){
if(!_scopeProfile||!CFEqual(_scopeProfile.source,sample.space)){[_scopeProfile release];_scopeProfile=[[DYColorProfile alloc]initWithSource:sample.space target:target error:&error];}
if(_scopeProfile){auto result=[_scopeProfile convertPixels:pixels alpha:dycm::Alpha::Straight budget:32ull*1024*1024 cancelled:nullptr error:&error];if(result){pixels=std::move(*result);converted=YES;}}
}if(target)CGColorSpaceRelease(target);
std::vector<dyscope::RGBA> reference;reference.reserve(pixels.size());for(const auto&p:pixels)reference.push_back({p.r,p.g,p.b,p.a});
auto measurements=dyscope::measure(reference);measurements.nonfinite+=invalid;
auto wave=dyscope::densityImage(measurements.wave,false),parade=dyscope::densityImage(measurements.parade,true);
NSMutableDictionary *metadata=[[sample.metadata mutableCopy]autorelease];
metadata[@"domain"]=converted?@"sRGB 显示参考":@"宿主 RGB(未换算)";
metadata[@"note"]=converted?@"最终输出 · ICC 转扩展 sRGB · R′G′B′ 百分比;非 HDR / IRE 精密测量":(error?[NSString stringWithFormat:@"RGB 原值参考 · %@;波形按 709 权重参考,非 IRE",error.localizedDescription]:@"最终输出 · 空间未知;RGB 原值 / 709 权重波形参考,非显示 / HDR / IRE 测量");
metadata[@"converted"]=@(converted);metadata[@"minimum"]=@(measurements.minimum);metadata[@"maximum"]=@(measurements.maximum);metadata[@"valid"]=@(measurements.valid);metadata[@"transparent"]=@(measurements.transparent>=invalid?measurements.transparent-invalid:0);metadata[@"nonfinite"]=@(measurements.nonfinite);metadata[@"below"]=@(measurements.below);metadata[@"above"]=@(measurements.above);
metadata[@"waveform"]=[NSData dataWithBytes:wave.data() length:wave.size()];metadata[@"parade"]=[NSData dataWithBytes:parade.data() length:parade.size()];metadata[@"histogram"]=[NSData dataWithBytes:measurements.histogram.data() length:sizeof(measurements.histogram)];
BOOL publish=NO;@synchronized(_previewLock){if(_scopeEnabled&&sample.generation==_scopeGeneration){[_scopePreview release];_scopePreview=[[NSData alloc]initWithBytes:pixels.data() length:pixels.size()*sizeof(DYCompositeRGBA)];[_scopeMetadata release];_scopeMetadata=[metadata copy];publish=YES;}}
NSUInteger generation=sample.generation;[sample release];
if(publish)dispatch_async(dispatch_get_main_queue(),^{BOOL active=NO;@synchronized(_previewLock){active=_scopeEnabled&&generation==_scopeGeneration;}if(active)[NSNotificationCenter.defaultCenter postNotificationName:@"DYScopeDidChange" object:self];});
}}
}
+49
查看文件
@@ -0,0 +1,49 @@
#pragma once
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdint>
#include <span>
#include <vector>
// Display-reference measurements only. Values remain unclipped; the plot
// covers -10%...110% and explicitly counts samples beyond that range.
namespace dyscope {
inline constexpr unsigned Width=320,Height=180,Bins=256;
inline constexpr float Low=-.1f,High=1.1f;
struct RGBA { float r,g,b,a; };
struct Result {
std::vector<uint32_t> wave=std::vector<uint32_t>(Width*Bins),parade=std::vector<uint32_t>(3*Width*Bins);
std::array<uint32_t,4*Bins> histogram{};
uint64_t valid=0,transparent=0,nonfinite=0,below=0,above=0;
float minimum=0,maximum=0;
};
inline unsigned bin(float v){if(!(v>Low))return 0;if(v>=High)return Bins-1;return unsigned(std::clamp(std::lround((v-Low)/(High-Low)*(Bins-1)),0l,long(Bins-1)));}
inline Result measure(std::span<const RGBA> pixels,unsigned width=Width,unsigned height=Height){
Result r;if(!width||!height||pixels.size()!=size_t(width)*height)return r;bool first=true;
for(unsigned y=0;y<height;y++)for(unsigned x=0;x<width;x++){
const auto&p=pixels[size_t(y)*width+x];
if(!(std::isfinite(p.r)&&std::isfinite(p.g)&&std::isfinite(p.b)&&std::isfinite(p.a))){r.nonfinite++;continue;}
if(p.a<=1e-6f){r.transparent++;continue;}
float values[4]={.2126f*p.r+.7152f*p.g+.0722f*p.b,p.r,p.g,p.b};unsigned column=std::min(Width-1,unsigned(uint64_t(x)*Width/width));
for(unsigned c=0;c<4;c++){
float v=values[c];unsigned b=bin(v);r.histogram[c*Bins+b]++;
if(!c)r.wave[(Bins-1-b)*Width+column]++;
else r.parade[(Bins-1-b)*(3*Width)+(c-1)*Width+column]++;
}
float lo=std::min({p.r,p.g,p.b}),hi=std::max({p.r,p.g,p.b});if(first){r.minimum=lo;r.maximum=hi;first=false;}else{r.minimum=std::min(r.minimum,lo);r.maximum=std::max(r.maximum,hi);}
r.below+=lo<Low;r.above+=hi>High;r.valid++;
}
return r;
}
inline std::vector<uint8_t> densityImage(std::span<const uint32_t> counts,bool parade){
std::vector<uint8_t> out(counts.size()*4);uint32_t maximum=0;for(uint32_t n:counts)maximum=std::max(maximum,n);
float divisor=std::log1p(float(maximum));unsigned width=parade?3*Width:Width;
for(size_t i=0;i<counts.size();i++){
float intensity=counts[i]&&divisor>0?std::pow(std::log1p(float(counts[i]))/divisor,.65f):0;
unsigned channel=parade?unsigned(i%width)/Width:3;uint8_t v=uint8_t(std::lround(intensity*255));
out[i*4]=channel==0||channel==3?v:uint8_t(v*.14f);out[i*4+1]=channel==1||channel==3?v:uint8_t(v*.14f);out[i*4+2]=channel==2||channel==3?v:uint8_t(v*.14f);out[i*4+3]=255;
}
return out;
}
}
+9
查看文件
@@ -0,0 +1,9 @@
#pragma once
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
@interface DYScopeSample : NSObject
@property(nonatomic,copy) NSData *pixels;
@property(nonatomic,copy) NSDictionary *metadata;
@property(nonatomic) NSUInteger generation;
@property(nonatomic) CGColorSpaceRef space;
@end
+5
查看文件
@@ -0,0 +1,5 @@
#import "DYScopeSample.h"
@implementation DYScopeSample
- (void)setSpace:(CGColorSpaceRef)space{if(_space==space)return;if(_space)CGColorSpaceRelease(_space);_space=space?CGColorSpaceRetain(space):nil;}
- (void)dealloc{[_pixels release];[_metadata release];if(_space)CGColorSpaceRelease(_space);[super dealloc];}
@end
@@ -10,3 +10,25 @@
int undo=base->_undoStarts;BOOL update=NO;[osc mouseDownAtPositionX:320 positionY:212.5 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseDraggedAtPositionX:348 positionY:196.75 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseUpAtPositionX:348 positionY:196.75 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];drain();NSDictionary *moved=DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0];DYMaskParameters p=DYMaskAtTime(moved,kCMTimeZero);run.record(@"native-osc-drag-writes-independent-normalized-geometry",fabs(p.centerX-.55)<1e-5&&fabs(p.centerY-.55)<1e-5,@{@"x":@(p.centerX),@"y":@(p.centerY)});run.record(@"native-osc-drag-commits-one-undo-after-callback",base->_undoStarts==undo+1&&base->_undoStarts==base->_undoEnds);
NSDictionary *before=[DYReadTools(base,kCMTimeZero).document copy];[plugin adoptToolCanvasDocument:before];[osc mouseDownAtPositionX:348 positionY:196.75 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseDraggedAtPositionX:370 positionY:180 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];BOOL handled=NO;[osc keyDownAtPositionX:370 positionY:180 keyPressed:27 modifiers:0 forceUpdate:&update didHandle:&handled atTime:kCMTimeZero];drain();run.record(@"native-osc-escape-discards-draft-without-host-edit",[before isEqual:DYReadTools(base,kCMTimeZero).document]&&base->_undoStarts==undo+1);[before release];[osc release];[plugin release];
}
{
DYDiagnosticManager*base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,&error);DYToolCanvasProbe*host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero;
NSMutableDictionary*doc=DYMutablePlist(DYReadTools(base,kCMTimeZero).document);NSDictionary*mask=DYNewMask(DYMaskRectangle);doc[@"baseMasks"][@"hsl"]=[NSMutableArray arrayWithObject:mask];DYWriteTools(base,doc,kCMTimeZero);
id<DYToolCanvasHostProbe>plugin=(id)[[NSClassFromString(@"DYPlugIn")alloc]initWithAPIManager:host];[plugin scheduleToolCanvasRegistration];NSData*state=nil;[plugin pluginState:&state atTime:kCMTimeZero quality:(FxQuality)0 error:&error];
auto drain=[](){double end=NSProcessInfo.processInfo.systemUptime+.06;while(NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.002]];};drain();
id<FxOnScreenControl_v4>osc=(id)[[NSClassFromString(@"DYToolOSC")alloc]initWithAPIManager:host];DYDiagnosticTile*overlay=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:640 height:400]autorelease];[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];BOOL update=NO;NSInteger part=0;
// Open the curve from the vertical rail, then place its editor across the
// mask drag destination. The ongoing mask gesture must retain ownership.
id viewer=[(id)osc valueForKey:@"viewerControls"];NSDictionary*curveButton=nil;for(NSDictionary*a in [viewer valueForKey:@"areas"])if([a[@"toolType"]isEqual:@"curve"])curveButton=a;
NSRect br=[curveButton[@"rect"]rectValue];double bx=NSMidX(br),by=400-NSMidY(br);[osc hitTestOSCAtMousePositionX:bx mousePositionY:by activePart:&part atTime:kCMTimeZero];[osc mouseDownAtPositionX:bx positionY:by activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseUpAtPositionX:bx positionY:by activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];
id panel=[[viewer valueForKey:@"panels"]lastObject];[panel setValue:[NSValue valueWithPoint:NSMakePoint(.63,.03)]forKey:@"position"];
[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];int undo=base->_undoStarts;
[osc hitTestOSCAtMousePositionX:260 mousePositionY:212.5 activePart:&part atTime:kCMTimeZero];[osc mouseDownAtPositionX:260 positionY:212.5 activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];
[osc hitTestOSCAtMousePositionX:450 mousePositionY:200 activePart:&part atTime:kCMTimeZero];BOOL insideViewer=part>=20000;[osc mouseDraggedAtPositionX:450 positionY:200 activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseUpAtPositionX:450 positionY:200 activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];drain();
DYMaskParameters p=DYMaskAtTime(DYReadTools(base,kCMTimeZero).document[@"baseMasks"][@"hsl"][0],kCMTimeZero);
run.record(@"native-osc-mask-gesture-keeps-capture-when-crossing-the-open-viewer-panel",insideViewer&&fabs(p.centerX-(.5+190./560))<1e-5&&fabs(p.centerY-(.5+12.5/315))<1e-5&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
BOOL toolbarBounded=YES;for(NSRect view:{NSMakeRect(400,310,480,100),NSMakeRect(0,0,120,80),NSMakeRect(-100,-50,400,300)}){
[(id)osc setValue:[NSValue valueWithRect:view]forKey:@"imageRect"];[(id)osc setValue:@2 forKey:@"uiScale"];NSRect visible=NSIntersectionRect(view,NSMakeRect(0,0,640,400));
for(NSInteger i=0;i<9;i++)toolbarBounded&=NSContainsRect(visible,[(id)osc toolbarRectForItem:i]);}
run.record(@"native-osc-mask-toolbar-stays-inside-small-letterboxed-image",toolbarBounded);
[osc release];[plugin release];drain();
}
@@ -1,6 +1,7 @@
@class DYPlugIn;
static NSMapTable *DYToolCanvasSessions(void){static NSMapTable *map;static dispatch_once_t once;dispatch_once(&once,^{map=[[NSMapTable strongToWeakObjectsMapTable]retain];});return map;}
@interface DYPlugIn (ToolCanvas)
- (DYViewerParameterBridge*)viewerParameterBridge;
- (NSDictionary*)toolCanvasMaskAtTime:(CMTime)time;
- (void)toolCanvasEvent:(NSEventType)type point:(NSPoint)point part:(NSInteger)part modifiers:(FxModifierKeys)modifiers key:(unichar)key time:(CMTime)time;
- (BOOL)toolCanvasVisible;
@@ -1,4 +1,5 @@
NSString *_toolSession,*_selectedToolNode,*_selectedToolMask;
DYViewerParameterBridge *_viewerParameterBridge;
NSTimer *_toolAnalysisTimer;
BOOL _toolCaptureEnabled,_toolCanvasHidden,_toolDrawingPen,_toolShowCoverage,_toolCanvasCommitPending;
NSMutableDictionary *_toolCanvasDraft,*_toolCanvasOriginal;NSDictionary *_toolCanvasDocument;
@@ -1,8 +1,10 @@
- (void)initializeToolHost {
_viewerParameterBridge=[[DYViewerParameterBridge alloc]initWithAPIManager:_apiManager];
_toolCaptureDevices=[NSMutableDictionary new];_toolCanvasDocument=[[[[DYToolDocument alloc]init]autorelease].document copy];_toolSourceTime=kCMTimeInvalid;_toolCanvasEditTime=kCMTimeInvalid;
NSNotificationCenter *n=NSNotificationCenter.defaultCenter;[n addObserver:self selector:@selector(toolCanvasSelection:) name:@"DYToolCanvasSelection" object:_apiManager];[n addObserver:self selector:@selector(toolCanvasCommand:) name:@"DYToolCanvasCommand" object:_apiManager];[n addObserver:self selector:@selector(toolTrackRequested:) name:@"DYToolTrack" object:_apiManager];
}
- (void)tearDownToolHost {
[_viewerParameterBridge invalidate];[_viewerParameterBridge release];_viewerParameterBridge=nil;
[_toolAnalysisTimer invalidate];[_toolAnalysisTimer release];@synchronized(DYToolCanvasSessions()){if(_toolSession)[DYToolCanvasSessions()removeObjectForKey:_toolSession];}
[_toolCanvasDocument release];[_toolSession release];[_selectedToolNode release];[_selectedToolMask release];[_toolCanvasDraft release];[_toolCanvasOriginal release];[_trackingNode release];[_trackingMaskID release];[_trackingFrozenMask release];[_trackingCandidate release];[_trackingSamples release];[_trackingMessage release];[_toolCaptureDevices release];
}
@@ -28,6 +30,7 @@
@synchronized(self){if(_trackingActive.load()&&(![_trackingNode isEqual:node]||![_trackingMaskID isEqual:mask])){_trackingCancelled.store(true);_trackingDiscard=YES;}[_selectedToolNode release];_selectedToolNode=[node copy];[_selectedToolMask release];_selectedToolMask=[mask copy];_toolCanvasHidden=[notification.userInfo[@"hidden"]boolValue];_toolDrawingPen=[notification.userInfo[@"draw"]boolValue];++_toolCanvasRevision;_toolCanvasEditTime=kCMTimeInvalid;_toolDragPart=0;_toolCanvasHasHover=NO;[_toolCanvasDraft release];_toolCanvasDraft=nil;[_toolCanvasOriginal release];_toolCanvasOriginal=nil;}[self postToolCanvasStatus:_toolDrawingPen?@"钢笔:点击放点,拖出曲柄;点首节点或完成绘制闭合。":@"已选中本层蒙版"];
}
- (BOOL)toolCanvasVisible {@synchronized(self){return _selectedToolNode&&_selectedToolMask&&!_toolCanvasHidden;}}
- (DYViewerParameterBridge*)viewerParameterBridge{return _viewerParameterBridge;}
- (NSDictionary*)toolCanvasMaskAtTime:(CMTime)time {
@synchronized(self){if(_toolCanvasHidden||!_selectedToolMask)return nil;NSDictionary *m=_toolCanvasDraft?:[self toolMask:_selectedToolMask node:_selectedToolNode document:_toolCanvasDocument];if(!m)return nil;DYMaskParameters p=DYMaskAtTime(m,time);return @{@"id":m[@"id"],@"parameters":[NSData dataWithBytes:&p length:sizeof(p)],@"nodes":(_toolDrawingPen&&!_toolCanvasDraft)?[NSData data]:(m[@"nodes"]?:[NSData data]),@"drawing":@(_toolDrawingPen),@"hover":(_toolDrawingPen&&_toolCanvasHasHover)?@[@(_toolCanvasHoverPoint.x),@(_toolCanvasHoverPoint.y)]:@[],@"coverage":@(_toolShowCoverage)};}
}
+25 -16
查看文件
@@ -4,28 +4,33 @@
@end
@implementation DYToolOSC {
id<MTLDevice> _device;id<MTLCommandQueue> _queue;CIContext *_context;
CGFloat _height,_uiScale;NSInteger _toolbarRows;NSRect _imageRect;NSDictionary *_mask;NSMutableArray *_handles;NSBezierPath *_outline;NSInteger _lastRoute;NSUInteger _drawCount,_hitDiagnostics,_eventDiagnostics;
DYViewerControls *_viewerControls;CGFloat _height,_canvasWidth,_uiScale;NSInteger _toolbarRows;NSRect _imageRect;NSDictionary *_mask;NSMutableArray *_handles;NSBezierPath *_outline;NSInteger _lastRoute;NSUInteger _drawCount,_hitDiagnostics,_eventDiagnostics;
}
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager{if((self=[super init])){_apiManager=manager;_handles=[NSMutableArray new];_lastRoute=-1;_uiScale=1;_toolbarRows=9;os_log(OS_LOG_DEFAULT,"dayu_tool_osc_init");}return self;}
- (void)dealloc{[_device release];[_queue release];[_context release];[_mask release];[_handles release];[_outline release];[super dealloc];}
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager{if((self=[super init])){_apiManager=manager;_viewerControls=[DYViewerControls new];_handles=[NSMutableArray new];_lastRoute=-1;_uiScale=1;_toolbarRows=9;os_log(OS_LOG_DEFAULT,"dayu_tool_osc_init");}return self;}
- (void)dealloc{[_viewerControls release];[_device release];[_queue release];[_context release];[_mask release];[_handles release];[_outline release];[super dealloc];}
- (FxDrawingCoordinates)drawingCoordinates{return kFxDrawingCoordinates_CANVAS;}
- (DYPlugIn*)pluginAtTime:(CMTime)time{NSString *value=nil;id<FxParameterRetrievalAPI_v6>get=[_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];[get getStringParameterValue:&value fromParameter:DYCanvasSessionParameterID];@synchronized(DYToolCanvasSessions()){return [DYToolCanvasSessions()objectForKey:value];}}
- (NSPoint)canvasPoint:(float)x y:(float)y parameters:(DYMaskParameters)p{
float ca=cos(p.angle),sa=sin(p.angle),aspect=p.imageAspect;float px=x*p.width*aspect,py=y*p.height;float u=p.centerX+(px*ca-py*sa)/aspect,v=p.centerY+px*sa+py*ca;return NSMakePoint(_imageRect.origin.x+u*_imageRect.size.width,_imageRect.origin.y+v*_imageRect.size.height);
}
- (void)addHandle:(NSPoint)p part:(NSInteger)part{[_handles addObject:@{@"point":[NSValue valueWithPoint:p],@"part":@(part)}];}
- (NSRect)toolbarRectForItem:(NSInteger)item{CGFloat scale=_uiScale,x=MAX(8*scale,_imageRect.origin.x+12*scale),y=MAX(8*scale,_imageRect.origin.y+12*scale);NSInteger rows=MAX(1,_toolbarRows);return NSMakeRect(x+(item/rows)*38*scale,y+(item%rows)*39*scale,32*scale,34*scale);}
- (NSRect)toolbarRectForItem:(NSInteger)item{
NSRect v=NSIntersectionRect(_imageRect,NSMakeRect(0,0,_canvasWidth,_height));NSInteger count=[_mask[@"drawing"]boolValue]?11:9,bestRows=1;CGFloat scale=0;
for(NSInteger rows=count;rows>=1;rows--){NSInteger columns=(count+rows-1)/rows;CGFloat candidate=MIN(_uiScale,MIN(v.size.width/(38*columns+16),v.size.height/(39*rows+16)));if(candidate>scale){scale=candidate;bestRows=rows;}}
scale=MAX(.01,scale);return NSMakeRect(NSMaxX(v)-40*scale-(item/bestRows)*38*scale,NSMinY(v)+8*scale+(item%bestRows)*39*scale,32*scale,34*scale);
}
- (void)drawOSCWithWidth:(NSInteger)width height:(NSInteger)height activePart:(NSInteger)activePart destinationImage:(FxImageTile*)destination atTime:(CMTime)time {@synchronized(self){@autoreleasepool{
if(!_device||_device.registryID!=destination.deviceRegistryID){[_device release];_device=nil;NSArray *devices=MTLCopyAllDevices();for(id<MTLDevice>d in devices)if(d.registryID==destination.deviceRegistryID)_device=[d retain];[devices release];[_queue release];_queue=[_device newCommandQueue];[_context release];_context=_device?[[CIContext contextWithMTLDevice:_device options:@{kCIContextWorkingColorSpace:NSNull.null,kCIContextOutputColorSpace:NSNull.null}]retain]:nil;}
id<MTLTexture>texture=[destination metalTextureForDevice:_device];if(!texture||!_queue)return;id<MTLCommandBuffer>commands=[_queue commandBuffer];MTLRenderPassDescriptor *pass=[MTLRenderPassDescriptor renderPassDescriptor];pass.colorAttachments[0].texture=texture;pass.colorAttachments[0].loadAction=MTLLoadActionClear;pass.colorAttachments[0].storeAction=MTLStoreActionStore;pass.colorAttachments[0].clearColor=MTLClearColorMake(0,0,0,0);id<MTLRenderCommandEncoder>encoder=[commands renderCommandEncoderWithDescriptor:pass];[encoder endEncoding];
_height=destination.imagePixelBounds.top-destination.imagePixelBounds.bottom;CGFloat canvasWidth=destination.imagePixelBounds.right-destination.imagePixelBounds.left;
_height=destination.imagePixelBounds.top-destination.imagePixelBounds.bottom;CGFloat canvasWidth=destination.imagePixelBounds.right-destination.imagePixelBounds.left;_canvasWidth=canvasWidth;
id<FxOnScreenControlAPI_v4>api=[_apiManager apiForProtocol:@protocol(FxOnScreenControlAPI_v4)];double lx=0,ly=0,ux=0,uy=0;[api convertPointFromSpace:kFxDrawingCoordinates_OBJECT fromX:0 fromY:0 toSpace:kFxDrawingCoordinates_CANVAS toX:&lx toY:&ly];[api convertPointFromSpace:kFxDrawingCoordinates_OBJECT fromX:1 fromY:1 toSpace:kFxDrawingCoordinates_CANVAS toX:&ux toY:&uy];_imageRect=NSMakeRect(lx,_height-uy,ux-lx,uy-ly);_uiScale=[api respondsToSelector:@selector(backingScaleFactor)]?MAX(1.,MIN(3.,[api backingScaleFactor])):1.;_toolbarRows=MAX(1,MIN(11,(NSInteger)floor((_height-MAX(8*_uiScale,_imageRect.origin.y+12*_uiScale)-8*_uiScale)/(39*_uiScale))));
DYPlugIn *plugin=[self pluginAtTime:time];NSDictionary *mask=[plugin toolCanvasMaskAtTime:time];NSInteger route=(plugin?1:0)+(mask?2:0);if(route!=_lastRoute||_drawCount++<2){_lastRoute=route;os_log(OS_LOG_DEFAULT,"dayu_tool_osc_route plugin=%{public}d mask=%{public}d width=%{public}.2f height=%{public}.2f",plugin!=nil,mask!=nil,_imageRect.size.width,_imageRect.size.height);}[_mask release];_mask=[mask copy];[_handles removeAllObjects];[_outline release];_outline=nil;
if(mask&&canvasWidth>0&&_height>0&&canvasWidth<16384&&_height<16384&&_imageRect.size.width>0&&_imageRect.size.height>0){
[_viewerControls setBridge:[plugin viewerParameterBridge]];[_viewerControls setViewport:_imageRect];[_viewerControls prepareWithSize:NSMakeSize(canvasWidth,_height) scale:_uiScale atTime:time];
if(plugin&&canvasWidth>0&&_height>0&&canvasWidth<16384&&_height<16384&&_imageRect.size.width>0&&_imageRect.size.height>0){
NSBitmapImageRep *bitmap=[[[NSBitmapImageRep alloc]initWithBitmapDataPlanes:NULL pixelsWide:(NSInteger)canvasWidth pixelsHigh:(NSInteger)_height bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:(NSInteger)canvasWidth*4 bitsPerPixel:32]autorelease];memset(bitmap.bitmapData,0,bitmap.bytesPerRow*bitmap.pixelsHigh);[NSGraphicsContext saveGraphicsState];[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap]];NSAffineTransform *flip=[NSAffineTransform transform];[flip translateXBy:0 yBy:_height];[flip scaleXBy:1 yBy:-1];[flip concat];
// Match AppKit text/image drawing to the top-down canvas CTM.
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithCGContext:NSGraphicsContext.currentContext.CGContext flipped:YES]];
DYMaskParameters p;[mask[@"parameters"]getBytes:&p length:sizeof(p)];p.imageAspect=_imageRect.size.width/_imageRect.size.height;_outline=[[NSBezierPath bezierPath]retain];
if(mask){DYMaskParameters p;[mask[@"parameters"]getBytes:&p length:sizeof(p)];p.imageAspect=_imageRect.size.width/_imageRect.size.height;_outline=[[NSBezierPath bezierPath]retain];
if(p.kind==DYMaskBezier){NSData *data=mask[@"nodes"];auto *nodes=(const DYBezierNode*)data.bytes;NSUInteger count=data.length/sizeof(DYBezierNode);for(NSUInteger i=0;i<count;i++){NSPoint anchor=[self canvasPoint:nodes[i].x y:nodes[i].y parameters:p];if(i==0)[_outline moveToPoint:anchor];else{auto a=nodes[i-1],b=nodes[i];[_outline curveToPoint:anchor controlPoint1:[self canvasPoint:a.outX y:a.outY parameters:p] controlPoint2:[self canvasPoint:b.inX y:b.inY parameters:p]];}[self addHandle:anchor part:1000+i*3];for(int j=0;j<2;j++){NSPoint handle=[self canvasPoint:j?nodes[i].outX:nodes[i].inX y:j?nodes[i].outY:nodes[i].inY parameters:p];if(hypot(handle.x-anchor.x,handle.y-anchor.y)>3){NSBezierPath *line=[NSBezierPath bezierPath];[line moveToPoint:anchor];[line lineToPoint:handle];[[NSColor colorWithWhite:1 alpha:.55]setStroke];[line stroke];[self addHandle:handle part:1000+i*3+j+1];}}}
NSArray *hover=mask[@"hover"];if(count&&[mask[@"drawing"]boolValue]&&hover.count==2){NSPoint target=NSMakePoint(_imageRect.origin.x+[hover[0]doubleValue]*_imageRect.size.width,_imageRect.origin.y+[hover[1]doubleValue]*_imageRect.size.height);[_outline curveToPoint:target controlPoint1:[self canvasPoint:nodes[count-1].outX y:nodes[count-1].outY parameters:p] controlPoint2:target];}
if(count>=3&&![mask[@"drawing"]boolValue]){auto a=nodes[count-1],b=nodes[0];[_outline curveToPoint:[self canvasPoint:b.x y:b.y parameters:p] controlPoint1:[self canvasPoint:a.outX y:a.outY parameters:p] controlPoint2:[self canvasPoint:b.inX y:b.inY parameters:p]];[_outline closePath];}
@@ -37,28 +42,32 @@
for(NSDictionary *handle in _handles){NSPoint point=[handle[@"point"]pointValue];NSRect rect=NSMakeRect(point.x-4*_uiScale,point.y-4*_uiScale,8*_uiScale,8*_uiScale);[[NSColor colorWithWhite:.1 alpha:1]setFill];[[NSBezierPath bezierPathWithOvalInRect:rect]fill];[NSColor.whiteColor setStroke];[[NSBezierPath bezierPathWithOvalInRect:rect]stroke];}
NSArray *symbols=@[@"cursorarrow",@"point.topleft.down.to.point.bottomright.curvepath",@"rectangle",@"circle",@"line.diagonal",@"eyedropper",@"circle.lefthalf.filled",@"eye",@"xmark",@"checkmark",@"xmark.circle"];
NSInteger buttonCount=[mask[@"drawing"]boolValue]?11:9;
for(NSInteger i=0;i<buttonCount;i++){NSRect cell=[self toolbarRectForItem:i];BOOL active=(i==1&&[mask[@"drawing"]boolValue])||(i==0&&![mask[@"drawing"]boolValue]);[[NSColor colorWithCalibratedRed:active?.08:.12 green:active?.34:.12 blue:active?.58:.12 alpha:.94]setFill];[[NSBezierPath bezierPathWithRoundedRect:cell xRadius:5*_uiScale yRadius:5*_uiScale]fill];NSImage *icon=[NSImage imageWithSystemSymbolName:symbols[i] accessibilityDescription:nil];icon=[icon imageWithSymbolConfiguration:[NSImageSymbolConfiguration configurationWithPaletteColors:@[NSColor.whiteColor]]];[icon drawInRect:NSInsetRect(cell,7*_uiScale,7*_uiScale) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1 respectFlipped:YES hints:nil];}
for(NSInteger i=0;i<buttonCount;i++){NSRect cell=[self toolbarRectForItem:i];BOOL active=(i==1&&[mask[@"drawing"]boolValue])||(i==0&&![mask[@"drawing"]boolValue]);[[NSColor colorWithCalibratedRed:active?.08:.12 green:active?.34:.12 blue:active?.58:.12 alpha:.94]setFill];[[NSBezierPath bezierPathWithRoundedRect:cell xRadius:cell.size.width*5/32 yRadius:cell.size.width*5/32]fill];NSImage *icon=[NSImage imageWithSystemSymbolName:symbols[i] accessibilityDescription:nil];icon=[icon imageWithSymbolConfiguration:[NSImageSymbolConfiguration configurationWithPaletteColors:@[NSColor.whiteColor]]];[icon drawInRect:NSInsetRect(cell,cell.size.width*7/32,cell.size.width*7/32) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1 respectFlipped:YES hints:nil];}
if([mask[@"drawing"]boolValue]){NSRect hint=NSMakeRect(MAX(12*_uiScale,_imageRect.origin.x+12*_uiScale),MIN(_height-36*_uiScale,NSMaxY(_imageRect)-36*_uiScale),MIN(460*_uiScale,canvasWidth-24*_uiScale),28*_uiScale);[[NSColor colorWithWhite:.08 alpha:.9]setFill];[[NSBezierPath bezierPathWithRoundedRect:hint xRadius:5*_uiScale yRadius:5*_uiScale]fill];[@"钢笔:点击放点,拖出曲柄;点首节点或 ✓ 闭合" drawInRect:NSInsetRect(hint,7*_uiScale,5*_uiScale) withAttributes:@{NSFontAttributeName:[NSFont systemFontOfSize:12*_uiScale],NSForegroundColorAttributeName:NSColor.whiteColor}];}
}[_viewerControls draw];
[NSGraphicsContext restoreGraphicsState];CIImage *overlay=[CIImage imageWithCGImage:bitmap.CGImage options:@{kCIImageColorSpace:NSNull.null}];overlay=[overlay imageByApplyingTransform:CGAffineTransformMakeTranslation(0,texture.height-_height)];[_context render:overlay toMTLTexture:texture commandBuffer:commands bounds:CGRectMake(0,0,texture.width,texture.height) colorSpace:nil];
}[commands commit];[commands waitUntilCompleted];
}}}
- (NSInteger)partAtPoint:(NSPoint)point {
NSInteger viewerHit=[_viewerControls partAtPoint:point];if(viewerHit)return viewerHit;
if(!_mask)return 0;BOOL drawing=[_mask[@"drawing"]boolValue];for(NSInteger i=0;i<(drawing?11:9);i++)if(NSPointInRect(point,[self toolbarRectForItem:i]))return 10000+i;
DYMaskParameters p;[_mask[@"parameters"]getBytes:&p length:sizeof(p)];p.imageAspect=_imageRect.size.width/MAX(1.,_imageRect.size.height);
if(drawing){NSData *data=_mask[@"nodes"];if(data.length>=3*sizeof(DYBezierNode)){const DYBezierNode *nodes=(const DYBezierNode*)data.bytes;NSPoint first=[self canvasPoint:nodes[0].x y:nodes[0].y parameters:p];if(hypot(point.x-first.x,point.y-first.y)<=10*_uiScale)return 1000;}return NSPointInRect(point,_imageRect)?1:0;}
for(NSDictionary *h in _handles){NSPoint q=[h[@"point"]pointValue];if(hypot(q.x-point.x,q.y-point.y)<=9*_uiScale)return [h[@"part"]integerValue];}
if(p.kind==DYMaskBezier||p.kind==DYMaskLinearGradient||[_outline containsPoint:point])return 1;return 0;
}
- (void)hitTestOSCAtMousePositionX:(double)x mousePositionY:(double)y activePart:(NSInteger*)part atTime:(CMTime)time{@synchronized(self){NSDictionary *fresh=[[self pluginAtTime:time]toolCanvasMaskAtTime:time];[_mask release];_mask=[fresh copy];NSInteger hit=[self partAtPoint:NSMakePoint(x,_height-y)];if(part)*part=hit;if(_hitDiagnostics++<16)os_log(OS_LOG_DEFAULT,"dayu_tool_osc_hit x=%{public}.2f y=%{public}.2f height=%{public}.2f rect=%{public}.2f,%{public}.2f,%{public}.2f,%{public}.2f mask=%{public}d hit=%{public}ld",x,y,_height,_imageRect.origin.x,_imageRect.origin.y,_imageRect.size.width,_imageRect.size.height,_mask!=nil,(long)hit);}}
- (void)hitTestOSCAtMousePositionX:(double)x mousePositionY:(double)y activePart:(NSInteger*)part atTime:(CMTime)time{@synchronized(self){DYPlugIn*plugin=[self pluginAtTime:time];[_viewerControls setBridge:[plugin viewerParameterBridge]];[_viewerControls setViewport:_imageRect];[_viewerControls prepareWithSize:NSMakeSize(_canvasWidth,_height) scale:_uiScale atTime:time];NSDictionary *fresh=[plugin toolCanvasMaskAtTime:time];[_mask release];_mask=[fresh copy];NSInteger hit=[self partAtPoint:NSMakePoint(x,_height-y)];if(part)*part=hit;if(_hitDiagnostics++<16)os_log(OS_LOG_DEFAULT,"dayu_tool_osc_hit x=%{public}.2f y=%{public}.2f height=%{public}.2f rect=%{public}.2f,%{public}.2f,%{public}.2f,%{public}.2f mask=%{public}d hit=%{public}ld",x,y,_height,_imageRect.origin.x,_imageRect.origin.y,_imageRect.size.width,_imageRect.size.height,_mask!=nil,(long)hit);}}
- (BOOL)event:(NSEventType)type x:(double)x y:(double)y part:(NSInteger)part modifiers:(FxModifierKeys)modifiers key:(unichar)key time:(CMTime)time {@synchronized(self){
DYPlugIn *plugin=[self pluginAtTime:time];if(_eventDiagnostics++<12)os_log(OS_LOG_DEFAULT,"dayu_tool_osc_event type=%{public}ld part=%{public}ld x=%{public}.2f y=%{public}.2f plugin=%{public}d",(long)type,(long)part,x,y,plugin!=nil);if(!plugin||![plugin toolCanvasVisible]||_imageRect.size.width<=0||_imageRect.size.height<=0)return NO;NSPoint point=NSMakePoint((x-_imageRect.origin.x)/_imageRect.size.width,(_height-y-_imageRect.origin.y)/_imageRect.size.height);[plugin toolCanvasEvent:type point:point part:part modifiers:modifiers key:key time:time];return YES;
DYPlugIn *plugin=[self pluginAtTime:time];if(_eventDiagnostics++<12)os_log(OS_LOG_DEFAULT,"dayu_tool_osc_event type=%{public}ld part=%{public}ld x=%{public}.2f y=%{public}.2f plugin=%{public}d",(long)type,(long)part,x,y,plugin!=nil);[_viewerControls setBridge:[plugin viewerParameterBridge]];[_viewerControls setViewport:_imageRect];[_viewerControls prepareWithSize:NSMakeSize(_canvasWidth,_height) scale:_uiScale atTime:time];NSPoint canvasPoint=NSMakePoint(x,_height-y);if(type==NSEventTypeKeyDown&&key==27&&[_viewerControls capturing])return [_viewerControls finishCapture];if(type!=NSEventTypeKeyDown&&[_viewerControls event:type point:canvasPoint atTime:time])return YES;if(!plugin||![plugin toolCanvasVisible]||_imageRect.size.width<=0||_imageRect.size.height<=0)return NO;NSPoint point=NSMakePoint((x-_imageRect.origin.x)/_imageRect.size.width,(_height-y-_imageRect.origin.y)/_imageRect.size.height);[plugin toolCanvasEvent:type point:point part:part modifiers:modifiers key:key time:time];return YES;
}}
- (void)mouseDownAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{if(update)*update=[self event:NSEventTypeLeftMouseDown x:x y:y part:part modifiers:m key:0 time:t];}
- (void)mouseDraggedAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{if(update)*update=[self event:NSEventTypeLeftMouseDragged x:x y:y part:part modifiers:m key:0 time:t];}
- (void)mouseUpAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{if(update)*update=[self event:NSEventTypeLeftMouseUp x:x y:y part:part modifiers:m key:0 time:t];}
- (void)mouseDownAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{BOOL result=[self event:NSEventTypeLeftMouseDown x:x y:y part:part modifiers:m key:0 time:t];if(update)*update=result;}
- (void)mouseDraggedAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{BOOL result=[self event:NSEventTypeLeftMouseDragged x:x y:y part:part modifiers:m key:0 time:t];if(update)*update=result;}
- (void)mouseUpAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{BOOL result=[self event:NSEventTypeLeftMouseUp x:x y:y part:part modifiers:m key:0 time:t];if(update)*update=result;}
- (void)keyDownAtPositionX:(double)x positionY:(double)y keyPressed:(unsigned short)key modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update didHandle:(BOOL*)handled atTime:(CMTime)t{BOOL result=(key==27||key==13||key==10||key==3||key==8||key==127)&&[self event:NSEventTypeKeyDown x:x y:y part:1 modifiers:m key:key time:t];if(update)*update=result;if(handled)*handled=result;}
- (void)mouseMovedAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{NSDictionary *mask=[[self pluginAtTime:t]toolCanvasMaskAtTime:t];BOOL drawing=[mask[@"drawing"]boolValue];NSCursor *cursor=part>=10000?NSCursor.pointingHandCursor:(drawing||part>=1000)?NSCursor.crosshairCursor:part?NSCursor.openHandCursor:NSCursor.arrowCursor;[[_apiManager apiForProtocol:@protocol(FxOnScreenControlAPI_v4)]setCursor:cursor];if(drawing)[self event:NSEventTypeMouseMoved x:x y:y part:part modifiers:m key:0 time:t];if(update)*update=drawing;}
- (void)mouseEnteredAtPositionX:(double)x positionY:(double)y modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{if(update)*update=NO;}
- (void)mouseExitedAtPositionX:(double)x positionY:(double)y modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{if(update)*update=NO;}
- (void)mouseMovedAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{@synchronized(self){
DYPlugIn*plugin=[self pluginAtTime:t];[_viewerControls setBridge:[plugin viewerParameterBridge]];[_viewerControls setViewport:_imageRect];[_viewerControls prepareWithSize:NSMakeSize(_canvasWidth,_height) scale:_uiScale atTime:t];NSPoint point=NSMakePoint(x,_height-y);NSInteger viewerHit=[_viewerControls partAtPoint:point];BOOL redraw=[_viewerControls mouseMoved:point];NSDictionary *mask=[plugin toolCanvasMaskAtTime:t];BOOL drawing=[mask[@"drawing"]boolValue];NSCursor *cursor=[_viewerControls headerAtPoint:point]?([_viewerControls capturing]?NSCursor.closedHandCursor:NSCursor.openHandCursor):viewerHit?NSCursor.pointingHandCursor:part>=10000?NSCursor.pointingHandCursor:(drawing||part>=1000)?NSCursor.crosshairCursor:part?NSCursor.openHandCursor:NSCursor.arrowCursor;[[_apiManager apiForProtocol:@protocol(FxOnScreenControlAPI_v4)]setCursor:cursor];if(drawing&&!viewerHit)[self event:NSEventTypeMouseMoved x:x y:y part:part modifiers:m key:0 time:t];if(update)*update=redraw||drawing;
}}
- (void)mouseEnteredAtPositionX:(double)x positionY:(double)y modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{[self mouseMovedAtPositionX:x positionY:y activePart:0 modifiers:m forceUpdate:update atTime:t];}
- (void)mouseExitedAtPositionX:(double)x positionY:(double)y modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{@synchronized(self){BOOL changed=[_viewerControls mouseExited];if(update)*update=changed;}}
- (void)keyUpAtPositionX:(double)x positionY:(double)y keyPressed:(unsigned short)key modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update didHandle:(BOOL*)handled atTime:(CMTime)t{if(update)*update=NO;if(handled)*handled=NO;}
@end
@@ -0,0 +1,82 @@
// One OSC root owns a vertical tool rail and independent movable editors.
// Positions are view state; opening, moving and channel selection never edit a grade.
#import "DYTheme.h"
#include "DYViewerParameterPanel.inc.h"
static const NSInteger DYViewerPartBase=20000;
@interface DYViewerControls : NSObject
@property(nonatomic,retain) DYViewerParameterBridge *bridge;
- (void)setViewport:(NSRect)viewport;
- (void)prepareWithSize:(NSSize)size scale:(CGFloat)scale atTime:(CMTime)time;
- (void)draw;
- (NSInteger)partAtPoint:(NSPoint)point;
- (BOOL)event:(NSEventType)type point:(NSPoint)point atTime:(CMTime)time;
- (BOOL)mouseMoved:(NSPoint)point;
- (BOOL)mouseExited;
- (BOOL)capturing;
- (BOOL)finishCapture;
- (BOOL)headerAtPoint:(NSPoint)point;
@end
@implementation DYViewerControls {
DYViewerParameterBridge *_bridge;NSMutableArray *_panels,*_areas;DYViewerParameterPanel *_capture;
NSRect _viewport,_rail;NSSize _size;CGFloat _scale;CMTime _time;NSInteger _pressed,_hover,_railPage;BOOL _hasViewport;
}
@synthesize bridge=_bridge;
- (instancetype)init{if((self=[super init])){_panels=[NSMutableArray new];_areas=[NSMutableArray new];_scale=1;_time=kCMTimeInvalid;}return self;}
- (void)dealloc{[self finishCapture];[_bridge release];[_panels release];[_areas release];[super dealloc];}
- (void)setBridge:(DYViewerParameterBridge*)bridge{if(bridge==_bridge)return;[self finishCapture];for(DYViewerParameterPanel*p in _panels)p.bridge=nil;[_panels removeAllObjects];[_bridge release];_bridge=[bridge retain];}
- (void)setViewport:(NSRect)viewport{_viewport=viewport;_hasViewport=YES;}
- (void)prepareWithSize:(NSSize)size scale:(CGFloat)scale atTime:(CMTime)time{
_size=size;_time=time;NSRect bounds=NSMakeRect(0,0,size.width,size.height),v=_hasViewport?NSIntersectionRect(_viewport,bounds):bounds;_viewport=v;
_scale=MAX(.6,MIN(MAX(1.,scale),MIN(v.size.width/420.,v.size.height/350.)));CGFloat s=_scale;
for(DYViewerParameterPanel*p in [[_panels copy]autorelease]){if(!p.visible){if(p==_capture){[p finishCapture];_capture=nil;}p.bridge=nil;[_panels removeObjectIdenticalTo:p];continue;}[p setViewport:v];[p prepareWithSize:size scale:s atTime:time];}
if(_capture&&![_capture capturing])_capture=nil;
[_areas removeAllObjects];if(!_bridge||v.size.width<100||v.size.height<80)return;
NSInteger cap=MAX(1,MIN(14,(NSInteger)floor((v.size.height-72*s)/(30*s))));if(cap<14)cap=MAX(1,MIN(13,(NSInteger)floor((v.size.height-96*s)/(30*s))));NSInteger pages=(14+cap-1)/cap;_railPage=MAX(0,_railPage)%pages;
CGFloat x=NSMinX(v)+8*s,y=NSMinY(v)+8*s,w=40*s;
_rail=NSMakeRect(x,y,w,(30*MIN(cap,14-_railPage*cap)+54+(pages>1?24:0))*s);
NSArray*titles=@[@"一级",@"蜘蛛",@"基础",@"肤色",@"LUT",@"HSL",@"曲线",@"分级",@"原色",@"色阶",@"黑白",@"平衡",@"通道",@"胶片"];
for(NSInteger j=0;j<cap&&j+_railPage*cap<14;j++){NSInteger i=j+_railPage*cap;[_areas addObject:@{@"part":@(20020+i),@"kind":@"tool",@"toolType":DYToolTypes()[i],@"title":titles[i],@"rect":[NSValue valueWithRect:NSMakeRect(x+4*s,y+5*s+j*30*s,w-8*s,26*s)]}];}
CGFloat end=NSMaxY(_rail)-47*s;if(pages>1){[_areas addObject:@{@"part":@20003,@"kind":@"railPage",@"title":@"↕",@"rect":[NSValue valueWithRect:NSMakeRect(x+4*s,end-24*s,w-8*s,22*s)]}];}
[_areas addObject:@{@"part":@20001,@"kind":@"workspace",@"title":@"◫",@"rect":[NSValue valueWithRect:NSMakeRect(x+4*s,end,w-8*s,26*s)]}];
[_areas addObject:@{@"part":@20002,@"kind":@"hidePanels",@"title":@"收",@"rect":[NSValue valueWithRect:NSMakeRect(x+4*s,end+27*s,w-8*s,18*s)]}];
}
- (NSInteger)partAtPoint:(NSPoint)p{
if(!_bridge||!std::isfinite(p.x)||!std::isfinite(p.y)||!NSPointInRect(p,_viewport))return 0;
for(NSDictionary*a in _areas)if(NSPointInRect(p,[a[@"rect"]rectValue]))return [a[@"part"]integerValue];if(NSPointInRect(p,_rail))return 20000;
for(NSInteger i=_panels.count-1;i>=0;i--){NSInteger part=[_panels[i]partAtPoint:p];if(part)return 100000+(i+1)*10000+(part-20000);}
return 0;
}
- (BOOL)headerAtPoint:(NSPoint)p{if(NSPointInRect(p,_rail))return NO;for(DYViewerParameterPanel*panel in [_panels reverseObjectEnumerator]){NSInteger part=[panel partAtPoint:p];if(part)return part==20000;}return NO;}
- (void)draw{
if(!_areas.count)return;[NSGraphicsContext saveGraphicsState];NSRectClip(_viewport);CGFloat s=_scale;NSColor*ink=DYThemeColor(@"text"),*accent=DYThemeColor(@"accent");for(DYViewerParameterPanel*p in _panels)[p draw];DYDrawThemeSurface([NSBezierPath bezierPathWithRoundedRect:_rail xRadius:8*s yRadius:8*s],YES);
for(NSDictionary*a in _areas){NSRect r=[a[@"rect"]rectValue];BOOL selected=NO;for(DYViewerParameterPanel*p in _panels)if([p.toolType isEqual:a[@"toolType"]])selected=YES;
BOOL hover=_hover==[a[@"part"]integerValue];DYDrawSoftControl(r,5*s,NO,selected||hover,_pressed==[a[@"part"]integerValue]);
NSMutableParagraphStyle*style=[[[NSMutableParagraphStyle alloc]init]autorelease];style.alignment=NSTextAlignmentCenter;
[a[@"title"]drawInRect:NSInsetRect(r,1*s,4*s) withAttributes:@{NSFontAttributeName:[NSFont systemFontOfSize:([a[@"kind"]isEqual:@"workspace"]?16:10)*s weight:NSFontWeightMedium],NSForegroundColorAttributeName:selected?accent:ink,NSParagraphStyleAttributeName:style}];
}
for(NSDictionary*a in _areas)if(_hover==[a[@"part"]integerValue]){NSString*help=[a[@"kind"]isEqual:@"workspace"]?@"打开示波器与 LUT 工作区":[a[@"kind"]isEqual:@"hidePanels"]?@"收起所有画布面板":a[@"toolType"]?DYToolSection(a[@"toolType"])[@"title"]:@"下一组工具";NSRect r=[a[@"rect"]rectValue];NSRect tip=NSMakeRect(NSMaxX(_rail)+6*s,NSMinY(r),MIN(200*s,NSMaxX(_viewport)-NSMaxX(_rail)-10*s),25*s);if(tip.size.width>40*s){DYDrawThemeSurface([NSBezierPath bezierPathWithRoundedRect:tip xRadius:4*s yRadius:4*s],YES);[help drawInRect:NSInsetRect(tip,6*s,5*s)withAttributes:@{NSFontAttributeName:[NSFont systemFontOfSize:10*s],NSForegroundColorAttributeName:ink}];}break;}
[NSGraphicsContext restoreGraphicsState];
}
- (void)activateTool:(NSString*)type{
for(DYViewerParameterPanel*p in [[_panels copy]autorelease])if([p.toolType isEqual:type]){[p finishCapture];p.bridge=nil;[_panels removeObjectIdenticalTo:p];return;}
DYViewerParameterPanel*p=[[[DYViewerParameterPanel alloc]init]autorelease];p.toolType=type;p.bridge=_bridge;
CGFloat x=(_rail.size.width+24*_scale)/MAX(1.,_viewport.size.width),offset=(_panels.count%4)*22*_scale;
[p setInitialPosition:NSMakePoint(x+offset/MAX(1.,_viewport.size.width),(8*_scale+offset)/MAX(1.,_viewport.size.height))];[_panels addObject:p];
}
- (BOOL)event:(NSEventType)type point:(NSPoint)p atTime:(CMTime)time{
if(!std::isfinite(p.x)||!std::isfinite(p.y))return NO;[self prepareWithSize:_size scale:_scale atTime:time];
if(_capture){BOOL used=[_capture event:type point:p atTime:time];if(![_capture capturing]){_capture=nil;[self prepareWithSize:_size scale:_scale atTime:time];}return used;}
NSInteger hit=[self partAtPoint:p];
if(type==NSEventTypeLeftMouseDown){
if(hit>=100000){NSInteger index=(hit-100000)/10000-1;if(index<0||index>=(NSInteger)_panels.count)return NO;DYViewerParameterPanel*panel=[[_panels[index]retain]autorelease];[_panels removeObjectIdenticalTo:panel];[_panels addObject:panel];_capture=panel;return [panel event:type point:p atTime:time];}
if(!hit)return NO;_pressed=hit;return YES;
}
if(!_pressed)return NO;
if(type==NSEventTypeLeftMouseUp){NSInteger pressed=_pressed;_pressed=0;if(hit==pressed){for(NSDictionary*a in _areas)if([a[@"part"]integerValue]==hit){NSString*kind=a[@"kind"];if([kind isEqual:@"tool"])[self activateTool:a[@"toolType"]];else if([kind isEqual:@"workspace"])[_bridge requestWorkspace];else if([kind isEqual:@"hidePanels"]){for(DYViewerParameterPanel*panel in _panels){[panel finishCapture];panel.bridge=nil;}[_panels removeAllObjects];}else if([kind isEqual:@"railPage"])_railPage++;break;}}[self prepareWithSize:_size scale:_scale atTime:time];}
return YES;
}
- (BOOL)capturing{return _pressed||[_capture capturing];}
- (BOOL)finishCapture{BOOL had=[self capturing];for(DYViewerParameterPanel*p in _panels)[p finishCapture];_capture=nil;_pressed=0;return had;}
- (BOOL)mouseMoved:(NSPoint)p{NSInteger h=[self partAtPoint:p];BOOL changed=h!=_hover;_hover=h;for(DYViewerParameterPanel*panel in _panels)changed=[panel mouseMoved:p]||changed;return changed;}
- (BOOL)mouseExited{BOOL changed=_hover!=0;_hover=0;for(DYViewerParameterPanel*p in _panels)changed=[p mouseExited]||changed;return changed;}
@end
@@ -0,0 +1,84 @@
{
DYDiagnosticManager*base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,&error);
DYToolCanvasProbe*host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero;
id<DYViewerParameterProbe>bridge=(id)[[NSClassFromString(@"DYViewerParameterBridge")alloc]initWithAPIManager:host];
id<DYViewerControlsProbe>controls=(id)[NSClassFromString(@"DYViewerControls")new];controls.bridge=bridge;
NSSize size=NSMakeSize(1280,720);
auto drain=[](){double end=NSProcessInfo.processInfo.systemUptime+.04;while(NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.002]];};
auto publish=[&](){DYUniforms u;DYReadUniforms(host,host->_time,&u);[bridge publishUniforms:&u document:DYReadTools(host,host->_time).document atTime:host->_time];[controls prepareWithSize:size scale:1 atTime:host->_time];};
auto areaFor=[&](id owner,NSString*kind,NSString*key)->NSDictionary*{for(NSDictionary*a in [owner valueForKey:@"areas"])if([a[@"kind"]isEqual:kind]&&(!key||[a[@"descriptor"][@"key"]isEqual:key]||[a[@"toolType"]isEqual:key]||[a[@"nodeID"]isEqual:key]))return [[a copy]autorelease];return nil;};
auto click=[&](NSDictionary*a){if(!a)return;NSRect r=[a[@"rect"]rectValue];NSPoint p=NSMakePoint(NSMidX(r),NSMidY(r));[controls event:NSEventTypeLeftMouseDown point:p atTime:host->_time];[controls event:NSEventTypeLeftMouseUp point:p atTime:host->_time];};
auto panelFor=[&](NSString*type)->id{for(id panel in [controls valueForKey:@"panels"])if([[panel valueForKey:@"toolType"]isEqual:type])return panel;return nil;};
auto value=[&](NSString*key)->double{for(NSDictionary*d in DYDescriptors())if([d[@"key"]isEqual:key])return [base->_values[d[@"pid"]]doubleValue];return NAN;};
publish();int undo=base->_undoStarts;NSDictionary*initial=[[base->_values copy]autorelease];
NSMutableSet*types=[NSMutableSet set];CGFloat x=-1,lastY=-1;BOOL vertical=YES;
for(NSDictionary*a in [controls valueForKey:@"areas"])if([a[@"kind"]isEqual:@"tool"]){NSRect r=[a[@"rect"]rectValue];if(x>=0)vertical&=r.origin.x==x&&r.origin.y>lastY;x=r.origin.x;lastY=r.origin.y;[types addObject:a[@"toolType"]];}
run.record(@"viewer-vertical-rail-exposes-fourteen-tools-without-a-parameter-panel",vertical&&types.count==14&&[[controls valueForKey:@"panels"]count]==0);
BOOL allOpen=YES;for(NSString*type in DYToolTypes()){click(areaFor(controls,@"tool",type));allOpen&=panelFor(type)!=nil;}
run.record(@"viewer-tools-open-independent-panels-without-editing-the-grade",allOpen&&[[controls valueForKey:@"panels"]count]==14&&[initial isEqual:base->_values]&&base->_undoStarts==undo);
click(areaFor(controls,@"hidePanels",nil));click(areaFor(controls,@"tool",@"base"));id panel=panelFor(@"base");
NSRect before=[[panel valueForKey:@"panel"]rectValue],header=[areaFor(panel,@"open",nil)[@"rect"]rectValue];NSPoint hp=NSMakePoint(NSMidX(header),NSMidY(header));
[controls event:NSEventTypeLeftMouseDown point:hp atTime:host->_time];[controls event:NSEventTypeLeftMouseDragged point:NSMakePoint(hp.x+90,hp.y+20) atTime:host->_time];[controls event:NSEventTypeLeftMouseUp point:NSMakePoint(hp.x+140,hp.y+30) atTime:host->_time];NSRect after=[[panel valueForKey:@"panel"]rectValue];
run.record(@"viewer-dragging-header-moves-panel-with-final-release-point-and-no-undo",fabs(after.origin.x-before.origin.x-140)<1e-5&&fabs(after.origin.y-before.origin.y-30)<1e-5&&![controls capturing]&&[initial isEqual:base->_values]&&base->_undoStarts==undo);
NSDictionary*exposure=areaFor(panel,@"slider",@"exposure");NSRect row=[exposure[@"rect"]rectValue],track=NSMakeRect(row.origin.x+5,row.origin.y+28,row.size.width-10,4);NSPoint knob=NSMakePoint(NSMidX(track),NSMidY(track)),label=NSMakePoint(row.origin.x+10,row.origin.y+5);
[controls event:NSEventTypeLeftMouseDown point:label atTime:host->_time];[controls event:NSEventTypeLeftMouseUp point:label atTime:host->_time];drain();
[controls event:NSEventTypeLeftMouseDown point:knob atTime:host->_time];[controls event:NSEventTypeLeftMouseDragged point:NSMakePoint(knob.x+1,knob.y+1)atTime:host->_time];[controls event:NSEventTypeLeftMouseUp point:NSMakePoint(knob.x+1,knob.y+1)atTime:host->_time];drain();
run.record(@"viewer-label-and-knob-deadzone-do-not-create-edits",value(@"exposure")==0&&base->_undoStarts==undo);
[controls event:NSEventTypeLeftMouseDown point:NSMakePoint(knob.x+5,knob.y)atTime:host->_time];[controls event:NSEventTypeLeftMouseDragged point:NSMakePoint(knob.x+5+track.size.width*.1,knob.y)atTime:host->_time];drain();
run.record(@"viewer-slider-preserves-grab-offset-and-updates-live",fabs(value(@"exposure")-1)<1e-5&&[controls capturing]&&base->_undoStarts==undo+1&&base->_undoEnds==undo);
[controls event:NSEventTypeLeftMouseUp point:NSMakePoint(-100,1000)atTime:host->_time];drain();publish();
run.record(@"viewer-slider-captures-outside-and-closes-one-undo",value(@"exposure")==-5&&![controls capturing]&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);click(areaFor(panel,@"reset",@"exposure"));drain();publish();
click(areaFor(panel,@"headerBool",@"baseEnabled"));drain();publish();run.record(@"viewer-base-tone-and-color-eyes-remain-independent",value(@"baseEnabled")==0&&value(@"colorEnabled")==1);click(areaFor(panel,@"headerBool",@"baseEnabled"));drain();publish();
// Empty panels cannot close the shared bridge gesture owned by a live panel.
NSMutableDictionary*removedDoc=DYMutablePlist(DYReadTools(host,host->_time).document);DYSetBaseToolRemoved(removedDoc,@"film",YES);DYWriteTools(host,removedDoc,host->_time);publish();click(areaFor(controls,@"tool",@"film"));[panelFor(@"film")setValue:[NSValue valueWithPoint:NSMakePoint(.72,.1)]forKey:@"position"];publish();
// Base is still visible; raise it by an inert label down/up.
exposure=areaFor(panel,@"slider",@"exposure");row=[exposure[@"rect"]rectValue];label=NSMakePoint(row.origin.x+10,row.origin.y+5);[controls event:NSEventTypeLeftMouseDown point:label atTime:host->_time];[controls event:NSEventTypeLeftMouseUp point:label atTime:host->_time];
track=NSMakeRect(row.origin.x+5,row.origin.y+28,row.size.width-10,4);knob=NSMakePoint(NSMidX(track),NSMidY(track));undo=base->_undoStarts;
[controls event:NSEventTypeLeftMouseDown point:knob atTime:host->_time];[controls event:NSEventTypeLeftMouseDragged point:NSMakePoint(knob.x+track.size.width*.1,knob.y)atTime:host->_time];drain();publish();[controls event:NSEventTypeLeftMouseDragged point:NSMakePoint(knob.x+track.size.width*.2,knob.y)atTime:host->_time];[controls event:NSEventTypeLeftMouseUp point:NSMakePoint(knob.x+track.size.width*.3,knob.y)atTime:host->_time];drain();publish();
run.record(@"viewer-empty-removed-tool-never-terminates-another-panels-live-gesture",fabs(value(@"exposure")-3)<1e-5&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
click(areaFor(controls,@"tool",@"film"));click(areaFor(panel,@"reset",@"exposure"));drain();publish();
click(areaFor(controls,@"tool",@"curve"));id curve=panelFor(@"curve");
run.record(@"viewer-curve-opens-an-editable-graph-beside-existing-panel",curve&&panelFor(@"base")&&areaFor(curve,@"curvePlot",nil)&&!areaFor(curve,@"slider",nil));
NSRect plot=[areaFor(curve,@"curvePlot",nil)[@"rect"]rectValue];NSPoint point=NSMakePoint(plot.origin.x+.43*plot.size.width,plot.origin.y+.18*plot.size.height);undo=base->_undoStarts;
[controls event:NSEventTypeLeftMouseDown point:point atTime:host->_time];NSString*xKey=[[[curve valueForKey:@"captured"][@"xKey"]copy]autorelease],*yKey=[[[curve valueForKey:@"captured"][@"yKey"]copy]autorelease];drain();
[controls event:NSEventTypeLeftMouseDragged point:NSMakePoint(plot.origin.x+.54*plot.size.width,plot.origin.y+.23*plot.size.height)atTime:host->_time];drain();
run.record(@"viewer-curve-point-is-live-xy-not-a-scalar-only-control",xKey&&yKey&&fabs(value(xKey)-.54)<1e-5&&fabs(value(yKey)-23)<1e-4&&base->_undoStarts==undo+1&&base->_undoEnds==undo);
[controls event:NSEventTypeLeftMouseUp point:NSMakePoint(plot.origin.x+.61*plot.size.width,plot.origin.y+.3*plot.size.height)atTime:host->_time];drain();publish();
run.record(@"viewer-curve-final-release-commits-both-axes-with-one-undo",fabs(value(xKey)-.61)<1e-5&&fabs(value(yKey)-9)<1e-4&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
undo=base->_undoStarts;NSDictionary*deleteArea=areaFor(curve,@"deletePoint",nil);click(deleteArea);drain();publish();
run.record(@"viewer-curve-delete-deactivates-the-selected-slot",deleteArea&&value(xKey)==-1&&value(yKey)==0&&base->_undoStarts==undo+1);
NSDictionary*red=nil;for(NSDictionary*a in [curve valueForKey:@"areas"])if([a[@"kind"]isEqual:@"channel"]&&[a[@"index"]integerValue]==1)red=[[a copy]autorelease];undo=base->_undoStarts;click(red);drain();
run.record(@"viewer-curve-channel-switch-is-view-state-with-no-undo",[[curve valueForKey:@"channel"]integerValue]==1&&base->_undoStarts==undo);
click(areaFor(controls,@"tool",@"grading"));id grading=panelFor(@"grading");NSDictionary*wheel=areaFor(grading,@"wheel",nil);NSRect wr=[wheel[@"rect"]rectValue];NSPoint wp=NSMakePoint(NSMidX(wr)+wr.size.width*.2,NSMidY(wr));undo=base->_undoStarts;
[controls event:NSEventTypeLeftMouseDown point:wp atTime:host->_time];[controls event:NSEventTypeLeftMouseDragged point:NSMakePoint(NSMidX(wr),NSMidY(wr)-wr.size.width*.3)atTime:host->_time];[controls event:NSEventTypeLeftMouseUp point:NSMakePoint(NSMidX(wr),NSMidY(wr)-wr.size.width*.4)atTime:host->_time];drain();publish();
run.record(@"viewer-grading-wheel-edits-hue-and-saturation-in-one-gesture",wheel&&fabs(value(@"grade0_0")-90)<1e-5&&fabs(value(@"grade0_1")-80)<1e-4&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1&&[[controls valueForKey:@"panels"]count]==3);
click(areaFor(grading,@"graphMode",nil));run.record(@"viewer-graph-panel-retains-precise-parameter-view",areaFor(grading,@"slider",nil)&&!areaFor(grading,@"wheel",nil));
NSRect modeRect=[areaFor(grading,@"graphMode",nil)[@"rect"]rectValue],nextRect=[areaFor(grading,@"next",nil)[@"rect"]rectValue];run.record(@"viewer-graph-mode-and-page-buttons-never-overlap",!NSIntersectsRect(modeRect,nextRect));
click(areaFor(grading,@"close",nil));run.record(@"viewer-closing-one-panel-preserves-other-graph-and-controls",!panelFor(@"grading")&&panelFor(@"curve")&&panelFor(@"base"));
// A repeated curve layer selects its UUID, rather than redirecting writes to root.
NSMutableDictionary*doc=DYMutablePlist(DYReadTools(host,host->_time).document);NSDictionary*layer=DYInsertTool(doc,@"curve",@"base:curve");NSString*layerID=[[layer[@"id"]copy]autorelease];DYWriteTools(host,doc,host->_time);publish();
// Raise curve with an inert header click twice (collapse/reopen), then layer menu.
click(areaFor(curve,@"open",nil));click(areaFor(curve,@"open",nil));click(areaFor(curve,@"catalog",nil));NSDictionary*module=areaFor(curve,@"module",layerID);click(module);
run.record(@"viewer-floating-editor-layer-menu-selects-only-its-tool-type",module&&[[curve valueForKey:@"nodeID"]isEqual:layerID]&&[[curve valueForKey:@"nodes"]count]==2);
plot=[areaFor(curve,@"curvePlot",nil)[@"rect"]rectValue];point=NSMakePoint(NSMidX(plot),NSMidY(plot));[controls event:NSEventTypeLeftMouseDown point:point atTime:host->_time];[controls prepareWithSize:size scale:1 atTime:CMTimeMake(1,24)];
run.record(@"viewer-playhead-change-clears-graphic-capture",![controls capturing]);
run.record(@"viewer-missing-next-frame-snapshot-preserves-selected-independent-layer",[[curve valueForKey:@"nodeID"]isEqual:layerID]&&!areaFor(curve,@"curvePlot",nil));
host->_time=CMTimeMake(1,24);publish();run.record(@"viewer-new-frame-restores-the-same-independent-editor-target",[[curve valueForKey:@"nodeID"]isEqual:layerID]&&areaFor(curve,@"curvePlot",nil));host->_time=kCMTimeZero;publish();
doc=DYMutablePlist(DYReadTools(host,host->_time).document);DYRemoveTool(doc,layerID);DYWriteTools(host,doc,host->_time);publish();run.record(@"viewer-deleted-layer-falls-back-to-surviving-same-tool",[[curve valueForKey:@"nodeID"]isEqual:@"base:curve"]);
click(areaFor(controls,@"hidePanels",nil));BOOL bounded=YES;
for(NSSize next:{NSMakeSize(120,80),NSMakeSize(180,200),NSMakeSize(320,240),NSMakeSize(1000,462),NSMakeSize(1280,720)})for(CGFloat scale:{1.,2.}){[controls setViewport:NSMakeRect(0,0,next.width,next.height)];[controls prepareWithSize:next scale:scale atTime:host->_time];for(NSDictionary*a in [controls valueForKey:@"areas"])bounded&=NSContainsRect(NSMakeRect(0,0,next.width,next.height),[a[@"rect"]rectValue]);bounded&=[controls partAtPoint:NSMakePoint(-1,20)]==0&&[controls partAtPoint:NSMakePoint(next.width+1,20)]==0&&[controls partAtPoint:NSMakePoint(30,next.height+1)]==0;}
run.record(@"viewer-small-and-retina-canvases-never-hit-outside-visible-image",bounded);
[controls setViewport:NSMakeRect(0,0,180,200)];[controls prepareWithSize:NSMakeSize(180,200)scale:1 atTime:host->_time];click(areaFor(controls,@"tool",@"base"));NSDictionary*railEntry=areaFor(controls,@"tool",@"base");NSRect entryRect=[railEntry[@"rect"]rectValue];run.record(@"viewer-vertical-entry-remains-reachable-above-overlapping-small-panel",[controls partAtPoint:NSMakePoint(NSMidX(entryRect),NSMidY(entryRect))]==[railEntry[@"part"]integerValue]);
click(areaFor(controls,@"hidePanels",nil));
[controls setViewport:NSMakeRect(40,30,1160,650)];[controls prepareWithSize:size scale:1 atTime:host->_time];NSRect rail=[[controls valueForKey:@"rail"]rectValue];run.record(@"viewer-rail-is-anchored-to-image-and-not-letterbox",NSContainsRect(NSMakeRect(40,30,1160,650),rail)&&[controls partAtPoint:NSMakePoint(NSMidX(rail),20)]==0);
// Offscreen drawing checks the actual OSC renderer, without opening an APP.
[controls setViewport:NSMakeRect(0,0,1280,720)];[controls prepareWithSize:size scale:1 atTime:host->_time];
for(NSString*type in @[@"base",@"curve",@"grading"]){click(areaFor(controls,@"tool",type));id p=panelFor(type);CGFloat px=[type isEqual:@"base"]?.05:[type isEqual:@"curve"]?.32:.59;[p setValue:[NSValue valueWithPoint:NSMakePoint(px,.1)]forKey:@"position"];}
[controls prepareWithSize:size scale:1 atTime:host->_time];
NSBitmapImageRep*bitmap=[[[NSBitmapImageRep alloc]initWithBitmapDataPlanes:NULL pixelsWide:1280 pixelsHigh:720 bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:1280*4 bitsPerPixel:32]autorelease];
[NSGraphicsContext saveGraphicsState];[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap]];NSAffineTransform*flip=[NSAffineTransform transform];[flip translateXBy:0 yBy:720];[flip scaleXBy:1 yBy:-1];[flip concat];[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithCGContext:NSGraphicsContext.currentContext.CGContext flipped:YES]];
[[NSColor colorWithCalibratedWhite:.2 alpha:1]setFill];NSRectFill(NSMakeRect(0,0,1280,720));[controls draw];[NSGraphicsContext restoreGraphicsState];NSString*png=[runtime stringByAppendingPathComponent:@"viewer-workspace.png"];
run.record(@"viewer-real-osc-draws-vertical-rail-curves-and-wheels-offscreen",[[bitmap representationUsingType:NSBitmapImageFileTypePNG properties:@{}]writeToFile:png atomically:YES],@{@"path":png});
[controls finishCapture];controls.bridge=nil;[bridge invalidate];drain();[controls release];[bridge release];
}
@@ -0,0 +1,18 @@
#pragma once
@protocol DYViewerControlsProbe
@property(nonatomic,retain) id<DYViewerParameterProbe> bridge;
- (void)setViewport:(NSRect)viewport;
- (void)prepareWithSize:(NSSize)size scale:(CGFloat)scale atTime:(CMTime)time;
- (void)draw;
- (NSInteger)partAtPoint:(NSPoint)point;
- (BOOL)event:(NSEventType)type point:(NSPoint)point atTime:(CMTime)time;
- (BOOL)mouseMoved:(NSPoint)point;
- (BOOL)mouseExited;
- (BOOL)capturing;
- (BOOL)finishCapture;
- (id)valueForKey:(NSString*)key;
@end
@interface NSObject (DYMaskToolbarDiagnosticGeometry)
- (NSRect)toolbarRectForItem:(NSInteger)item;
@end
@@ -0,0 +1,71 @@
// Methods of DYViewerParameterPanel. Geometry is shared by drawing and input.
- (double)graphicValue:(NSString*)key{return [self valueForDescriptor:[self descriptorForKey:key]];}
- (NSArray*)curveSlots{
NSMutableArray*slots=[NSMutableArray array];NSInteger n=_channel==0?4:2;
for(NSInteger i=0;i<n;i++)[slots addObject:@{@"xKey":_channel==0?[NSString stringWithFormat:@"masterX%ld",(long)i]:[NSString stringWithFormat:@"channel%ldX%ld",(long)_channel-1,(long)i],@"yKey":[NSString stringWithFormat:@"curveY%ld",(long)(_channel==0?i:4+(_channel-1)*2+i)]}];
for(NSInteger i=0;i<4;i++)[slots addObject:@{@"xKey":[NSString stringWithFormat:@"curve%ldExtraX%ld",(long)_channel,(long)i],@"yKey":[NSString stringWithFormat:@"curve%ldExtra%ld",(long)_channel,(long)i]}];return slots;
}
- (NSArray*)curvePoints{
NSMutableArray*points=[NSMutableArray array];for(NSDictionary*slot in [self curveSlots]){double x=[self graphicValue:slot[@"xKey"]];if(x<0)continue;[points addObject:@{@"xKey":slot[@"xKey"],@"yKey":slot[@"yKey"],@"x":@(x),@"y":@(MAX(0.,MIN(1.,x+[self graphicValue:slot[@"yKey"]]*.01)))}];}
[points sortUsingComparator:^NSComparisonResult(NSDictionary*a,NSDictionary*b){return [a[@"x"]compare:b[@"x"]];}];return points;
}
- (void)layoutGraphicAt:(CGFloat)y{
if(!_snapshot||![self node]||_panel.size.width<180*_scale||_panel.size.height<180*_scale)return;CGFloat s=_scale,x=_panel.origin.x,w=_panel.size.width;
if([_toolType isEqual:@"curve"]){
for(NSInteger c=0;c<4;c++)[self addArea:NSMakeRect(x+12*s+c*(w-24*s)/4,y,(w-30*s)/4,23*s)part:22010+c kind:@"channel" title:@[@"RGB",@"红",@"绿",@"蓝"][c] descriptor:nil index:c];
NSRect graph=NSMakeRect(x+18*s,y+31*s,w-36*s,MAX(45*s,NSMaxY(_panel)-y-84*s));[self addArea:graph part:22000 kind:@"curvePlot" title:@"" descriptor:nil index:0];
if(_selectedX)[self addArea:NSMakeRect(x+12*s,NSMaxY(_panel)-47*s,90*s,20*s)part:22020 kind:@"deletePoint" title:@"删除选中点" descriptor:nil index:0];
}else{
CGFloat diameter=MAX(20*s,MIN((w-48*s)/2,(NSMaxY(_panel)-y-52*s)/2-20*s));
for(NSInteger i=0;i<4;i++){CGFloat cx=x+w*(i%2?.75:.25),top=y+(i/2)*(diameter+29*s);[self addArea:NSMakeRect(cx-diameter/2,top+20*s,diameter,diameter)part:22100+i kind:@"wheel" title:@[@"阴影",@"中间调",@"高光",@"全局"][i] descriptor:nil index:i];}
}
}
- (NSPoint)curvePosition:(NSDictionary*)p rect:(NSRect)r{return NSMakePoint(r.origin.x+[p[@"x"]doubleValue]*r.size.width,r.origin.y+(1-[p[@"y"]doubleValue])*r.size.height);}
- (void)drawGraphic:(NSDictionary*)area{
CGFloat s=_scale;NSRect r=[area[@"rect"]rectValue];NSColor*ink=DYThemeColor(@"text"),*accent=DYThemeColor(@"accent");
if([area[@"kind"]isEqual:@"wheel"]){
NSInteger index=[area[@"index"]integerValue];[self text:area[@"title"]rect:NSMakeRect(r.origin.x,r.origin.y-19*s,r.size.width,17*s)size:10 color:ink alignment:NSTextAlignmentCenter];
// Cached raster is generated from the same HSV convention as the renderer controls.
static NSImage*wheel=nil;static dispatch_once_t once;dispatch_once(&once,^{NSInteger n=192;NSBitmapImageRep*b=[[[NSBitmapImageRep alloc]initWithBitmapDataPlanes:NULL pixelsWide:n pixelsHigh:n bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bytesPerRow:n*4 bitsPerPixel:32]autorelease];
for(NSInteger yy=0;yy<n;yy++)for(NSInteger xx=0;xx<n;xx++){double dx=(xx+.5-n*.5)/(n*.5-1),dy=(n*.5-yy-.5)/(n*.5-1),sat=hypot(dx,dy),h=atan2(dy,dx)/(2*M_PI);if(h<0)h++;NSColor*c=[NSColor colorWithSRGBRed:1 green:1 blue:1 alpha:1];c=[[NSColor colorWithHue:h saturation:MIN(1.,sat) brightness:1 alpha:1]colorUsingColorSpace:NSColorSpace.sRGBColorSpace];NSUInteger at=(yy*n+xx)*4;b.bitmapData[at]=lrint(c.redComponent*255);b.bitmapData[at+1]=lrint(c.greenComponent*255);b.bitmapData[at+2]=lrint(c.blueComponent*255);b.bitmapData[at+3]=sat<=1?230:0;}
wheel=[[NSImage alloc]initWithSize:NSMakeSize(n,n)];[wheel addRepresentation:b];});
[wheel drawInRect:r fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:.8 respectFlipped:YES hints:nil];
double hue=[self graphicValue:[NSString stringWithFormat:@"grade%ld_0",(long)index]],sat=[self graphicValue:[NSString stringWithFormat:@"grade%ld_1",(long)index]],angle=hue*M_PI/180,rad=r.size.width*.5*sat/100;
NSPoint p=NSMakePoint(NSMidX(r)+cos(angle)*rad,NSMidY(r)-sin(angle)*rad);[NSColor.blackColor setStroke];NSBezierPath*knob=[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(p.x-5*s,p.y-5*s,10*s,10*s)];knob.lineWidth=3*s;[knob stroke];[NSColor.whiteColor setStroke];knob.lineWidth=1.4*s;[knob stroke];
return;
}
DYDrawSoftControl(r,4*s,YES,NO,NO);[NSGraphicsContext saveGraphicsState];NSRectClip(r);
[[ink colorWithAlphaComponent:.16]setStroke];NSBezierPath*grid=[NSBezierPath bezierPath];grid.lineWidth=.5*s;
for(int i=0;i<5;i++){CGFloat x=r.origin.x+r.size.width*i/4,y=r.origin.y+r.size.height*i/4;[grid moveToPoint:NSMakePoint(x,NSMinY(r))];[grid lineToPoint:NSMakePoint(x,NSMaxY(r))];[grid moveToPoint:NSMakePoint(NSMinX(r),y)];[grid lineToPoint:NSMakePoint(NSMaxX(r),y)];}[grid stroke];
[[ink colorWithAlphaComponent:.2]setStroke];NSBezierPath*diagonal=[NSBezierPath bezierPath];[diagonal moveToPoint:NSMakePoint(NSMinX(r),NSMaxY(r))];[diagonal lineToPoint:NSMakePoint(NSMaxX(r),NSMinY(r))];[diagonal stroke];
// Identical monotone Hermite interpolation to the existing curve editor.
NSArray*points=[self curvePoints];std::vector<NSPoint> p;p.push_back(NSMakePoint(0,0));for(NSDictionary*point in points)p.push_back(NSMakePoint([point[@"x"]doubleValue],[point[@"y"]doubleValue]));p.push_back(NSMakePoint(1,1));
for(size_t i=1;i<p.size();i++)p[i].x=MAX(p[i].x,p[i-1].x+.0001);p.back().x=1;
std::vector<double>slopes(p.size()-1),m(p.size());for(size_t i=0;i<slopes.size();i++)slopes[i]=(p[i+1].y-p[i].y)/MAX(.0001,p[i+1].x-p[i].x);m.front()=slopes.front();m.back()=slopes.back();for(size_t i=1;i+1<p.size();i++)m[i]=slopes[i-1]*slopes[i]>0?(slopes[i-1]+slopes[i])*.5:0;
for(size_t i=0;i<slopes.size();i++){if(fabs(slopes[i])<.00001)m[i]=m[i+1]=0;else{double a=m[i]/slopes[i],b=m[i+1]/slopes[i],v=hypot(a,b);if(v>3){m[i]=3*slopes[i]*a/v;m[i+1]=3*slopes[i]*b/v;}}}
NSBezierPath*curve=[NSBezierPath bezierPath];curve.lineWidth=1.8*s;size_t segment=0;
for(int sample=0;sample<=256;sample++){double x=sample/256.;while(segment+2<p.size()&&x>p[segment+1].x)segment++;double width=MAX(.0001,p[segment+1].x-p[segment].x),t=MAX(0.,MIN(1.,(x-p[segment].x)/width)),t2=t*t,t3=t2*t;double y=(2*t3-3*t2+1)*p[segment].y+(t3-2*t2+t)*width*m[segment]+(-2*t3+3*t2)*p[segment+1].y+(t3-t2)*width*m[segment+1];NSPoint q=NSMakePoint(r.origin.x+x*r.size.width,r.origin.y+(1-MAX(0.,MIN(1.,y)))*r.size.height);if(sample==0)[curve moveToPoint:q];else[curve lineToPoint:q];}
NSColor*color=_channel==0?accent:_channel==1?NSColor.systemRedColor:_channel==2?NSColor.systemGreenColor:NSColor.systemBlueColor;[color setStroke];[curve stroke];
for(NSDictionary*point in points){NSPoint q=[self curvePosition:point rect:r];BOOL selected=[point[@"xKey"]isEqual:_selectedX];[color setFill];NSBezierPath*dot=[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(q.x-4*s,q.y-4*s,8*s,8*s)];[dot fill];[(selected?NSColor.whiteColor:ink)setStroke];dot.lineWidth=(selected?2:1)*s;[dot stroke];}
[NSGraphicsContext restoreGraphicsState];[self text:@"0 输入 → 1" rect:NSMakeRect(r.origin.x,NSMaxY(r)+2*s,r.size.width,14*s)size:8 color:ink alignment:NSTextAlignmentCenter];
}
- (void)beginGraphicAt:(NSPoint)p{
if(!_snapshot||![self node])return;NSMutableDictionary*c=[[_captured mutableCopy]autorelease];NSRect r=[c[@"rect"]rectValue];NSString*xKey=nil,*yKey=nil;
if([c[@"kind"]isEqual:@"curvePlot"]){NSDictionary*nearest=nil;double distance=12*_scale;for(NSDictionary*point in [self curvePoints]){NSPoint q=[self curvePosition:point rect:r];double d=hypot(q.x-p.x,q.y-p.y);if(d<distance){distance=d;nearest=point;}}
if(!nearest)for(NSDictionary*slot in [self curveSlots])if([self graphicValue:slot[@"xKey"]]<0){nearest=slot;break;}
if(!nearest)return;xKey=nearest[@"xKey"];yKey=nearest[@"yKey"];[_selectedX release];_selectedX=[xKey copy];c[@"newPoint"]=@([self graphicValue:xKey]<0);
}else{if(hypot(p.x-NSMidX(r),p.y-NSMidY(r))>r.size.width*.5)return;NSInteger i=[c[@"index"]integerValue];xKey=[NSString stringWithFormat:@"grade%ld_0",(long)i];yKey=[NSString stringWithFormat:@"grade%ld_1",(long)i];}
NSDictionary*xd=[self descriptorForKey:xKey],*yd=[self descriptorForKey:yKey];if(!xd||!yd)return;c[@"xKey"]=xKey;c[@"yKey"]=yKey;
[_captured release];_captured=[c copy];NSDictionary*values=@{xKey:@([self graphicValue:xKey]),yKey:@([self graphicValue:yKey])};[_bridge beginParameters:@[xd,yd]node:_nodeID values:values atTime:_time];
if([c[@"newPoint"]boolValue]||[c[@"kind"]isEqual:@"wheel"])[self updateGraphicAt:p];
}
- (void)updateGraphicAt:(NSPoint)p{
NSString*xKey=_captured[@"xKey"],*yKey=_captured[@"yKey"];if(!xKey||!yKey)return;NSRect r=[_captured[@"rect"]rectValue];double x,y;
if([_captured[@"kind"]isEqual:@"curvePlot"]){x=MAX(.001,MIN(.999,(p.x-r.origin.x)/MAX(1.,r.size.width)));double output=MAX(0.,MIN(1.,1-(p.y-r.origin.y)/MAX(1.,r.size.height)));
for(NSDictionary*point in [self curvePoints])if(![point[@"xKey"]isEqual:xKey]){double other=[point[@"x"]doubleValue];if(fabs(x-other)<.001)x=x<other?other-.001:other+.001;}x=MAX(.001,MIN(.999,x));y=(output-x)*100;
}else{double dx=p.x-NSMidX(r),dy=NSMidY(r)-p.y;x=atan2(dy,dx)*180/M_PI;if(x<0)x+=360;y=MIN(100.,hypot(dx,dy)/(r.size.width*.5)*100);}
NSDictionary*values=@{xKey:@(x),yKey:@(y)};[_draftValues addEntriesFromDictionary:values];[_bridge changeValues:values];
}
- (void)deleteSelectedPoint{
if(!_selectedX)return;for(NSDictionary*point in [self curvePoints])if([point[@"xKey"]isEqual:_selectedX]){NSString*x=point[@"xKey"],*y=point[@"yKey"];[_bridge beginParameters:@[[self descriptorForKey:x],[self descriptorForKey:y]]node:_nodeID values:@{x:@([self graphicValue:x]),y:@([self graphicValue:y])}atTime:_time];[_bridge changeValues:@{x:@(-1),y:@0}];[_bridge endGesture];break;}[_selectedX release];_selectedX=nil;
}
@@ -0,0 +1,275 @@
// The OSC side publishes values and enqueues intent. Only the main queue enters
// host actions; no OSC/render callback waits for AppKit or a host model write.
@interface DYViewerParameterBridge : NSObject
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager;
- (void)publishUniforms:(const DYUniforms*)uniforms document:(NSDictionary*)document atTime:(CMTime)time;
- (NSDictionary*)snapshotAtTime:(CMTime)time;
- (void)beginParameter:(NSDictionary*)descriptor node:(NSString*)nodeID value:(double)value atTime:(CMTime)time;
- (void)changeValue:(double)value;
- (void)beginParameters:(NSArray<NSDictionary*>*)descriptors node:(NSString*)nodeID values:(NSDictionary<NSString*,NSNumber*>*)values atTime:(CMTime)time;
// Every sample supplies every key selected by beginParameters. Invalid or
// incomplete samples are rejected as a unit, before the first host write.
- (void)changeValues:(NSDictionary<NSString*,NSNumber*>*)values;
- (void)endGesture;
// Call before the owning plug-in releases this object during teardown.
- (void)invalidate;
- (void)requestWorkspace;
@end
static BOOL DYViewerSameValue(double a,double b) {
return std::isfinite(a)&&std::isfinite(b)&&fabs(a-b)<=1e-6*MAX(1.,MAX(fabs(a),fabs(b)));
}
static NSDictionary *DYViewerCanonicalDescriptor(NSDictionary *candidate) {
if(![candidate isKindOfClass:NSDictionary.class])return nil;
for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:candidate[@"pid"]]&&[d[@"key"]isEqual:candidate[@"key"]])return d;
return nil;
}
static BOOL DYViewerDescriptorBelongsToType(NSDictionary *d,NSString *type) {
if(!type.length)return NO;
for(NSDictionary *owned in DYBaseToolDescriptors(type))if([owned[@"pid"]isEqual:d[@"pid"]])return YES;
return NO;
}
static BOOL DYViewerSanitizeValue(NSDictionary *d,double input,double *output) {
if(!d||!std::isfinite(input))return NO;
double lo=[d[@"min"]doubleValue],hi=[d[@"max"]doubleValue],v=MAX(lo,MIN(hi,input));
if(!std::isfinite(lo)||!std::isfinite(hi)||hi<lo)return NO;
if([d[@"kind"]isEqual:@"bool"])v=v>=.5?1:0;
else if([d[@"kind"]isEqual:@"popup"]){
// A popup is an enum, not a continuous range. Unknown choices must not
// silently turn into the first/last item when a stale event is received.
v=round(input);NSArray *values=d[@"values"];
if(values){BOOL found=NO;for(NSNumber *number in values)if(DYViewerSameValue(v,number.doubleValue)){v=number.doubleValue;found=YES;break;}if(!found)return NO;}
else if(v<0||v>=(double)[d[@"options"]count])return NO;
if(v<lo||v>hi)return NO;
}
if(output)*output=v;return YES;
}
@implementation DYViewerParameterBridge {
id<PROAPIAccessing> _apiManager;
NSDictionary *_snapshot,*_sourceDocument;
CMTime _snapshotTime;
BOOL _invalidated,_validationScheduled;
uint64_t _requestSequence,_requestedGesture;
// The fields below are confined to the main queue.
id<PROAPIAccessing> _writerHost,_writerTarget;
NSArray *_writerDescriptors;
NSDictionary *_writerLastValues,*_writerCompanions;
NSString *_writerNode,*_writerType;
CMTime _writerTime;
uint64_t _writerGesture;
BOOL _writerUndoOpen;
}
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager {
if((self=[super init])){_apiManager=manager;_snapshotTime=kCMTimeInvalid;_writerTime=kCMTimeInvalid;}return self;
}
- (void)dealloc {
// invalidate enqueues closure before the owner releases its final reference;
// the queued block keeps the bridge alive until its host group is closed.
NSCAssert(!_writerUndoOpen,@"Viewer parameter group must be closed before teardown");
[_snapshot release];[_sourceDocument release];[_writerHost release];[_writerTarget release];
[_writerDescriptors release];[_writerLastValues release];[_writerCompanions release];[_writerNode release];[_writerType release];[super dealloc];
}
- (void)requestWorkspace{
dispatch_async(dispatch_get_main_queue(),^{id manager=nil;@synchronized(self){if(!_invalidated)manager=_apiManager;}if(manager)[NSNotificationCenter.defaultCenter postNotificationName:@"DYColorWorkspaceRequested" object:manager];});
}
- (void)publishUniforms:(const DYUniforms*)uniforms document:(NSDictionary*)document atTime:(CMTime)time {
if(!uniforms||!document||!CMTIME_IS_NUMERIC(time))return;
NSDictionary *frozen=nil;
@synchronized(self){
if(_invalidated)return;
if(document==_sourceDocument&&![document isKindOfClass:NSMutableDictionary.class])frozen=[_snapshot[@"document"]retain];
}
if(!frozen){
DYToolDocument *copy=[[[DYToolDocument alloc]init]autorelease];
if(!DYValidToolDocument(document))return;copy.document=document;frozen=[copy.document retain];
}
NSData *bytes=[NSData dataWithBytes:uniforms length:sizeof(*uniforms)];BOOL validate=NO;
@synchronized(self){
if(!_invalidated){
[_snapshot release];_snapshot=[@{@"uniforms":bytes,@"document":frozen,@"timeValue":@(time.value),@"timeScale":@(time.timescale),@"timeEpoch":@(time.epoch)}copy];
[_sourceDocument release];_sourceDocument=[document retain];_snapshotTime=time;
if(_requestedGesture&&!_validationScheduled){_validationScheduled=YES;validate=YES;}
}
}
[frozen release];
if(validate)dispatch_async(dispatch_get_main_queue(),^{
@synchronized(self){self->_validationScheduled=NO;}
if(self->_writerGesture&&![self writerStillValid])[self closeWriter];
});
}
- (NSDictionary*)snapshotAtTime:(CMTime)time {
@synchronized(self){
if(_invalidated||!CMTIME_IS_NUMERIC(time)||!CMTIME_IS_NUMERIC(_snapshotTime)||CMTimeCompare(time,_snapshotTime)!=0)return nil;
return [[_snapshot retain]autorelease];
}
}
- (void)closeWriter {
NSCAssert(NSThread.isMainThread,@"Host writes require the main queue");
if(_writerUndoOpen){
id<FxCustomParameterActionAPI_v4>action=[_writerHost apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];
[action startAction:self];@try{[[_writerHost apiForProtocol:@protocol(FxUndoAPI)]endUndoGroup];}@finally{[action endAction:self];}
}
_writerUndoOpen=NO;_writerGesture=0;_writerTime=kCMTimeInvalid;
[_writerHost release];_writerHost=nil;[_writerTarget release];_writerTarget=nil;
[_writerDescriptors release];_writerDescriptors=nil;[_writerLastValues release];_writerLastValues=nil;
[_writerCompanions release];_writerCompanions=nil;
[_writerNode release];_writerNode=nil;[_writerType release];_writerType=nil;
}
- (BOOL)writerNodeExists {
NSDictionary *doc=DYReadTools(_writerHost,_writerTime).document;
if([_writerNode hasPrefix:@"base:"])return !DYBaseToolRemoved(doc,_writerType);
NSDictionary *node=DYToolWithID(doc,_writerNode);return node&&[node[@"type"]isEqual:_writerType];
}
- (BOOL)writerValueMatches {
if(![self writerNodeExists])return NO;
id<FxParameterRetrievalAPI_v6>get=[_writerTarget apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];
for(NSDictionary *d in _writerDescriptors){double value=NAN;
if(![get getFloatValue:&value fromParameter:[d[@"pid"]unsignedIntValue] atTime:_writerTime]||!DYViewerSameValue(value,[_writerLastValues[d[@"key"]]doubleValue]))return NO;
}
// Primary scalar edits also touch configuration/bypass switches. A later
// external change to any of those switches must win over this live drag.
for(NSNumber *pid in _writerCompanions){double companion=NAN;if(![get getFloatValue:&companion fromParameter:pid.unsignedIntValue atTime:_writerTime]||!DYViewerSameValue(companion,[_writerCompanions[pid]doubleValue]))return NO;}
return YES;
}
- (BOOL)writerStillValid {
if(!_writerGesture)return NO;BOOL active;
@synchronized(self){active=!_invalidated;}
if(!active)return NO;
id<FxCustomParameterActionAPI_v4>action=[_writerTarget apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!action)return NO;
BOOL valid=NO;[action startAction:self];@try{
valid=CMTIME_IS_NUMERIC(action.currentTime)&&CMTimeCompare(action.currentTime,_writerTime)==0&&[self writerValueMatches];
}@finally{[action endAction:self];}return valid;
}
- (void)beginParameter:(NSDictionary*)descriptor node:(NSString*)nodeID value:(double)value atTime:(CMTime)time {
NSDictionary *d=DYViewerCanonicalDescriptor(descriptor);if(!d)return;
[self beginParameters:@[d] node:nodeID values:@{d[@"key"]:@(value)} atTime:time];
}
- (void)beginParameters:(NSArray<NSDictionary*>*)descriptors node:(NSString*)nodeID values:(NSDictionary<NSString*,NSNumber*>*)values atTime:(CMTime)time {
if(![descriptors isKindOfClass:NSArray.class]||!descriptors.count||descriptors.count>DYDescriptors().count||![values isKindOfClass:NSDictionary.class]||values.count!=descriptors.count||![nodeID isKindOfClass:NSString.class]||!CMTIME_IS_NUMERIC(time))return;
NSMutableArray *canonical=[NSMutableArray array];NSMutableDictionary *original=[NSMutableDictionary dictionary];NSMutableSet *pids=[NSMutableSet set];
for(NSDictionary *candidate in descriptors){
NSDictionary *d=DYViewerCanonicalDescriptor(candidate);NSNumber *number=d?values[d[@"key"]]:nil;double sanitized=0;
if(!d||original[d[@"key"]]||[pids containsObject:d[@"pid"]]||![number isKindOfClass:NSNumber.class]||!DYViewerSanitizeValue(d,number.doubleValue,&sanitized))return;
[canonical addObject:d];[pids addObject:d[@"pid"]];original[d[@"key"]]=@(sanitized);
}
NSString *node=[nodeID copy];NSArray *selected=[canonical copy];NSDictionary *initial=[original copy];uint64_t gesture;
@synchronized(self){if(_invalidated){[node release];[selected release];[initial release];return;}_requestedGesture=gesture=++_requestSequence;}
dispatch_async(dispatch_get_main_queue(),^{
[self closeWriter];id<PROAPIAccessing>host=nil;
@synchronized(self){if(!self->_invalidated)host=[self->_apiManager retain];}
if(!host)return;
id<FxCustomParameterActionAPI_v4>action=[host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];
if(!action){[host release];return;}
id<PROAPIAccessing>target=nil;NSString *type=nil;
[action startAction:self];@try{
if(CMTIME_IS_NUMERIC(action.currentTime)&&CMTimeCompare(action.currentTime,time)==0){
NSDictionary *doc=DYReadTools(host,time).document;
if([node hasPrefix:@"base:"]){type=[node substringFromIndex:5];if([DYToolTypes()containsObject:type]&&!DYBaseToolRemoved(doc,type))target=[host retain];}
else{NSDictionary *layer=DYToolWithID(doc,node);if(layer){type=layer[@"type"];target=[[DYToolManager alloc]initWithHost:host node:layer];}}
for(NSDictionary *d in selected)if(!DYViewerDescriptorBelongsToType(d,type)){[target release];target=nil;break;}
type=[type copy];
}
}@finally{[action endAction:self];}
if(target){
self->_writerHost=host;self->_writerTarget=target;self->_writerDescriptors=[selected retain];self->_writerLastValues=[initial retain];self->_writerNode=[node copy];self->_writerType=type;
self->_writerTime=time;self->_writerGesture=gesture;
if(![self writerStillValid])[self closeWriter];
}else{[type release];[host release];}
});
[node release];[selected release];[initial release];
}
- (void)writeValues:(NSDictionary<NSString*,NSNumber*>*)values gesture:(uint64_t)gesture {
NSCAssert(NSThread.isMainThread,@"Host writes require the main queue");
if(!_writerGesture||gesture!=_writerGesture||values.count!=_writerDescriptors.count)return;
NSMutableDictionary *desired=[NSMutableDictionary dictionary];BOOL anyChanged=NO,primaryValue=NO,blackWhite=NO;NSString *workingKey=nil;
NSMutableSet *explicitPids=[NSMutableSet set];
for(NSDictionary *d in _writerDescriptors){
NSString *key=d[@"key"];NSNumber *number=values[key];double v=0;
if(![number isKindOfClass:NSNumber.class]||!DYViewerSanitizeValue(d,number.doubleValue,&v))return;
desired[key]=@(v);[explicitPids addObject:d[@"pid"]];
if(!DYViewerSameValue(v,[_writerLastValues[key]doubleValue])){
anyChanged=YES;
primaryValue|=[key hasPrefix:@"cm"]&&![key hasPrefix:@"cmbypass"]&&![key isEqual:@"cmConfigured"]&&![key hasSuffix:@"Enabled"];
blackWhite|=[key isEqual:@"blackWhiteMix"];
if([@[@"cmworkingTransfer",@"cmworkingGamut"]containsObject:key])workingKey=key;
}
}
BOOL active;@synchronized(self){active=!_invalidated;}if(!active){[self closeWriter];return;}
id<FxCustomParameterActionAPI_v4>action=[_writerTarget apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];
if(!action){[self closeWriter];return;}BOOL conflict=NO,changed=NO,failed=NO;
[action startAction:self];@try{
conflict=!CMTIME_IS_NUMERIC(action.currentTime)||CMTimeCompare(action.currentTime,_writerTime)!=0||![self writerValueMatches];
if(!conflict&&anyChanged){
id<FxUndoAPI>undo=[_writerHost apiForProtocol:@protocol(FxUndoAPI)];
NSString *title=_writerDescriptors.count==1?_writerDescriptors[0][@"title"]:@"图形控件";
if(!_writerUndoOpen)_writerUndoOpen=[undo startUndoGroup:[@"画面调整 · " stringByAppendingString:title?:@"调色"]];
if(_writerUndoOpen){
id<FxParameterSettingAPI_v6>set=[_writerTarget apiForProtocol:@protocol(FxParameterSettingAPI_v6)];
id<FxParameterRetrievalAPI_v6>get=[_writerTarget apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];
NSMutableDictionary *before=[NSMutableDictionary dictionary];
for(NSDictionary *d in _writerDescriptors)before[d[@"pid"]]=_writerLastValues[d[@"key"]];
DYInspectorToken *old=nil;
if(primaryValue||blackWhite){
[get getCustomParameterValue:&old fromParameter:DYInspectorParameterID atTime:_writerTime];
for(NSDictionary *r in DYDescriptors())if([r[@"key"]isEqual:@"cmConfigured"]||(primaryValue&&[r[@"key"]hasPrefix:@"cmbypass"])){double previous=NAN;if([get getFloatValue:&previous fromParameter:[r[@"pid"]unsignedIntValue] atTime:_writerTime]&&std::isfinite(previous))before[r[@"pid"]]=@(previous);}
}
// Prevalidation and conflict checks cover the entire batch. Both axes are
// set inside this one action; an independent layer commits one document.
for(NSDictionary *d in _writerDescriptors)if(![set setFloatValue:[desired[d[@"key"]]doubleValue] toParameter:[d[@"pid"]unsignedIntValue] atTime:_writerTime]){failed=YES;break;}
if(!failed&&(primaryValue||blackWhite)){
// Explicit switches in the batch remain literal switches. Automatic CST
// companions never overwrite a requested eye/configuration/bypass value.
if(primaryValue){
if(![explicitPids containsObject:@2236])failed|=![set setFloatValue:1 toParameter:2236 atTime:_writerTime];
for(NSDictionary *r in DYDescriptors())if([r[@"key"]hasPrefix:@"cmbypass"]&&![explicitPids containsObject:r[@"pid"]])failed|=![set setFloatValue:0 toParameter:[r[@"pid"]unsignedIntValue] atTime:_writerTime];
}else if(old.schema<2&&![explicitPids containsObject:@2236]){double configured=0;[get getFloatValue:&configured fromParameter:2236 atTime:_writerTime];if(configured<.5)failed|=![set setFloatValue:-1 toParameter:2236 atTime:_writerTime];}
if(!failed&&old&&old.schema<2){DYInspectorToken *token=[[old copy]autorelease];token.schema=2;failed|=![set setCustomParameterValue:token toParameter:DYInspectorParameterID atTime:_writerTime];}
}
if(failed){
// The host API has no abortAction. Restore all affected fields before
// ending the action rather than leaving half a graphic update behind.
for(NSNumber *pid in before)[set setFloatValue:[before[pid]doubleValue] toParameter:pid.unsignedIntValue atTime:_writerTime];
if(old)[set setCustomParameterValue:old toParameter:DYInspectorParameterID atTime:_writerTime];
}else{
if(workingKey)DYPrimaryControlChanged(_writerTarget,_writerTime,workingKey);
NSMutableDictionary *actual=[NSMutableDictionary dictionary];
for(NSDictionary *d in _writerDescriptors){double v=[desired[d[@"key"]]doubleValue];[get getFloatValue:&v fromParameter:[d[@"pid"]unsignedIntValue] atTime:_writerTime];actual[d[@"key"]]=@(v);}
[_writerLastValues release];_writerLastValues=[actual copy];changed=YES;
if(primaryValue||blackWhite){
NSMutableDictionary *companions=[NSMutableDictionary dictionary];
for(NSDictionary *r in DYDescriptors())if([r[@"key"]isEqual:@"cmConfigured"]||(primaryValue&&[r[@"key"]hasPrefix:@"cmbypass"])){double related=NAN;if([get getFloatValue:&related fromParameter:[r[@"pid"]unsignedIntValue] atTime:_writerTime]&&std::isfinite(related))companions[r[@"pid"]]=@(related);}
[_writerCompanions release];_writerCompanions=[companions copy];
}
}
}
}
}@finally{[action endAction:self];}
if(conflict||failed)[self closeWriter];
if(changed)[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_apiManager];
}
- (void)changeValue:(double)value {
if(!std::isfinite(value))return;uint64_t gesture;
@synchronized(self){if(_invalidated)return;gesture=_requestedGesture;}
if(gesture)dispatch_async(dispatch_get_main_queue(),^{if(self->_writerGesture==gesture&&self->_writerDescriptors.count==1)[self writeValues:@{self->_writerDescriptors[0][@"key"]:@(value)} gesture:gesture];});
}
- (void)changeValues:(NSDictionary<NSString*,NSNumber*>*)values {
if(![values isKindOfClass:NSDictionary.class]||!values.count)return;
// Copy only validated primitive input, so callers may reuse mutable samples.
NSMutableDictionary *sample=[NSMutableDictionary dictionary];
for(id key in values){id value=values[key];if(![key isKindOfClass:NSString.class]||![value isKindOfClass:NSNumber.class]||!std::isfinite([value doubleValue]))return;sample[[[key copy]autorelease]]=@([value doubleValue]);}
NSDictionary *frozen=[sample copy];uint64_t gesture;
@synchronized(self){if(_invalidated){[frozen release];return;}gesture=_requestedGesture;}
if(gesture)dispatch_async(dispatch_get_main_queue(),^{[self writeValues:frozen gesture:gesture];});
[frozen release];
}
- (void)endGesture {
uint64_t gesture;@synchronized(self){gesture=_requestedGesture;_requestedGesture=0;}
if(gesture)dispatch_async(dispatch_get_main_queue(),^{if(self->_writerGesture==gesture)[self closeWriter];});
}
- (void)invalidate {
@synchronized(self){if(_invalidated)return;_invalidated=YES;_requestedGesture=0;_apiManager=nil;}
dispatch_async(dispatch_get_main_queue(),^{[self closeWriter];});
}
@end
@@ -0,0 +1,131 @@
{
// Exercise the real bridge on a fake host; the values pass through the same
// float IDs and immutable independent-layer document used by the product.
DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,&error);
DYToolCanvasProbe *host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero;
id<DYViewerParameterProbe>bridge=(id)[[NSClassFromString(@"DYViewerParameterBridge")alloc]initWithAPIManager:host];
auto drain=[](){double end=NSProcessInfo.processInfo.systemUptime+.025;while(NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.002]];};
auto descriptor=[](NSString *key)->NSDictionary*{for(NSDictionary *d in DYDescriptors())if([d[@"key"]isEqual:key])return d;return nil;};
auto value=[&](NSDictionary *d)->double{double v=NAN;[base getFloatValue:&v fromParameter:[d[@"pid"]unsignedIntValue] atTime:host->_time];return v;};
NSDictionary *exposure=descriptor(@"exposure"),*grainHold=descriptor(@"filmGrainHold"),*primaryExposure=descriptor(@"cmexposure"),*primaryEye=descriptor(@"primaryMasterEnabled");
DYUniforms u;DYReadUniforms(host,kCMTimeZero,&u);NSMutableDictionary *document=DYMutablePlist(DYReadTools(base,kCMTimeZero).document);
[bridge publishUniforms:&u document:document atTime:kCMTimeZero];NSDictionary *snapshot=[bridge snapshotAtTime:kCMTimeZero];
[document setObject:@[@"base"] forKey:@"removedBase"];
run.record(@"viewer-bridge-published-snapshot-is-immutable-and-frame-bound",[snapshot[@"uniforms"]length]==sizeof(DYUniforms)&&![snapshot[@"document"][@"removedBase"]count]&&![bridge snapshotAtTime:CMTimeMake(1,24)]);
int undo=base->_undoStarts;
[bridge beginParameter:exposure node:@"base:base" value:0 atTime:kCMTimeZero];[bridge changeValue:.4];drain();
run.record(@"viewer-bridge-drag-writes-before-mouse-up-asynchronously",fabs(value(exposure)-.4)<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo);
[bridge changeValue:.8];[bridge endGesture];[bridge endGesture];drain();
run.record(@"viewer-bridge-continuous-drag-closes-one-host-undo-group",fabs(value(exposure)-.8)<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
undo=base->_undoStarts;
[bridge beginParameter:exposure node:@"base:base" value:.8 atTime:kCMTimeZero];[bridge changeValue:.8];[bridge endGesture];drain();
run.record(@"viewer-bridge-no-op-gesture-does-not-create-an-undo",base->_undoStarts==undo&&base->_undoEnds==undo);
[bridge beginParameter:exposure node:@"base:base" value:.8 atTime:kCMTimeZero];[bridge changeValue:NAN];[bridge changeValue:INFINITY];[bridge endGesture];drain();
run.record(@"viewer-bridge-nonfinite-values-are-rejected",fabs(value(exposure)-.8)<1e-6&&base->_undoStarts==undo);
[bridge beginParameter:exposure node:@"base:base" value:.8 atTime:kCMTimeZero];[bridge changeValue:1000];[bridge endGesture];drain();
run.record(@"viewer-bridge-values-are-clamped-to-the-existing-parameter-domain",value(exposure)==[exposure[@"max"]doubleValue]);
undo=base->_undoStarts;
[bridge beginParameter:exposure node:@"base:base" value:value(exposure) atTime:kCMTimeZero];[bridge changeValue:1.1];drain();
[base setFloatValue:2.1 toParameter:[exposure[@"pid"]unsignedIntValue] atTime:kCMTimeZero];
[bridge changeValue:1.3];[bridge endGesture];drain();
run.record(@"viewer-bridge-external-parameter-edit-wins-and-closes-the-group",fabs(value(exposure)-2.1)<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
undo=base->_undoStarts;
[bridge beginParameter:exposure node:@"base:base" value:value(exposure) atTime:kCMTimeZero];[bridge changeValue:2.2];drain();
host->_time=CMTimeMake(1,24);[bridge changeValue:2.8];[bridge endGesture];drain();
run.record(@"viewer-bridge-playhead-change-does-not-write-to-a-new-frame",fabs(value(exposure)-2.2)<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);host->_time=kCMTimeZero;
undo=base->_undoStarts;
[bridge beginParameter:exposure node:@"base:base" value:0 atTime:kCMTimeZero];[bridge changeValue:1.2];[bridge endGesture];drain();
run.record(@"viewer-bridge-stale-snapshot-cannot-overwrite-current-values",fabs(value(exposure)-2.2)<1e-6&&base->_undoStarts==undo);
[bridge beginParameter:grainHold node:@"base:film" value:1 atTime:kCMTimeZero];[bridge changeValue:3.4];[bridge endGesture];drain();
run.record(@"viewer-bridge-popup-writes-an-existing-discrete-value",value(grainHold)==3);
NSDictionary *densityMode=descriptor(@"filmDensityMode");undo=base->_undoStarts;
[bridge beginParameter:densityMode node:@"base:film" value:2 atTime:kCMTimeZero];[bridge changeValue:0];[bridge endGesture];drain();
run.record(@"viewer-bridge-popup-values-outside-the-enumeration-are-rejected",value(densityMode)==2&&base->_undoStarts==undo);
[bridge beginParameter:primaryEye node:@"base:primary" value:value(primaryEye) atTime:kCMTimeZero];[bridge changeValue:0];[bridge endGesture];drain();
run.record(@"viewer-bridge-primary-master-eye-is-not-reactivated-by-the-bridge",value(primaryEye)==0);
[bridge beginParameter:primaryExposure node:@"base:primary" value:0 atTime:kCMTimeZero];[bridge changeValue:.3];[bridge endGesture];drain();
run.record(@"viewer-bridge-primary-edit-preserves-master-bypass-and-configures-cst",fabs(value(primaryExposure)-.3)<1e-6&&value(primaryEye)==0&&[base->_values[@2236]doubleValue]==1);
undo=base->_undoStarts;
[bridge beginParameter:primaryExposure node:@"base:primary" value:.3 atTime:kCMTimeZero];[bridge changeValue:.4];drain();
NSDictionary *bypass=descriptor(@"cmbypassExposure");[base setFloatValue:1 toParameter:[bypass[@"pid"]unsignedIntValue] atTime:kCMTimeZero];
[bridge changeValue:.6];[bridge endGesture];drain();
run.record(@"viewer-bridge-external-primary-bypass-is-not-cleared-by-a-later-drag",fabs(value(primaryExposure)-.4)<1e-6&&value(bypass)==1&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
undo=base->_undoStarts;
[bridge beginParameter:exposure node:@"base:base" value:value(exposure) atTime:kCMTimeZero];[bridge changeValue:2.3];drain();
host->_time=CMTimeMake(1,24);DYReadUniforms(host,host->_time,&u);[bridge publishUniforms:&u document:DYReadTools(base,host->_time).document atTime:host->_time];drain();
run.record(@"viewer-bridge-new-frame-publication-closes-an-abandoned-gesture",fabs(value(exposure)-2.3)<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);[bridge endGesture];drain();host->_time=kCMTimeZero;
undo=base->_undoStarts;
[bridge beginParameter:exposure node:@"missing-layer" value:value(exposure) atTime:kCMTimeZero];[bridge changeValue:4];[bridge endGesture];
[bridge beginParameter:exposure node:@"base:hsl" value:value(exposure) atTime:kCMTimeZero];[bridge changeValue:4];[bridge endGesture];drain();
run.record(@"viewer-bridge-invalid-node-and-wrong-module-descriptors-do-not-write",fabs(value(exposure)-2.3)<1e-6&&base->_undoStarts==undo);
NSMutableDictionary *doc=DYMutablePlist(DYReadTools(base,kCMTimeZero).document);NSDictionary *layer=DYInsertTool(doc,@"base",@"base:base");NSString *layerID=layer[@"id"];
DYWriteTools(base,doc,kCMTimeZero);double rootExposure=value(exposure);
[bridge beginParameter:exposure node:layerID value:0 atTime:kCMTimeZero];[bridge changeValue:.65];[bridge endGesture];drain();
NSDictionary *savedLayer=DYToolWithID(DYReadTools(base,kCMTimeZero).document,layerID);
run.record(@"viewer-bridge-independent-layer-keeps-root-and-other-layers-isolated",fabs([savedLayer[@"values"][@"exposure"]doubleValue]-.65)<1e-6&&value(exposure)==rootExposure);
undo=base->_undoStarts;
[bridge beginParameter:exposure node:layerID value:.65 atTime:kCMTimeZero];[bridge changeValue:.75];drain();
doc=DYMutablePlist(DYReadTools(base,kCMTimeZero).document);DYRemoveTool(doc,layerID);DYWriteTools(base,doc,kCMTimeZero);
[bridge changeValue:.9];[bridge endGesture];drain();
run.record(@"viewer-bridge-deleted-layer-is-not-recreated-by-a-pending-drag",!DYToolWithID(DYReadTools(base,kCMTimeZero).document,layerID)&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1&&value(exposure)==rootExposure);
undo=base->_undoStarts;
[bridge beginParameter:exposure node:@"base:base" value:rootExposure atTime:kCMTimeZero];[bridge changeValue:2.4];drain();
doc=DYMutablePlist(DYReadTools(base,kCMTimeZero).document);DYSetBaseToolRemoved(doc,@"base",YES);DYWriteTools(base,doc,kCMTimeZero);
[bridge changeValue:2.6];[bridge endGesture];drain();
run.record(@"viewer-bridge-removed-base-is-not-written-after-its-removal",fabs(value(exposure)-2.4)<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
doc=DYMutablePlist(DYReadTools(base,kCMTimeZero).document);DYSetBaseToolRemoved(doc,@"base",NO);DYWriteTools(base,doc,kCMTimeZero);
undo=base->_undoStarts;
[bridge beginParameter:exposure node:@"base:base" value:value(exposure) atTime:kCMTimeZero];[bridge changeValue:2.5];drain();
[bridge invalidate];[bridge changeValue:3];drain();
run.record(@"viewer-bridge-teardown-closes-a-live-undo-and-rejects-further-writes",fabs(value(exposure)-2.5)<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1&&![bridge snapshotAtTime:kCMTimeZero]);
[bridge release];
}
{
DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,&error);
DYViewerBatchActionProbe *host=[[[DYViewerBatchActionProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero;
id<DYViewerParameterProbe>bridge=(id)[[NSClassFromString(@"DYViewerParameterBridge")alloc]initWithAPIManager:host];
auto drain=[](){double end=NSProcessInfo.processInfo.systemUptime+.025;while(NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.002]];};
auto descriptor=[](NSString *key)->NSDictionary*{for(NSDictionary *d in DYDescriptors())if([d[@"key"]isEqual:key])return d;return nil;};
auto value=[&](NSDictionary *d)->double{double v=NAN;[base getFloatValue:&v fromParameter:[d[@"pid"]unsignedIntValue] atTime:host->_time];return v;};
NSDictionary *x=descriptor(@"masterX0"),*y=descriptor(@"curveY0"),*exposure=descriptor(@"exposure");NSArray *pair=@[x,y];
host->_pairIDs=[@[x[@"pid"],y[@"pid"]]copy];int undo=base->_undoStarts;
[bridge beginParameters:pair node:@"base:curve" values:@{@"masterX0":@(-1),@"curveY0":@0} atTime:kCMTimeZero];drain();
run.record(@"viewer-bridge-batch-begin-only-reads-and-preserves-unused-curve-slot",value(x)==-1&&value(y)==0&&base->_undoStarts==undo&&host->_committedPairs.count==0);
[bridge changeValues:@{@"masterX0":@.3,@"curveY0":@20}];drain();
NSArray *first=host->_committedPairs.lastObject;
run.record(@"viewer-bridge-curve-xy-are-live-in-one-host-action-before-mouse-up",fabs(value(x)-.3)<1e-6&&value(y)==20&&host->_committedPairs.count==1&&first.count==2&&fabs([first[0]doubleValue]-.3)<1e-6&&[first[1]doubleValue]==20&&host->_allWritesInsideAction&&base->_undoStarts==undo+1&&base->_undoEnds==undo);
[bridge changeValues:@{@"masterX0":@.4,@"curveY0":@30}];[bridge endGesture];drain();
run.record(@"viewer-bridge-batch-continuous-xy-drag-uses-one-undo",fabs(value(x)-.4)<1e-6&&value(y)==30&&host->_committedPairs.count==2&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
undo=base->_undoStarts;NSUInteger commits=host->_committedPairs.count;
[bridge beginParameters:pair node:@"base:curve" values:@{@"masterX0":@.4,@"curveY0":@30} atTime:kCMTimeZero];
[bridge changeValues:@{@"masterX0":@.5}];[bridge changeValues:@{@"masterX0":@.5,@"curveY0":@(NAN)}];[bridge changeValues:@{@"masterX0":@.5,@"wrong-key":@40}];[bridge endGesture];drain();
run.record(@"viewer-bridge-incomplete-nonfinite-and-foreign-key-samples-reject-the-entire-batch",fabs(value(x)-.4)<1e-6&&value(y)==30&&host->_committedPairs.count==commits&&base->_undoStarts==undo);
[bridge beginParameters:pair node:@"base:curve" values:@{@"masterX0":@.4,@"curveY0":@30} atTime:kCMTimeZero];[bridge changeValues:@{@"masterX0":@.4,@"curveY0":@30}];[bridge endGesture];drain();
run.record(@"viewer-bridge-batch-no-op-does-not-create-an-undo",base->_undoStarts==undo&&host->_committedPairs.count==commits);
[bridge beginParameters:pair node:@"base:curve" values:@{@"masterX0":@.4,@"curveY0":@30} atTime:kCMTimeZero];[bridge changeValues:@{@"masterX0":@.5,@"curveY0":@35}];drain();
[base setFloatValue:45 toParameter:[y[@"pid"]unsignedIntValue] atTime:kCMTimeZero];commits=host->_committedPairs.count;
[bridge changeValues:@{@"masterX0":@.6,@"curveY0":@40}];[bridge endGesture];drain();
run.record(@"viewer-bridge-external-y-edit-stops-both-axes-of-the-graphic-gesture",fabs(value(x)-.5)<1e-6&&value(y)==45&&host->_committedPairs.count==commits&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
undo=base->_undoStarts;
[bridge beginParameters:pair node:@"base:curve" values:@{@"masterX0":@.4,@"curveY0":@45} atTime:kCMTimeZero];[bridge changeValues:@{@"masterX0":@.8,@"curveY0":@60}];[bridge endGesture];drain();
run.record(@"viewer-bridge-one-stale-original-value-rejects-the-entire-graphic-gesture",fabs(value(x)-.5)<1e-6&&value(y)==45&&base->_undoStarts==undo);
[bridge beginParameters:@[x,exposure] node:@"base:curve" values:@{@"masterX0":@.5,@"exposure":@0} atTime:kCMTimeZero];[bridge changeValues:@{@"masterX0":@.8,@"exposure":@1}];[bridge endGesture];drain();
run.record(@"viewer-bridge-mixed-module-batch-is-rejected-before-any-write",fabs(value(x)-.5)<1e-6&&value(exposure)==0&&base->_undoStarts==undo);
NSMutableDictionary *doc=DYMutablePlist(DYReadTools(base,kCMTimeZero).document);NSDictionary *layer=DYInsertTool(doc,@"curve",@"base:curve");NSString *layerID=layer[@"id"];DYWriteTools(base,doc,kCMTimeZero);
[bridge beginParameters:pair node:layerID values:@{@"masterX0":@(-1),@"curveY0":@0} atTime:kCMTimeZero];[bridge changeValues:@{@"masterX0":@.2,@"curveY0":@(-10)}];[bridge endGesture];drain();
NSDictionary *saved=DYToolWithID(DYReadTools(base,kCMTimeZero).document,layerID);
run.record(@"viewer-bridge-independent-curve-xy-commit-together-with-root-isolation",fabs([saved[@"values"][@"masterX0"]doubleValue]-.2)<1e-6&&[saved[@"values"][@"curveY0"]doubleValue]==-10&&fabs(value(x)-.5)<1e-6&&value(y)==45&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
undo=base->_undoStarts;
[bridge beginParameter:exposure node:@"base:base" value:0 atTime:kCMTimeZero];[bridge changeValue:.25];[bridge endGesture];drain();
run.record(@"viewer-bridge-single-value-entry-points-remain-compatible-after-batch-extension",fabs(value(exposure)-.25)<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
undo=base->_undoStarts;host->_rejectParameterID=[y[@"pid"]unsignedIntValue];host->_rejectNextWrite=YES;
[bridge beginParameters:pair node:@"base:curve" values:@{@"masterX0":@.5,@"curveY0":@45} atTime:kCMTimeZero];[bridge changeValues:@{@"masterX0":@.7,@"curveY0":@50}];[bridge endGesture];drain();
run.record(@"viewer-bridge-rejected-second-field-restores-first-field-within-the-same-action",fabs(value(x)-.5)<1e-6&&value(y)==45&&host->_allWritesInsideAction&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
NSDictionary *h=descriptor(@"cmbalanceAngle"),*s=descriptor(@"cmbalanceStrength");undo=base->_undoStarts;
[bridge beginParameters:@[h,s] node:@"base:primary" values:@{@"cmbalanceAngle":@0,@"cmbalanceStrength":@0} atTime:kCMTimeZero];[bridge changeValues:@{@"cmbalanceAngle":@30,@"cmbalanceStrength":@.4}];drain();
[base setFloatValue:0 toParameter:2236 atTime:kCMTimeZero];
[bridge changeValues:@{@"cmbalanceAngle":@45,@"cmbalanceStrength":@.6}];[bridge endGesture];drain();
run.record(@"viewer-bridge-external-cst-configuration-conflict-stops-the-whole-color-wheel",value(h)==30&&fabs(value(s)-.4)<1e-6&&[base->_values[@2236]doubleValue]==0&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
[bridge invalidate];drain();[bridge release];
}
@@ -0,0 +1,157 @@
// Independently authored canvas UI. Hit geometry and drawing share the same layout.
#import "DYTheme.h"
@interface DYViewerParameterPanel : NSObject
@property(nonatomic,retain) DYViewerParameterBridge *bridge;
@property(nonatomic,copy) NSString *toolType;
@property(nonatomic) BOOL visible;
- (void)setInitialPosition:(NSPoint)position;
- (void)setViewport:(NSRect)viewport;
- (void)prepareWithSize:(NSSize)size scale:(CGFloat)scale atTime:(CMTime)time;
- (void)draw;
- (NSInteger)partAtPoint:(NSPoint)point;
- (BOOL)event:(NSEventType)type point:(NSPoint)point atTime:(CMTime)time;
- (BOOL)mouseMoved:(NSPoint)point;
- (BOOL)mouseExited;
- (BOOL)capturing;
- (BOOL)finishCapture;
@end
@implementation DYViewerParameterPanel {
DYViewerParameterBridge *_bridge;NSDictionary *_snapshot;NSArray *_nodes,*_rows;NSMutableArray *_areas;
NSString *_nodeID,*_toolType,*_selectedX;NSMutableDictionary *_draftValues;NSInteger _channel;BOOL _graphMode,_visible;NSSize _size;NSRect _panel,_viewport;BOOL _hasViewport;CGFloat _scale;BOOL _open,_catalog,_dragging,_hasDraft,_positioned,_movingPanel;NSPoint _position,_panelStart;
NSInteger _page,_catalogPage,_capacity,_catalogCapacity,_hover,_pressed;NSPoint _down;NSDictionary *_captured;
double _draftValue,_downValue;CGFloat _knobOffset;CMTime _time,_downTime;
}
@synthesize bridge=_bridge,toolType=_toolType,visible=_visible;
- (void)setInitialPosition:(NSPoint)p{_position=p;_positioned=YES;}
- (instancetype)init{if((self=[super init])){_areas=[NSMutableArray new];_nodeID=[@"base:base" copy];_scale=1;_open=YES;_visible=YES;_graphMode=YES;_draftValues=[NSMutableDictionary new];_time=_downTime=kCMTimeInvalid;}return self;}
- (void)dealloc{if(_pressed)[_bridge endGesture];[_bridge release];[_snapshot release];[_nodes release];[_rows release];[_areas release];[_nodeID release];[_toolType release];[_selectedX release];[_draftValues release];[_captured release];[super dealloc];}
- (void)setBridge:(DYViewerParameterBridge*)bridge{if(bridge==_bridge)return;if(_pressed)[_bridge endGesture];[_bridge release];_bridge=[bridge retain];_pressed=0;_dragging=NO;_movingPanel=NO;[_captured release];_captured=nil;}
- (BOOL)capturing{return _pressed!=0;}
- (BOOL)finishCapture{BOOL had=_pressed!=0;if(had)[_bridge endGesture];_pressed=0;_hasDraft=NO;[_draftValues removeAllObjects];_movingPanel=NO;_dragging=NO;[_captured release];_captured=nil;return had;}
- (NSDictionary*)descriptorForKey:(NSString*)key{for(NSDictionary*d in DYDescriptors())if([d[@"key"]isEqual:key])return d;return nil;}
- (NSDictionary*)node{for(NSDictionary*n in _nodes)if([n[@"id"]isEqual:_nodeID])return n;return nil;}
- (double)valueForDescriptor:(NSDictionary*)d{
if(_pressed&&_draftValues[d[@"key"]])return [_draftValues[d[@"key"]]doubleValue];
if(_hasDraft&&_captured&&[_captured[@"descriptor"][@"pid"]isEqual:d[@"pid"]]&&_pressed)return _draftValue;
NSDictionary*n=[self node];DYUniforms u;NSData*raw=_snapshot[@"uniforms"];if(raw.length!=sizeof(u))return [d[@"default"]doubleValue];
if([_nodeID hasPrefix:@"base:"])[raw getBytes:&u length:sizeof(u)];else u=DYToolUniforms(n[@"layer"]);
NSInteger offset=[d[@"offset"]integerValue];return offset>=0&&offset+sizeof(float)<=sizeof(u)?*(float*)((uint8_t*)&u+offset):[d[@"default"]doubleValue];
}
- (void)addArea:(NSRect)rect part:(NSInteger)part kind:(NSString*)kind title:(NSString*)title descriptor:(NSDictionary*)d index:(NSInteger)index{
NSMutableDictionary*a=[NSMutableDictionary dictionaryWithDictionary:@{@"rect":[NSValue valueWithRect:rect],@"part":@(part),@"kind":kind,@"title":title?:@"",@"index":@(index)}];if(d)a[@"descriptor"]=d;if([kind isEqual:@"module"]&&index<(NSInteger)_nodes.count)a[@"nodeID"]=_nodes[index][@"id"];[_areas addObject:a];
}
- (void)setViewport:(NSRect)viewport{_viewport=viewport;_hasViewport=YES;}
- (void)prepareWithSize:(NSSize)canvasSize scale:(CGFloat)scale atTime:(CMTime)time{
_size=canvasSize;NSRect viewport=_hasViewport?NSIntersectionRect(_viewport,NSMakeRect(0,0,canvasSize.width,canvasSize.height)):NSMakeRect(0,0,canvasSize.width,canvasSize.height);NSSize size=viewport.size;_scale=MAX(.6,MIN(MAX(1.,scale),MIN(size.width/360.,size.height/230.)));_time=time;
if(_pressed&&(!CMTIME_IS_NUMERIC(time)||CMTimeCompare(time,_downTime)!=0)){[self finishCapture];}
[_snapshot release];_snapshot=[[_bridge snapshotAtTime:time]retain];NSDictionary*doc=_snapshot[@"document"];
if(doc){NSMutableArray*nodes=[NSMutableArray array];NSMutableDictionary*counts=[NSMutableDictionary dictionary];
for(NSString*ID in DYToolDisplayOrder(doc?:@{})){
BOOL base=[ID hasPrefix:@"base:"];NSDictionary*layer=base?nil:DYToolWithID(doc,ID);NSString*type=base?[ID substringFromIndex:5]:layer[@"type"];if(!type||![_toolType isEqual:type]||(base&&DYBaseToolRemoved(doc,type)))continue;
NSString*title=DYToolSection(type)[@"title"]?:type;if([type isEqual:@"base"])title=@"基础调整";
NSInteger count=[counts[type]integerValue];counts[type]=@(count+1);if(!base)title=[title stringByAppendingFormat:@" · %ld",(long)(count+1)];
[nodes addObject:@{@"id":ID,@"type":type,@"title":title,@"layer":layer?:@{}}];
}[_nodes release];_nodes=[nodes copy];
if(![self node]){[self finishCapture];[_nodeID release];_nodeID=_nodes.count?[_nodes[0][@"id"]copy]:nil;_page=0;[_selectedX release];_selectedX=nil;}}
NSString*type=[self node][@"type"]?:_toolType;NSMutableArray*rows=[NSMutableArray array];
// These are the existing public scalar controls, never hidden curve-slot metadata.
NSArray*sections=[type isEqual:@"base"]?@[@"base",@"color"]:type?@[type]:@[];
if(doc)for(NSString*part in sections)for(NSDictionary*d in DYToolSection(part)[@"rows"]){NSString*k=d[@"key"];if(!d[@"pid"]||[k hasPrefix:@"cmbypass"]||[k isEqual:@"copyAutoGrade"]||([type isEqual:@"curve"]&&![k hasPrefix:@"curveY"]))continue;[rows addObject:d];}
[_rows release];_rows=[rows copy];[_areas removeAllObjects];if(!_bridge||size.width<120||size.height<80)return;
CGFloat s=_scale,margin=8*s,w=MIN(300*s,size.width-2*margin);_capacity=MAX(1,MIN(5,(NSInteger)floor((size.height-124*s)/(46*s))));
_catalogCapacity=MAX(1,MIN(7,(NSInteger)floor((size.height-124*s)/(32*s))));
_page=MIN(MAX(0,_page),MAX(0,((NSInteger)_rows.count-1)/_capacity));_catalogPage=MIN(MAX(0,_catalogPage),MAX(0,((NSInteger)_nodes.count-1)/_catalogCapacity));
BOOL graph=_graphMode&&([type isEqual:@"curve"]||[type isEqual:@"grading"]);
CGFloat body=_catalog?32*MIN(_catalogCapacity,(NSInteger)_nodes.count):graph?([type isEqual:@"curve"]?236:278):46*MIN(_capacity,(NSInteger)_rows.count);
CGFloat h=_open?(100+body)*s:30*s,panelHeight=MIN(h,size.height-2*margin),x=viewport.origin.x+margin,top=viewport.origin.y+margin;
if(_positioned){x=MAX(viewport.origin.x+margin,MIN(NSMaxX(viewport)-margin-w,viewport.origin.x+_position.x*size.width));top=MAX(viewport.origin.y+margin,MIN(NSMaxY(viewport)-margin-panelHeight,viewport.origin.y+_position.y*size.height));}
_position=NSMakePoint((x-viewport.origin.x)/MAX(1.,size.width),(top-viewport.origin.y)/MAX(1.,size.height));_positioned=YES;
_panel=NSMakeRect(x,top,w,panelHeight);
[self addArea:NSMakeRect(x,top,w-34*s,30*s) part:20000 kind:@"open" title:[@"⠿ " stringByAppendingString:DYToolSection(type)[@"title"]?:@"调色"] descriptor:nil index:0];
[self addArea:NSMakeRect(NSMaxX(_panel)-30*s,top+3*s,26*s,24*s) part:20001 kind:@"close" title:@"×" descriptor:nil index:0];if(!_open)return;
CGFloat y=top+36*s;
[self addArea:NSMakeRect(x+8*s,y,w-([type isEqual:@"base"]?126:84)*s,28*s) part:20002 kind:@"catalog" title:!doc?@"等待当前帧…":[self node]?[[self node][@"title"] stringByAppendingString:@" ▾"]:@"此工具已移除" descriptor:nil index:0];
NSDictionary*enabled=[self descriptorForKey:[type isEqual:@"primary"]?@"primaryMasterEnabled":[type stringByAppendingString:@"Enabled"]];
if(enabled&&_snapshot)[self addArea:NSMakeRect(NSMaxX(_panel)-36*s,y,27*s,28*s) part:20003 kind:@"headerBool" title:[type isEqual:@"base"]?@"调":@"" descriptor:enabled index:0];
if([type isEqual:@"base"]&&_snapshot)[self addArea:NSMakeRect(NSMaxX(_panel)-76*s,y,36*s,28*s) part:20007 kind:@"headerBool" title:@"色" descriptor:[self descriptorForKey:@"colorEnabled"] index:0];
y+=36*s;
if(_catalog){
for(NSInteger i=0;i<_catalogCapacity&&_catalogPage*_catalogCapacity+i<(NSInteger)_nodes.count;i++){NSDictionary*n=_nodes[_catalogPage*_catalogCapacity+i];[self addArea:NSMakeRect(x+8*s,y+i*32*s,w-16*s,27*s) part:20100+i kind:@"module" title:n[@"title"] descriptor:nil index:_catalogPage*_catalogCapacity+i];}y+=MIN(_catalogCapacity,(NSInteger)_nodes.count)*32*s;
}else if(graph){
[self layoutGraphicAt:y];y=NSMaxY(_panel)-25*s;
}else{
for(NSInteger i=0;i<_capacity&&_page*_capacity+i<(NSInteger)_rows.count;i++){NSDictionary*d=_rows[_page*_capacity+i];NSString*kind=d[@"kind"]?:@"float";NSString*valueKind=[kind isEqual:@"bool"]?@"bool":[kind isEqual:@"popup"]?@"choice":@"slider";
[self addArea:NSMakeRect(x+10*s,y+i*46*s,w-46*s,40*s) part:21000+i*3 kind:valueKind title:d[@"title"] descriptor:d index:i];
[self addArea:NSMakeRect(NSMaxX(_panel)-31*s,y+i*46*s+5*s,23*s,29*s) part:21001+i*3 kind:@"reset" title:@"↺" descriptor:d index:i];}y+=MIN(_capacity,(NSInteger)_rows.count)*46*s;
}
if([type isEqual:@"curve"]||[type isEqual:@"grading"])[self addArea:NSMakeRect(NSMaxX(_panel)-110*s,NSMaxY(_panel)-23*s,66*s,19*s) part:20008 kind:@"graphMode" title:_graphMode?@"参数 ›":@"图形 ›" descriptor:nil index:0];
NSInteger total=_catalog?_nodes.count:_rows.count,cap=_catalog?_catalogCapacity:_capacity;
if(total>cap&&(_catalog||!graph)){[self addArea:NSMakeRect(x+8*s,y,29*s,23*s) part:20004 kind:@"previous" title:@"‹" descriptor:nil index:0];[self addArea:NSMakeRect(NSMaxX(_panel)-37*s,y,29*s,23*s) part:20005 kind:@"next" title:@"›" descriptor:nil index:0];}
}
- (NSRect)trackForArea:(NSDictionary*)area{NSRect r=[area[@"rect"]rectValue];return NSMakeRect(r.origin.x+5*_scale,r.origin.y+28*_scale,r.size.width-10*_scale,4*_scale);}
- (void)text:(NSString*)text rect:(NSRect)rect size:(CGFloat)size color:(NSColor*)color alignment:(NSTextAlignment)alignment{
NSMutableParagraphStyle*p=[[[NSMutableParagraphStyle alloc]init]autorelease];p.lineBreakMode=NSLineBreakByTruncatingTail;p.alignment=alignment;
[text drawInRect:rect withAttributes:@{NSFontAttributeName:[NSFont systemFontOfSize:size*_scale weight:NSFontWeightMedium],NSForegroundColorAttributeName:color,NSParagraphStyleAttributeName:p}];
}
- (NSString*)valueText:(NSDictionary*)d value:(double)v{
if([d[@"kind"]isEqual:@"bool"])return v>.5?@"开启":@"关闭";
if([d[@"kind"]isEqual:@"popup"]){NSArray*values=d[@"values"],*options=d[@"options"];NSInteger i=values?[values indexOfObject:@((NSInteger)llround(v))]:(NSInteger)llround(v);return i>=0&&i<(NSInteger)options.count?options[i]:@"—";}
return [NSString stringWithFormat:[d[@"max"]doubleValue]-[d[@"min"]doubleValue]>20?@"%.1f":@"%.2f",v];
}
- (void)draw{
if(!_areas.count)return;[NSGraphicsContext saveGraphicsState];NSRectClip(NSIntersectionRect(_panel,NSMakeRect(0,0,_size.width,_size.height)));CGFloat s=_scale;NSColor*ink=DYThemeColor(@"text")?:NSColor.whiteColor,*accent=DYThemeColor(@"accent")?:NSColor.systemCyanColor;
NSBezierPath*panel=[NSBezierPath bezierPathWithRoundedRect:_panel xRadius:9*s yRadius:9*s];DYDrawThemeSurface(panel,YES);
for(NSDictionary*a in _areas){NSRect r=[a[@"rect"]rectValue];NSInteger part=[a[@"part"]integerValue];NSString*kind=a[@"kind"];BOOL pressed=_pressed==part,hover=_hover==part;NSDictionary*d=a[@"descriptor"];
if([kind isEqual:@"curvePlot"]||[kind isEqual:@"wheel"]){[self drawGraphic:a];continue;}
if([kind isEqual:@"slider"]){double v=[self valueForDescriptor:d],lo=[d[@"min"]doubleValue],hi=[d[@"max"]doubleValue];CGFloat ratio=hi>lo?MAX(0.,MIN(1.,(v-lo)/(hi-lo))):0;NSRect track=[self trackForArea:a];
[self text:a[@"title"] rect:NSMakeRect(r.origin.x,r.origin.y,r.size.width-68*s,18*s) size:11 color:ink alignment:NSTextAlignmentLeft];[self text:[self valueText:d value:v] rect:NSMakeRect(NSMaxX(r)-68*s,r.origin.y,68*s,18*s) size:11 color:hover||pressed?accent:ink alignment:NSTextAlignmentRight];
DYDrawSoftControl(NSInsetRect(track,-2*s,-3*s),5*s,YES,NO,NO);[accent setFill];[[NSBezierPath bezierPathWithRoundedRect:NSMakeRect(track.origin.x,track.origin.y,MAX(2*s,track.size.width*ratio),track.size.height) xRadius:2*s yRadius:2*s]fill];
CGFloat marker=MAX(0.,MIN(1.,([d[@"default"]doubleValue]-lo)/(hi-lo)));[ink setStroke];NSBezierPath*tick=[NSBezierPath bezierPath];[tick moveToPoint:NSMakePoint(track.origin.x+marker*track.size.width,NSMidY(track)-5*s)];[tick lineToPoint:NSMakePoint(track.origin.x+marker*track.size.width,NSMidY(track)+5*s)];tick.lineWidth=.7*s;[tick stroke];
DYDrawSoftControl(NSMakeRect(track.origin.x+ratio*track.size.width-6*s,NSMidY(track)-6*s,12*s,12*s),6*s,NO,hover||pressed,pressed);
}else{
BOOL selected=([kind isEqual:@"channel"]&&[a[@"index"]integerValue]==_channel)||([kind isEqual:@"module"]&&[a[@"nodeID"]isEqual:_nodeID])||([kind isEqual:@"tool"]&&[a[@"toolType"]isEqual:[self node][@"type"]]);BOOL on=([kind isEqual:@"bool"]||[kind isEqual:@"headerBool"])&&[self valueForDescriptor:d]>.5;
DYDrawSoftControl(r,5*s,NO,hover||selected||on,pressed);NSString*title=a[@"title"];
if(d&&![kind isEqual:@"reset"]){NSString*value=[self valueText:d value:[self valueForDescriptor:d]];title=[kind isEqual:@"headerBool"]?(title.length?title:([self valueForDescriptor:d]>.5?@"●":@"○")):[NSString stringWithFormat:@"%@ %@%@",title,value,[kind isEqual:@"choice"]?@" ›":@""];}
[self text:title rect:NSInsetRect(r,5*s,5*s) size:[kind isEqual:@"open"]?12:11 color:[kind isEqual:@"toolUnavailable"]?[ink colorWithAlphaComponent:.35]:ink alignment:NSTextAlignmentCenter];
}
}
if(_open){NSString*hint=_catalog?@"选择当前工具的图层":(_graphMode&&[_toolType isEqual:@"curve"])?@"点击加点 · 拖动调整":(_graphMode&&[_toolType isEqual:@"grading"])?@"拖动色轮 · 参数查看亮度":@"拖动调节 · ↺ 还原";if(_hover==20000||_movingPanel)hint=@"拖动标题移动 · 单击折叠";[self text:hint rect:NSMakeRect(_panel.origin.x+40*s,NSMaxY(_panel)-22*s,_panel.size.width-168*s,18*s) size:9 color:ink alignment:NSTextAlignmentCenter];}
[NSGraphicsContext restoreGraphicsState];
}
- (NSInteger)partAtPoint:(NSPoint)p{if(!_visible||!std::isfinite(p.x)||!std::isfinite(p.y)||!_bridge||!NSPointInRect(p,NSIntersectionRect(_panel,NSMakeRect(0,0,_size.width,_size.height))))return 0;for(NSDictionary*a in [_areas reverseObjectEnumerator])if(![a[@"kind"]isEqual:@"toolUnavailable"]&&NSPointInRect(p,[a[@"rect"]rectValue]))return [a[@"part"]integerValue];return _open&&NSPointInRect(p,_panel)?20006:0;}
- (NSDictionary*)areaForPart:(NSInteger)part{for(NSDictionary*a in _areas)if([a[@"part"]integerValue]==part)return a;return nil;}
- (void)applySliderPoint:(NSPoint)p{
NSRect t=[self trackForArea:_captured];NSDictionary*d=_captured[@"descriptor"];double ratio=MAX(0.,MIN(1.,(p.x-_knobOffset-t.origin.x)/MAX(1.,t.size.width)));_draftValue=[d[@"min"]doubleValue]+ratio*([d[@"max"]doubleValue]-[d[@"min"]doubleValue]);[_bridge changeValue:_draftValue];
}
- (void)clickArea:(NSDictionary*)a{
NSString*kind=a[@"kind"];if([kind isEqual:@"close"]){_visible=NO;return;}if([kind isEqual:@"open"]){_open=!_open;_catalog=NO;return;}if([kind isEqual:@"graphMode"]){_graphMode=!_graphMode;return;}if([kind isEqual:@"channel"]){_channel=[a[@"index"]integerValue];[_selectedX release];_selectedX=nil;return;}if([kind isEqual:@"deletePoint"]){[self deleteSelectedPoint];return;}if([kind isEqual:@"catalog"]){_catalog=!_catalog;return;}
if([kind isEqual:@"module"]||[kind isEqual:@"tool"]){for(NSDictionary*n in _nodes)if([n[@"id"]isEqual:a[@"nodeID"]]){[_nodeID release];_nodeID=[a[@"nodeID"]copy];_catalog=NO;_page=0;break;}return;}
if([kind isEqual:@"previous"]||[kind isEqual:@"next"]){NSInteger total=_catalog?_nodes.count:_rows.count,cap=_catalog?_catalogCapacity:_capacity,count=MAX(1,(total+cap-1)/cap),delta=[kind isEqual:@"next"]?1:-1;if(_catalog)_catalogPage=(_catalogPage+delta+count)%count;else _page=(_page+delta+count)%count;return;}
NSDictionary*d=a[@"descriptor"];if(!d||!_snapshot)return;double old=[self valueForDescriptor:d],v=old;
if([kind isEqual:@"reset"])v=[d[@"default"]doubleValue];else if([kind isEqual:@"bool"]||[kind isEqual:@"headerBool"])v=old>.5?0:1;else if([kind isEqual:@"choice"]){NSArray*values=d[@"values"],*options=d[@"options"];NSInteger i=values?[values indexOfObject:@((NSInteger)llround(old))]:(NSInteger)llround(old);if(!options.count)return;i=(i+1)%options.count;v=values?[values[i]doubleValue]:i;}
[_bridge beginParameter:d node:_nodeID value:old atTime:_time];[_bridge changeValue:v];[_bridge endGesture];
}
- (void)movePanelToPointer:(NSPoint)p{
NSRect viewport=_hasViewport?NSIntersectionRect(_viewport,NSMakeRect(0,0,_size.width,_size.height)):NSMakeRect(0,0,_size.width,_size.height);CGFloat margin=10*_scale;
CGFloat x=MAX(NSMinX(viewport)+margin,MIN(NSMaxX(viewport)-margin-_panel.size.width,_panelStart.x+p.x-_down.x)),y=MAX(NSMinY(viewport)+margin,MIN(NSMaxY(viewport)-margin-_panel.size.height,_panelStart.y+p.y-_down.y));
_position=NSMakePoint((x-viewport.origin.x)/MAX(1.,viewport.size.width),(y-viewport.origin.y)/MAX(1.,viewport.size.height));_positioned=YES;_movingPanel=YES;[self prepareWithSize:_size scale:_scale atTime:_time];
}
- (BOOL)event:(NSEventType)type point:(NSPoint)p atTime:(CMTime)time{
if(!std::isfinite(p.x)||!std::isfinite(p.y))return NO;[self prepareWithSize:_size scale:_scale atTime:time];NSInteger hit=[self partAtPoint:p];
if(type==NSEventTypeLeftMouseDown){if(!hit)return NO;[_bridge endGesture];_hasDraft=NO;_pressed=hit;_down=p;_panelStart=_panel.origin;_downTime=time;_dragging=NO;_movingPanel=NO;[_captured release];_captured=[[self areaForPart:hit]copy];NSDictionary*d=_captured[@"descriptor"];
if([_captured[@"kind"]isEqual:@"curvePlot"]||[_captured[@"kind"]isEqual:@"wheel"]){[self beginGraphicAt:p];return YES;}
if([_captured[@"kind"]isEqual:@"slider"]&&_snapshot){NSRect t=[self trackForArea:_captured];if(NSPointInRect(p,NSInsetRect(t,-8*_scale,-8*_scale))){_downValue=[self valueForDescriptor:d];_draftValue=_downValue;_hasDraft=YES;[_bridge beginParameter:d node:_nodeID value:_downValue atTime:time];CGFloat knob=t.origin.x+(_downValue-[d[@"min"]doubleValue])/([d[@"max"]doubleValue]-[d[@"min"]doubleValue])*t.size.width;_knobOffset=fabs(p.x-knob)<=8*_scale?p.x-knob:0;if(fabs(p.x-knob)>8*_scale)[self applySliderPoint:p];}}return YES;
}
if(!_pressed)return NO;
if(type==NSEventTypeLeftMouseDragged){if(fabs(p.x-_down.x)>2*_scale||fabs(p.y-_down.y)>2*_scale)_dragging=YES;if(_dragging&&[_captured[@"kind"]isEqual:@"open"])[self movePanelToPointer:p];if(_dragging&&([_captured[@"kind"]isEqual:@"curvePlot"]||[_captured[@"kind"]isEqual:@"wheel"]))[self updateGraphicAt:p];if(_dragging&&_hasDraft&&[_captured[@"kind"]isEqual:@"slider"]&&_snapshot)[self applySliderPoint:p];return YES;}
if(type==NSEventTypeLeftMouseUp){if([_captured[@"kind"]isEqual:@"open"]&&(_dragging||fabs(p.x-_down.x)>2*_scale||fabs(p.y-_down.y)>2*_scale))[self movePanelToPointer:p];BOOL moved=_movingPanel;BOOL graphic=[_captured[@"kind"]isEqual:@"curvePlot"]||[_captured[@"kind"]isEqual:@"wheel"];if(graphic){if(_dragging||fabs(p.x-_down.x)>2*_scale||fabs(p.y-_down.y)>2*_scale)[self updateGraphicAt:p];[_bridge endGesture];}BOOL slider=[_captured[@"kind"]isEqual:@"slider"];NSDictionary*a=[_captured retain];NSInteger pressed=_pressed;
if(slider){if(_hasDraft&&(_dragging||fabs(p.x-_down.x)>2*_scale||fabs(p.y-_down.y)>2*_scale))[self applySliderPoint:p];[_bridge endGesture];}
_pressed=0;_dragging=NO;_movingPanel=NO;_hasDraft=NO;[_captured release];_captured=nil;[_draftValues removeAllObjects];if(!moved&&!slider&&!graphic&&hit==pressed&&(!a[@"nodeID"]||[a[@"nodeID"]isEqual:[self areaForPart:hit][@"nodeID"]]))[self clickArea:a];[a release];[self prepareWithSize:_size scale:_scale atTime:time];return YES;}
return NO;
}
#include "DYViewerGraphics.inc.h"
- (BOOL)mouseMoved:(NSPoint)p{NSInteger part=[self partAtPoint:p];BOOL changed=part!=_hover;_hover=part;return changed;}
- (BOOL)mouseExited{BOOL changed=_hover!=0;_hover=0;return changed;}
@end
@@ -0,0 +1,47 @@
#pragma once
@protocol DYViewerParameterProbe
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager;
- (void)publishUniforms:(const DYUniforms*)uniforms document:(NSDictionary*)document atTime:(CMTime)time;
- (NSDictionary*)snapshotAtTime:(CMTime)time;
- (void)beginParameter:(NSDictionary*)descriptor node:(NSString*)nodeID value:(double)value atTime:(CMTime)time;
- (void)changeValue:(double)value;
- (void)beginParameters:(NSArray<NSDictionary*>*)descriptors node:(NSString*)nodeID values:(NSDictionary<NSString*,NSNumber*>*)values atTime:(CMTime)time;
- (void)changeValues:(NSDictionary<NSString*,NSNumber*>*)values;
- (void)endGesture;
- (void)invalidate;
@end
// Test-only host wrapper: sample paired values at each outer action boundary.
// This verifies that an OSC graph never exposes an x-only intermediate action.
@interface DYViewerBatchActionProbe : DYToolCanvasProbe {
@public
NSArray *_pairIDs;
NSMutableArray *_committedPairs;
NSInteger _actionDepth;
BOOL _writesInAction,_allWritesInsideAction,_rejectNextWrite;
UInt32 _rejectParameterID;
}
@end
@implementation DYViewerBatchActionProbe
- (instancetype)init{if((self=[super init])){_committedPairs=[NSMutableArray new];_allWritesInsideAction=YES;}return self;}
- (void)dealloc{[_pairIDs release];[_committedPairs release];[super dealloc];}
- (id)apiForProtocol:(Protocol*)protocol{if([NSStringFromProtocol(protocol)isEqual:@"FxParameterSettingAPI_v6"])return self;return [super apiForProtocol:protocol];}
- (void)startAction:(id)sender{[super startAction:sender];++_actionDepth;}
- (void)endAction:(id)sender{
if(_actionDepth==1&&_writesInAction){
NSMutableArray *sample=[NSMutableArray array];id<FxParameterRetrievalAPI_v6>get=(id)_base;
for(NSNumber *pid in _pairIDs){double value=NAN;[get getFloatValue:&value fromParameter:pid.unsignedIntValue atTime:_time];[sample addObject:@(value)];}
[_committedPairs addObject:sample];_writesInAction=NO;
}
--_actionDepth;[super endAction:sender];
}
- (BOOL)setFloatValue:(double)value toParameter:(UInt32)pid atTime:(CMTime)time{
_allWritesInsideAction&=_actionDepth>0&&NSThread.isMainThread;
if(_rejectNextWrite&&pid==_rejectParameterID){_rejectNextWrite=NO;return NO;}
_writesInAction=YES;return [(id<FxParameterSettingAPI_v6>)_base setFloatValue:value toParameter:pid atTime:time];
}
- (BOOL)setCustomParameterValue:(NSObject<NSSecureCoding,NSCopying>*)value toParameter:(UInt32)pid atTime:(CMTime)time{
_allWritesInsideAction&=_actionDepth>0&&NSThread.isMainThread;_writesInAction=YES;
return [(id<FxParameterSettingAPI_v6>)_base setCustomParameterValue:value toParameter:pid atTime:time];
}
@end
@@ -0,0 +1,53 @@
#import "DYColorWorkspace.h"
// Offscreen fixtures: no window is ordered onto the user's screen.
@interface DYColorWorkspace (DiagnosticActions)
- (NSDictionary *)selectionContext;
- (BOOL)commitLUT:(NSString *)path expected:(NSDictionary *)expected error:(NSError **)error;
- (NSProgress *)selectLUT:(NSString *)path completion:(void(^)(NSError *))completion;
@end
@interface DYWorkspaceDiagnosticHost : DYDiagnosticManager {
@public NSView *_parent;CMTime _workspaceTime;NSUInteger _requests,_closes;NSInteger _actionDepth;BOOL _permissionFailure,_nodeCommitHadUndo,_rejectToolsWrites;
}
@end
@implementation DYWorkspaceDiagnosticHost
- (instancetype)init{if((self=[super init]))_workspaceTime=kCMTimeZero;return self;}
- (id)apiForProtocol:(Protocol *)p{NSString *name=NSStringFromProtocol(p);if([@[@"FxRemoteWindowAPI",@"FxRemoteWindowAPI_v2",@"FxRemoteWindowAPI_v3"]containsObject:name]){if(!_actionDepth)_permissionFailure=YES;return self;}return [super apiForProtocol:p];}
- (void)startAction:(id)sender{_actionDepth++;}
- (void)endAction:(id)sender{_actionDepth--;if(_actionDepth<0)_permissionFailure=YES;}
- (CMTime)currentTime{return _workspaceTime;}
- (void)remoteWindowWithMinimumSize:(CGSize)minimum maximumSize:(CGSize)maximum reply:(void(^)(FxXPView*,NSError*))reply{if(!_actionDepth)_permissionFailure=YES;_requests++;reply((FxXPView*)_parent,nil);}
- (void)closeRemoteWindow{if(!_actionDepth)_permissionFailure=YES;_closes++;}
- (BOOL)setCustomParameterValue:(NSObject<NSSecureCoding,NSCopying> *)value toParameter:(UInt32)pid atTime:(CMTime)time{if(pid==DYToolsParameterID){_nodeCommitHadUndo=_undoActive;if(_rejectToolsWrites)return NO;}return [super setCustomParameterValue:value toParameter:pid atTime:time];}
@end
@interface DYWorkspaceDiagnosticRenderer : DYRenderer{
@public NSProgress *_preparedTask;void(^_preparedReply)(NSError*);
}
- (void)completePreparation;
@end
@implementation DYWorkspaceDiagnosticRenderer
- (void)dealloc{[_preparedTask release];[_preparedReply release];[super dealloc];}
- (NSProgress *)prepareLUTPath:(NSString *)path completion:(void(^)(NSError*))completion{[_preparedTask release];_preparedTask=[[NSProgress discreteProgressWithTotalUnitCount:1]retain];[_preparedReply release];_preparedReply=[completion copy];return _preparedTask;}
- (void)completePreparation{void(^reply)(NSError*)=[_preparedReply copy];[_preparedReply release];_preparedReply=nil;if(reply)reply(nil);[reply release];}
@end
// Cache only the top content strip. A background-painted sibling must never
// erase the heading/page selector/close button in that strip.
static NSBitmapImageRep *DYWorkspaceHeaderBitmap(NSView *root){
NSRect top=NSMakeRect(0,0,root.bounds.size.width,52);NSBitmapImageRep *bitmap=[root bitmapImageRepForCachingDisplayInRect:top];if(bitmap)[root cacheDisplayInRect:top toBitmapImageRep:bitmap];return bitmap;
}
static NSUInteger DYWorkspaceHeaderInk(NSBitmapImageRep *bitmap,NSView *root,NSView *control){
if(!bitmap||!bitmap.pixelsWide||!bitmap.pixelsHigh)return 0;NSColor *base=[[bitmap colorAtX:0 y:0]colorUsingColorSpace:NSColorSpace.deviceRGBColorSpace];if(!base)return 0;
CGFloat scale=bitmap.pixelsWide/root.bounds.size.width;NSInteger left=MAX(0,NSInteger(floor(NSMinX(control.frame)*scale))),right=MIN(bitmap.pixelsWide,NSInteger(ceil(NSMaxX(control.frame)*scale)));NSUInteger count=0;
for(NSInteger y=0;y<bitmap.pixelsHigh;y++)for(NSInteger x=left;x<right;x++){NSColor *pixel=[[bitmap colorAtX:x y:y]colorUsingColorSpace:NSColorSpace.deviceRGBColorSpace];if(pixel&&(fabs(pixel.redComponent-base.redComponent)+fabs(pixel.greenComponent-base.greenComponent)+fabs(pixel.blueComponent-base.blueComponent)>.12))count++;}
return count;
}
static BOOL DYWorkspaceLargeDirtyPreservesHeader(NSBitmapImageRep *bitmap,NSView *root,NSView *pane){
if(!bitmap)return NO;NSData *before=[NSData dataWithBytes:bitmap.bitmapData length:bitmap.bytesPerRow*bitmap.pixelsHigh];
[NSGraphicsContext saveGraphicsState];NSGraphicsContext *context=[NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap];[NSGraphicsContext setCurrentContext:context];CGContextRef cg=context.CGContext;
// Map the pane's flipped local coordinates into the cached top-strip pixels.
// Intentionally bypass AppKit's clipping here: the draw implementation must
// itself stay within its bounds even for a deliberately oversized dirty rect.
CGContextTranslateCTM(cg,0,bitmap.pixelsHigh);CGContextScaleCTM(cg,bitmap.pixelsWide/root.bounds.size.width,-bitmap.pixelsHigh/52.0);CGContextTranslateCTM(cg,pane.frame.origin.x,pane.frame.origin.y);
[pane drawRect:NSInsetRect(pane.bounds,-200,-200)];[NSGraphicsContext restoreGraphicsState];
NSData *after=[NSData dataWithBytes:bitmap.bitmapData length:bitmap.bytesPerRow*bitmap.pixelsHigh];return [before isEqual:after];
}
@@ -0,0 +1,62 @@
{
auto workspaceDrain=[](){double end=NSProcessInfo.processInfo.systemUptime+.04;while(NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.002]];};
NSString *oldLUT=[runtime stringByAppendingPathComponent:@"old.cube"],*retainLUT=[runtime stringByAppendingPathComponent:@"retain.cube"],*newLUT=[runtime stringByAppendingPathComponent:@"new.cube"],*lateLUT=[runtime stringByAppendingPathComponent:@"late.cube"],*userLUT=[runtime stringByAppendingPathComponent:@"user-new.cube"],*nodeLUT=[runtime stringByAppendingPathComponent:@"node.cube"],*deletedLUT=[runtime stringByAppendingPathComponent:@"deleted.cube"];
DYWorkspaceDiagnosticHost *host=[[[DYWorkspaceDiagnosticHost alloc]init]autorelease];DYCreateParameters(host,&error);
DYWorkspaceDiagnosticRenderer *scopeRenderer=[[[DYWorkspaceDiagnosticRenderer alloc]init]autorelease];
DYLUTLibrary *scopeLibrary=[[[DYLUTLibrary alloc]initWithRootURL:[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"workspace-library"]]]autorelease];
NSPanel *fixture=[[[NSPanel alloc]initWithContentRect:NSMakeRect(20,30,920,620) styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO]autorelease];host->_parent=fixture.contentView;
DYColorWorkspace *workspace=[[[DYColorWorkspace alloc]initWithManager:host renderer:scopeRenderer library:scopeLibrary title:@"原片段"]autorelease];
[workspace showRelativeToView:nil];workspaceDrain();NSView *root=[workspace valueForKey:@"root"];
run.record(@"workspace-remote-attaches-within-host-permissions",workspace.visible&&host->_requests==1&&!host->_permissionFailure&&root.superview==host->_parent&&!fixture.visible);
NSView *scopePane=[workspace valueForKey:@"scopePane"],*heading=[workspace valueForKey:@"heading"],*pages=[workspace valueForKey:@"pages"],*closeButton=nil;for(NSView *control in root.subviews)if([control isKindOfClass:NSButton.class]&&[[(NSButton*)control title]isEqual:@"关闭"])closeButton=control;
NSBitmapImageRep *headerBitmap=DYWorkspaceHeaderBitmap(root);NSUInteger headingInk=DYWorkspaceHeaderInk(headerBitmap,root,heading),pagesInk=DYWorkspaceHeaderInk(headerBitmap,root,pages),closeInk=DYWorkspaceHeaderInk(headerBitmap,root,closeButton);
NSString *headerPNG=[runtime stringByAppendingPathComponent:@"workspace-topbar.png"];BOOL headerSaved=[[headerBitmap representationUsingType:NSBitmapImageFileTypePNG properties:@{}]writeToFile:headerPNG atomically:YES];
run.record(@"workspace-offscreen-topbar-heading-pages-close-render-pixels",headerSaved&&headingInk>20&&pagesInk>50&&closeInk>20,@{@"headingPixels":@(headingInk),@"pagesPixels":@(pagesInk),@"closePixels":@(closeInk),@"path":headerPNG});
run.record(@"workspace-content-and-scope-pane-explicitly-clip",root.clipsToBounds&&scopePane.clipsToBounds);
run.record(@"workspace-oversized-scope-dirty-cannot-erase-topbar",DYWorkspaceLargeDirtyPreservesHeader(headerBitmap,root,scopePane));
[host->_parent setFrameSize:NSMakeSize(800,540)];run.record(@"workspace-follows-remote-container-resize",NSEqualRects(root.frame,host->_parent.bounds));
headerBitmap=DYWorkspaceHeaderBitmap(root);headingInk=DYWorkspaceHeaderInk(headerBitmap,root,heading);pagesInk=DYWorkspaceHeaderInk(headerBitmap,root,pages);closeInk=DYWorkspaceHeaderInk(headerBitmap,root,closeButton);
run.record(@"workspace-topbar-survives-resize-and-large-dirty-redraw",headingInk>20&&pagesInk>50&&closeInk>20&&DYWorkspaceLargeDirtyPreservesHeader(headerBitmap,root,scopePane),@{@"headingPixels":@(headingInk),@"pagesPixels":@(pagesInk),@"closePixels":@(closeInk)});
[workspace showRelativeToView:nil];workspaceDrain();run.record(@"workspace-reopens-existing-host-remote-window",host->_requests==2&&workspace.visible&&root.superview==host->_parent);
[workspace close];[workspace close];run.record(@"workspace-closes-host-window-once-and-stops-scopes",host->_closes==1&&!workspace.visible&&![[scopeRenderer valueForKey:@"scopeEnabled"]boolValue]&&!host->_permissionFailure&&host->_actionDepth==0);
[workspace showRelativeToView:nil];workspaceDrain();[NSNotificationCenter.defaultCenter postNotificationName:NSWindowWillCloseNotification object:fixture];run.record(@"workspace-host-close-cleans-without-recursive-close",!workspace.visible&&host->_closes==1&&!root.superview);
[scopeRenderer setScopeEnabled:NO];[scopeRenderer setValue:@{@"time":@99} forKey:@"scopeMetadata"];[scopeRenderer setValue:[NSMutableData dataWithLength:16] forKey:@"scopePreview"];[scopeRenderer setScopeEnabled:YES];
run.record(@"workspace-new-scope-session-clears-old-frame",!scopeRenderer.scopeMetadata&&!scopeRenderer.scopePreview);[scopeRenderer setScopeEnabled:NO];
// A new active session is needed before delivering asynchronous selections.
[workspace showRelativeToView:nil];workspaceDrain();
DYAssetState *before=[[DYReadAssets(host,kCMTimeZero)copy]autorelease];before.paths=@{@"look0":oldLUT,@"look1":retainLUT};DYWriteAssets(host,before,kCMTimeZero);
int starts=host->_undoStarts,ends=host->_undoEnds;NSError *workspaceError=nil;
BOOL wrote=[workspace commitLUT:newLUT expected:[workspace selectionContext] error:&workspaceError];
run.record(@"workspace-style1-preserves-other-lut-slots-one-undo",wrote&&[DYReadAssets(host,kCMTimeZero).paths[@"look0"]isEqual:newLUT]&&[DYReadAssets(host,kCMTimeZero).paths[@"look1"]isEqual:retainLUT]&&host->_undoStarts==starts+1&&host->_undoEnds==ends+1);
__block BOOL completed=NO;__block NSError *selectionError=nil;starts=host->_undoStarts;
[workspace selectLUT:nil completion:^(NSError *e){completed=YES;selectionError=e;}];workspaceDrain();
run.record(@"workspace-remove-style1-applies-once-after-async-boundary",completed&&!selectionError&&!DYReadAssets(host,kCMTimeZero).paths[@"look0"]&&host->_undoStarts==starts+1);
completed=NO;selectionError=nil;[workspace selectLUT:lateLUT completion:^(NSError *e){completed=YES;selectionError=e;}];host->_workspaceTime=CMTimeMake(1,24);[scopeRenderer completePreparation];
run.record(@"workspace-async-playhead-change-keeps-new-frame-untouched",completed&&selectionError&&!DYReadAssets(host,kCMTimeZero).paths[@"look0"]);host->_workspaceTime=kCMTimeZero;
completed=NO;selectionError=nil;[workspace selectLUT:lateLUT completion:^(NSError *e){completed=YES;selectionError=e;}];DYAssetState *external=[[DYReadAssets(host,kCMTimeZero)copy]autorelease];external.paths=@{@"look0":userLUT};DYWriteAssets(host,external,kCMTimeZero);[scopeRenderer completePreparation];
run.record(@"workspace-async-lut-conflict-preserves-user-change",completed&&selectionError&&[DYReadAssets(host,kCMTimeZero).paths[@"look0"]isEqual:userLUT]);
completed=NO;selectionError=nil;[workspace selectLUT:lateLUT completion:^(NSError *e){completed=YES;selectionError=e;}];for(NSDictionary *d in DYDescriptors())if([d[@"key"]isEqual:@"cmworkingTransfer"])[host setFloatValue:3 toParameter:[d[@"pid"]unsignedIntValue] atTime:kCMTimeZero];[scopeRenderer completePreparation];
run.record(@"workspace-async-color-context-conflict-preserves-state",completed&&selectionError&&[DYReadAssets(host,kCMTimeZero).paths[@"look0"]isEqual:userLUT]);
completed=NO;selectionError=nil;NSProgress *pending=[workspace selectLUT:lateLUT completion:^(NSError *e){completed=YES;selectionError=e;}];[workspace close];[scopeRenderer completePreparation];
run.record(@"workspace-close-cancels-pending-selection-without-write",pending.cancelled&&completed&&selectionError&&[DYReadAssets(host,kCMTimeZero).paths[@"look0"]isEqual:userLUT]);
NSMutableDictionary *document=DYMutablePlist(DYReadTools(host,kCMTimeZero).document);NSDictionary *look=DYInsertTool(document,@"look",@"base:look");NSString *nodeID=[[look[@"id"]copy]autorelease];BOOL inserted=look&&DYWriteTools(host,document,kCMTimeZero);run.need(@"workspace-independent-style-fixture-inserted",inserted,@{@"node":nodeID?:@"missing",@"validDocument":@(DYValidToolDocument(document))});
DYToolManager *node=[[[DYToolManager alloc]initWithHost:host node:look]autorelease];DYColorWorkspace *nodeWorkspace=[[[DYColorWorkspace alloc]initWithManager:node renderer:scopeRenderer library:scopeLibrary title:@"独立风格"]autorelease];starts=host->_undoStarts;host->_nodeCommitHadUndo=NO;
wrote=[nodeWorkspace commitLUT:nodeLUT expected:[nodeWorkspace selectionContext] error:&workspaceError];
run.record(@"workspace-independent-style1-writes-target-node-inside-undo",wrote&&[DYToolWithID(DYReadTools(host,kCMTimeZero).document,nodeID)[@"paths"][@"look0"]isEqual:nodeLUT]&&[DYReadAssets(host,kCMTimeZero).paths[@"look0"]isEqual:userLUT]&&host->_nodeCommitHadUndo&&host->_undoStarts==starts+1,@{@"written":@(wrote),@"error":workspaceError.localizedDescription?:@"none",@"nodePaths":DYToolWithID(DYReadTools(host,kCMTimeZero).document,nodeID)[@"paths"]?:@{},@"rootStyle1":DYReadAssets(host,kCMTimeZero).paths[@"look0"]?:@"none",@"commitWithinUndo":@(host->_nodeCommitHadUndo),@"undoStartsBefore":@(starts),@"undoStartsAfter":@(host->_undoStarts)});
starts=host->_undoStarts;workspaceError=nil;wrote=[nodeWorkspace commitLUT:@"relative.cube" expected:[nodeWorkspace selectionContext] error:&workspaceError];run.record(@"workspace-relative-lut-path-is-rejected-before-undo",!wrote&&workspaceError&&host->_undoStarts==starts&&[DYToolWithID(DYReadTools(host,kCMTimeZero).document,nodeID)[@"paths"][@"look0"]isEqual:nodeLUT]);
host->_rejectToolsWrites=YES;workspaceError=nil;wrote=[nodeWorkspace commitLUT:newLUT expected:[nodeWorkspace selectionContext] error:&workspaceError];host->_rejectToolsWrites=NO;
run.record(@"workspace-node-host-rejection-is-not-reported-as-applied",!wrote&&workspaceError&&[DYToolWithID(DYReadTools(host,kCMTimeZero).document,nodeID)[@"paths"][@"look0"]isEqual:nodeLUT],@{@"error":workspaceError.localizedDescription?:@"missing"});
document=DYMutablePlist(DYReadTools(host,kCMTimeZero).document);DYRemoveTool(document,nodeID);DYWriteTools(host,document,kCMTimeZero);starts=host->_undoStarts;workspaceError=nil;
wrote=[nodeWorkspace commitLUT:deletedLUT expected:[nodeWorkspace selectionContext] error:&workspaceError];run.record(@"workspace-deleted-node-does-not-write-another-layer",!wrote&&workspaceError&&host->_undoStarts==starts&&[DYReadAssets(host,kCMTimeZero).paths[@"look0"]isEqual:userLUT]);
[nodeWorkspace close];run.record(@"workspace-offscreen-fixtures-never-presented",!fixture.visible&&!host->_permissionFailure&&host->_actionDepth==0);
// Run the production final-tile sampling and worker color conversion on a
// known premultiplied half-float host output, independently of LUT analysis.
DYDiagnosticTile *finalTile=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:4 height:4]autorelease];CGColorSpaceRef finalSpace=CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);[finalTile setDiagnosticColorSpace:finalSpace];CGColorSpaceRelease(finalSpace);
std::vector<__fp16> finalPixels(4*4*4);for(unsigned i=0;i<16;i++){finalPixels[i*4]=.125f;finalPixels[i*4+1]=.25f;finalPixels[i*4+2]=.375f;finalPixels[i*4+3]=.5f;}[[finalTile metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,4,4) mipmapLevel:0 withBytes:finalPixels.data() bytesPerRow:4*8];
[scopeRenderer setScopeEnabled:YES];[scopeRenderer captureScopeTile:finalTile atTime:CMTimeMake(7,24)];double scopeDeadline=NSProcessInfo.processInfo.systemUptime+5;while(!scopeRenderer.scopeMetadata&&NSProcessInfo.processInfo.systemUptime<scopeDeadline)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.005]];
NSDictionary *scopeData=scopeRenderer.scopeMetadata;NSData *finalPreview=scopeRenderer.scopePreview;const float *finalSample=(const float*)finalPreview.bytes;
run.record(@"workspace-final-output-sample-unpremultiplies-and-converts-real-icc",[scopeData[@"converted"]boolValue]&&[scopeData[@"valid"]unsignedIntegerValue]==320*180&&finalPreview.length==320*180*16&&fabs(finalSample[0]-.537099)<.003&&fabs(finalSample[1]-.735357)<.003&&fabs(finalSample[2]-.880825)<.003&&finalSample[3]==.5f);
run.record(@"workspace-final-output-worker-publishes-real-scope-rasters",[scopeData[@"waveform"]length]==320*256*4&&[scopeData[@"parade"]length]==3*320*256*4&&[scopeData[@"histogram"]length]==4*256*4&&[scopeData[@"wholeImage"]boolValue]);
[scopeRenderer setScopeEnabled:NO];[scopeRenderer captureScopeTile:finalTile atTime:CMTimeMake(8,24)];workspaceDrain();run.record(@"workspace-hidden-scope-capture-does-no-work",[scopeRenderer.scopeMetadata isEqual:scopeData]);
}
+3 -3
查看文件
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.8.5</string>
<string>1.10.0</string>
<key>CFBundleVersion</key>
<string>67</string>
<string>72</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>PlugInKit</key>
@@ -71,7 +71,7 @@
<key>uuid</key>
<string>1C17B73B-F229-4C09-A434-EAF6DFF5F22A</string>
<key>version</key>
<string>1.8.5</string>
<string>1.10.0</string>
</dict>
<dict>
<key>className</key>
+2 -2
查看文件
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.8.5</string>
<string>1.10.0</string>
<key>CFBundleVersion</key>
<string>67</string>
<string>72</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
+22
查看文件
@@ -1,3 +1,23 @@
# 2026-11-04 画布工具与辅助工作区:1.10.0(72)验收完成
当前正式安装 **1.10.0(72)**,固定位置 `/Library/Plug-Ins/FxPlug/大鱼调色.app`,主 Bundle ID `com.dayu.color`,XPC `com.dayu.color.XPC`。实际编译源码 `80dec904bedf5f704b29d16325fa95d639f3a250`;Developer ID 团队 B3W25FX5H5,APP 公证 `c0209032-38d2-4434-8e37-7f911414c3c6` Accepted。票据、Gatekeeper、唯一 PluginKit 正式路径、正式安装的 **695 项原生检查**与用户实鼠验收通过。
画布侧改为纵向十四工具入口,支持多个独立移动、折叠和关闭的浮动工具面板。曲线直接添加、拖动、删除点并切 RGB 通道;颜色分级提供四个实际色轮,二者可切换参数页。其它工具继续使用原有参数和图层 UUID;移动面板与切换编辑视图不进入调色撤销。
外部“工作区 · 示波器 / LUT”由 FxRemoteWindow 托管。亮度波形、RGB 分列和直方图采集当前效果输出并标注 sRGB 显示参考/分块限制;不包含其后其他效果或宿主显示转换,也不替代 HDR/IRE 测量。LUT 页预览与应用风格1。用户明确确认曲线拖点/一次撤销、外窗 LUT 预览、移动播放头后示波器更新“三项都正常”,见 `verification/HostWorkspace1.10.0.json`。
最终 PKG `../发行包/大鱼调色-1.10.0.pkg`,43,090,565 字节,SHA-256 `ee70461c9b2d2e0ddd78cbcb3371c3b1b36b7f0e5fc69bfccc7ac0f1a3e468d8`,Installer 签名、公证 `9604cc73-153c-4751-ac5b-2cca76b4c219` Accepted、票据、Gatekeeper 和20项展开验包通过。APP 已独立安装验收,本轮未重复执行系统 PKG 安装脚本。`verification/Package.json` 是本版验包记录。
按用户要求,公证后先更新原文章 https://dayu.media/15792/:标题及正文说明“紧急 UI 更新”,新生成封面,深色/浅色两张用户原图,主下载包更新为本版;50元、有效会员免费及其它商业/视频设置保留。前台SEO逐项一致、旧图移除、新图原始哈希与正式包完整下载校验通过。素材、正文、提示词与验证分别保存在 `Publishing/1.10.0/`、`verification/Article1.10.0.json`。未修改 NAS 源码、生产接口或自动更新清单。
远端 https://dayu.media/git/dayu/dayu-color.git,main。发行目标标签 `v1.10.0-canvas-workspace-20261104`;Git Release 仍待上传与完整下载核验,不能将旧版 `Release.json` 当作本版记录。标签包含最终 Package.json 与文章记录;发布后 Release.json 保存在后续 main,不移动已有标签。71 因实窗顶栏缺陷被72替代未发布,70包保留为历史未发布候选。
独立远程 checkout 已核对实际编译提交、526个跟踪文件、Git fsck、8个锁定依赖归档、插件/诊断/工作区/渲染器四个翻译单元 C++20 语法,见 `verification/WorkspaceRecovery1.10.0.json`。无 LFS/子模块,未重复完整重建 CMS 依赖。Xcode27.1、FxPlug SDK4.3.5、Apple Silicon/macOS14.6+;签名/公证凭据需独立恢复,不在 Git。
正式验收后已清理任务生成的70/71旧安装恢复APP、缓存生成APP和公证ZIP,见 `verification/WorkspacePendingCleanup1.10.0.json`;源码恢复checkout暂留供最终标签核验。源码、历史包和用户QA媒体保留。恢复具体步骤沿用下文,当前版本以本节和相应验证记录为准。
以下为上一完整发布版 1.8.5(67)及历史交接,供恢复参考。
# 大鱼调色开发交接
2026-11-04,Asia/Shanghai。当前正式1.8.5(67),实际编译源码d39004c26af3c0c5853111faef7e40e6c66f6aa6。工程 /Volumes/备份/大鱼调色/大鱼调色,main,https://dayu.media/git/dayu/dayu-color.git。AppKit/Objective-C++,Wrapper Application / Release,macOS14.6+,Apple Silicon,Xcode27.1/FxPlug4.3.5。
@@ -33,3 +53,5 @@ tools/checkpoint.py对明确路径提交/推送/回读,自带锁。tools/deliv
正式验证后只清理本任务生成APP、提交ZIP、临时旧安装备份、下载和恢复clone,保留源码/历史包/私人QA媒体。RECOVERY.md记录恢复方式;源码远程备份不替代签名凭据独立备份。
最终67正式PKG 43010987字节,SHA-256 b4540c2be931d9e042ed1a6f2673c001e4b6e0ec67eef0bc22f4b3977af4952b,公证04fae6f1-7e38-4ab4-8c12-7bcae0ea77fd Accepted,Installer签名/票据/Gatekeeper及20项展开验包通过。源码及正式包记录随v1.8.5-light-dark-20261104标签保存;实际Release/下载回读另见后续Release.json。
最终Release386/附件30已发布并回读:https://dayu.media/git/dayu/dayu-color/releases/tag/v1.8.5-light-dark-20261104。标签完整提交def8c2f6386a3d34453912b9e8f96e37e192796c;草稿Edge真实下载与发布后再次完整下载均核对43010987字节、SHA-256 b4540c2be931d9e042ed1a6f2673c001e4b6e0ec67eef0bc22f4b3977af4952b。PKG公证04fae6f1-7e38-4ab4-8c12-7bcae0ea77fd Accepted。独立远程版本标签498个文件与8个依赖归档校验,编译输入一致;本轮未独立重新编译。生成APP、旧安装备份、候选66包、下载副本及恢复clone按SoftCleanup1.8.5.json清理,正式67安装和最终PKG/历史包保留。标签包含最终Package.json;标签快照里的旧Release.json是上一版历史,1.8.5发布回读在后续main,不移动既有标签。