比较提交

...
作者 SHA1 备注 提交日期
mac 5f8fb13fce release: accept 1.11.0 host tests and finalize notarized package 2026-11-05 02:19:32 +08:00
mac 4f7450bfec release: preserve signed notarized 1.11.0 package pending host acceptance 2026-11-05 02:14:17 +08:00
mac d2875fe86c docs: preserve formal host discovery and pending mouse acceptance evidence 2026-11-05 02:12:00 +08:00
mac 1835ecc2a2 docs: explain canvas graphics, face selection and lens workflow for 1.11.0 2026-11-05 02:07:46 +08:00
mac fdfcbd8ba9 docs: record notarized 1.11.0 candidate and prepare native host acceptance fixtures 2026-11-05 02:03:43 +08:00
mac 49d35cb49a fix: retain compact folded defaults after resetting all tools 2026-11-05 01:54:19 +08:00
mac 2711e0016e release: prepare 1.11.0 canvas tools and rebuild native template metadata 2026-11-05 01:51:03 +08:00
mac 1c3e294ce9 fix: protect async preview lifetime and validate real canvas and spatial tools 2026-11-05 01:42:34 +08:00
mac a3bd2ceb26 feat: wire canvas HSL and spider editors, face support and lens repair (validation pending) 2026-11-05 01:28:18 +08:00
mac e2aa0bd9a1 docs: save canvas tools and face protection implementation contract 2026-11-05 01:16:23 +08:00
mac 5224e404f5 docs: add custom canvas control development handoff 2026-11-04 23:57:02 +08:00
mac 302b75710b release: save article verification, tag recovery and blocked draft publication state 2026-11-04 23:13:05 +08:00
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
共修改 97 个文件,包含 3783 行新增和 154 行删除

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

+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元、有效会员免费及其它商业设置保持。
+13
查看文件
@@ -0,0 +1,13 @@
# 大鱼调色 1.11.0(73)
曲线、HSL 与蜘蛛盘现可在画布中直接编辑。曲线包含同区直方图,三个工具支持半透明面板、多面板移动、独立图层及一次拖动一次撤销。
主检查器默认保留一级、基础、蜘蛛、HSL 四张折叠卡;其它工具通过添加模块或画布工具条打开。新增当前帧人脸肤色限定及实际保护区域预览,并加入缩放、光学中心和蒙版可调的镜头径向畸变修复。旧调色参数 ID、已有图层及预设 v7 继续兼容。
需要 macOS 14.6 或更高、Apple Silicon Mac、Final Cut Pro 或 Motion。肤色范围在本机检测;未识别到人脸时不使用上一镜头蒙版。镜头修复由本项目独立实现,尚无与参考插件逐像素一致的证明。包含空间处理的调色可保存完整预设,静态 Cube 无法保存空间选区或几何变换。
APP 实际编译源码:49d35cb49ab93f5ab6ca3411eaea80f7219be346。APP 公证 Accepted、票据及 Gatekeeper 通过,正式安装 724 项原生检查通过。
PKG 已签名、公证 Accepted、粘附票据并通过 20 项展开验包。43,128,845 字节,SHA-256:2dd5166902ebdaae50dd897057459cbe7e5ea611dbdeb571bd688e843c59768e。
Final Cut Pro 12.4 已加载唯一正式安装版本;用户实鼠确认画布三工具及一次撤销、人脸肤色区域、畸变网格调整三项均正常。旧版恢复 APP 已在验收后清理。
+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

+21 -1
查看文件
@@ -1,6 +1,26 @@
# 大鱼调色
原生 FxPlug 4 调色器,当前公测版本 **1.8.4(64)**。唯一安装位置为 `/Library/Plug-Ins/FxPlug/大鱼调色.app`;Final Cut Pro 中从“效果 → 大鱼调色”添加。
## 1.11.0 画布图形与空间工具
工具条可打开曲线、HSL 和蜘蛛盘的半透明编辑面板,拖动标题可移动,点击标题折叠,同一工具再次点击关闭。主检查器初始仅显示一级、蜘蛛、基础、HSL 四张折叠卡;其它工具通过“+ 添加模块”或画布入口进入,已有有效调色自动显示。
- 曲线:同区显示直方图;切换 RGB/红/绿/蓝,点击加点、拖动调节、删除选中点。
- HSL:选择色相、饱和度或明亮度,上下拖动对应颜色点;参数页保留精确参数与自定义色选。
- 蜘蛛盘:拖点联动同列自由点,可固定、还原选中点、全盘复位及切换网格分辨率。
- 肤色:默认仅保护人脸肤色;“显示肤色保护区域”以灰度显示实际权重。无脸时为空,关闭人脸限定可使用旧的全图颜色筛选。
- 镜头畸变修复:正负强度调整径向畸变,配合缩放与光学中心;小画布通过工具条 ↕ 翻页找到“畸变”。
图形修改支持基础层与独立 UUID 层,一次拖动归入一次撤销。主题、面板位置和开合不改变调色。系统“降低透明度”开启时使用实色面板。完整预设保存空间参数与网格;Cube 无法保存空间选区和几何变换。
正式 1.11.0(73)已签名、公证、安装并通过 724 项原生检查;FCP 12.4 中画布三工具及一次撤销、人脸肤色区域、畸变调整已由用户实鼠确认正常。PKG 已通过签名、公证与 20 项展开验包,保存在上级发行包目录。Release 发布状态见 verification/Release.json。
继续完善画布自定控件请先读[自定控件开发交接](/Volumes/备份/大鱼调色/大鱼调色/自定控件开发交接.md),其中列出当前能力、源码入口、交互约定、建议顺序和验证方法。
原生 FxPlug 4 调色器。当前正式签名、公证并安装 **1.11.0(73)**,固定位置 `/Library/Plug-Ins/FxPlug/大鱼调色.app`;FCP 中从“效果 → 大鱼调色”添加。
1.10.0 基线采用纵向工具条和多个可移动浮动面板,曲线可直接拖点,分级可直接调色轮;画布外工作区提供 sRGB 显示参考示波器和风格1 LUT 预览。该历史版本的695项正式安装原生检查与用户实鼠的曲线拖点/一次撤销、LUT预览、示波器更新均通过。
[原资源文章](https://dayu.media/15792/)此前更新为“1.10.0 紧急 UI 更新”,本轮未修改文章或站点下载。[历史 1.10.0 Git Release](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.10.0-canvas-workspace-20261104)保留原有草稿,因草稿附件下载核验未完成而未发布;源码与版本标签已推送并独立恢复核验。详见[交互说明](research/ViewerWorkspace-20261104.md)、[宿主验证](verification/HostWorkspace1.10.0.json)、[文章验证](verification/Article1.10.0.json)与[恢复说明](RECOVERY.md)。
1.8.4 收敛“霓虹炫彩”配色:所有模块统一使用用户已认可的低饱和近黑表面,去掉红绿橙色块。保存预设保留原粉紫到青色渐变;模块名称按钮以统一轻渐变、细边和更亮展开态强化显示,蒙版/删除/再加一层按钮增加克制的按钮底。原主题编号、功能、直方图、CMS及预设保持。
+32
查看文件
@@ -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` 已推送并回读,完整提交 `c0e6f3be0afc310125d2d045a96655db7524f24b`。Git Release387/附件31已上传草稿;草稿下载需要浏览器登录,而CUA因当前页面URL访问限制终止会话,未绕过限制、未发布Release。当前 `verification/Release.json` 与 `CMSReleaseDraft.json` 如实记录下载核验阻塞。原文章的下载包已另行完整下载校验通过,不能用它冒充Release附件下载证明。标签包含最终Package.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`;独立远程版本标签已核对源码、Git完整性、文章和三张素材哈希,实际编译源码未变;恢复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)统一底色与模块按钮强化
@@ -450,3 +472,13 @@ python3 Packaging/build_pkg.py --pkg-forge-repo /实际/PKG工坊源码目录 --
正式PKG `大鱼调色-1.6.0.pkg`,40833847字节,SHA-256 `13821631b5d54f1b9c1934c513a9cc7e92641208e20219839a63e23865f21cca`;PKG公证 `4716e3c7-8199-4dc1-940c-2376dd647e9b` Accepted,签名、票据、Gatekeeper和20项展开验包通过。发行包未再次运行系统安装器。
最终[Release373](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.6.0-print-looks-20261102) / 附件18已发布并回读确认。标签 `v1.6.0-print-looks-20261102` 对应完整SHA `0cc51149a6f21ebe09465b4fd7130451bedd57bb`;草稿正常浏览器下载与发布后完整下载均校验40,833,847字节及SHA-256一致。发行标签296文件逐字节恢复和full/strict fsck通过,与实际编译SHA的程序源码完全一致。恢复clone、独立构建和下载副本清理完成;已知相关位置仅正式39版APP,历史发行包和私人验收数据保留。记录见 `verification/Release.json`、`ReleaseDraftDownload1.6.0.json`、`PrintLooksReleaseRecovery.json`、`PrintLooksCleanup.json`。
## 1.11.0(73)画布与空间工具交付
实际编译 `49d35cb49ab93f5ab6ca3411eaea80f7219be346` 已推送并从大鱼远端独立恢复549文件,逐字节一致,full/strict fsck和模板合同通过。无LFS和子模块。固定安装仍为 `/Library/Plug-Ins/FxPlug/大鱼调色.app`。APP公证 `348c6e9b-f5d9-4661-bc7f-f192fa770ecf` Accepted,安装版724项原生回归通过。用户实鼠确认画布三工具及一次撤销、肤色区域、畸变三项正常,正式宿主验收记录见verification/HostCanvasTools1.11.0.json。Delivery状态verified,旧版恢复APP已清理。
新增Vision属于系统框架,无下载模型或服务端人脸上传。图像和短时人脸几何在本机处理;测试真人来源及公共领域说明见tools/fixtures/README.md。新增独立反向径向畸变采样,保留原Uniform1312字节完整前缀,扩展后1344字节。完整预设保存新数据;Cube不能保存空间选区和几何变换。
重建模板:`python3 tools/build_template.py --refresh-model --overwrite`;构建交付:`python3 tools/deliver.py`(先退出FCP/Motion);新宿主项目:`python3 tools/create_canvas_host_fixture.py`,随后通过FCP的文件→导入→XML打开生成的文件,不能直接编辑fcpbundle。仅签名公证或模拟宿主回归通过不足以完成实鼠验收。
1.11.0 PKG已完成Developer ID Installer签名、Apple公证Accepted(ffbdb4fb-f573-411e-99fc-166c4a829121)、票据/Gatekeeper和20项展开验包。43,128,845字节,SHA-256 `2dd5166902ebdaae50dd897057459cbe7e5ea611dbdeb571bd688e843c59768e`,正式包位于 `/Volumes/备份/大鱼调色/发行包/大鱼调色-1.11.0.pkg`。未执行PKG安装脚本;APP由交付流程独立正式安装验证。Release和完整下载核验以verification/Release.json为准。
+44
查看文件
@@ -0,0 +1,44 @@
# 画布工具与修复任务
日期:2026-11-05。基线 main `5224e404f54067eca11b9b749095d87fa980c535`,远程已核验,工作区干净。唯一正式产品 `com.dayu.color`,安装 `/Library/Plug-Ins/FxPlug/大鱼调色.app`。
用户验收范围:
- 曲线、HSL、蜘蛛盘为可移动半透明画布图形;曲线同区叠加直方图,保留精确参数页。
- 主检查器初始只展示一级、基础、蜘蛛、HSL 四张折叠卡。其它工具通过添加模块或画布工具条进入,已有工程的有效调色必须保留。
- 肤色保护增加区域显示;实时识别人脸,并将颜色筛选限制在人脸皮肤范围,无脸不得保护同色背景。参考用户指定 MIT 仓库 FCP-BeautyGirl,保留来源说明。
- 参考 mFilmLook 的变形/镜头畸变修复功能,接入真实渲染、模块、预设和撤销。
布局沿用 AppKit/Metal OSC 与原参数桥。图形、命中共用几何,基础层及 UUID 层均支持,一次拖动一次撤销,时间/节点/外部冲突时停止写入。半透明在降低透明度时使用实色。
演示 `/Volumes/备份/6524bdcd3a33f6bd0128a340b9c7fadc_raw.mp4`:4096×2584,120fps,45.65秒;只读抽帧存构建缓存,不把用户视频上传到源码仓库。
交付必须完成 Release、Developer ID、Apple Accepted、票据、唯一安装及正式路径自检、宿主功能验收、PKG 与 Release 下载校验、远端独立恢复。额度重置由用户手动操作。
状态:研究与实现中,尚未交付新版。
## 实现检查点
HSL八色三轴图形、蜘蛛网格拖动/固定/复位/分辨率、半透明绘制与降低透明度替代、曲线直方图已连接原参数。蜘蛛自定义资产扩展了主队列冲突保护。主面板按显示状态隐藏未使用的附加模块,保存过的有效参数自动显示;画布工具入口可以恢复已删除类型。
FCP-BeautyGirl 参考提交 `42fecaa3b55471fea928339127d53484663d4057`,MIT 许可证见同目录 FCPBeautyGirl-MIT.txt。参考 Vision revision 3、76点、皮肤支持区与五官排除的思路;未引入美颜、瘦脸或目标二进制。
mFilmLook 3.1.4 arm64 SHA-256 `b1cee1dffd3b490afa0c22db646404b018a0aaadf70d9a6827e95cb178c74357`。REA Ghidra 12.1.4 观察到 Lens Distortion、ParamLensDistortionEnable/Strength、RenderDistortionKernel,证据 `ev_77ca21689086d3b977243f1b81b3833a89b9e48aa5cd3e38594572abad5296a2`、`ev_5c4653c5bdd4316ec067c530085235c5c37733b2490065ed6d5ea855611057a7`。本项目独立编写反向径向采样,不宣称已证明目标GPU逐像素等价。
Uniform 仅在原1312字节之后追加32字节,旧参数ID与完整前缀不变;新增独立镜头模块、肤色范围预览及默认人脸限定。当前编译/验证中,未安装。
## 第二阶段验证
原生回归已扩展至719项,新增真实 OSC 图形手势、UUID网格资产、外部拓扑冲突、畸变GPU与独立CPU采样对照、NASA公共领域真人及同色背景检查。原695项按新15工具和四卡折叠布局更新展示预期,旧点颜色/Cube参照显式排除新空间人脸选区。
AddressSanitizer 发现旧 renderLegacy 的 C++ 引用捕获向异步通知泄漏栈 self 地址;改为独立 Objective-C 通知方法后完整内存检查运行结束,无该内存错误。先前未检测到问题的旧正式版695项仍通过,原栈布局偶然掩盖缺陷。
肤色预览改为在原生皮肤阶段读取同一个色选算法、同一预HSL参考、同一用户蒙版与人脸覆盖,白色代表保护权重。初次真人测试识别人脸但MTLTexture→CIImage上下相反,已按TOP_LEFT归一化修正,正在重跑;未通过前不交付。
曲线直方图由成功渲染的分析更新发布到同时间快照,播放头不匹配时不展示旧帧。人脸只缓存完全相同的标准化像素;无脸或输入失败时为空,不延续上一镜头。新增空间处理的Cube导出会明确拒绝,完整预设继续保存。
## 候选 1.11.0(73)
724项原生回归通过;真实人脸中心归一化坐标约(0.437,0.244),双人检测2张脸。上下原点输出最大误差0;同色背景差异0,人脸保护生效。独立层、零强度用户蒙版和无脸清空均通过。新的完整724项AddressSanitizer运行未报告内存错误;唯一失败为启用插桩后的旧主队列响应阈值(约226ms),无插桩Release该项通过,未放宽阈值。
最终交付脚本显式关闭ASAN并清理专用构建后重编译,正式安装自检自动提供版本化真人fixture。FCP已通过正常退出保存现有验收库;不修改库数据库。准备正式构建和宿主验收,尚未交付新版。
+21
查看文件
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Dayu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+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安装脚本。
+80 -3
查看文件
@@ -1271,6 +1271,28 @@
"step": 1,
"title": "肤色色相"
},
{
"default": 1,
"key": "skinFaceOnly",
"kind": "bool",
"max": 1,
"min": 0,
"offset": 1332,
"pid": 2333,
"step": 0.01,
"title": "仅保护人脸肤色"
},
{
"default": 0,
"key": "skinVisualize",
"kind": "bool",
"max": 1,
"min": 0,
"offset": 1336,
"pid": 2334,
"step": 0.01,
"title": "显示肤色保护区域"
},
{
"default": 1,
"key": "skinEnabled",
@@ -3630,6 +3652,61 @@
"pid": 2292,
"step": 0.01,
"title": "胶片模拟"
},
{
"default": 0,
"key": "lensStrength",
"kind": "float",
"max": 100,
"min": -100,
"offset": 1316,
"pid": 2329,
"step": 1,
"title": "畸变校正"
},
{
"default": 1,
"key": "lensScale",
"kind": "float",
"max": 2,
"min": 1,
"offset": 1320,
"pid": 2330,
"step": 0.01,
"title": "画面缩放"
},
{
"default": 0.5,
"key": "lensCenterX",
"kind": "float",
"max": 1,
"min": 0,
"offset": 1324,
"pid": 2331,
"step": 0.01,
"title": "光学中心 X"
},
{
"default": 0.5,
"key": "lensCenterY",
"kind": "float",
"max": 1,
"min": 0,
"offset": 1328,
"pid": 2332,
"step": 0.01,
"title": "光学中心 Y"
},
{
"default": 1,
"key": "lensEnabled",
"kind": "bool",
"max": 1,
"min": 0,
"offset": 1312,
"pid": 2328,
"step": 0.01,
"title": "镜头畸变修复"
}
],
"sourceSHA256": {
@@ -3641,11 +3718,11 @@
"大鱼调色/Plugin/DYManagedColor.h": "d5901d6ac11d93f3f4438dd8d48bb3a123d06d9b79ed39e8dca38db4261bc87a",
"大鱼调色/Plugin/DYManagedColor.mm": "d9d2688f26a51d1131ee63b415e0c09989616312d31eb3b636fd299f475ece08",
"大鱼调色/Plugin/DYModel.h": "a28652bd53aa9e1d085af1108c344b5d673c5e1b3731531e1bb2982efeb8708c",
"大鱼调色/Plugin/DYModel.mm": "29fea6064d3131119933401f554cc04e48cadf07d0c62f25b8d66795201396f8",
"大鱼调色/Plugin/DYModel.mm": "e5bdf3177e164c0b97e535be7e6d14ea56d49f3f74c3622078374e7a9597d2c1",
"大鱼调色/Plugin/DYSpiderState.h": "0c80747e41e8fc97762e301b011bd08c18865a825eaafde086ed79ace37b22f9",
"大鱼调色/Plugin/DYToolState.h": "0a83109d2c02626d6b9e7340b74be6e6a74f366f31f9d7622b4a88000d5ad7b9",
"大鱼调色/Plugin/DYToolState.mm": "be984c73f5c4e563e3ac8de2b911e33071773f3d823b6b2d631444d3aa2baea2",
"大鱼调色/Plugin/DYUniforms.h": "207d36b5b53ab084fa8eb3813ccbbeb5193178e3468a37e9dc692ab196ffbb6a",
"大鱼调色/Plugin/DYToolState.mm": "49ccde836056123cc4912eaf43da11af1713db19add5e833d0287586554acd09",
"大鱼调色/Plugin/DYUniforms.h": "4901446fa6b2a6987a6a137baa458df70f5e25a1e64fdb5c502f765b20edc0c0",
"大鱼调色/Plugin/MaskCore/DYMask.h": "5b9aa44390d4a1fca1baf5e34cb9eefc8483c939a65cc2a0412b7b41fc85bc16",
"大鱼调色/Plugin/MaskCore/DYMaskOperator.h": "43fa701ad574f38ce0ab4f4d3900bb034edaaa1adc09821d2f4443ee2b687ba2",
"大鱼调色/Plugin/SpiderCore/DYColorMath.h": "bdd6278e17ff4208ad94a8b0e834c817c0a3475f205dd79898e8fd88e84a19c9",
+2 -2
查看文件
@@ -1,10 +1,10 @@
{
"passed": true,
"sha256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
"sha256": "eaf60224f8d970f8841a03fe0325adc4af73d1c017375b020bcc0e256f0cd803",
"version": "5.11",
"displayversion": "5.4.5",
"filterCount": 1,
"nativeFloatParameters": 278,
"nativeFloatParameters": 285,
"customParameters": 3,
"publications": [
{
+7
查看文件
@@ -306,6 +306,8 @@
<parameter name="白平衡与颜色" id="2035" flags="12889161760" default="1" value="1" />
<parameter name="保护程度" id="2117" flags="12889161760" default="60" value="60" />
<parameter name="肤色色相" id="2118" flags="12889161760" default="28" value="28" />
<parameter name="仅保护人脸肤色" id="2333" flags="12889161760" default="1" value="1" />
<parameter name="显示肤色保护区域" id="2334" flags="12889161760" default="0" value="0" />
<parameter name="肤色保护" id="2116" flags="12889161760" default="1" value="1" />
<parameter name="风格 1 强度" id="2015" flags="12889161760" default="1" value="1" />
<parameter name="风格 2 启用" id="2040" flags="12889161760" default="1" value="1" />
@@ -513,6 +515,11 @@
<parameter name="印片外观" id="2324" flags="12889161776" default="0" value="0" />
<parameter name="印片强度" id="2325" flags="12889161760" default="1" value="1" />
<parameter name="胶片模拟" id="2292" flags="12889161760" default="1" value="1" />
<parameter name="畸变校正" id="2329" flags="12889161760" default="0" value="0" />
<parameter name="画面缩放" id="2330" flags="12889161760" default="1" value="1" />
<parameter name="光学中心 X" id="2331" flags="12889161760" default="0.5" value="0.5" />
<parameter name="光学中心 Y" id="2332" flags="12889161760" default="0.5" value="0.5" />
<parameter name="镜头畸变修复" id="2328" flags="12889161760" default="1" value="1" />
<parameter name="混合" id="10001" flags="12884901888" default="1" value="1" />
<parameter name="翻转" id="10002" flags="12889161760" default="0" value="0" />
<parameter name="输入点" id="10003" flags="12889161760" default="1" value="1" />
+26 -2
查看文件
@@ -8,7 +8,7 @@ import re
def masked_kernel(source):
original = re.search(r'define <4 x half> @dy_grade\(.*?\n\}', source, re.S).group()
body = original.replace('@dy_grade(', '@dy_gradeMasked(', 1)
args = ', '.join(f'float %dyWeight{i}' for i in range(12))
args = ', '.join(f'float %dyWeight{i}' for i in range(12)) + ', float %dySkinVisualize'
body = body.replace(') local_unnamed_addr #0 {', ', '+args+') local_unnamed_addr #0 {', 1)
# Each stage mixes against its actual input. Split basic adjustment has
# two native locations; both use the same per-module coverage.
@@ -58,6 +58,26 @@ def masked_kernel(source):
' %dyIncludesFinalLast = icmp uge i32 %dyStageLast, 11',
' %dyIncludesFinal = and i1 %dyIncludesFinalFirst, %dyIncludesFinalLast',
' %v672 = select i1 %dyIncludesFinal, <3 x float> %dyClamped672, <3 x float> %v669']), 1)
def preview(code, reference, ranged=False):
regular=next(line for line in code.splitlines() if line.startswith(' %v669 = tail call'))
extra=[regular.replace('%v669 = ', '%dySkinNormal = ', 1),
' %dySkinSelection = call float @dy_skinWeight(<3 x float> %v668, <3 x float> '+reference+', %struct.DYUniforms addrspace(2)* %v12)',
' %dySkinPointer = getelementptr inbounds %struct.DYUniforms, %struct.DYUniforms addrspace(2)* %v12, i64 0, i32 65',
' %dySkinVector = load <3 x float>, <3 x float> addrspace(2)* %dySkinPointer, align 16',
' %dySkinStrength = extractelement <3 x float> %dySkinVector, i64 1',
' %dySkinRatio = fmul float %dySkinStrength, 0x3F847AE140000000',
' %dySkinSelected = fmul float %dySkinSelection, %dyWeight3',
' %dySkinAmount = fmul float %dySkinSelected, %dySkinRatio',
' %dySkinGray0 = insertelement <3 x float> undef, float %dySkinAmount, i64 0',
' %dySkinGray = shufflevector <3 x float> %dySkinGray0, <3 x float> undef, <3 x i32> zeroinitializer',
' %dySkinShow = fcmp ogt float %dySkinVisualize, 5.000000e-01']
condition='%dySkinShow'
if ranged:
extra+=[' %dySkinShowActive = and i1 %dySkinShow, %dyStageActive669'];condition='%dySkinShowActive'
extra+=[' %v669 = select i1 '+condition+', <3 x float> %dySkinGray, <3 x float> %dySkinNormal']
return code.replace(regular, '\n'.join(extra), 1)
body=preview(body,'%v411')
segment=preview(segment,'%dySkinReference',True)
skin='''
define <3 x float> @dy_skinExtra(<3 x float> %color, <3 x float> %reference, %struct.DYUniforms addrspace(2)* %uniforms) {
entry:
@@ -65,4 +85,8 @@ entry:
ret <3 x float> %result
}
'''
return source+'\n'+body+'\n'+segment+'\n'+skin
# Expose the existing color-selection arithmetic for a matching preview.
weight = re.search(r'define internal fastcc <3 x float> @_ZL19applySkinProtection.*?\n\}', source, re.S).group()
weight = weight.replace('define internal fastcc <3 x float> @_ZL19applySkinProtectionDv3_fS_RU11MTLconstantK17DYUniforms', 'define float @dy_skinWeight', 1)
weight = weight[:weight.index('v135:')] + 'v135:\n br label %v153\nv153:\n %weight = phi float [ 0.000000e+00, %v3 ], [ %v133, %v135 ], [ 0.000000e+00, %v46 ]\n ret float %weight\n}\n'
return source+'\n'+body+'\n'+segment+'\n'+skin+'\n'+weight
+47
查看文件
@@ -0,0 +1,47 @@
#!/usr/bin/env python3
"""Prepare synthetic grid and public-domain portrait projects for native host QA."""
from pathlib import Path
import base64, json, plistlib, struct, uuid, zlib
import xml.etree.ElementTree as E
root=Path(__file__).resolve().parent.parent
qa=Path.home()/'Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/canvas-1.11.0'
qa.mkdir(parents=True,exist_ok=True)
portrait=root/'tools/fixtures/astronaut.png'
assert portrait.is_file()
def chunk(name,data):
return struct.pack('>I',len(data))+name+data+struct.pack('>I',zlib.crc32(name+data)&0xffffffff)
grid=qa/'lens-grid.png';w,h=1920,1080;rows=[]
for y in range(h):
row=bytearray(b'\0')
for x in range(w):
edge=x%120<3 or y%120<3
row+=bytes((225,225,225) if edge else (int(35+x/w*110),int(40+y/h*100),75))
rows.append(row)
grid.write_bytes(b'\x89PNG\r\n\x1a\n'+chunk(b'IHDR',struct.pack('>IIBBBBB',w,h,8,2,0,0,0))+chunk(b'sRGB',b'\0')+chunk(b'IDAT',zlib.compress(b''.join(rows)))+chunk(b'IEND',b''))
model=json.loads((root/'template/sources/RegisteredParameters.json').read_text())
defaults={r['key']:r['default'] for r in model['parameters']}
spider=json.loads((root/'research/cms-correction-20261104/neutral-spider.json').read_text())
def preset(name,changes):
values=dict(defaults);values.update(primaryMasterEnabled=0,inputEnabled=0,inputProfile=0,preLUTStrength=0,lookEnabled=0);values.update(changes)
payload=dict(format='com.dayu.color.preset',version=7,colorManagement={},values=values,paths={},spider=spider,tools=base64.b64encode(plistlib.dumps(dict(schema=2,layers=[],baseMasks={}),fmt=plistlib.FMT_BINARY)).decode())
(qa/name).write_text(json.dumps(payload,ensure_ascii=False,indent=2)+'\n')
preset('肤色区域预览.json',dict(skinEnabled=1,skinStrength=100,skinFaceOnly=1,skinVisualize=1,hslEnabled=1,**{f'hsl0_{i}':40 for i in range(8)}))
preset('镜头畸变修复.json',dict(skinEnabled=0,hslEnabled=0,lensEnabled=1,lensStrength=60,lensScale=1.12))
doc=E.Element('fcpxml',version='1.12');resources=E.SubElement(doc,'resources')
E.SubElement(resources,'format',id='f1',width='1920',height='1080',frameDuration='1/25s',colorSpace='1-1-1 (Rec. 709)')
for n,path,size in [('face',portrait,(512,512)),('grid',grid,(1920,1080))]:
E.SubElement(resources,'format',id='format-'+n,name='FFVideoFormatRateUndefined',width=str(size[0]),height=str(size[1]))
a=E.SubElement(resources,'asset',id=n,name=path.stem,start='0s',duration='0s',hasVideo='1',videoSources='1',format='format-'+n)
E.SubElement(a,'media-rep',kind='original-media',src=path.resolve().as_uri())
template=Path.home()/'Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef'
E.SubElement(resources,'effect',id='fx',name='大鱼调色',uid='~/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef',src=template.as_uri())
event=E.SubElement(E.SubElement(doc,'library'),'event',name='大鱼调色_1.11.0_73_画布与空间工具',uid=str(uuid.uuid5(uuid.NAMESPACE_URL,'dayu-color/canvas-1.11.0-73')).upper())
for name,asset in [('1.11.0_画布曲线_HSL_蜘蛛盘','face'),('1.11.0_人脸肤色保护','face'),('1.11.0_镜头畸变修复','grid')]:
project=E.SubElement(event,'project',name=name,uid=str(uuid.uuid5(uuid.NAMESPACE_URL,name)).upper())
sequence=E.SubElement(project,'sequence',format='f1',duration='6s',tcStart='0s',tcFormat='NDF',audioLayout='stereo',audioRate='48k')
clip=E.SubElement(E.SubElement(sequence,'spine'),'video',ref=asset,name=name,offset='0s',start='0s',duration='6s')
E.SubElement(clip,'filter-video',ref='fx',name='大鱼调色',enabled='1')
E.indent(doc);output=qa/'大鱼调色_1.11.0_73_验收.fcpxml'
output.write_text('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE fcpxml>\n'+E.tostring(doc,encoding='unicode')+'\n')
print(output)
+2 -2
查看文件
@@ -35,7 +35,7 @@ def unregister(path):
reg=run('pluginkit','-m','-A','-D','-v','-i','com.dayu.color.XPC')
if any(l.rstrip().endswith('\t'+str(path)) for l in reg.splitlines()):run('pluginkit','-r',str(path))
def self_test(executable,report):
result=subprocess.run([str(executable),'--self-test'],cwd=ROOT,text=True,capture_output=True)
result=subprocess.run([str(executable),'--self-test'],cwd=ROOT,text=True,capture_output=True,env=dict(os.environ,DY_DIAGNOSTIC_FACE_FIXTURE=str(ROOT/'tools/fixtures/astronaut.png')))
report.write_text(result.stdout)
report.with_suffix('.stderr').write_text(result.stderr)
try:parsed=json.loads(result.stdout)
@@ -53,7 +53,7 @@ def main():
if IDENTITY not in ids:raise RuntimeError('有效发布证书或私钥不可用')
if any(l.endswith('/Contents/MacOS/大鱼调色') for l in run('ps','-axo','comm=').splitlines()):raise RuntimeError('请先正常退出当前大鱼调色窗口')
print('Building final Release',flush=True)
run('xcodebuild','-project','大鱼调色.xcodeproj','-scheme','Wrapper Application','-configuration','Release','-derivedDataPath',str(CACHE/'DerivedData'),'build',log=CACHE/'release-build.log')
run('xcodebuild','-project','大鱼调色.xcodeproj','-scheme','Wrapper Application','-configuration','Release','-enableAddressSanitizer','NO','-derivedDataPath',str(CACHE/'DerivedData'),'clean','build',log=CACHE/'release-build.log')
b=APP/'Contents/Resources/FCP Templates/大鱼调色.moef';b.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(ROOT/'template/大鱼调色.moef',b)
for name in ['large.png','small.png']:
if (ROOT/'template'/name).exists():shutil.copy2(ROOT/'template'/name,b.parent/name)
+9
查看文件
@@ -0,0 +1,9 @@
# Person mask regression fixture
`astronaut.png` is the 512×512 NASA photograph of Eileen Collins distributed by scikit-image v0.25.2. It is used solely as a local segmentation test fixture, not as a product asset or endorsement. It is not copied into the APP.
- Source: https://raw.githubusercontent.com/scikit-image/scikit-image/v0.25.2/skimage/data/astronaut.png
- Attribution and rights: https://scikit-image.org/docs/0.25.x/api/skimage.data.html#skimage.data.astronaut (NASA Great Images database; released into the public domain, no known copyright restrictions).
- SHA-256: `88431cd9653ccd539741b555fb0a46b61558b301d4110412b5bc28b5e3ea6cb5`
The tests derive a two-person composition, a shifted image, and an occluded image in memory. They check basic foreground/background separation and request independence; they do not establish broad segmentation accuracy or equivalence to Color Finale.
二进制文件未显示。

之后

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

+83
查看文件
@@ -0,0 +1,83 @@
{
"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,
"alt": "大鱼调色 1.10.0 紧急 UI 更新:画布工具、曲线色轮与独立工作区"
},
"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",
"frontendCoverVerified": true
}
+8 -8
查看文件
@@ -1,11 +1,11 @@
{
"status": "draft-download-required",
"releaseID": 383,
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.8.2-blackgold-20261104",
"tag": "v1.8.2-blackgold-20261104",
"commit": "f4bacfbd75404a69f51127356fc861a44c0c27e9",
"assetID": 27,
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.8.2-blackgold-20261104/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.8.2.pkg",
"bytes": 43006067,
"sha256": "cbabffc620ad851bd8ecddfaf797c46689722d0f772be409aaa29d0841a2eded"
"releaseID": 387,
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.10.0-canvas-workspace-20261104",
"tag": "v1.10.0-canvas-workspace-20261104",
"commit": "c0e6f3be0afc310125d2d045a96655db7524f24b",
"assetID": 31,
"downloadURL": "https://dayu.media/git/attachments/cb9b5516-0953-4993-99a1-360c1d92cb6d",
"bytes": 43090565,
"sha256": "ee70461c9b2d2e0ddd78cbcb3371c3b1b36b7f0e5fc69bfccc7ac0f1a3e468d8"
}
+22
查看文件
@@ -0,0 +1,22 @@
{
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/canvas-1.11.0/大鱼调色_1.11.0_73_验收.fcpxml",
"status": "pass",
"dtd": "/Applications/Final Cut Pro.app/Contents/Frameworks/Interchange.framework/Versions/A/Resources/FCPXMLv1_12.dtd",
"errors": [],
"warnings": [],
"checks": {
"dtd": true,
"xml": true,
"local_media": {
"checked": 2,
"missing": 0
}
},
"version": "1.12",
"summary": {
"projects": 3,
"assets": 2,
"elements": 27
},
"host_validation": "not_performed_by_this_command"
}
+58
查看文件
@@ -0,0 +1,58 @@
{
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.11.0.pkg",
"sha256": "2dd5166902ebdaae50dd897057459cbe7e5ea611dbdeb571bd688e843c59768e",
"bytes": 43128845,
"testUnsigned": false,
"installationExecuted": false,
"checks": [
"PKG Developer ID Installer signature",
"PKG stapled ticket and Gatekeeper install assessment",
"must-close attached to root-authorized payload",
"all four FCP/Motion host identifiers",
"bundle relocation disabled",
"desktop and Bundle ID preinstall guards",
"postinstall contains actual FxPlug verification invocations",
"GUI worker, registration repair and Finder reveal present",
"successful completion and consecutive registration checks",
"exact payload contents: 大鱼调色.app",
"fixed FxPlug outer APP install path",
"outer APP has one real verification action",
"service path/identifier/registration version: com.dayu.color.XPC",
"nonempty FxPlug service manifest",
"payload APP signature, independent ticket and Gatekeeper",
"exact payload contents: 大鱼调色",
"login-user resource destination: ~/Movies/Motion Templates.localized/Effects.localized",
"complete outer APP payload present",
"welcome warns to save work and close hosts",
"conclusion gives manual APP and host restart instructions"
],
"resources": [
{
"source": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
"payload": "Library/Plug-Ins/FxPlug/大鱼调色.app",
"bundleID": "com.dayu.color",
"version": "1.11.0",
"build": "73"
},
{
"source": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/pkg-inputs/大鱼调色",
"payload": "Library/Application Support/PKGForge/Payload/com.dayu.color.installer.eb9ab973-a3e5-42c3-862f-658f5151d090/3257180A-BAC3-4EB9-A02B-91B15B093A2E/大鱼调色"
}
],
"signature": "Package \"大鱼调色-1.11.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 18:10:52 +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.11.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": "ffbdb4fb-f573-411e-99fc-166c4a829121",
"status": "Accepted",
"name": "大鱼调色-1.11.0.pkg",
"createdDate": "2026-11-04T18:10:53.762Z"
},
"appCompiledSource": "49d35cb49ab93f5ab6ca3411eaea80f7219be346",
"appBuild": "73",
"hostAcceptance": "passed-user-actual-mouse",
"packageBuilderCommit": "eb53707c0e67d8ddeab8c1270bb079f1050cfafe",
"installScope": "Package expanded and verified; installation scripts were not run.",
"releaseStatus": "ready-for-release"
}
@@ -0,0 +1,9 @@
{
"commit": "49d35cb49ab93f5ab6ca3411eaea80f7219be346",
"remote": "https://dayu.media/git/dayu/dayu-color.git",
"trackedFilesCompared": 549,
"mismatches": [],
"lfs": false,
"submodules": false,
"fullStrictFsck": "passed"
}
+14
查看文件
@@ -0,0 +1,14 @@
{
"checks": 724,
"memoryError": false,
"stackUseAfterReturnEnabled": true,
"failedChecks": [
{
"heartbeats": 0,
"maximumGapMS": 226.45924999960698,
"name": "external-activation-main-loop-responsive",
"pass": false
}
],
"note": "Instrumented main-loop timing exceeds the unchanged release threshold; the non-instrumented Release check passes."
}
+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;
}
+8 -7
查看文件
@@ -2,15 +2,16 @@
"status": "verified",
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
"bundleID": "com.dayu.color",
"version": "1.8.5",
"build": "67",
"version": "1.11.0",
"build": "73",
"team": "B3W25FX5H5",
"notaryID": "bf104b1f-5161-4970-8d8a-170989825747",
"notaryID": "348c6e9b-f5d9-4661-bc7f-f192fa770ecf",
"notaryStatus": "Accepted",
"gatekeeper": "/Library/Plug-Ins/FxPlug/大鱼调色.app: accepted\nsource=Notarized Developer ID",
"sourceCommit": "d39004c26af3c0c5853111faef7e40e6c66f6aa6",
"sourceCommit": "49d35cb49ab93f5ab6ca3411eaea80f7219be346",
"templatePath": "/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef",
"templateSHA256": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
"shaderSHA256": "38395fc34a3e3f222c34abc7b643df820f6a3c1a12eac52f2f9a6beaa0a7da76",
"hostVerification": "verification/HostTwoModes1.8.5.json"
"templateSHA256": "eaf60224f8d970f8841a03fe0325adc4af73d1c017375b020bcc0e256f0cd803",
"shaderSHA256": "462afbfdfc8d79aefd17d0928151f4c981d4145e2ad6bc3486a27aa73177b128",
"hostVerification": "verification/HostCanvasTools1.11.0.json",
"hostAcceptance": "User actual mouse: 三项均正常"
}
+28
查看文件
@@ -0,0 +1,28 @@
{
"version": "1.11.0",
"build": "73",
"status": "passed",
"sourceCommit": "49d35cb49ab93f5ab6ca3411eaea80f7219be346",
"formalPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
"nativeChecks": 724,
"nativePass": true,
"host": "Final Cut Pro 12.4",
"event": "大鱼调色_1.11.0_73_画布与空间工具",
"projectsImported": 3,
"importWarningObserved": false,
"mainPanelObserved": "primary, spider, base, hsl collapsed",
"mappedExecutableVerified": true,
"servicePID": 81386,
"strictSignature": true,
"stapledTicket": true,
"noInstrumentedRuntime": true,
"manualAcceptance": {
"canvas": "passed",
"faceSelection": "passed",
"lens": "passed",
"source": "user actual-mouse confirmation",
"userReply": "三项均正常",
"confirmedAt": "2026-11-05T02:17:59.020148+08:00"
},
"automationLimit": "Coordinate input could not establish reliable native OSC mouse actions; final three-case acceptance is the user actual-mouse confirmation, separately from the 724 native checks."
}
+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, final signed/notarized package and published article verified. Git Release 387 / asset 31 remains draft; authenticated draft download verification blocked.",
"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."
}
}
+514 -16
查看文件
@@ -1,6 +1,6 @@
{
"bundlePath": "/Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit",
"checks": 610,
"checks": 724,
"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,14 +12,14 @@
"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/148FEAE4-C0CE-4B1C-89E2-6F0DDC4DBD8C"
},
{
"descriptors": 278,
"descriptors": 285,
"name": "descriptor-unique-id-offset-key",
"pass": true,
"sections": 17,
"uniformBytes": 1312
"sections": 18,
"uniformBytes": 1344
},
{
"name": "finite-real-model-defaults",
@@ -113,8 +113,8 @@
"pass": true
},
{
"modules": 14,
"name": "default-primary-spider-base-expanded-all-eyes-on",
"modules": 15,
"name": "default-only-primary-spider-base-hsl-visible-and-collapsed",
"pass": true
},
{
@@ -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/148FEAE4-C0CE-4B1C-89E2-6F0DDC4DBD8C/diagnostic-export.cube"
},
{
"bytes": 1186074,
@@ -910,7 +910,7 @@
},
{
"heartbeats": 0,
"maximumGapMS": 77.39162500365637,
"maximumGapMS": 62.63825000496581,
"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": 3066,
"headingPixels": 51420,
"name": "workspace-offscreen-topbar-heading-pages-close-render-pixels",
"pagesPixels": 1664,
"pass": true,
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/148FEAE4-C0CE-4B1C-89E2-6F0DDC4DBD8C/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": 3066,
"headingPixels": 40380,
"name": "workspace-topbar-survives-resize-and-large-dirty-redraw",
"pagesPixels": 1664,
"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": "DB95746F-DB9E-46E2-BA89-96FD043BA21B",
"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/148FEAE4-C0CE-4B1C-89E2-6F0DDC4DBD8C/node.cube"
},
"pass": true,
"rootStyle1": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/148FEAE4-C0CE-4B1C-89E2-6F0DDC4DBD8C/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
@@ -1336,7 +1455,7 @@
"pass": true
},
{
"changedComponents": 1929,
"changedComponents": 1938,
"maxAbsoluteError": 0.0009765625,
"name": "anchored-split-retains-native-pre-hsl-skin-reference",
"nonfiniteComponents": 0,
@@ -1384,16 +1503,16 @@
"pass": true
},
{
"changedComponents": 2016,
"maxAbsoluteError": 0.0009765625,
"changedComponents": 1741,
"maxAbsoluteError": 0.00048828125,
"name": "anchored-bw-suffix-defers-color-mixture-until-after-native-skin",
"nonfiniteComponents": 0,
"nonzeroComponents": 9832,
"pass": true
},
{
"changedComponents": 1974,
"maxAbsoluteError": 0.001220703125,
"changedComponents": 1714,
"maxAbsoluteError": 0.00146484375,
"name": "anchored-look-suffix-keeps-bw-mixture-before-single-spider",
"nonfiniteComponents": 0,
"nonzeroComponents": 9832,
@@ -2141,7 +2260,7 @@
"pass": true
},
{
"coveredPixels": 13508,
"coveredPixels": 24613,
"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,379 @@
{
"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-all-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-curves-hsl-and-spider-offscreen",
"pass": true,
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/148FEAE4-C0CE-4B1C-89E2-6F0DDC4DBD8C/viewer-workspace.png"
},
{
"name": "canvas-hsl-plot-captures-outside-and-commits-one-undo",
"pass": true
},
{
"name": "canvas-hsl-independent-uuid-does-not-edit-base",
"pass": true
},
{
"name": "canvas-spider-drags-real-mesh-and-closes-one-undo",
"pass": true
},
{
"name": "canvas-spider-uuid-persists-mesh-without-touching-base",
"pass": true
},
{
"name": "canvas-spider-external-topology-change-wins",
"pass": true
},
{
"name": "canvas-histogram-is-frozen-to-matching-frame",
"pass": true
},
{
"error": "",
"name": "lens-neutral-production-render",
"pass": true
},
{
"name": "lens-neutral-is-identity-with-existing-prefix",
"pass": true
},
{
"error": "",
"name": "lens-positive-production-render",
"pass": true
},
{
"error": "",
"name": "lens-negative-production-render",
"pass": true
},
{
"name": "lens-directions-move-source-in-opposite-directions",
"pass": true
},
{
"name": "lens-keeps-finite-premultiplied-border-alpha",
"pass": true
},
{
"maximumError": 0.00019232047872341784,
"name": "lens-gpu-matches-independent-inverse-radial-oracle",
"pass": true
},
{
"name": "lens-spatial-correction-is-refused-by-cube-export",
"pass": true
},
{
"name": "face-real-portrait-fixture-loaded",
"pass": true
},
{
"error": "",
"name": "face-protected-production-render",
"pass": true
},
{
"centerX": 0.43674153089523315,
"centerY": 0.24444662034511566,
"faces": 1,
"name": "face-vision-finds-real-portrait-and-builds-support",
"pass": true
},
{
"error": "",
"name": "face-unprotected-reference-render",
"pass": true
},
{
"backgroundDifference": 0,
"faceDifference": 0.13671875,
"name": "face-protects-face-color-without-same-hue-background",
"pass": true
},
{
"error": "",
"name": "face-actual-selection-preview-render",
"pass": true
},
{
"backgroundWeight": 0,
"faceWeight": 1,
"maximum": 1,
"maxX": 216,
"maxY": 71,
"name": "face-preview-shows-actual-weight-and-excludes-background",
"pass": true
},
{
"error": "",
"name": "face-bottom-origin-production-render",
"pass": true
},
{
"maximumError": 0,
"name": "face-top-and-bottom-origins-protect-identical-visual-region",
"pass": true
},
{
"name": "face-preview-respects-authored-zero-strength-mask",
"pass": true
},
{
"name": "face-independent-layer-uses-own-preview-and-face-mask",
"pass": true
},
{
"faces": 2,
"name": "face-multiple-people-build-independent-support-regions",
"pass": true
},
{
"error": "",
"name": "face-none-protected-render",
"pass": true
},
{
"error": "",
"name": "face-none-unprotected-reference",
"pass": true
},
{
"name": "face-no-detection-clears-prior-frame-and-fails-closed",
"pass": true
}
],
"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/148FEAE4-C0CE-4B1C-89E2-6F0DDC4DBD8C",
"scope": "Native model and renderer integration with real Metal/IOSurface textures and fake FxPlug host selectors; no GUI or live host document."
}
+17 -23
查看文件
@@ -1,7 +1,7 @@
{
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.8.5.pkg",
"sha256": "b4540c2be931d9e042ed1a6f2673c001e4b6e0ec67eef0bc22f4b3977af4952b",
"bytes": 43010987,
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.11.0.pkg",
"sha256": "2dd5166902ebdaae50dd897057459cbe7e5ea611dbdeb571bd688e843c59768e",
"bytes": 43128845,
"testUnsigned": false,
"installationExecuted": false,
"checks": [
@@ -31,34 +31,28 @@
"source": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
"payload": "Library/Plug-Ins/FxPlug/大鱼调色.app",
"bundleID": "com.dayu.color",
"version": "1.8.5",
"build": "67"
"version": "1.11.0",
"build": "73"
},
{
"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.eb9ab973-a3e5-42c3-862f-658f5151d090/3257180A-BAC3-4EB9-A02B-91B15B093A2E/大鱼调色"
}
],
"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.11.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 18:10:52 +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.11.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"
"id": "ffbdb4fb-f573-411e-99fc-166c4a829121",
"status": "Accepted",
"name": "大鱼调色-1.11.0.pkg",
"createdDate": "2026-11-04T18:10:53.762Z"
},
"appCompiledSource": "d39004c26af3c0c5853111faef7e40e6c66f6aa6",
"appBuild": "67",
"packageBuilderRemote": "https://dayu.media/git/dayu/pkg-forge.git",
"appCompiledSource": "49d35cb49ab93f5ab6ca3411eaea80f7219be346",
"appBuild": "73",
"hostAcceptance": "passed-user-actual-mouse",
"packageBuilderCommit": "eb53707c0e67d8ddeab8c1270bb079f1050cfafe",
"templateSHA256": {
"大鱼调色.moef": "3f4f642146ae60710b865bd131c0d0be458e6430de54b50bd49dc9637643c891",
"large.png": "ab12611e8801cff86332ccc505a4cffa0c1120541c2efb9bb9908be2c9fe631a",
"small.png": "41fec3138aee904fc39d6982e6fde809243ffec55298dbfe966f4f48d89caf8a"
},
"installedAppHostAcceptance": "verification/HostTwoModes1.8.5.json",
"installScope": "本轮仅生成并验包,未再次执行系统安装;正式 APP 已有独立宿主验收。"
"installScope": "Package expanded and verified; installation scripts were not run.",
"releaseStatus": "ready-for-release"
}
+31 -20
查看文件
@@ -1,25 +1,36 @@
{
"passResult": true,
"passResult": false,
"status": "draft-download-verification-blocked",
"published": false,
"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",
"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",
"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"
}
"tag": "v1.10.0-canvas-workspace-20261104",
"releaseCommit": "c0e6f3be0afc310125d2d045a96655db7524f24b",
"releaseID": 387,
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.10.0-canvas-workspace-20261104",
"assetID": 31,
"downloadURL": "https://dayu.media/git/attachments/cb9b5516-0953-4993-99a1-360c1d92cb6d",
"bytes": 43090565,
"sha256": "ee70461c9b2d2e0ddd78cbcb3371c3b1b36b7f0e5fc69bfccc7ac0f1a3e468d8",
"draft": true,
"sourceAndTagRemotelyVerified": true,
"attachmentMetadataVerified": true,
"downloadVerified": false,
"reason": "Draft attachment HTTP download requires an authenticated browser session. CUA ended the browser session because the current browser URL is not allowed; no bypass or publication performed.",
"article": {
"id": 15792,
"url": "https://dayu.media/15792/",
"verified": true
},
"previousPublishedRelease": {
"tag": "v1.8.5-light-dark-20261104",
"releaseID": 386,
"releaseCommit": "def8c2f6386a3d34453912b9e8f96e37e192796c",
"history": "The full previous report remains in tag v1.10.0-canvas-workspace-20261104:verification/Release.json and earlier Git history."
},
"finalReadbackConfirmed": true,
"assetName": "大鱼调色-1.10.0.pkg",
"repositoryID": 52,
"repositoryVisibilityPreserved": true
}
+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,40 @@
{
"status": "accepted-app-copies-and-verification-download-cleaned-release-draft-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": true,
"release1100Published": false,
"scope": "Formal build72 and all historical packages retained. Task-created unused build70/71 recovery apps, cache app/XPC/submission ZIP, two verified independent source recovery clones at the same fixed path, website package verification download and temporary acceptance script removed. Git Release 387 remains draft because authenticated attachment download verification was blocked.",
"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
}
],
"finalRemovedGeneratedArtifacts": [
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/osc-recovery",
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/article-1.10.0-download.pkg",
"/tmp/dayu_accept_workspace.py"
],
"retainedGeneratedArtifacts": [],
"releaseDraft": {
"id": 387,
"assetID": 31,
"published": false,
"reason": "Browser download verification blocked"
},
"retainedFinalPackage": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.10.0.pkg",
"sourceAndHistoricalPackagesPreserved": true,
"sourceRecoveryCheckoutRemoved": true
}
+49
查看文件
@@ -0,0 +1,49 @@
{
"status": "compiled-source-and-release-tag-remotely-recovered",
"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.",
"tag": "v1.10.0-canvas-workspace-20261104",
"tagCommit": "c0e6f3be0afc310125d2d045a96655db7524f24b",
"tagTrackedFiles": 541,
"tagWorkingTreeClean": true,
"tagFsck": true,
"compiledSourcesIdentical": true,
"articleAndMediaHashesVerified": true,
"releaseState": "Release 387 / asset 31 uploaded as draft; authenticated draft download blocked by browser URL restrictions, not published.",
"tagRecoveryScope": "Fresh independent remote clone and tag checkout; clean tracked tree, fsck, exact Package/Article records and three publishing assets verified. All compiled-source code/dependencies unchanged from the separately syntax-checked source commit. No full dependency rebuild repeated."
}
+10
查看文件
@@ -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,
@@ -385,6 +387,8 @@
"-framework",
MetalPerformanceShaders,
"-framework",
Vision,
"-framework",
QuartzCore,
"-lcompression",
"-lz",
@@ -419,6 +423,8 @@
"-framework",
MetalPerformanceShaders,
"-framework",
Vision,
"-framework",
QuartzCore,
"-lcompression",
"-lz",
@@ -447,6 +453,8 @@
"-framework",
MetalPerformanceShaders,
"-framework",
Vision,
"-framework",
QuartzCore,
"-lcompression",
"-lz",
@@ -474,6 +482,8 @@
"-framework",
MetalPerformanceShaders,
"-framework",
Vision,
"-framework",
QuartzCore,
"-lcompression",
"-lz",
@@ -0,0 +1,61 @@
// Exercise actual OSC hit geometry, host writes and production Metal output.
{
DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,nil);
DYToolCanvasProbe *host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero;
id<DYViewerParameterProbe>bridge=(id)[[NSClassFromString(@"DYViewerParameterBridge")alloc]initWithAPIManager:host];
id<DYViewerControlsProbe>panel=(id)[NSClassFromString(@"DYViewerParameterPanel")new];panel.bridge=bridge;
auto drain=[](){double until=NSProcessInfo.processInfo.systemUptime+.06;while(NSProcessInfo.processInfo.systemUptime<until)[[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];[bridge publishAssets:DYReadAssets(host,host->_time)histogram:nil atTime:host->_time];[panel prepareWithSize:NSMakeSize(1280,720)scale:1 atTime:host->_time];};
auto area=[&](NSString *kind)->NSDictionary*{for(NSDictionary*a in [(id)panel valueForKey:@"areas"])if([a[@"kind"]isEqual:kind])return [[a copy]autorelease];return nil;};
auto drag=[&](NSPoint a,NSPoint b){[panel event:NSEventTypeLeftMouseDown point:a atTime:host->_time];[panel event:NSEventTypeLeftMouseDragged point:b atTime:host->_time];drain();[panel event:NSEventTypeLeftMouseUp point:b atTime:host->_time];drain();publish();};
[(id)panel setValue:@"hsl" forKey:@"toolType"];publish();NSRect plot=[area(@"hslPlot")[@"rect"]rectValue];int undo=base->_undoStarts;
NSPoint a=NSMakePoint(NSMinX(plot)+plot.size.width*2.5/8,NSMidY(plot)),b=NSMakePoint(a.x,NSMinY(plot)-40);drag(a,b);
DYUniforms edited;DYReadUniforms(host,kCMTimeZero,&edited);run.record(@"canvas-hsl-plot-captures-outside-and-commits-one-undo",edited.hslHueA[2]==100&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
NSMutableDictionary *doc=DYMutablePlist(DYReadTools(host,kCMTimeZero).document);NSString *layerID=DYInsertTool(doc,@"hsl",@"base:hsl")[@"id"];DYWriteTools(host,doc,kCMTimeZero);publish();[(id)panel setValue:layerID forKey:@"nodeID"];publish();plot=[area(@"hslPlot")[@"rect"]rectValue];a=NSMakePoint(NSMinX(plot)+plot.size.width*2.5/8,NSMidY(plot));b=NSMakePoint(a.x,NSMidY(plot)-plot.size.height*.25);drag(a,b);DYReadUniforms(host,kCMTimeZero,&edited);
run.record(@"canvas-hsl-independent-uuid-does-not-edit-base",edited.hslHueA[2]==100&&fabs([DYToolWithID(DYReadTools(host,kCMTimeZero).document,layerID)[@"values"][@"hsl0_2"]doubleValue]-50)<1e-5);
[(id)panel setValue:@"spider" forKey:@"toolType"];publish();plot=[area(@"spiderPlot")[@"rect"]rectValue];auto mesh=dy::neutralMesh();int selected=dy::meshIndex(mesh,0,2);a=NSMakePoint(plot.origin.x+mesh.x[selected]*plot.size.width,plot.origin.y+mesh.y[selected]*plot.size.height);b=NSMakePoint(a.x+9,a.y-6);undo=base->_undoStarts;drag(a,b);
NSData *saved=DYReadAssets(host,kCMTimeZero).spiderMesh;auto changed=DYSpiderMesh(saved);run.record(@"canvas-spider-drags-real-mesh-and-closes-one-undo",saved.length&&fabs(changed.x[selected]-mesh.x[selected])>.001&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
doc=DYMutablePlist(DYReadTools(host,kCMTimeZero).document);NSString *spiderID=DYInsertTool(doc,@"spider",@"base:spider")[@"id"];DYWriteTools(host,doc,kCMTimeZero);publish();[(id)panel setValue:spiderID forKey:@"nodeID"];publish();plot=[area(@"spiderPlot")[@"rect"]rectValue];a=NSMakePoint(plot.origin.x+mesh.x[selected]*plot.size.width,plot.origin.y+mesh.y[selected]*plot.size.height);b=NSMakePoint(a.x-8,a.y+5);drag(a,b);
run.record(@"canvas-spider-uuid-persists-mesh-without-touching-base",[saved isEqual:DYReadAssets(host,kCMTimeZero).spiderMesh]&&[DYToolWithID(DYReadTools(host,kCMTimeZero).document,spiderID)[@"spider"]length]>0);
NSData *current=DYToolWithID(DYReadTools(host,kCMTimeZero).document,spiderID)[@"spider"];[bridge beginSpider:current node:spiderID enabled:1 atTime:kCMTimeZero];drain();doc=DYMutablePlist(DYReadTools(host,kCMTimeZero).document);auto external=dy::neutralMesh(12,12);NSData *externalData=[NSData dataWithBytes:&external length:sizeof(external)];((NSMutableDictionary*)DYToolWithID(doc,spiderID))[@"spider"]=externalData;DYWriteTools(host,doc,kCMTimeZero);[bridge changeSpider:current];[bridge endGesture];drain();
run.record(@"canvas-spider-external-topology-change-wins",[DYToolWithID(DYReadTools(host,kCMTimeZero).document,spiderID)[@"spider"]isEqual:externalData]);
DYHistogram hist{};hist.samples=1;hist.bins[1][100]=1;NSData *histData=[NSData dataWithBytes:&hist length:sizeof(hist)];[bridge publishHistogram:histData atTime:kCMTimeZero];run.record(@"canvas-histogram-is-frozen-to-matching-frame",[[bridge snapshotAtTime:kCMTimeZero][@"histogram"]isEqual:histData]&&![bridge snapshotAtTime:CMTimeMake(1,24)]);
[panel finishCapture];panel.bridge=nil;[bridge invalidate];drain();[(id)panel release];[(id)bridge release];
}
{
const NSUInteger w=64,h=48;DYDiagnosticTile *src=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease],*dst=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease];Pixels grid(w*h*4);
for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w;x++){NSUInteger i=(y*w+x)*4;grid[i]=x/double(w-1)*.5;grid[i+1]=y/double(h-1)*.5;grid[i+2]=.1;grid[i+3]=1;}
[[src metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,w,h)mipmapLevel:0 withBytes:grid.data()bytesPerRow:w*8];DYRenderer *lens=[[[DYRenderer alloc]init]autorelease];DYUniforms u=DYToolUniforms(@{@"type":@"lens"});
Pixels identity=render(run,lens,src,dst,gpu,u,@{},@"lens-neutral-production-render");run.record(@"lens-neutral-is-identity-with-existing-prefix",difference(identity,grid).maximum<.002&&offsetof(DYUniforms,lensSectionEnabled)==1312);
u.lensStrength=80;Pixels positive=render(run,lens,src,dst,gpu,u,@{},@"lens-positive-production-render");u.lensStrength=-80;Pixels negative=render(run,lens,src,dst,gpu,u,@{},@"lens-negative-production-render");NSUInteger sample=(h/2*w+w*3/4)*4;
run.record(@"lens-directions-move-source-in-opposite-directions",positive[sample]>identity[sample]&&negative[sample]<identity[sample]&&difference(positive,negative).maximum>.01);
BOOL finite=YES,alpha=YES;for(NSUInteger i=0;i<w*h;i++){for(int c=0;c<4;c++)finite&=std::isfinite((float)positive[i*4+c])&&std::isfinite((float)negative[i*4+c]);alpha&=positive[i*4+3]>=0&&positive[i*4+3]<=1;}
run.record(@"lens-keeps-finite-premultiplied-border-alpha",finite&&alpha&&positive[3]<1);
double worst=0;for(NSUInteger y=4;y<h-4;y+=5)for(NSUInteger x=4;x<w-4;x+=7){double aspect=w/double(h),qx=(x+.5)/w-.5,qy=(y+.5)/h-.5,r2=(qx*qx*aspect*aspect+qy*qy)/(.25*(aspect*aspect+1)),sx=.5+qx*(1-.2*r2),sy=.5+qy*(1-.2*r2);double expectedX=(sx*w-.5)/(w-1)*.5,expectedY=(sy*h-.5)/(h-1)*.5;worst=MAX(worst,fabs((float)negative[(y*w+x)*4]-expectedX));worst=MAX(worst,fabs((float)negative[(y*w+x)*4+1]-expectedY));}
run.record(@"lens-gpu-matches-independent-inverse-radial-oracle",worst<.003,@{@"maximumError":@(worst)});
NSURL *cube=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"unsupported-lens.cube"]];NSError *failure=nil;run.record(@"lens-spatial-correction-is-refused-by-cube-export",![lens exportLUT:cube uniforms:u paths:@{}spider:nil tools:[[[DYToolDocument alloc]init]autorelease].document error:&failure]&&failure);
}
NSString *faceFixture=NSProcessInfo.processInfo.environment[@"DY_DIAGNOSTIC_FACE_FIXTURE"];
if(faceFixture.length){
NSBitmapImageRep *bitmap=[NSBitmapImageRep imageRepWithContentsOfFile:faceFixture];run.need(@"face-real-portrait-fixture-loaded",bitmap.pixelsWide==512&&bitmap.pixelsHigh==512);
const NSUInteger w=512,h=512;DYDiagnosticTile *src=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease],*dst=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease];Pixels portrait(w*h*4);
auto linear=[](double c){return c<=.04045?c/12.92:pow((c+.055)/1.055,2.4);};
for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w;x++){NSColor *c=[[bitmap colorAtX:x y:y]colorUsingColorSpace:NSColorSpace.sRGBColorSpace];NSUInteger i=(y*w+x)*4;portrait[i]=linear(c.redComponent);portrait[i+1]=linear(c.greenComponent);portrait[i+2]=linear(c.blueComponent);portrait[i+3]=1;}
// Same hue as a cheek, deliberately outside the face, must remain unprotected.
for(NSUInteger y=400;y<480;y++)for(NSUInteger x=400;x<480;x++)for(int c=0;c<3;c++)portrait[(y*w+x)*4+c]=portrait[(115*w+220)*4+c];
auto upload=[&](const Pixels& pixels){[[src metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,w,h)mipmapLevel:0 withBytes:pixels.data()bytesPerRow:w*8];};upload(portrait);
DYRenderer *face=[[[DYRenderer alloc]init]autorelease];DYUniforms u=DYToolUniforms(@{@"type":@"hsl"});u.hslHueA=(DYFloat4){40,40,40,40};u.hslHueB=(DYFloat4){40,40,40,40};u.skinProtection=(DYFloat3){1,100,28};u.skinFaceOnly=1;
Pixels protectedFrame=render(run,face,src,dst,gpu,u,@{},@"face-protected-production-render");NSData *entries=[face valueForKey:@"faceEntries"];NSInteger faces=0;const DYToolMaskEntry *values=(const DYToolMaskEntry*)entries.bytes;for(NSUInteger i=0;i<entries.length/sizeof(*values);i++)faces+=values[i].section==-100;
double faceX=0,faceY=0;for(NSUInteger i=0;i<entries.length/sizeof(*values);i++)if(values[i].section==-100){faceX=values[i].mask.parameters.centerX;faceY=values[i].mask.parameters.centerY;break;}run.record(@"face-vision-finds-real-portrait-and-builds-support",faces>=1,@{@"faces":@(faces),@"centerX":@(faceX),@"centerY":@(faceY)});u.skinProtection.x=0;Pixels unprotected=render(run,face,src,dst,gpu,u,@{},@"face-unprotected-reference-render");double inside=0,outside=0;
for(NSUInteger y=65;y<185;y++)for(NSUInteger x=175;x<275;x++)for(int c=0;c<3;c++)inside=MAX(inside,fabs((float)protectedFrame[(y*w+x)*4+c]-(float)unprotected[(y*w+x)*4+c]));for(NSUInteger y=410;y<470;y++)for(NSUInteger x=410;x<470;x++)for(int c=0;c<3;c++)outside=MAX(outside,fabs((float)protectedFrame[(y*w+x)*4+c]-(float)unprotected[(y*w+x)*4+c]));
run.record(@"face-protects-face-color-without-same-hue-background",inside>.005&&outside<.002,@{@"faceDifference":@(inside),@"backgroundDifference":@(outside)});
u.skinProtection.x=1;u.skinVisualize=1;Pixels selection=render(run,face,src,dst,gpu,u,@{},@"face-actual-selection-preview-render");double white=0,black=0;for(NSUInteger y=65;y<185;y++)for(NSUInteger x=175;x<275;x++)white=MAX(white,(float)selection[(y*w+x)*4]);for(NSUInteger y=410;y<470;y++)for(NSUInteger x=410;x<470;x++)black=MAX(black,(float)selection[(y*w+x)*4]);
double maximum=0;NSUInteger maxX=0,maxY=0;for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w;x++)if(selection[(y*w+x)*4]>maximum){maximum=selection[(y*w+x)*4];maxX=x;maxY=y;}
run.record(@"face-preview-shows-actual-weight-and-excludes-background",white>.01&&black<.001,@{@"faceWeight":@(white),@"backgroundWeight":@(black),@"maximum":@(maximum),@"maxX":@(maxX),@"maxY":@(maxY)});
// Both FxPlug row conventions must resolve the same visual face.
Pixels flipped(portrait.size());for(NSUInteger y=0;y<h;y++)memcpy(flipped.data()+y*w*4,portrait.data()+(h-1-y)*w*4,w*8);upload(flipped);[src setDiagnosticImageOrigin:kFxImageOrigin_BOTTOM_LEFT];[dst setDiagnosticImageOrigin:kFxImageOrigin_BOTTOM_LEFT];u.skinVisualize=0;Pixels bottom=render(run,face,src,dst,gpu,u,@{},@"face-bottom-origin-production-render");double flipError=0;for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w*4;x++)flipError=MAX(flipError,fabs((float)bottom[(h-1-y)*w*4+x]-(float)protectedFrame[y*w*4+x]));run.record(@"face-top-and-bottom-origins-protect-identical-visual-region",flipError<.003,@{@"maximumError":@(flipError)});[src setDiagnosticImageOrigin:kFxImageOrigin_TOP_LEFT];[dst setDiagnosticImageOrigin:kFxImageOrigin_TOP_LEFT];upload(portrait);
NSMutableDictionary *masked=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document);NSMutableDictionary *zero=DYMutablePlist(DYNewMask(DYMaskRectangle));DYMaskParameters zeroP=DYMaskAtTime(zero,kCMTimeZero);zeroP.strength=0;zero[@"parameters"]=[NSData dataWithBytes:&zeroP length:sizeof(zeroP)];masked[@"baseMasks"][@"skin"]=[NSMutableArray arrayWithObject:zero];u.skinVisualize=1;NSError *maskError=nil;BOOL maskOK=[face renderSource:src destination:dst uniforms:u paths:@{}spider:nil tools:masked error:&maskError];Pixels empty=read(dst,gpu);double emptyMax=0;for(NSUInteger i=0;i<w*h;i++)emptyMax=MAX(emptyMax,(float)empty[i*4]);run.record(@"face-preview-respects-authored-zero-strength-mask",maskOK&&emptyMax<.001);
u.skinVisualize=0;u.skinProtection.x=0;NSMutableDictionary *layers=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document);NSMutableDictionary *skin=(id)DYInsertTool(layers,@"skin",@"base:skin");skin[@"values"][@"skinStrength"]=@100;skin[@"values"][@"skinVisualize"]=@1;BOOL layerOK=[face renderSource:src destination:dst uniforms:u paths:@{}spider:nil tools:layers error:&maskError];Pixels layerMask=read(dst,gpu);double layerFace=0,layerBackground=0;for(NSUInteger y=65;y<185;y++)for(NSUInteger x=175;x<275;x++)layerFace=MAX(layerFace,(float)layerMask[(y*w+x)*4]);for(NSUInteger y=410;y<470;y++)for(NSUInteger x=410;x<470;x++)layerBackground=MAX(layerBackground,(float)layerMask[(y*w+x)*4]);run.record(@"face-independent-layer-uses-own-preview-and-face-mask",layerOK&&layerFace>.01&&layerBackground<.001);
DYDiagnosticTile *twoSource=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:1024 height:512]autorelease],*twoDest=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:1024 height:512]autorelease];Pixels two(1024*512*4);for(NSUInteger y=0;y<512;y++)for(NSUInteger x=0;x<1024;x++)memcpy(two.data()+(y*1024+x)*4,portrait.data()+(y*512+x%512)*4,8);[[twoSource metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,1024,512)mipmapLevel:0 withBytes:two.data()bytesPerRow:1024*8];u.skinProtection.x=1;BOOL twoOK=[face renderSource:twoSource destination:twoDest uniforms:u paths:@{}error:&maskError];NSData *twoEntries=[face valueForKey:@"faceEntries"];const DYToolMaskEntry *twoMasks=(const DYToolMaskEntry*)twoEntries.bytes;NSInteger faceCount=0;for(NSUInteger i=0;i<twoEntries.length/sizeof(*twoMasks);i++)faceCount+=twoMasks[i].section==-100;run.record(@"face-multiple-people-build-independent-support-regions",twoOK&&faceCount==2,@{@"faces":@(faceCount)});
Pixels noFace(w*h*4);for(NSUInteger i=0;i<w*h;i++){noFace[i*4]=.35;noFace[i*4+1]=.18;noFace[i*4+2]=.1;noFace[i*4+3]=1;}upload(noFace);u.skinVisualize=0;Pixels noFaceProtected=render(run,face,src,dst,gpu,u,@{},@"face-none-protected-render");u.skinProtection.x=0;Pixels noFacePlain=render(run,face,src,dst,gpu,u,@{},@"face-none-unprotected-reference");run.record(@"face-no-detection-clears-prior-frame-and-fails-closed",difference(noFaceProtected,noFacePlain).maximum<.002);
}
+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
+14 -3
查看文件
@@ -12,6 +12,7 @@
#import "DYInspector.h"
#import "DYTheme.h"
#include "DYSpiderState.h"
#include "DYToolGPU.h"
#include <string>
#import <CoreVideo/CoreVideo.h>
#import <IOSurface/IOSurface.h>
@@ -21,6 +22,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 +93,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;
@@ -137,6 +142,7 @@ struct Run {
bool passed=true;
void record(NSString *name,bool ok,NSDictionary *details=nil) {
NSMutableDictionary *row=[NSMutableDictionary dictionaryWithDictionary:details?:@{}];
if(getenv("DAYU_DIAGNOSTICS_PROGRESS"))fprintf(stderr,"%s %s\n",ok?"PASS":"FAIL",name.UTF8String);
row[@"name"]=name;row[@"pass"]=@(ok);[rows addObject:row];if(!ok)passed=false;
}
void need(NSString *name,bool ok,NSDictionary *details=nil) {
@@ -245,8 +251,8 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
DYDiagnosticManager *uiHost=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(uiHost,nil);
DYInspector *inspector=[[[DYInspector alloc]initWithAPIManager:uiHost]autorelease];[inspector refresh];
NSArray *cards=[inspector valueForKey:@"cards"];BOOL initialUI=YES;
for(NSDictionary *card in cards)initialUI&=([card[@"collapsed"]boolValue]!=[@[@"primary",@"spider",@"base"]containsObject:card[@"section"][@"key"]])&&[(NSButton*)card[@"enabled"]state]==NSControlStateValueOn;
run.record(@"default-primary-spider-base-expanded-all-eyes-on",initialUI,@{@"modules":@(cards.count)});
for(NSDictionary *card in cards){BOOL expected=[@[@"primary",@"spider",@"base",@"hsl"]containsObject:card[@"section"][@"key"]];initialUI&=[card[@"collapsed"]boolValue]&&[card[@"removed"]boolValue]!=expected;}
run.record(@"default-only-primary-spider-base-hsl-visible-and-collapsed",initialUI,@{@"modules":@(cards.count)});
DYUniforms uiBefore,uiAfter;DYReadUniforms(uiHost,kCMTimeZero,&uiBefore);BOOL foldingIndependent=YES;
for(NSDictionary *card in cards){NSButton *header=card[@"header"];BOOL was=[card[@"collapsed"]boolValue];[header performClick:nil];[inspector refresh];DYReadUniforms(uiHost,kCMTimeZero,&uiAfter);foldingIndependent&=[card[@"collapsed"]boolValue]!=was&&memcmp(&uiBefore,&uiAfter,sizeof(uiBefore))==0;[header performClick:nil];[inspector refresh];}
run.record(@"all-disclosure-actions-preserve-every-render-parameter",foldingIndependent);
@@ -268,7 +274,7 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
NSWindow *interactionWindow=[[[NSWindow alloc]initWithContentRect:NSMakeRect(0,0,400,780) styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO]autorelease];interactionWindow.contentView=inspector;[inspector layoutSubtreeIfNeeded];
NSArray *graphics=[inspector valueForKey:@"graphics"];NSView *wheel=nil;for(NSView *graphic in graphics)if([NSStringFromClass(graphic.class)isEqual:@"DYPrimaryBalanceWheel"])wheel=graphic;
run.need(@"primary-balance-wheel-restored-and-palette-loaded",wheel&&[wheel valueForKey:@"wheel"]!=nil);
BOOL merged=cards.count==14&&[cards[0][@"section"][@"key"]isEqual:@"primary"]&&[cards[1][@"section"][@"key"]isEqual:@"spider"];for(NSDictionary *card in cards)merged&=![@[@"input",@"output"]containsObject:card[@"section"][@"key"]];
BOOL merged=cards.count==DYToolTypes().count&&[cards[0][@"section"][@"key"]isEqual:@"primary"]&&[cards[1][@"section"][@"key"]isEqual:@"spider"];for(NSDictionary *card in cards)merged&=![@[@"input",@"output"]containsObject:card[@"section"][@"key"]];
NSDictionary *controls=[inspector valueForKey:@"controls"];for(NSDictionary *record in controls.allValues)merged&=![[record[@"descriptor"]objectForKey:@"key"]hasPrefix:@"cmbypass"];
run.record(@"single-primary-card-no-bypass-checkboxes",merged);
auto mouseFor=[&](NSView *view,NSEventType type,NSPoint point,NSEventModifierFlags flags=0,NSInteger clicks=1){return [NSEvent mouseEventWithType:type location:[view convertPoint:point toView:nil] modifierFlags:flags timestamp:0 windowNumber:interactionWindow.windowNumber context:nil eventNumber:0 clickCount:clicks pressure:type==NSEventTypeLeftMouseUp?0:1];};
@@ -301,6 +307,7 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
[disc resetMesh];NSData *beforeCancel=[[disc.meshData copy]autorelease];NSPoint anchor=[disc point:2];[disc mouseDown:mouseFor(disc,NSEventTypeLeftMouseDown,anchor)];[disc mouseDragged:mouseFor(disc,NSEventTypeLeftMouseDragged,NSMakePoint(anchor.x+10,anchor.y+5))];[disc keyDown:[NSEvent keyEventWithType:NSEventTypeKeyDown location:NSZeroPoint modifierFlags:0 timestamp:0 windowNumber:interactionWindow.windowNumber context:nil characters:@"\x1b" charactersIgnoringModifiers:@"\x1b" isARepeat:NO keyCode:53]];run.record(@"spider-escape-restores-coordinates-and-pins",[beforeCancel isEqual:disc.meshData]);
run.record(@"native-interaction-window-never-visible",!interactionWindow.visible);[inspector resetAll:nil];[inspector refresh];
id<MTLDevice> gpu=MTLCreateSystemDefaultDevice();run.need(@"metal-device",gpu!=nil);gpuName=gpu.name;
defaults.skinFaceOnly=0; // legacy point-color and Cube reference suite
const NSUInteger width=64,height=48;DYDiagnosticTile *source=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:width height:height]autorelease],*destination=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:width height:height]autorelease];
run.need(@"real-iosurface-image-tiles",source&&destination&&source.ioSurface&&destination.ioSurface);
Pixels input(width*height*4);for(NSUInteger y=0;y<height;y++)for(NSUInteger x=0;x<width;x++){size_t p=(y*width+x)*4;float alpha=float((x+y)%5)/4.f;input[p]=(__fp16)((.08f+.75f*float(x)/(width-1))*alpha);input[p+1]=(__fp16)((.05f+.8f*float(y)/(height-1))*alpha);input[p+2]=(__fp16)((.1f+.65f*float((x*7+y*3)%64)/63.f)*alpha);input[p+3]=(__fp16)alpha;}
@@ -494,6 +501,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 +512,9 @@ 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"
#include "DYCanvasToolsDiagnostics.inc.h"
[gpu release];
} @catch(NSException *exception) {
run.record(@"diagnostic-exception",false,@{@"exception":exception.name?:@"unknown",@"message":exception.reason?:@"unknown"});
+43
查看文件
@@ -0,0 +1,43 @@
// Authored adaptation of Vision face support in FCP-BeautyGirl (MIT).
// Geometry is rebuilt from this input frame; no previous-shot mask is reused.
- (void)prepareFaceSupport:(FxImageTile*)source {
[_faceEntries release];_faceEntries=nil;std::vector<DYToolMaskEntry> entries;
FxRect image=source.imagePixelBounds,tile=source.tilePixelBounds;
if(image.left!=tile.left||image.right!=tile.right||image.top!=tile.top||image.bottom!=tile.bottom){[_faceEntries release];_faceEntries=nil;[_faceInput release];_faceInput=nil;return;}
NSMutableDictionary *device=[self device:source.deviceRegistryID error:nil];id<MTLTexture>texture=[source metalTextureForDevice:device[@"device"]];if(!texture)return;
if(!_faceContext)_faceContext=[[CIContext contextWithMTLDevice:device[@"device"] options:@{kCIContextCacheIntermediates:@NO}]retain];
CGColorSpaceRef linear=CGColorSpaceCreateWithName(kCGColorSpaceLinearSRGB);
CIImage *input=[CIImage imageWithMTLTexture:texture options:@{kCIImageColorSpace:(id)linear}];CGColorSpaceRelease(linear);if(!input)return;
// CIImage's MTLTexture coordinates are bottom-up; normalize FxPlug top-first rows.
if(source.imageOrigin==kFxImageOrigin_TOP_LEFT)input=[input imageByApplyingTransform:CGAffineTransformMake(1,0,0,-1,0,input.extent.size.height)];
CGFloat scale=MIN(1.,960./MAX(input.extent.size.width,input.extent.size.height));input=[input imageByApplyingTransform:CGAffineTransformMakeScale(scale,scale)];
CGColorSpaceRef srgb=CGColorSpaceCreateWithName(kCGColorSpaceSRGB);CGImageRef cg=[_faceContext createCGImage:input fromRect:input.extent format:kCIFormatRGBA8 colorSpace:srgb];CGColorSpaceRelease(srgb);if(!cg)return;
CFDataRef raster=CGDataProviderCopyData(CGImageGetDataProvider(cg));BOOL same=raster&&[_faceInput isEqual:(NSData*)raster];if(same){_faceEntries=[_faceCachedEntries retain];CFRelease(raster);CGImageRelease(cg);return;}[_faceInput release];_faceInput=raster?[(NSData*)raster copy]:nil;if(raster)CFRelease(raster);[_faceEntries release];_faceEntries=nil;
VNDetectFaceLandmarksRequest *request=[VNDetectFaceLandmarksRequest new];request.revision=VNDetectFaceLandmarksRequestRevision3;request.constellation=VNRequestFaceLandmarksConstellation76Points;
VNImageRequestHandler *handler=[[VNImageRequestHandler alloc]initWithCGImage:cg orientation:kCGImagePropertyOrientationUp options:@{}];CGImageRelease(cg);
if([handler performRequests:@[request] error:nil])for(VNFaceObservation *face in request.results){
if(entries.size()>64||face.confidence<.5||!face.landmarks.faceContour.pointCount)continue;CGRect box=face.boundingBox;if(box.size.width<.015||box.size.height<.015)continue;
DYToolMaskEntry support{};support.section=-100;support.mask.parameters=dyDefaultMaskParameters();auto &p=support.mask.parameters;p.kind=DYMaskBezier;p.centerX=CGRectGetMidX(box);p.centerY=1-CGRectGetMidY(box);p.width=box.size.width;p.height=box.size.height;p.feather=.1;
auto &path=support.mask.path;VNFaceLandmarkRegion2D *contour=face.landmarks.faceContour;
for(NSUInteger i=0;i<contour.pointCount;i++){CGPoint q=contour.normalizedPoints[i];path.x[path.count]=q.x-.5;path.y[path.count]=.5-q.y;path.count++;}
// Close the jaw along a soft forehead cap, instead of selecting the whole box.
BOOL forward=path.x[path.count-1]>path.x[0];for(int i=0;i<=12;i++){float t=i/12.f,x=forward?1-t:t;path.x[path.count]=x-.5;path.y[path.count]=-.28-.28*sinf(t*M_PI);path.count++;}entries.push_back(support);
for(VNFaceLandmarkRegion2D *region in @[face.landmarks.leftEye?:[NSNull null],face.landmarks.rightEye?:[NSNull null],face.landmarks.outerLips?:[NSNull null],face.landmarks.leftEyebrow?:[NSNull null],face.landmarks.rightEyebrow?:[NSNull null]]){
if(![region isKindOfClass:VNFaceLandmarkRegion2D.class]||!region.pointCount)continue;CGFloat loX=1,loY=1,hiX=0,hiY=0;for(NSUInteger i=0;i<region.pointCount;i++){CGPoint q=region.normalizedPoints[i];loX=MIN(loX,q.x);hiX=MAX(hiX,q.x);loY=MIN(loY,q.y);hiY=MAX(hiY,q.y);}
DYToolMaskEntry hole{};hole.section=-101;hole.mask.parameters=dyDefaultMaskParameters();auto &h=hole.mask.parameters;h.kind=DYMaskEllipse;h.centerX=box.origin.x+(loX+hiX)*.5*box.size.width;h.centerY=1-(box.origin.y+(loY+hiY)*.5*box.size.height);h.width=(hiX-loX)*box.size.width*1.2;h.height=MAX(.035,hiY-loY)*box.size.height*1.6;h.feather=.35;entries.push_back(hole);
}
}
[handler release];[request release];_faceEntries=[[NSData alloc]initWithBytes:entries.data() length:entries.size()*sizeof(DYToolMaskEntry)];[_faceCachedEntries release];_faceCachedEntries=[_faceEntries copy];
}
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){
DYUniforms effective=u;bypassNeutralTools(&effective);bypassIdleSkin(&effective);BOOL face=effective.skinProtection.x>.5&&(u.skinFaceOnly>.5||u.skinVisualize>.5);for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);face|=[node[@"type"]isEqual:@"skin"]&&layer.skinProtection.x>.5&&layer.skinFaceOnly>.5;}
if(face&&!_exporting)[self prepareFaceSupport:src];else{[_faceEntries release];_faceEntries=nil;}
BOOL ok=[self renderToolsSource:src destination:dst uniforms:u paths:paths spider:spider tools:tools error:error];
return ok;
}}
- (BOOL)renderLens:(FxImageTile*)source destination:(FxImageTile*)destination uniforms:(DYUniforms)u masks:(NSArray*)masks entry:(NSDictionary*)entry error:(NSError**)error {
if(source.imageOrigin==kFxImageOrigin_BOTTOM_LEFT)u.lensCenterY=1-u.lensCenterY;
id<MTLDevice>d=entry[@"device"];id<MTLTexture>before=[source metalTextureForDevice:d],output=[destination metalTextureForDevice:d];
id<MTLCommandBuffer>cb=[entry[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>ce=[cb computeCommandEncoder];[ce setComputePipelineState:entry[@"dyLensRepair"]];[ce setTexture:before atIndex:0];[ce setTexture:output atIndex:1];[ce setBytes:&u length:sizeof(u) atIndex:0];float aspect=before.width*source.pixelAspect/MAX(1.,(double)before.height);[ce setBytes:&aspect length:sizeof(aspect) atIndex:1];[ce dispatchThreads:MTLSizeMake(output.width,output.height,1)threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];[cb commit];[cb waitUntilCompleted];if(cb.status!=MTLCommandBufferStatusCompleted)return fail(error,cb.error.localizedDescription);
if(!masks.count)return YES;MTLTextureDescriptor *desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:output.pixelFormat width:output.width height:output.height mipmapped:NO];desc.storageMode=MTLStorageModePrivate;desc.usage=MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite|MTLTextureUsageRenderTarget;id<MTLTexture>blend=[d newTextureWithDescriptor:desc];if(!blend)return fail(error,@"无法分配修复蒙版");DYToolMaskHeader h{};h.section=(int)[DYToolTypes()indexOfObject:@"lens"];id<MTLBuffer>buffer=[self maskBuffer:@{@"lens":masks}tile:source device:d header:&h];cb=[entry[@"queue"]commandBuffer];[self encodeBlend:before after:output output:blend masks:buffer header:h entry:entry commands:cb];[cb commit];[cb waitUntilCompleted];DYExportTile *tile=[[DYExportTile alloc]initWithTexture:blend registry:d.registryID];[tile setBounds:destination.tilePixelBounds origin:destination.imageOrigin];[tile setPixelAspect:destination.pixelAspect];BOOL ok=cb.status==MTLCommandBufferStatusCompleted&&[self copyTile:tile to:destination entry:entry error:error];[tile release];[blend release];return ok;
}
+1 -1
查看文件
@@ -4,7 +4,7 @@
auto filmRender=[&](DYUniforms value,NSDictionary *tools,NSString *name){NSError *failure=nil;BOOL ok=[renderer renderSource:source destination:destination uniforms:value paths:@{} spider:nil tools:tools?:empty.document error:&failure];run.need(name,ok,@{@"error":reason(failure)});return read(destination,gpu);};
uploadFilm(input);DYUniforms neutral=DYToolUniforms(@{@"type":@"mixer"});neutral.mixerSectionEnabled=1;
Pixels before=filmRender(neutral,nil,@"film-neutral-production-render");
run.record(@"new-tools-default-to-neutral",!DYChannelMixerActive(neutral)&&!DYFilmActive(defaults.film)&&DYToolTypes().count==14&&DYToolIsNeutral(DYNewTool(@"film"))&&DYToolIsNeutral(DYNewTool(@"mixer")));
run.record(@"new-tools-default-to-neutral",!DYChannelMixerActive(neutral)&&!DYFilmActive(defaults.film)&&DYToolTypes().count==15&&DYToolIsNeutral(DYNewTool(@"lens"))&&DYToolIsNeutral(DYNewTool(@"film"))&&DYToolIsNeutral(DYNewTool(@"mixer")));
BOOL alpha=YES;for(size_t i=0;i<before.size()/4;i++)alpha&=before[i*4+3]==input[i*4+3];run.record(@"new-neutral-tools-preserve-existing-alpha",alpha);
DYUniforms matrix=neutral;matrix.mixerRed=(DYFloat4){.8,.25,-.05,0};matrix.mixerBlue=(DYFloat4){.1,0,.9,0};
Pixels mixed=filmRender(matrix,nil,@"channel-mixer-production-render");auto delta=difference(before,mixed);run.record(@"channel-mixer-affects-real-frame",delta.different>50&&delta.nonfinite==0,measure(delta));
+30 -11
查看文件
@@ -17,13 +17,13 @@ extern "C" half4 dy_gradeMasked(half4 sample, float2 uv, texture2d<half> source,
texture3d<float> look3, texture3d<float> look4, texture3d<float> look5,
texture3d<float> hslMixer, texture3d<float> whiteBalance,
texture3d<float> colorGrading, constant DYUniforms& uniforms,
constant float& sceneLevel,float w0,float w1,float w2,float w3,float w4,float w5,float w6,float w7,float w8,float w9,float w10,float w11);
constant float& sceneLevel,float w0,float w1,float w2,float w3,float w4,float w5,float w6,float w7,float w8,float w9,float w10,float w11,float skinVisualize);
extern "C" half4 dy_gradeSegment(half4 sample, float2 uv, texture2d<half> source,
texture3d<float> preLUT, texture3d<float> look1, texture3d<float> look2,
texture3d<float> look3, texture3d<float> look4, texture3d<float> look5,
texture3d<float> hslMixer, texture3d<float> whiteBalance,
texture3d<float> colorGrading, constant DYUniforms& uniforms,
constant float& sceneLevel,float w0,float w1,float w2,float w3,float w4,float w5,float w6,float w7,float w8,float w9,float w10,float w11,uint stageFirst,uint stageLast,float3 skinReference,float3 originalReference);
constant float& sceneLevel,float w0,float w1,float w2,float w3,float w4,float w5,float w6,float w7,float w8,float w9,float w10,float w11,float skinVisualize,uint stageFirst,uint stageLast,float3 skinReference,float3 originalReference);
struct DYRaster {
float4 position [[position]];
@@ -65,7 +65,7 @@ fragment half4 dyFragment(DYRaster in [[stage_in]],
half4 color=dy_grade(sample,in.uv,source,preLUT,look1,look2,look3,look4,look5,hslMixer,whiteBalance,colorGrading,colorUniforms,sceneLevel);
result.rgb=mix(color.rgb,result.rgb,half(options.blackWhiteMix));
}
if(spiderSize.x>0 && uniforms.spiderSectionEnabled>.5f && uniforms.spiderMix>0.0f){
if(uniforms.skinVisualize<.5f && spiderSize.x>0 && uniforms.spiderSectionEnabled>.5f && uniforms.spiderMix>0.0f){
float3 color=float3(result.rgb);float3 warped=dyVariableSpider(color,spiderSize.x,spiderSize.y,spiderSamples);
result.rgb=half3(dyLimit(mix(color,warped,uniforms.spiderMix)));
}
@@ -145,7 +145,7 @@ inline float dyToolCoverage(float2 uv,float3 source,device const DYToolMaskEntry
float a=dyToolMask(x,y,source,masks[i].mask);
if(!found){coverage=masks[i].combine==1?1-a:a;found=true;}
else if(masks[i].combine==1)coverage*=1-a;else if(masks[i].combine==2)coverage*=a;else coverage=1-(1-coverage)*(1-a);
}return clamp(coverage,0.f,1.f);
}if(section==3&&h.faceOnly){float face=0;for(uint i=0;i<h.count;i++)if(masks[i].section==-100)face=1-(1-face)*(1-dyToolMask(x,y,source,masks[i].mask));for(uint i=0;i<h.count;i++)if(masks[i].section==-101)face*=1-dyToolMask(x,y,source,masks[i].mask);coverage*=face;}return clamp(coverage,0.f,1.f);
}
fragment half4 dyMaskedFragment(DYRaster in [[stage_in]],
@@ -173,12 +173,12 @@ fragment half4 dyMaskedFragment(DYRaster in [[stage_in]],
float weights[12];float3 encoded=dyToolEncode(float3(sample.rgb));
for(int i=0;i<12;i++)weights[i]=dyToolCoverage(in.uv,encoded,masks,maskHeader,i);
half4 result = dy_gradeMasked(sample, in.uv, source, preLUT, look1, look2, look3,
look4, look5, hslMixer, whiteBalance, colorGrading, uniforms, sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11]);
look4, look5, hslMixer, whiteBalance, colorGrading, uniforms, sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],(uniforms.skinProtection.x>.5?uniforms.skinVisualize:0));
if(options.blackWhiteMix>0.0f && options.blackWhiteMix<1.0f) {
half4 color=dy_gradeMasked(sample,in.uv,source,preLUT,look1,look2,look3,look4,look5,hslMixer,whiteBalance,colorGrading,colorUniforms,sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11]);
half4 color=dy_gradeMasked(sample,in.uv,source,preLUT,look1,look2,look3,look4,look5,hslMixer,whiteBalance,colorGrading,colorUniforms,sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],(uniforms.skinProtection.x>.5?uniforms.skinVisualize:0));
result.rgb=mix(color.rgb,result.rgb,half(options.blackWhiteMix));
}
if(spiderSize.x>0 && uniforms.spiderSectionEnabled>.5f && uniforms.spiderMix>0.0f){
if(uniforms.skinVisualize<.5f && spiderSize.x>0 && uniforms.spiderSectionEnabled>.5f && uniforms.spiderMix>0.0f){
float3 color=float3(result.rgb);float3 warped=dyVariableSpider(color,spiderSize.x,spiderSize.y,spiderSamples);
result.rgb=half3(dyLimit(mix(color,warped,uniforms.spiderMix*weights[1])));
}
@@ -219,9 +219,9 @@ fragment half4 dySegmentFragment(DYRaster in [[stage_in]],
half4 reference=skinReference.sample(sampleFilter,in.uv);
float3 skinEncoded=dyToolEncode(reference.a>half(0)?float3(reference.rgb/reference.a):float3(0));
half4 result = dy_gradeSegment(sample, in.uv, nativeSource, preLUT, look1, look2, look3,
look4, look5, hslMixer, whiteBalance, colorGrading, uniforms, sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],uint(stages.first),uint(stages.last),skinEncoded,encoded);
look4, look5, hslMixer, whiteBalance, colorGrading, uniforms, sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],(uniforms.skinProtection.x>.5?uniforms.skinVisualize:0),uint(stages.first),uint(stages.last),skinEncoded,encoded);
if(stages.first<=9 && stages.last>=9 && options.blackWhiteMix>0.0f && options.blackWhiteMix<1.0f) {
half4 color=dy_gradeSegment(sample,in.uv,nativeSource,preLUT,look1,look2,look3,look4,look5,hslMixer,whiteBalance,colorGrading,colorUniforms,sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],uint(stages.first),uint(stages.last),skinEncoded,encoded);
half4 color=dy_gradeSegment(sample,in.uv,nativeSource,preLUT,look1,look2,look3,look4,look5,hslMixer,whiteBalance,colorGrading,colorUniforms,sceneLevel,weights[0],weights[1],weights[2],weights[3],weights[4],weights[5],weights[6],weights[7],weights[8],weights[9],weights[10],weights[11],(uniforms.skinProtection.x>.5?uniforms.skinVisualize:0),uint(stages.first),uint(stages.last),skinEncoded,encoded);
result.rgb=mix(color.rgb,result.rgb,half(options.blackWhiteMix));
}
result.a = sample.a;
@@ -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)]],
@@ -315,11 +327,12 @@ kernel void dyColorManagement(texture2d<float,access::read> source [[texture(0)]
// Premultiplication is preserved by mixing the two equally-alpha images.
kernel void dyToolBlend(texture2d<float,access::read> before [[texture(0)]],texture2d<float,access::read> after [[texture(1)]],texture2d<half,access::write> output [[texture(2)]],device const DYToolMaskEntry* masks [[buffer(0)]],constant DYToolMaskHeader& h [[buffer(1)]],uint2 pos [[thread_position_in_grid]]){
if(pos.x>=output.get_width()||pos.y>=output.get_height())return;float4 a=before.read(pos),b=after.read(pos);float2 uv=(float2(pos)+.5f)/float2(output.get_width(),output.get_height());float amount=dyToolCoverage(uv,dyToolEncode(a.a>0?(h.premultiplied?a.rgb/a.a:a.rgb):float3(0)),masks,h,h.section);output.write(half4(mix(a,b,amount)),pos);
if(pos.x>=output.get_width()||pos.y>=output.get_height())return;float4 a=before.read(pos),b=after.read(pos);float2 uv=(float2(pos)+.5f)/float2(output.get_width(),output.get_height());float amount=dyToolCoverage(uv,dyToolEncode(a.a>0?(h.premultiplied?a.rgb/a.a:a.rgb):float3(0)),masks,h,h.section);output.write(half4(h.skinPreview?float4(b.rgb*amount,a.a):mix(a,b,amount)),pos);
}
extern "C" float dy_skinWeight(float3 color,float3 reference,constant DYUniforms& uniforms);
extern "C" float3 dy_skinExtra(float3 color,float3 reference,constant DYUniforms& uniforms);
kernel void dyToolSkin(texture2d<float,access::read> before [[texture(0)]],texture2d<float> reference [[texture(1)]],texture2d<half,access::write> output [[texture(2)]],constant DYUniforms& u [[buffer(0)]],uint2 pos [[thread_position_in_grid]]){
if(pos.x>=output.get_width()||pos.y>=output.get_height())return;constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);float4 a=before.read(pos),b=reference.sample(f,(float2(pos)+.5f)/float2(output.get_width(),output.get_height()));if(a.a>0){float3 c=dy_skinExtra(dyToolEncode(a.rgb/a.a),dyToolEncode(b.a>0?b.rgb/b.a:float3(0)),u);a.rgb=dyToolDecode(c)*a.a;}output.write(half4(a),pos);
if(pos.x>=output.get_width()||pos.y>=output.get_height())return;constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);float4 a=before.read(pos),b=reference.sample(f,(float2(pos)+.5f)/float2(output.get_width(),output.get_height()));if(a.a>0){float3 c=dy_skinExtra(dyToolEncode(a.rgb/a.a),dyToolEncode(b.a>0?b.rgb/b.a:float3(0)),u);a.rgb=u.skinProtection.x>.5&&u.skinVisualize>.5?float3(dy_skinWeight(float3(0),dyToolEncode(b.a>0?b.rgb/b.a:float3(0)),u)*clamp(u.skinProtection.y*.01f,0.f,1.f)*a.a):dyToolDecode(c)*a.a;}output.write(half4(a),pos);
}
fragment half4 dyToolCopyFragment(DYRaster in [[stage_in]],texture2d<half> source [[texture(0)]]){constexpr sampler f(coord::normalized,address::clamp_to_edge,filter::linear);return source.sample(f,in.uv);}
@@ -327,3 +340,9 @@ fragment half4 dyToolCopyFragment(DYRaster in [[stage_in]],texture2d<half> sourc
#include "DYFilmKernels.inc.h"
#include "DYManagedKernels.inc.h"
#include "DYPrimaryKernels.inc.h"
// Inverse radial sampling; alpha stays premultiplied through interpolation.
kernel void dyLensRepair(texture2d<float> source [[texture(0)]],texture2d<float,access::write> output [[texture(1)]],constant DYUniforms& u [[buffer(0)]],constant float& aspect [[buffer(1)]],uint2 p [[thread_position_in_grid]]){
if(p.x>=output.get_width()||p.y>=output.get_height())return;float2 uv=(float2(p)+.5f)/float2(output.get_width(),output.get_height()),center=float2(u.lensCenterX,u.lensCenterY);float2 q=(uv-center)/max(1.f,u.lensScale),metric=q*float2(aspect,1);float2 corner=max(center,1-center)*float2(aspect,1);float radius=dot(metric,metric)/max(1e-6f,dot(corner,corner));float2 sample=center+q*(1+clamp(u.lensStrength,-100.f,100.f)*.0025f*radius);
constexpr sampler f(coord::normalized,address::clamp_to_zero,filter::linear);output.write(source.sample(f,sample),p);
}
+25 -9
查看文件
@@ -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>
@@ -216,7 +217,7 @@ static NSArray *DYPresentationSections(void) {
for(NSString *key in @[@"temperature",@"tint",@"exposure",@"contrast",@"highlights",@"shadows",@"whites",@"blacks",@"texture",@"clarity",@"dehaze",@"vibrance",@"saturation",@"skinEnabled",@"copyAutoGrade"]){NSDictionary*d=byKey[key];if(d)[rows addObject:d];}
base[@"rows"]=rows;base[@"extraEnabled"]=bySection[@"color"][@"enabled"];
base[@"title"]=@"基础调整";
return @[primary,bySection[@"spider"],base,bySection[@"skin"],bySection[@"look"],bySection[@"hsl"],bySection[@"curve"],bySection[@"grading"],bySection[@"primaries"],bySection[@"levels"],bySection[@"blackwhite"],bySection[@"balance"],bySection[@"mixer"],bySection[@"film"]];
return @[primary,bySection[@"spider"],base,bySection[@"skin"],bySection[@"look"],bySection[@"hsl"],bySection[@"curve"],bySection[@"grading"],bySection[@"primaries"],bySection[@"levels"],bySection[@"blackwhite"],bySection[@"balance"],bySection[@"mixer"],bySection[@"film"],bySection[@"lens"]];
}
@@ -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,8 @@ 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(revealViewerTool:) name:@"DYViewerToolRequested" object:_manager];
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 +537,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 +558,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 +574,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 +589,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]);
@@ -698,7 +709,7 @@ static NSImage *DYWheelImage(void) {
}
for(NSView *row in body)if(![ordered containsObject:row])row.hidden=YES;body=ordered;
}
NSMutableDictionary *record=[NSMutableDictionary dictionaryWithDictionary:@{@"section":section,@"view":card,@"header":header,@"enabled":enabled,@"reset":reset,@"body":body,@"collapsed":@(![@[@"primary",@"spider",@"base"]containsObject:key])}];
NSMutableDictionary *record=[NSMutableDictionary dictionaryWithDictionary:@{@"section":section,@"view":card,@"header":header,@"enabled":enabled,@"reset":reset,@"body":body,@"collapsed":@YES}];
if([key isEqual:@"look"]){NSButton *add=DYButton(@"+",self,@selector(addLook:));add.bordered=NO;add.font=[NSFont boldSystemFontOfSize:20];add.accessibilityLabel=@"添加风格 LUT";[card addSubview:add];record[@"add"]=add;}
id<PROAPIAccessing> host=_embedded?[(DYToolManager*)_manager host]:_manager;
NSString *nodeID=_embedded?[(DYToolManager*)_manager nodeID]:[@"base:" stringByAppendingString:key];
@@ -753,7 +764,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;}
@@ -842,7 +853,11 @@ static NSImage *DYWheelImage(void) {
for(NSView *row in c[@"body"])row.alphaValue=enabled?1:.45;
}
id<PROAPIAccessing> maskHost=_embedded?[(DYToolManager*)_manager host]:_manager;NSDictionary *tools=DYReadTools(maskHost,t).document;for(NSDictionary *card in _cards){
BOOL removed=!_embedded&&DYBaseToolRemoved(tools,card[@"section"][@"key"]);groupingChanged|=[card[@"removed"]boolValue]!=removed;((NSMutableDictionary *)card)[@"removed"]=@(removed);
NSString *type=card[@"section"][@"key"];BOOL visible=YES;
if(!_embedded){DYInspectorToken *token=nil;[get getCustomParameterValue:&token fromParameter:DYInspectorParameterID atTime:t];visible=[@[@"primary",@"base",@"spider",@"hsl"]containsObject:type]||[token.folds[[@"visible:" stringByAppendingString:type]]boolValue];
if(!visible){for(NSDictionary*d in DYBaseToolDescriptors(type)){double value=[d[@"default"]doubleValue];[get getFloatValue:&value fromParameter:[d[@"pid"]unsignedIntValue]atTime:t];if(std::isfinite(value)&&fabs(value-[d[@"default"]doubleValue])>1e-6){visible=YES;break;}}if([tools[@"baseMasks"][type]count])visible=YES;if([type isEqual:@"look"])for(NSString *assetKey in DYReadAssets(_manager,t).paths)if([assetKey hasPrefix:@"look"])visible=YES;}
}
BOOL removed=!_embedded&&(DYBaseToolRemoved(tools,type)||!visible);groupingChanged|=[card[@"removed"]boolValue]!=removed;((NSMutableDictionary *)card)[@"removed"]=@(removed);
[card[@"maskPanel"]refreshWithDocument:tools time:t];
NSString *nodeID=_embedded?[(DYToolManager*)_manager nodeID]:[@"base:" stringByAppendingString:card[@"section"][@"key"]];NSUInteger count=[DYMasksForTool(tools,nodeID) count];
[(DYMaskCountBadge*)card[@"maskBadge"]setCount:count];NSString *hint=count?[NSString stringWithFormat:@"已有 %lu 个蒙版;点击添加独立蒙版",(unsigned long)count]:@"添加本工具的独立蒙版";
@@ -1009,7 +1024,7 @@ static NSImage *DYWheelImage(void) {
NSError *failure=nil;if(!DYResetToolParameters(_manager,DYDescriptors(),t,&failure)){dispatch_async(dispatch_get_main_queue(),^{[self showError:failure.localizedDescription?:@"未能完整还原参数。"];});return;}
DYAssetState *assets=[[[DYAssetState alloc] init] autorelease];assets.paths=@{};DYWriteAssets(_manager,assets,t);DYWriteTools(_manager,[[[DYToolDocument alloc]init]autorelease].document,t);
[set setCustomParameterValue:[[[DYInspectorToken alloc]init]autorelease] toParameter:DYInspectorParameterID atTime:t];
for(NSMutableDictionary *card in _cards)card[@"collapsed"]=@(![@[@"primary",@"spider",@"base"]containsObject:card[@"section"][@"key"]]);
for(NSMutableDictionary *card in _cards)card[@"collapsed"]=@YES;
} @finally {if(grouped)[undo endUndoGroup];[action endAction:self];}
[self postChanged];
}
@@ -1052,6 +1067,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];
+2 -1
查看文件
@@ -136,7 +136,7 @@ static void initialize(){static dispatch_once_t once;dispatch_once(&once,^{
section(@"spider",@"蜘蛛盘校色仪",offsetof(DYUniforms,spiderSectionEnabled),@[scalar(@"spiderMix",@"蜘蛛盘混合",offsetof(DYUniforms,spiderMix),0,1,1)]);
section(@"base",@"基础调色",136,[[[base subarrayWithRange:NSMakeRange(0,6)]arrayByAddingObjectsFromArray:[base subarrayWithRange:NSMakeRange(10,3)]]arrayByAddingObject:copyAuto],1);
section(@"color",@"白平衡与颜色",140,@[base[6],base[7],base[9],base[8]],1);
section(@"skin",@"肤色保护",464,@[scalar(@"skinStrength",@"保护程度",468,0,100,60),scalar(@"skinHue",@"肤色色相",472,0,60,28)],1);
section(@"skin",@"肤色保护",464,@[scalar(@"skinStrength",@"保护程度",468,0,100,60),scalar(@"skinHue",@"肤色色相",472,0,60,28),row(@"skinFaceOnly",@"仅保护人脸肤色",offsetof(DYUniforms,skinFaceOnly),0,1,1,@"bool"),row(@"skinVisualize",@"显示肤色保护区域",offsetof(DYUniforms,skinVisualize),0,1,0,@"bool")],1);
NSMutableArray*look=[NSMutableArray arrayWithObject:scalar(@"postLUTStrength",@"风格 1 强度",60,0,1,1)];
for(int i=0;i<4;i++){[look addObject:row([NSString stringWithFormat:@"look%dEnabled",i+2],[NSString stringWithFormat:@"风格 %d 启用",i+2],160+i*4,0,1,1,@"bool")];[look addObject:scalar([NSString stringWithFormat:@"look%dStrength",i+2],[NSString stringWithFormat:@"风格 %d 强度",i+2],64+i*4,0,1,1)];}
section(@"look",@"风格 LUT",144,look);
@@ -189,6 +189,7 @@ static void initialize(){static dispatch_once_t once;dispatch_once(&once,^{
[descriptors replaceObjectAtIndex:descriptors.count-1 withObject:printLook];[film addObject:printLook];
NSMutableDictionary *printStrength=[[row(@"filmPrintStrength",@"印片强度",offsetof(DYUniforms,filmPrint)+sizeof(float),0,1,1,@"float")mutableCopy]autorelease];printStrength[@"filmTab"]=@5;[descriptors replaceObjectAtIndex:descriptors.count-1 withObject:printStrength];[film addObject:printStrength];
section(@"film",@"胶片模拟",offsetof(DYUniforms,film)+offsetof(DYFilmSettings,enabled),film);
section(@"lens",@"镜头畸变修复",offsetof(DYUniforms,lensSectionEnabled),@[scalar(@"lensStrength",@"畸变校正",offsetof(DYUniforms,lensStrength),-100,100,0),scalar(@"lensScale",@"画面缩放",offsetof(DYUniforms,lensScale),1,2,1),scalar(@"lensCenterX",@"光学中心 X",offsetof(DYUniforms,lensCenterX),0,1,.5),scalar(@"lensCenterY",@"光学中心 Y",offsetof(DYUniforms,lensCenterY),0,1,.5)]);
#undef FR
#undef FE
});}
+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];[_viewerParameterBridge publishAssets:a histogram:nil 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;NSData *previousHistogram=[_renderer histogram];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){NSData *histogram=[_renderer histogram];if(histogram&&histogram!=previousHistogram)[_viewerParameterBridge publishHistogram:histogram atTime:t];[_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;
+21 -6
查看文件
@@ -11,6 +11,8 @@
#include "DYToolGPU.h"
#include "DYFilmMath.h"
#import <CoreImage/CoreImage.h>
#import <Vision/Vision.h>
#import <ImageIO/ImageIO.h>
#import <MetalPerformanceShaders/MetalPerformanceShaders.h>
#import "DYColorTables.h"
#import "DYLUTLibrary.h"
@@ -18,6 +20,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.
@@ -64,6 +68,7 @@ static void bypassNeutralTools(DYUniforms *u){
}
}
static void bypassIdleSkin(DYUniforms *u){
if(u->skinVisualize>.5)return;
if(u->curveSectionEnabled>.5||u->hslSectionEnabled>.5||u->colorGradingSectionEnabled>.5||u->primariesSectionEnabled>.5||u->levelsSectionEnabled>.5||u->blackWhiteSectionEnabled>.5||u->colorBalanceSectionEnabled>.5)return;
if(u->preLUTStrength!=0||u->postLUTStrength!=0||simd_any(u->extraPostLUTStrengths!=0))return;
const float *values=&u->exposure,*enabled=&u->exposureEnabled;
@@ -110,16 +115,25 @@ static NSArray *DYPrimaryActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
CFTimeInterval _lastPreview;
BOOL _exporting;
NSDictionary *_toolDocument,*_colorContext,*_exportManagedState;
BOOL _managedFinishing;
BOOL _managedFinishing;NSData *_faceEntries,*_faceInput,*_faceCachedEntries;CIContext *_faceContext;
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 "DYFaceRender.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{[_faceEntries release];[_faceInput release];[_faceCachedEntries release];[_faceContext release];[_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];
@@ -142,6 +156,7 @@ static NSArray *DYPrimaryActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
progress.completedUnitCount=2;dispatch_async(dispatch_get_main_queue(),^{NSError *result=progress.cancelled?[NSError errorWithDomain:NSCocoaErrorDomain code:NSUserCancelledError userInfo:nil]:error;if(completion)completion(result);});
}});return progress;
}
- (void)notifyPreviewChanged{dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:@"DYPreviewDidChange" object:self];});}
- (void)invalidatePreview{@synchronized(_previewLock){[_preview release];_preview=nil;[_lookLUTPreview release];_lookLUTPreview=nil;[_histogram release];_histogram=nil;_lastPreview=0;}dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:@"DYPreviewDidChange" object:self];});}
- (NSData*)histogram{@synchronized(_previewLock){return [[_histogram retain]autorelease];}}
- (NSData*)preview{@synchronized(_previewLock){return [[_preview retain]autorelease];}}
@@ -153,7 +168,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 @[@"dyLensRepair",@"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.
@@ -204,7 +219,7 @@ static NSArray *DYPrimaryActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
}
if([e[@"spiderActive"]boolValue]){spiderBuffer=e[@"spiderBuffer"];spiderSize={ [e[@"spiderHues"]intValue],[e[@"spiderRings"]intValue]};}
}
DYToolMaskHeader maskHeader{};id<MTLBuffer>maskBuffer=(masks.count||segmented)?[self maskBuffer:masks tile:src device:d header:&maskHeader]:nil;BOOL hasMasks=maskHeader.count>0;if((hasMasks||segmented)&&!maskBuffer)return fail(err,@"无法分配蒙版缓冲区");
DYToolMaskHeader maskHeader{};id<MTLBuffer>maskBuffer=(masks.count||segmented||u.skinFaceOnly>.5||_faceEntries.length)?[self maskBuffer:masks tile:src device:d header:&maskHeader]:nil;maskHeader.faceOnly=u.skinFaceOnly>.5;BOOL hasMasks=maskHeader.count>0||maskHeader.faceOnly;if((hasMasks||segmented)&&!maskBuffer)return fail(err,@"无法分配蒙版缓冲区");
NSMutableDictionary*ps=e[@"pipelines"];NSString*format=[NSString stringWithFormat:@"%lu-%d-%d",(unsigned long)output.pixelFormat,hasMasks,segmented];id<MTLRenderPipelineState>pipeline=ps[format];if(!pipeline){MTLRenderPipelineDescriptor*p=[MTLRenderPipelineDescriptor new];p.vertexFunction=[e[@"library"]newFunctionWithName:@"dyVertex"];p.fragmentFunction=[e[@"library"]newFunctionWithName:segmented?@"dySegmentFragment":hasMasks?@"dyMaskedFragment":@"dyFragment"];p.colorAttachments[0].pixelFormat=output.pixelFormat;pipeline=[d newRenderPipelineStateWithDescriptor:p error:err];[p.vertexFunction release];[p.fragmentFunction release];[p release];if(!pipeline)return NO;ps[format]=pipeline;[pipeline release];}
MTLTextureDescriptor*td=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:input.width height:input.height mipmapped:NO];td.storageMode=MTLStorageModePrivate;td.usage=MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite;id<MTLTexture>straight=[d newTextureWithDescriptor:td];if(!straight)return fail(err,@"无法分配调色缓冲区");
id<MTLCommandBuffer>cb=[e[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyUnpremultiply"]];[ce setTexture:input atIndex:0];[ce setTexture:straight atIndex:1];[ce dispatchThreads:MTLSizeMake(input.width,input.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];
@@ -240,7 +255,7 @@ static NSArray *DYPrimaryActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
for(NSUInteger y=0;y<180;y++)memcpy((uint8_t*)topFirst.mutableBytes+y*rowBytes,(const uint8_t*)_preview.bytes+(179-y)*rowBytes,rowBytes);
_lookLUTPreview=[topFirst copy];
}else _lookLUTPreview=[_preview retain];
_lastPreview=CACurrentMediaTime();dispatch_async(dispatch_get_main_queue(),^{[[NSNotificationCenter defaultCenter]postNotificationName:@"DYPreviewDidChange" object:self];});
_lastPreview=CACurrentMediaTime();[self notifyPreviewChanged];
}}
if(!ok)fail(err,cb.error.localizedDescription);[pb release];[straight release];[scene release];return ok;
});}}
+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 -1
查看文件
@@ -1,5 +1,5 @@
#pragma once
#include "MaskCore/DYMaskOperator.h"
struct DYToolMaskEntry {DYResolvedMask mask;int section,combine;};
struct DYToolMaskHeader {unsigned count;float offsetX,offsetY,scaleX,scaleY;int section,premultiplied;};
struct DYToolMaskHeader {unsigned count;float offsetX,offsetY,scaleX,scaleY;int section,premultiplied,faceOnly,skinPreview;};
struct DYToolStageRange {int first,last,suppressBlackWhite;};
@@ -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)};}
}
@@ -8,7 +8,7 @@
DYToolDocument *authored=[[[DYToolDocument alloc]init]autorelease];authored.document=doc;NSData *archive=[NSKeyedArchiver archivedDataWithRootObject:authored requiringSecureCoding:YES error:&error];DYToolDocument *restored=[NSKeyedUnarchiver unarchivedObjectOfClass:DYToolDocument.class fromData:archive error:&error];run.record(@"inserted-order-secure-archive-roundtrip",[restored isEqual:authored]&&[DYToolDisplayOrder(restored.document)isEqual:order]);
NSMutableDictionary *bad=DYMutablePlist(doc);bad[@"layers"][0][@"after"]=@"base:unknown";run.record(@"insertion-rejects-unknown-base-anchor",!DYValidToolDocument(bad));bad=DYMutablePlist(doc);bad[@"layers"][0][@"after"]=bad[@"layers"][0][@"id"];run.record(@"insertion-rejects-cyclic-anchor",!DYValidToolDocument(bad));
BOOL removed=DYRemoveTool(doc,one[@"id"]);order=DYToolDisplayOrder(doc);hslIndex=[order indexOfObject:@"base:hsl"];run.record(@"delete-reconnects-child-without-moving-to-bottom",removed&&DYValidToolDocument(doc)&&[order[hslIndex+1]isEqual:newest[@"id"]]&&[order[hslIndex+2]isEqual:two[@"id"]]);
DYWriteTools(manager,doc,kCMTimeZero);DYInspector *inspector=[[[DYInspector alloc]initWithAPIManager:manager renderer:renderer]autorelease];[inspector refresh];[inspector setFrameSize:NSMakeSize(360,780)];[inspector layoutSubtreeIfNeeded];NSDictionary *views=[inspector valueForKey:@"_stackViews"];NSArray *cards=[inspector valueForKey:@"_cards"];NSView *baseHSL=nil,*baseCurve=nil;for(NSDictionary *card in cards){if([card[@"section"][@"key"]isEqual:@"hsl"])baseHSL=card[@"view"];if([card[@"section"][@"key"]isEqual:@"curve"])baseCurve=card[@"view"];}NSView *newView=views[newest[@"id"]],*secondView=views[two[@"id"]];run.record(@"new-native-card-is-laid-out-between-its-source-and-next-module",newView&&secondView&&NSMinY(newView.frame)>=NSMaxY(baseHSL.frame)&&NSMinY(secondView.frame)>=NSMaxY(newView.frame)&&NSMinY(baseCurve.frame)>=NSMaxY(secondView.frame));
DYWriteTools(manager,doc,kCMTimeZero);DYInspector *inspector=[[[DYInspector alloc]initWithAPIManager:manager renderer:renderer]autorelease];[inspector refresh];[inspector setFrameSize:NSMakeSize(360,780)];[inspector layoutSubtreeIfNeeded];NSDictionary *views=[inspector valueForKey:@"_stackViews"];NSArray *cards=[inspector valueForKey:@"_cards"];NSView *baseHSL=nil,*baseCurve=nil;for(NSDictionary *card in cards){if([card[@"section"][@"key"]isEqual:@"hsl"])baseHSL=card[@"view"];if([card[@"section"][@"key"]isEqual:@"curve"])baseCurve=card[@"view"];}NSView *newView=views[newest[@"id"]],*secondView=views[two[@"id"]];run.record(@"new-native-card-is-laid-out-between-its-source-and-next-module",newView&&secondView&&NSMinY(newView.frame)>=NSMaxY(baseHSL.frame)&&NSMinY(secondView.frame)>=NSMaxY(newView.frame)&&(baseCurve.hidden||NSMinY(baseCurve.frame)>=NSMaxY(secondView.frame)));
doc=DYMutablePlist(empty.document);NSMutableDictionary *legacy=DYMutablePlist(DYNewTool(@"hsl"));[doc[@"layers"]addObject:legacy];NSDictionary *child=DYInsertTool(doc,@"hsl",legacy[@"id"]);run.record(@"schema-one-tail-layer-retains-tail-root-with-new-child",[DYToolRootAnchor(doc,legacy[@"id"])isEqual:@"tail"]&&[DYToolRootAnchor(doc,child[@"id"])isEqual:@"tail"]&&[DYToolDisplayOrder(doc).lastObject isEqual:child[@"id"]]);
auto renderInserted=[&](NSDictionary *tools,DYUniforms u,NSString *name){NSError *failure=nil;BOOL ok=[renderer renderSource:source destination:destination uniforms:u paths:@{} spider:nil tools:tools error:&failure];run.need(name,ok,@{@"error":reason(failure)});return read(destination,gpu);};
auto upload=[&](DYDiagnosticTile *tile,const Pixels &pixels){[[tile metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:pixels.data() bytesPerRow:width*8];};
+7 -1
查看文件
@@ -14,6 +14,11 @@
if(sender.tag<0||sender.tag>=_cards.count)return;id<PROAPIAccessing>host=_embedded?[(DYToolManager*)_manager host]:_manager;id<FxCustomParameterActionAPI_v4>a=[host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];
NSString *addedID=nil;@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(host,a.currentTime).document);if([doc[@"layers"]count]>=DYToolLimit){[self showError:@"最多可添加 32 个独立工具层。"];return;}NSString *type=_cards[sender.tag][@"section"][@"key"],*anchor=_embedded?[(DYToolManager*)_manager nodeID]:[@"base:" stringByAppendingString:type];NSMutableDictionary *node=(id)DYInsertTool(doc,type,anchor);if(!node)return;if(DYPrimaryColorState(DYReadAssets(host,a.currentTime).colorManagement)){DYUniforms root;DYReadUniforms(host,a.currentTime,&root);DYSeedPrimaryWorkingSpace(node,root.cm.workingTransfer,root.cm.workingGamut);}addedID=[node[@"id"]copy];id<FxUndoAPI>undo=[host apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"再加一层初始化工具"];DYWriteTools(host,doc,a.currentTime);[undo endUndoGroup];}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:host userInfo:@{@"scrollToTool":addedID?:@""}];[addedID release];
}
- (void)revealViewerTool:(NSNotification*)note {
if(_embedded||![DYToolTypes()containsObject:note.userInfo[@"type"]])return;NSString *type=note.userInfo[@"type"];id<FxCustomParameterActionAPI_v4>a=[self actionAPI];[a startAction:self];@try{DYInspectorToken *old=nil;[[_manager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getCustomParameterValue:&old fromParameter:DYInspectorParameterID atTime:a.currentTime];DYInspectorToken *token=old?[[old copy]autorelease]:[[[DYInspectorToken alloc]init]autorelease];NSMutableDictionary *folds=[[token.folds mutableCopy]autorelease];folds[[@"visible:" stringByAppendingString:type]]=@YES;token.folds=folds;[[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)]setCustomParameterValue:token toParameter:DYInspectorParameterID atTime:a.currentTime];
NSMutableDictionary *doc=DYMutablePlist(DYReadTools(_manager,a.currentTime).document);if(DYBaseToolRemoved(doc,type)){BOOL existing=NO;for(NSDictionary*n in doc[@"layers"])if([n[@"type"]isEqual:type])existing=YES;if(!existing){id<FxUndoAPI>undo=[_manager apiForProtocol:@protocol(FxUndoAPI)];if([undo startUndoGroup:@"添加画布工具"]){DYInsertTool(doc,type,[@"base:" stringByAppendingString:type]);DYWriteTools(_manager,doc,a.currentTime);[undo endUndoGroup];}}}
}@finally{[a endAction:self];}[self refresh];[self setNeedsLayout:YES];
}
- (void)addModule:(NSMenuItem *)sender{
if(_embedded)return;NSString *type=sender.representedObject;for(NSUInteger i=0;i<_cards.count;i++)if([_cards[i][@"section"][@"key"]isEqual:type]){NSButton *source=[[[NSButton alloc]init]autorelease];source.tag=i;[self repeatTool:source];return;}
}
@@ -43,7 +48,8 @@
}@finally{
if(grouped)[undo endUndoGroup];[a endAction:self];
if(attempted&&!changed&&!failure)failure=[NSError errorWithDomain:@"com.dayu.color.ToolRemoval" code:1 userInfo:@{NSLocalizedDescriptionKey:@"未能完成删除,模块已保留。可撤销本次参数还原。"}];
dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:host];if(failure)[self showError:failure.localizedDescription];});
id retainedHost=[(id)host retain];NSError *retainedFailure=[failure retain];
dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:retainedHost];if(retainedFailure)[self showError:retainedFailure.localizedDescription];[retainedHost release];[retainedFailure release];});
}
// Model refresh posts accessibility changes after the remote action unwinds.
// Synchronous notification here can re-enter the host's ViewBridge callback.
+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
+9 -6
查看文件
@@ -7,7 +7,7 @@
h->premultiplied=1;
for(NSString *type in groups){NSInteger section=[DYToolTypes()indexOfObject:type];if(section==NSNotFound)continue;
for(NSDictionary *m in groups[type]){if(![m[@"enabled"]boolValue])continue;DYToolMaskEntry entry{};entry.section=(int)section;entry.combine=[m[@"combine"]intValue];[m[@"parameters"]getBytes:&entry.mask.parameters length:sizeof(DYMaskParameters)];entry.mask.parameters.imageAspect=w/ht;NSData *nodes=m[@"nodes"];entry.mask.path=dyFlattenMask((const DYBezierNode*)nodes.bytes,nodes.length/sizeof(DYBezierNode));entries.push_back(entry);}
}h->count=(unsigned)entries.size();if(entries.empty())entries.push_back({});return [[device newBufferWithBytes:entries.data() length:entries.size()*sizeof(DYToolMaskEntry) options:MTLResourceStorageModeShared]autorelease];
}if(_faceEntries.length){const DYToolMaskEntry *faces=(const DYToolMaskEntry*)_faceEntries.bytes;entries.insert(entries.end(),faces,faces+_faceEntries.length/sizeof(DYToolMaskEntry));}h->count=(unsigned)entries.size();if(entries.empty())entries.push_back({});return [[device newBufferWithBytes:entries.data() length:entries.size()*sizeof(DYToolMaskEntry) options:MTLResourceStorageModeShared]autorelease];
}
- (void)encodeBlend:(id<MTLTexture>)before after:(id<MTLTexture>)after output:(id<MTLTexture>)output masks:(id<MTLBuffer>)masks header:(DYToolMaskHeader)h entry:(NSDictionary*)entry commands:(id<MTLCommandBuffer>)commands {
id<MTLComputeCommandEncoder>encoder=[commands computeCommandEncoder];[encoder setComputePipelineState:entry[@"dyToolBlend"]];[encoder setTexture:before atIndex:0];[encoder setTexture:after atIndex:1];[encoder setTexture:output atIndex:2];[encoder setBuffer:masks offset:0 atIndex:0];[encoder setBytes:&h length:sizeof(h) atIndex:1];[encoder dispatchThreads:MTLSizeMake(output.width,output.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[encoder endEncoding];
@@ -31,21 +31,22 @@
BOOL found=NO;float low=1,high=1;for(NSDictionary *mask in node[@"masks"]){if(![mask[@"enabled"]boolValue])continue;DYMaskParameters p=DYMaskAtTime(mask,kCMTimeInvalid);float a=0,b=p.strength==0?0:1;NSInteger combine=[mask[@"combine"]integerValue];if(!found){low=combine==1?1-b:a;high=combine==1?1-a:b;found=YES;}else if(combine==1){low*=1-b;high*=1-a;}else if(combine==2){low*=a;high*=b;}else{low=1-(1-low)*(1-a);high=1-(1-high)*(1-b);}}
if(found&&high==0)return [self copyTile:source to:destination entry:entry error:error];
DYUniforms layer=DYToolUniforms(node);NSString *type=node[@"type"];
if([type isEqual:@"lens"])return [self renderLens:source destination:destination uniforms:layer masks:node[@"masks"] entry:entry error:error];
if([type isEqual:@"mixer"]||[type isEqual:@"film"]){layer.filmFrameKey=[node[@"filmFrameKey"]unsignedIntValue];return [self renderFilmTool:type source:source destination:destination uniforms:layer masks:node[@"masks"] entry:entry error:error];}
if(![type isEqual:@"skin"])return [self renderLegacy:source destination:destination uniforms:layer paths:node[@"paths"] spider:node[@"spider"] masks:@{type:node[@"masks"]} error:error];
id<MTLDevice>d=entry[@"device"];id<MTLTexture>before=[source metalTextureForDevice:d],input=[original metalTextureForDevice:d],after=[destination metalTextureForDevice:d];
id<MTLCommandBuffer>cb=[entry[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>ce=[cb computeCommandEncoder];[ce setComputePipelineState:entry[@"dyToolSkin"]];[ce setTexture:before atIndex:0];[ce setTexture:input atIndex:1];[ce setTexture:after atIndex:2];[ce setBytes:&layer length:sizeof(layer) atIndex:0];[ce dispatchThreads:MTLSizeMake(after.width,after.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];[cb commit];[cb waitUntilCompleted];if(cb.status!=MTLCommandBufferStatusCompleted)return fail(error,cb.error.localizedDescription);
if(![node[@"masks"]count])return YES;
if(![node[@"masks"]count]&&layer.skinFaceOnly<.5&&layer.skinVisualize<.5)return YES;
MTLTextureDescriptor *desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:after.width height:after.height mipmapped:NO];desc.storageMode=MTLStorageModePrivate;desc.usage=MTLTextureUsageRenderTarget|MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite;id<MTLTexture>blend=[d newTextureWithDescriptor:desc];if(!blend)return fail(error,@"无法分配新增工具蒙版缓冲区");
DYToolMaskHeader h{};h.section=3;id<MTLBuffer>buffer=[self maskBuffer:@{type:node[@"masks"]} tile:source device:d header:&h];cb=[entry[@"queue"]commandBuffer];[self encodeBlend:before after:after output:blend masks:buffer header:h entry:entry commands:cb];[cb commit];[cb waitUntilCompleted];BOOL ok=cb.status==MTLCommandBufferStatusCompleted;
DYToolMaskHeader h{};h.section=3;h.faceOnly=layer.skinFaceOnly>.5;h.skinPreview=layer.skinProtection.x>.5&&layer.skinVisualize>.5;id<MTLBuffer>buffer=[self maskBuffer:@{type:node[@"masks"]} tile:source device:d header:&h];cb=[entry[@"queue"]commandBuffer];[self encodeBlend:before after:after output:blend masks:buffer header:h entry:entry commands:cb];[cb commit];[cb waitUntilCompleted];BOOL ok=cb.status==MTLCommandBufferStatusCompleted;
DYExportTile *blended=[[DYExportTile alloc]initWithTexture:blend registry:d.registryID];[blended setBounds:source.tilePixelBounds origin:source.imageOrigin];[blended setPixelAspect:source.pixelAspect];[blend release];if(ok)ok=[self copyTile:blended to:destination entry:entry error:error];else fail(error,cb.error.localizedDescription);[blended release];return ok;
}
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){return DYRenderWithPool(error,[&]()->BOOL{
- (BOOL)renderToolsSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){return DYRenderWithPool(error,[&]()->BOOL{
if(!tools)tools=@{@"schema":@1,@"layers":@[],@"baseMasks":@{}};if(!DYValidToolDocument(tools))return fail(error,@"工具或蒙版数据损坏,未更改原工程");
DYApplyRemovedBaseTools(&u,tools);paths=DYVisibleBaseToolPaths(paths,tools);if(DYBaseToolRemoved(tools,@"spider"))spider=nil;
NSArray *layers=tools[@"layers"];BOOL active=NO,anchored=NO;for(NSDictionary *node in layers)if(!DYToolIsNeutral(node)){active=YES;anchored|=![DYToolRootAnchor(tools,node[@"id"])isEqual:@"tail"];}
// No active extra tool keeps the exact historical fused path, including HDR.
if(!active&&!DYChannelMixerActive(u)&&!DYFilmToolActive(u))return [self renderLegacy:src destination:dst uniforms:u paths:paths spider:spider masks:tools[@"baseMasks"] error:error];
if(!active&&!DYChannelMixerActive(u)&&!DYFilmToolActive(u)&&(u.lensSectionEnabled<.5||(u.lensStrength==0&&u.lensScale==1)))return [self renderLegacy:src destination:dst uniforms:u paths:paths spider:spider masks:tools[@"baseMasks"] error:error];
NSMutableDictionary *entry=[self device:dst.deviceRegistryID error:error];if(!entry)return NO;id<MTLDevice>d=entry[@"device"];id<MTLTexture>input=[src metalTextureForDevice:d];if(!input)return fail(error,@"宿主图像纹理不可用");
MTLTextureDescriptor *desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:input.width height:input.height mipmapped:NO];desc.storageMode=MTLStorageModePrivate;desc.usage=MTLTextureUsageRenderTarget|MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite;
DYExportTile *tile=nil,*skinReference=nil,*originalReference=nil;NSArray *order=DYToolDisplayOrder(tools);NSMutableDictionary *groups=[NSMutableDictionary dictionary];for(NSString *ID in order){NSDictionary *node=DYToolWithID(tools,ID);if(!node||DYToolIsNeutral(node))continue;NSString *root=DYToolRootAnchor(tools,ID);if(!groups[root])groups[root]=[NSMutableArray array];[groups[root]addObject:node];}
@@ -91,7 +92,7 @@
if(!apply(@"base:spider"))return NO;
}
// New end-of-chain base tools do not move any historical color stages.
for(NSString *type in @[@"mixer",@"film"]){BOOL enabled=[type isEqual:@"mixer"]?DYChannelMixerActive(u):DYFilmToolActive(u);if(enabled){DYExportTile *next=makeTile();if(!next)return fail(error,@"无法分配胶片工具缓冲区");BOOL ok=[self renderFilmTool:type source:tile destination:next uniforms:u masks:tools[@"baseMasks"][type]?:@[] entry:entry error:error];if(!ok){[next release];return NO;}replace(next);}if(!apply([@"base:" stringByAppendingString:type]))return NO;}
for(NSString *type in @[@"mixer",@"film",@"lens"]){BOOL enabled=[type isEqual:@"lens"]?u.lensSectionEnabled>.5&&(u.lensStrength!=0||u.lensScale!=1):[type isEqual:@"mixer"]?DYChannelMixerActive(u):DYFilmToolActive(u);if(enabled){DYExportTile *next=makeTile();if(!next)return fail(error,@"无法分配胶片工具缓冲区");BOOL ok=[type isEqual:@"lens"]?[self renderLens:tile destination:next uniforms:u masks:tools[@"baseMasks"][type]?:@[] entry:entry error:error]:[self renderFilmTool:type source:tile destination:next uniforms:u masks:tools[@"baseMasks"][type]?:@[] entry:entry error:error];if(!ok){[next release];return NO;}replace(next);}if(!apply([@"base:" stringByAppendingString:type]))return NO;}
// Schema 1 extra layers (and children inserted after those layers) retain
// their old end-of-chain order. Saving does not silently migrate old looks.
if(!apply(@"tail"))return NO;return [self copyTile:tile to:dst entry:entry error:error];
@@ -99,6 +100,8 @@
});}}
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){
if(tools&&!DYValidToolDocument(tools))return fail(error,@"工具或蒙版数据损坏,未更改原工程");DYApplyRemovedBaseTools(&u,tools);paths=DYVisibleBaseToolPaths(paths,tools);if(DYBaseToolRemoved(tools,@"spider"))spider=nil;
if((u.lensSectionEnabled>.5&&(u.lensStrength!=0||u.lensScale!=1))||(u.skinProtection.x>.5&&u.skinVisualize>.5))return fail(error,@"镜头修复与肤色区域显示无法保存到 Cube,请保存完整预设。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"lens"]&&!DYToolIsNeutral(node))return fail(error,@"镜头畸变属于空间处理,请保存完整预设。");}
DYUniforms effective=u;if(![paths[@"input"]length]&&effective.inputProfile==0)effective.preLUTStrength=0;if(![paths[@"look0"]length])effective.postLUTStrength=0;for(int i=0;i<4;i++)if(![paths[[NSString stringWithFormat:@"look%d",i+1]]length])effective.extraPostLUTStrengths[i]=0;bypassNeutralTools(&effective);bypassIdleSkin(&effective);if(effective.skinFaceOnly>.5&&effective.skinProtection.x>.5&&effective.skinProtection.y>0)return fail(error,@"人脸限定肤色保护属于空间选区,Cube 无法保存。请保存完整预设,或关闭人脸限定后导出。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"skin"]&&layer.skinProtection.x>.5&&layer.skinProtection.y>0&&(layer.skinFaceOnly>.5||layer.skinVisualize>.5))return fail(error,@"新增肤色层含人脸空间选区,请保存完整预设。");}
if(DYFilmToolActive(u)&&DYFilmSpatialActive(u.film))return fail(error,@"当前胶片含晕光、辉光、颗粒或暗角,无法完整保存到静态 Cube。请保存完整预设,或关闭这些处理后再导出。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"film"]&&DYFilmToolActive(layer)&&DYFilmSpatialActive(layer.film))return fail(error,@"新增胶片层含空间或时间处理,无法完整保存到静态 Cube。请保存完整预设。");}
for(NSArray *masks in [tools[@"baseMasks"]allValues])if(masks.count)return fail(error,@"当前调色含空间蒙版或跟踪,Cube 无法保存这些信息。请先保存完整预设,或移除蒙版后导出。");for(NSDictionary *node in tools[@"layers"])if([node[@"masks"]count])return fail(error,@"新增工具含蒙版,无法完整导出为 Cube。请保存完整预设。");
_toolDocument=tools;BOOL ok=NO;@try{ok=[self exportLUT:url uniforms:u paths:paths spider:spider error:error];}@finally{_toolDocument=nil;}return ok;
+2 -2
查看文件
@@ -4,7 +4,7 @@
#include <set>
#import <objc/runtime.h>
NSArray *DYToolTypes(void){return @[@"primary",@"spider",@"base",@"skin",@"look",@"hsl",@"curve",@"grading",@"primaries",@"levels",@"blackwhite",@"balance",@"mixer",@"film"];}
NSArray *DYToolTypes(void){return @[@"primary",@"spider",@"base",@"skin",@"look",@"hsl",@"curve",@"grading",@"primaries",@"levels",@"blackwhite",@"balance",@"mixer",@"film",@"lens"];}
NSDictionary *DYToolSection(NSString *type){for(NSDictionary *s in DYSections())if([s[@"key"]isEqual:type])return s;return nil;}
static NSArray *DYBaseToolParts(NSString *type){return [type isEqual:@"primary"]?@[@"input",@"primary",@"output"]:[type isEqual:@"base"]?@[@"base",@"color"]:@[type];}
static NSArray<NSDictionary *> *DYBuildBaseToolDescriptors(NSString *type){
@@ -124,7 +124,7 @@ DYUniforms DYToolUniforms(NSDictionary *node){DYUniforms u;DYDefaultUniforms(&u)
// new layers explicitly disable mapping so adding a neutral layer is identity.
if([type isEqual:@"primary"]){u.primarySectionEnabled=1;u.cm.configured=1;u.cm.inputTransfer=u.cm.outputTransfer;u.cm.inputGamut=u.cm.outputGamut;u.cm.toneMapping=0;}
for(NSDictionary *d in DYDescriptors()){NSNumber *v=node[@"values"][d[@"key"]];if(v&&[d[@"offset"]integerValue]>=0)*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])=v.floatValue;}return u;}
BOOL DYToolIsNeutral(NSDictionary *node){NSString *type=node[@"type"];DYUniforms u=DYToolUniforms(node);NSDictionary *section=DYToolSection(type);BOOL enabled=YES;if([type isEqual:@"primary"])enabled=u.primarySectionEnabled>.5;else if([type isEqual:@"base"])enabled=u.baseSectionEnabled>.5||u.colorSectionEnabled>.5;else for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:section[@"enabled"]])enabled=*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])>.5;if(!enabled)return YES;if([type isEqual:@"primary"]&&u.cm.toneMapping>.5)return NO;if([type isEqual:@"mixer"])return !DYChannelMixerActive(u);if([type isEqual:@"film"])return !DYFilmToolActive(u);if([type isEqual:@"skin"])return u.skinProtection.y==0;if([node[@"type"]isEqual:@"spider"]&&[node[@"spider"]length]){auto mesh=DYSpiderMesh(node[@"spider"]);for(float v:dy::meshSamples(mesh))if(v!=0)return NO;}if([node[@"paths"]count])return NO;for(NSDictionary *d in DYDescriptors()){NSNumber *v=node[@"values"][d[@"key"]];if([type isEqual:@"primary"]&&[d[@"key"]isEqual:@"cmtoneMapping"]&&v.floatValue==0)continue;if(v&&v.floatValue!=[d[@"default"]floatValue])return NO;}return YES;}
BOOL DYToolIsNeutral(NSDictionary *node){NSString *type=node[@"type"];DYUniforms u=DYToolUniforms(node);NSDictionary *section=DYToolSection(type);BOOL enabled=YES;if([type isEqual:@"primary"])enabled=u.primarySectionEnabled>.5;else if([type isEqual:@"base"])enabled=u.baseSectionEnabled>.5||u.colorSectionEnabled>.5;else for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:section[@"enabled"]])enabled=*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])>.5;if(!enabled)return YES;if([type isEqual:@"primary"]&&u.cm.toneMapping>.5)return NO;if([type isEqual:@"lens"])return u.lensStrength==0&&u.lensScale==1;if([type isEqual:@"mixer"])return !DYChannelMixerActive(u);if([type isEqual:@"film"])return !DYFilmToolActive(u);if([type isEqual:@"skin"])return u.skinProtection.y==0&&u.skinVisualize<.5;if([node[@"type"]isEqual:@"spider"]&&[node[@"spider"]length]){auto mesh=DYSpiderMesh(node[@"spider"]);for(float v:dy::meshSamples(mesh))if(v!=0)return NO;}if([node[@"paths"]count])return NO;for(NSDictionary *d in DYDescriptors()){NSNumber *v=node[@"values"][d[@"key"]];if([type isEqual:@"primary"]&&[d[@"key"]isEqual:@"cmtoneMapping"]&&v.floatValue==0)continue;if(v&&v.floatValue!=[d[@"default"]floatValue])return NO;}return YES;}
@implementation DYToolManager {
id<PROAPIAccessing> _host;NSString *_nodeID,*_type;NSInteger _depth;CMTime _time;NSMutableDictionary *_pending;DYInspectorToken *_token;
+5 -1
查看文件
@@ -132,6 +132,9 @@ typedef struct DYUniforms {
DYFilmSettings film;
DYUInt filmFrameKey; // frozen render time, never an author parameter
DYFloat4 filmPrint; // appended after the complete 1.5.0 prefix: look, strength, reserved, reserved
// Append-only 1.11 extension; every historical offset remains unchanged.
float lensSectionEnabled,lensStrength,lensScale,lensCenterX;
float lensCenterY,skinFaceOnly,skinVisualize,extensionReserved;
} DYUniforms;
typedef struct DYVertex2D { DYFloat2 position; DYFloat2 textureCoordinate; } DYVertex2D;
@@ -152,7 +155,8 @@ DY_ABI_ASSERT(offsetof(DYUniforms, mixerRed) == 1104, "complete 1.4.3 prefix sta
DY_ABI_ASSERT(offsetof(DYUniforms, film) == 1168, "1.5.0 film settings stay fixed");
DY_ABI_ASSERT(offsetof(DYUniforms, filmFrameKey) == 1284, "1.5.0 frozen frame key stays fixed");
DY_ABI_ASSERT(offsetof(DYUniforms, filmPrint) == 1296, "complete 1.5.0 prefix stays fixed");
DY_ABI_ASSERT(sizeof(DYUniforms) == 1312, "1.6.0 uniform size");
DY_ABI_ASSERT(offsetof(DYUniforms, lensSectionEnabled) == 1312, "complete 1.10 prefix stays fixed");
DY_ABI_ASSERT(sizeof(DYUniforms) == 1344, "1.11 append-only extension size");
DY_ABI_ASSERT(offsetof(DYUniforms, exposure) == 0, "exposure offset");
DY_ABI_ASSERT(offsetof(DYUniforms, contrast) == 4, "contrast offset");
DY_ABI_ASSERT(offsetof(DYUniforms, highlights) == 8, "highlights offset");
@@ -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 toolCount=DYToolTypes().count;NSInteger cap=MAX(1,MIN(toolCount,(NSInteger)floor((v.size.height-72*s)/(30*s))));if(cap<toolCount)cap=MAX(1,MIN(toolCount-1,(NSInteger)floor((v.size.height-96*s)/(30*s))));NSInteger pages=(toolCount+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,toolCount-_railPage*cap)+54+(pages>1?24:0))*s);
NSArray*titles=@[@"一级",@"蜘蛛",@"基础",@"肤色",@"LUT",@"HSL",@"曲线",@"分级",@"原色",@"色阶",@"黑白",@"平衡",@"通道",@"胶片",@"畸变"];
for(NSInteger j=0;j<cap&&j+_railPage*cap<toolCount;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;}
[_bridge requestTool:type];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-all-tools-without-a-parameter-panel",vertical&&types.count==DYToolTypes().count&&[[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]==DYToolTypes().count&&[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 @[@"hsl",@"curve",@"spider"]){click(areaFor(controls,@"tool",type));id p=panelFor(type);CGFloat px=[type isEqual:@"hsl"]?.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-curves-hsl-and-spider-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
+111
查看文件
@@ -0,0 +1,111 @@
// Methods of DYViewerParameterPanel. Geometry is shared by drawing and input.
- (BOOL)graphicKind:(NSString*)kind{return [@[@"curvePlot",@"wheel",@"hslPlot",@"spiderPlot"]containsObject:kind];}
- (NSData*)spiderData {if(_spiderDraft)return _spiderDraft;return [_nodeID hasPrefix:@"base:"]?_snapshot[@"spider"]:[self node][@"layer"][@"spider"];}
- (void)beginSpiderData {[_bridge beginSpider:[self spiderData] node:_nodeID enabled:[self graphicValue:@"spiderEnabled"] atTime:_time];}
- (void)spiderAction:(NSInteger)action {
auto mesh=DYSpiderMesh([self spiderData]);if(action==0){mesh=dy::neutralMesh(mesh.hues,mesh.rings+1);}
else if(action==3||action==4){int count=action==3?mesh.hues:mesh.rings+1;int next=count<12?12:count<24?24:6;mesh=dy::resampleMesh(mesh,action==3?next:mesh.hues,action==4?next:mesh.rings+1);_selectedSpider=-1;}
else if(_selectedSpider>=0&&_selectedSpider<dy::meshCount(mesh)){if(action==1)mesh.pins[_selectedSpider]=dy::meshBoundary(mesh,(int)_selectedSpider)||!mesh.pins[_selectedSpider];else {auto neutral=dy::neutralMesh(mesh.hues,mesh.rings+1);mesh.x[_selectedSpider]=neutral.x[_selectedSpider];mesh.y[_selectedSpider]=neutral.y[_selectedSpider];}}
else return;
[self beginSpiderData];[_bridge changeSpider:[NSData dataWithBytes:&mesh length:sizeof(mesh)]];[_bridge endGesture];
}
- (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:@"hsl"]){
for(NSInteger axis=0;axis<3;axis++)[self addArea:NSMakeRect(x+12*s+axis*(w-24*s)/3,y,(w-30*s)/3,23*s)part:22210+axis kind:@"hslAxis" title:@[@"色相",@"饱和度",@"明亮度"][axis]descriptor:nil index:axis];
[self addArea:NSMakeRect(x+18*s,y+34*s,w-36*s,MAX(40*s,NSMaxY(_panel)-y-85*s))part:22200 kind:@"hslPlot" title:@"" descriptor:nil index:0];
}else if([_toolType isEqual:@"spider"]){
CGFloat d=MAX(30*s,MIN(w-36*s,NSMaxY(_panel)-y-67*s));[self addArea:NSMakeRect(x+(w-d)/2,y,d,d)part:22300 kind:@"spiderPlot" title:@"" descriptor:nil index:0];
auto mesh=DYSpiderMesh([self spiderData]);NSArray *titles=@[@"全盘还原",@"固定点",@"还原点",[NSString stringWithFormat:@"色相 %d",mesh.hues],[NSString stringWithFormat:@"环数 %d",mesh.rings+1]];
for(NSInteger i=0;i<5;i++)[self addArea:NSMakeRect(x+8*s+i*(w-16*s)/5,NSMaxY(_panel)-53*s,(w-20*s)/5,23*s)part:22310+i kind:@"spiderAction" title:titles[i] descriptor:nil index:i];
}else 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:@"hslPlot"]){
[NSGraphicsContext saveGraphicsState];NSRectClip(r);[[ink colorWithAlphaComponent:.18]setStroke];NSBezierPath *mid=[NSBezierPath bezierPath];[mid moveToPoint:NSMakePoint(NSMinX(r),NSMidY(r))];[mid lineToPoint:NSMakePoint(NSMaxX(r),NSMidY(r))];[mid stroke];
NSBezierPath *curve=[NSBezierPath bezierPath];curve.lineWidth=1.5*s;
for(int i=0;i<8;i++){double v=[self graphicValue:[NSString stringWithFormat:@"hsl%ld_%d",(long)_hslAxis,i]];CGFloat xx=NSMinX(r)+(i+.5)*r.size.width/8,yy=NSMidY(r)-v/200*r.size.height;NSPoint point=NSMakePoint(xx,yy);if(i==0)[curve moveToPoint:point];else[curve lineToPoint:point];}
[accent setStroke];[curve stroke];
for(int i=0;i<8;i++){double v=[self graphicValue:[NSString stringWithFormat:@"hsl%ld_%d",(long)_hslAxis,i]];CGFloat xx=NSMinX(r)+(i+.5)*r.size.width/8,yy=NSMidY(r)-v/200*r.size.height;NSColor *c=[NSColor colorWithHue:i/8. saturation:.7 brightness:.95 alpha:.9];[c setFill];[[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(xx-5*s,yy-5*s,10*s,10*s)]fill];[self text:[NSString stringWithFormat:@"%.0f",v]rect:NSMakeRect(xx-15*s,MIN(NSMaxY(r)-15*s,yy+7*s),30*s,15*s)size:8 color:ink alignment:NSTextAlignmentCenter];}
[NSGraphicsContext restoreGraphicsState];[self text:@"红 橙 黄 绿 青 蓝 紫 洋红" rect:NSMakeRect(r.origin.x,NSMaxY(r)+3*s,r.size.width,15*s)size:9 color:ink alignment:NSTextAlignmentCenter];return;
}
if([area[@"kind"]isEqual:@"spiderPlot"]){
auto mesh=DYSpiderMesh([self spiderData]);CGFloat rad=r.size.width/2;NSPoint center=NSMakePoint(NSMidX(r),NSMidY(r));
for(int i=0;i<64;i++){double a=i*2*M_PI/64,b=(i+1)*2*M_PI/64;NSBezierPath *wedge=[NSBezierPath bezierPath];[wedge moveToPoint:center];[wedge lineToPoint:NSMakePoint(center.x+cos(a)*rad,center.y+sin(a)*rad)];[wedge lineToPoint:NSMakePoint(center.x+cos(b)*rad,center.y+sin(b)*rad)];[wedge closePath];[[NSColor colorWithHue:i/64. saturation:.8 brightness:.8 alpha:.24]setFill];[wedge fill];}
auto point=[&](int i){return NSMakePoint(r.origin.x+mesh.x[i]*r.size.width,r.origin.y+mesh.y[i]*r.size.height);};NSBezierPath *net=[NSBezierPath bezierPath];net.lineWidth=.6*s;
for(int ring=1;ring<=mesh.rings;ring++)for(int hue=0;hue<=mesh.hues;hue++){NSPoint q=point(dy::meshIndex(mesh,hue%mesh.hues,ring));if(hue==0)[net moveToPoint:q];else[net lineToPoint:q];}
for(int hue=0;hue<mesh.hues;hue++){[net moveToPoint:point(dy::meshCount(mesh)-1)];for(int ring=1;ring<=mesh.rings;ring++)[net lineToPoint:point(dy::meshIndex(mesh,hue,ring))];}
[[ink colorWithAlphaComponent:.5]setStroke];[net stroke];
for(int i=0;i<dy::meshCount(mesh);i++){NSPoint q=point(i);CGFloat rr=(i==_selectedSpider?4:2)*s;[(i==_selectedSpider?accent:ink)setFill];[[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(q.x-rr,q.y-rr,2*rr,2*rr)]fill];if(mesh.pins[i]){[NSColor.blackColor setFill];NSRectFill(NSMakeRect(q.x-s,q.y-s,2*s,2*s));}}return;
}
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;
}
[[ink colorWithAlphaComponent:.06]setFill];[[NSBezierPath bezierPathWithRect:r]fill];[NSGraphicsContext saveGraphicsState];NSRectClip(r);
NSData *rawHistogram=_snapshot[@"histogram"];const DYHistogram *hist=rawHistogram.length==sizeof(DYHistogram)?(const DYHistogram*)rawHistogram.bytes:nullptr;
if(hist&&hist->samples){uint32_t peak=1;for(int c=0;c<4;c++)if(_channel==0||c==_channel)for(int b=0;b<256;b++)peak=MAX(peak,hist->bins[c][b]);NSArray *colors=@[ink,NSColor.systemRedColor,NSColor.systemGreenColor,NSColor.systemBlueColor];for(int c=3;c>=0;c--){if(_channel&&c!=_channel)continue;NSBezierPath *area=[NSBezierPath bezierPath];[area moveToPoint:NSMakePoint(NSMinX(r),NSMaxY(r))];for(int b=0;b<256;b++)[area lineToPoint:NSMakePoint(NSMinX(r)+b/255.*r.size.width,NSMaxY(r)-sqrt(hist->bins[c][b]/double(peak))*r.size.height*.86)];[area lineToPoint:NSMakePoint(NSMaxX(r),NSMaxY(r))];[area closePath];[[colors[c]colorWithAlphaComponent:c==0?.08:.2]setFill];[area fill];}}
[[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:@"spiderPlot"]){auto mesh=DYSpiderMesh([self spiderData]);double best=12*_scale;NSInteger chosen=-1;for(int i=0;i<dy::meshCount(mesh);i++){double distance=hypot(p.x-(r.origin.x+mesh.x[i]*r.size.width),p.y-(r.origin.y+mesh.y[i]*r.size.height));if(distance<best){best=distance;chosen=i;}}if(chosen<0)return;_selectedSpider=chosen;c[@"meshStart"]=[NSData dataWithBytes:&mesh length:sizeof(mesh)];[_captured release];_captured=[c copy];[self beginSpiderData];return;}
if([c[@"kind"]isEqual:@"hslPlot"]){NSInteger color=MAX(0,MIN(7,(NSInteger)((p.x-r.origin.x)/r.size.width*8)));NSString *key=[NSString stringWithFormat:@"hsl%ld_%ld",(long)_hslAxis,(long)color];c[@"hslKey"]=key;[_captured release];_captured=[c copy];[_bridge beginParameter:[self descriptorForKey:key]node:_nodeID value:[self graphicValue:key]atTime:_time];return;}
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{
if([_captured[@"kind"]isEqual:@"spiderPlot"]){NSData *start=_captured[@"meshStart"];if(!start||_selectedSpider<0)return;NSRect r=[_captured[@"rect"]rectValue];auto mesh=DYSpiderMesh(start);std::bitset<dy::SpiderMeshCapacity> selected;selected[_selectedSpider]=true;auto moved=dy::moveMesh(mesh,selected,(p.x-_down.x)/r.size.width,(p.y-_down.y)/r.size.height);[_spiderDraft release];_spiderDraft=[[NSData alloc]initWithBytes:&moved length:sizeof(moved)];[_bridge changeSpider:_spiderDraft];return;}
if([_captured[@"kind"]isEqual:@"hslPlot"]){NSString *key=_captured[@"hslKey"];if(!key)return;NSRect r=[_captured[@"rect"]rectValue];double v=MAX(-100.,MIN(100.,(NSMidY(r)-p.y)/r.size.height*200));_draftValues[key]=@(v);[_bridge changeValue:v];return;}
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,323 @@
#include "DYSpiderState.h"
#import "DYHistogram.h"
// 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;
- (void)requestTool:(NSString*)type;
- (void)publishAssets:(DYAssetState*)assets histogram:(NSData*)histogram atTime:(CMTime)time;
- (void)beginSpider:(NSData*)mesh node:(NSString*)node enabled:(double)enabled atTime:(CMTime)time;
- (void)changeSpider:(NSData*)mesh;
- (void)publishHistogram:(NSData*)histogram atTime:(CMTime)time;
@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,_writerSpider; NSData *_writerLastMesh;
}
- (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)publishAssets:(DYAssetState*)assets histogram:(NSData*)histogram atTime:(CMTime)time {
@synchronized(self){if(_invalidated||!_snapshot||CMTimeCompare(time,_snapshotTime)!=0)return;NSMutableDictionary *next=[[_snapshot mutableCopy]autorelease];next[@"spider"]=assets.spiderMesh?:[NSData data];if(histogram)next[@"histogram"]=histogram;[_snapshot release];_snapshot=[next copy];}
}
- (void)publishHistogram:(NSData*)histogram atTime:(CMTime)time {
if(histogram.length!=sizeof(DYHistogram))return;@synchronized(self){if(_invalidated||!_snapshot||CMTimeCompare(time,_snapshotTime)!=0)return;NSMutableDictionary *next=[[_snapshot mutableCopy]autorelease];next[@"histogram"]=histogram;[_snapshot release];_snapshot=[next copy];}
}
- (void)requestTool:(NSString*)type {
if(![DYToolTypes()containsObject:type])return;
dispatch_async(dispatch_get_main_queue(),^{id manager=nil;@synchronized(self){if(!self->_invalidated)manager=self->_apiManager;}if(manager)[NSNotificationCenter.defaultCenter postNotificationName:@"DYViewerToolRequested" object:manager userInfo:@{@"type":type}];});
}
- (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){
NSData *sameHistogram=CMTimeCompare(_snapshotTime,time)==0?[_snapshot[@"histogram"]retain]:nil;
[_snapshot release];_snapshot=[@{@"uniforms":bytes,@"document":frozen,@"timeValue":@(time.value),@"timeScale":@(time.timescale),@"timeEpoch":@(time.epoch)}copy];
if(sameHistogram){NSMutableDictionary *withHistogram=[[_snapshot mutableCopy]autorelease];withHistogram[@"histogram"]=sameHistogram;[_snapshot release];_snapshot=[withHistogram copy];[sameHistogram release];}
[_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;_writerSpider=NO;[_writerLastMesh release];_writerLastMesh=nil;_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;
if(_writerSpider){NSData *current=DYReadAssets(_writerTarget,_writerTime).spiderMesh?:[NSData data];if(![current isEqual:_writerLastMesh])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)beginSpider:(NSData*)mesh node:(NSString*)node enabled:(double)enabled atTime:(CMTime)time {
if(mesh.length&&!DYSpiderMeshIsValid(mesh))return;NSDictionary *descriptor=nil;for(NSDictionary*d in DYDescriptors())if([d[@"key"]isEqual:@"spiderEnabled"])descriptor=d;
if(!descriptor)return;[self beginParameter:descriptor node:node value:enabled atTime:time];uint64_t gesture;@synchronized(self){gesture=_requestedGesture;}NSData *original=[mesh copy]?:[NSData new];
dispatch_async(dispatch_get_main_queue(),^{if(self->_writerGesture==gesture&&[self->_writerType isEqual:@"spider"]){self->_writerSpider=YES;self->_writerLastMesh=[original copy];if(![self writerStillValid])[self closeWriter];}});[original release];
}
- (void)changeSpider:(NSData*)mesh {
if(!DYSpiderMeshIsValid(mesh))return;NSData *frozen=[mesh copy];uint64_t gesture;@synchronized(self){gesture=_invalidated?0:_requestedGesture;}
if(gesture)dispatch_async(dispatch_get_main_queue(),^{
if(self->_writerGesture!=gesture||!self->_writerSpider)return;
if(![self writerStillValid]){[self closeWriter];return;}
if([frozen isEqual:self->_writerLastMesh])return;
id<FxCustomParameterActionAPI_v4>a=[self->_writerTarget apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];BOOL changed=NO,failed=NO;
[a startAction:self];@try{
if(!CMTIME_IS_NUMERIC(a.currentTime)||CMTimeCompare(a.currentTime,self->_writerTime)!=0||![self writerValueMatches]){failed=YES;}
else{
if(!self->_writerUndoOpen)self->_writerUndoOpen=[[self->_writerHost apiForProtocol:@protocol(FxUndoAPI)]startUndoGroup:@"画面调整 · 蜘蛛盘"];
if(self->_writerUndoOpen){DYAssetState *old=DYReadAssets(self->_writerTarget,self->_writerTime);DYAssetState *next=[[old copy]autorelease];next.spiderMesh=frozen;
failed=!DYWriteAssets(self->_writerTarget,next,self->_writerTime);
if(failed)DYWriteAssets(self->_writerTarget,old,self->_writerTime);else changed=YES;
}
}
}@finally{[a endAction:self];}
// Re-read after DYToolManager commits its document at the outer boundary.
if(changed){[a startAction:self];NSData *actual=nil;@try{actual=[DYReadAssets(self->_writerTarget,self->_writerTime).spiderMesh retain];}@finally{[a endAction:self];}BOOL saved=[actual isEqual:frozen];[actual release];if(!saved)failed=YES;else{[self->_writerLastMesh release];self->_writerLastMesh=[frozen copy];[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];}}
if(failed)[self closeWriter];
});[frozen 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,158 @@
// 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,_hslAxis,_selectedSpider;NSData *_spiderDraft;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;_selectedSpider=-1;_draftValues=[NSMutableDictionary new];_time=_downTime=kCMTimeInvalid;}return self;}
- (void)dealloc{if(_pressed)[_bridge endGesture];[_bridge release];[_spiderDraft 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;[_spiderDraft release];_spiderDraft=nil;[_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&&([@[@"curve",@"grading",@"hsl",@"spider"]containsObject:type]);
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([@[@"curve",@"grading",@"hsl",@"spider"]containsObject:type])[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];BOOL solid=NSWorkspace.sharedWorkspace.accessibilityDisplayShouldReduceTransparency;
[[DYThemeColor(@"surface")?:DYThemeColor(@"background")?:NSColor.blackColor colorWithAlphaComponent:solid?1:.66]setFill];[panel fill];[[ink colorWithAlphaComponent:.32]setStroke];panel.lineWidth=s;[panel stroke];
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([self graphicKind:kind]){[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:@"hslAxis"]&&[a[@"index"]integerValue]==_hslAxis))||([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(_graphMode&&[_toolType isEqual:@"hsl"])hint=@"拖动色点 · 参数精调";if(_graphMode&&[_toolType isEqual:@"spider"])hint=@"拖点联动 · 固定与还原选中点";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:@"hslAxis"]){_hslAxis=[a[@"index"]integerValue];return;}if([kind hasPrefix:@"spiderAction"]){[self spiderAction:[a[@"index"]integerValue]];return;}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([self graphicKind:_captured[@"kind"]]){[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&&([self graphicKind:_captured[@"kind"]]))[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=[self graphicKind:_captured[@"kind"]];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;[_spiderDraft release];_spiderDraft=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,51 @@
#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)publishAssets:(DYAssetState*)assets histogram:(NSData*)histogram atTime:(CMTime)time;
- (void)publishHistogram:(NSData*)histogram atTime:(CMTime)time;
- (void)beginSpider:(NSData*)mesh node:(NSString*)node enabled:(double)enabled atTime:(CMTime)time;
- (void)changeSpider:(NSData*)mesh;
- (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.11.0</string>
<key>CFBundleVersion</key>
<string>67</string>
<string>73</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.11.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.11.0</string>
<key>CFBundleVersion</key>
<string>67</string>
<string>73</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
+24
查看文件
@@ -1,3 +1,25 @@
# 2026-11-04 画布工具与辅助工作区:1.10.0(72)验收完成
下一阶段完善自定控件,先读[自定控件开发交接](/Volumes/备份/大鱼调色/大鱼调色/自定控件开发交接.md)。该文件集中说明当前代码、尚未补齐的专用图形和后续验证方式;本文件保留完整产品交付与历史。
当前正式安装 **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` 已推送并回读,完整提交 `c0e6f3be0afc310125d2d045a96655db7524f24b`。Git Release387/附件31已上传草稿;草稿下载需要浏览器登录,而CUA因当前页面URL访问限制终止会话,未绕过限制、未发布Release。当前 `verification/Release.json` 与 `CMSReleaseDraft.json` 如实记录下载核验阻塞。原文章的下载包已另行完整下载校验通过,不能用它冒充Release附件下载证明。标签包含最终Package.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`;独立远程版本标签已核对源码、Git完整性、文章和三张素材哈希,实际编译源码未变;恢复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 +55,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,不移动既有标签。
+163
查看文件
@@ -0,0 +1,163 @@
# 大鱼调色自定控件开发交接
更新日期:2026-11-05,Asia/Shanghai。
## 本轮 1.11.0(73)交付状态
本轮已实现曲线直方图、HSL八色三轴、蜘蛛网格的半透明画布编辑;主检查器默认只显示一级、蜘蛛、基础、HSL四张折叠卡,其它模块由添加菜单或画布入口显示。已有非默认调色和蒙版自动保留为可见模块。全部还原也恢复四卡折叠布局。
肤色保护增加默认开启的人脸限定和“显示肤色保护区域”,使用当前帧 Vision revision3/76点、人脸轮廓、额头及五官排除,并与原色选及用户蒙版相乘;灰度显示实际保护权重。无脸与失败帧为空,不沿用上一镜头。基础与UUID独立层均支持。参考FCP-BeautyGirl的思路与MIT许可见research/FCPBeautyGirl-MIT.txt。
新增“镜头畸变修复”工具,支持正反径向校正、缩放与光学中心,接入独立层、蒙版、预设和撤销。其采样由本项目独立编写,尚无目标GPU逐像素等价证明。人脸选区和镜头修复不能导出到静态Cube,完整预设可保存。
APP正式编译SHA `49d35cb49ab93f5ab6ca3411eaea80f7219be346`,Apple公证 `348c6e9b-f5d9-4661-bc7f-f192fa770ecf` Accepted,票据/Gatekeeper/唯一位置安装及724项正式安装自检通过。用户已实鼠确认画布/肤色/畸变“三项均正常”,详见verification/HostCanvasTools1.11.0.json。交付脚本已完成,Delivery为 **verified**;旧版恢复APP已清理,交付锁已释放。PKG容器签名、公证Accepted、票据及20项展开验包通过,保存在上级发行包目录,见verification/Package.json。Release最终发布及下载核验见verification/Release.json。
FCP 12.4已成功导入三个验收项目,无导入错误;实际主检查器四张折叠卡与图像已观察到,服务进程使用正式安装路径。事件“大鱼调色_1.11.0_73_画布与空间工具”。工具 `tools/create_canvas_host_fixture.py` 可重建FCPXML、两项测试预设与网格;真人fixture随源码保存于tools/fixtures,仅用于验收。静态DTD/素材检查通过不等于鼠标功能验收。
新增代码入口:DYFaceRender.inc.h(Vision与镜头渲染),DYCanvasToolsDiagnostics.inc.h(新增29项回归),DYToolGPU.h(人脸覆盖元数据),DYGrade.metal及tools/build_masked_kernel.py(实际肤色选区输出)。旧Uniform完整1312字节前缀不变,仅追加32字节;旧参数ID和预设v7不变。蜘蛛写入使用DYViewerParameterBridge的beginSpider/changeSpider,必须保持冲突检查和一次撤销。
AddressSanitizer完整724项无内存错误,插桩下唯一旧性能阈值失败;正常Release全部通过。修复旧渲染C++引用捕获向异步通知泄漏self栈地址的问题,通知必须通过独立Objective-C方法调度,避免恢复旧写法。
源码和阶段记录已持续推送;实际编译SHA从远端独立恢复549个文件逐字节一致、full/strict fsck及模板合同验证通过。最新明细见research/CanvasTools-20261105.md及verification/CanvasSourceRecovery1.11.0.json。旧1.10.0 Release387草稿不属于本轮新发行,保持原状。
## 以下为1.10.0基线交接
更新日期:2026-11-04,Asia/Shanghai。下一阶段继续完善「大鱼调色」的画布自定控件与画布外辅助工作区。当前正式版本为 **1.10.0(72)**,曲线拖点与一次撤销、LUT 预览、示波器随播放头更新已由用户实鼠确认。后续可以在这个版本上继续开发。
当前十四个工具都有画布入口,专用图形编辑已覆盖曲线和颜色分级;其它工具主要通过通用参数面板调整。下一阶段的具体控件样式和功能范围尚未确定,下文将现有能力、实现约定与建议顺序分别说明。本次交接只新增文档,不修改插件功能、版本或线上文章。
## 工程与版本基线
| 项目 | 当前记录 |
| --- | --- |
| 工程根目录 | `/Volumes/备份/大鱼调色/大鱼调色`,不是上一级同名目录 |
| 工程与方案 | `大鱼调色.xcodeproj`,`Wrapper Application`,Release |
| 技术 | AppKit、Objective-C++、FxPlug 4、Metal;现有工程不以 SwiftUI 实现控件 |
| 仓库 | <https://dayu.media/git/dayu/dayu-color.git>,分支 `main`;保持已有仓库可见性 |
| 交接前 main | `302b75710b24c52e7c535faa1a5cf92790359272`;交接文档另作后续提交 |
| 正式 APP 实际编译源码 | `80dec904bedf5f704b29d16325fa95d639f3a250`;后续提交为文档、验证和发布记录 |
| 版本标签 | `v1.10.0-canvas-workspace-20261104` → `c0e6f3be0afc310125d2d045a96655db7524f24b`,已推送并独立恢复核验 |
| 唯一正式安装 | `/Library/Plug-Ins/FxPlug/大鱼调色.app`,1.10.0(72) |
| 产品身份 | 主 Bundle ID `com.dayu.color`;内嵌服务 `com.dayu.color.XPC` |
| 固定构建缓存 | `/Users/mac/Library/Caches/CodexBuilds/com.dayu.color`,其中 `DerivedData` 用于 Release 构建 |
| 产品交付锁 | `/Users/mac/.codex/app-delivery-locks/com.dayu.color.lock`;本次交接读取时未占用 |
| 构建与宿主基线 | Xcode 27.1、FxPlug SDK 4.3.5;Apple Silicon、macOS 14.6+;已验收宿主 FCP 12.4 |
接手时先盘点工作区、分支、远程引用和产品锁,再修改明确属于本任务的文件。保留完整 Git 历史和既有标签;不要在源码提交中保存密码、令牌或签名私钥。
## 用户已经明确的交互方向
- 画布侧边使用纵向工具排列,工具入口需要直接可见。
- 曲线等图形控件可以叠在画面上,调整应直接作用于画布里的控件。
- 工具面板能够拖动位置;可同时打开多个不同工具,保留现有检查器作为参数入口。
- 画布外需要独立组件承载示波器、LUT 预览等,可参考 Color Finale 的内外分工。
- 保留现有浅色、深色两种模式。界面主题、面板位置等显示状态与调色数据分开。
- mFilmLook 和 Color Finale 作为交互参考;产品中的控件由本项目独立实现。
此前“只有一个基础调色”“整个面板不能拖动”对应 69 及更早阶段。70 已加入面板移动与十四工具切换,用户确认正常;随后根据新要求发展为 72 的纵向工具条和独立工作区。继续开发应以 72 为起点。历史过程见[屏幕控件研究](/Volumes/备份/大鱼调色/大鱼调色/research/mFilmLookOSC-20261104.md)与[工作区实现说明](/Volumes/备份/大鱼调色/大鱼调色/research/ViewerWorkspace-20261104.md)。
## 当前控件的实际能力
| 区域 | 已有能力 | 继续开发时需要知道的边界 |
| --- | --- | --- |
| 纵向工具条 | 一级、蜘蛛、基础、肤色、LUT、HSL、曲线、分级、原色、色阶、黑白、平衡、通道、胶片;小画布分页;工作区入口和收起面板 | 工具条锚定图像可见区域左侧;同一工具按钮再次点击会关闭并移除其面板 |
| 浮动面板 | 标题点击折叠、拖动移动、关闭、置顶;同类图层选择;参数分页 | 每个工具类型最多一个浮动面板;同类独立层通过图层菜单切换。位置只存在于当前面板对象,未实现关闭重建或重启后恢复布局 |
| 曲线 | RGB/红/绿/蓝切换,选点、加点、拖点、删除点,图形和参数页切换 | 使用已有有限参数槽,不是无限点曲线;固定端点另行绘制 |
| 颜色分级 | 阴影、中间调、高光、全局四个色轮;图形和参数页切换 | 画布色轮直接修改色相与饱和度,其它分级参数继续使用参数页 |
| 通用参数 | 已公开参数的滑杆、开关、循环选项、单项复位和数值显示 | 当前画布数值显示不是完整文本输入框;选项主要通过点击循环。并未自动覆盖检查器里的资产选择、蜘蛛网格等全部自定义操作 |
| 画布外工作区 | FxRemoteWindow 宿主窗口,亮度波形、RGB 分列、直方图,风格1 LUT 浏览与真实帧预览 | LUT 页目标为当前 manager 对应的 `look0`,即风格1;不是任意 LUT 槽或任意浮动面板图层选择器 |
十四工具类型顺序来自 `DYToolTypes()`:`primary, spider, base, skin, look, hsl, curve, grading, primaries, levels, blackwhite, balance, mixer, film`。工具条名称与类型顺序需要同步维护。
## 代码入口
下表文件均在本工程内。多数 `*.inc.h` 是在 `.mm` 中展开的实现片段,不能当作独立编译单元重复加入目标。
| 要完善的部分 | 文件 | 主要入口 |
| --- | --- | --- |
| FxPlug 画布坐标、绘制、命中及输入路由 | [DYToolOSC.inc.h](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYToolOSC.inc.h) | `DYToolOSC`,`drawOSC`、`partAtPoint:`、鼠标回调;同时保留原蒙版与钢笔路由 |
| 纵向工具条、面板开关、置顶与捕获 | [DYViewerControls.inc.h](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYViewerControls.inc.h) | `prepareWithSize:scale:atTime:`、`activateTool:`、`event:point:atTime:` |
| 浮动面板布局、图层目录、滑杆和标题拖动 | [DYViewerParameterPanel.inc.h](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYViewerParameterPanel.inc.h) | `prepareWithSize:`、`clickArea:`、`movePanelToPointer:`、`finishCapture` |
| 曲线与四个色轮的图形交互 | [DYViewerGraphics.inc.h](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYViewerGraphics.inc.h) | `curveSlots`、`layoutGraphicAt:`、`drawGraphic:`、`beginGraphicAt:`、`updateGraphicAt:` |
| 快照、主队列写回、撤销与冲突保护 | [DYViewerParameterBridge.inc.h](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYViewerParameterBridge.inc.h) | `publishUniforms:`、`snapshotAtTime:`、`beginParameters:`、`changeValues:`、`endGesture`、`invalidate` |
| 插件发布快照及采集最终输出 | [DYPlugIn.mm](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYPlugIn.mm) | `pluginState:atTime:` 发布 uniforms/工具文档;成功渲染后调用 `captureScopeTile:atTime:` |
| OSC 与插件实例绑定 | [DYToolHostMethods.inc.h](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYToolHostMethods.inc.h) | `initializeToolHost`、`tearDownToolHost`、`scheduleToolCanvasRegistration`、`viewerParameterBridge` |
| 检查器、工作区按钮及现有原生图形控件 | [DYInspector.mm](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYInspector.mm) | `openWorkspace:`;`DYCurvePanel`、`DYColorWheel`、`DYWheelPanel`;原图形手势接口 |
| 蜘蛛盘的现有原生实现 | [DYSpiderDisc.inc.h](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYSpiderDisc.inc.h) | `DYSpiderPanel`;网格状态另见 `DYSpiderState.h` 与 `SpiderCore/` |
| 画布外窗口和 LUT 应用 | [DYColorWorkspace.mm](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYColorWorkspace.mm) | `showRelativeToView:`、`layoutWorkspace`、`pageChanged:`、`selectionContextAtTime:`、`selectLUT:`、`commitLUT:expected:error:`、`close` |
| 示波器采样与异步统计 | [DYScopeCapture.inc.h](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYScopeCapture.inc.h) | `setScopeEnabled:`、`captureScopeTile:atTime:`、`processPendingScopeSamples`;统计和 GPU 采样见 `DYScopeMath.hpp`、`DYScopeSample.mm` |
| 参数定义与独立图层 | [DYModel.mm](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYModel.mm)、[DYToolState.mm](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYToolState.mm) | `DYDescriptors()`、`DYSections()`、`DYToolTypes()`、`DYToolDisplayOrder()`、`DYToolManager` |
| 深浅模式与控件表面绘制 | [DYTheme.mm](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYTheme.mm) | `DYThemeColor`、`DYDrawThemeSurface`、`DYDrawSoftControl`;尽量复用现有主题能力 |
画布侧基本链路为:宿主 OSC 输入 → `DYToolOSC` → `DYViewerControls` → 对应 `DYViewerParameterPanel`/图形方法 → `DYViewerParameterBridge` → 主队列宿主 action → 原参数或稳定 UUID 对应的 `DYToolManager`。渲染状态再通过快照回到面板。外部工作区通过绑定 manager 的通知打开,由检查器管理生命周期。
## 新控件必须保留的交互约定
**坐标与命中。** 布局以真实 OBJECT→CANVAS 图像矩形和画布的交集为准。绘制、命中、拖动应共用几何数据;控件在宿主黑边能画出来不代表能接收鼠标。工具条绘制与命中优先,面板逆序命中,按下面板后置顶。原有蒙版和钢笔仍从同一 OSC 根路由。
**捕获与释放。** 按下记录目标、时间、起点和原值;超过 `2 × scale` 的位移后进入拖动。滑杆或图形捕获后,移出轨道继续处理,松开补算最终位置并结束手势。普通按钮在原命中区释放才触发;拖标题后松开不能再折叠面板。`mouseExited` 清悬停,不直接中止仍捕获的拖动。
**线程与快照。** OSC 回调读取当前帧的不可变快照,不同步等待主队列,也不直接改宿主模型。`snapshotAtTime:` 只返回同一时间的快照;缺帧时保留原 UUID 选择并暂缓编辑。主队列写入前复核当前时间、目标节点、原值和关联开关;发现外部修改或目标消失时结束手势,保留最新外部设置。
**多字段写入与撤销。** 曲线 X/Y、色轮 H/S 通过 `beginParameters:` 和完整 `changeValues:` 成组提交,放在同一次宿主 action 内;一次手势只打开一个撤销组。不要拆成两个单字段手势。宿主拒绝写入时尝试还原受影响字段并结束该组;宿主 API 没有 `abortAction`。单击开关、复位和删除点也需完整收尾。空闲面板不能结束另一面板的共享写入手势。
**参数与显示状态。** 面板移动、开合、置顶、分页、通道切换只改变显示状态,不写调色参数、不制造撤销项。基础层使用 `base:<type>`;独立层使用真实 UUID,不能按面板下标或当前列表序号写参数。保留参数 ID、uniform 布局、预设 v7、CMS nil/v2/v3 的既有兼容约定;本轮图形扩展优先连接现有数据。
**生命周期。** 播放头变化、插件或面板销毁、manager 失效时必须结束捕获并关闭撤销组。异步操作使用序号/会话校验,关闭窗口后不得继续提交。项目使用手动内存管理,新增 retain/release 和异步 block 时沿用现有生命周期处理。
## 曲线和色轮的参数映射
曲线显示输出值为 `output = x + curveY × 0.01`;拖点写回 `curveY = (output - x) × 100`。`curveY` 保存的是相对对角线偏移,不能直接填绝对输出值。RGB 主曲线为4个基础槽加4个额外槽,单色通道为2个基础槽加4个额外槽;`x < 0` 表示未启用槽,删除点写 `x = -1, y = 0`。绘制使用与现有编辑器一致的单调 Hermite 插值和固定首尾端点。
色轮使用 `grade{i}_0` 表示角度制色相、`grade{i}_1` 表示0–100饱和度,`i = 0..3` 分别为阴影、中间调、高光、全局。画布坐标 Y 轴与色轮数学坐标方向相反,新增圆盘控件时需要同时核对绘制和输入变换。
蜘蛛网格属于自定义资产/图层数据,不能直接套用当前 float 描述符桥接。若将蜘蛛盘搬入画布,应先明确基础层 `DYAssetState.spiderMesh` 与独立层 `spider` 数据的目标路由,再扩展安全写入通道、冲突检测和一次撤销。
## 外部工作区的约定
工作区由 FxRemoteWindow 托管并绑定当前插件实例;`DYColorWorkspaceRequested` 通知的 object 是对应 manager。LUT 异步准备完成后检查播放头、原风格1选择、全局颜色管理及目标图层是否仍有效,且在 `DYToolManager` 结束 action 后回读真实保存结果。关闭窗口要取消准备并关闭示波器采样。
工作区示波器采样**当前效果的处理输出**,不含后续其它效果或宿主显示转换。320×180 采样在已知 ICC 配置下转扩展 sRGB;空间未知时明确显示宿主 RGB 原值参考。波形、RGB 分列、直方图属于显示参考,不替代 HDR/IRE 精密测量。宿主仅提供分块时须保留分块标注。
`DYScopeCapture.inc.h` 与原 `_renderer histogram` 分开:后者属于较早的分析/曲线参考缓存,不能直接拿来充当最终输出示波器。宿主输出纹理可能在 render 返回后被复用,因此小幅 GPU 读回在其所有权仍有效时完成;CPU 颜色转换和统计放在后台队列,待处理帧合并为最新帧。
71 曾出现绘图区越界覆盖工作区顶栏,72 已加入根视图、面板裁剪和顶栏位图回归。修改工作区布局时保留这些检查,特别核对窗口缩放和大片 dirty rect 重绘。
## 建议的后续开发顺序
以下是接手建议,具体工具及样式以用户下一次要求为准。
1. 先确定要完善的一个工具,检查其在原检查器里的现有实现与数据结构。蜘蛛盘、HSL 等尚无专用画布图形,可作为后续候选;不要把十四个入口当作十四套图形控件均已完成。
2. 在现有画布框架内实现该工具的布局、绘制和命中。保留通用参数页作为精确参数入口;若新增数值输入、菜单、键盘或修饰键操作,补齐焦点、宿主快捷键和钢笔工具之间的路由约定。
3. 连接真实参数或自定义资产,覆盖基础层与独立 UUID 层,验证一次撤销/重做和检查器同步。需要修改多项数据时成组提交。
4. 再完善多面板布局、面板位置恢复或同类多图层同时显示。这些会改变当前“一类型一面板”的行为,需独立设计;纯显示布局不要进入调色预设和撤销历史。
5. 逐项检查浅深两种模式、窄画布、不同缩放、面板重叠与外窗按钮可读性。现有三项功能验收不能覆盖所有新增交互或后续视觉修改。
## 验证与正式交付
已通过的基线包括:正式安装版695项原生检查;用户实鼠的曲线拖点与一次撤销、风格1 LUT 真实预览、移动播放头后示波器更新。用户原话为“三项都正常”,见[宿主验收](/Volumes/备份/大鱼调色/大鱼调色/verification/HostWorkspace1.10.0.json)。原生检查使用真实 Metal/IOSurface 和模拟 FxPlug 宿主选择器,不能代替真实 FCP 文档操作。
新增图形控件的原生回归主要放在 [DYViewerControlsDiagnostics.inc.h](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYViewerControlsDiagnostics.inc.h);参数批量写入和冲突保护放在 [DYViewerParameterDiagnostics.inc.h](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYViewerParameterDiagnostics.inc.h);外窗、LUT 提交与越界重绘见 [DYWorkspaceDiagnostics.inc.h](/Volumes/备份/大鱼调色/大鱼调色/大鱼调色/Plugin/DYWorkspaceDiagnostics.inc.h)。这些检查由 `DYDiagnostics.mm` 集成,测试辅助协议见对应 Probe 文件。
需要重跑正式安装自检时,入口为:
```sh
'/Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit/Contents/MacOS/大鱼调色 XPC Service' --self-test
```
功能改动后的交付流程沿用 [tools/deliver.py](/Volumes/备份/大鱼调色/大鱼调色/tools/deliver.py):先保存并正常退出宿主,Release 构建、正式签名、公证 Accepted、票据验证,再替换唯一正式位置并运行正式安装自检,最后进入宿主验收。脚本会在正式安装后等待 `complete` 或 `leave`;只有真实验收通过才输入 `complete`,否则保留诊断和恢复状态。最终还需核验 PluginKit/实际宿主进程路径并清理本任务生成的多余 APP、提交 ZIP 和旧版恢复副本,不能仅凭脚本退出宣称交付完成。
新增控件至少实测:拖动与释放位置、移出控件继续捕获、一次撤销及重做、独立层目标、切换片段/播放头、拖动期间外部改值、面板开合与位置变化、工程重开、深浅模式和缩放。已有缺陷对应的回归按改动范围运行,不为纯文档修改重复构建或验收插件。
代码修改分阶段用 [tools/checkpoint.py](/Volumes/备份/大鱼调色/大鱼调色/tools/checkpoint.py) 对明确文件提交、推送并核验远程;脚本自带仓库锁,不要套同一把锁造成死锁。完整恢复、签名与打包约定见[恢复说明](/Volumes/备份/大鱼调色/大鱼调色/RECOVERY.md)。
## 已完成的发布与遗留事项
- 正式 APP 和 PKG 均已签名、公证、粘附票据并验证。PKG 位于 `/Volumes/备份/大鱼调色/发行包/大鱼调色-1.10.0.pkg`,43,090,565字节,SHA-256 `ee70461c9b2d2e0ddd78cbcb3371c3b1b36b7f0e5fc69bfccc7ac0f1a3e468d8`。PKG 通过20项展开验包,本轮未重复运行系统安装脚本。详情见 [Package.json](/Volumes/备份/大鱼调色/大鱼调色/verification/Package.json)。
- [资源文章15792](https://dayu.media/15792/)已更新为“1.10.0 紧急 UI 更新”,使用新封面和用户提供的深色、浅色两张原始截图,主下载同步新版。50元、有效会员免费及其他商业设置保留。文章图片、SEO及安装包完整下载已验证,见 [Article1.10.0.json](/Volumes/备份/大鱼调色/大鱼调色/verification/Article1.10.0.json)。发布素材在 `/Volumes/备份/大鱼调色/大鱼调色/Publishing/1.10.0/`。
- **Git Release387/附件31仍为草稿,未发布。** 安装包已上传,但草稿下载需要已登录浏览器;上一会话的电脑操作工具因当前浏览器页面 URL 访问限制终止。尚未取得该 Release 附件的完整下载证明,不可把网站文章的包下载证明替代它。后续恢复正常访问后,复用既有草稿与附件,完整下载核对上述大小和哈希,再由 `Packaging/publish_beta.py --verified-download` 完成发布与发布后再次下载核验。不要重复上传、删除旧附件或移动现有标签。当前记录见 [Release.json](/Volumes/备份/大鱼调色/大鱼调色/verification/Release.json) 与 [CMSReleaseDraft.json](/Volumes/备份/大鱼调色/大鱼调色/verification/CMSReleaseDraft.json)。
- 任务生成的70/71旧安装恢复APP、缓存生成APP、公证ZIP、验证下载副本和源码恢复 checkout 已按记录清理。源码、用户工程/QA媒体及历史发行包保留,见 [清理记录](/Volumes/备份/大鱼调色/大鱼调色/verification/WorkspacePendingCleanup1.10.0.json)。未修改 NAS 后端源码或网站自动更新清单。
## 给下一会话的接续说明
继续完善大鱼调色的画布自定控件。先读取本文件,再读取工作区研究与对应源码。基于 main 和已验收的正式1.10.0(72),保留纵向工具条、多个可拖动面板、画布内曲线/色轮及画布外示波器/LUT工作区。按用户指定工具继续补齐交互,保留参数、独立图层UUID、一次手势一次撤销和主队列安全写入。已有三项实鼠验收通过,不用退回69或70阶段。新功能仍按正式Release签名、公证、唯一安装、宿主验收、源码推送和安装包Release规则交付。上一版Release草稿的下载核验阻塞另有记录,不要宣称已发布。