比较提交
| 作者 | SHA1 | 提交日期 | |
|---|---|---|---|
|
|
23d5af7dcf | ||
|
|
0eb56aed12 | ||
|
|
7bac613f4a | ||
|
|
0b53fdcdfd | ||
|
|
38adc259e0 | ||
|
|
745aa1626e | ||
|
|
fa7ef93714 | ||
|
|
1932565ecd | ||
|
|
dbf25fe671 | ||
|
|
375761619f | ||
|
|
34162025b6 | ||
|
|
3fc32f3e19 | ||
|
|
659a8c540d | ||
|
|
cec044f124 | ||
|
|
f72aa2609d | ||
|
|
edfb74b171 | ||
|
|
bbdd47d1d7 | ||
|
|
281721bda1 | ||
|
|
827ddb8a32 | ||
|
|
dbb7ca4a99 | ||
|
|
5e94042db9 | ||
|
|
f8cc898546 | ||
|
|
6528f888af | ||
|
|
132d98c584 | ||
|
|
eb2dc311cb | ||
|
|
c2818cbb11 | ||
|
|
ac164245aa | ||
|
|
cf5a97cac9 | ||
|
|
8074444259 | ||
|
|
c2c65aaaff | ||
|
|
48b00c8579 | ||
|
|
d2bf0696bd | ||
|
|
76537da0a6 |
没有与搜索条件相匹配的文件
@@ -0,0 +1,18 @@
|
||||
大鱼调色 1.2.0(17),适用于 Apple Silicon Mac,最低 macOS 14.6。
|
||||
|
||||
- 输入还原改为大鱼 CST 的输入转换、工作空间一级调色和输出转换,曲线与色域独立选择。
|
||||
- 标题只展开/折叠,小眼睛只启用/旁路,独立保存。默认一级调色与基础调整展开,其余折叠,所有眼睛开启。
|
||||
- 保留旧工程输入 LUT/相机档位兼容;风格 LUT、编码兼容、后台加载及自动分析继续可用。
|
||||
- Cube 导出包含 CST 与一级调色;黑白新增默认 0% 混合,默认画面中性。
|
||||
- 153 项原生检查及 21 组独立 CST 像素对照通过;FCP 12.4 默认、独立开关、参数保留、Sony/ACES 选择、保存重开及风格库应用验收通过。
|
||||
|
||||
安装包包含原生 FxPlug APP 和 FCP 模板,不含用户 LUT、预设或媒体。安装前保存工作并正常退出 Final Cut Pro/Motion。APP 和 PKG 均完成正式签名、公证、票据与 Gatekeeper 核验,20 项展开验包通过;本轮未重复执行 PKG 安装。
|
||||
|
||||
版本标签:`v1.2.0-cst-fold-20261101`
|
||||
APP 实际编译源码:`48b00c85799b0226ba32aba3f2e5397aa0e509ed`
|
||||
APP 公证:`f25ae46e-92da-4470-842e-128bdb232aa8`,Accepted
|
||||
PKG 公证:`c7b97b0f-57c8-45d3-a4d7-7db8e8694487`,Accepted
|
||||
|
||||
附件:`大鱼调色-1.2.0.pkg`
|
||||
大小:13,818,397 字节
|
||||
SHA-256:`9fba4f0c1a313a6da8374b683f7e6b41af70388d7a7a180e26b9e236a9ba64a1`
|
||||
@@ -0,0 +1,20 @@
|
||||
大鱼调色 1.3.0(18),适用于 Apple Silicon Mac,最低 macOS 14.6。
|
||||
|
||||
- 输入转换、工作空间、一级调色与输出转换合并到一级调色卡片,移除四个旁路选项;眼睛统一启停。
|
||||
- 一级白平衡迁入原 CST 色轮,保留精细拖动和双击复位,并支持方向键微调。
|
||||
- 从“大鱼调色盘”移植可变蜘蛛盘,支持联动/独立 6、8、12、16、24 点数、固定点、多选、整环/整列和复位,随工程与预设保存,Cube 导出也包含蜘蛛盘。
|
||||
- 默认展开一级调色、蜘蛛盘校色仪、基础调整,其余折叠,所有眼睛打开。折叠与停用分别保存。
|
||||
- 保留旧工程、旧 LUT 和旧预设兼容。198 项正式版原生检查、25 种网格的 204,683 项数学检查通过;FCP 12.4 的键盘调整、菜单撤销/重做、网格密度、默认及保存重开验证通过。
|
||||
|
||||
FCP 自动化坐标鼠标注入未激活远程视图,因此宿主内拖动和双击未确认;原生 AppKit 事件检查已覆盖精细拖动、复位和一次拖动的撤销配对。Motion、Intel 和旧系统未验收。
|
||||
|
||||
安装包包含原生 FxPlug APP 和 FCP 模板,不含用户 LUT、预设或媒体。安装前保存工作并正常退出 Final Cut Pro/Motion。APP 与 PKG 均完成 Developer ID 签名、公证、票据与 Gatekeeper 核验,20 项真实展开验包通过。本轮正式 APP 已完成唯一安装,未重复执行 PKG 安装脚本。
|
||||
|
||||
版本标签:`v1.3.0-spider-balance-20261101`
|
||||
APP 实际编译源码:`c2818cbb1157093f80efd2a85cea0cf1509f565e`
|
||||
APP 公证:`5de714ac-dd28-4d2b-926f-6c0f424d0e5d`,Accepted
|
||||
PKG 公证:`f6b25757-1e6b-4260-9667-5baecce8b3d4`,Accepted
|
||||
|
||||
附件:`大鱼调色-1.3.0.pkg`
|
||||
大小:14,066,399 字节
|
||||
SHA-256:`36c251722d3c9e4aaed8d5a09bf5afd3bf84039e9d1161c63635ab9d8224f506`
|
||||
@@ -0,0 +1,20 @@
|
||||
大鱼调色 1.3.1(19),适用于 Apple Silicon Mac,最低 macOS 14.6。
|
||||
|
||||
- 一级白平衡色轮增加可见的“复位”按钮,只重置本色轮方向和强度;双击复位继续保留。
|
||||
- LUT 缩略图浏览器改用宿主独立浮动窗口,支持系统移动/缩放;增加网格/列表布局和可调整侧栏,保存窗口及布局偏好。宿主会限制最大窗口尺寸。
|
||||
- “最近使用”固定在分类最前,只记录成功应用的 LUT,去重并按最新优先显示,最多保留 40 个;全部和文件夹列表也优先显示最近使用。
|
||||
- 新实例和全部还原的输入默认为 Sony S-Log3 / S-Gamut3.Cine,输出仍为 Gamma 2.4 / Rec.709。
|
||||
- 201 项正式版原生检查、23 项浏览器专项检查和 3,025 项大目录回归通过。FCP 12.4 的默认、可见复位、浮动窗口/系统缩放、布局、最近排序及浏览器关闭重开检查通过。
|
||||
|
||||
自动化未独立确认自由标题栏/边缘拖动;原生隐藏窗口的几何、缩放和持久化检查通过。用户开始使用后保留当前选择与布局,未再次重启宿主。Motion、Intel、旧系统未验收。
|
||||
|
||||
安装包包含原生 FxPlug APP 和 FCP 模板,不含用户 LUT、预设、最近使用记录或媒体。安装前保存工作并正常退出 Final Cut Pro/Motion。APP 与 PKG 均完成 Developer ID 签名、公证、票据和 Gatekeeper 核验,20 项展开验包通过。本轮 APP 已唯一安装,未重复执行 PKG 安装器。
|
||||
|
||||
版本标签:`v1.3.1-browser-recents-20261101`
|
||||
APP 实际编译源码:`dbb7ca4a995ef832178a32f35939aed7d3a85012`
|
||||
APP 公证:`9e93dc7f-04a3-44f9-a1e4-792bd7b31533`,Accepted
|
||||
PKG 公证:`85cad776-c3d7-4037-9643-24041b269002`,Accepted
|
||||
|
||||
附件:`大鱼调色-1.3.1.pkg`
|
||||
大小:14,073,683 字节
|
||||
SHA-256:`954b10c581f31d23a8c417a6f37b24fae19939786dce8733b4d6f09c7ed3adae`
|
||||
@@ -0,0 +1,27 @@
|
||||
大鱼调色 1.4.0(24),适用于 Apple Silicon Mac,最低 macOS 14.6。
|
||||
|
||||
- 十二个模块标题增加“添加蒙版”和“再加一层”。新增工具从初始化参数开始,独立保存参数、开关、折叠、复位、删除、LUT和蒙版;同类HSL可以连续叠加。
|
||||
- 蒙版包括椭圆、矩形、钢笔、线性渐变、HSL和亮度选区,可相加、减去、相交、反转、羽化和调节强度。画面提供轮廓和左侧工具栏,面板可编辑各类型参数。
|
||||
- 从“大鱼调色盘”源码适配Metal光流与仿射跟踪,支持几何蒙版的正向、反向、双向和单帧跟踪,取消保留可信段,一次撤销恢复;单帧完成后移动播放头。
|
||||
- 完整预设v4保留每层工具、蒙版和逐帧轨迹,兼容旧预设。旧float参数和原调色链保留。
|
||||
|
||||
正式版本222项原生检查通过。FCP12.4实测第二HSL初始化为零、红色色相32且原层仍为零,原层椭圆与新增层矩形独立;正向99帧轨迹、双向100帧轨迹、新增层单帧2键及播放头移动通过。一次撤销/重做、正常退出重开后的完整预设均逐字节一致。远端独立恢复210文件,模型/模板和Metal着色器重建一致。
|
||||
|
||||
画面中心拖动已经由用户用实际鼠标确认,原生点击/拖动回调及原层蒙版坐标变化已核对,新增层蒙版坐标保持不变。旋转、缩放和钢笔手势尚未实机确认;原生模拟宿主的真实Metal叠加、命中、拖动提交、一次撤销及Esc检查通过。Motion、Intel、旧系统、变速/裁剪/非方像素工程未实测。
|
||||
|
||||
新增工具标量目前是静态作者值,蒙版轨迹按时间求值。跟踪不含透视、剪切。空间蒙版不能导出为Cube,需保存完整预设。旧模板实例若不显示画面控件,可先保存完整预设,再应用新版效果并载入;不自动覆盖旧效果。
|
||||
|
||||
安装包包含原生FxPlug APP和FCP模板,不含用户LUT、预设、最近使用记录或媒体。安装前保存工作并正常退出Final Cut Pro/Motion。唯一APP位置为 `/Library/Plug-Ins/FxPlug/大鱼调色.app`。APP已正式安装;PKG另做签名、公证、票据、Gatekeeper及展开验包,不重复执行安装器。
|
||||
|
||||
版本标签:`v1.4.0-tool-masks-20261101`
|
||||
APP实际编译源码:`dbf25fe6719f17075362538dad0404951102524d`
|
||||
APP公证:`40fdaaaa-1821-4cc8-bec3-c5dc6d8b9f77`,Accepted
|
||||
|
||||
PKG公证:`da6edea3-11f4-451b-aece-91916cca329a`,Accepted
|
||||
APP和PKG均通过Developer ID签名、票据与Gatekeeper;20项展开验包通过。
|
||||
|
||||
附件:`大鱼调色-1.4.0.pkg`
|
||||
大小:14,250,425字节
|
||||
SHA-256:`16a4958e28bc2a43c40e6131067eb03a49aecba5bbe3c0424bc7024fa532af38`
|
||||
|
||||
安装包明细见本标签的 `verification/Package.json`;实际发布及完整下载校验见后续主分支的 `verification/Release.json`。
|
||||
@@ -0,0 +1,7 @@
|
||||
新增工具现在紧接点击的模块插入,初始化参数独立;旧工程已有的末尾层保留原位置与画面。蒙版检视器扩大文字、数值框和按钮,滑杆分行显示。修复钢笔进入绘制态、实时预览、曲柄、闭合/取消/重画及提示文字方向。
|
||||
|
||||
跟踪参考Color Finale行为独立适配:实际钢笔路径范围、300特征、亚像素精炼、21×21光流,最高3840×2160分析采样。281项原生检查及18项独立CPU/Metal跟踪检查通过。FCP12.4实测相邻插入、独立参数、绘制态与面板、钢笔蒙版正向99键、一次撤销/重做及保存重开完整预设一致。
|
||||
|
||||
实际鼠标钢笔落点/闭合仍待用户确认:自动化输入没有进入FCP画面回调,原生OSC模拟检查单独通过。当前不含Color Finale全部能力,B样条、编组、人物/图像/外部蒙版和完整轨迹区段编辑等尚有差异;未做同一真实视频的完整轨迹等价对照。跟踪不含透视/剪切。详细证据见仓库交接文档和verification/HostMaskWorkflow1.4.1.json。
|
||||
|
||||
版本1.4.1(26),Apple Silicon,macOS14.6起;APP实际编译源码 `0eb56aed126c825ca89712ce90f8cc1c05b03d89`。APP公证 `1ddc5499-2da3-4d98-8b2d-09272b0ee326`、PKG公证 `9a5ff448-2ac1-444e-b993-2928cf8c333f` 均Accepted,票据/Gatekeeper和20项展开验包通过。包 `大鱼调色-1.4.1.pkg`,14,337,616字节,SHA-256 `0c167aba339bbfdd9c4cbd96aea384e2d43f6d498629ebaf7b1c18cbc6dca5c6`。发行标签保留完整源码和交付记录,APP编译节点与发行记录节点分别列明。唯一正式APP位置 `/Library/Plug-Ins/FxPlug/大鱼调色.app`;不含用户LUT、预设或媒体。
|
||||
@@ -1,51 +1,67 @@
|
||||
# 大鱼调色
|
||||
|
||||
原生 FxPlug 4 调色器。主方案为 **Wrapper Application**,包含独立 XPC 插件,正式安装在 `/Library/Plug-Ins/FxPlug/大鱼调色.app`。
|
||||
原生 FxPlug 4 调色器,当前正式安装版本 **1.4.1(26)**。唯一安装位置为 `/Library/Plug-Ins/FxPlug/大鱼调色.app`;Final Cut Pro 中从“效果 → 大鱼调色”添加。
|
||||
|
||||
支持 17 种相机输入转换、自选输入 LUT、基础光影、白平衡、局部增强、肤色保护、五层风格 LUT、RGB 曲线、8 色与自定义 HSL、四个色轮、三原色、色阶、黑白和色彩平衡。包含自动调色、复制时自动分析、系统吸管、JSON 预设和 Cube 导出。
|
||||
## 色彩管理与一级调色
|
||||
|
||||
- [分析与范围](research/ANALYSIS.md)
|
||||
- [Color Finale 移植研究与算法来源](research/ALGORITHM_SOURCES.md)
|
||||
- [恢复、依赖与正式交付](RECOVERY.md)
|
||||
- [GPU 数学来源与验证](tools/kernels/README.md)
|
||||
- [正式安装记录](verification/Delivery.json)
|
||||
- [LUT 后台加载的 FCP 验收](verification/HostLUTLoading.json)
|
||||
- [N12 外部 LUT 导入与应用验收](verification/HostExternalLUT.json)
|
||||
- [外部 LUT 问题定位及回归](verification/ExternalLUTActivation.json)
|
||||
- [LUT 编码兼容与回归](verification/LUTEncoding.json)
|
||||
- [混合编码 LUT 的 FCP 验收](verification/HostLUTEncoding.json)
|
||||
- [LUT 加载响应压力测试](verification/LUTResponsiveness.json)
|
||||
- [程序图标与插件缩略图验收](verification/BrandAssets.json)
|
||||
- [分组展开与启用验收](verification/HostGroupFolding.json)
|
||||
- [主题与 LUT 库的 FCP 验收](verification/HostThemeLUT.json)
|
||||
- [早期调色链的 FCP 验收](verification/Host.json)
|
||||
前段已改为 **输入转换 → 工作空间一级调色 → 输出转换**,复用大鱼 CST 仓库的固定源码与原生 GPU 数学。曲线和色域独立选择,工作空间统一供一级调色及输出使用,不经相机还原 LUT 近似。
|
||||
|
||||
当前正式版本为 1.1.5(16),交付标签 `v1.1.5-lut-encoding-20261101`。所有调色分组统一为展开即启用、折叠即停用;新建实例与全部还原只展开基础调节。折叠保留参数和 LUT 路径,重新展开继续使用;打开已保存的调色时按各组实际启用状态展开。基础调节同时控制其光影、白平衡与颜色子组。
|
||||
新实例输入为 Sony S-Log3 / S-Gamut3.Cine,输出为 Gamma 2.4 / Rec.709,工作空间为 DaVinci Intermediate / DaVinci Wide Gamut,自动色调映射关闭。请按素材实际编码选择相机输入;不会根据片段或曲线名称猜测、覆盖手选色域。一级调色包含曝光、色彩平衡、饱和度、对比度与轴心、分区影调、黑白点、趾部/肩部压缩。输入、工作空间和输出已合并到一级调色卡片,四个旁路选项移除,由一级眼睛统一启停。一级白平衡改用原 CST 色轮,支持精细拖动、方向键微调、双击复位,以及可见的“复位”按钮;按钮只重置一级白平衡。
|
||||
|
||||
程序图标与 FCP 缩略图采用统一的光谱鱼。两张原始生成图及提示词保存在 `design/`;运行 `python3 tools/build_brand_assets.py` 使用 macOS 工具导出 ICNS、640×360 与 240×135 的效果预览。
|
||||
CST 后的基础调整、HSL、曲线、色轮、五层风格 LUT 等仍属于既有显示域调色链。保留肤色保护、三原色、色阶、黑白、自动调色、吸管、预设和 Cube 导出。Cube 导出包含 CST、一级调色(含白平衡色轮)、蜘蛛盘及其它已启用的逐像素颜色操作。折叠不影响导出,眼睛关闭的模块不计入;纹理、清晰度、去朦胧和逐画面统计不写入 LUT。导出为 33³ Cube,应应用于与导出时相同编码的输入,避免重复叠加 CST/一级处理。
|
||||
|
||||
主题与 LUT 浏览库自 1.1.0(6)提供,源码标签 `v1.1.0-theme-lut-20261031`。灰、蓝、紫、绿、橙五套主题切换后跨实例记忆。风格 LUT 左侧网格按钮打开缩略图浏览器,右侧文件夹按钮打开 `~/Movies/大鱼调色LUT/look LUTs`。可导入文件或目录,按目录与名称过滤,单击应用,缩略图大小与目录会保存。
|
||||
旧工程的输入 LUT / 相机档位和原画面保持兼容;在一级调色中看到“旧版输入 → 改用 CST”时,可明确切换。编辑 CST 参数也会启用新链路。旧参数 ID、LUT 路径与预设读取保留。
|
||||
|
||||
缩略图使用当前素材先经过输入 LUT 的画面;没有源帧时显示本产品生成的色卡。显示方向与宿主图像原点一致,自动分析保留自己的原始数据。浏览器优先采用 FxPlug 宿主窗口,不能使用时回退为锚定弹出面板。品牌保留大鱼,吸管仍为系统取色器。
|
||||
## 模块界面
|
||||
|
||||
算法背景资料补充了同系列工程的 **Color Finale 移植研究**,涵盖调色工具、LUT 预览、图层与蒙版工作流;归档记录、适用范围及当前实现的来源区分见 [算法说明](research/ALGORITHM_SOURCES.md)。Camera Raw 查表数据与组合行为采用 Compositor 的 MIT 许可实现,许可证随资源保留。
|
||||
新实例和“全部还原”默认展开 **一级调色、蜘蛛盘校色仪、基础调整**,其余折叠,所有眼睛开启。标题只控制展开;眼睛只负责启用/停用,两者分别保存,正常重开仍保留。折叠保留参数、LUT 选择和效果。黑白混合默认 0%,避免全眼睛开启时直接变成黑白。
|
||||
|
||||
`大鱼调色/Plugin` 保存模型、AppKit 检查器、IOSurface/Metal 渲染与 CPU 查表;`tools/kernels` 保存可重建的 GPU 数学文本;`template` 是 FCP 效果入口。正式构建使用仓库中的源码和资源。
|
||||
蜘蛛盘直接移植“大鱼调色盘”的可变网格与数学,默认联动 6×6;支持 6/8/12/16/24 点数、独立两轴、固定点、多选、整环/整列和复位,随工程与预设保存。中性盘精确直通。
|
||||
|
||||
选择自有 LUT 后,预设记录其绝对路径;跨机器搬移时同时保留 LUT 文件并重新选择。LUT 导出只保存逐像素颜色,不包含纹理、清晰度或逐画面分析。
|
||||
LUT 缩略图浏览器使用宿主的独立可调整窗口:拖动标题栏移动,拖动窗口边缘调整大小;文件夹与预览之间的分隔条可调整侧栏宽度,底部可切换网格/列表和缩略图大小。位置、大小、布局与分类按库记忆,宿主可能限制最大窗口尺寸。“最近使用”固定在分类首位,仅在成功应用后记录、去重并按最新优先显示,保留最多 40 个;当前文件夹和全部列表也优先显示最近使用项。旧版已保存的当前 LUT 可在首次打开时作为历史起点,不虚构旧版未记录的其它历史。
|
||||
|
||||
`tools/create_lut_host_fixture.py` 可重建独立 FCP 验收 XML 和四个合成测试 LUT;它只写产品缓存,不会向用户库自动导入。LUT 核心检查见 `verification/LUTLibrary.json`,主题与浏览库实现说明见 `research/ThemeLUT-analysis.md`。
|
||||
五套主题跨实例记忆。风格 LUT 网格打开缩略图浏览库;用户库为 `~/Movies/大鱼调色LUT/look LUTs`。后台扫描、导入、解析、预览、取消和最后一次选择生效的机制保留;支持既有 UTF-8/16/32 与旧编码 Cube 兼容。用户文件不进入源码或安装包。
|
||||
|
||||
`tools/create_group_fold_host_fixture.py` 可创建独立的合成验收时间线,用于检查新实例仅基础调节默认启用、分组展开/折叠与数值保留。风格 LUT 总组停用会旁路全部五层;停用的输入或风格 LUT 不加载其文件。
|
||||
## 每工具蒙版与再次添加工具
|
||||
|
||||
LUT 文件夹扫描、逐项校验/复制和选择文件后的解析均在后台执行;导入期间可继续搜索、滚动和选择,刷新按钮临时变为“取消”。失败或取消会移除本次新复制的文件并保留既有库。目录与缩略图只为可见范围创建控件,预览逐项出现;快速切换时仅应用最后一次选择。24个65级合成LUT与3,025项库的响应测试见 [LUTResponsiveness.json](verification/LUTResponsiveness.json)。
|
||||
十二个模块标题均有“添加蒙版”和“再加一层”。新增工具紧接点击的原工具或新增工具插入,从本工具的初始化参数开始,拥有独立启停、折叠、复位、删除、LUT 和蒙版;不会复制原层当前设置。新增一级采用 Rec.709/Gamma 2.4 同域输入输出,新增肤色保护强度为零。
|
||||
|
||||
1.1.4 修复外部 Cube 的旧编码标题导致整批导入失败:标题、注释兼容旧编码,尺寸和数值仍严格校验,报错包含文件名。点击缩略图时先在后台解析并准备 GPU 纹理,宿主接受后才确认选择;已选表独立保留,不受缩略图缓存淘汰影响。用户提供的 N12 目录 26 个 LUT 已全部导入、生成缩略图并完成 Metal 渲染,FCP 中两份“青橙色”、64 级 LUT、快速切换和保存重开通过。用户 LUT 不进入源码或安装包。
|
||||
蒙版包括椭圆、矩形、钢笔、线性渐变、HSL 和亮度选区,支持相加、减去、相交、反转、羽化和强度。矩形、椭圆和闭合钢笔区域可正向、反向、双向或单帧跟踪。算法从“大鱼调色盘”固定源码适配,随本产品独立构建;不依赖安装父插件。完整预设 v4 保存新增工具、蒙版和逐帧轨迹,兼容旧预设。空间蒙版不能导出到 Cube,导出时会提示。
|
||||
|
||||
1.1.5 增加整份 Cube 的 UTF-16/UTF-32 大小端、有无 BOM 识别,在后台转换工作副本,保留导入文件的原始字节。支持常见换行及 Unicode 空白,标题、注释继续兼容 ASCII 指令下的旧编码。16 份 UTF-8/16/32 与 GB18030、Big5、Shift JIS、Windows-1252、MacRoman、ISO-8859-1 样本已在 FCP 中全部导入、预览和逐项应用,无 BOM UTF-32 保存重开通过。损坏的编码、非法数字仍会报错,不使用有损转码猜测颜色值。
|
||||
蒙版检视器采用13pt参数文字和数值、32–36pt按钮、独立整行滑杆及两列跟踪操作。钢笔菜单直接进入绘制态,可点击放点、拖出曲柄、点首节点/Return/“完成绘制”闭合,Esc/取消保留原路径;支持重画、Delete回退和即时预览。跟踪改进实际路径搜索边界、300点特征、亚像素精炼和21×21光流,分析采样上限3840×2160。
|
||||
|
||||
正式 PKG 打包使用 PKG 工坊源码中的 `pkg-forge` 技能。运行 `python3 Packaging/build_pkg.py --pkg-forge-repo /实际/PKG工坊源码目录`,默认输出到上级“发行包”目录;先使用 `--prepare-only` 可只检查清单。打包使用已验证的正式 APP,并从相同 APP 资源中核对、整理 FCP 模板与缩略图,不重签或重建调色 APP。生成包将要求正常退出四种 FCP/Motion 宿主并在登录用户会话验证注册;签名公证和真实展开验包由该技能的原打包器与校验器完成。已有同名版本包不会覆盖。
|
||||
正式版281项原生检查、独立CPU/Metal跟踪18项通过。FCP实测相邻插入、初始化与独立参数、大号面板、绘制态切换、钢笔蒙版正向99键、一次撤销/重做及保存重开完整预设一致。画面提示文字方向已修正。自动化鼠标没有触发FCP画面回调,实际鼠标钢笔落点/闭合仍待用户确认,不能将模拟宿主通过写成实机手势通过。1.4.0的中心拖动已有用户确认。新增工具标量仍为静态值,蒙版轨迹按时间求值,跟踪不含透视/剪切。
|
||||
|
||||
当前正式安装包:[大鱼调色-1.1.5.pkg](../发行包/大鱼调色-1.1.5.pkg),包含1.1.5(16)正式APP及相同版本的FCP模板/预览图;本机Apple Silicon,最低macOS14.6。签名、公证与20项真实展开验包记录见 [Package.json](verification/Package.json)。本轮没有重复执行系统安装;包内APP与已验收的正式安装逐字节一致。
|
||||
旧schema1末尾层保持原保存位置与渲染,避免改变旧工程外观;新添加的层使用schema2插入锚点。原生固定模块的既有处理顺序保留。当前实现参考本机Color Finale的行为和参数独立适配,并非全部功能完整移植;B样条、编组、人物/图像/外部蒙版及完整轨迹区段编辑等差异见专项清单。
|
||||
旧模板实例可能保留关闭画面控件的状态;可先保存完整预设,再重新应用新版效果并载入预设。不会自动覆盖旧实例。实现与验收边界见 [实现说明](research/ToolMaskImplementation.md)、[宿主记录](verification/HostToolMasks.json) 和 [恢复核验](verification/ToolMaskRecovery.json)。
|
||||
|
||||
正式包已保存到[1.1.5 Release](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.1.5-lut-encoding-20261101),完整下载核对大小与 SHA-256 通过。运行 `python3 Packaging/publish_release.py --tag v1.1.5-lut-encoding-20261101 --notes Packaging/Release-1.1.5.md` 可复用 PKG 技能核对同一附件;不会重复上传。安装包不进入普通 Git,发布记录见 [Release.json](verification/Release.json)。
|
||||
## 验证与恢复
|
||||
|
||||
- [本轮交接](大鱼调色FxPlug4交接.md)
|
||||
- [1.4.1 正式版 281 项原生检查](verification/InstalledSelfTest.json)
|
||||
- [插入、钢笔和跟踪工作流](research/MaskWorkflow1.4.1.md)
|
||||
- [1.4.1 FCP验收及实际鼠标缺口](verification/HostMaskWorkflow1.4.1.json)
|
||||
- [Color Finale对照和未迁移范围](research/ColorFinaleMasksFollowup.md)
|
||||
- [1.4.1远端源码独立恢复](verification/MaskWorkflowRecovery.json)
|
||||
- [每工具蒙版、跟踪、保存重开与用户实际拖动](verification/HostToolMasks.json)
|
||||
- [1.4.0 发行标签独立恢复](verification/ToolMaskReleaseRecovery.json)
|
||||
- [CST 来源与集成边界](research/CSTIntegration.md)
|
||||
- [CST 固定源码节点与摘要](research/CSTIntegration.json)
|
||||
- [蜘蛛盘与色轮来源和适配](research/SpiderAndBalanceIntegration.md)
|
||||
- [1.3.1 的 201 项原生与独立像素对照](verification/BrowserNative.json)
|
||||
- [浏览器布局与最近使用专项检查](verification/BrowserCustomization.json)
|
||||
- [大规模 LUT 加载与取消回归](verification/BrowserRegression.json)
|
||||
- [204,683 项网格数学检查](verification/SpiderMath.json)
|
||||
- [正式 FCP 界面与保存重开](verification/HostBrowserAndReset.json)
|
||||
- [正式安装与公证](verification/Delivery.json)
|
||||
- [远端独立恢复与着色器重建](verification/BrowserRecovery.json)
|
||||
- [完整恢复说明和历史](RECOVERY.md)
|
||||
- [原有算法来源](research/ALGORITHM_SOURCES.md)
|
||||
|
||||
构建使用 `Wrapper Application` 方案、Release。运行 `python3 tools/deliver.py` 完成签名、公证、唯一安装和正式宿主验收;更改模型后运行 `python3 tools/build_template.py --refresh-model --overwrite`。`tools/create_browser_host_fixture.py` 重建独立合成验收 XML,不写用户 LUT 库。
|
||||
|
||||
正式发行包由 PKG 工坊技能生成,包含 APP 与 FCP 模板,不含用户 LUT、预设或媒体。安装与发布证据分别保存在 [Package.json](verification/Package.json) 和 [Release.json](verification/Release.json);以其中记录的版本和成功状态为准。
|
||||
|
||||
正式发行包:[大鱼调色-1.4.1.pkg](../发行包/大鱼调色-1.4.1.pkg);APP与PKG均已签名、公证、粘附票据和通过Gatekeeper,20项展开验包通过;Release下载核验以本轮Release.json记录为准。历史[1.4.0 Release](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.4.0-tool-masks-20261101)及更早发行包和标签保留。
|
||||
|
||||
1.3.1 的历史验收包含 Sony 默认、可见复位、浮动浏览器、系统窗口缩放、两种布局、最近排序与关闭重开。原生检查单独覆盖几何/布局持久化和鼠标事件;当时自动化没有独立确认自由标题栏/边缘拖动。1.4.0 另在独立合成工程中完成上文的宿主检查,用户确认中心拖动后保留其试调状态。
|
||||
+91
-2
@@ -1,10 +1,77 @@
|
||||
# 大鱼调色恢复说明
|
||||
|
||||
## 当前 1.4.1(26):相邻插入、蒙版可读性与钢笔流程
|
||||
|
||||
APP实际编译 `0eb56aed126c825ca89712ce90f8cc1c05b03d89`,公证 `1ddc5499-2da3-4d98-8b2d-09272b0ee326` Accepted;票据、Gatekeeper、唯一正式安装和安装后281项原生检查通过。正式路径、Bundle ID和签名团队不变。PKG/Release以当前验证JSON的版本和成功状态为准。 本轮发行标签 `v1.4.1-mask-workflow-20261101`;包 `../发行包/大鱼调色-1.4.1.pkg`,14,337,616字节,SHA-256 `0c167aba339bbfdd9c4cbd96aea384e2d43f6d498629ebaf7b1c18cbc6dca5c6`。PKG公证 `9a5ff448-2ac1-444e-b993-2928cf8c333f` Accepted,票据/Gatekeeper与20项展开验包通过;本轮未再次执行系统安装器。
|
||||
|
||||
新层紧接点击源插入,schema2的after保存原模块或UUID锚点;旧schema1尾层不迁移,保留旧画面。渲染在原固定工具对应阶段执行新层,非只移动界面。保持无新增激活层时原融合路径、CST参考、肤色参考、黑白混合和原蜘蛛盘顺序。详见 `research/MaskWorkflow1.4.1.md`。
|
||||
|
||||
蒙版面板扩大文字/数值和按钮,钢笔有明确的绘制、完成、取消与重画状态;实时草稿不调用宿主API,完成后单次提交。跟踪采用实际路径范围、300特征、亚像素精炼、21×21光流,采样最高3840×2160。Color Finale只读研究与独立适配差异见 `research/ColorFinaleMasksFollowup.md`,并非完整移植所有原版蒙版能力。
|
||||
|
||||
FCP12.4相邻插入、独立初始化参数、面板/绘制态、钢笔蒙版正向99键、一次撤销/重做和冷重开完整预设一致;实际鼠标钢笔落点/闭合待用户确认,自动输入未进入OSC回调。原生281项和独立跟踪18项通过,不等同所有真实素材与手势均已验收。详见 `verification/HostMaskWorkflow1.4.1.json`。
|
||||
|
||||
从远端独立恢复224文件、full/strict fsck,并从恢复源码重建模型/模板及Metal,与正式版着色器一致,见 `verification/MaskWorkflowRecovery.json`。无LFS/子模块;临时clone已清理。中间25版及24版临时APP备份在26版验证后清理,历史正式PKG保留。
|
||||
|
||||
## 历史 1.4.0(24):每工具蒙版与初始化叠层
|
||||
|
||||
APP 实际编译 `dbf25fe6719f17075362538dad0404951102524d`,公证 `40fdaaaa-1821-4cc8-bec3-c5dc6d8b9f77`,Accepted;票据、Gatekeeper、唯一正式安装、222项原生检查及FCP保存重开通过。安装和实际宿主证据分别见 `verification/Delivery.json`、`verification/HostToolMasks.json`。正式包和Release以对应JSON记录的1.4.0状态为准,不套用历史1.3.1记录。
|
||||
|
||||
发行标签 `v1.4.0-tool-masks-20261101`,PKG公证 `da6edea3-11f4-451b-aece-91916cca329a` Accepted,20项展开验包通过。包 `../发行包/大鱼调色-1.4.0.pkg`,14,250,425字节,SHA-256 `16a4958e28bc2a43c40e6131067eb03a49aecba5bbe3c0424bc7024fa532af38`。本轮正式APP已安装和宿主验证,PKG未重复运行安装器。
|
||||
|
||||
新增9002静态作者文档保存UUID工具实例和每层蒙版,9003仅作不保存的OSC会话路由。旧float ID、9001资产和1104字节制服ABI保持。预设v4保存完整工具与轨迹,兼容v1–3;轨迹用精确CMTime求值,新增工具标量暂不支持宿主标量关键帧。空间蒙版不能表达为Cube,应保存完整预设。蒙版/Metal光流来源固定为父库 `f8950384e514685c8809fe8e8ee2dd5f16ad0bd7`,摘要见 `research/ToolMaskPort.json`;构建与运行不读取父库或Color Finale。
|
||||
|
||||
远端独立克隆该编译节点,210个提交文件逐字节核对、strict/full fsck通过;从恢复源码和本机SDK重建模型/模板及Metal,模板和正式着色器摘要完全一致,见 `verification/ToolMaskRecovery.json`。不含LFS或子模块。恢复临时目录已清理,签名证书私钥仍需独立恢复。
|
||||
|
||||
FCP实测独立HSL、每层椭圆/矩形、数值编辑、正向99键、双向100键、单帧2键、一次撤销/重做及冷重开完整预设一致。用户已实际确认中心拖动,原生hit/drag回调和原层坐标变化已核对,新增层蒙版坐标不变;旋转/缩放/钢笔尚未实机验证,模拟宿主的原生OSC检查通过。旧模板实例可能保留关闭OSC的状态,可保存完整预设后重新应用新版效果再载入,不自动覆盖旧工程。
|
||||
|
||||
## 历史 1.3.1(19):色轮复位、可调整浏览器与最近使用
|
||||
|
||||
实际编译 `dbb7ca4a995ef832178a32f35939aed7d3a85012`,APP 公证 `9e93dc7f-04a3-44f9-a1e4-792bd7b31533`,Accepted;票据、Gatekeeper、唯一正式安装与 FCP 12.4 加载通过。发行标签 `v1.3.1-browser-recents-20261101`,包目标 `../发行包/大鱼调色-1.3.1.pkg`。本版本发布结果见 verification/Package.json 和 verification/Release.json。
|
||||
|
||||
新实例及全部还原的输入默认为 Sony S-Log3(数学 ID 28)与 Sony S-Gamut3.Cine(27);输出 Gamma 2.4 / Rec.709、工作 DI/DWG 不变。一级白平衡的可见复位按钮只写方向和强度为零,保持双击复位与一次撤销。
|
||||
|
||||
浏览器在 CustomParameterAction scope 中取得并立即请求 FxRemoteWindowAPI_v2 的最小/最大尺寸窗口;首个子视图在 reply 返回前同步附着。当前 FCP 实测独立浮动窗口生效。支持网格/列表、缩略图大小、可拖动分隔条和按库保存的窗口/布局偏好;旧宿主保留可分离弹出框回退。窗口尺寸受宿主 80% 上限及屏幕约束。
|
||||
|
||||
最近使用保存在当前 XPC 的 NSUserDefaults,key 以库的规范路径隔离;只记录成功且最新的宿主应用确认,失败、取消、过时回调不写。最多 40 个,去重最新优先,最近分类第一位,全部/文件夹也最近优先。首次打开可从已有当前 LUT 初始化;不能补造旧版本未记录的所有历史。LUT 文件不改动,历史偏好不进 Git/PKG。
|
||||
|
||||
verification/BrowserNative.json 为正式路径 201 项;BrowserCustomization.json 为 23 项真实离屏 AppKit 窗口/布局/历史检查;BrowserRegression.json 含 3,025 项虚拟化、取消和应用确认回归。FCP 的 Sony 默认、可见复位、浮动窗口及系统缩放、两种布局、最近排序和关闭重开见 HostBrowserAndReset.json。自由标题栏/边缘拖动未由自动化独立确认;用户开始操作后保留当前状态,未再重启 FCP。Motion、Intel、旧系统未验收。
|
||||
|
||||
远端独立恢复编译提交 178 文件、full/strict fsck 及 Metal 重建与正式库一致,见 verification/BrowserRecovery.json。恢复历史版本时仍使用其各自标签和验证记录,不把当前 Sony 默认替代历史中明确保存的设置。
|
||||
|
||||
## 历史 1.3.0(18)交付
|
||||
|
||||
实际编译源码 `c2818cbb1157093f80efd2a85cea0cf1509f565e`;APP 公证 `5de714ac-dd28-4d2b-926f-6c0f424d0e5d`,Accepted,票据和 Gatekeeper 通过,唯一正式路径 `/Library/Plug-Ins/FxPlug/大鱼调色.app`。版本标签 `v1.3.0-spider-balance-20261101`,最终发行记录见 verification/Package.json 和 verification/Release.json 的本版本条目。
|
||||
|
||||
输入、工作空间、一级和输出合并一个卡片,移除四个可见旁路;旧阶段/旁路参数继续注册,打开旧工程不重解释原值,明确编辑 CST 或复位才清理旧旁路。一级白平衡复用原 CST 图像及 +104°、/5 精细拖动和原 BASIS 强度换算,角度范围修正为 0–360°,旧数值不重解释。
|
||||
|
||||
蜘蛛盘原样数学和交互源来自 dayu-colorplate 的 `f8950384e514685c8809fe8e8ee2dd5f16ad0bd7`;资源与来源摘要均已入仓库,不依赖兄弟 APP 运行。默认联动 6×6,可变 6/8/12/16/24,两轴独立;完整网格与固定点保存至现有 DYAssetState,预设 schema 3 含 JSON 网格并继续读取旧预设。InspectorToken 仍 schema 2。默认一级调色、蜘蛛盘、基础调整展开,其余折叠,所有眼睛开启。
|
||||
|
||||
正式版常规 155 项自检、带独立 CST 参照的 198 项集成检查通过;25 个网格的 204,683 项数学检查通过。远端独立恢复实际编译提交的 168 个文件,strict/full fsck 及着色器重建与正式库摘要一致,见 verification/SpiderRecovery.json。兄弟仓库只读参考,未修改。
|
||||
|
||||
FCP 12.4 已验证合并面板、默认、色轮/蜘蛛盘键盘修改、宿主菜单撤销/重做、两轴密度、固定点操作、整环选择及正常保存重开,验收实例最后全部还原。自动化坐标鼠标注入未激活 FxPlug 远程视图,因此未确认实时宿主拖动/双击;原生 AppKit 鼠标事件和一次拖动撤销配对检查单独通过,不混为宿主操作。记录见 verification/HostSpiderAndBalance.json。Motion、Intel、旧系统仍未验收。
|
||||
|
||||
正式构建、安装与启动由 tools/deliver.py 执行;PKG 由 Packaging/build_pkg.py 调用 PKG 工坊并真实展开验包,不重复执行系统安装。发布器先草稿、完整下载校验后发布,不移动历史标签或覆盖历史附件。签名凭据和用户 LUT 不进仓库。
|
||||
|
||||
## 历史 1.2.0(17)交付
|
||||
|
||||
版本标签 `v1.2.0-cst-fold-20261101`;实际编译源码 `48b00c85799b0226ba32aba3f2e5397aa0e509ed`。正式 APP 公证 `f25ae46e-92da-4470-842e-128bdb232aa8`,Accepted,票据和 Gatekeeper 通过;唯一安装路径及服务进程已在 FCP 12.4 核对。签名团队 B3W25FX5H5,固定缓存和公证配置不变。
|
||||
|
||||
前段复用 `dayu/dayu-cst` 的 `973766b51dbcab3ab5092f1955d753575cd32d89` 源码:输入曲线/色域 → 工作空间一级 → 输出曲线/色域,源码副本与摘要均在本仓库,不依赖另一份 CST APP 才能生产运行。原始 944 字节调色 ABI 前缀保留,新增控制追加其后。来源见 research/CSTIntegration.json。
|
||||
|
||||
一级调色与基础调整默认展开,其他模块折叠,全部眼睛开启;折叠独立写入 InspectorToken,不修改渲染参数。新 InspectorToken schema 2,旧 schema 1 及旧输入 LUT/预设继续读取。旧工程默认旁路新 CST,直到明确迁移;黑白新增混合,旧工程保留原黑白效果。新默认 Rec.709/Gamma 2.4 往返保持中性。
|
||||
|
||||
153 项原生检查通过,21 组独立 CST 像素对照最大分量误差 0.0000152587890625,正式路径常规自检 110 项通过;FCP 新实例默认、折叠、眼睛、0.70 曝光、Sony/ACES 选择及保存重开通过。风格库 N12 的 26 项可见并可应用。宿主观察不冒充逐像素导出一致,Motion/Intel/旧系统未验收。
|
||||
|
||||
远端独立克隆实际编译节点,151 个提交文件校核、full/strict fsck,以及着色器重建均通过,重建 SHA 与正式库一致。详见 verification/CSTRecovery.json。无 LFS、无子模块。签名私钥和用户 LUT 仍须独立恢复。
|
||||
|
||||
安装包/Release 的版本、摘要、标签、附件下载校验分别见 verification/Package.json 和 verification/Release.json;尚未产生本版本成功记录时不能据历史记录宣称发布完成。本轮 APP 已完成唯一安装,PKG 只展开验包,不重复运行安装脚本。
|
||||
|
||||
|
||||
远程:https://dayu.media/git/dayu/dayu-color.git,分支main。
|
||||
初始化基线:10987dd6bcc6986ea321eff75b37d4e8b48e966d;后续节点见git log。
|
||||
产品主ID:com.dayu.color,XPC:com.dayu.color.XPC;唯一正式位置:/Library/Plug-Ins/FxPlug/大鱼调色.app。
|
||||
|
||||
当前交付标签:v1.1.5-lut-encoding-20261101。APP 1.1.5(16)编译源码:59b058a3c8b9e5387381574da6bbc05af437527c;标签另含最终宿主验收与恢复记录。Apple 公证 ID b47b6fe8-b7a9-4112-93b9-de85b03ca598,Accepted;正式签名、票据、Gatekeeper 与宿主重开均通过,见 verification/Delivery.json 和 verification/HostLUTEncoding.json。
|
||||
历史 1.1.5 交付标签:v1.1.5-lut-encoding-20261101。APP 1.1.5(16)编译源码:59b058a3c8b9e5387381574da6bbc05af437527c;标签另含最终宿主验收与恢复记录。Apple 公证 ID b47b6fe8-b7a9-4112-93b9-de85b03ca598,Accepted;正式签名、票据、Gatekeeper 与宿主重开均通过,见 verification/Delivery.json 和 verification/HostLUTEncoding.json。
|
||||
|
||||
外部LUT版本 v1.1.4-external-lut-20261101 保留,编译源码497eef29fe8eaa5fb7025aa045b6dfa46a9acc14,原公证ID d9d9b05a-58b5-4a7a-aac2-6433b87d901d。
|
||||
|
||||
@@ -12,7 +79,7 @@
|
||||
|
||||
分组折叠版本 v1.1.2-group-fold-20261031 保留,编译源码 cdcb30a6aa1519bfb2f183165fef11cbf278bc7c,原公证 ID 398b020c-9e1e-4c2b-b637-e8e3af2a8f59。
|
||||
|
||||
所有调色分组展开即启用、折叠即停用,关闭时参数不可见;仅基础调节在新实例和全部还原后默认展开。折叠保留数值和 LUT 路径;打开已保存实例时按其实际启用状态展开。基础调节同时控制原光影与颜色两个子组。风格 LUT 总组停用时全部五层均旁路,关闭的输入或风格 LUT 不加载文件。肤色保护的百分比字段按0–100范围显示和保存。
|
||||
历史 1.1.2–1.1.5 行为(已由 1.2.0 取代):所有调色分组展开即启用、折叠即停用,关闭时参数不可见;仅基础调节在新实例和全部还原后默认展开。折叠保留数值和 LUT 路径;打开已保存实例时按其实际启用状态展开。基础调节同时控制原光影与颜色两个子组。风格 LUT 总组停用时全部五层均旁路,关闭的输入或风格 LUT 不加载文件。肤色保护的百分比字段按0–100范围显示和保存。
|
||||
|
||||
FCP12.4正式安装版本的11组标题/眼睛联动、隐藏参数、黑白红45与肤色65%跨折叠及保存重开保留、全部还原后只展开基础调节的验收见 verification/HostGroupFolding.json。仅在独立合成验收项目中改值,最后恢复默认;用户媒体和其他产品未作改动。
|
||||
|
||||
@@ -139,3 +206,25 @@ python3 Packaging/build_pkg.py --pkg-forge-repo /实际/PKG工坊源码目录 --
|
||||
正式Release:https://dayu.media/git/dayu/dayu-color/releases/tag/v1.1.5-lut-encoding-20261101;Release ID355,附件ID8,关联原标签06968514fc5205a83fbf3c5a3dbb1be0f6f3e79b,标签未移动。仅上传一次大鱼调色-1.1.5.pkg,13,752,153字节,SHA256 bf2a4acc57a3c08176be0f317c90551120bfcfb21a7224a690191884c8a3d071。
|
||||
|
||||
草稿Web下载对令牌请求返回404,但正常登录会话可下载。通过Edge实际下载草稿附件、核对全部字节和SHA后才由API发布;发布后再次用上传器完整下载正式链接并回读Release/附件,复用同一个附件且校验通过。草稿下载的临时副本按来源、创建时间和摘要核实后清理,本地正式发行包保留。详见verification/Release.json;此过程没有重新构建或改动已验包安装包,也未再次安装PKG。
|
||||
|
||||
## 1.2.0 正式 PKG
|
||||
|
||||
正式包 `../发行包/大鱼调色-1.2.0.pkg`,13,818,397 字节,SHA-256 `9fba4f0c1a313a6da8374b683f7e6b41af70388d7a7a180e26b9e236a9ba64a1`。PKG 公证 `c7b97b0f-57c8-45d3-a4d7-7db8e8694487`,Accepted;Installer 团队 B3W25FX5H5、票据、Gatekeeper 及 20 项展开验包通过。包内 APP 与已验收正式安装一致,未重复运行安装器。
|
||||
|
||||
正式 Release 已发布并完整下载校验:[1.2.0 Release](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.2.0-cst-fold-20261101),Release ID 363,附件 ID 10。关联标签完整提交 `8074444259fbacc758ec003aa91a6331b6224a85`,APP 实际编译 `48b00c85799b0226ba32aba3f2e5397aa0e509ed`;附件 13,818,397 字节,SHA-256 `9fba4f0c1a313a6da8374b683f7e6b41af70388d7a7a180e26b9e236a9ba64a1`。草稿下载验证后才发布,发布后再次用上传器完整下载并回读核对;仅一次附件上传,未覆盖历史附件或移动标签。浏览器临时下载副本已按大小、摘要和来源核实清理,本地正式发行包保留。
|
||||
|
||||
## 1.3.0 正式 PKG
|
||||
|
||||
正式包 `../发行包/大鱼调色-1.3.0.pkg`,14,066,399 字节,SHA-256 `36c251722d3c9e4aaed8d5a09bf5afd3bf84039e9d1161c63635ab9d8224f506`。PKG 公证 `f6b25757-1e6b-4260-9667-5baecce8b3d4`,Accepted;Installer 团队 B3W25FX5H5、可信时间戳、票据、Gatekeeper 和 20 项真实展开验包通过。包内 APP 与已验收正式安装一致,未重复运行安装器。APP 编译源码 `c2818cbb1157093f80efd2a85cea0cf1509f565e`。正式包保留,临时展开副本由打包入口清理。
|
||||
|
||||
正式 Release 已发布并完成草稿、正式链接两次完整下载校验:[1.3.0 Release](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.3.0-spider-balance-20261101),Release ID 365,附件 ID 11,关联标签提交 `6528f888affe0acdd4292bc0c5ae0dac3a89b5a5`,实际 APP 编译 `c2818cbb1157093f80efd2a85cea0cf1509f565e`。附件 14,066,399 字节,SHA-256 `36c251722d3c9e4aaed8d5a09bf5afd3bf84039e9d1161c63635ab9d8224f506`;只上传一次,未覆盖历史附件或移动标签。草稿浏览器下载副本已按来源、创建时间、字节数和摘要确认后清理,正式发行包保留。标签远端恢复 172 文件、full/strict fsck 通过,见 verification/SpiderReleaseRecovery.json。
|
||||
|
||||
## 1.3.1 正式 PKG
|
||||
|
||||
正式包 `../发行包/大鱼调色-1.3.1.pkg`,14,073,683 字节,SHA-256 `954b10c581f31d23a8c417a6f37b24fae19939786dce8733b4d6f09c7ed3adae`。PKG 公证 `85cad776-c3d7-4037-9643-24041b269002`,Accepted;Installer 团队 B3W25FX5H5、可信时间戳、票据、Gatekeeper 和 20 项真实展开验包通过。包内 APP 与已验收的正式安装一致,APP 实际编译 `dbb7ca4a995ef832178a32f35939aed7d3a85012`;未重复执行系统安装。
|
||||
|
||||
正式 Release 已发布并完整下载校验:[1.3.1 Release](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.3.1-browser-recents-20261101),Release ID 366、附件 ID 12;标签提交 `281721bda11484c23f294b4f0d9e0b30ef829288`,APP 编译 `dbb7ca4a995ef832178a32f35939aed7d3a85012`。附件 14,073,683 字节,SHA-256 `954b10c581f31d23a8c417a6f37b24fae19939786dce8733b4d6f09c7ed3adae`。草稿经已登录会话完整下载校验后发布,正式链接再次完整下载校验;只上传一次并复用同一附件。临时下载副本已核实清理,正式发行包保留。交付标签远端独立恢复 184 文件与 full/strict fsck 通过,见 verification/BrowserReleaseRecovery.json。
|
||||
|
||||
## 蒙版、跟踪与可重复工具的文档交接(2026-11-01)
|
||||
|
||||
文档整理前 main 为 `bbdd47d1d74e241f1f144bb2c245204e86973b3f`。交接标签 `handoff-mask-tracking-tools-20261101` 保存最新 `大鱼调色FxPlug4交接.md` 及 `research/MaskTrackingAndToolStack.md`,区分正式 1.3.1(19)与尚未实现的多个独立 HSL、每实例蒙版和跟踪。本文档提交未重新构建、安装或发布 APP/PKG,不移动原发行标签;父级“大鱼调色盘”只读参考。接续时保护用户当前窗口、布局、LUT 选择和工程。
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"repository": "https://dayu.media/git/dayu/dayu-cst.git",
|
||||
"commit": "973766b51dbcab3ab5092f1955d753575cd32d89",
|
||||
"files": [
|
||||
{
|
||||
"source": "tools/kernels/CSTKernel.ll",
|
||||
"destination": "tools/kernels/CSTKernel.ll",
|
||||
"sha256": "78c2414d1c086dc7eaa043308f0febd32691b1ad49629febdcc1138b232cefc8"
|
||||
},
|
||||
{
|
||||
"source": "tools/kernels/BasisKernel.ll",
|
||||
"destination": "tools/kernels/BasisKernel.ll",
|
||||
"sha256": "221ca94c52a997aa8cb2b2155bb8c7ad57bf0829b0241857664a75e78329a4b3"
|
||||
},
|
||||
{
|
||||
"source": "大鱼CST/Plugin/DayuShaderTypes.h",
|
||||
"destination": "大鱼调色/Plugin/DYCSTTypes.h",
|
||||
"sha256": "3372e3cd77248eeb374e54675d2902befceea8e00a2afc4f9543116ef3027696"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
# CST 色彩管理集成
|
||||
|
||||
本轮以 dayu-cst 的固定源码节点复用 CSTKernel / BasisKernel;原路径和摘要见 CSTIntegration.json,参考仓库保持只读。新处理顺序为输入转换 → 工作空间一级调色 → 输出转换 → 原有基础调整与风格链。曲线和色域独立选择,工作曲线由同一个参数供一级与输出使用,不通过跨实例通知同步。
|
||||
|
||||
沿用大鱼调色的宿主线性 RGB 边界:CST 前恢复编码值,三个阶段内部不使用 3D LUT、不裁切至 0–1;返回宿主线性后再进入原有显示域调色链。此版本的后续 HSL、曲线与风格 LUT 仍是既有显示域工具,不宣称全链路改造成场景线性调色。CST 源内核使用 half 输入,保留其原生精度边界。
|
||||
|
||||
新实例默认输入/输出 Gamma 2.4、Rec.709,工作 DaVinci Intermediate / DaVinci Wide Gamut;自动色调映射默认关闭。按实际素材选择相机曲线/色域。选择自动映射时复用参考代码的场景/显示映射标志。一级默认参数直接沿用 CST 源码。
|
||||
|
||||
一级调色、基础调整默认展开;其余折叠;所有模块眼睛开启。黑白模块增加混合(默认 0),保证眼睛开启不强制把初始画面变成黑白。折叠写入独立的 InspectorToken,仅保存界面状态,不修改任何调色参数、启用位或 LUT 路径。眼睛只修改启用位。
|
||||
|
||||
旧 InspectorToken schema 1 仍可读取:默认跳过新 CST,并保留旧版黑白强度。旧输入 LUT / 相机输入也维持原路径,直到用户明确编辑 CST 参数或选择“旧版输入 → 改用 CST”。新旧模型的前 944 字节 ABI 与所有旧参数 ID 保留。
|
||||
|
||||
Cube 导出改用生产渲染路径生成 33³ 色格,包含新的 CST 与一级参数;关闭不可写入 Cube 的空间细节工具和逐画面统计。用户 LUT 和宿主资料不进入仓库。
|
||||
|
||||
原生模型、真实 AppKit 折叠动作、IOSurface/Metal 和 Cube 导出已通过 153 项检查,其中 21 组参数与正式大鱼 CST 着色器直接逐像素对照(包含 17 个相机输入组合、ACEScct/Linear/新增曲线/显示曲线工作空间)。本机 Apple M4 的最大线性预乘分量误差为 0.0000152587890625。具体输入、原库摘要与边界见 verification/CSTIntegration.json。正式宿主与发行由独立记录确认。
|
||||
|
||||
为避免全眼睛开启让中性查表裁切 HDR,未调整的曲线/HSL/色轮/三原色/色阶/色彩平衡在渲染副本旁路;无其他实际调整时肤色保护也无需执行。原参数、眼睛和界面数值不变。默认输入与输出相同、一级中性且映射关闭时跳过可证明为恒等的往返,避免累积 half 量化误差。
|
||||
@@ -0,0 +1,261 @@
|
||||
{
|
||||
"date": "2026-11-01",
|
||||
"scope": "Read-only installed Color Finale 2.16.2(625) static analysis and independent Dayu tracking reconstruction; no target runtime/GUI",
|
||||
"target": {
|
||||
"path": "/Applications/ColorFinale.app/Contents/PlugIns/ColorFinale.pluginkit/Contents/MacOS/ColorFinale",
|
||||
"sha256": "49121a6f5487060d322a59e7658166ab772e8a56f7dc1bcfa9d433a89436b30f",
|
||||
"architecture": "arm64",
|
||||
"provider": "Ghidra 12.1.4"
|
||||
},
|
||||
"baselineCommit": "745aa1626e1df368290fbbd47a716ff3ce9ca630",
|
||||
"evidence": [
|
||||
{
|
||||
"evidence_id": "ev_6539e1080a6e0d9cf27d9cb3c26703110b8f50030981b18cc075356840849e08",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTShapeTrackerView::addShapeForEvent:",
|
||||
"address": "0x1000e2900",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_0f9372e98efac18d8f666dcf137addc2ecdaffdfdb153f0a31b3ecfc2ba8b9ca",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTShapeTrackerView::setShapeEditMode:",
|
||||
"address": "0x1000e1fcc",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_2dd4ac418346bd4d15d05f8145bb2a547ab531d742b4e8edfb3314fc49fdde0a",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTOnScreenBezierShape::mouseDown:",
|
||||
"address": "0x10009be0c",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_8aa635a486e91b5af36bc39d424964417e0b6b77706cb24218640ac253b426b6",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTOnScreenBezierShape::mouseUp:",
|
||||
"address": "0x10009c084",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_4c3864a55c7dc71ee02b67c4eed011dbe00a9d8072c275ff002607d22618c288",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTOnScreenPathShape::closePath",
|
||||
"address": "0x100033ec8",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_2fc54b9d31f2ac894aae0b560fee33284a155fe6505697c0a83be1af0bc0a8ea",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTOnScreenPathShape::controlPoint:mouseDown:",
|
||||
"address": "0x10003429c",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_d3bea253005ee2007c110f15d6658e542de8f2075d40585897b875f9b517ec2b",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTOnScreenPathShape::keyDown:",
|
||||
"address": "0x1000345c8",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_ba0c6d39ae45e26b8ade69f41f6fb8da934c526a686e64be89690b762a11e585",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTShapeBezierControlPoint::controlPoint:mouseDragged:",
|
||||
"address": "0x10009d178",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_ea178e24d10afea13fa74a0d70941648d1ca4c45005a1533df478c9212f6f9b7",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTShapeTrackerControl::addToolbarButtons",
|
||||
"address": "0x10001ef7c",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_dcd7aa770925f63c8c14c968ae6b417fda78685c7be7fa739a78209957d40e2d",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTAreaTracker::track:trackerState:",
|
||||
"address": "0x100035e40",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_e798c4e6e032e085812f81831ecc16196bd3c2278bf634961379669ee1308f7e",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTAreaTracker::trackFrame:inScene:",
|
||||
"address": "0x100036cbc",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_8bad5bbc4bd2890227567b9799cfc1e68c6d56631e67a73224d57971767664c4",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "-[FTTrackerShape(FTOnScreenShape)_addKeyFrameForShape:atTime:]",
|
||||
"address": "0x100047dc4",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_fe677a9c456fc8739e0c33edd513c3f6b94431c7fbb6f1194a78801f39f32072",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTShapeTrackerControl::shapeTrackerView:geometryDidChangeForShapes:",
|
||||
"address": "0x100025414",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
},
|
||||
{
|
||||
"evidence_id": "ev_533595e2ddf4c96d5c82f3ce25c7ff44a3549f37d8b80e5b5b5a82360e283c77",
|
||||
"operation": "analyze_function",
|
||||
"procedure": "FTMaskShapeViewController::viewDidLoad",
|
||||
"address": "0x10007f3b0",
|
||||
"authority": "shipped-artifact",
|
||||
"confidence": "observed"
|
||||
}
|
||||
],
|
||||
"localOnlyEvidenceDirectory": "/Users/mac/Library/Caches/CodexBuilds/ColorResearch/dayu-mask-followup-20261101",
|
||||
"sourceApplicationRuntimeDependency": false,
|
||||
"proprietaryCodeOrResourcesCommitted": false,
|
||||
"originalArtifactModified": false,
|
||||
"completeMigrationClaim": false,
|
||||
"limitations": [
|
||||
"Static analysis is not live runtime acceptance.",
|
||||
"Independent detector/gray conversion/LK/RANSAC safeguards do not exactly reproduce OpenCV results.",
|
||||
"Interface Builder default 64-document coverage omitted mask nibs; exact full inspector pixel sizes are unknown.",
|
||||
"B-spline, grouping/parent masks, image/person/external inputs, published masks and full keyframe-region editing are outside this fault-fix implementation.",
|
||||
"No same-video, same-path, whole-trajectory comparison to the original product has been performed."
|
||||
],
|
||||
"independentVerification": {
|
||||
"passResult": true,
|
||||
"count": 18,
|
||||
"checks": [
|
||||
{
|
||||
"name": "cpu-pen-texture-outside-creation-box-starts",
|
||||
"pass": true,
|
||||
"features": 117
|
||||
},
|
||||
{
|
||||
"yErrorPixels": 0.03234100341796875,
|
||||
"xErrorPixels": 0.007296752929676131,
|
||||
"name": "cpu-extended-pen-region-subpixel-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cpu-real-300-feature-capacity",
|
||||
"pass": true,
|
||||
"features": 300
|
||||
},
|
||||
{
|
||||
"pass": true,
|
||||
"rotation": 0.02499544620513916,
|
||||
"scaleX": 1.025027871131897,
|
||||
"scaleY": 0.9799908995628357,
|
||||
"xErrorPixels": 0.0009307861328267109,
|
||||
"yErrorPixels": 0.0005807876586860772,
|
||||
"name": "cpu-translation-rotation-independent-xy-scale"
|
||||
},
|
||||
{
|
||||
"name": "cpu-subpixel-refinement-and-redetection-remain-stationary",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cpu-unrelated-cut-is-not-trusted-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "cpu-flat-region-still-refuses-tracking",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"generatedFramesAndAnalysisMilliseconds": 43.247542,
|
||||
"features": 300,
|
||||
"name": "cpu-1080p-complete-frame-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"generatedFramesAndAnalysisMilliseconds": 111.362708,
|
||||
"features": 300,
|
||||
"name": "cpu-3840x2160-complete-frame-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "metal-pen-texture-outside-creation-box-starts",
|
||||
"pass": true,
|
||||
"features": 117
|
||||
},
|
||||
{
|
||||
"yErrorPixels": 0.03234100341796875,
|
||||
"xErrorPixels": 0.007296752929676131,
|
||||
"name": "metal-extended-pen-region-subpixel-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "metal-real-300-feature-capacity",
|
||||
"pass": true,
|
||||
"features": 300
|
||||
},
|
||||
{
|
||||
"pass": true,
|
||||
"rotation": 0.02499544620513916,
|
||||
"scaleX": 1.025027871131897,
|
||||
"scaleY": 0.9799908995628357,
|
||||
"xErrorPixels": 0.0009307861328267109,
|
||||
"yErrorPixels": 0.0005807876586860772,
|
||||
"name": "metal-translation-rotation-independent-xy-scale"
|
||||
},
|
||||
{
|
||||
"name": "metal-subpixel-refinement-and-redetection-remain-stationary",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "metal-unrelated-cut-is-not-trusted-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "metal-flat-region-still-refuses-tracking",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"generatedFramesAndAnalysisMilliseconds": 31.447709,
|
||||
"features": 300,
|
||||
"name": "metal-1080p-complete-frame-motion",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"generatedFramesAndAnalysisMilliseconds": 88.904167,
|
||||
"features": 300,
|
||||
"name": "metal-3840x2160-complete-frame-motion",
|
||||
"pass": true
|
||||
}
|
||||
],
|
||||
"memoryRunPass": true,
|
||||
"peakResidentBytes": 299597824,
|
||||
"generatedImageOracles": true,
|
||||
"baselineExtendedRegion": {
|
||||
"started": false,
|
||||
"features": 0
|
||||
},
|
||||
"newExtendedRegion": {
|
||||
"started": true,
|
||||
"features": 117
|
||||
},
|
||||
"appLaunched": false,
|
||||
"scope": "Independent generated images, CPU tracker and optional real Metal optical flow. No app or GUI host launched."
|
||||
},
|
||||
"implementationSHA256": {
|
||||
"大鱼调色/Plugin/MaskCore/DYTracker.hpp": "68d32e8704e737587729397b0e8dd856f40c26aff479af7a65e5a32c48e95d6b",
|
||||
"大鱼调色/Plugin/DYToolFlow.inc.h": "f4426c1bc4a36a93561c9d43ea794b89c10767fb94cbc442b82563766b1856d8",
|
||||
"大鱼调色/Plugin/DYTracking.metal": "e0c13390a952b13eb92081840069f79632c05326aaf1a0cc927200a84d4e4ac0",
|
||||
"tools/verify_tool_tracking_followup.mm": "961c3ff4359bc06bf7b6d1f71b8fcfa40efee32d2f7722a0af9ba813971d7c64"
|
||||
},
|
||||
"independentShaderSHA256": "2899508dbcff3329531ec23f9fe13f30993ba5416bf7788697557f5d611783f8"
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
# Color Finale 蒙版与跟踪的本机复核(2026-11-01)
|
||||
|
||||
本轮针对用户报告的“层在最底部新增、蒙版控件太小、钢笔不可用”核对本机发行产物。目标为 ColorFinale 2.16.2(625)的 arm64 插件,完整文件 SHA-256 `49121a6f5487060d322a59e7658166ab772e8a56f7dc1bcfa9d433a89436b30f`,与此前归档研究一致。原程序始终只读,未执行或操作其 FCP 界面。静态观察不是运行行为验收,也不能据此声称整个原版功能已完整迁移。
|
||||
|
||||
这里只保存行为、接口、参数和 Evidence 索引,不保存原版反编译源码、二进制、图标或其他资源。新功能仍是本产品自己的源码与 Metal 实现,不依赖 Color Finale 安装。
|
||||
|
||||
## 钢笔状态与可迁移交互
|
||||
|
||||
| 本机静态观察 | 入口与 Evidence |
|
||||
| --- | --- |
|
||||
| 选择 Bezier 新建模式后,首次点击建立可编辑/选中的零尺寸路径,交给新路径处理该点击,随后进入独立的路径编辑模式 | `FTShapeTrackerView::addShapeForEvent:` `0x1000e2900`,`ev_6539e1080a6e0d9cf27d9cb3c26703110b8f50030981b18cc075356840849e08` |
|
||||
| 新建与编辑路径是不同模式;离开路径编辑模式会尝试闭合当前路径 | `setShapeEditMode:` `0x1000e1fcc`,`ev_0f9372e98efac18d8f666dcf137addc2ecdaffdfdb153f0a31b3ecfc2ba8b9ca` |
|
||||
| 编辑态可向未闭合路径追加锚点,也有在曲线上插点的分支;放置后可拖出共线双柄 | `FTOnScreenBezierShape::mouseDown:` `0x10009be0c`,`ev_2dd4ac418346bd4d15d05f8145bb2a547ab531d742b4e8edfb3314fc49fdde0a`;`FTShapeBezierControlPoint::controlPoint:mouseDragged:` `0x10009d178`,`ev_ba0c6d39ae45e26b8ade69f41f6fb8da934c526a686e64be89690b762a11e585` |
|
||||
| 未闭合且至少三个点才允许闭合;点击首锚点会闭合 | `FTOnScreenPathShape::closePath` `0x100033ec8`,`ev_4c3864a55c7dc71ee02b67c4eed011dbe00a9d8072c275ff002607d22618c288`;`controlPoint:mouseDown:` `0x10003429c`,`ev_2fc54b9d31f2ac894aae0b560fee33284a155fe6505697c0a83be1af0bc0a8ea` |
|
||||
| 原版未闭合路径接收 Return 或 Esc 时均尝试闭合;Delete 删除选中锚点 | `FTOnScreenPathShape::keyDown:` `0x1000345c8`,`ev_d3bea253005ee2007c110f15d6658e542de8f2075d40585897b875f9b517ec2b` |
|
||||
| 画面工具栏有选择、路径编辑、矩形、椭圆、渐变边、B 样条、Bezier;预览按钮原生最小尺寸为30×22,另有8×8内边距 | `FTShapeTrackerControl::addToolbarButtons` `0x10001ef7c`,`ev_ea178e24d10afea13fa74a0d70941648d1ca4c45005a1533df478c9212f6f9b7` |
|
||||
|
||||
大鱼本轮保留明确的“Esc取消草稿”行为,与原版“Esc尝试结束闭合”不同。不能把新实现描述为所有快捷键均完全相同。当前产品旧钢笔入口未携带绘制态,且通知会清除绘制态;即使菜单项存在,也不能证明进入了放点模式。修复应同时覆盖绘制态、首点/Return结束、删除、草稿预览、提交和取消,以及再次选择已有路径的编辑。
|
||||
|
||||
形状属性控制器将 `feather`、`opacity`、`position`、`scale`、`rotation` 绑定到对应作者属性,见 `FTMaskShapeViewController::viewDidLoad` `0x10007f3b0`,Evidence `ev_533595e2ddf4c96d5c82f3ce25c7ff44a3549f37d8b80e5b5b5a82360e283c77`。完整检视器字号和运行时像素布局未取得充分静态证据;不能从符号名称推断其可读性。
|
||||
|
||||
## 跟踪差异与本轮改进
|
||||
|
||||
原版核心 `FTAreaTracker::track:trackerState:` `0x100035e40`,Evidence `ev_dcd7aa770925f63c8c14c968ae6b417fda78685c7be7fa739a78209957d40e2d`。逐帧作者状态 Evidence `ev_e798c4e6e032e085812f81831ecc16196bd3c2278bf634961379669ee1308f7e`(`0x100036cbc`)。原版每帧接收完整图像、最多3840×2160转换为8位灰度,将 position/rotation/scale 按 effectTime 写入作者键,不是渲染时临时估计。当前大鱼已经有精确时间键、相邻帧参考、丢失停止和这些变换输出;这些并非本轮才补齐。
|
||||
|
||||
| 项目 | 原版静态观察 | 大鱼1.4.0(24)与本轮选择 |
|
||||
| --- | --- | --- |
|
||||
| 区域 | 用形状点的凸包构造特征遮罩 | 原有实际多边形判断更贴合凹路径,但包围框和前置±0.5裁剪错误。本轮改为从实际路径顶点推导变换后搜索边界,保留实际多边形判断,修复默认框外钢笔纹理被裁掉的问题 |
|
||||
| 特征 | 300点,quality0.03,最小距离10,blockSize3 | 原有180点、0.012相对阈值、按帧大小变化的间距、5×5邻域。本轮调整为300点、0.03、10像素、3×3;仍采用独立中心差分与2像素候选扫描,并不等同OpenCV检测器 |
|
||||
| 角点精炼 | `cornerSubPix` 半窗10,20次/0.03 | 原有无亚像素精炼。本轮用独立加权梯度交点迭代,半窗10、20次/0.03,限制发散并保留初始点回退;不是复制OpenCV内部实现 |
|
||||
| 光流 | LK21×21,maxLevel3即最多4级,30次/0.01;前后误差严格小于1 | 原有9×9、最多5级、20次。本轮CPU和Metal统一21×21、最多4级、30次/0.01;保留原有均值去除、RMSE及≤1.1像素前后检查,不声称数值全等 |
|
||||
| 重检测 | 分析计数小于2或偶数时重检测并精炼 | 原有每5帧或少于60点补点。本轮每2帧或不足60时重选;新点少于12时保留仍可信旧点,后续仍须通过完整拟合/失效条件 |
|
||||
| 拟合 | `estimateAffine2D` RANSAC2000次、阈值3、confidence0.99、refine10 | 本轮保留确定性400次、1.6/1.5阈值、3次最小二乘、至少8点/52%内点与非线状分布检查。阈值不能无验证地照搬,否则可能把错误帧当作成功 |
|
||||
| 输出/失效 | 原版持久化位置、旋转和独立XY缩放,失败节点不再继续 | 大鱼保持QR分解位置/旋转/独立XY缩放,丢失停止、置信度和每步缩放/旋转保护。它比已观察到的原版分支更保守,不含透视或剪切输出 |
|
||||
|
||||
独立检查 `tools/verify_tool_tracking_followup.mm` 使用已知仿射变换生成图像,分别运行CPU和真实Metal后端。默认创建框外的钢笔区域在旧提交 `745aa1626e1df368290fbbd47a716ff3ce9ca630` 检出0点、无法启动;新版本检出117点,12帧亚像素移动末帧误差约X0.0073/Y0.0323像素。另覆盖300点实际传输、旋转与非等比缩放、静止重检测、换景拒绝、平坦区域拒绝,以及1920×1080/3840×2160完整帧。18项通过;4K生成两帧及分析本机记录约CPU111ms/Metal89ms,不是所有素材的性能承诺。
|
||||
|
||||
## “完整移植”的边界
|
||||
|
||||
本轮是可验证的独立重建与关键交互修复,不能宣称完整复制Color Finale蒙版系统。原版还观察到B样条、形状多选/编组、父蒙版、图像/人物/宿主外部蒙版、HSL取色增减与来源/模糊、发布蒙版/抠出、轨迹区域选择与按键区段编辑等体系;当前大鱼每工具六类蒙版不具备全部对应能力。`FTMaskDetailViewController` 的形状、HSL、图像、人物、FCP控制器方法库存见 Evidence `ev_0497fc6415b6b210fea8a052adf0f93483af228b44063dffd2c76d93a990cef1`。大鱼独立“亮度选区”不能据此称为已复刻原版某个独立Luma类;本次主插件范围没有取得该类的充分证据。
|
||||
|
||||
算法阈值及默认值对齐不是对真实视频的等价证明。本轮尚未取得原版与大鱼在同一真实视频、相同路径及分析范围下的完整轨迹对照,也未分析原版所有链接框架和动态形状UI。完整范围继续由差异清单追踪,不能把当前故障修复或合成检查通过替代这些开放项。
|
||||
|
||||
完整REA证据和恢复snapshot仅在本机研究缓存:`/Users/mac/Library/Caches/CodexBuilds/ColorResearch/dayu-mask-followup-20261101/`。当前REA目标已关闭,原产物未修改。Interface Builder decoder默认64文档首先遍历Sparkle,未覆盖后续蒙版nib;不能把该局限解释为蒙版UI不存在。新摘要保留此未知,不复制原版资源作为新产品界面。
|
||||
@@ -0,0 +1,95 @@
|
||||
# 续作方案:工具实例、蒙版与跟踪
|
||||
|
||||
2026-11-01。**这是下一阶段方案,尚未实现。** 用户明确要增加蒙版、跟踪和可添加工具,并举例“一层 HSL 不够,再加一个 HSL”。本文的具体类型、按钮和实施顺序为建议,不把参考库现有全部功能自动扩为新产品的承诺。
|
||||
|
||||
## 一、先解决多个 HSL 的身份和执行问题
|
||||
|
||||
当前固定 HSL 在 `DYModel.mm` 注册,使用 `DYUniforms` 的一组 `hsl*` 字段,`DYColorTables.mm` 构造一份 24 参数 HSL 查表。`DYGrade.metal` 调用融合的 `dy_grade`,蜘蛛盘随后执行。CST 位于原有显示域调色链之前。
|
||||
|
||||
推荐为可添加工具建立统一实例模型;先开放 HSL,一旦成立再扩展支持的类型。一个实例至少保存稳定 UUID、工具类型及版本、名称、启用状态、混合强度、独立参数和其蒙版引用;作者文档保存有序实例列表。显示名称和列表位置都不能代替身份。
|
||||
|
||||
界面最小闭环:添加工具 → HSL → 出现第二张独立 HSL 卡片 → 调整各自参数 → 单独启停/折叠 → 保存重开仍互不覆盖。复制、删除、重命名、排序是适合此模型的后续操作建议;若本阶段提供,均须使用同一作者状态和单次宿主撤销。
|
||||
|
||||
折叠只写 `folds[nodeID]` 一类界面状态,眼睛写实例启用;不能共用现有 `folds["hsl"]`。所有控件回调、异步加载、选中目标和 Undo 都绑定 nodeID + 参数键,不能绑定可能因插入/删除变化的数组下标。
|
||||
|
||||
### 渲染与旧参数的适配
|
||||
|
||||
先写清工具顺序和每个阶段的颜色域。保持 CST 输入/一级/输出的现有全局前段;新增 HSL 不应再执行一次 CST 或其它全局调整。当前固定链有融合内核,**不能为每个工具直接重复调用整个 `renderSource`**,否则会重复曝光、LUT、统计或空间处理。
|
||||
|
||||
原固定 HSL 可用稳定的兼容实例映射到原参数 ID,以保留旧工程和已有宿主动画;新增 HSL 必须有自己的参数存储与缓存。若需要将原链拆成可重排阶段,先做旧路径与拆分路径数值回归,再让新文档使用新计划。若先采用附加工具段,也必须在界面和文档明确其实际执行位置,不能让 UI 顺序与渲染顺序不同。
|
||||
|
||||
无新增状态的旧工程必须沿用原路径;显式迁移后记录格式版本,避免同一 HSL 同时从旧融合链和新实例链执行两次。旧参数 ID、枚举值、944 字节 ABI 前缀不能重排。新工具使用中性参数时应直通;关闭工具、混合为零或空新增列表应恢复原结果。
|
||||
|
||||
每个实例的查表/中间纹理缓存至少按 device、类型、完整有效参数和相关域信息隔离。第一层调值不能污染第二层。建立完整帧/分块、半透明、负值/HDR、重排以及连续多实例的检查,不把“面板能多开”当成多工具渲染已完成。
|
||||
|
||||
## 二、作者状态、动画和预设先定合同
|
||||
|
||||
本项目现有 `DYAssetState` 在参数 9001,标志含 `NOT_ANIMATABLE`。可以保留它存 LUT/蜘蛛盘资源;若新增工具参数需要宿主关键帧,须另行选择可动画的参数方案或明确时间化作者状态,不能直接塞入 9001 后默认为支持关键帧。
|
||||
|
||||
需区分:宿主可动画参数、工具/蒙版作者数据、逐帧求值后的不可变渲染计划,以及可丢弃缓存。轨迹作者数据随工程保存,运行计划按给定 CMTime 求值,不能由 UI 当前播放头或可变全局选择决定渲染。
|
||||
|
||||
所有新增类型应覆盖 NSSecureCoding 白名单、copy、isEqual、hash、验证、资源路径、预设、宿主归档和渲染状态。当前 InspectorToken schema 2、预设 JSON v3、临时 render-state schema 1 分属不同格式。不要用一次任意“schema++”代替各格式的明确迁移。
|
||||
|
||||
对新数据设置数量/大小/嵌套上限,验证有限数值、合法工具类型、UUID 唯一和引用完整性。失败加载保持旧作者文档;不加载任意类。必要时为当前插件增加明确文档格式,而不是依赖不可版本化的 UI 对象。
|
||||
|
||||
## 三、把蒙版绑定到工具实例
|
||||
|
||||
建议先移植矩形、椭圆和闭合钢笔;羽化、反转、强度和组合规则应有明确数学定义。其它 HSL/亮度键、人物或外部蒙版只作为父库的后续候选,未获本轮逐项指定。
|
||||
|
||||
每个工具保存自己的蒙版列表和当前蒙版 ID。首阶段优先正常混合:`output = mix(toolInput, toolResult, clamp(maskCoverage * toolOpacity, 0, 1))`。多蒙版的加/减/交集顺序、无蒙版的覆盖语义、空路径和禁用蒙版的含义须先确定并测试。不要用一个全局蒙版同时影响所有 HSL。
|
||||
|
||||
CPU、Metal、预览和 OSC 共用坐标合同:源图/目的图范围、宿主 tile bounds、top/bottom origin、非方形像素、缩放/旋转及视图变换都要处理。计算蒙版不能依赖检查器或浏览器尺寸。保留 alpha,明确直通 RGB 与预乘 RGB 的转换和混合边界。
|
||||
|
||||
画面控件通过宿主的 OSC 机制绘制,使用当前效果实例和稳定工具/蒙版 ID 隔离。点击效果标题、开关显示控件、关闭工具窗口后是否保留轮廓等行为在正式 FCP 中验证。不要自建一张静帧预览来冒充宿主当前画面的编辑和跟踪。
|
||||
|
||||
## 四、跟踪移植的范围与易错点
|
||||
|
||||
父库正式68采用 Metal 图像金字塔/正反光流与确定性 RANSAC,输出位置、旋转和独立横纵缩放。其输出合同不包括透视/剪切。建议复用前向、后向、同参考帧双向和前后单帧;连续范围、单帧参考区间、取消行为均按精确帧长定义,不猜帧率。
|
||||
|
||||
从宿主分析接口取得实际源帧。当前 `lookLUTPreview` 只是 320×180 预览,不足以替代最终跟踪输入;也不能靠拖动播放头或缓存最后一帧伪造完整分析。需要检查、实现并验证 FxAnalyzer / FxAnalysisAPI 生命周期和真实帧调度。
|
||||
|
||||
分析开始时冻结效果实例、文档/工具/蒙版 ID、形状 revision、参考 CMTime、范围和帧长。每次结果发布验证目标仍匹配;切片段、切实例、删除工具、编辑蒙版或新一轮分析后,过时回调不得写回当前文档。
|
||||
|
||||
将手工键和自动轨迹分开保存;手工修正优先,合并只替换指定区间的可替换自动结果,保留区间外轨迹、羽化和强度动画。取消保留可信段;空结果不制造作者编辑。低置信度/丢失要有明确提示,不能静默填成功或持续外推。
|
||||
|
||||
**先读父库 `research/tracking-host-lifecycle.md`。** 它记录过提前返回后不收尾、跨 action 分组无效、预览刷新吃掉 Undo/Redo、旧实例在切片段后持续刷新等实际问题。当前可复用方案在准备好结果后,单个有效 action 内完成命名 Undo 起止和完整作者状态写入,然后 endAction;分析收尾保证一次,迟到/重复收尾不再编辑。别恢复早期58–67的已知问题流程。
|
||||
|
||||
## 五、参考库导航(只读)
|
||||
|
||||
本次核对:`/Volumes/备份/大鱼调色/大鱼调色盘`,HEAD `f8950384e514685c8809fe8e8ee2dd5f16ad0bd7`;正式68源码 `d05994d5f4547687511bef524efe8c881e8a5c9c`。接手时先检查差异,若参考更新则固定并记录新节点。
|
||||
|
||||
| 参考入口 | 复用方向 |
|
||||
| --- | --- |
|
||||
| `HANDOFF.md`、`verification/release-2.0.0-build68.json` | 正式68的真实完成范围与宿主证据 |
|
||||
| `Sources/DYSettings.h/.mm` | 作者文档、图层、每层蒙版与归档 |
|
||||
| `Sources/DYPanelLayers.inc` | 图层/工具列表操作与编辑目标 |
|
||||
| `Sources/DYMaskState.h/.mm` | 精确 CMTime、手动/自动键、形状与变换求值 |
|
||||
| `Core/DYMask.h`、`DYMaskOperator.h`、`DYLayerPlan.h` | 蒙版数学、组合/源阶段、渲染计划 |
|
||||
| `Sources/DYPanelMasks.inc`、`DYInspectorMaskControls.inc` | 蒙版编辑器、宿主检查器入口 |
|
||||
| `Core/DYTracker.hpp`、`Sources/DYMetalTracker.h/.mm` | 光流后端、RANSAC、结果/区间合并 |
|
||||
| `Sources/DYPlugin.mm` | FxAnalyzer、目标冻结、取消/收尾、预览归属、Undo 提交 |
|
||||
| `Sources/DYRenderer.mm`、`Shaders/DYColor.metal` | 计划执行、纹理与蒙版合成,需适配本项目 |
|
||||
| `research/tracking-host-lifecycle.md` | 宿主生命周期、单 action 撤销和旧实例刷新防护 |
|
||||
| `Tools/test_tracking.py`、`Tools/test_mask_refinement.py` | 参考测试和合成运动素材思路,不能替代本产品验收 |
|
||||
|
||||
父库有独立 Bundle ID、参数表、1032 字节 DYGrade、作者格式和更大的产品范围。本项目为 1104 字节 DYUniforms。按功能适配源码,保留本产品颜色链和品牌/安装身份;不整仓覆盖、不盲抄 PID/结构体,不把父库已验收数量记成本项目通过。移入源码时记录来源节点、文件摘要与必要资源,构建不得依赖兄弟 APP 或另一目录运行时存在。
|
||||
|
||||
## 六、建议里程碑与验收
|
||||
|
||||
| 阶段 | 可交付行为 | 最低验收重点 |
|
||||
| --- | --- | --- |
|
||||
| A:两个 HSL | 独立添加、调值、眼睛和折叠;实例保存 | 不共用参数/缓存;旧工程画面不变;删除/插入不串目标;单次 Undo/Redo;重开与预设 |
|
||||
| B:每实例蒙版 | 两个 HSL 分别影响不同区域 | 蒙版/羽化/反转/透明度 CPU–GPU 对照;原点、tile、4K与非方形画面;关闭精确旁路 |
|
||||
| C:宿主控件 | 在 FCP 检视器画与改蒙版 | 当前实例隔离、真实拖动/绘制、工具窗口关闭后的行为、一次手势一次撤销 |
|
||||
| D:跟踪 | 实际运动帧驱动对应蒙版 | 前后/双向/单帧;取消可信段;低置信度;手工键优先;精确 CMTime;切片段/旧回调隔离 |
|
||||
| E:正式回归 | 保存、导出、性能与发行 | 冷重开轨迹完整一致;一次 Undo/Redo 的作者文档核对;旧预设/工程、CST/蜘蛛盘/LUT 回归;正式交付 |
|
||||
|
||||
用本产品独立合成源验证平移、旋转、独立轴缩放、边界/透明、局部遮挡或目标离画;量化中心和尺寸误差,并区分算法样本与实机结果。对任意遮挡不能作无证据保证。导出后检查完整运动序列,不能只看静态首帧轮廓。
|
||||
|
||||
新增无蒙版、无逐帧依赖的逐像素 HSL 可表达为 LUT;空间蒙版和跟踪不能完整写入普通 3D Cube。到实现时应明确选择阻止完整导出、或让用户明确导出全局部分,并在 UI 说明;不得静默丢掉局部调色后仍称完整一致。
|
||||
|
||||
## 七、工作与交付边界
|
||||
|
||||
本轮只交接,不实现这些功能、不改变正式 1.3.1(19)。下一轮遵循 `/Users/mac/.codex/AGENTS.md`:先保护当前工作,保存并推送阶段检查点;构建/CLI 测试在固定缓存,用户可见测试走已签名公证的唯一正式安装。新增功能后递增版本/构建号,刷新模型模板,完整签名、公证、安装、FCP 验收、清理、PKG、Release 完整下载与远端恢复。
|
||||
|
||||
用户正在使用浏览器时,不为额外测试重启或复位其工程。优先用新合成测试库,完整保留其 LUT、预设、最近使用和现有轨迹。此任务不需要 NAS 后端部署,不新增生产服务。
|
||||
@@ -0,0 +1,39 @@
|
||||
# 1.4.1:就地插层、蒙版可读性和钢笔修复
|
||||
|
||||
基线为1.4.0(24)后的主分支 `745aa1626e1df368290fbbd47a716ff3ce9ca630`。本轮原生Release构建281项检查通过,独立跟踪18项检查通过。正式签名、公证、宿主和安装包状态分别以 `verification/Delivery.json`、宿主记录、`Package.json`、`Release.json` 为准;此说明不代替实机验收。
|
||||
|
||||
## 插入位置与运算
|
||||
|
||||
新建工具文档schema2的节点保存 `after` 锚点,可引用原工具或另一个工具UUID。点击原HSL或新增HSL的“再加一层”,新层立即排在该层之后。再次点击原层时插在原层与此前第二层之间;删除层重接后续节点。参数仍从初始化值开始,独立保存身份、折叠、启停、蒙版和资源。
|
||||
|
||||
schema1及没有after的既有1.4.0尾部层保留原位置和原数学,不在打开旧工程时偷偷改变调色;新层和旧尾部层的子层可并存。序号按当前显示位置生成,作者身份始终为UUID。
|
||||
|
||||
原固定融合链的操作顺序早于当前界面分组,不重新排列旧模块。活跃插入通过独立分段内核执行在原工具的实际阶段之后;基础调整在第二阶段后、CST在前段、蜘蛛盘在原末端。原始内核保留,没有活跃新增层时使用原融合路径,初始化新层像素精确直通。
|
||||
|
||||
分段保留首次CST后的原图,供原邻域、白点统计、亮度权重和蒙版取样;保留原uniform及旧输入LUT,只禁止后段再次CST。肤色参考保留在原HSL之前。部分黑白混合若被黑白/LUT锚点切开,在共同前缀后保留黑白与彩色两支,原肤色之后混合,再执行新增肤色与一次蜘蛛盘。可证明全零覆盖的额外工具直接复制输入,避免空蒙版额外裁切HDR/负值。
|
||||
|
||||
HSL与后续颜色分级、红通道曲线与HSL的独立非交换参照,以及Cube同序检查通过。CST、原三原色+白点统计/纹理、旧输入LUT、亮度选区、肤色、基础第二阶段、部分黑白混合和蜘蛛盘的零覆盖插层参照通过,分段半浮点最大差异约0.001465。此差异不适用于所有素材和参数组合的精度保证。
|
||||
|
||||
## 蒙版控件与钢笔
|
||||
|
||||
面板参数与数字为13pt,状态12pt;数值框88×32pt,滑条单独占一行,操作按钮32–36pt高,跟踪按钮两列三行。六种类型在220/300/420pt宽度的边界、不重叠、字号和目标尺寸检查通过。画面工具栏依据宿主backingScaleFactor绘制,短画面换列。
|
||||
|
||||
修复检视器添加钢笔未携带绘制态的问题,提供“重画钢笔”“完成绘制”“取消绘制”。点击放点、按住拖出共线双柄,鼠标移动显示下一段预览;至少三个点时点首节点、Return或完成按钮闭合。Delete回退未提交点,选中已闭合路径节点可删除(至少保留三点)。Esc/取消恢复原作者路径。绘制中禁用跟踪,完成或取消后恢复。
|
||||
|
||||
OSC回调只在锁内更新内存草稿,立即供下一次绘制读取;宿主参数提交留到回调结束后的主队列,形成一次撤销。连续手势排队保留,跨帧草稿、过期目标和迟到模式通知拒绝覆盖。绘制、命中和坐标缓存也有自身互斥。画面位图上下坐标与AppKit上下文方向保持一致,修正钢笔提示条文字翻转。原生检查覆盖检视器入口、默认形状外放点、即时预览、曲柄、首节点/Return闭合、完成/取消按钮、归档、连续手势和跨帧拒绝。
|
||||
|
||||
## Color Finale 对照与跟踪
|
||||
|
||||
本机Color Finale 2.16.2(625)只读静态证据、精确产物摘要和迁移边界见 `ColorFinaleMasksFollowup.md/.json`。没有复制原版反编译源码、二进制、图标或运行库作为产品依赖。
|
||||
|
||||
修复原跟踪器将钢笔区域预先裁到创建框±0.5的问题。特征搜索边界由实际变换后的路径推导,保留真实多边形判断;300特征、相对质量0.03、10像素间隔、亚像素精炼、21×21 LK、最多4级、30次迭代、每两帧重检测。继续保留现有严格仿射拟合、置信度、丢失停止和手工键优先。宿主实际分析采样上限3840×2160,兼顾像素长宽比。
|
||||
|
||||
默认框外钢笔纹理在旧版检出0点、无法启动,新版117点;12帧亚像素运动末帧误差约X0.0073/Y0.0323像素。独立CPU与真实Metal18项覆盖300点容量、旋转、独立缩放、静止、换景/低纹理拒绝及4K;本产品281项原生集成同时覆盖实际插件FxAnalyzer回调的精确帧序、撤销、取消和过期写入。
|
||||
|
||||
这些是有证据的独立重建与适配,不代表Color Finale全部蒙版系统已经完整迁移。B样条、多选/编组、图像/人物/外部蒙版、来源和轨迹区段编辑等差异见专项清单;未进行同一真实视频的完整原版轨迹等价对照。旧系统、Intel、Motion和非方像素/变速工程仍需实机覆盖。
|
||||
|
||||
## 正式宿主验收
|
||||
|
||||
1.4.1(26)APP公证Accepted,唯一正式安装与281项原生检查通过。FCP12.4在独立合成工程中验证:相邻插入、连续原层点击插入顺序、零参数新层与32色相既有层独立、放大面板、绘制态/跟踪禁用、提示文字方向、钢笔蒙版正向99键和一次撤销/重做。冷重开后完整预设逐字节相同。
|
||||
|
||||
CUA坐标输入未进入原生OSC回调;实际鼠标钢笔放点与闭合仍待用户确认。跟踪宿主验收使用现存默认闭合四点钢笔路径,不称为新手绘路径。真实鼠标中心拖动有1.4.0用户确认,但不扩大为本轮钢笔确认。记录见 `verification/HostMaskWorkflow1.4.1.json`。
|
||||
@@ -0,0 +1,25 @@
|
||||
# 蜘蛛盘和一级白平衡色轮的移植
|
||||
|
||||
参考仓库只读,来源节点及逐文件 SHA-256 在 `SpiderAndBalanceSources.json`;生产构建只使用当前仓库内的源码、图像与 Metal 资源。
|
||||
|
||||
## 蜘蛛盘
|
||||
|
||||
复用“大鱼调色盘”的可变网格、交互和 CPU/Metal 数学。新实例为 6×6(31 个节点),色相与饱和度点数可联动或独立选择 6、8、12、16、24。保留单点同列自由点联动、固定点仍可直接拖动、⌘ 多选、Shift 固定、框选、整环/整列选择、右键复位与键盘微调。
|
||||
|
||||
本项目的 AppKit 适配遵循原工程的手动内存管理,网格仍使用原始结构。中性网格在生产渲染中精确直通;变形网格在既有调色链后运行原始 `dyVariableSpider` 和 `dyLimit`,透明度按原预乘边界处理。眼睛和混合控制独立于折叠,Cube 导出复用相同路径。
|
||||
|
||||
网格、固定点、密度及联动状态保存在现有 DYAssetState 自定义参数中。预设 schema 3 增加 JSON 蜘蛛盘数据,旧预设恢复为中性新盘;旧模型和参数 ID 继续注册。主线程只写小型状态,渲染侧按 Metal device 缓存样本网格。
|
||||
|
||||
## 一级白平衡
|
||||
|
||||
复用“大鱼 CST”的色轮图像和交互换算:+104° 方位校正、拖动距离 /5、圆形强度约束、双击归零。一级色轮直接写原 BASIS 的方向与强度参数,取代可见的两根滑块;角度参数范围修正为 0–360°,旧存储数值保持原解释。原 BASIS 的强度平方后乘 4 换算不变。
|
||||
|
||||
色轮与蜘蛛盘每次拖动都由 FxUndoAPI 合并成一次宿主撤销;视图移除或释放时结束未完成动作。
|
||||
|
||||
## 面板与兼容
|
||||
|
||||
输入转换、工作空间、一级参数、输出转换合并为一个一级调色卡片。移除可见的四个旧旁路选项,一级眼睛统一启停;旧阶段开关和旁路参数仍保留注册,避免仅打开旧工程就改变画面。用户明确编辑 CST/色轮或复位时才清理旧旁路。
|
||||
|
||||
新实例与全部还原默认展开一级调色、蜘蛛盘校色仪、基础调整,其他模块折叠,所有眼睛开启。折叠状态仍由 InspectorToken schema 2 保存,与渲染状态分离。
|
||||
|
||||
验证分为原生数学/像素检查、AppKit 回调检查和正式 FCP 操作记录。数学覆盖见 `verification/SpiderMath.json`,原生集成见 `verification/SpiderAndBalance.json`;正式宿主记录单独保存,不以离屏回调代替用户界面验收。
|
||||
@@ -0,0 +1,41 @@
|
||||
[
|
||||
{
|
||||
"repository": "https://dayu.media/git/dayu/dayu-colorplate.git",
|
||||
"commit": "f8950384e514685c8809fe8e8ee2dd5f16ad0bd7",
|
||||
"source": "Core/DYColorMath.h",
|
||||
"destination": "大鱼调色/Plugin/SpiderCore/DYColorMath.h",
|
||||
"sha256": "bdd6278e17ff4208ad94a8b0e834c817c0a3475f205dd79898e8fd88e84a19c9"
|
||||
},
|
||||
{
|
||||
"repository": "https://dayu.media/git/dayu/dayu-colorplate.git",
|
||||
"commit": "f8950384e514685c8809fe8e8ee2dd5f16ad0bd7",
|
||||
"source": "Core/DYSpiderMesh.hpp",
|
||||
"destination": "大鱼调色/Plugin/SpiderCore/DYSpiderMesh.hpp",
|
||||
"sha256": "81ecf1f0bae4030615144c7cd7ca492f93f2d718ff9e45da8242f97848e3d754"
|
||||
},
|
||||
{
|
||||
"repository": "https://dayu.media/git/dayu/dayu-cst.git",
|
||||
"commit": "973766b51dbcab3ab5092f1955d753575cd32d89",
|
||||
"source": "大鱼CST/Plugin/Resources/Basis_balanceWheel.png",
|
||||
"destination": "大鱼调色/Plugin/Resources/Basis_balanceWheel.png",
|
||||
"sha256": "56d6cc32611f90b53dfa2ae221d5d1c9633ae494b32bc3050ec85b8ad1220989"
|
||||
},
|
||||
{
|
||||
"repository": "https://dayu.media/git/dayu/dayu-colorplate.git",
|
||||
"commit": "f8950384e514685c8809fe8e8ee2dd5f16ad0bd7",
|
||||
"source": "Sources/DYPanel.mm",
|
||||
"sourceSHA256": "80c6d07abab2d9a78a6c7070e2edf395289a952c731d05423681727aed97035e",
|
||||
"section": "DYSpider class and point-count controls",
|
||||
"adaptedDestination": "DYSpiderDisc.inc.h / DYNewPanels.inc.h",
|
||||
"adaptations": "Host parameter adapter, manual ownership and this product theme; original geometry and control math retained."
|
||||
},
|
||||
{
|
||||
"repository": "https://dayu.media/git/dayu/dayu-cst.git",
|
||||
"commit": "973766b51dbcab3ab5092f1955d753575cd32d89",
|
||||
"source": "大鱼CST/Plugin/DayuCustomViews.mm",
|
||||
"sourceSHA256": "18e3bece1f627a24b875e9d02cbe938c183f6ed2ae9081e668ba460e5bf5d051",
|
||||
"section": "DayuBalanceWheelView: +104 degree orientation, /5 drag scale and radial clamp",
|
||||
"adaptedDestination": "DYNewPanels.inc.h",
|
||||
"adaptations": "Host parameter adapter, manual ownership and this product theme; original geometry and control math retained."
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,35 @@
|
||||
# 每工具蒙版与初始化叠层(1.4 开发记录)
|
||||
|
||||
基线:`edfb74b171f51d4beaa9926e27d2d80791fbf43c`,原正式版本 1.3.1(19)。当前正式安装 1.4.0(24),实际编译 `dbf25fe6719f17075362538dad0404951102524d`。以 verification/Delivery.json、HostToolMasks.json、Package.json 和 Release.json 分别核对安装、宿主、包和发布状态。
|
||||
|
||||
## 界面与顺序
|
||||
|
||||
十二个原模块标题栏均增加“添加蒙版”和“再加一层”。新增工具在原模块列表之后按添加顺序执行,使用稳定 UUID;不复制原层当前参数。每层保留原生 HSL、曲线、色轮、蜘蛛盘和 LUT 浏览器。独立启停、折叠、复位、删除;原层宿主 float ID 不动。新增一级使用 Rec.709/Gamma 2.4 同域输入输出,避免默认再次转换 Sony Log;新增肤色保护强度从零开始。
|
||||
|
||||
原有工具保留原融合内核顺序。单独增加 `dy_gradeMasked`,在原生运算各阶段按该模块覆盖率混合;基础调整原生分布的两个阶段共用它自己的蒙版。原 `dy_grade` 保留,不增加蒙版的旧工程调用它。蜘蛛盘在原末端、CST 在原前段,蒙版分别作用在自己的阶段。新增工具用只开启该工具的制服参数执行,不重放其它原模块。新增肤色保护以本次效果的源画面作为保护参考。
|
||||
|
||||
## 状态与数学
|
||||
|
||||
9002 为 `DYToolDocument` 静态作者参数,独立于旧9001资源参数;9003 为不随工程保存的 OSC 会话路由。新工具标量目前为静态作者值,不声称支持宿主标量关键帧。蒙版轨迹独立以精确 CMTime 存储,并在 pluginState 的给定时间求值。预设 v4 在 JSON 中用 base64 二进制 plist 保留完整工具/蒙版/轨迹,兼容载入 v1–3;无9002旧工程使用空文档。
|
||||
|
||||
最多32个新增工具;每工具16个蒙版;每蒙版16384个轨迹键,全文最多65536键和24MiB plist。验证工具类型、UUID、数值、路径/节点、时间顺序和合法参数。归档使用 NSSecureCoding 类白名单、独立 copy/equality/hash。缓存按设备/完整参数,非共享可变面板状态。循环纹理只保留当前与下一层,不将所有中间4K帧保留至函数结束。
|
||||
|
||||
六种蒙版:矩形、椭圆、闭合贝塞尔、线性渐变、HSL、亮度;复用父库128字节蒙版参数及原始覆盖数学。多蒙版有序相加 `1-(1-a)*(1-b)`、减去 `a*(1-b)`、相交 `a*b`;第一项减去从1开始;无启用蒙版为全覆盖。色彩选区取本段输入的显示编码色;几何使用源图完整范围、原点和像素长宽比。各运算在既有颜色域混合,保持alpha。空间蒙版/跟踪不能用Cube表达,导出时明确拒绝,完整预设可保留。
|
||||
|
||||
## 宿主画面与跟踪
|
||||
|
||||
原生 FxOnScreenControl_v4 注册到本产品 UUID。画面工具栏提供选择、钢笔、矩形、椭圆、渐变、HSL、亮度及显示开关;面板提供相同类型和数值编辑作为替代操作。中心、大小、旋转、钢笔节点和手柄在宿主真实画面编辑;钢笔 Enter 闭合、Escape 取消。画面手势先编辑内存草稿,结束时在单个 host action 中提交一次撤销。
|
||||
|
||||
跟踪从父库移植 Metal 金字塔/正反光流及确定性仿射 RANSAC(来源与摘要见 ToolMaskPort.json)。通过 FxAnalyzer 请求宿主实际完整源帧;960宽采样区别于320×180浏览器预览。参考帧和分析首帧比对方向;帧调度采用精确CMTime,遇到重复、跳帧、尺寸变化或低置信度停止。输出位置、旋转、独立宽高,不含透视和剪切。矩形/椭圆/闭合钢笔可前向、后向、双向、单帧跟踪。取消保留可信连续段,手工键优先,保留区间外键。冻结目标UUID和完整蒙版,过期目标不回写。一次收尾防重入、宿主状态轮询补缺失cleanup;结果准备好后单action写入、单次撤销。没有周期写入预览参数。
|
||||
|
||||
## 验证入口
|
||||
|
||||
`--self-test` 增加实际IOSurface/Metal多HSL独立顺序参照、六类型CPU/GPU覆盖对照、alpha、空/默认直通、归档/非法数据、原生面板复用和实际插件分析回调(模拟宿主调度,使用真实Metal运动帧)的检查。它不代替实机宿主验证。
|
||||
|
||||
`python3 tools/create_mask_host_fixture.py` 生成本产品专用合成运动和两个独立FCP项目;不修改旧项目或用户媒体。最终验收必须在唯一正式安装的已公证版本中进行,并另存结果。
|
||||
|
||||
24版正式路径222项原生检查通过;新增OSC检查使用真实Metal叠加,验证透明背景、坐标命中、异步拖动写回、单次撤销和Esc取消。作者文档以不可变快照供OSC读取,不在绘制回调中进入主插件宿主API;添加蒙版先发布选择快照,再结束参数提交。轨迹查找使用CMTime二分定位,渲染快照仅替换各蒙版的当前参数,不重复序列化全部轨迹。
|
||||
|
||||
24版FCP12.4实测:第二HSL从0到32独立保存,原HSL保持0;原层椭圆中心X数值改为0.6,新增层矩形保持0.5;正向99键,一次Undo到0键,一次Redo到99键且完整预设逐字节一致;双向100键;新增层独立单帧2键,播放头由1帧到2帧。正常退出重开后,完整预设逐字节一致,分别保留100/2键。初验自动化坐标点击未进入真实宿主hit/event回调;随后用户已确认实际鼠标中心拖动正常,原生hit/mouseDown/mouseDragged日志也已捕获,原层中心变为0.378/0.379而新增层仍0.5/0.5。用户试调结果保留。旋转、缩放、钢笔手势未实机确认,不能以模拟器通过代替。取消、过期目标和逆向精确节奏由原生模拟调度覆盖;Motion、Intel、变速/裁剪/非方像素未实测。发行标签保存首次验收快照,用户后续实际鼠标确认保存在主分支当前记录,标签不移动。
|
||||
|
||||
20–23版是本次中间验收节点,不作为最终发行。模板10005现采用父库原生Boolean flags8589934592/default0/value1,pluginVersion0解析当前插件。既有FCP保存的旧模板实例可能保留10005=0;画面控件需保存完整预设后重新应用新版效果,旧实例调色数学不自动迁移或覆盖。
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"sourceRepository": "https://dayu.media/git/dayu/dayu-colorplate.git",
|
||||
"sourceCommit": "f8950384e514685c8809fe8e8ee2dd5f16ad0bd7",
|
||||
"files": {
|
||||
"Core/DYMask.h": "ede701e3636c7608f5f8be3be2d95acfdd8080e751d18f89c6660bd874997101",
|
||||
"Core/DYMaskOperator.h": "43fa701ad574f38ce0ab4f4d3900bb034edaaa1adc09821d2f4443ee2b687ba2",
|
||||
"Core/DYTracker.hpp": "0d67d4d7d919cf3f255fe39f949c3e3ae6cad1a2ae07ad429ee45f1e23bdeb3e",
|
||||
"Sources/DYMetalTracker.mm": "11b49215e9e024e5d1aa59a57dc7ab28048f569cfa3ef6943c014ad26040883d",
|
||||
"Shaders/DYTracking.metal": "4949ffcc32701c95c2385e1ebd6425fbb8fe66771c801b65aaf0a308d23e155c"
|
||||
},
|
||||
"status": "implementation-in-progress",
|
||||
"scope": "Adapt parent mask mathematics, Metal bidirectional optical flow and deterministic affine RANSAC. No reference app runtime dependency."
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
{
|
||||
"archivesBase64": {
|
||||
"9000": "AAAAAAAAAb0qYnBsaXN0MDDUAQIDBAUGBwxYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctIICQoLXERhdGFJc0xlZ2FjeV8QD0JsaW5kRGF0YU9iamVjdIACgAGjDQ4PVSRudWxsTxD+YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVtDdXN0b20gRGF0YYABowsMEVUkbnVsbNINDg8QVnNjaGVtYVYkY2xhc3MQAYAC0hITFBVaJGNsYXNzbmFtZVgkY2xhc3Nlc18QEERZSW5zcGVjdG9yVG9rZW6iFhdfEBBEWUluc3BlY3RvclRva2VuWE5TT2JqZWN0CBEaJCkyN0lMWFpeZGlwd3l7gIuUp6q9AAAAAAAAAQEAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAMYIAAgAEQAaACQAKQAyADcASQBOAFsAbQBvAHEAdQB7AXwAAAAAAAACAQAAAAAAAAAQAAAAAAAAAAAAAAAAAAABfQA=",
|
||||
"9001": "AAAAAAAAAe8qYnBsaXN0MDDUAQIDBAUGBwxYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctIICQoLXERhdGFJc0xlZ2FjeV8QD0JsaW5kRGF0YU9iamVjdIACgAGjDQ4PVSRudWxsTxEBL2JwbGlzdDAw1AECAwQFBgcKWCR2ZXJzaW9uWSRhcmNoaXZlclQkdG9wWCRvYmplY3RzEgABhqBfEA9OU0tleWVkQXJjaGl2ZXLRCAlbQ3VzdG9tIERhdGGAAaULDBEXHVUkbnVsbNINDg8QVXBhdGhzViRjbGFzc4ACgATTEhMOFBUWV05TLmtleXNaTlMub2JqZWN0c6CggAPSGBkaG1okY2xhc3NuYW1lWCRjbGFzc2VzXE5TRGljdGlvbmFyeaIaHFhOU09iamVjdNIYGR4fXERZQXNzZXRTdGF0ZaIgHFxEWUFzc2V0U3RhdGUIERokKTI3SUxYWmBma3F4enyDi5aXmJqfqrPAw8zR3uEAAAAAAAABAQAAAAAAAAAhAAAAAAAAAAAAAAAAAAAA7ggACAARABoAJAApADIANwBJAE4AWwBtAG8AcQB1AHsBrgAAAAAAAAIBAAAAAAAAABAAAAAAAAAAAAAAAAAAAAGvAA=="
|
||||
"9000": "AAAAAAAAAisqYnBsaXN0MDDUAQIDBAUGBwxYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctIICQoLXERhdGFJc0xlZ2FjeV8QD0JsaW5kRGF0YU9iamVjdIACgAGjDQ4PVSRudWxsTxEBa2JwbGlzdDAw1AECAwQFBgcKWCR2ZXJzaW9uWSRhcmNoaXZlclQkdG9wWCRvYmplY3RzEgABhqBfEA9OU0tleWVkQXJjaGl2ZXLRCAlbQ3VzdG9tIERhdGGAAaULDBMZH1UkbnVsbNMNDg8QERJVZm9sZHNWc2NoZW1hViRjbGFzc4ACEAKABNMUFQ8WFxhXTlMua2V5c1pOUy5vYmplY3RzoKCAA9IaGxwdWiRjbGFzc25hbWVYJGNsYXNzZXNcTlNEaWN0aW9uYXJ5ohweWE5TT2JqZWN00hobICFfEBBEWUluc3BlY3RvclRva2VuoiIeXxAQRFlJbnNwZWN0b3JUb2tlbgAIABEAGgAkACkAMgA3AEkATABYAFoAYABmAG0AcwB6AIEAgwCFAIcAjgCWAKEAogCjAKUAqgC1AL4AywDOANcA3ADvAPIAAAAAAAACAQAAAAAAAAAjAAAAAAAAAAAAAAAAAAABBQgACAARABoAJAApADIANwBJAE4AWwBtAG8AcQB1AHsB6gAAAAAAAAIBAAAAAAAAABAAAAAAAAAAAAAAAAAAAAHrAA==",
|
||||
"9001": "AAAAAAAAAjcqYnBsaXN0MDDUAQIDBAUGBwxYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctIICQoLXERhdGFJc0xlZ2FjeV8QD0JsaW5kRGF0YU9iamVjdIACgAGjDQ4PVSRudWxsTxEBd2JwbGlzdDAw1AECAwQFBgcKWCR2ZXJzaW9uWSRhcmNoaXZlclQkdG9wWCRvYmplY3RzEgABhqBfEA9OU0tleWVkQXJjaGl2ZXLRCAlbQ3VzdG9tIERhdGGAAaULDBUbIVUkbnVsbNQNDg8QERITFFVwYXRoc1YkY2xhc3Ncc3BpZGVyTGlua2VkWnNwaWRlck1lc2iAAoAECYAA0xYXDhgZGldOUy5rZXlzWk5TLm9iamVjdHOgoIAD0hwdHh9aJGNsYXNzbmFtZVgkY2xhc3Nlc1xOU0RpY3Rpb25hcnmiHiBYTlNPYmplY3TSHB0iI1xEWUFzc2V0U3RhdGWiJCBcRFlBc3NldFN0YXRlAAgAEQAaACQAKQAyADcASQBMAFgAWgBgAGYAbwB1AHwAiQCUAJYAmACZAJsAogCqALUAtgC3ALkAvgDJANIA3wDiAOsA8AD9AQAAAAAAAAACAQAAAAAAAAAlAAAAAAAAAAAAAAAAAAABDQgACAARABoAJAApADIANwBJAE4AWwBtAG8AcQB1AHsB9gAAAAAAAAIBAAAAAAAAABAAAAAAAAAAAAAAAAAAAAH3AA==",
|
||||
"9002": "AAAAAAAAApUqYnBsaXN0MDDUAQIDBAUGBwxYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctIICQoLXERhdGFJc0xlZ2FjeV8QD0JsaW5kRGF0YU9iamVjdIACgAGjDQ4PVSRudWxsTxEB1WJwbGlzdDAw1AECAwQFBgcKWCR2ZXJzaW9uWSRhcmNoaXZlclQkdG9wWCRvYmplY3RzEgABhqBfEA9OU0tleWVkQXJjaGl2ZXLRCAlbQ3VzdG9tIERhdGGAAawLDBEdHh8gJCotMDFVJG51bGzSDQ4PEFhkb2N1bWVudFYkY2xhc3OAAoAL0xITDhQYHFdOUy5rZXlzWk5TLm9iamVjdHOjFRYXgAOABIAFoxkaG4AGgAiACoAHWWJhc2VNYXNrc1ZsYXllcnNWc2NoZW1h0xITDiEiHKCggAfSJSYnKFokY2xhc3NuYW1lWCRjbGFzc2VzXE5TRGljdGlvbmFyeaInKVhOU09iamVjdNITDissoIAJ0iUmLi9XTlNBcnJheaIuKRAB0iUmMjNeRFlUb29sRG9jdW1lbnSiNCleRFlUb29sRG9jdW1lbnQACAARABoAJAApADIANwBJAEwAWABaAGcAbQByAHsAggCEAIYAjQCVAKAApACmAKgAqgCuALAAsgC0ALYAwADHAM4A1QDWANcA2QDeAOkA8gD/AQIBCwEQAREBEwEYASABIwElASoBOQE8AAAAAAAAAgEAAAAAAAAANQAAAAAAAAAAAAAAAAAAAUsIAAgAEQAaACQAKQAyADcASQBOAFsAbQBvAHEAdQB7AlQAAAAAAAACAQAAAAAAAAAQAAAAAAAAAAAAAAAAAAACVQA="
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
@@ -44,10 +45,834 @@
|
||||
"offset": 56,
|
||||
"pid": 2014,
|
||||
"step": 0.01,
|
||||
"title": "输入强度"
|
||||
"title": "旧版输入强度"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"key": "cmConfigured",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
"min": -1,
|
||||
"offset": 944,
|
||||
"pid": 2236,
|
||||
"step": 0.01,
|
||||
"title": "CST 配置版本"
|
||||
},
|
||||
{
|
||||
"cmTab": 0,
|
||||
"default": 1,
|
||||
"key": "cminputEnabled",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 964,
|
||||
"pid": 2241,
|
||||
"step": 0.01,
|
||||
"title": "输入转换启用"
|
||||
},
|
||||
{
|
||||
"cmTab": 0,
|
||||
"default": 28,
|
||||
"key": "cminputTransfer",
|
||||
"kind": "popup",
|
||||
"max": 1003,
|
||||
"min": 0,
|
||||
"notAnimatable": true,
|
||||
"offset": 948,
|
||||
"options": [
|
||||
"KOLOR Default",
|
||||
"ACEScct",
|
||||
"Apple Log",
|
||||
"Apple Log 2",
|
||||
"ARRI LogC3",
|
||||
"ARRI LogC4",
|
||||
"Blackmagic Film Gen 5",
|
||||
"Canon C-Log",
|
||||
"Canon C-Log 2",
|
||||
"Canon C-Log 3",
|
||||
"DaVinci Intermediate",
|
||||
"DJI D-Log",
|
||||
"DJI D-Log 2",
|
||||
"DJI D-Log M",
|
||||
"Fujifilm F-Log",
|
||||
"Fujifilm F-Log2",
|
||||
"Fujifilm F-Log2 C",
|
||||
"GoPro GP-Log",
|
||||
"GoPro GP-Log2",
|
||||
"GoPro GP-Log2 (Official, 0 EV)",
|
||||
"Insta I-Log",
|
||||
"Leica L-Log",
|
||||
"Linear",
|
||||
"Nikon N-Log",
|
||||
"Panasonic V-Log",
|
||||
"Phantom Log 1",
|
||||
"Phantom Log 2",
|
||||
"REDLog3G10",
|
||||
"Samsung Log",
|
||||
"Sony S-Log2",
|
||||
"Sony S-Log3",
|
||||
"Gamma 2.2",
|
||||
"Gamma 2.4",
|
||||
"Gamma 2.6"
|
||||
],
|
||||
"pid": 2237,
|
||||
"step": 1,
|
||||
"title": "输入曲线",
|
||||
"values": [
|
||||
99,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
30,
|
||||
29,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27,
|
||||
28,
|
||||
1001,
|
||||
1002,
|
||||
1003
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmTab": 0,
|
||||
"default": 27,
|
||||
"key": "cminputGamut",
|
||||
"kind": "popup",
|
||||
"max": 1003,
|
||||
"min": 0,
|
||||
"notAnimatable": true,
|
||||
"offset": 952,
|
||||
"options": [
|
||||
"KOLOR Default",
|
||||
"ACES AP0",
|
||||
"ACES AP1",
|
||||
"Apple Log 2",
|
||||
"ARRI WG3",
|
||||
"ARRI WG4",
|
||||
"Blackmagic Wide Gamut",
|
||||
"Canon Cinema Gamut",
|
||||
"DaVinci Wide Gamut",
|
||||
"DJI Action 5",
|
||||
"DJI Air 2S",
|
||||
"DJI D-Gamut",
|
||||
"DJI D-Gamut 2",
|
||||
"DJI Mavic2 Pro",
|
||||
"DJI Mavic 3 Pro",
|
||||
"DJI Mini 4 Pro",
|
||||
"DJI Mini 5 Pro",
|
||||
"DJI Pocket 3",
|
||||
"Fujifilm F-GamutC",
|
||||
"GoPro GP-Log",
|
||||
"P3-DCI",
|
||||
"P3 D65",
|
||||
"Panasonic V-Gamut",
|
||||
"Rec.709 / BT.709",
|
||||
"Rec.2020 / BT.2020",
|
||||
"RED Wide Gamut RGB",
|
||||
"Sony S-Gamut",
|
||||
"Sony S-Gamut3",
|
||||
"Sony S-Gamut3.Cine"
|
||||
],
|
||||
"pid": 2238,
|
||||
"step": 1,
|
||||
"title": "输入色域",
|
||||
"values": [
|
||||
99,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
16,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
28,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmTab": 0,
|
||||
"default": 10,
|
||||
"key": "cmworkingTransfer",
|
||||
"kind": "popup",
|
||||
"max": 1003,
|
||||
"min": 0,
|
||||
"notAnimatable": true,
|
||||
"offset": 956,
|
||||
"options": [
|
||||
"KOLOR Default",
|
||||
"ACEScct",
|
||||
"Apple Log",
|
||||
"Apple Log 2",
|
||||
"ARRI LogC3",
|
||||
"ARRI LogC4",
|
||||
"Blackmagic Film Gen 5",
|
||||
"Canon C-Log",
|
||||
"Canon C-Log 2",
|
||||
"Canon C-Log 3",
|
||||
"DaVinci Intermediate",
|
||||
"DJI D-Log",
|
||||
"DJI D-Log 2",
|
||||
"DJI D-Log M",
|
||||
"Fujifilm F-Log",
|
||||
"Fujifilm F-Log2",
|
||||
"Fujifilm F-Log2 C",
|
||||
"GoPro GP-Log",
|
||||
"GoPro GP-Log2",
|
||||
"GoPro GP-Log2 (Official, 0 EV)",
|
||||
"Insta I-Log",
|
||||
"Leica L-Log",
|
||||
"Linear",
|
||||
"Nikon N-Log",
|
||||
"Panasonic V-Log",
|
||||
"Phantom Log 1",
|
||||
"Phantom Log 2",
|
||||
"REDLog3G10",
|
||||
"Samsung Log",
|
||||
"Sony S-Log2",
|
||||
"Sony S-Log3",
|
||||
"Gamma 2.2",
|
||||
"Gamma 2.4",
|
||||
"Gamma 2.6"
|
||||
],
|
||||
"pid": 2239,
|
||||
"step": 1,
|
||||
"title": "工作曲线",
|
||||
"values": [
|
||||
99,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
30,
|
||||
29,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27,
|
||||
28,
|
||||
1001,
|
||||
1002,
|
||||
1003
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmTab": 0,
|
||||
"default": 16,
|
||||
"key": "cmworkingGamut",
|
||||
"kind": "popup",
|
||||
"max": 1003,
|
||||
"min": 0,
|
||||
"notAnimatable": true,
|
||||
"offset": 960,
|
||||
"options": [
|
||||
"KOLOR Default",
|
||||
"ACES AP0",
|
||||
"ACES AP1",
|
||||
"Apple Log 2",
|
||||
"ARRI WG3",
|
||||
"ARRI WG4",
|
||||
"Blackmagic Wide Gamut",
|
||||
"Canon Cinema Gamut",
|
||||
"DaVinci Wide Gamut",
|
||||
"DJI Action 5",
|
||||
"DJI Air 2S",
|
||||
"DJI D-Gamut",
|
||||
"DJI D-Gamut 2",
|
||||
"DJI Mavic2 Pro",
|
||||
"DJI Mavic 3 Pro",
|
||||
"DJI Mini 4 Pro",
|
||||
"DJI Mini 5 Pro",
|
||||
"DJI Pocket 3",
|
||||
"Fujifilm F-GamutC",
|
||||
"GoPro GP-Log",
|
||||
"P3-DCI",
|
||||
"P3 D65",
|
||||
"Panasonic V-Gamut",
|
||||
"Rec.709 / BT.709",
|
||||
"Rec.2020 / BT.2020",
|
||||
"RED Wide Gamut RGB",
|
||||
"Sony S-Gamut",
|
||||
"Sony S-Gamut3",
|
||||
"Sony S-Gamut3.Cine"
|
||||
],
|
||||
"pid": 2240,
|
||||
"step": 1,
|
||||
"title": "工作色域",
|
||||
"values": [
|
||||
99,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
16,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
28,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmTab": 0,
|
||||
"default": 1,
|
||||
"key": "cmmix",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1076,
|
||||
"pid": 2269,
|
||||
"step": 0.01,
|
||||
"title": "CST 混合"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 1,
|
||||
"key": "cmbasisEnabled",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 968,
|
||||
"pid": 2242,
|
||||
"step": 0.01,
|
||||
"title": "一级调色启用"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmexposure",
|
||||
"kind": "float",
|
||||
"max": 5,
|
||||
"min": -5,
|
||||
"offset": 988,
|
||||
"pid": 2247,
|
||||
"step": 0.01,
|
||||
"title": "一级曝光"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmbalanceAngle",
|
||||
"kind": "float",
|
||||
"max": 360,
|
||||
"min": 0,
|
||||
"offset": 992,
|
||||
"pid": 2248,
|
||||
"step": 1,
|
||||
"title": "色彩平衡方向"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmbalanceStrength",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 996,
|
||||
"pid": 2249,
|
||||
"step": 0.01,
|
||||
"title": "色彩平衡强度"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 1,
|
||||
"key": "cmsaturation",
|
||||
"kind": "float",
|
||||
"max": 2,
|
||||
"min": 0,
|
||||
"offset": 1000,
|
||||
"pid": 2250,
|
||||
"step": 0.01,
|
||||
"title": "一级饱和度"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmcontrast",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": -1,
|
||||
"offset": 1004,
|
||||
"pid": 2251,
|
||||
"step": 0.01,
|
||||
"title": "一级对比度"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmpivot",
|
||||
"kind": "float",
|
||||
"max": 3,
|
||||
"min": -3,
|
||||
"offset": 1008,
|
||||
"pid": 2252,
|
||||
"step": 0.01,
|
||||
"title": "对比度轴心"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmhiContrast",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": -1,
|
||||
"offset": 1012,
|
||||
"pid": 2253,
|
||||
"step": 0.01,
|
||||
"title": "高光对比度"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmhiPivot",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": -1,
|
||||
"offset": 1016,
|
||||
"pid": 2254,
|
||||
"step": 0.01,
|
||||
"title": "高光轴心"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmshadowContrast",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": -1,
|
||||
"offset": 1020,
|
||||
"pid": 2255,
|
||||
"step": 0.01,
|
||||
"title": "阴影对比度"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmshadowPivot",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": -1,
|
||||
"offset": 1024,
|
||||
"pid": 2256,
|
||||
"step": 0.01,
|
||||
"title": "阴影轴心"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 1,
|
||||
"key": "cmwhite",
|
||||
"kind": "float",
|
||||
"max": 1.5,
|
||||
"min": 0.5,
|
||||
"offset": 1028,
|
||||
"pid": 2257,
|
||||
"step": 0.01,
|
||||
"title": "白点"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0.5,
|
||||
"key": "cmshoulder",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1032,
|
||||
"pid": 2258,
|
||||
"step": 0.01,
|
||||
"title": "肩部压缩"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmhighlights",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": -1,
|
||||
"offset": 1036,
|
||||
"pid": 2259,
|
||||
"step": 0.01,
|
||||
"title": "一级高光"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmmidtones",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": -1,
|
||||
"offset": 1040,
|
||||
"pid": 2260,
|
||||
"step": 0.01,
|
||||
"title": "一级中间调"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmshadows",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": -1,
|
||||
"offset": 1044,
|
||||
"pid": 2261,
|
||||
"step": 0.01,
|
||||
"title": "一级阴影"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmblack",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": -1,
|
||||
"offset": 1048,
|
||||
"pid": 2262,
|
||||
"step": 0.01,
|
||||
"title": "黑点"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0.5,
|
||||
"key": "cmtoe",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1052,
|
||||
"pid": 2263,
|
||||
"step": 0.01,
|
||||
"title": "趾部压缩"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0.5,
|
||||
"key": "cmchromaMix",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1056,
|
||||
"pid": 2264,
|
||||
"step": 0.01,
|
||||
"title": "色度混合"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmbypassExposure",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1060,
|
||||
"pid": 2265,
|
||||
"step": 0.01,
|
||||
"title": "旁路一级曝光"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmbypassBalance",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1064,
|
||||
"pid": 2266,
|
||||
"step": 0.01,
|
||||
"title": "旁路一级色彩"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmbypassContrast",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1068,
|
||||
"pid": 2267,
|
||||
"step": 0.01,
|
||||
"title": "旁路一级对比"
|
||||
},
|
||||
{
|
||||
"cmTab": 1,
|
||||
"default": 0,
|
||||
"key": "cmbypassTone",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1072,
|
||||
"pid": 2268,
|
||||
"step": 0.01,
|
||||
"title": "旁路一级影调"
|
||||
},
|
||||
{
|
||||
"cmTab": 2,
|
||||
"default": 1,
|
||||
"key": "cmoutputEnabled",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 972,
|
||||
"pid": 2243,
|
||||
"step": 0.01,
|
||||
"title": "输出转换启用"
|
||||
},
|
||||
{
|
||||
"cmTab": 2,
|
||||
"default": 1002,
|
||||
"key": "cmoutputTransfer",
|
||||
"kind": "popup",
|
||||
"max": 1003,
|
||||
"min": 0,
|
||||
"notAnimatable": true,
|
||||
"offset": 976,
|
||||
"options": [
|
||||
"KOLOR Default",
|
||||
"ACEScct",
|
||||
"Apple Log",
|
||||
"Apple Log 2",
|
||||
"ARRI LogC3",
|
||||
"ARRI LogC4",
|
||||
"Blackmagic Film Gen 5",
|
||||
"Canon C-Log",
|
||||
"Canon C-Log 2",
|
||||
"Canon C-Log 3",
|
||||
"DaVinci Intermediate",
|
||||
"DJI D-Log",
|
||||
"DJI D-Log 2",
|
||||
"DJI D-Log M",
|
||||
"Fujifilm F-Log",
|
||||
"Fujifilm F-Log2",
|
||||
"Fujifilm F-Log2 C",
|
||||
"GoPro GP-Log",
|
||||
"GoPro GP-Log2",
|
||||
"GoPro GP-Log2 (Official, 0 EV)",
|
||||
"Insta I-Log",
|
||||
"Leica L-Log",
|
||||
"Linear",
|
||||
"Nikon N-Log",
|
||||
"Panasonic V-Log",
|
||||
"Phantom Log 1",
|
||||
"Phantom Log 2",
|
||||
"REDLog3G10",
|
||||
"Samsung Log",
|
||||
"Sony S-Log2",
|
||||
"Sony S-Log3",
|
||||
"Gamma 2.2",
|
||||
"Gamma 2.4",
|
||||
"Gamma 2.6"
|
||||
],
|
||||
"pid": 2244,
|
||||
"step": 1,
|
||||
"title": "输出曲线",
|
||||
"values": [
|
||||
99,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
30,
|
||||
29,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27,
|
||||
28,
|
||||
1001,
|
||||
1002,
|
||||
1003
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmTab": 2,
|
||||
"default": 22,
|
||||
"key": "cmoutputGamut",
|
||||
"kind": "popup",
|
||||
"max": 1003,
|
||||
"min": 0,
|
||||
"notAnimatable": true,
|
||||
"offset": 980,
|
||||
"options": [
|
||||
"KOLOR Default",
|
||||
"ACES AP0",
|
||||
"ACES AP1",
|
||||
"Apple Log 2",
|
||||
"ARRI WG3",
|
||||
"ARRI WG4",
|
||||
"Blackmagic Wide Gamut",
|
||||
"Canon Cinema Gamut",
|
||||
"DaVinci Wide Gamut",
|
||||
"DJI Action 5",
|
||||
"DJI Air 2S",
|
||||
"DJI D-Gamut",
|
||||
"DJI D-Gamut 2",
|
||||
"DJI Mavic2 Pro",
|
||||
"DJI Mavic 3 Pro",
|
||||
"DJI Mini 4 Pro",
|
||||
"DJI Mini 5 Pro",
|
||||
"DJI Pocket 3",
|
||||
"Fujifilm F-GamutC",
|
||||
"GoPro GP-Log",
|
||||
"P3-DCI",
|
||||
"P3 D65",
|
||||
"Panasonic V-Gamut",
|
||||
"Rec.709 / BT.709",
|
||||
"Rec.2020 / BT.2020",
|
||||
"RED Wide Gamut RGB",
|
||||
"Sony S-Gamut",
|
||||
"Sony S-Gamut3",
|
||||
"Sony S-Gamut3.Cine"
|
||||
],
|
||||
"pid": 2245,
|
||||
"step": 1,
|
||||
"title": "输出色域",
|
||||
"values": [
|
||||
99,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
16,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
28,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmTab": 2,
|
||||
"default": 0,
|
||||
"key": "cmtoneMapping",
|
||||
"kind": "popup",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"notAnimatable": true,
|
||||
"offset": 984,
|
||||
"options": [
|
||||
"关闭",
|
||||
"开启"
|
||||
],
|
||||
"pid": 2246,
|
||||
"step": 0.01,
|
||||
"title": "自动色调映射",
|
||||
"values": [
|
||||
0,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"key": "inputEnabled",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
@@ -55,7 +880,7 @@
|
||||
"offset": 132,
|
||||
"pid": 2033,
|
||||
"step": 0.01,
|
||||
"title": "输入 / LUT"
|
||||
"title": "输入转换 / CST"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
@@ -368,6 +1193,39 @@
|
||||
"step": 1,
|
||||
"title": "复制时自动调色"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"key": "primaryMasterEnabled",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1084,
|
||||
"pid": 2271,
|
||||
"step": 0.01,
|
||||
"title": "一级调色总开关"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"key": "spiderMix",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1092,
|
||||
"pid": 2273,
|
||||
"step": 0.01,
|
||||
"title": "蜘蛛盘混合"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"key": "spiderEnabled",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1088,
|
||||
"pid": 2272,
|
||||
"step": 0.01,
|
||||
"title": "蜘蛛盘校色仪"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"key": "baseEnabled",
|
||||
@@ -413,7 +1271,7 @@
|
||||
"title": "肤色色相"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"default": 1,
|
||||
"key": "skinEnabled",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
@@ -523,7 +1381,7 @@
|
||||
"title": "风格 5 强度"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"default": 1,
|
||||
"key": "lookEnabled",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
@@ -1106,7 +1964,7 @@
|
||||
"title": "蓝 扩展点4 X"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"default": 1,
|
||||
"key": "curveEnabled",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
@@ -1491,7 +2349,7 @@
|
||||
"title": "显示自定义色选区"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"default": 1,
|
||||
"key": "hslEnabled",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
@@ -1656,7 +2514,7 @@
|
||||
"title": "平衡"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"default": 1,
|
||||
"key": "gradingEnabled",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
@@ -1733,7 +2591,7 @@
|
||||
"title": "蓝原色 饱和度"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"default": 1,
|
||||
"key": "primariesEnabled",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
@@ -1964,7 +2822,7 @@
|
||||
"title": "蓝 输出白"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"default": 1,
|
||||
"key": "levelsEnabled",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
@@ -2064,6 +2922,17 @@
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"key": "blackWhiteMix",
|
||||
"kind": "float",
|
||||
"max": 1,
|
||||
"min": 0,
|
||||
"offset": 1080,
|
||||
"pid": 2270,
|
||||
"step": 0.01,
|
||||
"title": "黑白混合"
|
||||
},
|
||||
{
|
||||
"default": 1,
|
||||
"key": "blackwhiteEnabled",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
@@ -2184,7 +3053,7 @@
|
||||
"title": "高光 黄 ↔ 蓝"
|
||||
},
|
||||
{
|
||||
"default": 0,
|
||||
"default": 1,
|
||||
"key": "balanceEnabled",
|
||||
"kind": "bool",
|
||||
"max": 1,
|
||||
@@ -2196,9 +3065,18 @@
|
||||
}
|
||||
],
|
||||
"sourceSHA256": {
|
||||
"template/tools/dump_model.mm": "2ef22e010e0cae15b73107d39fb2c125f6049b1e5405e88078f936cf29e79350",
|
||||
"大鱼调色/Plugin/DYModel.h": "66507eb37e0c0e3426a10ab45f7388fd53fcba570a715a6574396056731d5129",
|
||||
"大鱼调色/Plugin/DYModel.mm": "cf46784f302014d7c025249c5ebbd02505a5e70739ec3ffc0d269890601bb5c5",
|
||||
"大鱼调色/Plugin/DYUniforms.h": "06db5ec83703aa320c9569a7de08617a2fdbc535ac29f438558959d485aa2138"
|
||||
"template/tools/dump_model.mm": "04e04446aa351d774913bc25b06512fefe7969bdf4c6e471a91f1e9d6c4fc3b5",
|
||||
"大鱼调色/Plugin/DYCSTTypes.h": "3372e3cd77248eeb374e54675d2902befceea8e00a2afc4f9543116ef3027696",
|
||||
"大鱼调色/Plugin/DYColorManagement.h": "b0a4cd1b8c45dbce90a7b4f30f72ebf95ecd382895e74e3bfeda0f7cdb185157",
|
||||
"大鱼调色/Plugin/DYModel.h": "80e88add97deeac7a9dc47d12f68b0245905786297de2e6553b3da15c729da6e",
|
||||
"大鱼调色/Plugin/DYModel.mm": "beadabb0773e911581dedc263f55a49e03dde6e6d1fc2329df18cb384710d234",
|
||||
"大鱼调色/Plugin/DYSpiderState.h": "0c80747e41e8fc97762e301b011bd08c18865a825eaafde086ed79ace37b22f9",
|
||||
"大鱼调色/Plugin/DYToolState.h": "28088ec819307a60f2e52334fd807a514c3ff8a550bc0efbe7069b68a6242320",
|
||||
"大鱼调色/Plugin/DYToolState.mm": "9ddc4b7509ad63fc24d1724359b4a218609f90b971eee57f6cdeda0c1b309129",
|
||||
"大鱼调色/Plugin/DYUniforms.h": "8ef480025c739b29f55884ba0c7218e9d6fd8d80c46cfc72d6ee3da90215abe4",
|
||||
"大鱼调色/Plugin/MaskCore/DYMask.h": "5b9aa44390d4a1fca1baf5e34cb9eefc8483c939a65cc2a0412b7b41fc85bc16",
|
||||
"大鱼调色/Plugin/MaskCore/DYMaskOperator.h": "43fa701ad574f38ce0ab4f4d3900bb034edaaa1adc09821d2f4443ee2b687ba2",
|
||||
"大鱼调色/Plugin/SpiderCore/DYColorMath.h": "bdd6278e17ff4208ad94a8b0e834c817c0a3475f205dd79898e8fd88e84a19c9",
|
||||
"大鱼调色/Plugin/SpiderCore/DYSpiderMesh.hpp": "81ecf1f0bae4030615144c7cd7ca492f93f2d718ff9e45da8242f97848e3d754"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "DYModel.h"
|
||||
#import "DYToolState.h"
|
||||
|
||||
static NSString *archive(id object) {
|
||||
NSKeyedArchiver *inner=[[[NSKeyedArchiver alloc]initRequiringSecureCoding:YES]autorelease];
|
||||
@@ -17,7 +18,7 @@ static NSString *archive(id object) {
|
||||
return [carrier base64EncodedStringWithOptions:0];
|
||||
}
|
||||
int main(void){@autoreleasepool{
|
||||
NSDictionary *out=@{@"parameters":DYDescriptors(),@"archivesBase64":@{@"9000":archive([[[DYInspectorToken alloc]init]autorelease]),@"9001":archive([[[DYAssetState alloc]init]autorelease])}};
|
||||
NSDictionary *out=@{@"parameters":DYDescriptors(),@"archivesBase64":@{@"9000":archive([[[DYInspectorToken alloc]init]autorelease]),@"9001":archive([[[DYAssetState alloc]init]autorelease]),@"9002":archive([[[DYToolDocument alloc]init]autorelease])}};
|
||||
NSError *error=nil;NSData *json=[NSJSONSerialization dataWithJSONObject:out options:NSJSONWritingPrettyPrinted|NSJSONWritingSortedKeys error:&error];
|
||||
if(!json){fprintf(stderr,"Could not export our model metadata\n");return 2;}fwrite(json.bytes,1,json.length,stdout);return 0;
|
||||
}}
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"passed": true,
|
||||
"sha256": "ebf8b7aa7a6781b9ce611375a838d89997656b0fc01077b2a7e5b1b2a2c373e1",
|
||||
"sha256": "9b8f6e407545429b77c1de88d4cceb738760771c5a7f1dbd9732bdcc95c23738",
|
||||
"version": "5.13",
|
||||
"displayversion": "5.6.7",
|
||||
"filterCount": 1,
|
||||
"nativeFloatParameters": 196,
|
||||
"customParameters": 2,
|
||||
"nativeFloatParameters": 234,
|
||||
"customParameters": 3,
|
||||
"publications": [
|
||||
{
|
||||
"object": "10081",
|
||||
|
||||
+61
-18
@@ -288,22 +288,61 @@
|
||||
<parameter name="宽度" id="313" flags="8589934610" default="1" value="3840" />
|
||||
<parameter name="高度" id="314" flags="8589934610" default="1" value="2160" />
|
||||
</parameter>
|
||||
<filter name="大鱼调色" id="10060" factoryID="5" pluginUUID="1C17B73B-F229-4C09-A434-EAF6DFF5F22A" pluginVersion="1" pluginName="大鱼调色" pluginDynamicParams="0">
|
||||
<filter name="大鱼调色" id="10060" factoryID="5" pluginUUID="1C17B73B-F229-4C09-A434-EAF6DFF5F22A" pluginVersion="0" pluginName="大鱼调色" pluginDynamicParams="0">
|
||||
<timing in="0 1 1 0" out="1199198 120000 1 0" offset="0 1 1 0" />
|
||||
<baseFlags>8589934608</baseFlags>
|
||||
<parameter name="大鱼调色" id="9000" flags="12884901888">
|
||||
<numberOfKeypoints>0</numberOfKeypoints>
|
||||
<defaultVal>*********PoeMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl1yMb-gOLBoA11I*E61-*I4-kdM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh260Jh1RLBoPqoUF43oMM*-ckgA2JIYPbJgPB6B1UwEJbBXO4JhMJMYMqlVQrAE*M*0oV6H3-JO74BgMLBnPa3hNJUYMqlVQrBZQpwE22FNGKtnQ4JXR4xmJ4xfNKuW3VRT2--2KIZiQr-ZMrFjQZFjOqJiK2tHHq7eNKBo0-2O70YmBoZAK3dSN4ZkRrZvU6iIduex*********E2*********4********************AM6**U*2E*O*0E*8E*m*1Q*GE-C*3g*PE-j*52*RE-v*Lk********0*E*********E*******************-TE*</defaultVal>
|
||||
<dataValue>*********PoeMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl1yMb-gOLBoA11I*E61-*I4-kdM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh260Jh1RLBoPqoUF43oMM*-ckgA2JIYPbJgPB6B1UwEJbBXO4JhMJMYMqlVQrAE*M*0oV6H3-JO74BgMLBnPa3hNJUYMqlVQrBZQpwE22FNGKtnQ4JXR4xmJ4xfNKuW3VRT2--2KIZiQr-ZMrFjQZFjOqJiK2tHHq7eNKBo0-2O70YmBoZAK3dSN4ZkRrZvU6iIduex*********E2*********4********************AM6**U*2E*O*0E*8E*m*1Q*GE-C*3g*PE-j*52*RE-v*Lk********0*E*********E*******************-TE*</dataValue>
|
||||
<defaultVal>*********WgeMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-Oq7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**OI91-AN5pIYPbJgPBAB1UwE2F7JNaxgN5BKQqBcNKpVJWFXP43nQs*02*8*-BAI3EwK3lVLHZAiOqJtQpdCImtjMadZMrFnc80**x6O4lkRKWFXP43nQqtVPKJM74BgMLBnNLBQHZB2OKBoOKxiML7tcVkSK2tHHq7eNKBooVcP603T2--2KIZiQr-ZMrFjQZFjOqJicW6SLl*EF3Z7PbBkNKBoPr7IPqhZPU*6*-2*4U*Y*0Y*AU*r*2Y*H*-M*3c*M*-a*4o*Qk-u*62*Uk03*6Q*XU0K*82*cU0X*8I*eU0p*9s*mk1C*BQ*r*1j*D6********0*E*********X*******************--EU*0**F*-c*7**d*16*Bk-7*2s*Kk-h*4w*QE-p*5g-uU********6-*********-********************5f**</defaultVal>
|
||||
<dataValue>*********WgeMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-Oq7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**OI91-AN5pIYPbJgPBAB1UwE2F7JNaxgN5BKQqBcNKpVJWFXP43nQs*02*8*-BAI3EwK3lVLHZAiOqJtQpdCImtjMadZMrFnc80**x6O4lkRKWFXP43nQqtVPKJM74BgMLBnNLBQHZB2OKBoOKxiML7tcVkSK2tHHq7eNKBooVcP603T2--2KIZiQr-ZMrFjQZFjOqJicW6SLl*EF3Z7PbBkNKBoPr7IPqhZPU*6*-2*4U*Y*0Y*AU*r*2Y*H*-M*3c*M*-a*4o*Qk-u*62*Uk03*6Q*XU0K*82*cU0X*8I*eU0p*9s*mk1C*BQ*r*1j*D6********0*E*********X*******************--EU*0**F*-c*7**d*16*Bk-7*2s*Kk-h*4w*QE-p*5g-uU********6-*********-********************5f**</dataValue>
|
||||
</parameter>
|
||||
<parameter name="LUT 文件" id="9001" flags="12889161776">
|
||||
<numberOfKeypoints>0</numberOfKeypoints>
|
||||
<defaultVal>*********SweMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-9q7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**OI91-2L5JIYPbJgPB6B1UwEJL-VR4VnJWFXP43nQs*0U*HH2VAC3-IKJotH9ahZSLBOHZAiPq7eNKBoQu0UU*DG4-YO4pcYMqlVQrBiMKpZK0FXP43nQqJnL2tHF4ZXR4ZjPa3mSO6O53VCIoxWOaJXRB6M4FsTL2FNELBnNLFHR43oNO6U53l2KI3nQqJoIrFVR4I62FcY8H6rGIlMKa-aOr3sSbm1WtOLa7eTefD*kwnFri2********-*E*********V********************vUU*0**F*-c*7**d*16*Bk-7*2s*Kk-h*4w*QE-p*5g-fU********6-*********-********************4j**</defaultVal>
|
||||
<dataValue>*********SweMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-9q7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**OI91-2L5JIYPbJgPB6B1UwEJL-VR4VnJWFXP43nQs*0U*HH2VAC3-IKJotH9ahZSLBOHZAiPq7eNKBoQu0UU*DG4-YO4pcYMqlVQrBiMKpZK0FXP43nQqJnL2tHF4ZXR4ZjPa3mSO6O53VCIoxWOaJXRB6M4FsTL2FNELBnNLFHR43oNO6U53l2KI3nQqJoIrFVR4I62FcY8H6rGIlMKa-aOr3sSbm1WtOLa7eTefD*kwnFri2********-*E*********V********************vUU*0**F*-c*7**d*16*Bk-7*2s*Kk-h*4w*QE-p*5g-fU********6-*********-********************4j**</dataValue>
|
||||
<defaultVal>*********XQeMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-Rq7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**OI91-IP6JIYPbJgPBEB1UwE2F6H33JkMLFcQpMYMqlVQrBQQr-dN4JmH4ZiOqJYKbBkOKFZQYpZQqW**c*20M**olML1VUN4ZRCImtfNLZnKYtH9axWOaJXR5CUc6*1oVkR5VxO74BgMLBnPa3hNJUYMqlVQrBZQplCIoFdMrFdPqtVQbaW5W-MHZBDMadZMrHG5-oW6pl2KI3nQqJoIrFVR4KW70-QF3Z-QrBZR3BoMLFZ**U*2E*O*0E*8E*m*1Q*GE-A*3U*KU-U*4M*Pk-p*5k*WE0I*7M*a*0N*7g*cU0e*9I*hU0r*9Y*jU17*B6*rk1W*Cg*w*1x*E*********0*E*********Z*******************-1EU*0**F*-c*7**d*16*Bk-7*2s*Kk-h*4w*QE-p*5g-xU********6-*********-********************5r**</defaultVal>
|
||||
<dataValue>*********XQeMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-Rq7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**OI91-IP6JIYPbJgPBEB1UwE2F6H33JkMLFcQpMYMqlVQrBQQr-dN4JmH4ZiOqJYKbBkOKFZQYpZQqW**c*20M**olML1VUN4ZRCImtfNLZnKYtH9axWOaJXR5CUc6*1oVkR5VxO74BgMLBnPa3hNJUYMqlVQrBZQplCIoFdMrFdPqtVQbaW5W-MHZBDMadZMrHG5-oW6pl2KI3nQqJoIrFVR4KW70-QF3Z-QrBZR3BoMLFZ**U*2E*O*0E*8E*m*1Q*GE-A*3U*KU-U*4M*Pk-p*5k*WE0I*7M*a*0N*7g*cU0e*9I*hU0r*9Y*jU17*B6*rk1W*Cg*w*1x*E*********0*E*********Z*******************-1EU*0**F*-c*7**d*16*Bk-7*2s*Kk-h*4w*QE-p*5g-xU********6-*********-********************5r**</dataValue>
|
||||
</parameter>
|
||||
<parameter name="工具与蒙版" id="9002" flags="12889161776">
|
||||
<numberOfKeypoints>0</numberOfKeypoints>
|
||||
<defaultVal>*********dIeMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-pK7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**Ok91-2R5VwU70chA13J74tpP4nG1EsD23VYPqBpPKJiR3MYMqlVQrC**c*9ol6H1VEM53RCImtfNLZnKYtH9axWOaJXR5CX3FMLU*C*-6*3clYO4s*4U*W*0c*5KK7VQqJBMLBfQpNgMLZZQbBKQqBcNKpVol6H1W2W580UU*TG7GMb83cYMqlVQrBiMKpZK0FXP43nQqJnL2tHF4ZXR4ZjPa3mSO6b8JVCIoxWOaJXRB6H1Wggc6*7oWIa9WxLHZB-Qb7VSO6i8F*-oWIaAXBSF3ZIPqxgF4xXRKpZPbGWB0ZSF3ZIPqxgF4xXRKpZPbE*0**F*-c*7**d*16*Bk-7*2k*K*-O*4Q*PE-m*5g*UU02*6M*XE0J*8**d*0a*8U*eU0i*9**gU0o*9M*k*15*As*pE1K*BQ*qE1S*CY*wU1z*E6-0k2E*F2-2k2M*G*-6k2Z*Gc-CE2w*********U2*********BE*******************Ig6**U*2E*O*0E*8E*m*1Q*GE-C*3g*PE-j*52*RE-v*ZE********0*E*********E*******************0JE*</defaultVal>
|
||||
<dataValue>*********dIeMb-gOLBoA11I*E61-*I4-klM75NZQbBdPqtN743mMqVdRaJmJ0FoPr-M74xWOaJXR5AG**44c3wE1otHGqJtNKF-QaBcOLNZQh660Ec9L2FVR437QolZNq3XSJwE1o7gOKtYF43oMIxWOaJXR6*0U*4X1EsDJGFiRKlgHl2-pK7kP4ZnR1*kp*20*kE3-UQ8K0FqNL7nOKxiKGFVQaBcOLNZQZEYR4xkK0FjMadZMrFn2U*-Ve-T2*xCIohZSKJYEL7XO4ZqNL9F0*ZPErJnR4xh62FVR44**Ok91-2R5VwU70chA13J74tpP4nG1EsD23VYPqBpPKJiR3MYMqlVQrC**c*9ol6H1VEM53RCImtfNLZnKYtH9axWOaJXR5CX3FMLU*C*-6*3clYO4s*4U*W*0c*5KK7VQqJBMLBfQpNgMLZZQbBKQqBcNKpVol6H1W2W580UU*TG7GMb83cYMqlVQrBiMKpZK0FXP43nQqJnL2tHF4ZXR4ZjPa3mSO6b8JVCIoxWOaJXRB6H1Wggc6*7oWIa9WxLHZB-Qb7VSO6i8F*-oWIaAXBSF3ZIPqxgF4xXRKpZPbGWB0ZSF3ZIPqxgF4xXRKpZPbE*0**F*-c*7**d*16*Bk-7*2k*K*-O*4Q*PE-m*5g*UU02*6M*XE0J*8**d*0a*8U*eU0i*9**gU0o*9M*k*15*As*pE1K*BQ*qE1S*CY*wU1z*E6-0k2E*F2-2k2M*G*-6k2Z*Gc-CE2w*********U2*********BE*******************Ig6**U*2E*O*0E*8E*m*1Q*GE-C*3g*PE-j*52*RE-v*ZE********0*E*********E*******************0JE*</dataValue>
|
||||
</parameter>
|
||||
<parameter name="相机输入" id="2013" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="输入强度" id="2014" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="输入 / LUT" id="2033" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="旧版输入强度" id="2014" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="CST 配置版本" id="2236" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="输入转换启用" id="2241" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="输入曲线" id="2237" flags="12889161776" default="28" value="28" />
|
||||
<parameter name="输入色域" id="2238" flags="12889161776" default="27" value="27" />
|
||||
<parameter name="工作曲线" id="2239" flags="12889161776" default="10" value="10" />
|
||||
<parameter name="工作色域" id="2240" flags="12889161776" default="16" value="16" />
|
||||
<parameter name="CST 混合" id="2269" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="一级调色启用" id="2242" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="一级曝光" id="2247" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="色彩平衡方向" id="2248" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="色彩平衡强度" id="2249" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="一级饱和度" id="2250" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="一级对比度" id="2251" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="对比度轴心" id="2252" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="高光对比度" id="2253" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="高光轴心" id="2254" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="阴影对比度" id="2255" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="阴影轴心" id="2256" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="白点" id="2257" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="肩部压缩" id="2258" flags="12889161760" default="0.5" value="0.5" />
|
||||
<parameter name="一级高光" id="2259" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="一级中间调" id="2260" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="一级阴影" id="2261" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="黑点" id="2262" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="趾部压缩" id="2263" flags="12889161760" default="0.5" value="0.5" />
|
||||
<parameter name="色度混合" id="2264" flags="12889161760" default="0.5" value="0.5" />
|
||||
<parameter name="旁路一级曝光" id="2265" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="旁路一级色彩" id="2266" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="旁路一级对比" id="2267" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="旁路一级影调" id="2268" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="输出转换启用" id="2243" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="输出曲线" id="2244" flags="12889161776" default="1002" value="1002" />
|
||||
<parameter name="输出色域" id="2245" flags="12889161776" default="22" value="22" />
|
||||
<parameter name="自动色调映射" id="2246" flags="12889161776" default="0" value="0" />
|
||||
<parameter name="输入转换 / CST" id="2033" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="曝光" id="2000" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="曝光 启用" id="2020" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="对比度" id="2001" flags="12889161760" default="0" value="0" />
|
||||
@@ -330,12 +369,15 @@
|
||||
<parameter name="清晰度 启用" id="2031" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="去朦胧" id="2012" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="去朦胧 启用" id="2032" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="复制时自动调色" id="8800" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="复制时自动调色" id="8800" flags="12889161776" default="0" value="0" />
|
||||
<parameter name="一级调色总开关" id="2271" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="蜘蛛盘混合" id="2273" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="蜘蛛盘校色仪" id="2272" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="基础调色" id="2034" flags="12889161760" default="1" value="1" />
|
||||
<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="2116" 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" />
|
||||
<parameter name="风格 2 强度" id="2016" flags="12889161760" default="1" value="1" />
|
||||
@@ -345,7 +387,7 @@
|
||||
<parameter name="风格 4 强度" id="2018" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="风格 5 启用" id="2043" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="风格 5 强度" id="2019" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="风格 LUT" id="2036" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="风格 LUT" id="2036" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="主曲线 阴影" id="2046" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="主曲线 暗部" id="2047" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="主曲线 亮部" id="2048" flags="12889161760" default="0" value="0" />
|
||||
@@ -398,7 +440,7 @@
|
||||
<parameter name="蓝 扩展点3 X" id="2234" flags="12889161760" default="-1" value="-1" />
|
||||
<parameter name="蓝 扩展点4 偏移" id="2231" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="蓝 扩展点4 X" id="2235" flags="12889161760" default="-1" value="-1" />
|
||||
<parameter name="曲线" id="2044" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="曲线" id="2044" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="红 色相" id="2068" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="橙 色相" id="2069" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="黄 色相" id="2070" flags="12889161760" default="0" value="0" />
|
||||
@@ -433,7 +475,7 @@
|
||||
<parameter name="自定义 明亮度" id="2098" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="自定义 明亮度范围" id="2142" flags="12889161760" default="40" value="40" />
|
||||
<parameter name="显示自定义色选区" id="2144" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="HSL 混色" id="2045" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="HSL 混色" id="2045" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="阴影 色相" id="2106" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="阴影 饱和度" id="2107" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="阴影 明亮度" id="2113" flags="12889161760" default="0" value="0" />
|
||||
@@ -448,14 +490,14 @@
|
||||
<parameter name="全局 明亮度" id="2150" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="混合" id="2101" flags="12889161760" default="50" value="50" />
|
||||
<parameter name="平衡" id="2102" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="颜色分级" id="2100" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="颜色分级" id="2100" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="红原色 色相" id="2121" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="红原色 饱和度" id="2122" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="绿原色 色相" id="2123" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="绿原色 饱和度" id="2124" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="蓝原色 色相" id="2125" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="蓝原色 饱和度" id="2126" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="三原色" id="2120" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="三原色" id="2120" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="RGB 输入黑" id="2156" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="RGB 伽马" id="2160" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="RGB 输入白" id="2164" flags="12889161760" default="255" value="255" />
|
||||
@@ -476,7 +518,7 @@
|
||||
<parameter name="蓝 输入白" id="2167" flags="12889161760" default="255" value="255" />
|
||||
<parameter name="蓝 输出黑" id="2171" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="蓝 输出白" id="2175" flags="12889161760" default="255" value="255" />
|
||||
<parameter name="色阶" id="2152" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="色阶" id="2152" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="黑白 红" id="2180" flags="12889161760" default="40" value="40" />
|
||||
<parameter name="黑白 黄" id="2181" flags="12889161760" default="60" value="60" />
|
||||
<parameter name="黑白 绿" id="2182" flags="12889161760" default="40" value="40" />
|
||||
@@ -485,7 +527,8 @@
|
||||
<parameter name="黑白 洋红" id="2185" flags="12889161760" default="80" value="80" />
|
||||
<parameter name="着色色相" id="2186" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="着色饱和度" id="2187" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="黑白混色" id="2176" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="黑白混合" id="2270" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="黑白混色" id="2176" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="保持明度" id="2189" flags="12889161760" default="1" value="1" />
|
||||
<parameter name="阴影 青 ↔ 红" id="2192" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="阴影 洋红 ↔ 绿" id="2193" flags="12889161760" default="0" value="0" />
|
||||
@@ -496,11 +539,11 @@
|
||||
<parameter name="高光 青 ↔ 红" id="2200" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="高光 洋红 ↔ 绿" id="2201" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="高光 黄 ↔ 蓝" id="2202" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="色彩平衡" id="2188" flags="12889161760" default="0" value="0" />
|
||||
<parameter name="色彩平衡" id="2188" 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" />
|
||||
<parameter name="发布 OSC" id="10005" flags="4294967296" default="0" value="0" />
|
||||
<parameter name="发布 OSC" id="10005" flags="8589934592" default="0" value="1" />
|
||||
</filter>
|
||||
</scenenode>
|
||||
<aspectRatio>1</aspectRatio>
|
||||
|
||||
+11
-2
@@ -3,6 +3,7 @@
|
||||
from pathlib import Path
|
||||
import argparse
|
||||
import subprocess
|
||||
from build_masked_kernel import masked_kernel
|
||||
|
||||
|
||||
def main():
|
||||
@@ -15,15 +16,23 @@ def main():
|
||||
work.mkdir(parents=True, exist_ok=True)
|
||||
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||
objects = []
|
||||
for name in ('DYGradeKernel', 'DYStatisticsKernel', 'DYLUTExportKernel'):
|
||||
for name in ('DYGradeKernel', 'DYStatisticsKernel', 'DYLUTExportKernel', 'CSTKernel', 'BasisKernel'):
|
||||
target = work / (name + '.air')
|
||||
subprocess.run(['xcrun', 'metal-opt', str(root / 'tools/kernels' / (name + '.ll')),
|
||||
source = root / 'tools/kernels' / (name + '.ll')
|
||||
if name == 'DYGradeKernel':
|
||||
generated = work / 'DYGradeMasked.ll'
|
||||
generated.write_text(masked_kernel(source.read_text()))
|
||||
source = generated
|
||||
subprocess.run(['xcrun', 'metal-opt', str(source),
|
||||
'-o', str(target)], check=True)
|
||||
objects.append(str(target))
|
||||
wrapper = work / 'DYGradeWrapper.air'
|
||||
subprocess.run(['xcrun', '-sdk', 'macosx', 'metal', '-std=metal3.1',
|
||||
'-mmacosx-version-min=14.6', '-c',
|
||||
str(root / '大鱼调色/Plugin/DYGrade.metal'), '-o', str(wrapper)], check=True)
|
||||
tracking=work / 'DYTracking.air'
|
||||
subprocess.run(['xcrun','-sdk','macosx','metal','-std=metal3.1','-mmacosx-version-min=14.6','-c',str(root/'大鱼调色/Plugin/DYTracking.metal'),'-o',str(tracking)],check=True)
|
||||
objects.append(str(tracking))
|
||||
subprocess.run(['xcrun', '-sdk', 'macosx', 'metallib', str(wrapper), *objects,
|
||||
'-o', str(args.output)], check=True)
|
||||
print(args.output)
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
"""Add per-stage coverage to a separate entry; preserve the legacy AIR function.
|
||||
|
||||
Anchors are exact SSA values of the versioned source, not guessed byte offsets.
|
||||
No target runtime or installed reference binary is a build dependency.
|
||||
"""
|
||||
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))
|
||||
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.
|
||||
stages = [(82,53,0),(83,82,8),(408,83,2),(409,408,6),
|
||||
(410,409,9),(411,410,11),(498,411,5),(519,498,7),
|
||||
(520,519,2),(521,520,10),(668,521,4),(669,668,3)]
|
||||
for value, before, section in stages:
|
||||
target = f'%v{value}'
|
||||
lines = body.splitlines()
|
||||
index = next(i for i,l in enumerate(lines) if l.startswith(' '+target+' = '))
|
||||
# Keep all PHIs first in a block, then insert the coverage operation.
|
||||
end = index+1
|
||||
while end<len(lines) and re.match(r' %\w+ = phi ',lines[end]): end+=1
|
||||
lines[index] = lines[index].replace(target+' = ',f'%dyRaw{value} = ',1)
|
||||
lines[end:end] = [
|
||||
f' %dyScalar{value} = insertelement <3 x float> undef, float %dyWeight{section}, i64 0',
|
||||
f' %dyVector{value} = shufflevector <3 x float> %dyScalar{value}, <3 x float> undef, <3 x i32> zeroinitializer',
|
||||
f' {target} = tail call <3 x float> @air.mix.v3f32(<3 x float> %v{before}, <3 x float> %dyRaw{value}, <3 x float> %dyVector{value}) #1']
|
||||
body='\n'.join(lines)
|
||||
# A second, explicitly ranged entry lets anchored extra tools interrupt the
|
||||
# existing native instruction order. The historical entry above is unchanged.
|
||||
segment = body.replace('@dy_gradeMasked(', '@dy_gradeSegment(', 1)
|
||||
segment = segment.replace(') local_unnamed_addr #0 {', ', i32 %dyStageFirst, i32 %dyStageLast, <3 x float> %dyExternalSkinReference, <3 x float> %dyOriginalReference) local_unnamed_addr #0 {', 1)
|
||||
for stage, (value, before, section) in enumerate(stages):
|
||||
target = f' %dyScalar{value} = insertelement <3 x float> undef, float %dyWeight{section}, i64 0'
|
||||
replacement = '\n'.join([
|
||||
f' %dyAtOrAfter{value} = icmp ule i32 %dyStageFirst, {stage}',
|
||||
f' %dyAtOrBefore{value} = icmp uge i32 %dyStageLast, {stage}',
|
||||
f' %dyStageActive{value} = and i1 %dyAtOrAfter{value}, %dyAtOrBefore{value}',
|
||||
f' %dyEffective{value} = select i1 %dyStageActive{value}, float %dyWeight{section}, float 0.000000e+00',
|
||||
target.replace(f'%dyWeight{section}', f'%dyEffective{value}')])
|
||||
assert target in segment
|
||||
segment = segment.replace(target, replacement, 1)
|
||||
skin_call = ' %dyRaw669 = tail call fast fastcc <3 x float> @_ZL19applySkinProtection'
|
||||
assert skin_call in segment
|
||||
segment = segment.replace(skin_call, ' %dyHasLocalSkinReference = icmp ule i32 %dyStageFirst, 5\n %dySkinReference = select i1 %dyHasLocalSkinReference, <3 x float> %v411, <3 x float> %dyExternalSkinReference\n'+skin_call, 1)
|
||||
segment = segment.replace('(<3 x float> %v668, <3 x float> %v411,', '(<3 x float> %v668, <3 x float> %dySkinReference,', 1)
|
||||
# Highlight/shadow spatial weighting uses the same original post-CST
|
||||
# reference as the historical fused function, not a later segment's input.
|
||||
original_luma = next(line for line in segment.splitlines() if line.startswith(' %v213 = '))
|
||||
assert '@air.dot.v3f32(<3 x float> %v53,' in original_luma
|
||||
segment = segment.replace(original_luma, original_luma.replace('<3 x float> %v53,', '<3 x float> %dyOriginalReference,'), 1)
|
||||
clamp = next(line for line in segment.splitlines() if line.startswith(' %v672 = '))
|
||||
segment = segment.replace(clamp, '\n'.join([
|
||||
clamp.replace('%v672 = ', '%dyClamped672 = ', 1),
|
||||
' %dyIncludesFinalFirst = icmp ule i32 %dyStageFirst, 11',
|
||||
' %dyIncludesFinalLast = icmp uge i32 %dyStageLast, 11',
|
||||
' %dyIncludesFinal = and i1 %dyIncludesFinalFirst, %dyIncludesFinalLast',
|
||||
' %v672 = select i1 %dyIncludesFinal, <3 x float> %dyClamped672, <3 x float> %v669']), 1)
|
||||
skin='''
|
||||
define <3 x float> @dy_skinExtra(<3 x float> %color, <3 x float> %reference, %struct.DYUniforms addrspace(2)* %uniforms) {
|
||||
entry:
|
||||
%result = call fastcc <3 x float> @_ZL19applySkinProtectionDv3_fS_RU11MTLconstantK17DYUniforms(<3 x float> %color, <3 x float> %reference, %struct.DYUniforms addrspace(2)* %uniforms)
|
||||
ret <3 x float> %result
|
||||
}
|
||||
'''
|
||||
return source+'\n'+body+'\n'+segment+'\n'+skin
|
||||
+11
-8
@@ -20,14 +20,14 @@ CONTENT_TAGS={'scenenode','layer','group','filter','behavior','mask'}
|
||||
def sha(data):return hashlib.sha256(data).hexdigest()
|
||||
|
||||
def model_identity():
|
||||
files=['大鱼调色/Plugin/DYModel.h','大鱼调色/Plugin/DYModel.mm','大鱼调色/Plugin/DYUniforms.h','template/tools/dump_model.mm']
|
||||
files=['大鱼调色/Plugin/DYModel.h','大鱼调色/Plugin/DYModel.mm','大鱼调色/Plugin/DYUniforms.h','大鱼调色/Plugin/DYColorManagement.h','大鱼调色/Plugin/DYCSTTypes.h','大鱼调色/Plugin/DYSpiderState.h','大鱼调色/Plugin/SpiderCore/DYColorMath.h','大鱼调色/Plugin/SpiderCore/DYSpiderMesh.hpp','template/tools/dump_model.mm','大鱼调色/Plugin/DYToolState.h','大鱼调色/Plugin/DYToolState.mm','大鱼调色/Plugin/MaskCore/DYMaskOperator.h','大鱼调色/Plugin/MaskCore/DYMask.h']
|
||||
return {name:sha((ROOT/name).read_bytes()) for name in files}
|
||||
|
||||
def refresh_metadata():
|
||||
cache=Path('/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/template-model')
|
||||
cache.mkdir(parents=True,exist_ok=True)
|
||||
executable=cache/'dump_model'
|
||||
command=['xcrun','clang++','-std=c++17','-fno-objc-arc','-fblocks','-F','/Library/Developer/SDKs/FxPlug.sdk/Library/Frameworks','-F','/Library/Developer/Frameworks','-framework','Foundation','-framework','AppKit','-framework','FxPlug','-Wl,-rpath,/Library/Developer/Frameworks','-I',str(ROOT/'大鱼调色/Plugin'),str(TEMPLATE/'tools/dump_model.mm'),str(ROOT/'大鱼调色/Plugin/DYModel.mm'),'-o',str(executable)]
|
||||
command=['xcrun','clang++','-std=c++17','-fno-objc-arc','-fblocks','-F','/Library/Developer/SDKs/FxPlug.sdk/Library/Frameworks','-F','/Library/Developer/Frameworks','-framework','Foundation','-framework','AppKit','-framework','FxPlug','-framework','CoreMedia','-Wl,-rpath,/Library/Developer/Frameworks','-I',str(ROOT/'大鱼调色/Plugin'),str(TEMPLATE/'tools/dump_model.mm'),str(ROOT/'大鱼调色/Plugin/DYModel.mm'),str(ROOT/'大鱼调色/Plugin/DYToolState.mm'),'-o',str(executable)]
|
||||
subprocess.run(command,check=True)
|
||||
result=json.loads(subprocess.check_output([str(executable)],text=True))
|
||||
result['sourceSHA256']=model_identity()
|
||||
@@ -67,14 +67,14 @@ def build(model):
|
||||
insert_at=list(root).index(root.findall('factory')[-1])+1
|
||||
for uuid,fid in factory_ids.items():
|
||||
factory=copy.deepcopy(lookup[uuid]);factory.set('id',fid);root.insert(insert_at,factory);insert_at+=1
|
||||
filt=E.parse(SOURCES/'NativeFxPlugShell.xml').getroot()
|
||||
filt=E.parse(SOURCES/'NativeFxPlugShell.xml').getroot();filt.set('pluginVersion','0')
|
||||
# Keep the original native host mix/flip/input-point/OSC parameters, replace
|
||||
# the product's entire registered parameter set and custom archives.
|
||||
host=list(filt.findall('parameter'))
|
||||
for node in host:filt.remove(node)
|
||||
for pid,name in [('9000','大鱼调色'),('9001','LUT 文件')]:
|
||||
for pid,name in [('9000','大鱼调色'),('9001','LUT 文件'),('9002','工具与蒙版')]:
|
||||
text,class_name=custom_archive(model['archivesBase64'][pid])
|
||||
expected='DYInspectorToken' if pid=='9000' else 'DYAssetState'
|
||||
expected={'9000':'DYInspectorToken','9001':'DYAssetState','9002':'DYToolDocument'}[pid]
|
||||
if class_name!=expected:raise ValueError('Wrong custom parameter class')
|
||||
flags='12884901888' if pid=='9000' else '12889161776'
|
||||
param=E.SubElement(filt,'parameter',name=name,id=pid,flags=flags)
|
||||
@@ -82,8 +82,10 @@ def build(model):
|
||||
E.SubElement(param,'defaultVal').text=text;E.SubElement(param,'dataValue').text=text
|
||||
for row in model['parameters']:
|
||||
value=format(float(row['default']),'.17g')
|
||||
E.SubElement(filt,'parameter',name=row['title'],id=str(row['pid']),flags='12889161760',default=value,value=value)
|
||||
for node in host:filt.append(node)
|
||||
E.SubElement(filt,'parameter',name=row['title'],id=str(row['pid']),flags='12889161776' if row.get('notAnimatable') else '12889161760',default=value,value=value)
|
||||
for node in host:
|
||||
if node.get("id")=="10005":node.set("value","1");node.set("default","0");node.set("flags","8589934592")
|
||||
filt.append(node)
|
||||
source.append(filt)
|
||||
copyright=E.parse(SOURCES/'CopyrightRig.xml').getroot()
|
||||
entity_map={'3356608241':'10080','3356608243':'10081','3356608245':'10082'}
|
||||
@@ -118,6 +120,7 @@ def verify(data,model):
|
||||
assert len(filters)==1 and filters[0].get('pluginUUID')==PLUGIN_UUID
|
||||
f=filters[0];params={p.get('id'):p for p in f.findall('parameter')}
|
||||
assert len(params)==len(list(f.findall('parameter')))
|
||||
assert params["10005"].get("value")=="1" and params["10005"].get("flags")=="8589934592" and f.get("pluginVersion")=="0"
|
||||
for row in model['parameters']:
|
||||
p=params[str(row['pid'])];assert float(p.get('default'))==float(row['default'])==float(p.get('value'))
|
||||
assert all(not v in data for v in (b'CameraRawTables',b'1.png',b'relativeURL'))
|
||||
@@ -148,7 +151,7 @@ def verify(data,model):
|
||||
assert [entry.attrib for entry in menu.findall('entry')]==[{'name':title,'tag':'2'}]
|
||||
assert widget.findtext('affecting')=='2' and widget.findtext('snapshot')=='3'
|
||||
assert len({n.get('id') for n in scene.iter() if n.tag in CONTENT_TAGS})==len([n for n in scene.iter() if n.tag in CONTENT_TAGS])
|
||||
return {'passed':True,'sha256':sha(data),'version':root.get('version'),'displayversion':root.findtext('displayversion'),'filterCount':1,'nativeFloatParameters':len(model['parameters']),'customParameters':2,'publications':[dict(t.attrib) for t in pub],'effectSourceType':3,'externalMediaRequired':False,'placeholder':'native Drop Zone.tiff','animationObjects':0,'copyright':{'passed':True,'rig':'10080','author':'10081','site':'10082','unbound':True},'savedSelection':{'passed':True,'selectedContentCount':0,'currentObjectIsProject':True},'hostUIVerified':False,'hostRenderVerified':False}
|
||||
return {'passed':True,'sha256':sha(data),'version':root.get('version'),'displayversion':root.findtext('displayversion'),'filterCount':1,'nativeFloatParameters':len(model['parameters']),'customParameters':3,'publications':[dict(t.attrib) for t in pub],'effectSourceType':3,'externalMediaRequired':False,'placeholder':'native Drop Zone.tiff','animationObjects':0,'copyright':{'passed':True,'rig':'10080','author':'10081','site':'10082','unbound':True},'savedSelection':{'passed':True,'selectedContentCount':0,'currentObjectIsProject':True},'hostUIVerified':False,'hostRenderVerified':False}
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Create an isolated chart project for browser layout, recent use and reset QA."""
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
import xml.etree.ElementTree as ET
|
||||
root=Path(__file__).resolve().parent.parent
|
||||
runpy.run_path(str(root/'tools/create_host_fixture.py'))
|
||||
qa=Path.home()/'Library/Caches/CodexBuilds/com.dayu.color/fcp-qa'
|
||||
tree=ET.parse(qa/'大鱼调色_正式版验收.fcpxml')
|
||||
tree.find('.//event').set('name','大鱼调色_浏览器与复位验收')
|
||||
tree.find('.//project').set('name','大鱼调色_1.3.1_浏览器与复位')
|
||||
ET.indent(tree)
|
||||
output=qa/'大鱼调色_1.3.1_浏览器与复位.fcpxml'
|
||||
output.write_text('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE fcpxml>\n'+ET.tostring(tree.getroot(),encoding='unicode')+'\n')
|
||||
print(output)
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate the isolated synthetic CST/disclosure acceptance timeline."""
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
import xml.etree.ElementTree as ET
|
||||
root = Path(__file__).resolve().parent.parent
|
||||
runpy.run_path(str(root / 'tools/create_host_fixture.py'))
|
||||
qa = Path.home() / 'Library/Caches/CodexBuilds/com.dayu.color/fcp-qa'
|
||||
tree = ET.parse(qa / '大鱼调色_正式版验收.fcpxml')
|
||||
tree.find('.//event').set('name', '大鱼调色_CST与独立折叠验收')
|
||||
tree.find('.//project').set('name', '大鱼调色_1.2_CST与独立折叠')
|
||||
output = qa / '大鱼调色_1.2_CST与独立折叠.fcpxml'
|
||||
ET.indent(tree)
|
||||
output.write_text('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE fcpxml>\n' + ET.tostring(tree.getroot(), encoding='unicode') + '\n')
|
||||
print(output)
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Synthetic, isolated mask/layer acceptance projects; no user media writes."""
|
||||
from pathlib import Path
|
||||
import subprocess,xml.etree.ElementTree as E
|
||||
out=Path('/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa');out.mkdir(parents=True,exist_ok=True)
|
||||
media=out/'大鱼调色_蒙版合成运动.mov'
|
||||
if not media.exists():
|
||||
subprocess.run(['/opt/homebrew/bin/ffmpeg','-v','error','-f','lavfi','-i',"nullsrc=s=1080x640:r=25:d=4,geq=lum='128+70*sin(X/11)*cos(Y/9)+35*sin((X+Y)/4)':cb='128+35*sin(X/17)':cr='128+35*cos(Y/21)',crop=960:540:'40+10*t':'40+5*t'",'-c:v','prores_ks','-profile:v','2','-pix_fmt','yuv422p10le','-color_primaries','bt709','-color_trc','bt709','-colorspace','bt709',str(media)],check=True)
|
||||
root=E.Element('fcpxml',version='1.12');res=E.SubElement(root,'resources');E.SubElement(res,'format',id='f1',width='960',height='540',frameDuration='1/25s',colorSpace='1-1-1 (Rec. 709)');a=E.SubElement(res,'asset',id='a1',name='合成运动纹理',start='0s',duration='4s',format='f1',hasVideo='1',videoSources='1');E.SubElement(a,'media-rep',kind='original-media',src=media.as_uri());template=Path('/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef');E.SubElement(res,'effect',id='fx',name='大鱼调色',uid='~/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef',src=template.as_uri());lib=E.SubElement(root,'library');event=E.SubElement(lib,'event',name='大鱼调色_1.4.1_26_蒙版与工具层验收')
|
||||
for name in ['大鱼调色_1.4.1_26_独立工具与蒙版','大鱼调色_1.4.1_26_逐帧跟踪']:
|
||||
project=E.SubElement(event,'project',name=name);seq=E.SubElement(project,'sequence',format='f1',tcStart='0s',tcFormat='NDF',audioLayout='stereo',audioRate='48k',duration='4s');spine=E.SubElement(seq,'spine');clip=E.SubElement(spine,'asset-clip',ref='a1',name=name,offset='0s',start='0s',duration='4s');E.SubElement(clip,'filter-video',ref='fx',name='大鱼调色',enabled='1')
|
||||
E.indent(root);xml=out/'大鱼调色_1.4.1_26_蒙版与工具层.fcpxml';xml.write_text('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE fcpxml>\n'+E.tostring(root,encoding='unicode')+'\n');print(xml)
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Create an isolated synthetic FCP project for the native spider and wheel."""
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
import xml.etree.ElementTree as ET
|
||||
root=Path(__file__).resolve().parent.parent
|
||||
runpy.run_path(str(root/'tools/create_host_fixture.py'))
|
||||
qa=Path.home()/'Library/Caches/CodexBuilds/com.dayu.color/fcp-qa'
|
||||
tree=ET.parse(qa/'大鱼调色_正式版验收.fcpxml')
|
||||
tree.find('.//event').set('name','大鱼调色_蜘蛛盘与白平衡验收')
|
||||
tree.find('.//project').set('name','大鱼调色_1.3_蜘蛛盘与白平衡')
|
||||
ET.indent(tree)
|
||||
output=qa/'大鱼调色_1.3_蜘蛛盘与白平衡.fcpxml'
|
||||
output.write_text('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE fcpxml>\n'+ET.tostring(tree.getroot(),encoding='unicode')+'\n')
|
||||
print(output)
|
||||
文件差异过大,未显示。
加载差异
文件差异过大,未显示。
加载差异
@@ -0,0 +1,39 @@
|
||||
#import <AppKit/AppKit.h>
|
||||
#import "../大鱼调色/Plugin/DYLUTBrowser.h"
|
||||
#import "../大鱼调色/Plugin/DYLUTLibrary.h"
|
||||
@interface DYLUTBrowser (Probe)
|
||||
- (void)layoutBrowser;
|
||||
- (void)layoutChanged:(id)sender;
|
||||
- (void)rebuildGrid;
|
||||
- (void)folderClicked:(NSButton *)button;
|
||||
- (void)thumbnailClicked:(id)tile;
|
||||
@end
|
||||
static NSMutableArray *checks;
|
||||
static void require(BOOL pass,NSString *name){[checks addObject:@{@"name":name,@"pass":@(pass)}];if(!pass){fprintf(stderr,"FAIL %s\n",name.UTF8String);exit(1);}}
|
||||
static void pump(BOOL(^done)(void)){double end=NSProcessInfo.processInfo.systemUptime+15;while(!done()&&NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.005]];require(done(),@"asynchronous browser task completed");}
|
||||
int main(int argc,const char **argv){@autoreleasepool{
|
||||
checks=[NSMutableArray new];require(argc==2,@"report destination supplied");[NSApplication sharedApplication];[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];
|
||||
NSURL *root=[NSURL fileURLWithPath:[NSTemporaryDirectory()stringByAppendingPathComponent:[@"dayu-browser-layout-" stringByAppendingString:NSUUID.UUID.UUIDString]]];NSFileManager *fm=NSFileManager.defaultManager;[fm createDirectoryAtURL:root withIntermediateDirectories:YES attributes:nil error:nil];
|
||||
NSString *cube=@"LUT_3D_SIZE 2\n0 0 0\n1 0 0\n0 1 0\n1 1 0\n0 0 1\n1 0 1\n0 1 1\n1 1 1\n";
|
||||
for(NSString *name in @[@"Alpha.cube",@"Middle.cube",@"Zulu.cube"])[cube writeToURL:[root URLByAppendingPathComponent:name] atomically:YES encoding:NSUTF8StringEncoding error:nil];
|
||||
DYLUTLibrary *library=[[[DYLUTLibrary alloc]initWithRootURL:root]autorelease];require([library reload:nil],@"isolated library loaded");NSString *alpha=[library.entries[0]objectForKey:@"path"],*middle=[library.entries[1]objectForKey:@"path"],*zulu=[library.entries[2]objectForKey:@"path"];
|
||||
[library recordUsedPath:alpha];[library recordUsedPath:zulu];[library recordUsedPath:alpha];require([library.recentPaths isEqual:@[alpha,zulu]],@"recent use deduplicates and puts latest first");
|
||||
DYLUTLibrary *reopened=[[[DYLUTLibrary alloc]initWithRootURL:root]autorelease];require([reopened.recentPaths isEqual:library.recentPaths],@"recent history survives a new library instance");
|
||||
__block void(^ack)(NSError *)=nil;DYLUTBrowser *browser=[[DYLUTBrowser alloc]initWithLibrary:library preview:nil selectedPath:nil palette:@{} selection:^NSProgress *(NSString *path,void(^completion)(NSError *)){[ack release];ack=[completion copy];return [NSProgress discreteProgressWithTotalUnitCount:1];}];
|
||||
pump(^{return [browser valueForKey:@"libraryTask"]==nil;});require([[[browser valueForKey:@"folderPaths"]firstObject]isEqual:@"@recent"],@"recent category is first in the sidebar");
|
||||
require([[[browser valueForKey:@"visibleEntries"]valueForKey:@"path"]isEqual:@[alpha,zulu]],@"recent category contains only used LUTs in order");
|
||||
NSButton *all=nil;for(NSButton *button in [browser valueForKey:@"folderButtons"])if([button.identifier isEqual:@"*"])all=button;[browser folderClicked:all];
|
||||
require([[[browser valueForKey:@"visibleEntries"]valueForKey:@"path"]isEqual:@[alpha,zulu,middle]],@"all LUTs also put recent uses before unused names");
|
||||
id tile=[[browser valueForKey:@"tiles"]objectForKey:middle];[tile setEnabled:YES];[browser thumbnailClicked:tile];require([library.recentPaths isEqual:@[alpha,zulu]],@"loading does not update recent history");ack([NSError errorWithDomain:@"host" code:1 userInfo:nil]);require([library.recentPaths isEqual:@[alpha,zulu]],@"host rejection does not update history");
|
||||
[browser thumbnailClicked:tile];ack(nil);require([library.recentPaths isEqual:@[middle,alpha,zulu]],@"only successful host application records recent use");
|
||||
NSSearchField *search=[browser valueForKey:@"search"];search.stringValue=@"Zulu";[browser rebuildGrid];require([[browser valueForKey:@"visibleEntries"]count]==1,@"search respects recent-first ordering");search.stringValue=@"";[browser rebuildGrid];
|
||||
NSView *view=[browser valueForKey:@"root"];[view setFrameSize:NSMakeSize(1200,760)];[browser layoutBrowser];NSInteger wide=[[browser valueForKey:@"columns"]integerValue];[view setFrameSize:NSMakeSize(720,420)];[browser layoutBrowser];require(wide>[[browser valueForKey:@"columns"]integerValue],@"grid reflows when the browser size changes");
|
||||
NSPopUpButton *layout=[browser valueForKey:@"layoutMenu"];[layout selectItemAtIndex:1];[browser layoutChanged:nil];require([[browser valueForKey:@"columns"]integerValue]==1&&[[browser valueForKey:@"tileHeight"]doubleValue]==70,@"list layout has full-width rows");
|
||||
NSSplitView *split=[browser valueForKey:@"splitView"];[split setPosition:240 ofDividerAtIndex:0];[browser layoutBrowser];NSScrollView *folders=[browser valueForKey:@"folderScroll"],*grid=[browser valueForKey:@"gridScroll"];require(fabs(folders.frame.size.width-240)<2&&NSMaxX(folders.frame)<=NSMinX(grid.frame),@"sidebar divider changes folder width without overlapping previews");
|
||||
[browser close];[browser release];browser=[[DYLUTBrowser alloc]initWithLibrary:library preview:nil selectedPath:nil palette:@{} selection:nil];pump(^{return [browser valueForKey:@"libraryTask"]==nil;});require([(NSPopUpButton*)[browser valueForKey:@"layoutMenu"]indexOfSelectedItem]==1&&fabs([[browser valueForKey:@"sidebarWidth"]doubleValue]-240)<2,@"layout and sidebar width survive reopening");
|
||||
NSPanel *host=[[[NSPanel alloc]initWithContentRect:NSMakeRect(120,160,900,620) styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO]autorelease];__block int closes=0;[browser showInRemoteParent:host.contentView close:^{closes++;}];pump(^{return [browser valueForKey:@"presentationWindow"]==host;});require(!host.visible&&browser.visible,@"remote-parent checks never display a test window");
|
||||
NSRect desired=NSMakeRect(190,210,1000,680);[host setFrame:desired display:NO];NSString *frameKey=[@"com.dayu.color.lookLUTPreview.windowFrame|" stringByAppendingString:library.rootURL.path];require(NSEqualRects(NSRectFromString([NSUserDefaults.standardUserDefaults stringForKey:frameKey]),host.frame),@"window position and size are remembered");[browser close];[browser close];require(closes==1,@"remote close callback runs once");[browser release];[ack release];ack=nil;
|
||||
for(int i=0;i<50;i++)[library recordUsedPath:[root.path stringByAppendingPathComponent:[NSString stringWithFormat:@"History-%d.cube",i]]];require(library.recentPaths.count==40&&[library.recentPaths[0]hasSuffix:@"History-49.cube"],@"recent history stays bounded at 40 newest paths");
|
||||
NSArray *keys=NSUserDefaults.standardUserDefaults.dictionaryRepresentation.allKeys;for(NSString *key in keys)if([key containsString:library.rootURL.path])[NSUserDefaults.standardUserDefaults removeObjectForKey:key];require([fm removeItemAtURL:root error:nil],@"isolated fixtures and preferences cleaned");
|
||||
NSDictionary *report=@{@"pass":@YES,@"checks":checks,@"scope":@"Real AppKit browser objects, hidden host-owned window fixture, asynchronous acknowledgement and root-scoped history; no visible test app or user LUT changes."};[[NSJSONSerialization dataWithJSONObject:report options:NSJSONWritingPrettyPrinted error:nil]writeToFile:[NSString stringWithUTF8String:argv[1]] atomically:YES];printf("PASS %lu browser checks\n",(unsigned long)checks.count);[checks release];return 0;
|
||||
}}
|
||||
+1
-1
@@ -93,7 +93,7 @@ static Pixels render(id<MTLRenderPipelineState> pipeline, bool dayu, id<MTLTextu
|
||||
[e setFragmentTexture:source atIndex:0];
|
||||
for (NSUInteger i=0;i<textures.count;++i) [e setFragmentTexture:textures[i] atIndex:i+1];
|
||||
[e setFragmentBytes:&u length:sizeof(u) atIndex:0]; float scene=.73f; [e setFragmentBytes:&scene length:4 atIndex:1];
|
||||
if(dayu) { DYRenderOptions options={}; options.outputPremultiplied=premultiplied; [e setFragmentBytes:&options length:sizeof(options) atIndex:2]; }
|
||||
if(dayu) { DYRenderOptions options={}; options.outputPremultiplied=premultiplied; [e setFragmentBytes:&options length:sizeof(options) atIndex:2];[e setFragmentBytes:&u length:sizeof(u) atIndex:3];float empty[2]={0,0};simd_int2 size={0,0};[e setFragmentBytes:empty length:sizeof(empty) atIndex:4];[e setFragmentBytes:&size length:sizeof(size) atIndex:5]; }
|
||||
else { float disabledWatermark[8]={}; [e setFragmentBytes:disabledWatermark length:sizeof(disabledWatermark) atIndex:2]; }
|
||||
[e drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4]; [e endEncoding]; finish(commands);
|
||||
Pixels output(width*height*4); [destination getBytes:output.data() bytesPerRow:width*8 fromRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0]; return output;
|
||||
|
||||
@@ -101,6 +101,7 @@ int main(int argc,const char *argv[]) {@autoreleasepool {
|
||||
[acknowledgements addObject:[[completion copy]autorelease]];NSProgress *task=[NSProgress discreteProgressWithTotalUnitCount:1];[applyTasks addObject:task];return task;
|
||||
}];
|
||||
pump(^{return [ackBrowser valueForKey:@"libraryTask"]==nil;});
|
||||
[ackBrowser setValue:@"*" forKey:@"folder"];[ackBrowser rebuildGrid]; // This fixture tests two acknowledgements, regardless of saved/default category.
|
||||
NSDictionary *ackTiles=[ackBrowser valueForKey:@"tiles"];NSArray *ackPaths=ackTiles.allKeys;require(ackPaths.count>=2,@"acknowledgement fixture has selectable thumbnails");
|
||||
id firstTile=ackTiles[ackPaths[0]],secondTile=ackTiles[ackPaths[1]];[firstTile setEnabled:YES];[secondTile setEnabled:YES];
|
||||
[ackBrowser thumbnailClicked:firstTile];
|
||||
@@ -125,5 +126,6 @@ int main(int argc,const char *argv[]) {@autoreleasepool {
|
||||
#endif
|
||||
report[@"checks"]=checks;report[@"scope"]=@"Synthetic 24 x 65-cube import with real main-run-loop heartbeat and snapshot reads; headless browser cancellation, latest selection and 3,025-entry virtualization. No user library or visible test app.";
|
||||
NSData *json=[NSJSONSerialization dataWithJSONObject:report options:NSJSONWritingPrettyPrinted error:&error];require([json writeToFile:[NSString stringWithUTF8String:argv[1]] atomically:YES],@"report written");
|
||||
for(NSString *key in NSUserDefaults.standardUserDefaults.dictionaryRepresentation.allKeys)if([key containsString:destination.path])[NSUserDefaults.standardUserDefaults removeObjectForKey:key];
|
||||
require([fm removeItemAtURL:root error:&error],@"isolated fixtures removed");printf("PASS: import %.3fs, main gap %.1fms, %lu ticks\n",duration,maxGap*1000,(unsigned long)ticks);[checks release];return 0;
|
||||
}}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Reused sibling topology/math checks; source recorded in SpiderAndBalanceSources.json.
|
||||
#import <Metal/Metal.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#include "../大鱼调色/Plugin/SpiderCore/DYSpiderMesh.hpp"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <random>
|
||||
static int checks=0;
|
||||
static void require(bool value,const char*why){checks++;if(!value){fprintf(stderr,"FAIL %s\n",why);exit(1);}}
|
||||
int main(){@autoreleasepool{
|
||||
static_assert(sizeof(dy::SpiderMesh)==4988,"archive ABI");
|
||||
NSString*source=[NSString stringWithContentsOfFile:@"大鱼调色/Plugin/SpiderCore/DYColorMath.h" encoding:NSUTF8StringEncoding error:nil];
|
||||
source=[source stringByAppendingString:@"\nkernel void meshProbe(device const float4*input[[buffer(0)]],device float4*out[[buffer(1)]],constant int2&size[[buffer(2)]],device const float*samples[[buffer(3)]],uint i[[thread_position_in_grid]]){out[i]=float4(dyVariableSpider(input[i].xyz,size.x,size.y,samples),1);}\n"];
|
||||
NSError*error=nil;id<MTLDevice>device=MTLCreateSystemDefaultDevice();require(device,"Metal device");MTLCompileOptions*options=[MTLCompileOptions new];options.fastMathEnabled=NO;id<MTLLibrary>lib=[device newLibraryWithSource:source options:options error:&error];if(!lib)fprintf(stderr,"%s\n",error.localizedDescription.UTF8String);require(lib,"shared polar implementation compiles for Metal");id<MTLComputePipelineState>pipeline=[device newComputePipelineStateWithFunction:[lib newFunctionWithName:@"meshProbe"] error:&error];require(pipeline,"Metal pipeline");id<MTLCommandQueue>queue=[device newCommandQueue];
|
||||
std::vector<simd_float4>corpus;std::mt19937 rng(571030);std::uniform_real_distribution<float>values(-.2,4);
|
||||
for(int i=0;i<1000;i++){auto rgb=dyHSVRGB(float3{float(i)/1000,float(i%71)/70,1});corpus.push_back(simd_float4{rgb.x,rgb.y,rgb.z,1});corpus.push_back(simd_float4{values(rng),values(rng),values(rng),1});}
|
||||
for(float gray:{0.f,.001f,.5f,1.f,4.f})corpus.push_back(simd_float4{gray,gray,gray,1});
|
||||
id<MTLBuffer>input=[device newBufferWithBytes:corpus.data() length:corpus.size()*sizeof(simd_float4) options:MTLResourceStorageModeShared],output=[device newBufferWithLength:corpus.size()*sizeof(simd_float4) options:MTLResourceStorageModeShared];float maxError=0;int grids=0;
|
||||
for(int hues:{6,8,12,16,24})for(int saturation:{6,8,12,16,24}){
|
||||
auto neutral=dy::neutralMesh(hues,saturation);require(dy::validMesh(neutral),"all 25 supported topologies validate");auto samples=dy::meshSamples(neutral);
|
||||
for(auto c:corpus){auto n=dyVariableSpider(float3{c.x,c.y,c.z},hues,saturation-1,samples.data());require(n.x==c.x&&n.y==c.y&&n.z==c.z,"every neutral grid is exact identity including HDR and gray");}
|
||||
std::bitset<dy::SpiderMeshCapacity>selection;selection[2]=1;auto moved=dy::moveMesh(neutral,selection,-.035,.04);require(moved.pins[2]&&moved.x[0]<neutral.x[0]&&moved.x[saturation-1]==neutral.x[saturation-1],"one anchor moves free spoke points and leaves neighboring hue fixed");require(moved.x[saturation-2]==neutral.x[saturation-2],"outer boundary stays constrained");samples=dy::meshSamples(moved);
|
||||
id<MTLBuffer>buffer=[device newBufferWithBytes:samples.data() length:samples.size()*sizeof(float) options:MTLResourceStorageModeShared];simd_int2 size={hues,saturation-1};id<MTLCommandBuffer>cmd=[queue commandBuffer];id<MTLComputeCommandEncoder>enc=[cmd computeCommandEncoder];[enc setComputePipelineState:pipeline];[enc setBuffer:input offset:0 atIndex:0];[enc setBuffer:output offset:0 atIndex:1];[enc setBytes:&size length:sizeof(size) atIndex:2];[enc setBuffer:buffer offset:0 atIndex:3];[enc dispatchThreads:MTLSizeMake(corpus.size(),1,1) threadsPerThreadgroup:MTLSizeMake(64,1,1)];[enc endEncoding];[cmd commit];[cmd waitUntilCompleted];require(cmd.status==MTLCommandBufferStatusCompleted,"Metal dispatch completed");const auto*gpu=(const simd_float4*)output.contents;int changed=0;
|
||||
for(size_t i=0;i<corpus.size();i++){auto c=corpus[i];auto cpu=dyVariableSpider(float3{c.x,c.y,c.z},hues,saturation-1,samples.data());for(int k=0;k<3;k++){float relative=fabs(cpu[k]-gpu[i][k])/std::max(1.f,fabs(cpu[k]));maxError=std::max(maxError,relative);require(std::isfinite(gpu[i][k])&&relative<5e-5,"CPU Metal parity for each deformed grid");}changed+=fabs(cpu.x-c.x)+fabs(cpu.y-c.y)+fabs(cpu.z-c.z)>.001;}
|
||||
require(changed>0,"grid edit changes visible colors");grids++;
|
||||
// Uniform translation survives resampling between every pair of resolutions.
|
||||
auto translated=neutral;for(int i=0;i<dy::meshCount(translated);i++){translated.x[i]+=.02;translated.y[i]-=.01;}
|
||||
auto other=dy::resampleMesh(translated,saturation,hues);for(int i=0;i<dy::meshCount(other);i++){auto q=dy::meshNeutral(other,i);require(fabs(other.x[i]-q.x-.02)<2e-7&&fabs(other.y[i]-q.y+.01)<2e-7,"resampling preserves displacement including seam center and outer boundary");}
|
||||
}
|
||||
auto legacy=dyDefaultGrade();legacy.spiderX[7]+=.04;auto mesh=dy::legacyMesh(legacy);auto projected=dy::meshLegacyGrade(legacy,mesh);require(!memcmp(&legacy,&projected,sizeof(legacy)),"legacy grid no-op projection preserves every byte");auto invalid=mesh;invalid.hues=7;require(!dy::validMesh(invalid),"invalid resolution rejected");invalid=mesh;invalid.x[0]=NAN;require(!dy::validMesh(invalid),"nonfinite coordinate rejected");invalid=mesh;invalid.pins[4]=0;require(!dy::validMesh(invalid),"missing boundary constraint rejected");
|
||||
printf("PASS spider_mesh: %d assertions, %d topologies, %lu colors/grid, CPU/Metal max relative error %.9g\n",checks,grids,(unsigned long)corpus.size(),maxError);
|
||||
}}
|
||||
@@ -0,0 +1,105 @@
|
||||
// Independent generated-image oracles for free-path ROI, subpixel motion,
|
||||
// anisotropic transforms, feature capacity, and loss protection. No host UI.
|
||||
#import <Foundation/Foundation.h>
|
||||
#include "../大鱼调色/Plugin/MaskCore/DYTracker.hpp"
|
||||
#include "../大鱼调色/Plugin/DYToolFlow.inc.h"
|
||||
#include <chrono>
|
||||
|
||||
static float noise(int x,int y,uint32_t seed=0) {
|
||||
uint32_t n=uint32_t(x)*73856093u^uint32_t(y)*19349663u^seed;
|
||||
n^=n>>13;n*=1274126177u;n^=n>>16;
|
||||
return .1f+.8f*float(n&65535)/65535.f;
|
||||
}
|
||||
static float scene(float x,float y,bool extended=false,uint32_t seed=0) {
|
||||
if(extended&&(x<251||x>379||y<77||y>307))return .5f;
|
||||
float gx=x/3.f,gy=y/3.f;int ix=int(std::floor(gx)),iy=int(std::floor(gy));
|
||||
float dx=gx-ix,dy=gy-iy;
|
||||
return (1-dy)*((1-dx)*noise(ix,iy,seed)+dx*noise(ix+1,iy,seed))+
|
||||
dy*((1-dx)*noise(ix,iy+1,seed)+dx*noise(ix+1,iy+1,seed));
|
||||
}
|
||||
static dy::GrayFrame frame(int w,int h,double tx=0,double ty=0,double angle=0,
|
||||
double sx=1,double sy=1,bool extended=false,uint32_t seed=0) {
|
||||
dy::GrayFrame f{w,h,std::vector<float>(size_t(w)*h)};
|
||||
double cx=w*(extended?.35:.5),cy=h*.5,c=cos(angle),s=sin(angle);
|
||||
for(int y=0;y<h;y++)for(int x=0;x<w;x++) {
|
||||
double dx=x-cx-tx,dy=y-cy-ty;
|
||||
float u=float((c*dx+s*dy)/sx+cx),v=float((-s*dx+c*dy)/sy+cy);
|
||||
f.pixels[y*w+x]=scene(u,v,extended,seed);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
int main(int argc,const char*argv[]) {@autoreleasepool {
|
||||
NSMutableArray *checks=[NSMutableArray array];bool all=true;
|
||||
auto record=[&](NSString *name,bool pass,NSDictionary *extra=nil) {
|
||||
NSMutableDictionary *d=[NSMutableDictionary dictionaryWithDictionary:extra?:@{}];
|
||||
d[@"name"]=name;d[@"pass"]=@(pass);[checks addObject:d];all&=pass;
|
||||
};
|
||||
NSURL *library=argc>1?[NSURL fileURLWithPath:[NSString stringWithUTF8String:argv[1]]]:nil;
|
||||
for(int mode=0;mode<(library?2:1);mode++) {
|
||||
NSString *prefix=mode?@"metal":@"cpu";
|
||||
auto setup=[&](dy::Tracker& tracker) {
|
||||
if(!mode)return true;
|
||||
NSError *error=nil;auto backend=DYToolCreateMetalFlow(library,&error);
|
||||
if(!backend){record([prefix stringByAppendingString:@"-backend"],false,@{@"error":error.localizedDescription?:@"unavailable"});return false;}
|
||||
tracker.setBackend(backend);return true;
|
||||
};
|
||||
{
|
||||
dy::Tracker tracker;if(!setup(tracker))continue;
|
||||
tracker.setMask({{.8f,-.5f},{1.8f,-.5f},{1.8f,.5f},{.8f,.5f}});
|
||||
auto f=frame(512,384,0,0,0,1,1,true);
|
||||
bool started=tracker.reset(f,{.35f,.5f,.2f,.45f,0});
|
||||
record([prefix stringByAppendingString:@"-pen-texture-outside-creation-box-starts"],started,
|
||||
@{@"features":@(tracker.result().features)});
|
||||
bool passed=started;dy::TrackResult result;
|
||||
for(int i=1;i<=12&&passed;i++) {result=tracker.track(frame(512,384,1.25*i,.5*i,0,1,1,true));passed=result.valid;}
|
||||
double ex=fabs(result.cx-(.35+15./512))*512,ey=fabs(result.cy-(.5+6./384))*384;
|
||||
record([prefix stringByAppendingString:@"-extended-pen-region-subpixel-motion"],passed&&ex<.65&&ey<.65,
|
||||
@{@"xErrorPixels":@(ex),@"yErrorPixels":@(ey)});
|
||||
}
|
||||
{
|
||||
dy::Tracker tracker;if(!setup(tracker))continue;
|
||||
auto f=frame(640,480);bool started=tracker.reset(f,{.5,.5,.85,.85,0});
|
||||
record([prefix stringByAppendingString:@"-real-300-feature-capacity"],started&&tracker.result().features==300,
|
||||
@{@"features":@(tracker.result().features)});
|
||||
auto result=tracker.track(frame(640,480,2.25,-1.5,.025,1.025,.98));
|
||||
double ex=fabs(result.cx-(.5+2.25/640))*640,ey=fabs(result.cy-(.5-1.5/480))*480;
|
||||
record([prefix stringByAppendingString:@"-translation-rotation-independent-xy-scale"],
|
||||
started&&result.valid&&ex<.5&&ey<.5&&fabs(result.rotation-.025)<.004&&fabs(result.scaleX-1.025)<.005&&fabs(result.scaleY-.98)<.005,
|
||||
@{@"xErrorPixels":@(ex),@"yErrorPixels":@(ey),@"rotation":@(result.rotation),@"scaleX":@(result.scaleX),@"scaleY":@(result.scaleY)});
|
||||
}
|
||||
{
|
||||
dy::Tracker tracker;if(!setup(tracker))continue;
|
||||
auto f=frame(640,480);bool passed=tracker.reset(f,{.5,.5,.65,.65,0});dy::TrackResult result;
|
||||
for(int i=1;i<=6&&passed;i++){result=tracker.track(f);passed=result.valid;}
|
||||
record([prefix stringByAppendingString:@"-subpixel-refinement-and-redetection-remain-stationary"],passed&&fabs(result.cx-.5)*640<.05&&fabs(result.cy-.5)*480<.05);
|
||||
}
|
||||
{
|
||||
dy::Tracker tracker;if(!setup(tracker))continue;
|
||||
auto f=frame(640,480);bool started=tracker.reset(f,{.5,.5,.7,.7,0});
|
||||
auto result=tracker.track(frame(640,480,0,0,0,1,1,false,0x3344));
|
||||
record([prefix stringByAppendingString:@"-unrelated-cut-is-not-trusted-motion"],started&&!result.valid&&!tracker.active());
|
||||
dy::GrayFrame flat{640,480,std::vector<float>(640*480,.5f)};
|
||||
record([prefix stringByAppendingString:@"-flat-region-still-refuses-tracking"],!tracker.reset(flat,{.5,.5,.7,.7,0}));
|
||||
}
|
||||
{
|
||||
dy::Tracker tracker;if(!setup(tracker))continue;
|
||||
auto t=std::chrono::steady_clock::now();auto f=frame(1920,1080);bool started=tracker.reset(f,{.5,.5,.5,.5,0});
|
||||
auto result=tracker.track(frame(1920,1080,4,2));
|
||||
double ms=std::chrono::duration<double,std::milli>(std::chrono::steady_clock::now()-t).count();
|
||||
record([prefix stringByAppendingString:@"-1080p-complete-frame-motion"],started&&result.valid&&fabs(result.cx-(.5+4./1920))*1920<.5&&fabs(result.cy-(.5+2./1080))*1080<.5,
|
||||
@{@"generatedFramesAndAnalysisMilliseconds":@(ms),@"features":@(result.features)});
|
||||
}
|
||||
{
|
||||
dy::Tracker tracker;if(!setup(tracker))continue;
|
||||
auto t=std::chrono::steady_clock::now();auto f=frame(3840,2160);bool started=tracker.reset(f,{.5,.5,.5,.5,0});
|
||||
auto result=tracker.track(frame(3840,2160,8,4));
|
||||
double ms=std::chrono::duration<double,std::milli>(std::chrono::steady_clock::now()-t).count();
|
||||
record([prefix stringByAppendingString:@"-3840x2160-complete-frame-motion"],started&&result.valid&&fabs(result.cx-(.5+8./3840))*3840<.5&&fabs(result.cy-(.5+4./2160))*2160<.5,
|
||||
@{@"generatedFramesAndAnalysisMilliseconds":@(ms),@"features":@(result.features)});
|
||||
}
|
||||
}
|
||||
NSDictionary *report=@{@"pass":@(all),@"checks":checks,@"scope":@"Independent generated images, CPU tracker and optional real Metal optical flow. No app or GUI host launched.",@"sourceApplicationRuntimeDependency":@NO};
|
||||
NSData *json=[NSJSONSerialization dataWithJSONObject:report options:NSJSONWritingPrettyPrinted error:nil];
|
||||
fwrite(json.bytes,1,json.length,stdout);fputc('\n',stdout);return all?0:1;
|
||||
}}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"roots": [
|
||||
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color",
|
||||
"/Volumes/备份/大鱼调色",
|
||||
"/Library/Plug-Ins/FxPlug",
|
||||
"/Applications",
|
||||
"/Users/mac/Library/Plug-Ins/FxPlug",
|
||||
"/Users/mac/Downloads",
|
||||
"/Users/mac/Desktop"
|
||||
],
|
||||
"candidates": [
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"version": "1.3.1",
|
||||
"build": "19"
|
||||
}
|
||||
],
|
||||
"cleanup": "Final Release APP, loose XPC, submission ZIP, old formal backup and package staging removed by delivery/package scripts. Only this task synthetic failure fixture removed; user history and active settings preserved.",
|
||||
"scope": "Only listed roots inspected; historical distribution packages and unrelated products preserved."
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"pass" : true,
|
||||
"checks" : [
|
||||
{
|
||||
"name" : "report destination supplied",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "isolated library loaded",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "recent use deduplicates and puts latest first",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "recent history survives a new library instance",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "asynchronous browser task completed",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "recent category is first in the sidebar",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "recent category contains only used LUTs in order",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "all LUTs also put recent uses before unused names",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "loading does not update recent history",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "host rejection does not update history",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "only successful host application records recent use",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "search respects recent-first ordering",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "grid reflows when the browser size changes",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "list layout has full-width rows",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "sidebar divider changes folder width without overlapping previews",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "asynchronous browser task completed",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "layout and sidebar width survive reopening",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "asynchronous browser task completed",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "remote-parent checks never display a test window",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "window position and size are remembered",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "remote close callback runs once",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "recent history stays bounded at 40 newest paths",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "isolated fixtures and preferences cleaned",
|
||||
"pass" : true
|
||||
}
|
||||
],
|
||||
"scope" : "Real AppKit browser objects, hidden host-owned window fixture, asynchronous acknowledgement and root-scoped history; no visible test app or user LUT changes."
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/大鱼调色_1.3.1_浏览器与复位.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": 1,
|
||||
"missing": 0
|
||||
}
|
||||
},
|
||||
"version": "1.12",
|
||||
"summary": {
|
||||
"projects": 1,
|
||||
"assets": 1,
|
||||
"elements": 15
|
||||
},
|
||||
"host_validation": "not_performed_by_this_command"
|
||||
}
|
||||
文件差异过大,未显示。
加载差异
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"sourceCommit": "dbb7ca4a995ef832178a32f35939aed7d3a85012",
|
||||
"restoredFiles": 178,
|
||||
"fsck": "full strict passed",
|
||||
"rebuiltShaderSHA256": "034fdf3de0c8ab0ac8eacc8f8a4bd6fbb8ee8c8c93ed3af61363c8175f0196e2",
|
||||
"clone": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/browser-remote-restore-obhflq1b",
|
||||
"cloneCleaned": true,
|
||||
"formalShaderSHA256": "034fdf3de0c8ab0ac8eacc8f8a4bd6fbb8ee8c8c93ed3af61363c8175f0196e2"
|
||||
}
|
||||
@@ -0,0 +1,284 @@
|
||||
{
|
||||
"sourceBytes" : 197731344,
|
||||
"mainHeartbeatMaxGapMS" : 6.234458414837718,
|
||||
"bulkFiles" : 24,
|
||||
"checks" : [
|
||||
{
|
||||
"name" : "isolated source folder created",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "synthetic 65-cube file written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "anchor fixture written",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "preexisting library item imported",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "import completion is on main queue",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "bulk import succeeds",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "background operation completes within timeout",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "all files and previous entry preserved",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "main run loop stays responsive while importing",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "cancelled import returns cancellation",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "background operation completes within timeout",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "cancel exercised after copy had begun",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "cancel rolls back newly copied files only",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "cancelled scan reports cancellation",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "background operation completes within timeout",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "cancelled scan preserves previous snapshot",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "cold selection prepares off thread and completes on main",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "background operation completes within timeout",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "invalid selection reports failure asynchronously",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "background operation completes within timeout",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "3000 catalog files in independent folders created",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "background operation completes within timeout",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "large directory list creates only visible folder controls",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "large catalog creates only visible thumbnail controls",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "scrolling keeps thumbnail view count bounded",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "search remains usable after catalog loading",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "background operation completes within timeout",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "rapid selection applies only the latest LUT",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "background operation completes within timeout",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "clear selection supersedes pending LUT application",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "scan after browser close completes",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "background operation completes within timeout",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "closing during import cancels without changing existing library",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "background operation completes within timeout",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "acknowledgement fixture has selectable thumbnails",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "thumbnail stays loading until host application acknowledges",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "host rejection preserves previous selection and reports the error",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "new thumbnail click cancels previous application task",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "late older acknowledgement cannot mark a stale LUT selected",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "only acknowledged latest thumbnail becomes selected",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "removal also waits for host acknowledgement",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "acknowledged removal clears selection",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "closing the browser cancels pending host application",
|
||||
"pass" : true
|
||||
},
|
||||
{
|
||||
"name" : "completion after close cannot change the selection",
|
||||
"pass" : true
|
||||
}
|
||||
],
|
||||
"initialLiveThumbnailViews" : 28,
|
||||
"snapshotsReadDuringImport" : 1521,
|
||||
"mainHeartbeatTicks" : 1521,
|
||||
"scope" : "Synthetic 24 x 65-cube import with real main-run-loop heartbeat and snapshot reads; headless browser cancellation, latest selection and 3,025-entry virtualization. No user library or visible test app.",
|
||||
"pass" : true,
|
||||
"largeCatalogEntries" : 3025,
|
||||
"cubeDimension" : 65,
|
||||
"initialLiveFolderViews" : 15,
|
||||
"importSeconds" : 7.5717383332084864
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"tag": "v1.3.1-browser-recents-20261101",
|
||||
"releaseCommit": "281721bda11484c23f294b4f0d9e0b30ef829288",
|
||||
"restoredFiles": 184,
|
||||
"fsck": "full strict passed",
|
||||
"compiledSource": "dbb7ca4a995ef832178a32f35939aed7d3a85012",
|
||||
"compiledSourceRecovery": "verification/BrowserRecovery.json",
|
||||
"cloneCleaned": true
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"pass": true,
|
||||
"productBundleID": "com.dayu.color",
|
||||
"checkedRoots": [
|
||||
"/Volumes/备份/大鱼调色/大鱼调色",
|
||||
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color",
|
||||
"/Library/Plug-Ins/FxPlug",
|
||||
"/Applications",
|
||||
"/Users/mac/Library/Plug-Ins/FxPlug",
|
||||
"/Users/mac/Desktop",
|
||||
"/Users/mac/Downloads"
|
||||
],
|
||||
"outerApps": [
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"version": "1.2.0",
|
||||
"build": "17"
|
||||
}
|
||||
],
|
||||
"scope": "Bounded current-product inventory; unrelated products and user archives not deleted.",
|
||||
"deliveryGeneratedCopiesRemoved": true,
|
||||
"recoveryCloneRemoved": true,
|
||||
"formalPackageRetained": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.2.0.pkg"
|
||||
}
|
||||
文件差异过大,未显示。
加载差异
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"pass": true,
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"sourceCommit": "48b00c85799b0226ba32aba3f2e5397aa0e509ed",
|
||||
"restoredFiles": 151,
|
||||
"fsck": "full strict passed",
|
||||
"rebuiltShaderSHA256": "47b7c184e6f243406f0482b1a4a0312f0d0700a0b51196e51ab17a90ef0f29cc",
|
||||
"formalShaderSHA256": "47b7c184e6f243406f0482b1a4a0312f0d0700a0b51196e51ab17a90ef0f29cc",
|
||||
"clone": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/cst-remote-restore-0tb5r75b",
|
||||
"cloneCleaned": true
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"pass": true,
|
||||
"tag": "v1.2.0-cst-fold-20261101",
|
||||
"tagCommit": "8074444259fbacc758ec003aa91a6331b6224a85",
|
||||
"restoredFiles": 156,
|
||||
"fsck": "strict full passed",
|
||||
"packageRecordMatches": true,
|
||||
"cloneCleaned": true
|
||||
}
|
||||
+10
-27
@@ -2,35 +2,18 @@
|
||||
"status": "verified",
|
||||
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"bundleID": "com.dayu.color",
|
||||
"version": "1.1.5",
|
||||
"build": "16",
|
||||
"version": "1.4.1",
|
||||
"build": "26",
|
||||
"team": "B3W25FX5H5",
|
||||
"notaryID": "b47b6fe8-b7a9-4112-93b9-de85b03ca598",
|
||||
"notaryID": "1ddc5499-2da3-4d98-8b2d-09272b0ee326",
|
||||
"notaryStatus": "Accepted",
|
||||
"gatekeeper": "/Library/Plug-Ins/FxPlug/大鱼调色.app: accepted\nsource=Notarized Developer ID",
|
||||
"sourceCommit": "59b058a3c8b9e5387381574da6bbc05af437527c",
|
||||
"sourceCommit": "0eb56aed126c825ca89712ce90f8cc1c05b03d89",
|
||||
"templatePath": "/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef",
|
||||
"templateSHA256": "ebf8b7aa7a6781b9ce611375a838d89997656b0fc01077b2a7e5b1b2a2c373e1",
|
||||
"shaderSHA256": "9d89ed3197cf987a37ad7320911d23b8510b5461ffca2bd16397c8b963e02132",
|
||||
"hostVerification": "verification/HostLUTEncoding.json",
|
||||
"sourceRecoveryVerification": "verification/LUTEncodingRecovery.json",
|
||||
"responsivenessVerification": "verification/LUTEncoding.json",
|
||||
"registry": "com.dayu.color.XPC(1.1)\t78D73EB2-7FCE-41CD-8E6A-6AABC8ACACDB\t2026-11-01 07:39:57 +0000\t/Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit\n (1 plug-in)",
|
||||
"appInventory": [
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"version": "1.1.5",
|
||||
"build": "16"
|
||||
}
|
||||
],
|
||||
"inventoryScope": [
|
||||
"project and fixed product cache",
|
||||
"system FxPlug and Applications",
|
||||
"user FxPlug, Downloads and Desktop"
|
||||
],
|
||||
"packageVerification": "verification/Package.json",
|
||||
"packageStagingCleanup": {
|
||||
"identifier": "com.dayu.color.installer.c8d19ea6-1117-4621-ae47-48a41ea4ca10",
|
||||
"remainingMatchedDirectories": []
|
||||
}
|
||||
"templateSHA256": "9b8f6e407545429b77c1de88d4cceb738760771c5a7f1dbd9732bdcc95c23738",
|
||||
"shaderSHA256": "757b240921846ed06ca294a9bbfbd4aee5d41c6361a3918254a806187eb997ea",
|
||||
"hostVerification": "verification/HostMaskWorkflow1.4.1.json",
|
||||
"hostVerificationLimitations": [
|
||||
"实际鼠标钢笔落点和闭合待用户确认;原生OSC模拟检查通过。"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"date": "2026-11-01",
|
||||
"version": "1.3.1",
|
||||
"build": "19",
|
||||
"hostVersion": "12.4",
|
||||
"sourceCommit": "dbb7ca4a995ef832178a32f35939aed7d3a85012",
|
||||
"formalServiceProcesses": [
|
||||
"95818 /Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit/Contents/MacOS/大鱼调色 XPC Service"
|
||||
],
|
||||
"checks": [
|
||||
{
|
||||
"name": "sony-new-instance-default",
|
||||
"passResult": true,
|
||||
"observed": "New isolated FCP instance displays Sony S-Log3 and Sony S-Gamut3.Cine; output Gamma 2.4 / Rec.709."
|
||||
},
|
||||
{
|
||||
"name": "visible-primary-reset",
|
||||
"passResult": true,
|
||||
"observed": "Wheel adjusted to 256 degrees / 0.5%; visible 复位 button restored 0 degrees / 0%."
|
||||
},
|
||||
{
|
||||
"name": "host-owned-floating-browser",
|
||||
"passResult": true,
|
||||
"observed": "Browser opens in a separate FCP floating window with system close, zoom and minimize controls; no anchored popover in this host."
|
||||
},
|
||||
{
|
||||
"name": "window-resize-and-reflow",
|
||||
"passResult": true,
|
||||
"observed": "System zoom resized the floating window; grid/footer reflowed. Frame preference observed {{0, 110}, {1449, 916}}. Exact titlebar/border drag was not independently confirmed through automation."
|
||||
},
|
||||
{
|
||||
"name": "recent-first-and-success-acknowledgement",
|
||||
"passResult": true,
|
||||
"observed": "Applied 复古胶片风 then 复古清新干净1 from existing N12 library. 最近使用 is first category and contains exactly the latter followed by the former; newest also first in the folder."
|
||||
},
|
||||
{
|
||||
"name": "list-layout",
|
||||
"passResult": true,
|
||||
"observed": "Selected 列表; each LUT displayed as a full-width row with thumbnail and name."
|
||||
},
|
||||
{
|
||||
"name": "close-reopen-persistence",
|
||||
"passResult": true,
|
||||
"observed": "Done and reopen retained 列表, 最近使用 category, two-item order and current selection."
|
||||
},
|
||||
{
|
||||
"name": "user-live-use-preserved",
|
||||
"passResult": true,
|
||||
"observed": "User began manipulating the browser; their current grid layout, thumbnail size and selection were preserved. Further host restart/reset was stopped."
|
||||
}
|
||||
],
|
||||
"testData": "New isolated synthetic project 大鱼调色_1.3.1_浏览器与复位; existing LUTs read/applied, never imported or deleted.",
|
||||
"limitations": [
|
||||
"Live titlebar/border mouse drag was attempted but exact motion was not confirmed independently; native hidden-window geometry/resize/persistence and real host window zoom were checked separately.",
|
||||
"A full FCP process restart was not repeated after the user began interacting; browser close/reopen and native persisted preference recovery passed. Motion, Intel and older macOS not tested."
|
||||
],
|
||||
"finalState": "User is actively using the formally installed new browser; no preference rollback or test-instance reset performed after user interaction.",
|
||||
"userStateObserved": {
|
||||
"windowFrame": "{{225, 90}, {1469, 936}}",
|
||||
"layout": "grid",
|
||||
"thumbnailSize": 197.9713040865385,
|
||||
"preferencesPreserved": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"pass": true,
|
||||
"date": "2026-11-01",
|
||||
"hostVersion": "12.4",
|
||||
"version": "1.2.0",
|
||||
"build": "17",
|
||||
"sourceCommit": "48b00c85799b0226ba32aba3f2e5397aa0e509ed",
|
||||
"shaderSHA256": "47b7c184e6f243406f0482b1a4a0312f0d0700a0b51196e51ab17a90ef0f29cc",
|
||||
"formalServiceProcesses": [
|
||||
"91273 /Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit/Contents/MacOS/大鱼调色 XPC Service"
|
||||
],
|
||||
"checks": [
|
||||
{
|
||||
"name": "formal-version-loaded",
|
||||
"pass": true,
|
||||
"observed": "Inspector 1.2.0; XPC executable at the formal installation"
|
||||
},
|
||||
{
|
||||
"name": "new-instance-defaults",
|
||||
"pass": true,
|
||||
"observed": "13 module eyes on; primary and basic expanded; all other modules collapsed"
|
||||
},
|
||||
{
|
||||
"name": "fold-independent-of-enable",
|
||||
"pass": true,
|
||||
"observed": "Primary exposure 0.70 retained across collapse, eye off and expand; expansion did not re-enable"
|
||||
},
|
||||
{
|
||||
"name": "separate-transfer-gamut",
|
||||
"pass": true,
|
||||
"observed": "Sony S-Log3 selected without overwriting gamut; S-Gamut3.Cine selected separately"
|
||||
},
|
||||
{
|
||||
"name": "working-space",
|
||||
"pass": true,
|
||||
"observed": "ACEScct and ACES AP1 selected independently"
|
||||
},
|
||||
{
|
||||
"name": "normal-reopen",
|
||||
"pass": true,
|
||||
"observed": "Normal quit and reopen retained Sony input, ACES working space, exposure 0.70, primary collapsed and eye off"
|
||||
},
|
||||
{
|
||||
"name": "reset-defaults",
|
||||
"pass": true,
|
||||
"observed": "Reset all restored neutral controls, all eyes on, primary/basic expanded and others collapsed"
|
||||
},
|
||||
{
|
||||
"name": "style-library",
|
||||
"pass": true,
|
||||
"observed": "N12 folder 26 entries; previews populated; selected look confirmed by host"
|
||||
},
|
||||
{
|
||||
"name": "legacy-document",
|
||||
"pass": true,
|
||||
"observed": "Old acceptance project opened with its selected look and original enable values retained; no old-project edits"
|
||||
}
|
||||
],
|
||||
"testData": "Synthetic chart in a new acceptance project; user LUT files only read, never imported or deleted.",
|
||||
"finalState": "Acceptance instance reset to defaults. Old project values unchanged.",
|
||||
"limitations": [
|
||||
"CST numeric comparisons are recorded separately in CSTIntegration.json; no claim of pixel-exact live-host export equivalence.",
|
||||
"Motion, Intel and older macOS not tested. PKG installation not repeated."
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"status": "verified-with-explicit-pen-gesture-gap",
|
||||
"host": "Final Cut Pro 12.4",
|
||||
"formalApp": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"fixtureProject": "大鱼调色_1.4.1_25_独立工具与蒙版",
|
||||
"preliminaryBuild": "25",
|
||||
"newDocumentSchema": 2,
|
||||
"checks": [
|
||||
{
|
||||
"name": "native-inspector-add-layer-immediately-after-source",
|
||||
"passed": true,
|
||||
"evidence": "AX HSL base → HSL2 → HSL3 → Curve; schema2 after anchors match"
|
||||
},
|
||||
{
|
||||
"name": "repeated-add-at-original-inserts-before-existing-child",
|
||||
"passed": true,
|
||||
"newLayerID": "276668CB-1409-43E2-8967-012378413F4E",
|
||||
"oldLayerID": "B27B1FDF-EEEB-4307-8CE5-9F8128BB8F0D",
|
||||
"newValues": {},
|
||||
"oldValues": {
|
||||
"hsl0_0": 32.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "larger-mask-inspector-readable-in-formal-FCP",
|
||||
"passed": true,
|
||||
"evidence": "Observed screenshot: full-width sliders, large values and separate drawing rows"
|
||||
},
|
||||
{
|
||||
"name": "new-pen-enters-drawing-and-disables-tracking",
|
||||
"passed": true,
|
||||
"evidence": "Inspector drawing buttons enabled; tracking disabled; empty canvas draft and draw status"
|
||||
},
|
||||
{
|
||||
"name": "cold-reopen-entire-preset-byte-exact",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "upright-canvas-pen-hint-and-symbols",
|
||||
"passed": true,
|
||||
"evidence": "Final installed build 26 FCP screenshot"
|
||||
},
|
||||
{
|
||||
"name": "native-FCP-bezier-forward-tracking",
|
||||
"passed": true,
|
||||
"keys": 99,
|
||||
"mask": "Existing default closed 4-point Bezier; no claim of real-mouse drawn path"
|
||||
},
|
||||
{
|
||||
"name": "single-undo-clears-track-and-redo-exactly-restores-full-preset",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"presetBefore": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/workflow25-before-reopen.json",
|
||||
"bytes": 8258,
|
||||
"sha256": "9654ff3be150928e20f1b8536227bc39169997f36c6b82f91c3c945ef1fbcb0a"
|
||||
},
|
||||
"limitations": [
|
||||
"CUA coordinate clicks do not enter the FCP native OSC hit/event callback. Actual-mouse pen placement/closure remains unconfirmed pending user reply. Native real-OSC simulated-host tests passed separately.",
|
||||
"No claim of full Color Finale migration or same-real-video trajectory parity.",
|
||||
"Old schema1 tail layers keep their saved position and rendering for compatibility."
|
||||
],
|
||||
"userMediaModified": false,
|
||||
"finalBuild": "26",
|
||||
"compiledSource": "0eb56aed126c825ca89712ce90f8cc1c05b03d89",
|
||||
"formalXPCProcess": 8304,
|
||||
"formalHostProcess": 8287,
|
||||
"singlePluginKitPath": true,
|
||||
"presets": {
|
||||
"workflow26-after-reopen.json": {
|
||||
"sha256": "9654ff3be150928e20f1b8536227bc39169997f36c6b82f91c3c945ef1fbcb0a",
|
||||
"keys": 0,
|
||||
"layers": 2,
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/workflow26-after-reopen.json"
|
||||
},
|
||||
"workflow26-tracked.json": {
|
||||
"sha256": "b7c76ab254a0f0edd7f3bd6cc116a6d56966212267834350d6b16adfe17c8873",
|
||||
"keys": 99,
|
||||
"layers": 2,
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/workflow26-tracked.json"
|
||||
},
|
||||
"workflow26-undo.json": {
|
||||
"sha256": "9654ff3be150928e20f1b8536227bc39169997f36c6b82f91c3c945ef1fbcb0a",
|
||||
"keys": 0,
|
||||
"layers": 2,
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/workflow26-undo.json"
|
||||
},
|
||||
"workflow26-redo.json": {
|
||||
"sha256": "b7c76ab254a0f0edd7f3bd6cc116a6d56966212267834350d6b16adfe17c8873",
|
||||
"keys": 99,
|
||||
"layers": 2,
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/workflow26-redo.json"
|
||||
}
|
||||
},
|
||||
"nativeChecks": {
|
||||
"checks": 281,
|
||||
"passResult": true,
|
||||
"timingNote": "First build26 cache run had 280/281: external-activation-main-loop-responsive had 0 heartbeat /155.951ms; repeat, Release preflight, and installed runs all281 pass. Commit0eb56ae message prematurely said281pass before inspecting the initial run."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"date": "2026-11-01",
|
||||
"hostVersion": "12.4",
|
||||
"version": "1.3.0",
|
||||
"build": "18",
|
||||
"sourceCommit": "c2818cbb1157093f80efd2a85cea0cf1509f565e",
|
||||
"shaderSHA256": "034fdf3de0c8ab0ac8eacc8f8a4bd6fbb8ee8c8c93ed3af61363c8175f0196e2",
|
||||
"formalServiceProcesses": [
|
||||
"93869 /Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit/Contents/MacOS/大鱼调色 XPC Service"
|
||||
],
|
||||
"testData": "Isolated synthetic chart project 大鱼调色_1.3_蜘蛛盘与白平衡; no user media or LUT modifications.",
|
||||
"checks": [
|
||||
{
|
||||
"name": "formal-installed-version",
|
||||
"passResult": true,
|
||||
"observed": "Inspector shows 1.3.0; active XPC path is the unique formal installation."
|
||||
},
|
||||
{
|
||||
"name": "merged-primary-without-bypasses",
|
||||
"passResult": true,
|
||||
"observed": "Input/working controls, native primary wheel and output controls are children of one primary card. Four former bypass checkboxes are absent."
|
||||
},
|
||||
{
|
||||
"name": "new-default-layout",
|
||||
"passResult": true,
|
||||
"observed": "12 module eyes on; primary, spider and basic expanded; remaining 9 cards collapsed."
|
||||
},
|
||||
{
|
||||
"name": "wheel-host-adjustment-and-undo",
|
||||
"passResult": true,
|
||||
"observed": "Native wheel keyboard adjustment 0.5% to 1.0%; host Edit > Undo restored 0.5% at 256 degrees."
|
||||
},
|
||||
{
|
||||
"name": "spider-variable-density",
|
||||
"passResult": true,
|
||||
"observed": "Linked 6x6 to 12x12; unlink and choose saturation 8 retained hue 12."
|
||||
},
|
||||
{
|
||||
"name": "spider-host-adjustment-fixed-and-selection",
|
||||
"passResult": true,
|
||||
"observed": "Main point 1 moved by keyboard from X 0.5847 to 0.5897 after Fix; select ring selected 12 points."
|
||||
},
|
||||
{
|
||||
"name": "spider-host-undo-redo",
|
||||
"passResult": true,
|
||||
"observed": "Host Edit > Undo restored X 0.5847; Edit > Redo restored X 0.5897."
|
||||
},
|
||||
{
|
||||
"name": "fold-eye-independence",
|
||||
"passResult": true,
|
||||
"observed": "Spider collapsed and eye off separately; expanding after reopen retained eye off."
|
||||
},
|
||||
{
|
||||
"name": "normal-quit-and-reopen",
|
||||
"passResult": true,
|
||||
"observed": "Primary/spider collapsed states, spider eye off, unlinked 12x8 grid, point 1 X 0.5897 Y 0.5000, and primary wheel 256 degrees / 0.5% retained."
|
||||
},
|
||||
{
|
||||
"name": "reset-defaults",
|
||||
"passResult": true,
|
||||
"observed": "All eyes on; primary/spider/basic expanded, others collapsed; wheel 0% and spider linked 6x6 restored."
|
||||
}
|
||||
],
|
||||
"limitations": [
|
||||
"Coordinate mouse injection into the remote FxPlug view did not activate controls in this automation session. Live-host drag and double-click were not confirmed; native AppKit mouse-event integration and one-gesture undo pairing passed separately in SpiderAndBalance.json.",
|
||||
"No claim of pixel-exact live-host export; GPU/CPU and independent CST pixel checks are separate. Motion, Intel and old macOS were not tested."
|
||||
],
|
||||
"finalState": "Acceptance instance reset to defaults; FCP left on the isolated synthetic project."
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
2026-11-01 22:38:15.062 Df 大鱼调色 XPC Service[2015:f58e1b] dayu_tool_osc_hit x=1043.19 y=497.04 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.122 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=982.30 y=678.64 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.140 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=969.16 y=688.19 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.160 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=969.16 y=688.19 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.306 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=905.88 y=707.31 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.325 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=878.42 y=667.88 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.356 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=870.06 y=648.77 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.376 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=859.31 y=612.93 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.395 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=858.12 y=592.62 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.410 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=858.12 y=586.65 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.504 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=859.31 y=580.67 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.692 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_hit x=859.31 y=580.67 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:15.702 Df 大鱼调色 XPC Service[2015:f58e1b] dayu_tool_osc_event type=1 part=1 x=859.31 y=580.67 plugin=1
|
||||
2026-11-01 22:38:15.708 Df 大鱼调色 XPC Service[2015:f59ed4] dayu_tool_osc_event type=6 part=1 x=880.81 y=584.26 plugin=1
|
||||
2026-11-01 22:38:15.760 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_event type=6 part=1 x=895.13 y=586.65 plugin=1
|
||||
2026-11-01 22:38:15.826 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_event type=6 part=1 x=915.43 y=586.65 plugin=1
|
||||
2026-11-01 22:38:15.843 Df 大鱼调色 XPC Service[2015:f58e1b] dayu_tool_osc_event type=6 part=1 x=916.63 y=586.65 plugin=1
|
||||
2026-11-01 22:38:15.863 Df 大鱼调色 XPC Service[2015:f5c5a6] dayu_tool_osc_event type=6 part=1 x=919.01 y=586.65 plugin=1
|
||||
2026-11-01 22:38:15.876 Df 大鱼调色 XPC Service[2015:f5c707] dayu_tool_osc_event type=6 part=1 x=921.40 y=586.65 plugin=1
|
||||
2026-11-01 22:38:15.893 Df 大鱼调色 XPC Service[2015:f5c708] dayu_tool_osc_event type=6 part=1 x=921.40 y=585.45 plugin=1
|
||||
2026-11-01 22:38:15.910 Df 大鱼调色 XPC Service[2015:f5c5a4] dayu_tool_osc_event type=6 part=1 x=923.79 y=585.45 plugin=1
|
||||
2026-11-01 22:38:15.929 Df 大鱼调色 XPC Service[2015:f58e1b] dayu_tool_osc_event type=6 part=1 x=924.99 y=584.26 plugin=1
|
||||
2026-11-01 22:38:16.009 Df 大鱼调色 XPC Service[2015:f5c5a6] dayu_tool_osc_event type=6 part=1 x=932.15 y=577.09 plugin=1
|
||||
2026-11-01 22:38:16.026 Df 大鱼调色 XPC Service[2015:f5c5a6] dayu_tool_osc_event type=6 part=1 x=934.54 y=572.31 plugin=1
|
||||
2026-11-01 22:38:17.140 Df 大鱼调色 XPC Service[2015:f59ed4] dayu_tool_osc_hit x=527.37 y=673.86 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
2026-11-01 22:38:17.158 Df 大鱼调色 XPC Service[2015:f5c708] dayu_tool_osc_hit x=546.48 y=610.54 height=1134.00 rect=-0.00,141.19,1514.00,851.63 mask=1 hit=1
|
||||
@@ -0,0 +1,104 @@
|
||||
{
|
||||
"status": "host-workflows-and-user-operated-center-drag-passed",
|
||||
"version": "1.4.0",
|
||||
"build": "24",
|
||||
"host": "Final Cut Pro 12.4",
|
||||
"platform": "Apple M4 / macOS 27.1",
|
||||
"formalPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"compiledSource": "dbf25fe6719f17075362538dad0404951102524d",
|
||||
"verifiedAt": "2026-11-01T14:33:04.639635+00:00",
|
||||
"userMediaTouched": false,
|
||||
"checks": {
|
||||
"allTwelveHeadersHaveBothButtons": true,
|
||||
"extraHSLStartsZero": true,
|
||||
"extraHSLIndependent32Original0": true,
|
||||
"perLayerEllipseAndRectangle": true,
|
||||
"numericalMaskCenterEdit": true,
|
||||
"hostCanvasOutlineAndToolbarVisible": true,
|
||||
"forwardTracking99Exact25fpsKeys": true,
|
||||
"singleUndoZeroKeys": true,
|
||||
"singleRedoByteExact": true,
|
||||
"bidirectional100Keys": true,
|
||||
"extraLayerSingleFrameTwoKeys": true,
|
||||
"singleFramePlayhead": "00:00:00:01 to 00:00:00:02",
|
||||
"coldReopenCompletePresetByteExact": true,
|
||||
"formalExecutablePathVerified": true,
|
||||
"liveCanvasCenterDragUserVerified": true
|
||||
},
|
||||
"presets": {
|
||||
"independent": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/mask24-independent.json",
|
||||
"sha256": "c135ff71d798bb95745bf820dadac461064cfd5c6f6eec803316f1c5b6ddc266",
|
||||
"originalHSLRedHue": 0,
|
||||
"extraHSLRedHue": 32.0,
|
||||
"baseMaskKeys": 0,
|
||||
"extraMaskKeys": 0
|
||||
},
|
||||
"tracked": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/mask24-tracked.json",
|
||||
"sha256": "04fbeb6d3adf16e3d720e3004fb8fa90025ffa801fc3d656bcb5c2e25754d13b",
|
||||
"originalHSLRedHue": 0,
|
||||
"extraHSLRedHue": 32.0,
|
||||
"baseMaskKeys": 99,
|
||||
"extraMaskKeys": 0
|
||||
},
|
||||
"undo": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/mask24-undo.json",
|
||||
"sha256": "cd5afc39f7a135ab4f2d0bcfadf226a7dbe8a257a0352e3bccfc4c552209c6ac",
|
||||
"originalHSLRedHue": 0,
|
||||
"extraHSLRedHue": 32.0,
|
||||
"baseMaskKeys": 0,
|
||||
"extraMaskKeys": 0
|
||||
},
|
||||
"redo": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/mask24-redo.json",
|
||||
"sha256": "04fbeb6d3adf16e3d720e3004fb8fa90025ffa801fc3d656bcb5c2e25754d13b",
|
||||
"originalHSLRedHue": 0,
|
||||
"extraHSLRedHue": 32.0,
|
||||
"baseMaskKeys": 99,
|
||||
"extraMaskKeys": 0
|
||||
},
|
||||
"before-reopen": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/mask24-before-reopen.json",
|
||||
"sha256": "effbee122eb84087b9ba389d73a677c65c8d6c0cd3ee8258211906f0fda31bba",
|
||||
"originalHSLRedHue": 0,
|
||||
"extraHSLRedHue": 32.0,
|
||||
"baseMaskKeys": 100,
|
||||
"extraMaskKeys": 2
|
||||
},
|
||||
"after-reopen": {
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/fcp-qa/mask24-after-reopen.json",
|
||||
"sha256": "effbee122eb84087b9ba389d73a677c65c8d6c0cd3ee8258211906f0fda31bba",
|
||||
"originalHSLRedHue": 0,
|
||||
"extraHSLRedHue": 32.0,
|
||||
"baseMaskKeys": 100,
|
||||
"extraMaskKeys": 2
|
||||
}
|
||||
},
|
||||
"nativeChecks": 222,
|
||||
"limitations": [
|
||||
"Live FCP center dragging is confirmed by the user and by native hit/mouseDown/mouseDragged logs; AX values changed on the intended original HSL mask while the extra HSL mask remained unchanged. Live rotation, resize and pen gestures remain unverified; direct native OSC simulator regressions pass.",
|
||||
"Live FCP covers forward, bidirectional and single-frame tracking. Cancellation, stale-target rejection and backward cadence are additionally covered by native simulated host scheduling.",
|
||||
"Motion, Intel, older systems, non-square-pixel/cropped/retimed projects are unverified. Tracking covers translation, rotation and independent XY scale, not perspective or shear.",
|
||||
"Extra scalar tool values are static author data. Temporal mask tracks are supported. Spatial masks cannot be exported into Cube; complete presets preserve them."
|
||||
],
|
||||
"manualCanvasAcceptance": {
|
||||
"confirmedBy": "User in this chat",
|
||||
"confirmation": "Mask follows the actual mouse when dragged.",
|
||||
"verifiedAt": "2026-11-01T14:39:11.615310+00:00",
|
||||
"baseEllipseBefore": [
|
||||
0.6,
|
||||
0.5
|
||||
],
|
||||
"baseEllipseAfterAX": [
|
||||
0.378,
|
||||
0.379
|
||||
],
|
||||
"independentExtraRectangleAfterAX": [
|
||||
0.5,
|
||||
0.5
|
||||
],
|
||||
"nativeHitAndDragCallbacksObserved": true,
|
||||
"userChangesPreserved": true
|
||||
}
|
||||
}
|
||||
+941
-23
文件差异过大,未显示。
加载差异
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"build": "26",
|
||||
"removedEarlierBackup": [
|
||||
"/Library/Plug-Ins/FxPlug/.dayu-color-previous-57969b9e8916483b9ac4e8aa4ac25f61.app"
|
||||
],
|
||||
"immediateBuild25Backup": "removed by tools/deliver.py after host verification",
|
||||
"copiesInInspectedRoots": [
|
||||
"/Library/Plug-Ins/FxPlug/大鱼调色.app"
|
||||
],
|
||||
"scope": [
|
||||
"/Library/Plug-Ins/FxPlug",
|
||||
"/Applications",
|
||||
"/Users/mac/Library/Plug-Ins/FxPlug",
|
||||
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/DerivedData/Build/Products/Release"
|
||||
],
|
||||
"historicalPackagesPreserved": true
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"sourceCommit": "0eb56aed126c825ca89712ce90f8cc1c05b03d89",
|
||||
"restoredFiles": 224,
|
||||
"fsck": "full strict passed",
|
||||
"rebuiltShaderSHA256": "757b240921846ed06ca294a9bbfbd4aee5d41c6361a3918254a806187eb997ea",
|
||||
"templateRebuiltFromNativeModel": true,
|
||||
"templateSHA256": "9b8f6e407545429b77c1de88d4cceb738760771c5a7f1dbd9732bdcc95c23738",
|
||||
"LFS": false,
|
||||
"submodules": false,
|
||||
"cloneCleaned": true,
|
||||
"formalShaderSHA256": "757b240921846ed06ca294a9bbfbd4aee5d41c6361a3918254a806187eb997ea",
|
||||
"formalShaderMatches": true
|
||||
}
|
||||
+17
-17
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.1.5.pkg",
|
||||
"sha256": "bf2a4acc57a3c08176be0f317c90551120bfcfb21a7224a690191884c8a3d071",
|
||||
"bytes": 13752153,
|
||||
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.4.1.pkg",
|
||||
"sha256": "0c167aba339bbfdd9c4cbd96aea384e2d43f6d498629ebaf7b1c18cbc6dca5c6",
|
||||
"bytes": 14337616,
|
||||
"testUnsigned": false,
|
||||
"installationExecuted": false,
|
||||
"checks": [
|
||||
@@ -31,34 +31,34 @@
|
||||
"source": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"payload": "Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"bundleID": "com.dayu.color",
|
||||
"version": "1.1.5",
|
||||
"build": "16"
|
||||
"version": "1.4.1",
|
||||
"build": "26"
|
||||
},
|
||||
{
|
||||
"source": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/pkg-inputs/大鱼调色",
|
||||
"payload": "Library/Application Support/PKGForge/Payload/com.dayu.color.installer.c8d19ea6-1117-4621-ae47-48a41ea4ca10/1F33731D-2B0E-486C-8F6B-88E78433618D/大鱼调色"
|
||||
"payload": "Library/Application Support/PKGForge/Payload/com.dayu.color.installer.f2577d05-34d4-4ef1-aa6d-7e7aca56f716/4CA0FF20-56AD-40A6-9383-45374239C928/大鱼调色"
|
||||
}
|
||||
],
|
||||
"signature": "Package \"大鱼调色-1.1.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-01 07:46:31 +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.1.5.pkg: accepted\nsource=Notarized Developer ID",
|
||||
"signature": "Package \"大鱼调色-1.4.1.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-01 15:38:31 +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.4.1.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": {
|
||||
"message": "Successfully received submission info",
|
||||
"name": "大鱼调色-1.1.5.pkg",
|
||||
"status": "Accepted",
|
||||
"createdDate": "2026-11-01T07:46:33.136Z",
|
||||
"id": "90a38636-93bb-4693-8db2-16b9a815e409"
|
||||
"createdDate": "2026-11-01T15:38:33.055Z",
|
||||
"name": "大鱼调色-1.4.1.pkg",
|
||||
"id": "9a5ff448-2ac1-444e-b993-2928cf8c333f",
|
||||
"status": "Accepted"
|
||||
},
|
||||
"appCompiledSource": "59b058a3c8b9e5387381574da6bbc05af437527c",
|
||||
"appBuild": "16",
|
||||
"appCompiledSource": "0eb56aed126c825ca89712ce90f8cc1c05b03d89",
|
||||
"appBuild": "26",
|
||||
"packageBuilderRemote": "https://dayu.media/git/dayu/pkg-forge.git",
|
||||
"packageBuilderCommit": "191da9dc0abfda83fcc5939f6fc90e4c9019f4d9",
|
||||
"packageBuilderCommit": "eb53707c0e67d8ddeab8c1270bb079f1050cfafe",
|
||||
"templateSHA256": {
|
||||
"大鱼调色.moef": "ebf8b7aa7a6781b9ce611375a838d89997656b0fc01077b2a7e5b1b2a2c373e1",
|
||||
"大鱼调色.moef": "9b8f6e407545429b77c1de88d4cceb738760771c5a7f1dbd9732bdcc95c23738",
|
||||
"large.png": "ab12611e8801cff86332ccc505a4cffa0c1120541c2efb9bb9908be2c9fe631a",
|
||||
"small.png": "41fec3138aee904fc39d6982e6fde809243ffec55298dbfe966f4f48d89caf8a"
|
||||
},
|
||||
"installedAppHostAcceptance": "verification/HostLUTEncoding.json",
|
||||
"installedAppHostAcceptance": "verification/HostMaskWorkflow1.4.1.json",
|
||||
"installScope": "本轮仅生成并验包,未再次执行系统安装;正式 APP 已有独立宿主验收。"
|
||||
}
|
||||
+9
-36
@@ -1,39 +1,12 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"status": "prepared-before-upload",
|
||||
"tag": "v1.4.1-mask-workflow-20261101",
|
||||
"repository": "dayu/dayu-color",
|
||||
"repositoryID": 52,
|
||||
"private": false,
|
||||
"tag": "v1.1.5-lut-encoding-20261101",
|
||||
"releaseCommit": "06968514fc5205a83fbf3c5a3dbb1be0f6f3e79b",
|
||||
"releaseID": 355,
|
||||
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.1.5-lut-encoding-20261101",
|
||||
"assetID": 8,
|
||||
"assetName": "大鱼调色-1.1.5.pkg",
|
||||
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.1.5-lut-encoding-20261101/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.1.5.pkg",
|
||||
"bytes": 13752153,
|
||||
"sha256": "bf2a4acc57a3c08176be0f317c90551120bfcfb21a7224a690191884c8a3d071",
|
||||
"existingAssetReused": true,
|
||||
"verification": "Authenticated full download SHA-256 and byte count, then release/asset read-back.",
|
||||
"credentialSource": "macOS Keychain: dayu-git-api",
|
||||
"verifiedAt": "2026-11-01T08:23:02.166677+00:00",
|
||||
"status": "published-and-download-verified",
|
||||
"packageVerification": "verification/Package.json",
|
||||
"prePublishDraftDownload": {
|
||||
"passResult": true,
|
||||
"path": "/Volumes/备份/大鱼调色-1.1.5.pkg",
|
||||
"bytes": 13752153,
|
||||
"sha256": "bf2a4acc57a3c08176be0f317c90551120bfcfb21a7224a690191884c8a3d071",
|
||||
"sourceURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.1.5-lut-encoding-20261101/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.1.5.pkg",
|
||||
"source": "Completed authenticated Microsoft Edge download from the draft release asset URL, located through its Open containing folder action.",
|
||||
"whereFromsPresent": false,
|
||||
"whereFromsMatches": false,
|
||||
"birthtime": 1793521155.9,
|
||||
"releaseID": 355,
|
||||
"assetID": 8,
|
||||
"temporaryCopyRemoved": true
|
||||
},
|
||||
"publisherSourceCommit": "557bea72d68dde09db2c40ae220b12fc68db87a7",
|
||||
"actualAppCompiledSource": "59b058a3c8b9e5387381574da6bbc05af437527c",
|
||||
"assetUploads": 1,
|
||||
"credentialValueRecorded": false
|
||||
"version": "1.4.1",
|
||||
"build": "26",
|
||||
"appCompiledSource": "0eb56aed126c825ca89712ce90f8cc1c05b03d89",
|
||||
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.4.1.pkg",
|
||||
"bytes": 14337616,
|
||||
"sha256": "0c167aba339bbfdd9c4cbd96aea384e2d43f6d498629ebaf7b1c18cbc6dca5c6",
|
||||
"previousRelease": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.4.0-tool-masks-20261101"
|
||||
}
|
||||
文件差异过大,未显示。
加载差异
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"roots": [
|
||||
"/Users/mac/Library/Caches/CodexBuilds/com.dayu.color",
|
||||
"/Volumes/备份/大鱼调色",
|
||||
"/Library/Plug-Ins/FxPlug",
|
||||
"/Applications",
|
||||
"/Users/mac/Library/Plug-Ins/FxPlug",
|
||||
"/Users/mac/Downloads",
|
||||
"/Users/mac/Desktop"
|
||||
],
|
||||
"candidates": [
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"version": "1.3.0",
|
||||
"build": "18"
|
||||
}
|
||||
],
|
||||
"phase": "After formal install and package generation",
|
||||
"passResult": true,
|
||||
"scope": "Only the listed roots inspected. Other products and user archives preserved.",
|
||||
"cleanup": "Delivery script removed its Release APP, loose XPC, submission ZIP and previous formal backup after successful acceptance; PKG builder removed its staging copies."
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"pass": true,
|
||||
"output": "PASS spider_mesh: 204683 assertions, 25 topologies, 2005 colors/grid, CPU/Metal max relative error 1.78813934e-06",
|
||||
"assertions": 204683,
|
||||
"topologies": 25,
|
||||
"colorsPerGrid": 2005,
|
||||
"maxRelativeError": 1.78813934e-06,
|
||||
"source": "tools/verify_spider_mesh.mm",
|
||||
"coreSourceSHA256": "bdd6278e17ff4208ad94a8b0e834c817c0a3475f205dd79898e8fd88e84a19c9"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"sourceCommit": "c2818cbb1157093f80efd2a85cea0cf1509f565e",
|
||||
"restoredFiles": 168,
|
||||
"fsck": "full strict passed",
|
||||
"rebuiltShaderSHA256": "034fdf3de0c8ab0ac8eacc8f8a4bd6fbb8ee8c8c93ed3af61363c8175f0196e2",
|
||||
"clone": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/spider-remote-restore-_wlti6wz",
|
||||
"cloneCleaned": true,
|
||||
"formalShaderSHA256": "034fdf3de0c8ab0ac8eacc8f8a4bd6fbb8ee8c8c93ed3af61363c8175f0196e2"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"tag": "v1.3.0-spider-balance-20261101",
|
||||
"releaseCommit": "6528f888affe0acdd4292bc0c5ae0dac3a89b5a5",
|
||||
"restoredFiles": 172,
|
||||
"fsck": "full strict passed",
|
||||
"compiledSource": "c2818cbb1157093f80efd2a85cea0cf1509f565e",
|
||||
"compiledSourceRecovery": "verification/SpiderRecovery.json",
|
||||
"cloneCleaned": true
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"removed": [
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-7d4cb59101b145c9831f00eb51f1e512.app",
|
||||
"version": "1.4.0",
|
||||
"build": "22",
|
||||
"reason": "Task-created previous formal install; final installed build24 verified"
|
||||
},
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-793570296f434520b48336b9fc33da85.app",
|
||||
"version": "1.3.1",
|
||||
"build": "19",
|
||||
"reason": "Task-created previous formal install; final installed build24 verified"
|
||||
},
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-eb52cb62e5b64c3dbcbe51b4a4f07173.app",
|
||||
"version": "1.4.0",
|
||||
"build": "21",
|
||||
"reason": "Task-created previous formal install; final installed build24 verified"
|
||||
},
|
||||
{
|
||||
"path": "/Library/Plug-Ins/FxPlug/.dayu-color-previous-cc56f5cdd2894832abaa89e76df4de8b.app",
|
||||
"version": "1.4.0",
|
||||
"build": "20",
|
||||
"reason": "Task-created previous formal install; final installed build24 verified"
|
||||
}
|
||||
],
|
||||
"immediatePreviousBuild23RemovedByDelivery": true,
|
||||
"formalBuild": "24",
|
||||
"registry": [
|
||||
" com.dayu.color.XPC(1.1)\t8C45F711-7E1E-43F1-907D-95297F896CE2\t2026-11-01 14:20:28 +0000\t/Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit"
|
||||
],
|
||||
"scope": "Current product standard install dirs, fixed build cache and current checkout; unrelated user archives and products excluded",
|
||||
"verifiedAt": "2026-11-01T14:33:52.542279+00:00"
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"status": "superseded-before-release",
|
||||
"version": "1.4.0",
|
||||
"build": "20",
|
||||
"sourceCommit": "659a8c540db47ed593059127ab7c5ab018c359c0",
|
||||
"notaryID": "f3a3ff9e-91e6-4d7f-9e3b-12cb19e74e31",
|
||||
"nativeChecks": 216,
|
||||
"liveFCP": {
|
||||
"addedInitializedSecondHSL": true,
|
||||
"changedSecondHueTo32": true,
|
||||
"perInstanceEllipse": true,
|
||||
"singleStepRealHostKeys": 2,
|
||||
"undoKeyCount": 0,
|
||||
"redoKeyCount": 2,
|
||||
"redoCompletePresetBytesEqual": true,
|
||||
"oscVerified": false,
|
||||
"oscBlocker": "Motion wrapper parameter 10005 remained zero; fixed to publish native OSC for build21."
|
||||
},
|
||||
"userMediaModified": false
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"sourceCommit": "dbf25fe6719f17075362538dad0404951102524d",
|
||||
"restoredFiles": 210,
|
||||
"fsck": "full strict passed",
|
||||
"rebuiltShaderSHA256": "df82ed0310281e854085063276ab161db7c623511751a1c1c63607b4072c8097",
|
||||
"formalShaderSHA256": "df82ed0310281e854085063276ab161db7c623511751a1c1c63607b4072c8097",
|
||||
"templateRebuiltFromNativeModel": true,
|
||||
"templateSHA256": "9b8f6e407545429b77c1de88d4cceb738760771c5a7f1dbd9732bdcc95c23738",
|
||||
"clone": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/mask-remote-restore-leyx6cd4/source",
|
||||
"LFS": false,
|
||||
"submodules": false,
|
||||
"cloneCleaned": true
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"passResult": true,
|
||||
"tag": "v1.4.0-tool-masks-20261101",
|
||||
"commit": "fa7ef93714c93ba959276e21be60e5758f37e0ad",
|
||||
"restoredFiles": 214,
|
||||
"fsck": "full strict passed",
|
||||
"packageSHA256": "16a4958e28bc2a43c40e6131067eb03a49aecba5bbe3c0424bc7024fa532af38",
|
||||
"packageBytes": 14250425,
|
||||
"sourceRecovery": "verification/ToolMaskRecovery.json",
|
||||
"cloneCleaned": true
|
||||
}
|
||||
@@ -60,12 +60,14 @@
|
||||
Plugin/DYDiagnostics.mm,
|
||||
Plugin/DYGrade.metal,
|
||||
Plugin/DYInspector.mm,
|
||||
Plugin/DYTheme.mm,
|
||||
Plugin/DYLUTLibrary.mm,
|
||||
Plugin/DYLUTBrowser.mm,
|
||||
Plugin/DYLUTLibrary.mm,
|
||||
Plugin/DYModel.mm,
|
||||
Plugin/DYPlugIn.mm,
|
||||
Plugin/DYRenderer.mm,
|
||||
Plugin/DYTheme.mm,
|
||||
Plugin/DYToolState.mm,
|
||||
Plugin/DYTracking.metal,
|
||||
Plugin/Info.plist,
|
||||
Plugin/main.m,
|
||||
Plugin/Resources/DayuColorTables.bin,
|
||||
@@ -121,9 +123,9 @@
|
||||
Plugin/Resources/InputLUTs/sony_slog3_sgamut3cine_to_rec709.dylut,
|
||||
"Plugin/Resources/THIRD-PARTY-NOTICES.txt",
|
||||
"Wrapper Application/AppDelegate.m",
|
||||
"Wrapper Application/Resources/DayuColor.icns",
|
||||
"Wrapper Application/Info.plist",
|
||||
"Wrapper Application/main.m",
|
||||
"Wrapper Application/Resources/DayuColor.icns",
|
||||
);
|
||||
target = 04962E5C3095058F009952AA /* XPC Service */;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef DAYU_SHADER_TYPES_H
|
||||
#define DAYU_SHADER_TYPES_H
|
||||
#include <simd/simd.h>
|
||||
typedef struct CSTParams { int inputGamut, inputTransfer, outputGamut, outputTransfer, toneMapping; } CSTParams;
|
||||
typedef struct BasisParams {
|
||||
int colorspace;
|
||||
float exposure, balanceTarget, balanceStrength, contrast, pivot, highlights, midtones, shadows;
|
||||
float trimLow, trimHigh, trimToeStrength, trimShoulderStrength, shadowContrast, shadowPivot, hiContrast, hiPivot, chromaMix;
|
||||
unsigned char bypassBalance, bypassTone, bypassExposure, bypassContrast;
|
||||
float saturation;
|
||||
} BasisParams;
|
||||
typedef struct DayuRenderParams {
|
||||
CSTParams input;
|
||||
CSTParams output;
|
||||
BasisParams basis;
|
||||
int stages;
|
||||
int sourceLinear;
|
||||
int destinationLinear;
|
||||
int reserved;
|
||||
// Additional curve-only adapters for working encodings absent from original BASIS.
|
||||
CSTParams basisInput;
|
||||
CSTParams basisOutput;
|
||||
} DayuRenderParams;
|
||||
#ifndef __METAL_VERSION__
|
||||
_Static_assert(sizeof(CSTParams)==20, "CST target layout");
|
||||
_Static_assert(sizeof(BasisParams)==80, "BASIS target layout");
|
||||
_Static_assert(sizeof(DayuRenderParams)==176, "Integrated layout; legacy prefix remains 136 bytes");
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
// Raw, animatable CST controls. The first 944 bytes of DYUniforms stay unchanged.
|
||||
#pragma once
|
||||
#include "DYCSTTypes.h"
|
||||
typedef struct DYCMSettings {
|
||||
float configured;
|
||||
float inputTransfer;
|
||||
float inputGamut;
|
||||
float workingTransfer;
|
||||
float workingGamut;
|
||||
float inputEnabled;
|
||||
float basisEnabled;
|
||||
float outputEnabled;
|
||||
float outputTransfer;
|
||||
float outputGamut;
|
||||
float toneMapping;
|
||||
float exposure;
|
||||
float balanceAngle;
|
||||
float balanceStrength;
|
||||
float saturation;
|
||||
float contrast;
|
||||
float pivot;
|
||||
float hiContrast;
|
||||
float hiPivot;
|
||||
float shadowContrast;
|
||||
float shadowPivot;
|
||||
float white;
|
||||
float shoulder;
|
||||
float highlights;
|
||||
float midtones;
|
||||
float shadows;
|
||||
float black;
|
||||
float toe;
|
||||
float chromaMix;
|
||||
float bypassExposure;
|
||||
float bypassBalance;
|
||||
float bypassContrast;
|
||||
float bypassTone;
|
||||
float mix;
|
||||
float blackWhiteMix;
|
||||
} DYCMSettings;
|
||||
#ifndef __METAL_VERSION__
|
||||
#include <math.h>
|
||||
static inline int DYBasisMode(int c) {
|
||||
if(c==99)return 0;if(c>=1&&c<=11)return c;
|
||||
switch(c){case 14:return 12;case 15:return 13;case 16:return 14;case 19:return 15;case 20:return 16;case 21:return 17;case 22:return 18;case 25:return 19;case 27:return 20;case 28:return 21;default:return -1;}
|
||||
}
|
||||
static inline DayuRenderParams DYCMRender(DYCMSettings s) {
|
||||
DayuRenderParams p={0};
|
||||
p.input=(CSTParams){(int)lroundf(s.inputGamut),(int)lroundf(s.inputTransfer),(int)lroundf(s.workingGamut),(int)lroundf(s.workingTransfer),0};
|
||||
p.output=(CSTParams){p.input.outputGamut,p.input.outputTransfer,(int)lroundf(s.outputGamut),(int)lroundf(s.outputTransfer),(int)lroundf(s.toneMapping)};
|
||||
p.stages=(s.inputEnabled>.5?1:0)|(s.basisEnabled>.5?2:0)|(s.outputEnabled>.5?4:0);
|
||||
if(s.toneMapping>.5){p.input.toneMapping=(p.input.inputTransfer>1000?2:0)+(p.input.outputTransfer>1000?1:0);p.output.toneMapping=(p.output.inputTransfer>1000?2:0)+(p.output.outputTransfer>1000?1:0);}
|
||||
int mode=DYBasisMode(p.input.outputTransfer);p.basis.colorspace=mode<0?10:mode;
|
||||
if(mode<0){p.reserved|=8;p.basisInput=(CSTParams){p.input.outputGamut,p.input.outputTransfer,p.input.outputGamut,10,0};p.basisOutput=(CSTParams){p.input.outputGamut,10,p.input.outputGamut,p.input.outputTransfer,0};}
|
||||
BasisParams *b=&p.basis;
|
||||
b->exposure=exp2f(s.exposure);b->balanceTarget=s.balanceAngle;b->balanceStrength=s.balanceStrength*s.balanceStrength*4;
|
||||
b->contrast=exp2f(s.contrast);b->pivot=exp2f(s.pivot);b->highlights=s.highlights;b->midtones=s.midtones*.3330000042915344f;b->shadows=s.shadows*1.5f;
|
||||
b->trimLow=1.0+(double)s.black*-.5;b->trimHigh=s.white;b->trimToeStrength=1+15*s.toe;b->trimShoulderStrength=1+7*s.shoulder;
|
||||
b->shadowContrast=(double)s.shadowContrast*-1.3;b->shadowPivot=exp2f(.20000000298023224f*s.shadowPivot);b->hiContrast=s.hiContrast*2;b->hiPivot=exp2f(-.20000000298023224f*s.hiPivot);b->chromaMix=s.chromaMix;
|
||||
b->bypassExposure=s.bypassExposure>.5;b->bypassBalance=s.bypassBalance>.5;b->bypassContrast=s.bypassContrast>.5;b->bypassTone=s.bypassTone>.5;b->saturation=s.saturation;
|
||||
return p;
|
||||
}
|
||||
#endif
|
||||
+165
-9
@@ -3,6 +3,8 @@
|
||||
#import "DYRenderer.h"
|
||||
#import "DYAutoGrade.h"
|
||||
#import "DYLUTLibrary.h"
|
||||
#import "DYInspector.h"
|
||||
#include "DYSpiderState.h"
|
||||
#include <string>
|
||||
#import <CoreVideo/CoreVideo.h>
|
||||
#import <IOSurface/IOSurface.h>
|
||||
@@ -11,6 +13,7 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include "DYToolTrackingProbe.inc.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.
|
||||
@@ -18,21 +21,48 @@
|
||||
@public
|
||||
NSMutableDictionary *_values,*_custom;
|
||||
BOOL _duplicate;
|
||||
@public
|
||||
int _undoStarts,_undoEnds;BOOL _undoActive;
|
||||
}
|
||||
@end
|
||||
@interface DYInspector (DiagnosticActions)
|
||||
- (void)refresh;
|
||||
- (void)resetAll:(id)sender;
|
||||
@end
|
||||
@protocol DYSpiderProbe
|
||||
@property(nonatomic,copy) NSData *meshData;
|
||||
@property(nonatomic,retain) NSMutableIndexSet *selection,*pinned;
|
||||
@property(nonatomic,copy) void(^changed)(DYGrade,NSData*);
|
||||
@property(nonatomic,copy) void(^gesture)(BOOL);
|
||||
@property(nonatomic,readonly) NSInteger hueCount,saturationCount;
|
||||
- (void)changeHueCount:(int)hues saturationCount:(int)saturation;
|
||||
- (void)resetMesh;
|
||||
- (NSPoint)point:(NSInteger)index;
|
||||
- (void)selectRing;
|
||||
- (void)selectSpoke;
|
||||
- (void)resetSelected;
|
||||
@end
|
||||
@implementation DYDiagnosticManager
|
||||
- (instancetype)init {if((self=[super init])){_values=[NSMutableDictionary new];_custom=[NSMutableDictionary new];}return self;}
|
||||
- (void)dealloc {[_values release];[_custom release];[super dealloc];}
|
||||
- (id)apiForProtocol:(Protocol *)protocol {
|
||||
NSString *name=NSStringFromProtocol(protocol);
|
||||
return [@[@"FxParameterCreationAPI_v5",@"FxParameterRetrievalAPI_v6",@"FxParameterSettingAPI_v6"]containsObject:name]?self:nil;
|
||||
return [@[@"FxParameterCreationAPI_v5",@"FxParameterRetrievalAPI_v6",@"FxParameterSettingAPI_v6",@"FxCustomParameterActionAPI_v4",@"FxUndoAPI"]containsObject:name]?self:nil;
|
||||
}
|
||||
- (BOOL)startUndoGroup:(NSString *)title{_undoStarts++;_undoActive=YES;return YES;}
|
||||
- (BOOL)endUndoGroup{_undoEnds++;_undoActive=NO;return YES;}
|
||||
- (void)startAction:(id)sender{}
|
||||
- (void)endAction:(id)sender{}
|
||||
- (CMTime)currentTime{return kCMTimeZero;}
|
||||
- (BOOL)addFloatSliderWithName:(NSString *)name parameterID:(UInt32)pid defaultValue:(double)value parameterMin:(double)minimum parameterMax:(double)maximum sliderMin:(double)sliderMinimum sliderMax:(double)sliderMaximum delta:(double)delta parameterFlags:(FxParameterFlags)flags {
|
||||
if(_values[@(pid)]||_custom[@(pid)]){_duplicate=YES;return NO;}_values[@(pid)]=@(value);return YES;
|
||||
}
|
||||
- (BOOL)addStringParameterWithName:(NSString*)name parameterID:(UInt32)pid defaultValue:(NSString*)value parameterFlags:(FxParameterFlags)flags{if(_values[@(pid)]||_custom[@(pid)]){_duplicate=YES;return NO;}_custom[@(pid)]=value;return YES;}
|
||||
- (BOOL)addCustomParameterWithName:(NSString *)name parameterID:(UInt32)pid defaultValue:(NSObject<NSSecureCoding,NSCopying> *)value parameterFlags:(FxParameterFlags)flags {
|
||||
if(_values[@(pid)]||_custom[@(pid)]){_duplicate=YES;return NO;}_custom[@(pid)]=value;return YES;
|
||||
}
|
||||
- (BOOL)getStringParameterValue:(NSString**)value fromParameter:(UInt32)pid{id string=_custom[@(pid)];if(![string isKindOfClass:NSString.class])return NO;if(value)*value=string;return YES;}
|
||||
- (BOOL)setStringParameterValue:(NSString*)value toParameter:(UInt32)pid{if(![_custom[@(pid)]isKindOfClass:NSString.class])return NO;_custom[@(pid)]=value;return YES;}
|
||||
- (BOOL)getFloatValue:(double *)value fromParameter:(UInt32)pid atTime:(CMTime)time {
|
||||
NSNumber *stored=_values[@(pid)];if(!stored)return NO;if(value)*value=stored.doubleValue;return YES;
|
||||
}
|
||||
@@ -78,6 +108,7 @@
|
||||
- (FxRect)imagePixelBounds {return _bounds;}
|
||||
- (uint64_t)deviceRegistryID {return _registry;}
|
||||
- (FxImageOrigin)imageOrigin {return _diagnosticOrigin;}
|
||||
- (double)pixelAspect{return 1;}
|
||||
- (void)setDiagnosticImageOrigin:(FxImageOrigin)origin {_diagnosticOrigin=origin;}
|
||||
@end
|
||||
|
||||
@@ -109,6 +140,21 @@ static Pixels render(Run& run,DYRenderer *renderer,DYDiagnosticTile *source,DYDi
|
||||
NSError *error=nil;BOOL ok=[renderer renderSource:source destination:destination uniforms:uniforms paths:paths error:&error];
|
||||
run.need(name,ok,@{@"error":ok?@"":reason(error)});return read(destination,gpu);
|
||||
}
|
||||
static Pixels referenceFrame(id<MTLDevice> gpu,id<MTLLibrary> library,const Pixels &premult,NSUInteger width,NSUInteger height,DayuRenderParams params,NSError **error){
|
||||
MTLTextureDescriptor *td=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:width height:height mipmapped:NO];td.storageMode=MTLStorageModeShared;td.usage=MTLTextureUsageShaderRead;
|
||||
id<MTLTexture>source=[gpu newTextureWithDescriptor:td];td.pixelFormat=MTLPixelFormatRGBA32Float;td.usage=MTLTextureUsageRenderTarget;id<MTLTexture>dest=[gpu newTextureWithDescriptor:td];
|
||||
Pixels encoded(premult.size());for(NSUInteger i=0;i<width*height;i++){float alpha=premult[i*4+3];for(int c=0;c<3;c++){float v=alpha>0?(float)(__fp16)((float)premult[i*4+c]/alpha):0;encoded[i*4+c]=v<=.0031308f?v*12.92f:1.055f*powf(v,1/2.4f)-.055f;}encoded[i*4+3]=alpha;}
|
||||
[source replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:encoded.data() bytesPerRow:width*8];
|
||||
MTLRenderPipelineDescriptor *pd=[MTLRenderPipelineDescriptor new];pd.vertexFunction=[library newFunctionWithName:@"vertexShader"];pd.fragmentFunction=[library newFunctionWithName:@"fragmentShader"];pd.colorAttachments[0].pixelFormat=MTLPixelFormatRGBA32Float;
|
||||
id<MTLRenderPipelineState>pipeline=[gpu newRenderPipelineStateWithDescriptor:pd error:error];[pd.vertexFunction release];[pd.fragmentFunction release];[pd release];
|
||||
Pixels result;if(pipeline){id<MTLCommandQueue>q=[gpu newCommandQueue];id<MTLCommandBuffer>cb=[q commandBuffer];MTLRenderPassDescriptor *rp=[MTLRenderPassDescriptor renderPassDescriptor];rp.colorAttachments[0].texture=dest;rp.colorAttachments[0].loadAction=MTLLoadActionDontCare;rp.colorAttachments[0].storeAction=MTLStoreActionStore;id<MTLRenderCommandEncoder>e=[cb renderCommandEncoderWithDescriptor:rp];
|
||||
float w=width,h=height;DYVertex2D vertices[]={{{w/2,-h/2},{1,1}},{{-w/2,-h/2},{0,1}},{{w/2,h/2},{1,0}},{{-w/2,h/2},{0,0}}};vector_uint2 vp={(unsigned)width,(unsigned)height};id<MTLBuffer>hist=[gpu newBufferWithLength:800 options:MTLResourceStorageModeShared];
|
||||
[e setRenderPipelineState:pipeline];[e setVertexBytes:vertices length:sizeof(vertices) atIndex:0];[e setVertexBytes:&vp length:sizeof(vp) atIndex:1];[e setFragmentTexture:source atIndex:0];[e setFragmentTexture:source atIndex:1];[e setFragmentBytes:¶ms length:sizeof(params) atIndex:0];[e setFragmentBuffer:hist offset:0 atIndex:1];[e drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4];[e endEncoding];[cb commit];[cb waitUntilCompleted];
|
||||
if(cb.status==MTLCommandBufferStatusCompleted){std::vector<float>pixels(width*height*4);[dest getBytes:pixels.data() bytesPerRow:width*16 fromRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0];result.resize(premult.size());for(NSUInteger i=0;i<width*height;i++){float a=premult[i*4+3];for(int c=0;c<3;c++){float v=pixels[i*4+c];float linear=v<=.04045f?v/12.92f:powf((v+.055f)/1.055f,2.4f);result[i*4+c]=a>0?(__fp16)((float)(__fp16)linear*a):0;}result[i*4+3]=a;}}
|
||||
[hist release];[q release];
|
||||
}
|
||||
[pipeline release];[source release];[dest release];return result;
|
||||
}
|
||||
static float *field(DYUniforms *u,NSDictionary *row){return (float *)((uint8_t *)u+[row[@"offset"]unsignedIntegerValue]);}
|
||||
}
|
||||
|
||||
@@ -127,11 +173,12 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
|
||||
for(NSDictionary *row in descriptors)if([row[@"offset"]integerValue]>=0){float value=*field(&defaults,row);finite&=std::isfinite(value);matches&=value==[row[@"default"]floatValue];}
|
||||
for(int c=0;c<3;c++)finite&=std::isfinite(defaults.primariesM0[c])&&std::isfinite(defaults.primariesM1[c])&&std::isfinite(defaults.primariesM2[c]);
|
||||
run.need(@"finite-real-model-defaults",finite&&matches);
|
||||
run.record(@"new-input-default-sony-slog3-sgamut3-cine",defaults.cm.inputTransfer==28&&defaults.cm.inputGamut==27&&defaults.cm.outputTransfer==1002&&defaults.cm.outputGamut==22);
|
||||
bool initialGroups=true;
|
||||
for(NSDictionary *section in sections){BOOL base=[@[@"base",@"color"]containsObject:section[@"key"]];for(NSDictionary *row in descriptors)if([row[@"pid"]isEqual:section[@"enabled"]])initialGroups&=([row[@"default"]doubleValue]>=.5)==base;}
|
||||
run.record(@"only-basic-adjustments-enabled-by-default",initialGroups);
|
||||
for(NSDictionary *section in sections){BOOL base=YES;for(NSDictionary *row in descriptors)if([row[@"pid"]isEqual:section[@"enabled"]])initialGroups&=([row[@"default"]doubleValue]>=.5)==base;}
|
||||
run.record(@"all-module-eyes-enabled-by-default",initialGroups);
|
||||
DYDiagnosticManager *manager=[[[DYDiagnosticManager alloc]init]autorelease];error=nil;
|
||||
run.need(@"native-parameter-creation",DYCreateParameters(manager,&error)&&!manager->_duplicate&&manager->_values.count==descriptors.count&&manager->_custom.count==2,@{@"error":reason(error)});
|
||||
run.need(@"native-parameter-creation",DYCreateParameters(manager,&error)&&!manager->_duplicate&&manager->_values.count==descriptors.count&&manager->_custom.count==4,@{@"error":reason(error)});
|
||||
id<FxParameterSettingAPI_v6> setter=[manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];id<FxParameterRetrievalAPI_v6> getter=[manager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];
|
||||
[setter setFloatValue:.75 toParameter:2000 atTime:kCMTimeZero];double value=0;[getter getFloatValue:&value fromParameter:2000 atTime:kCMTimeZero];DYUniforms restored;DYReadUniforms(manager,kCMTimeZero,&restored);
|
||||
run.record(@"native-get-set-model-roundtrip",value==.75&&restored.exposure==.75f);
|
||||
@@ -142,13 +189,100 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
|
||||
run.record(@"secure-asset-archive-roundtrip",decoded&&[assets isEqual:decoded],@{@"archiveBytes":@(archive.length),@"error":reason(error)});
|
||||
BOOL wrote=DYWriteAssets(manager,assets,kCMTimeZero);DYAssetState *readBack=DYReadAssets(manager,kCMTimeZero);run.record(@"native-custom-asset-get-set",wrote&&[readBack isEqual:assets]);
|
||||
DYAssetState *copy=[[assets copy]autorelease];copy.paths=@{};run.record(@"asset-copy-is-independent",assets.paths.count==2&©.paths.count==0);
|
||||
// Exercise the real AppKit actions against a separate, in-memory host.
|
||||
[NSApplication sharedApplication];
|
||||
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)});
|
||||
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);
|
||||
NSDictionary *first=cards[0];if(![first[@"collapsed"]boolValue]){[(NSButton*)first[@"header"]performClick:nil];[inspector refresh];}BOOL wasFolded=[first[@"collapsed"]boolValue];[(NSButton*)first[@"enabled"]performClick:nil];[inspector refresh];DYReadUniforms(uiHost,kCMTimeZero,&uiAfter);
|
||||
run.record(@"eye-only-toggles-enable-retains-disclosure",[first[@"collapsed"]boolValue]==wasFolded&&uiAfter.inputSectionEnabled==0);
|
||||
[(NSButton*)first[@"header"]performClick:nil];[inspector refresh];DYReadUniforms(uiHost,kCMTimeZero,&uiAfter);
|
||||
run.record(@"expanding-disabled-module-keeps-it-disabled",uiAfter.inputSectionEnabled==0&&![first[@"collapsed"]boolValue]);
|
||||
DYInspector *reopened=[[[DYInspector alloc]initWithAPIManager:uiHost]autorelease];[reopened refresh];NSArray *reopenedCards=[reopened valueForKey:@"cards"];
|
||||
run.record(@"inspector-recreation-restores-independent-disclosure",![reopenedCards[0][@"collapsed"]boolValue]&&[(NSButton*)reopenedCards[0][@"enabled"]state]==NSControlStateValueOff);
|
||||
DYInspectorToken *uiToken=uiHost->_custom[@(DYInspectorParameterID)];error=nil;NSData *foldArchive=[NSKeyedArchiver archivedDataWithRootObject:uiToken requiringSecureCoding:YES error:&error];DYInspectorToken *foldDecoded=[NSKeyedUnarchiver unarchivedObjectOfClass:DYInspectorToken.class fromData:foldArchive error:&error];
|
||||
run.record(@"secure-disclosure-archive-roundtrip",[foldDecoded isEqual:uiToken],@{@"error":reason(error)});
|
||||
DYInspectorToken *old=[[[DYInspectorToken alloc]init]autorelease];old.schema=1;uiHost->_custom[@(DYInspectorParameterID)]=old;DYReadUniforms(uiHost,kCMTimeZero,&uiAfter);
|
||||
run.record(@"legacy-inspector-retains-input-and-blackwhite-behavior",uiAfter.cm.configured==-1&&uiAfter.cm.blackWhiteMix==1);
|
||||
DayuRenderParams cp=DYCMRender(defaults.cm);run.record(@"working-space-shared-by-primary-and-output",cp.input.outputTransfer==cp.output.inputTransfer&&cp.input.outputGamut==cp.output.inputGamut&&cp.basis.colorspace==10);
|
||||
DYCMSettings converted=defaults.cm;converted.exposure=1.25;converted.contrast=.4;converted.balanceStrength=.3;converted.midtones=.6;converted.shadows=-.4;converted.black=.2;converted.shadowContrast=.3;converted.hiContrast=-.2;DayuRenderParams mapped=DYCMRender(converted);
|
||||
run.record(@"basis-raw-controls-use-reference-conversion",fabs(mapped.basis.exposure-exp2f(1.25))<1e-6&&fabs(mapped.basis.contrast-exp2f(.4))<1e-6&&fabs(mapped.basis.balanceStrength-.36)<1e-6&&fabs(mapped.basis.midtones-.1998)<1e-5&&fabs(mapped.basis.shadows+.6)<1e-6&&fabs(mapped.basis.trimLow-.9)<1e-6&&fabs(mapped.basis.shadowContrast+.39)<1e-6&&fabs(mapped.basis.hiContrast+.4)<1e-6);
|
||||
converted.workingTransfer=30;mapped=DYCMRender(converted);run.record(@"unsupported-basis-curve-adapts-through-intermediate",(mapped.reserved&8)&&mapped.basis.colorspace==10&&mapped.basisInput.inputTransfer==30&&mapped.basisOutput.outputTransfer==30);
|
||||
[inspector resetAll:nil];[inspector refresh];
|
||||
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==12&&[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];};
|
||||
[wheel setFrameSize:NSMakeSize(310,232)];NSPoint wheelCenter=NSMakePoint(155,126);int starts=uiHost->_undoStarts,ends=uiHost->_undoEnds;
|
||||
[wheel mouseDown:mouseFor(wheel,NSEventTypeLeftMouseDown,wheelCenter)];[wheel mouseDragged:mouseFor(wheel,NSEventTypeLeftMouseDragged,NSMakePoint(wheelCenter.x+25,wheelCenter.y+10))];[wheel mouseUp:mouseFor(wheel,NSEventTypeLeftMouseUp,NSMakePoint(wheelCenter.x+50,wheelCenter.y+20))];DYReadUniforms(uiHost,kCMTimeZero,&uiAfter);
|
||||
float expectedStrength=hypotf(10,4)/90.f,expectedAngle=fmodf(atan2f(4,10)*180/M_PI+360-104,360);
|
||||
run.record(@"balance-wheel-reference-orientation-and-fine-drag",fabs(uiAfter.cm.balanceStrength-expectedStrength)<1e-5&&fabs(uiAfter.cm.balanceAngle-expectedAngle)<1e-4&&uiAfter.cm.balanceAngle>1,@{@"angleDegrees":@(uiAfter.cm.balanceAngle),@"strength":@(uiAfter.cm.balanceStrength)});
|
||||
run.record(@"balance-drag-one-host-undo-group",uiHost->_undoStarts==starts+1&&uiHost->_undoEnds==ends+1&&!uiHost->_undoActive);
|
||||
NSButton *balanceReset=[wheel valueForKey:@"reset"];run.need(@"balance-visible-reset-button",[balanceReset.title isEqual:@"复位"]&&[balanceReset.accessibilityLabel isEqual:@"复位一级白平衡"]);
|
||||
DYUniforms beforeReset=uiAfter;starts=uiHost->_undoStarts;ends=uiHost->_undoEnds;[balanceReset performClick:nil];DYReadUniforms(uiHost,kCMTimeZero,&uiAfter);
|
||||
DYUniforms resetExpected=beforeReset;resetExpected.cm.balanceAngle=0;resetExpected.cm.balanceStrength=0;
|
||||
run.record(@"balance-button-resets-only-wheel-one-undo",memcmp(&resetExpected,&uiAfter,sizeof(uiAfter))==0&&uiHost->_undoStarts==starts+1&&uiHost->_undoEnds==ends+1);
|
||||
[wheel mouseDown:mouseFor(wheel,NSEventTypeLeftMouseDown,wheelCenter,0,2)];DYReadUniforms(uiHost,kCMTimeZero,&uiAfter);run.record(@"balance-double-click-neutral",uiAfter.cm.balanceStrength==0&&uiAfter.cm.balanceAngle==0);
|
||||
NSView *spiderPanel=[inspector valueForKey:@"spiderPanel"];NSView<DYSpiderProbe> *disc=(id)[spiderPanel valueForKey:@"disc"];[disc setFrameSize:NSMakeSize(310,300)];auto initialMesh=DYSpiderMesh(disc.meshData);
|
||||
run.record(@"spider-default-six-by-six-31-nodes",initialMesh.hues==6&&initialMesh.rings==5&&dy::meshCount(initialMesh)==31);
|
||||
auto selectNode=[&](int index,NSEventModifierFlags flags){NSPoint pt=[disc point:index];[disc mouseDown:mouseFor(disc,NSEventTypeLeftMouseDown,pt,flags)];[disc mouseUp:mouseFor(disc,NSEventTypeLeftMouseUp,pt,flags)];};
|
||||
auto dragNode=[&](int index,float dx,float dy){NSPoint pt=[disc point:index];[disc mouseDown:mouseFor(disc,NSEventTypeLeftMouseDown,pt)];[disc mouseDragged:mouseFor(disc,NSEventTypeLeftMouseDragged,NSMakePoint(pt.x+dx*.5,pt.y+dy*.5))];[disc mouseDragged:mouseFor(disc,NSEventTypeLeftMouseDragged,NSMakePoint(pt.x+dx,pt.y+dy))];[disc mouseUp:mouseFor(disc,NSEventTypeLeftMouseUp,NSMakePoint(pt.x+dx,pt.y+dy))];};
|
||||
starts=uiHost->_undoStarts;ends=uiHost->_undoEnds;dragNode(2,18,8);DYAssetState *spiderSaved=DYReadAssets(uiHost,kCMTimeZero);auto dragged=DYSpiderMesh(spiderSaved.spiderMesh);
|
||||
run.record(@"spider-single-drag-spoke-following-and-pin",dragged.x[0]>initialMesh.x[0]&&dragged.x[1]>initialMesh.x[1]&&dragged.x[3]>initialMesh.x[3]&&dragged.x[4]==initialMesh.x[4]&&dragged.x[5]==initialMesh.x[5]&&dragged.pins[2]);
|
||||
run.record(@"spider-drag-one-host-undo-group",uiHost->_undoStarts==starts+1&&uiHost->_undoEnds==ends+1&&!uiHost->_undoActive);
|
||||
error=nil;NSData *spiderArchive=[NSKeyedArchiver archivedDataWithRootObject:spiderSaved requiringSecureCoding:YES error:&error];DYAssetState *decodedSpider=[NSKeyedUnarchiver unarchivedObjectOfClass:DYAssetState.class fromData:spiderArchive error:&error];run.record(@"spider-archive-retains-mesh-pins-and-lut-paths",decodedSpider&&[decodedSpider isEqual:spiderSaved],@{@"error":reason(error)});
|
||||
NSDictionary *snapshot=[inspector performSelector:@selector(presetSnapshot)];NSData *presetJSON=[NSJSONSerialization dataWithJSONObject:snapshot options:0 error:&error];NSDictionary *decodedPreset=[NSJSONSerialization JSONObjectWithData:presetJSON options:0 error:&error];run.record(@"complete-version-four-preset-includes-mesh",[decodedPreset[@"version"]isEqual:@4]&&[DYSpiderFromJSON(decodedPreset[@"spider"])isEqual:spiderSaved.spiderMesh]);
|
||||
NSDictionary *portable=DYSpiderJSON(spiderSaved.spiderMesh,spiderSaved.spiderLinked);NSData *decodedPortable=DYSpiderFromJSON(portable);run.record(@"spider-json-preset-exact-roundtrip",[decodedPortable isEqual:spiderSaved.spiderMesh]);
|
||||
NSMutableDictionary *badJSON=[[portable mutableCopy]autorelease];badJSON[@"hues"]=@7;run.record(@"spider-json-rejects-unsupported-topology",!DYSpiderFromJSON(badJSON));auto corrupt=dragged;corrupt.x[0]=NAN;run.record(@"spider-archive-rejects-nonfinite-coordinates",!DYSpiderMeshIsValid([NSData dataWithBytes:&corrupt length:sizeof(corrupt)]));
|
||||
[disc changeHueCount:12 saturationCount:8];spiderSaved=DYReadAssets(uiHost,kCMTimeZero);auto dense=DYSpiderMesh(spiderSaved.spiderMesh);run.record(@"spider-independent-resolution-and-resample",dense.hues==12&&dense.rings==7&&fabs(dy::meshDelta(dense,0,.6).x)>0);
|
||||
[disc resetMesh];auto resetDense=DYSpiderMesh(DYReadAssets(uiHost,kCMTimeZero).spiderMesh);run.record(@"spider-reset-preserves-density",resetDense.hues==12&&resetDense.rings==7&&dy::meshSamples(resetDense)[4]==0);
|
||||
[disc changeHueCount:6 saturationCount:6];selectNode(1,0);selectNode(2,NSEventModifierFlagCommand);run.record(@"spider-command-multiselect",disc.selection.count==2);[disc selectRing];run.record(@"spider-ring-selection",disc.selection.count==12);[disc.selection removeAllIndexes];selectNode(0,0);[disc selectSpoke];run.record(@"spider-spoke-selection",disc.selection.count==5);
|
||||
selectNode(3,NSEventModifierFlagShift);run.record(@"spider-shift-pin",[disc.pinned containsIndex:3]);float pinnedX=DYSpiderMesh(disc.meshData).x[3];dragNode(3,8,0);run.record(@"spider-pinned-anchor-still-draggable",DYSpiderMesh(disc.meshData).x[3]>pinnedX);
|
||||
NSPoint resetPoint=[disc point:3];[disc rightMouseDown:mouseFor(disc,NSEventTypeRightMouseDown,resetPoint)];run.record(@"spider-right-click-reset-unpins",!DYSpiderMesh(disc.meshData).pins[3]);
|
||||
[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;
|
||||
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;}
|
||||
[[source metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:input.data() bytesPerRow:width*8];
|
||||
// Color-tool parity fixtures deliberately use a display-space identity
|
||||
// input; the user's new Sony camera default is checked independently above.
|
||||
defaults.cm.inputTransfer=1002;defaults.cm.inputGamut=22;
|
||||
DYRenderer *renderer=[[[DYRenderer alloc]init]autorelease];Pixels neutral=render(run,renderer,source,destination,gpu,defaults,@{},@"renderer-default-pass");Difference neutralDifference=difference(input,neutral);
|
||||
run.record(@"transparent-premultiplied-neutral",neutralDifference.nonfinite==0&&neutralDifference.maximum<=.001,measure(neutralDifference));
|
||||
NSString *cstReference=NSProcessInfo.processInfo.environment[@"DY_DIAGNOSTIC_CST_REFERENCE"];
|
||||
if(cstReference.length){
|
||||
error=nil;id<MTLLibrary>oracle=[gpu newLibraryWithURL:[NSURL fileURLWithPath:cstReference] error:&error];run.need(@"independent-installed-cst-reference-loaded",oracle!=nil,@{@"path":cstReference,@"error":reason(error)});
|
||||
const int cases[][3]={{28,27,10},{2,23,10},{4,4,10},{5,5,10},{6,6,10},{8,7,10},{9,7,10},{11,10,10},{12,28,10},{15,23,10},{16,17,10},{21,23,10},{22,21,10},{25,24,10},{27,25,10},{30,23,10},{29,23,10},{28,27,1},{28,27,20},{28,27,30},{28,27,1002}};
|
||||
for(unsigned index=0;index<sizeof(cases)/sizeof(cases[0]);index++){@autoreleasepool{
|
||||
DYUniforms candidate=defaults;candidate.cm.configured=1;candidate.cm.inputTransfer=cases[index][0];candidate.cm.inputGamut=cases[index][1];candidate.cm.workingTransfer=cases[index][2];candidate.cm.toneMapping=1;candidate.cm.exposure=.35;candidate.cm.contrast=.15;candidate.cm.saturation=1.1;candidate.cm.balanceAngle=(index%4)*90+.12;candidate.cm.balanceStrength=.03;
|
||||
DayuRenderParams p=DYCMRender(candidate.cm);Pixels expected=referenceFrame(gpu,oracle,input,width,height,p,&error);Pixels actual=render(run,renderer,source,destination,gpu,candidate,@{},[NSString stringWithFormat:@"cst-case-%02u-render",index]);
|
||||
BOOL same=expected.size()==actual.size();double worst=0;float refValue=0,gotValue=0;NSUInteger nonfinite=0;for(NSUInteger i=0;i<expected.size()&&same;i++){float a=expected[i],b=actual[i];if(!std::isfinite(a)||!std::isfinite(b)){nonfinite++;same=NO;break;}double delta=fabs(a-b);worst=fmax(worst,delta);same&=delta<=.004+.003*fabs(a);if(!same){refValue=a;gotValue=b;}}
|
||||
run.record([NSString stringWithFormat:@"cst-case-%02u-independent-pixels",index],same,@{@"inputCurve":@(p.input.inputTransfer),@"inputGamut":@(p.input.inputGamut),@"workingCurve":@(p.input.outputTransfer),@"maximumError":@(worst),@"referenceValue":@(refValue),@"actualValue":@(gotValue),@"nonfinite":@(nonfinite),@"components":@(actual.size())});
|
||||
}}[oracle release];
|
||||
}
|
||||
DYUniforms monochrome=defaults;monochrome.cm.blackWhiteMix=1;Pixels mono=render(run,renderer,source,destination,gpu,monochrome,@{},@"blackwhite-full-render");
|
||||
Difference monoDiff=difference(neutral,mono);run.record(@"blackwhite-mix-100-affects-frame",monoDiff.different>100&&monoDiff.nonfinite==0,measure(monoDiff));
|
||||
monochrome.cm.blackWhiteMix=.5;Pixels halfMono=render(run,renderer,source,destination,gpu,monochrome,@{},@"blackwhite-half-render");BOOL smooth=YES;for(NSUInteger i=0;i<mono.size();i++)smooth&=fabs((float)halfMono[i]-.5f*((float)mono[i]+(float)neutral[i]))<.001;
|
||||
run.record(@"blackwhite-half-mix-is-continuous",smooth);
|
||||
monochrome.blackWhiteSectionEnabled=0;Pixels monoOff=render(run,renderer,source,destination,gpu,monochrome,@{},@"blackwhite-eye-off-render");run.record(@"blackwhite-eye-bypasses-retained-mix",difference(neutral,monoOff).maximum==0);
|
||||
for(int hues:{6,12,24})for(int saturation:{6,8,24}){@autoreleasepool{
|
||||
auto mesh=dy::neutralMesh(hues,saturation);std::bitset<dy::SpiderMeshCapacity>selected;selected[2]=1;mesh=dy::moveMesh(mesh,selected,-.035f,.04f);NSData *data=[NSData dataWithBytes:&mesh length:sizeof(mesh)];DYUniforms warped=defaults;
|
||||
error=nil;BOOL ok=[renderer renderSource:source destination:destination uniforms:warped paths:@{} spider:data error:&error];Pixels frame=read(destination,gpu);auto samples=dy::meshSamples(mesh);BOOL parity=ok;double maximum=0;NSUInteger affected=0;
|
||||
for(NSUInteger i=0;i<width*height;i++){float alpha=input[i*4+3];float3 rgb={0,0,0};if(alpha>0)for(int c=0;c<3;c++)rgb[c]=(__fp16)((float)input[i*4+c]/alpha);float3 expected=dyLimit(dyVariableSpider(rgb,hues,saturation-1,samples.data()));for(int c=0;c<3;c++){float value=alpha>0?(__fp16)((float)(__fp16)expected[c]*alpha):0;double delta=fabs(value-(float)frame[i*4+c]);maximum=fmax(maximum,delta);parity&=std::isfinite(frame[i*4+c])&&delta<.003;affected+=fabs((float)frame[i*4+c]-(float)neutral[i*4+c])>.001;}}
|
||||
run.record([NSString stringWithFormat:@"spider-production-cpu-parity-%d-%d",hues,saturation],parity&&affected>0,@{@"maximumError":@(maximum),@"affectedComponents":@(affected),@"error":reason(error)});
|
||||
warped.spiderSectionEnabled=0;[renderer renderSource:source destination:destination uniforms:warped paths:@{} spider:data error:&error];run.record([NSString stringWithFormat:@"spider-eye-retains-but-bypasses-%d-%d",hues,saturation],difference(neutral,read(destination,gpu)).maximum==0);
|
||||
}}
|
||||
DYUniforms masterProbe=defaults;masterProbe.cm.configured=1;masterProbe.cm.exposure=.7;Pixels masterOn=render(run,renderer,source,destination,gpu,masterProbe,@{},@"primary-master-active-render");masterProbe.primarySectionEnabled=0;Pixels masterOff=render(run,renderer,source,destination,gpu,masterProbe,@{},@"primary-master-inactive-render");run.record(@"primary-master-controls-complete-cst-pipeline",difference(neutral,masterOn).different>100&&difference(neutral,masterOff).maximum==0);
|
||||
auto checkFoldedGroup=[&](DYUniforms active,NSUInteger offset,NSDictionary *paths,NSString *name){
|
||||
*(float *)((uint8_t *)&active+offset)=0;
|
||||
Pixels folded=render(run,renderer,source,destination,gpu,active,paths,[name stringByAppendingString:@"-render"]);
|
||||
@@ -188,16 +322,31 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
|
||||
[orientationRenderer invalidatePreview];run.record(@"preview-invalidation-clears-analysis-and-browser",![orientationRenderer preview]&&![orientationRenderer lookLUTPreview]);
|
||||
[source setDiagnosticImageOrigin:kFxImageOrigin_TOP_LEFT];
|
||||
[[source metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:input.data() bytesPerRow:width*8];
|
||||
DYUniforms cstExport=defaults;cstExport.cm.configured=1;cstExport.cm.exposure=.7f;
|
||||
NSURL *cstCube=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"cst-export.cube"]];error=nil;BOOL cstExported=[renderer exportLUT:cstCube uniforms:cstExport paths:@{} error:&error];
|
||||
NSString *cubeText=cstExported?[NSString stringWithContentsOfURL:cstCube encoding:NSUTF8StringEncoding error:&error]:nil;std::vector<float>cubeValues;
|
||||
for(NSString *line in [cubeText componentsSeparatedByCharactersInSet:NSCharacterSet.newlineCharacterSet]){float r,g,b;if(sscanf(line.UTF8String,"%f %f %f",&r,&g,&b)==3){cubeValues.push_back(r);cubeValues.push_back(g);cubeValues.push_back(b);}}
|
||||
Pixels gray(input.size());float grayLinear=powf((.5f+.055f)/1.055f,2.4f);for(NSUInteger i=0;i<width*height;i++){for(int c=0;c<3;c++)gray[i*4+c]=grayLinear;gray[i*4+3]=1;}
|
||||
[[source metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:gray.data() bytesPerRow:width*8];Pixels grayRendered=render(run,renderer,source,destination,gpu,cstExport,@{},@"cst-export-production-sample");
|
||||
BOOL cstCubeMatches=cstExported&&cubeValues.size()==33*33*33*3;for(int c=0;c<3&&cstCubeMatches;c++){float code=cubeValues[((16*33+16)*33+16)*3+c];float linear=code<=.04045f?code/12.92f:powf((code+.055f)/1.055f,2.4f);cstCubeMatches&=fabs(linear-(float)grayRendered[c])<.002&&fabs(code-.5f)>.01;}
|
||||
run.record(@"cube-export-includes-cst-primary-and-matches-production",cstCubeMatches,@{@"error":reason(error),@"triples":@(cubeValues.size()/3)});
|
||||
[[source metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:input.data() bytesPerRow:width*8];
|
||||
auto exportMesh=dy::neutralMesh();for(int i=0;i<dy::meshCount(exportMesh);i++){exportMesh.x[i]+=.02f;exportMesh.y[i]-=.01f;}NSData *exportMeshData=[NSData dataWithBytes:&exportMesh length:sizeof(exportMesh)];
|
||||
NSURL *meshCube=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"spider-export.cube"]];BOOL meshExported=[renderer exportLUT:meshCube uniforms:defaults paths:@{} spider:exportMeshData error:&error];NSString *meshText=meshExported?[NSString stringWithContentsOfURL:meshCube encoding:NSUTF8StringEncoding error:&error]:nil;std::vector<float>meshValues;
|
||||
for(NSString *line in [meshText componentsSeparatedByCharactersInSet:NSCharacterSet.newlineCharacterSet]){float r,g,b;if(sscanf(line.UTF8String,"%f %f %f",&r,&g,&b)==3){meshValues.push_back(r);meshValues.push_back(g);meshValues.push_back(b);}}
|
||||
auto meshSamples=dy::meshSamples(exportMesh);float3 exportInput={0,0,0};float codes[3]={.5f,.25f,.75f};for(int c=0;c<3;c++)exportInput[c]=(__fp16)powf((codes[c]+.055f)/1.055f,2.4f);float3 exportExpected=dyLimit(dyVariableSpider(exportInput,6,5,meshSamples.data()));BOOL meshCubeMatches=meshValues.size()==33*33*33*3;
|
||||
for(int c=0;c<3&&meshCubeMatches;c++){float code=meshValues[((24*33+8)*33+16)*3+c],linear=code<=.04045f?code/12.92f:powf((code+.055f)/1.055f,2.4f);meshCubeMatches&=fabs(linear-exportExpected[c])<.002;}
|
||||
run.record(@"cube-export-includes-spider-warp",meshCubeMatches,@{@"triples":@(meshValues.size()/3),@"error":reason(error)});
|
||||
DYUniforms u=defaults;u.exposure=.8f;Pixels exposed=render(run,renderer,source,destination,gpu,u,@{},@"renderer-exposure-pass");Difference exposureDifference=difference(neutral,exposed);run.record(@"exposure-affects-actual-frame",exposureDifference.nonfinite==0&&exposureDifference.different>100,measure(exposureDifference));
|
||||
u.baseSectionEnabled=0;Pixels bypass=render(run,renderer,source,destination,gpu,u,@{},@"renderer-base-bypass-pass");Difference bypassDifference=difference(neutral,bypass);run.record(@"base-group-bypass",bypassDifference.nonfinite==0&&bypassDifference.maximum==0,measure(bypassDifference));
|
||||
u=defaults;u.temperature=35;u.tint=-20;Pixels wb=render(run,renderer,source,destination,gpu,u,@{},@"renderer-white-balance-pass");Difference wbDifference=difference(neutral,wb);run.record(@"white-balance-real-table-frame",wbDifference.nonfinite==0&&wbDifference.different>100,measure(wbDifference));
|
||||
u.colorSectionEnabled=0;bypass=render(run,renderer,source,destination,gpu,u,@{},@"renderer-color-bypass-pass");bypassDifference=difference(neutral,bypass);run.record(@"color-group-bypass",bypassDifference.nonfinite==0&&bypassDifference.maximum==0,measure(bypassDifference));
|
||||
u=defaults;u.hslSectionEnabled=1;u.hslHueA.x=28;u.hslSatA.y=45;u.hslLumB.z=-18;Pixels hsl=render(run,renderer,source,destination,gpu,u,@{},@"renderer-hsl-pass");Difference hslDifference=difference(neutral,hsl);run.record(@"hsl-real-table-frame",hslDifference.nonfinite==0&&hslDifference.different>100,measure(hslDifference));
|
||||
checkFoldedGroup(u,offsetof(DYUniforms,hslSectionEnabled),@{},@"folded-hsl-bypasses-retained-adjustments");
|
||||
checkFoldedGroup(u,offsetof(DYUniforms,hslSectionEnabled),@{},@"disabled-hsl-bypasses-retained-adjustments");
|
||||
u=defaults;u.colorGradingSectionEnabled=1;u.colorGradingHueSatA.x=210;u.colorGradingHueSatA.y=42;u.colorGradingLuma.x=18;Pixels grading=render(run,renderer,source,destination,gpu,u,@{},@"renderer-grading-pass");Difference gradingDifference=difference(neutral,grading);run.record(@"grading-real-table-frame",gradingDifference.nonfinite==0&&gradingDifference.different>100,measure(gradingDifference));
|
||||
checkFoldedGroup(u,offsetof(DYUniforms,colorGradingSectionEnabled),@{},@"folded-grading-bypasses-retained-adjustments");
|
||||
checkFoldedGroup(u,offsetof(DYUniforms,colorGradingSectionEnabled),@{},@"disabled-grading-bypasses-retained-adjustments");
|
||||
for(int profile=1;profile<=17;profile++){@autoreleasepool{u=defaults;u.inputSectionEnabled=1;u.inputProfile=profile;Pixels transformed=render(run,renderer,source,destination,gpu,u,@{},[NSString stringWithFormat:@"input-profile-%02d-load-render",profile]);Difference delta=difference(neutral,transformed);run.record([NSString stringWithFormat:@"input-profile-%02d-finite-nonzero",profile],delta.nonfinite==0&&delta.nonzero>100,measure(delta));}}
|
||||
checkFoldedGroup(u,offsetof(DYUniforms,inputSectionEnabled),@{},@"folded-input-bypasses-retained-profile");
|
||||
checkFoldedGroup(u,offsetof(DYUniforms,inputSectionEnabled),@{},@"disabled-input-bypasses-retained-profile");
|
||||
DYRenderer *analysisRenderer=[[[DYRenderer alloc]init]autorelease];u=defaults;u.inputSectionEnabled=1;u.inputProfile=1;render(run,analysisRenderer,source,destination,gpu,u,@{},@"renderer-input-analysis-pass");
|
||||
NSData *inputPreview=[analysisRenderer preview];bool analysisDifferent=inputPreview.length==preview.length&&preview.length==320*180*16;double analysisMaximum=0;size_t analysisChanges=0;
|
||||
if(analysisDifferent){const float *a=(const float *)preview.bytes,*b=(const float *)inputPreview.bytes;for(NSUInteger i=0;i<preview.length/4;i++){if(!std::isfinite(a[i])||!std::isfinite(b[i])){analysisDifferent=false;break;}if(i%4!=3){double delta=std::fabs(double(a[i])-b[i]);analysisMaximum=std::max(analysisMaximum,delta);if(delta>1e-5)analysisChanges++;}}}
|
||||
@@ -205,7 +354,7 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
|
||||
NSString *lookFile=[runtime stringByAppendingPathComponent:@"diagnostic-look.cube"];NSMutableString *cube=[NSMutableString stringWithString:@"TITLE \"Self test look\"\nLUT_3D_SIZE 2\nDOMAIN_MIN 0 0 0\nDOMAIN_MAX 1 1 1\n"];
|
||||
for(int b=0;b<2;b++)for(int g=0;g<2;g++)for(int r=0;r<2;r++)[cube appendFormat:@"%.8f %.8f %.8f\n",.7f*r+.1f,.8f*g+.05f,.85f*b+.02f];error=nil;run.need(@"temporary-look-file",[cube writeToFile:lookFile atomically:YES encoding:NSUTF8StringEncoding error:&error],@{@"error":reason(error)});
|
||||
NSDictionary *paths=@{@"look0":lookFile,@"look1":lookFile,@"look2":lookFile,@"look3":lookFile,@"look4":lookFile};u=defaults;u.lookSectionEnabled=1;u.postLUTStrength=.35f;u.extraPostLUTStrengths=(DYFloat4){.4f,.5f,.6f,.7f};Pixels looks=render(run,renderer,source,destination,gpu,u,paths,@"renderer-five-look-pass");Difference looksDifference=difference(neutral,looks);run.record(@"five-look-mixes-affect-frame",looksDifference.nonfinite==0&&looksDifference.different>100,measure(looksDifference));
|
||||
checkFoldedGroup(u,offsetof(DYUniforms,lookSectionEnabled),paths,@"folded-look-bypasses-retained-LUTs");
|
||||
checkFoldedGroup(u,offsetof(DYUniforms,lookSectionEnabled),paths,@"disabled-look-bypasses-retained-LUTs");
|
||||
NSURL *exportURL=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"diagnostic-export.cube"]];error=nil;run.need(@"renderer-export-33cube",[renderer exportLUT:exportURL uniforms:u paths:paths error:&error],@{@"error":reason(error),@"path":exportURL.path});
|
||||
NSString *exported=[NSString stringWithContentsOfURL:exportURL encoding:NSUTF8StringEncoding error:&error];NSUInteger triples=0,nonzero=0;bool exportFinite=true;for(NSString *line in [exported componentsSeparatedByCharactersInSet:NSCharacterSet.newlineCharacterSet]){float r,g,b;if(sscanf(line.UTF8String,"%f %f %f",&r,&g,&b)==3){triples++;exportFinite&=std::isfinite(r)&&std::isfinite(g)&&std::isfinite(b);if(r!=0||g!=0||b!=0)nonzero++;}}
|
||||
run.record(@"export-33cube-data-contract",[exported containsString:@"LUT_3D_SIZE 33"]&&triples==33*33*33&&exportFinite&&nonzero>0,@{@"rows":@(triples),@"nonzeroRows":@(nonzero),@"bytes":@([[[NSFileManager defaultManager]attributesOfItemAtPath:exportURL.path error:nil][NSFileSize]unsignedLongLongValue])});
|
||||
@@ -221,9 +370,10 @@ extern "C" int DYRunDiagnostics(void) { @autoreleasepool {
|
||||
[externalRenderer prepareLUTPath:external completion:^(NSError *failure){preparationError=[failure retain];prepared=YES;}];
|
||||
double deadline=NSProcessInfo.processInfo.systemUptime+30;
|
||||
while(!prepared&&NSProcessInfo.processInfo.systemUptime<deadline)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.01]];
|
||||
double activationEnd=NSProcessInfo.processInfo.systemUptime;maxGap=std::max(maxGap,activationEnd-last);
|
||||
[heartbeat invalidate];
|
||||
run.need(@"external-decode-and-gpu-upload-complete",prepared&&!preparationError,@{@"error":reason(preparationError)});[preparationError release];
|
||||
run.record(@"external-activation-main-loop-responsive",beats>0&&maxGap<.15,@{@"heartbeats":@(beats),@"maximumGapMS":@(maxGap*1000)});
|
||||
run.record(@"external-activation-main-loop-responsive",maxGap<.15,@{@"heartbeats":@(beats),@"maximumGapMS":@(maxGap*1000)});
|
||||
DYUniforms externalUniforms=defaults;externalUniforms.lookSectionEnabled=1;externalUniforms.postLUTStrength=1;
|
||||
NSDictionary *externalPaths=@{@"look0":external};
|
||||
Pixels externalFrame=render(run,externalRenderer,source,destination,gpu,externalUniforms,externalPaths,@"external-first-frame-after-preparation");
|
||||
@@ -267,6 +417,12 @@ 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 "DYToolInsertionDiagnostics.inc.h"
|
||||
#include "DYToolTrackingDiagnostics.inc.h"
|
||||
#include "DYToolCanvasDiagnostics.inc.h"
|
||||
#include "DYToolPenDiagnostics.inc.h"
|
||||
#include "DYMaskPanelDiagnostics.inc.h"
|
||||
[gpu release];
|
||||
} @catch(NSException *exception) {
|
||||
run.record(@"diagnostic-exception",false,@{@"exception":exception.name?:@"unknown",@"message":exception.reason?:@"unknown"});
|
||||
|
||||
+214
-1
@@ -1,5 +1,7 @@
|
||||
#include <metal_stdlib>
|
||||
#include "DYUniforms.h"
|
||||
#include "DYToolGPU.h"
|
||||
#include "SpiderCore/DYColorMath.h"
|
||||
using namespace metal;
|
||||
|
||||
// The linked, versioned AIR helper owns color arithmetic only. Its source is in
|
||||
@@ -10,6 +12,18 @@ extern "C" half4 dy_grade(half4 sample, float2 uv, texture2d<half> source,
|
||||
texture3d<float> hslMixer, texture3d<float> whiteBalance,
|
||||
texture3d<float> colorGrading, constant DYUniforms& uniforms,
|
||||
constant float& sceneLevel);
|
||||
extern "C" half4 dy_gradeMasked(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);
|
||||
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);
|
||||
|
||||
struct DYRaster {
|
||||
float4 position [[position]];
|
||||
@@ -38,12 +52,178 @@ fragment half4 dyFragment(DYRaster in [[stage_in]],
|
||||
texture3d<float> colorGrading [[texture(9)]],
|
||||
constant DYUniforms& uniforms [[buffer(0)]],
|
||||
constant float& sceneLevel [[buffer(1)]],
|
||||
constant DYRenderOptions& options [[buffer(2)]]) {
|
||||
constant DYRenderOptions& options [[buffer(2)]],
|
||||
constant DYUniforms& colorUniforms [[buffer(3)]],
|
||||
device const float* spiderSamples [[buffer(4)]],
|
||||
constant int2& spiderSize [[buffer(5)]]) {
|
||||
constexpr sampler sampleFilter(coord::normalized, address::clamp_to_edge, filter::linear);
|
||||
half4 sample = source.sample(sampleFilter, in.uv);
|
||||
if (!(sample.a > half(0.0))) return half4(0.0h);
|
||||
half4 result = dy_grade(sample, in.uv, source, preLUT, look1, look2, look3,
|
||||
look4, look5, hslMixer, whiteBalance, colorGrading, uniforms, sceneLevel);
|
||||
if(options.blackWhiteMix>0.0f && options.blackWhiteMix<1.0f) {
|
||||
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){
|
||||
float3 color=float3(result.rgb);float3 warped=dyVariableSpider(color,spiderSize.x,spiderSize.y,spiderSamples);
|
||||
result.rgb=half3(dyLimit(mix(color,warped,uniforms.spiderMix)));
|
||||
}
|
||||
result.a = sample.a;
|
||||
if (options.outputPremultiplied) result.rgb *= result.a;
|
||||
return result;
|
||||
}
|
||||
|
||||
inline float dyToolMaskSoftStep(float low,float high,float value){if(high<=low)return value>=high?1:0;return dySmooth(low,high,value);}
|
||||
inline float dyToolMaskRangeWeight(float value,thread const DYMaskRange& range){
|
||||
float low=value>=range.low?1:dyToolMaskSoftStep(range.low-range.softLow,range.low,value);
|
||||
float high=value<=range.high?1:1-dyToolMaskSoftStep(range.high,range.high+range.softHigh,value);
|
||||
return low*high;
|
||||
}
|
||||
inline float dyToolMaskLeveledCoverage(float raw,thread const DYMaskParameters& p){
|
||||
float a=dyClamp((raw-p.inputBlack)/(p.inputWhite-p.inputBlack),0,1);
|
||||
if(p.inputGamma!=1&&a>0&&a<1)a=pow(a,1/p.inputGamma);
|
||||
return p.outputBlack+(p.outputWhite-p.outputBlack)*a;
|
||||
}
|
||||
inline float dyToolMaskFinalCoverage(float a,thread const DYMaskParameters& p){
|
||||
if(p.flags&DYMaskInvert)a=1-a;
|
||||
return dyClamp(a*p.strength,0,1);
|
||||
}
|
||||
inline float dyToolMaskLevels(float raw,thread const DYMaskParameters& p){return dyToolMaskFinalCoverage(dyToolMaskLeveledCoverage(raw,p),p);}
|
||||
inline float dyToolMaskHSLWeight(float3 source,thread const DYMaskParameters& p){
|
||||
float3 c=dyLimit(source);float lo=c.x<c.y?(c.x<c.z?c.x:c.z):(c.y<c.z?c.y:c.z),hi=c.x>c.y?(c.x>c.z?c.x:c.z):(c.y>c.z?c.y:c.z);
|
||||
// Same signed/HDR interval convention as the quick HSL tools. This is code
|
||||
// RGB selection; use LumaKey levels when absolute HDR brightness is needed.
|
||||
float base=lo<0?lo:0,scale=hi-base;if(scale<1)scale=1;
|
||||
float3 hsl=dyRGBHSL((c-float3{base,base,base})/scale);float weight=1;
|
||||
if(p.flags&DYMaskHueEnabled){
|
||||
float distance=dyHueDistance(hsl.x,p.hueCenterTurns),outer=p.hueCoreHalfWidth+p.hueSoftWidth;if(outer>.5f)outer=.5f;
|
||||
float hue=p.hueCoreHalfWidth>=.5f||distance<=p.hueCoreHalfWidth?1:1-dyToolMaskSoftStep(p.hueCoreHalfWidth,outer,distance);
|
||||
float chroma=(hi-lo)/scale;weight*=hue*dyToolMaskSoftStep(p.neutralChromaLow,p.neutralChromaHigh,chroma);
|
||||
}
|
||||
if(p.flags&DYMaskSaturationEnabled)weight*=dyToolMaskRangeWeight(hsl.y,p.saturationRange);
|
||||
if(p.flags&DYMaskLightnessEnabled)weight*=dyToolMaskRangeWeight(hsl.z,p.lightnessRange);
|
||||
return weight;
|
||||
}
|
||||
inline float dyToolMaskShapeWeight(float x,float y,thread const DYMaskParameters& p,thread const DYMaskPath& path){
|
||||
float dx=(x-p.centerX)*p.imageAspect,dy=y-p.centerY,ca=cos(p.angle),sa=sin(p.angle);
|
||||
float px=dx*ca+dy*sa,py=-dx*sa+dy*ca;
|
||||
if(p.kind==DYMaskLinearGradient){
|
||||
if(p.gradientWidth==0)return px>=0?1:0;
|
||||
return dyToolMaskSoftStep(0,1,.5f+px/(p.gradientWidth>1e-12f?p.gradientWidth:1e-12f));
|
||||
}
|
||||
float physicalWidth=p.width*p.imageAspect,physicalHeight=p.height;if(physicalWidth<1e-12f)physicalWidth=1e-12f;if(physicalHeight<1e-12f)physicalHeight=1e-12f;
|
||||
if(p.kind==DYMaskEllipse){float u=px/(physicalWidth*.5f),v=py/(physicalHeight*.5f),r=sqrt(u*u+v*v);if(p.feather==0)return r<=1?1:0;if(p.version==2&&(p.flags&DYMaskFeatherOutsideFlag))return 1-dyToolMaskSoftStep(1,1+p.feather,r);return 1-dyToolMaskSoftStep(1-p.feather,1,r);}
|
||||
float shorter=physicalWidth<physicalHeight?physicalWidth:physicalHeight;
|
||||
if(p.kind==DYMaskRectangle){float ax=px<0?-px:px,ay=py<0?-py:py,a=physicalWidth*.5f-ax,b=physicalHeight*.5f-ay;if(p.version==2&&(p.flags&DYMaskFeatherOutsideFlag)){if(p.feather==0)return a>=0&&b>=0?1:0;return dyToolMaskSoftStep(-p.feather*.5f*shorter,0,a<b?a:b);}if(a<0||b<0)return 0;if(p.feather==0)return 1;return dyToolMaskSoftStep(0,p.feather*.5f,(a<b?a:b)/shorter);}
|
||||
if(path.count<3||path.count>256)return 0;
|
||||
float u=px/physicalWidth,v=py/physicalHeight,sx=physicalWidth/shorter,sy=physicalHeight/shorter,distance2=1e10f;bool inside=false;
|
||||
for(int i=0,j=path.count-1;i<path.count;j=i++){
|
||||
float ax=path.x[j],ay=path.y[j],bx=path.x[i],by=path.y[i];if((ay>v)!=(by>v))if(u<(bx-ax)*(v-ay)/(by-ay)+ax)inside=!inside;
|
||||
float ex=(bx-ax)*sx,ey=(by-ay)*sy,xx=(u-ax)*sx,yy=(v-ay)*sy,den=ex*ex+ey*ey,t=den>1e-12f?dyClamp((xx*ex+yy*ey)/den,0,1):0;
|
||||
xx-=t*ex;yy-=t*ey;float d=xx*xx+yy*yy;if(d<distance2)distance2=d;
|
||||
}
|
||||
if(!inside)return 0;if(p.feather==0)return 1;return dyToolMaskSoftStep(0,p.feather*.5f,sqrt(distance2));
|
||||
}
|
||||
inline float dyToolMaskRawCoverage(float x,float y,float3 source,thread const DYMaskParameters& p,thread const DYMaskPath& path){return p.kind==DYMaskHSLKey?dyToolMaskHSLWeight(source,p):(p.kind==DYMaskLumaKey?dyLuma(dyLimit(source)):dyToolMaskShapeWeight(x,y,p,path));}
|
||||
inline float dyToolMaskOperator(float x,float y,float3 source,thread const DYMaskParameters& p,thread const DYMaskPath& path){
|
||||
if((p.version!=1&&p.version!=2)||p.kind>DYMaskLumaKey)return 0;
|
||||
float raw=dyToolMaskRawCoverage(x,y,source,p,path);
|
||||
return dyToolMaskLevels(raw,p);
|
||||
}
|
||||
|
||||
inline float dyToolMask(float x,float y,float3 source,device const DYResolvedMask& value){DYResolvedMask local=value;return dyToolMaskOperator(x,y,source,local.parameters,local.path);}
|
||||
|
||||
|
||||
inline float3 dyToolEncode(float3 linear){return select(1.055f*pow(max(linear,float3(0)),float3(1.f/2.4f))-.055f,linear*12.92f,linear<=.0031308f);}
|
||||
inline float3 dyToolDecode(float3 encoded){return select(pow(max((encoded+.055f)/1.055f,float3(0)),float3(2.4f)),encoded/12.92f,encoded<=.04045f);}
|
||||
inline float dyToolCoverage(float2 uv,float3 source,device const DYToolMaskEntry* masks,constant DYToolMaskHeader& h,int section){
|
||||
float x=h.offsetX+uv.x*h.scaleX,y=h.offsetY+uv.y*h.scaleY;float coverage=1;bool found=false;
|
||||
for(uint i=0;i<h.count;i++){if(masks[i].section!=section)continue;
|
||||
// Copy device data to thread storage; shared mask math accepts constant
|
||||
// descriptors, so evaluate through the address-space-neutral copy below.
|
||||
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);
|
||||
}
|
||||
|
||||
fragment half4 dyMaskedFragment(DYRaster in [[stage_in]],
|
||||
texture2d<half> source [[texture(0)]],
|
||||
texture3d<float> preLUT [[texture(1)]],
|
||||
texture3d<float> look1 [[texture(2)]],
|
||||
texture3d<float> look2 [[texture(3)]],
|
||||
texture3d<float> look3 [[texture(4)]],
|
||||
texture3d<float> look4 [[texture(5)]],
|
||||
texture3d<float> look5 [[texture(6)]],
|
||||
texture3d<float> hslMixer [[texture(7)]],
|
||||
texture3d<float> whiteBalance [[texture(8)]],
|
||||
texture3d<float> colorGrading [[texture(9)]],
|
||||
constant DYUniforms& uniforms [[buffer(0)]],
|
||||
constant float& sceneLevel [[buffer(1)]],
|
||||
constant DYRenderOptions& options [[buffer(2)]],
|
||||
constant DYUniforms& colorUniforms [[buffer(3)]],
|
||||
device const float* spiderSamples [[buffer(4)]],
|
||||
constant int2& spiderSize [[buffer(5)]],
|
||||
device const DYToolMaskEntry* masks [[buffer(6)]],
|
||||
constant DYToolMaskHeader& maskHeader [[buffer(7)]]) {
|
||||
constexpr sampler sampleFilter(coord::normalized, address::clamp_to_edge, filter::linear);
|
||||
half4 sample = source.sample(sampleFilter, in.uv);
|
||||
if (!(sample.a > half(0.0))) return half4(0.0h);
|
||||
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]);
|
||||
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]);
|
||||
result.rgb=mix(color.rgb,result.rgb,half(options.blackWhiteMix));
|
||||
}
|
||||
if(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])));
|
||||
}
|
||||
result.a = sample.a;
|
||||
if (options.outputPremultiplied) result.rgb *= result.a;
|
||||
return result;
|
||||
}
|
||||
|
||||
fragment half4 dySegmentFragment(DYRaster in [[stage_in]],
|
||||
texture2d<half> source [[texture(0)]],
|
||||
texture3d<float> preLUT [[texture(1)]],
|
||||
texture3d<float> look1 [[texture(2)]],
|
||||
texture3d<float> look2 [[texture(3)]],
|
||||
texture3d<float> look3 [[texture(4)]],
|
||||
texture3d<float> look4 [[texture(5)]],
|
||||
texture3d<float> look5 [[texture(6)]],
|
||||
texture3d<float> hslMixer [[texture(7)]],
|
||||
texture3d<float> whiteBalance [[texture(8)]],
|
||||
texture3d<float> colorGrading [[texture(9)]],
|
||||
constant DYUniforms& uniforms [[buffer(0)]],
|
||||
constant float& sceneLevel [[buffer(1)]],
|
||||
constant DYRenderOptions& options [[buffer(2)]],
|
||||
constant DYUniforms& colorUniforms [[buffer(3)]],
|
||||
device const float* spiderSamples [[buffer(4)]],
|
||||
constant int2& spiderSize [[buffer(5)]],
|
||||
device const DYToolMaskEntry* masks [[buffer(6)]],
|
||||
constant DYToolMaskHeader& maskHeader [[buffer(7)]],
|
||||
constant DYToolStageRange& stages [[buffer(8)]],
|
||||
texture2d<half> skinReference [[texture(10)]],
|
||||
texture2d<half> nativeSource [[texture(11)]]) {
|
||||
constexpr sampler sampleFilter(coord::normalized, address::clamp_to_edge, filter::linear);
|
||||
half4 sample = source.sample(sampleFilter, in.uv);
|
||||
if (!(sample.a > half(0.0))) return half4(0.0h);
|
||||
half4 originalSample=nativeSource.sample(sampleFilter,in.uv);
|
||||
float weights[12];float3 encoded=dyToolEncode(float3(originalSample.rgb));
|
||||
for(int i=0;i<12;i++)weights[i]=dyToolCoverage(in.uv,encoded,masks,maskHeader,i);
|
||||
if(stages.suppressBlackWhite)weights[10]=0;
|
||||
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);
|
||||
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);
|
||||
result.rgb=mix(color.rgb,result.rgb,half(options.blackWhiteMix));
|
||||
}
|
||||
result.a = sample.a;
|
||||
if (options.outputPremultiplied) result.rgb *= result.a;
|
||||
return result;
|
||||
@@ -110,3 +290,36 @@ kernel void dyInputAnalysis(texture2d<half> source [[texture(0)]],
|
||||
encoded=round(clamp(encoded,0.0f,1.0f)*255.0f)/255.0f;
|
||||
outRGBA[pixel.y*320+pixel.x]=float4(encoded,float(sample.a));
|
||||
}
|
||||
|
||||
// CST/BASIS arithmetic is reused verbatim from the versioned dayu-cst source.
|
||||
float4 cst_air(half4 sample, constant CSTParams& params);
|
||||
float4 basis_air(half4 sample, constant BasisParams& params);
|
||||
inline float3 dyEncode(float3 linear) {
|
||||
return select(1.055f*pow(max(linear,float3(0)),float3(1.0f/2.4f))-.055f,linear*12.92f,linear<=.0031308f);
|
||||
}
|
||||
inline float3 dyDecode(float3 encoded) {
|
||||
return select(pow(max((encoded+.055f)/1.055f,float3(0)),float3(2.4f)),encoded/12.92f,encoded<=.04045f);
|
||||
}
|
||||
kernel void dyColorManagement(texture2d<float,access::read> source [[texture(0)]],
|
||||
texture2d<half,access::write> destination [[texture(1)]],
|
||||
constant DayuRenderParams& p [[buffer(0)]],constant float& amount [[buffer(1)]],uint2 pos [[thread_position_in_grid]]) {
|
||||
if(pos.x>=source.get_width()||pos.y>=source.get_height())return;
|
||||
float4 sample=source.read(pos);if(!(sample.a>0)){destination.write(half4(0),pos);return;}
|
||||
float4 raw=float4(dyEncode(sample.rgb),sample.a),c=raw;
|
||||
if(p.stages&1)c=cst_air(half4(c),p.input);
|
||||
if(p.stages&2){if(p.reserved&8)c=cst_air(half4(c),p.basisInput);c=basis_air(half4(c),p.basis);if(p.reserved&8)c=cst_air(half4(c),p.basisOutput);}
|
||||
if(p.stages&4)c=cst_air(half4(c),p.output);
|
||||
c.rgb=mix(raw.rgb,c.rgb,amount);
|
||||
destination.write(half4(half3(dyDecode(c.rgb)),half(sample.a)),pos);
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
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);}
|
||||
+170
-65
@@ -1,9 +1,13 @@
|
||||
#import "DYInspector.h"
|
||||
#import "DYModel.h"
|
||||
#import "DYToolState.h"
|
||||
#import "DYAutoGrade.h"
|
||||
#import "DYColorTables.h"
|
||||
#import "DYTheme.h"
|
||||
#import "DYLUTLibrary.h"
|
||||
#import "DYLUTBrowser.h"
|
||||
#import "DYRenderer.h"
|
||||
#include "DYSpiderState.h"
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
@@ -82,6 +86,7 @@ static NSArray *DYAccessibleSubviews(NSView *view, BOOL visibleOnly) {
|
||||
if(visibleOnly&&!NSIntersectsRect(child.frame,visible))continue;
|
||||
[children addObject:child];
|
||||
}
|
||||
[children sortUsingComparator:^NSComparisonResult(NSView *a,NSView *b){if(NSMinY(a.frame)!=NSMinY(b.frame))return NSMinY(a.frame)<NSMinY(b.frame)?NSOrderedAscending:NSOrderedDescending;if(NSMinX(a.frame)!=NSMinX(b.frame))return NSMinX(a.frame)<NSMinX(b.frame)?NSOrderedAscending:NSOrderedDescending;return NSOrderedSame;}];
|
||||
return NSAccessibilityUnignoredChildren(children);
|
||||
}
|
||||
|
||||
@@ -120,6 +125,7 @@ static NSArray *DYAccessibleSubviews(NSView *view, BOOL visibleOnly) {
|
||||
- (NSArray *)accessibilityVisibleChildren { return self.accessibilityChildren; }
|
||||
- (NSArray *)accessibilityChildrenInNavigationOrder { return self.accessibilityChildren; }
|
||||
- (id)accessibilityVerticalScrollBar { return self.hasVerticalScroller?self.verticalScroller:nil; }
|
||||
- (void)scrollWheel:(NSEvent*)event{if(!self.hasVerticalScroller){[self.nextResponder scrollWheel:event];return;}[super scrollWheel:event];}
|
||||
@end
|
||||
|
||||
@interface DYCard : DYFlippedView @end
|
||||
@@ -167,16 +173,25 @@ static NSArray *DYPresentationSections(void) {
|
||||
NSMutableDictionary *bySection=[NSMutableDictionary dictionary],*byKey=[NSMutableDictionary dictionary];
|
||||
for(NSDictionary *s in DYSections())bySection[s[@"key"]]=s;
|
||||
for(NSDictionary *d in DYDescriptors())byKey[d[@"key"]]=d;
|
||||
NSMutableDictionary *input=[[bySection[@"input"] mutableCopy]autorelease];input[@"rows"]=@[byKey[@"preLUTStrength"]];
|
||||
NSMutableDictionary *primary=[[bySection[@"primary"]mutableCopy]autorelease];NSMutableArray *cmRows=[NSMutableArray array];
|
||||
for(NSString *part in @[@"input",@"primary",@"output"]){
|
||||
[cmRows addObject:@{@"key":[@"heading:" stringByAppendingString:part],@"title":[part isEqual:@"input"]?@"输入与工作空间":[part isEqual:@"output"]?@"输出转换":@"一级调色"}];
|
||||
for(NSDictionary *d in bySection[part][@"rows"]){NSString *key=d[@"key"];if([key hasPrefix:@"cmbypass"]||[key isEqual:@"cmbalanceStrength"])continue;
|
||||
if([key isEqual:@"cmbalanceAngle"])[cmRows addObject:@{@"key":@"primaryBalance",@"kind":@"balanceWheel",@"title":@"一级白平衡色轮"}];else[cmRows addObject:d];}
|
||||
}
|
||||
primary[@"rows"]=cmRows;primary[@"enabled"]=byKey[@"primaryMasterEnabled"][@"pid"];primary[@"enableParameters"]=@[bySection[@"input"][@"enabled"],bySection[@"primary"][@"enabled"],bySection[@"output"][@"enabled"]];
|
||||
NSMutableDictionary *base=[[bySection[@"base"] mutableCopy]autorelease];NSMutableArray *rows=[NSMutableArray array];
|
||||
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"];
|
||||
return @[input,base,bySection[@"skin"],bySection[@"look"],bySection[@"hsl"],bySection[@"curve"],bySection[@"grading"],bySection[@"primaries"],bySection[@"levels"],bySection[@"blackwhite"],bySection[@"balance"]];
|
||||
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"]];
|
||||
}
|
||||
|
||||
|
||||
@protocol DYGraphicDelegate <NSObject>
|
||||
- (void)writeGraphicValues:(NSDictionary *)values;
|
||||
- (void)writeSpiderMesh:(NSData *)mesh linked:(BOOL)linked;
|
||||
- (void)graphicGesture:(BOOL)begin title:(NSString *)title;
|
||||
@end
|
||||
|
||||
/// The graph uses the same sorted monotone Hermite tangent limiter as the GPU.
|
||||
@@ -367,6 +382,9 @@ static NSImage *DYWheelImage(void) {
|
||||
- (void)layout {[super layout];CGFloat w=self.bounds.size.width/2,h=self.bounds.size.height/2;for(NSInteger i=0;i<4;i++)[_wheels[i] setFrame:NSMakeRect((i%2)*w,(i/2)*h,w,h)];}
|
||||
@end
|
||||
|
||||
#include "DYNewPanels.inc.h"
|
||||
#include "DYMaskPanel.inc.h"
|
||||
|
||||
@interface DYInspector () <DYGraphicDelegate> {
|
||||
id<PROAPIAccessing> _manager;
|
||||
NSScrollView *_scroll;
|
||||
@@ -386,7 +404,9 @@ static NSImage *DYWheelImage(void) {
|
||||
NSArray *_themeButtons;
|
||||
NSMutableDictionary *_tabs;
|
||||
NSInteger _visibleLooks;
|
||||
BOOL _refreshing;
|
||||
BOOL _refreshing,_graphicUndoOpen;
|
||||
BOOL _embedded;NSMutableDictionary *_stackViews;NSArray *_stackOrder;NSDictionary *_stackRoots;CGFloat _stackHeight;
|
||||
DYSpiderPanel *_spiderPanel;
|
||||
NSMutableDictionary *_assetLoads,*_assetLoadIDs;
|
||||
NSUInteger _nextAssetLoadID;
|
||||
NSProgress *_menuScan;
|
||||
@@ -397,13 +417,16 @@ static NSImage *DYWheelImage(void) {
|
||||
@end
|
||||
|
||||
@implementation DYInspector
|
||||
#include "DYToolInspector.inc.h"
|
||||
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager {
|
||||
return [self initWithAPIManager:manager renderer:nil];
|
||||
}
|
||||
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager renderer:(DYRenderer *)renderer {
|
||||
if((self=[super initWithFrame:NSMakeRect(0,0,360,780)])) {
|
||||
_assetLoads=[NSMutableDictionary new];_assetLoadIDs=[NSMutableDictionary new];_manager=manager; _renderer=[renderer retain];_library=[DYLUTLibrary new];_tabs=[NSMutableDictionary new];_visibleLooks=1;
|
||||
_sections=[DYPresentationSections() copy];
|
||||
_embedded=[manager isKindOfClass:DYToolManager.class];if(_embedded)[(id)_manager retain];
|
||||
NSArray *presentation=DYPresentationSections();if(_embedded){NSMutableArray *filtered=[NSMutableArray array];for(NSDictionary *s in presentation)if([s[@"key"]isEqual:[(DYToolManager*)manager type]])[filtered addObject:s];presentation=filtered;}
|
||||
_sections=[presentation copy];_stackViews=[NSMutableDictionary new];_stackOrder=[@[]copy];
|
||||
_cards=[[NSMutableArray alloc] init]; _controls=[[NSMutableDictionary alloc] init];
|
||||
_assetButtons=[[NSMutableDictionary alloc] init]; _graphics=[[NSMutableArray alloc] init];
|
||||
self.autoresizingMask=NSViewWidthSizable;
|
||||
@@ -417,13 +440,13 @@ static NSImage *DYWheelImage(void) {
|
||||
_save=[DYButton(@"保存预设",self,@selector(savePreset:)) retain];
|
||||
_load=[DYButton(@"载入预设",self,@selector(loadPreset:)) retain];
|
||||
_export=[DYButton(@"导出 LUT",self,@selector(exportLUT:)) retain];
|
||||
for(NSView *v in @[_brand,_subtitle,_resetAll,_save,_load,_export]) [self addSubview:v];
|
||||
for(NSView *v in @[_brand,_subtitle,_resetAll,_save,_load,_export]){[self addSubview:v];v.hidden=_embedded;}
|
||||
NSMutableArray *themes=[NSMutableArray array];for(NSInteger i=0;i<5;i++){
|
||||
DYSwatchButton *b=[[[DYSwatchButton alloc]initWithFrame:NSZeroRect]autorelease];[b setButtonType:NSButtonTypePushOnPushOff];b.swatch=DYThemeSwatch(i);b.tag=i;b.target=self;b.action=@selector(selectTheme:);b.title=@"";b.bordered=NO;
|
||||
b.toolTip=[DYThemeNames()[i] stringByAppendingString:@"主题"];b.accessibilityLabel=b.toolTip;[self addSubview:b];[themes addObject:b];
|
||||
b.toolTip=[DYThemeNames()[i] stringByAppendingString:@"主题"];b.accessibilityLabel=b.toolTip;[self addSubview:b];b.hidden=_embedded;[themes addObject:b];
|
||||
}_themeButtons=[themes copy];
|
||||
_scroll=[[DYInspectorScrollView alloc] initWithFrame:NSZeroRect];
|
||||
_scroll.hasVerticalScroller=YES; _scroll.hasHorizontalScroller=NO; _scroll.drawsBackground=NO;
|
||||
_scroll.hasVerticalScroller=!_embedded; _scroll.hasHorizontalScroller=NO; _scroll.drawsBackground=NO;
|
||||
_scroll.autohidesScrollers=YES; _scroll.borderType=NSNoBorder;
|
||||
_scroll.clipsToBounds=YES;_scroll.wantsLayer=YES;_scroll.layer.masksToBounds=YES;
|
||||
_scroll.contentView.clipsToBounds=YES;
|
||||
@@ -443,8 +466,11 @@ static NSImage *DYWheelImage(void) {
|
||||
return self;
|
||||
}
|
||||
- (void)dealloc {
|
||||
[self graphicGesture:NO title:nil];_spiderPanel.delegate=nil;
|
||||
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];
|
||||
if(_embedded)[(id)_manager release];[_stackViews release];[_stackOrder release];[_stackRoots release];
|
||||
[_brand release]; [_subtitle release]; [_resetAll release]; [_save release]; [_load release]; [_export release];
|
||||
[_scroll release]; [_document release]; [_sections release]; [_cards release]; [_controls release]; [_assetButtons release]; [_graphics release]; [_sampler release];
|
||||
[_browser close];[_browser release];[_renderer release];[_library release];[_themeButtons release];[_tabs release];
|
||||
@@ -459,14 +485,14 @@ static NSImage *DYWheelImage(void) {
|
||||
- (NSSize)intrinsicContentSize { return NSMakeSize(360,780); }
|
||||
- (void)viewDidMoveToWindow {
|
||||
[super viewDidMoveToWindow];
|
||||
if(!self.window)[self cancelAssetLoads];
|
||||
if(!self.window){[self graphicGesture:NO title:nil];[self cancelAssetLoads];}
|
||||
if(self.window) {
|
||||
[self refresh];
|
||||
NSAccessibilityPostNotification(self,NSAccessibilityLayoutChangedNotification);
|
||||
}
|
||||
}
|
||||
- (void)modelChanged:(NSNotification *)n {
|
||||
if([NSThread isMainThread]) [self refresh];
|
||||
if([NSThread isMainThread]) {[self refresh];NSString *ID=n.userInfo[@"scrollToTool"];if(!_embedded&&ID.length&&_stackViews[ID]){[self layoutSubtreeIfNeeded];NSView *child=_stackViews[ID];[_document scrollPoint:NSMakePoint(0,MAX(0,child.frame.origin.y-8))];}}
|
||||
else dispatch_async(dispatch_get_main_queue(),^{ [self refresh]; });
|
||||
}
|
||||
- (void)selectTheme:(NSButton *)button {DYSetThemeIndex(button.tag);}
|
||||
@@ -495,7 +521,7 @@ static NSImage *DYWheelImage(void) {
|
||||
[header setButtonType:NSButtonTypePushOnPushOff];
|
||||
header.bordered=NO; header.alignment=NSTextAlignmentLeft; header.font=[NSFont boldSystemFontOfSize:12];
|
||||
header.contentTintColor=DYInk(); header.target=self; header.action=@selector(toggleSection:); header.tag=index;
|
||||
header.doubleClickAction=@selector(resetSection:); header.toolTip=@"展开启用,折叠停用;双击还原本组";
|
||||
header.doubleClickAction=@selector(resetSection:); header.toolTip=@"展开或折叠界面;双击还原本组";
|
||||
[card addSubview:header];
|
||||
NSButton *enabled=DYButton(@"",self,@selector(groupEnabled:));enabled.bordered=NO;[enabled setButtonType:NSButtonTypePushOnPushOff];enabled.image=[NSImage imageWithSystemSymbolName:@"eye" accessibilityDescription:@"启用本组"];
|
||||
enabled.tag=index; enabled.contentTintColor=DYAccent(); enabled.toolTip=@"启用或旁路本组";
|
||||
@@ -507,8 +533,8 @@ static NSImage *DYWheelImage(void) {
|
||||
[card addSubview:reset];
|
||||
NSMutableArray *body=[NSMutableArray array];
|
||||
NSString *key=section[@"key"]?:@"";
|
||||
if([key localizedCaseInsensitiveContainsString:@"input"]) {
|
||||
[body addObject:[self assetRowForKey:@"input" title:@"输入色彩" inCard:card]];
|
||||
if([key isEqual:@"primary"]) {
|
||||
NSButton *migrate=DYButton(@"旧版输入 → 改用 CST",self,@selector(useCST:));migrate.identifier=@"legacyInput";migrate.toolTip=@"保留旧工程输入效果;点击后改用上方 CST 设置,可撤销";[card addSubview:migrate];[body addObject:migrate];
|
||||
}
|
||||
if([key localizedCaseInsensitiveContainsString:@"look"]) {
|
||||
for(NSInteger i=0;i<5;i++) {
|
||||
@@ -539,12 +565,15 @@ static NSImage *DYWheelImage(void) {
|
||||
if([key isEqual:@"grading"]) {
|
||||
DYWheelPanel *wheels=[[[DYWheelPanel alloc]initWithFrame:NSZeroRect]autorelease];wheels.delegate=self;wheels.identifier=@"gradingWheels";[card addSubview:wheels];[body addObject:wheels];[_graphics addObject:wheels];
|
||||
}
|
||||
if([key isEqual:@"spider"]){_spiderPanel=[[[DYSpiderPanel alloc]initWithFrame:NSZeroRect]autorelease];_spiderPanel.delegate=self;_spiderPanel.identifier=@"spiderGraph";[card addSubview:_spiderPanel];[body addObject:_spiderPanel];}
|
||||
for(NSDictionary *d in section[@"rows"]) {
|
||||
DYFlippedView *row=[[[DYFlippedView alloc] initWithFrame:NSZeroRect] autorelease];
|
||||
row.identifier=d[@"key"];
|
||||
row.accessibilityLabel=d[@"title"];
|
||||
[card addSubview:row]; [body addObject:row];
|
||||
NSNumber *pid=d[@"pid"]; if(!pid)continue;
|
||||
NSNumber *pid=d[@"pid"];
|
||||
if([d[@"kind"]isEqual:@"balanceWheel"]){DYPrimaryBalanceWheel *wheel=[[[DYPrimaryBalanceWheel alloc]initWithFrame:NSZeroRect]autorelease];wheel.identifier=@"primaryBalance";wheel.delegate=self;[row addSubview:wheel];[_graphics addObject:wheel];continue;}
|
||||
if(!pid){NSTextField *heading=DYLabel(d[@"title"],11);heading.font=[NSFont boldSystemFontOfSize:11];heading.textColor=DYAccent();[row addSubview:heading];continue;}
|
||||
NSTextField *label=DYLabel(d[@"title"]?:d[@"key"],11); label.toolTip=d[@"title"];
|
||||
[row addSubview:label];
|
||||
NSMutableDictionary *record=[NSMutableDictionary dictionaryWithDictionary:@{@"descriptor":d,@"row":row,@"label":label}];
|
||||
@@ -552,7 +581,7 @@ static NSImage *DYWheelImage(void) {
|
||||
NSButton *eye=DYButton(@"",self,@selector(itemEnabled:));eye.bordered=NO;[eye setButtonType:NSButtonTypePushOnPushOff];eye.image=[NSImage imageWithSystemSymbolName:@"eye" accessibilityDescription:@"启用"];eye.tag=[pid integerValue];eye.contentTintColor=DYAccent();eye.accessibilityLabel=[d[@"title"] stringByAppendingString:@"启用"];eye.toolTip=@"启用或旁路此项";[row addSubview:eye];record[@"itemEnabled"]=eye;
|
||||
}
|
||||
NSString *kind=d[@"kind"]?:@"float";
|
||||
if([kind isEqualToString:@"bool"]) {
|
||||
if([kind isEqualToString:@"bool"]||[d[@"key"]hasPrefix:@"cmbypass"]) {
|
||||
NSButton *toggle=[NSButton checkboxWithTitle:@"" target:self action:@selector(scalarChanged:)];
|
||||
toggle.tag=[pid integerValue]; toggle.contentTintColor=DYAccent(); toggle.accessibilityLabel=d[@"title"];
|
||||
[row addSubview:toggle]; record[@"toggle"]=toggle;
|
||||
@@ -589,8 +618,14 @@ 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":@(![section[@"defaultEnabled"]boolValue])}];
|
||||
NSMutableDictionary *record=[NSMutableDictionary dictionaryWithDictionary:@{@"section":section,@"view":card,@"header":header,@"enabled":enabled,@"reset":reset,@"body":body,@"collapsed":@(![@[@"primary",@"spider",@"base"]containsObject:key])}];
|
||||
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];
|
||||
DYToolMaskPanel *maskPanel=[[[DYToolMaskPanel alloc]initWithManager:host nodeID:nodeID]autorelease];[card addSubview:maskPanel];[body insertObject:maskPanel atIndex:0];record[@"maskPanel"]=maskPanel;
|
||||
NSButton *mask=DYButton(@"",self,@selector(toolMask:));mask.tag=index;mask.bordered=NO;mask.image=[NSImage imageWithSystemSymbolName:@"circle.dashed.inset.filled" accessibilityDescription:@"添加蒙版"];mask.toolTip=@"添加本工具的独立蒙版";mask.accessibilityLabel=[section[@"title"]stringByAppendingString:@"添加蒙版"];[card addSubview:mask];record[@"maskButton"]=mask;
|
||||
NSButton *repeat=DYButton(@"",self,@selector(repeatTool:));repeat.tag=index;repeat.bordered=NO;repeat.image=[NSImage imageWithSystemSymbolName:@"plus.square.on.square" accessibilityDescription:@"再加一层"];repeat.toolTip=@"紧接当前工具插入一层初始化工具";repeat.accessibilityLabel=[section[@"title"]stringByAppendingString:@"再加一层"];[card addSubview:repeat];record[@"repeatButton"]=repeat;
|
||||
if(_embedded){NSButton *remove=DYButton(@"删除此层",self,@selector(removeTool:));remove.identifier=@"removeTool";[card addSubview:remove];[body addObject:remove];}
|
||||
[_cards addObject:record];
|
||||
index++;
|
||||
}
|
||||
@@ -610,7 +645,9 @@ static NSImage *DYWheelImage(void) {
|
||||
return row;
|
||||
}
|
||||
- (BOOL)showRow:(NSView *)row section:(NSString *)section {
|
||||
if([row.identifier isEqual:@"toolMasks"])return [(DYToolMaskPanel*)row contentHeight]>0;
|
||||
NSString *key=row.identifier?:@"";NSInteger tab=[_tabs[section]integerValue];
|
||||
if([key isEqual:@"legacyInput"])return [_tabs[@"legacyInput"]boolValue];
|
||||
if([section isEqual:@"curve"] && ![key isEqual:@"curveGraph"])return NO;
|
||||
if([section isEqual:@"hsl"]) {
|
||||
int axis=0,color=0;if(sscanf(key.UTF8String,"hsl%d_%d",&axis,&color)==2)return color==tab;
|
||||
@@ -622,7 +659,7 @@ static NSImage *DYWheelImage(void) {
|
||||
if([section isEqual:@"look"]){int slot=0;if(sscanf(key.UTF8String,"asset:look%d",&slot)==1)return slot<_visibleLooks;if([key isEqual:@"postLUTStrength"])return YES;int number=0;if(sscanf(key.UTF8String,"look%dStrength",&number)==1)return number-1<_visibleLooks;return NO;}
|
||||
return YES;
|
||||
}
|
||||
- (CGFloat)heightForRow:(NSView *)row {return [row.identifier isEqual:@"curveGraph"]?240:[row.identifier isEqual:@"gradingWheels"]?292:32;}
|
||||
- (CGFloat)heightForRow:(NSView *)row {if([row isKindOfClass:DYToolMaskPanel.class])return [(DYToolMaskPanel*)row contentHeight];if([row.identifier isEqual:@"spiderGraph"])return 444;if([row.identifier isEqual:@"primaryBalance"])return 232;if([row.identifier hasPrefix:@"heading:"])return 27;return [row.identifier isEqual:@"curveGraph"]?240:[row.identifier isEqual:@"gradingWheels"]?292:32;}
|
||||
- (void)layout {
|
||||
[super layout];
|
||||
CGFloat w=MAX(280,self.bounds.size.width),h=self.bounds.size.height;
|
||||
@@ -631,29 +668,34 @@ static NSImage *DYWheelImage(void) {
|
||||
_resetAll.frame=NSMakeRect(w-33,16,23,24);
|
||||
CGFloat gap=7,bw=(w-32-gap*2)/3;
|
||||
_save.frame=NSMakeRect(16,50,bw,27); _load.frame=NSMakeRect(16+bw+gap,50,bw,27); _export.frame=NSMakeRect(16+(bw+gap)*2,50,bw,27);
|
||||
_scroll.frame=NSMakeRect(0,88,w,MAX(80,h-88));
|
||||
_scroll.frame=_embedded?NSMakeRect(0,0,w,h):NSMakeRect(0,88,w,MAX(80,h-88));
|
||||
CGFloat cw=MAX(244,_scroll.contentSize.width-32),y=8;
|
||||
for(NSMutableDictionary *c in _cards) {
|
||||
DYCard *card=c[@"view"];BOOL collapsed=[c[@"collapsed"]boolValue];NSString *key=c[@"section"][@"key"];
|
||||
NSArray *body=c[@"body"];CGFloat contentHeight=0;
|
||||
for(NSView *row in body)if([self showRow:row section:key])contentHeight+=[self heightForRow:row];
|
||||
for(NSView *row in body)if([self showRow:row section:key]&&(!collapsed||[row isKindOfClass:DYToolMaskPanel.class]))contentHeight+=[self heightForRow:row];
|
||||
[c[@"enabled"]setFrame:NSMakeRect(12,12,20,20)];
|
||||
CGFloat titleWidth=MIN(cw-104,MAX(94,[[(NSButton *)c[@"header"]title]sizeWithAttributes:@{NSFontAttributeName:[NSFont boldSystemFontOfSize:12]}].width+36));
|
||||
CGFloat titleWidth=MIN(cw-143,MAX(94,[[(NSButton *)c[@"header"]title]sizeWithAttributes:@{NSFontAttributeName:[NSFont boldSystemFontOfSize:12]}].width+36));
|
||||
[c[@"header"]setFrame:NSMakeRect(42,8,titleWidth,28)];
|
||||
CGFloat headerHeight=43;
|
||||
card.frame=NSMakeRect(16,y,cw,headerHeight+(collapsed?0:contentHeight+8));y+=card.frame.size.height+12;
|
||||
[c[@"reset"]setFrame:NSMakeRect(cw-36,10,24,24)];
|
||||
[c[@"add"]setFrame:NSMakeRect(cw-64,10,24,24)];[c[@"add"]setEnabled:_visibleLooks<5];[c[@"add"]setHidden:collapsed];
|
||||
card.frame=NSMakeRect(16,y,cw,headerHeight+(contentHeight>0?contentHeight+8:0));y+=card.frame.size.height+12;
|
||||
[c[@"reset"]setFrame:NSMakeRect(cw-34,10,24,24)];
|
||||
[c[@"repeatButton"]setFrame:NSMakeRect(cw-62,10,24,24)];[c[@"maskButton"]setFrame:NSMakeRect(cw-90,10,24,24)];
|
||||
[c[@"add"]setFrame:NSMakeRect(cw-33,headerHeight+contentHeight-28,20,24)];[c[@"add"]setEnabled:_visibleLooks<5];[c[@"add"]setHidden:collapsed];
|
||||
CGFloat rowY=headerHeight;
|
||||
for(NSView *row in body) {
|
||||
BOOL show=!collapsed&&[self showRow:row section:key];row.hidden=!show;if(!show)continue;
|
||||
BOOL show=(!collapsed||[row isKindOfClass:DYToolMaskPanel.class])&&[self showRow:row section:key];row.hidden=!show;if(!show)continue;
|
||||
CGFloat rh=[self heightForRow:row];row.frame=NSMakeRect(12,rowY,cw-24,rh-1);rowY+=rh;
|
||||
if([row.identifier isEqual:@"removeTool"]){/* NSButton fills its row. */}
|
||||
if([row.identifier isEqual:@"primaryBalance"])for(NSView *v in row.subviews)v.frame=row.bounds;
|
||||
if([row.identifier hasPrefix:@"heading:"])for(NSView *v in row.subviews)v.frame=NSMakeRect(3,7,row.bounds.size.width-6,18);
|
||||
if([row.identifier isEqual:@"autoControls"]||[row.identifier isEqual:@"sampleControls"]) {
|
||||
CGFloat buttonWidth=(row.bounds.size.width-4*(row.subviews.count-1))/MAX((NSUInteger)1,row.subviews.count);NSInteger i=0;
|
||||
for(NSView *button in row.subviews)[button setFrame:NSMakeRect((buttonWidth+4)*i++,3,buttonWidth,25)];
|
||||
}
|
||||
if([row.identifier isEqual:@"hslTabs"]){CGFloat width=row.bounds.size.width/9;NSInteger i=0;for(NSView *button in row.subviews)[button setFrame:NSMakeRect(i++*width,1,width-1,27)];}
|
||||
}
|
||||
y=[self layoutRepeatedToolsAfter:[@"base:" stringByAppendingString:key] y:y width:w];
|
||||
}
|
||||
for(NSDictionary *record in _controls.allValues) {
|
||||
CGFloat rw=[record[@"row"]bounds].size.width,lw=MIN(103,MAX(77,rw*.34)),eyeWidth=record[@"itemEnabled"]?20:0;
|
||||
@@ -668,7 +710,8 @@ static NSImage *DYWheelImage(void) {
|
||||
[r[@"browse"]setHidden:input];[r[@"eye"]setFrame:NSMakeRect(0,5,18,20)];[r[@"browse"]setFrame:NSMakeRect(r[@"eye"]?20:0,4,20,24)];[r[@"label"]setFrame:NSMakeRect(input?2:r[@"eye"]?43:25,7,input?86:r[@"eye"]?51:69,18)];
|
||||
[r[@"choose"]setFrame:NSMakeRect(97,3,MAX(65,rw-152),26)];[r[@"folder"]setFrame:NSMakeRect(rw-51,4,24,24)];[r[@"remove"]setFrame:NSMakeRect(rw-23,4,22,24)];
|
||||
}
|
||||
[_document setFrameSize:NSMakeSize(_scroll.contentSize.width,MAX(y,_scroll.contentSize.height))];
|
||||
y=[self layoutRepeatedToolsAfter:@"tail" y:y width:w];
|
||||
_stackHeight=y;[_document setFrameSize:NSMakeSize(_scroll.contentSize.width,MAX(y,_scroll.contentSize.height))];
|
||||
}
|
||||
- (id<FxCustomParameterActionAPI_v4>)actionAPI { return [_manager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)]; }
|
||||
- (void)refresh {
|
||||
@@ -689,8 +732,9 @@ static NSImage *DYWheelImage(void) {
|
||||
if(d[@"enabled"]) {double enabled=1;[get getFloatValue:&enabled fromParameter:[d[@"enabled"] unsignedIntValue] atTime:t];[r[@"itemEnabled"] setState:enabled>=.5?NSControlStateValueOn:NSControlStateValueOff];[r[@"itemEnabled"] setImage:[NSImage imageWithSystemSymbolName:enabled>=.5?@"eye":@"eye.slash" accessibilityDescription:enabled>=.5?@"启用":@"旁路"]];for(NSString *control in @[@"slider",@"field",@"popup"]) [r[control] setAlphaValue:enabled>=.5?1:.45];}
|
||||
[r[@"slider"] setDoubleValue:v]; [r[@"field"] setStringValue:DYNumber(v,d)];
|
||||
[r[@"toggle"] setState:v>=.5?NSControlStateValueOn:NSControlStateValueOff];
|
||||
NSPopUpButton *popup=r[@"popup"]; if(popup.numberOfItems>0) [popup selectItemAtIndex:MAX(0,MIN((NSInteger)llround(v),popup.numberOfItems-1))];
|
||||
NSPopUpButton *popup=r[@"popup"]; if(popup.numberOfItems>0){NSArray *values=d[@"values"];NSInteger index=values?[values indexOfObject:@((int)llround(v))]:(NSInteger)llround(v);[popup selectItemAtIndex:index==NSNotFound?0:MAX(0,MIN(index,popup.numberOfItems-1))];}
|
||||
}
|
||||
for(NSDictionary *d in DYDescriptors())if([@[@"cmbalanceAngle",@"cmbalanceStrength"]containsObject:d[@"key"]]){double v=[d[@"default"]doubleValue];[get getFloatValue:&v fromParameter:[d[@"pid"]unsignedIntValue] atTime:t];graphicValues[d[@"key"]]=@(v);}
|
||||
for(id graphic in _graphics)[graphic setValues:graphicValues];
|
||||
for(NSMutableDictionary *c in _cards) {
|
||||
NSNumber *pid=c[@"section"][@"enabled"];
|
||||
@@ -698,19 +742,22 @@ static NSImage *DYWheelImage(void) {
|
||||
NSNumber *extra=c[@"section"][@"extraEnabled"];double extraValue=0;
|
||||
if(extra)[get getFloatValue:&extraValue fromParameter:extra.unsignedIntValue atTime:t];
|
||||
BOOL enabled=v>=.5||extraValue>=.5;
|
||||
BOOL collapsed=!enabled;groupingChanged|=collapsed!=[c[@"collapsed"]boolValue];c[@"collapsed"]=@(collapsed);
|
||||
[c[@"header"]setState:enabled?NSControlStateValueOn:NSControlStateValueOff];
|
||||
[c[@"header"]setToolTip:enabled?@"折叠并停用本组,保留参数值;双击还原本组":@"展开并启用本组,恢复之前的参数值;双击还原本组"];
|
||||
[c[@"header"]setAccessibilityHelp:[c[@"header"]toolTip]];
|
||||
[c[@"header"]setNeedsDisplay:YES];
|
||||
[c[@"enabled"] setState:enabled?NSControlStateValueOn:NSControlStateValueOff];
|
||||
[c[@"enabled"]setImage:[NSImage imageWithSystemSymbolName:enabled?@"eye":@"eye.slash" accessibilityDescription:enabled?@"折叠并停用本组":@"展开并启用本组"]];
|
||||
[c[@"enabled"]setToolTip:enabled?@"折叠并停用本组,保留参数值":@"展开并启用本组,恢复之前的参数值"];
|
||||
[c[@"enabled"]setAccessibilityHelp:[c[@"enabled"]toolTip]];
|
||||
// Visibility and rendering share the host's section enable value.
|
||||
for(NSView *row in c[@"body"])row.alphaValue=1;
|
||||
DYInspectorToken *token=nil;[get getCustomParameterValue:&token fromParameter:DYInspectorParameterID atTime:t];
|
||||
NSNumber *saved=[token isKindOfClass:DYInspectorToken.class]?token.folds[c[@"section"][@"key"]]:nil;
|
||||
BOOL collapsed=saved?saved.boolValue:[c[@"collapsed"]boolValue];groupingChanged|=collapsed!=[c[@"collapsed"]boolValue];c[@"collapsed"]=@(collapsed);
|
||||
[c[@"header"]setState:collapsed?NSControlStateValueOff:NSControlStateValueOn];
|
||||
[c[@"header"]setToolTip:collapsed?@"展开界面,不改变启用状态;双击还原本组":@"折叠界面,保持当前效果;双击还原本组"];
|
||||
[c[@"header"]setAccessibilityHelp:[c[@"header"]toolTip]];[c[@"header"]setNeedsDisplay:YES];
|
||||
[c[@"enabled"]setState:enabled?NSControlStateValueOn:NSControlStateValueOff];
|
||||
[c[@"enabled"]setImage:[NSImage imageWithSystemSymbolName:enabled?@"eye":@"eye.slash" accessibilityDescription:enabled?@"停用本组":@"启用本组"]];
|
||||
[c[@"enabled"]setToolTip:enabled?@"停用本组,保留参数和展开状态":@"启用本组,保留展开状态"];[c[@"enabled"]setAccessibilityHelp:[c[@"enabled"]toolTip]];
|
||||
for(NSView *row in c[@"body"])row.alphaValue=enabled?1:.45;
|
||||
}
|
||||
DYAssetState *assets=DYReadAssets(_manager,t);
|
||||
id<PROAPIAccessing> maskHost=_embedded?[(DYToolManager*)_manager host]:_manager;NSDictionary *tools=DYReadTools(maskHost,t).document;for(NSDictionary *card in _cards)[card[@"maskPanel"]refreshWithDocument:tools time:t];
|
||||
DYAssetState *assets=DYReadAssets(_manager,t);[_spiderPanel setMesh:assets.spiderMesh linked:assets.spiderLinked];
|
||||
double profile=0,configured=0;[get getFloatValue:&profile fromParameter:2013 atTime:t];[get getFloatValue:&configured fromParameter:2236 atTime:t];
|
||||
DYInspectorToken *oldToken=nil;[get getCustomParameterValue:&oldToken fromParameter:DYInspectorParameterID atTime:t];
|
||||
_tabs[@"legacyInput"]=@(configured<.5&&(configured<0||profile>.5||[assets.paths[@"input"]length]||oldToken.schema<2));
|
||||
for(NSString *key in _assetButtons) {
|
||||
NSString *path=assets.paths[key]; NSButton *button=_assetButtons[key][@"choose"];
|
||||
NSString *name=path.length?path.lastPathComponent.stringByDeletingPathExtension:@"无";
|
||||
@@ -724,14 +771,15 @@ static NSImage *DYWheelImage(void) {
|
||||
} @finally { [action endAction:self]; _refreshing=NO; }
|
||||
// Remote layout/accessibility can re-enter the host. Let the parameter
|
||||
// action and current callback unwind before notifying the remote view.
|
||||
if(!_embedded)[self synchronizeTools];
|
||||
if(groupingChanged)dispatch_async(dispatch_get_main_queue(),^{NSAccessibilityPostNotification(self,NSAccessibilityLayoutChangedNotification);});
|
||||
}
|
||||
- (void)postChanged { [[NSNotificationCenter defaultCenter] postNotificationName:@"DYModelChanged" object:_manager]; }
|
||||
- (void)postChanged { [[NSNotificationCenter defaultCenter] postNotificationName:@"DYModelChanged" object:_embedded?[(DYToolManager*)_manager host]:_manager]; }
|
||||
- (void)scalarChanged:(NSControl *)sender {
|
||||
if(_refreshing)return;
|
||||
NSNumber *pid=@(sender.tag); NSDictionary *r=_controls[pid],*d=r[@"descriptor"]; if(!d)return;
|
||||
double v;
|
||||
if([sender isKindOfClass:[NSPopUpButton class]])v=[(NSPopUpButton *)sender indexOfSelectedItem];
|
||||
if([sender isKindOfClass:[NSPopUpButton class]]){NSInteger i=[(NSPopUpButton *)sender indexOfSelectedItem];v=d[@"values"]?[d[@"values"][i]doubleValue]:i;}
|
||||
else if([sender isKindOfClass:[NSButton class]])v=[(NSButton *)sender state]==NSControlStateValueOn?1:0;
|
||||
else {
|
||||
if([sender isKindOfClass:[NSTextField class]]) {
|
||||
@@ -745,7 +793,12 @@ static NSImage *DYWheelImage(void) {
|
||||
v=fmax([d[@"min"] doubleValue],fmin([d[@"max"] doubleValue],v));
|
||||
id<FxCustomParameterActionAPI_v4> action=[self actionAPI];if(!action)return;
|
||||
[action startAction:self];
|
||||
@try { id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)]; [set setFloatValue:v toParameter:pid.unsignedIntValue atTime:action.currentTime]; }
|
||||
@try { id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)]; [set setFloatValue:v toParameter:pid.unsignedIntValue atTime:action.currentTime];if([d[@"key"]hasPrefix:@"cm"]||[d[@"key"]isEqual:@"blackWhiteMix"]){
|
||||
id<FxParameterRetrievalAPI_v6>get=[_manager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];DYInspectorToken *old=nil;[get getCustomParameterValue:&old fromParameter:DYInspectorParameterID atTime:action.currentTime];
|
||||
if([d[@"key"]hasPrefix:@"cm"]){[set setFloatValue:1 toParameter:2236 atTime:action.currentTime];[self clearPrimaryBypasses:set time:action.currentTime];}
|
||||
else if(old.schema<2){double cfg=0;[get getFloatValue:&cfg fromParameter:2236 atTime:action.currentTime];if(cfg<.5)[set setFloatValue:-1 toParameter:2236 atTime:action.currentTime];}
|
||||
if(old.schema<2){DYInspectorToken *token=[[old copy]autorelease];token.schema=2;[set setCustomParameterValue:token toParameter:DYInspectorParameterID atTime:action.currentTime];}
|
||||
} }
|
||||
@finally { [action endAction:self]; }
|
||||
[self postChanged];
|
||||
}
|
||||
@@ -753,7 +806,7 @@ static NSImage *DYWheelImage(void) {
|
||||
NSDictionary *r=_controls[@(sender.tag)],*d=r[@"descriptor"];if(!d)return;
|
||||
id<FxCustomParameterActionAPI_v4> action=[self actionAPI];if(!action)return;
|
||||
[action startAction:self];
|
||||
@try {id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];[set setFloatValue:[d[@"default"] doubleValue] toParameter:(UInt32)sender.tag atTime:action.currentTime];}
|
||||
@try {id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];[set setFloatValue:[d[@"default"] doubleValue] toParameter:(UInt32)sender.tag atTime:action.currentTime];if([d[@"key"]hasPrefix:@"cm"]){[set setFloatValue:1 toParameter:2236 atTime:action.currentTime];[self clearPrimaryBypasses:set time:action.currentTime];}}
|
||||
@finally {[action endAction:self];}
|
||||
[self postChanged];
|
||||
}
|
||||
@@ -771,10 +824,20 @@ static NSImage *DYWheelImage(void) {
|
||||
[action startAction:self];
|
||||
@try {
|
||||
CMTime t=action.currentTime;id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];
|
||||
for(NSString *key in values) {NSDictionary *d=byKey[key];double v=[values[key] doubleValue];if(!d||!std::isfinite(v))continue;v=fmax([d[@"min"]doubleValue],fmin([d[@"max"]doubleValue],v));[set setFloatValue:v toParameter:[d[@"pid"]unsignedIntValue] atTime:t];}
|
||||
BOOL primaryEdit=NO;for(NSString *key in values) {NSDictionary *d=byKey[key];primaryEdit|=[key hasPrefix:@"cm"];double v=[values[key] doubleValue];if(!d||!std::isfinite(v))continue;v=fmax([d[@"min"]doubleValue],fmin([d[@"max"]doubleValue],v));[set setFloatValue:v toParameter:[d[@"pid"]unsignedIntValue] atTime:t];}
|
||||
if(primaryEdit){[set setFloatValue:1 toParameter:2236 atTime:t];[self clearPrimaryBypasses:set time:t];}
|
||||
} @finally {[action endAction:self];}
|
||||
[self postChanged];
|
||||
}
|
||||
- (void)clearPrimaryBypasses:(id<FxParameterSettingAPI_v6>)set time:(CMTime)t{for(NSDictionary *d in DYDescriptors())if([d[@"key"]hasPrefix:@"cmbypass"])[set setFloatValue:0 toParameter:[d[@"pid"]unsignedIntValue] atTime:t];}
|
||||
- (void)graphicGesture:(BOOL)begin title:(NSString *)title{
|
||||
if(begin==_graphicUndoOpen)return;id<FxCustomParameterActionAPI_v4>a=[self actionAPI];if(!a)return;[a startAction:self];
|
||||
@try{id<FxUndoAPI>undo=[_manager apiForProtocol:@protocol(FxUndoAPI)];if(begin)_graphicUndoOpen=[undo startUndoGroup:title?:@"调整颜色"];else{[undo endUndoGroup];_graphicUndoOpen=NO;}}@finally{[a endAction:self];}
|
||||
}
|
||||
- (void)writeSpiderMesh:(NSData *)mesh linked:(BOOL)linked{
|
||||
if(mesh.length&&!DYSpiderMeshIsValid(mesh))return;id<FxCustomParameterActionAPI_v4>a=[self actionAPI];if(!a)return;[a startAction:self];
|
||||
@try{DYAssetState *state=[[DYReadAssets(_manager,a.currentTime)copy]autorelease];state.spiderMesh=mesh;state.spiderLinked=linked;DYWriteAssets(_manager,state,a.currentTime);}@finally{[a endAction:self];}[self postChanged];
|
||||
}
|
||||
- (void)setSectionEnabled:(BOOL)enabled atIndex:(NSInteger)index {
|
||||
if(index<0||index>=_cards.count)return;
|
||||
NSDictionary *section=_cards[index][@"section"];
|
||||
@@ -785,6 +848,8 @@ static NSImage *DYWheelImage(void) {
|
||||
id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];
|
||||
[set setFloatValue:enabled?1:0 toParameter:pid.unsignedIntValue atTime:action.currentTime];
|
||||
NSNumber *extra=section[@"extraEnabled"];if(extra)[set setFloatValue:enabled?1:0 toParameter:extra.unsignedIntValue atTime:action.currentTime];
|
||||
for(NSNumber *linked in section[@"enableParameters"])[set setFloatValue:enabled?1:0 toParameter:linked.unsignedIntValue atTime:action.currentTime];
|
||||
|
||||
}
|
||||
@finally {[action endAction:self];}
|
||||
[self postChanged];
|
||||
@@ -792,9 +857,22 @@ static NSImage *DYWheelImage(void) {
|
||||
- (void)groupEnabled:(NSButton *)sender { [self setSectionEnabled:sender.state==NSControlStateValueOn atIndex:sender.tag]; }
|
||||
- (void)toggleSection:(NSButton *)sender {
|
||||
if(sender.tag<0||sender.tag>=_cards.count)return;
|
||||
[self setSectionEnabled:[_cards[sender.tag][@"collapsed"]boolValue] atIndex:sender.tag];
|
||||
id<FxCustomParameterActionAPI_v4> action=[self actionAPI];if(!action)return;[action startAction:self];
|
||||
@try {
|
||||
id<FxParameterRetrievalAPI_v6> get=[_manager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];
|
||||
DYInspectorToken *old=nil;[get getCustomParameterValue:&old fromParameter:DYInspectorParameterID atTime:action.currentTime];DYInspectorToken *token=[old isKindOfClass:DYInspectorToken.class]?[[old copy]autorelease]:[[[DYInspectorToken alloc]init]autorelease];
|
||||
NSMutableDictionary *folds=[[token.folds mutableCopy]autorelease];
|
||||
for(NSDictionary *card in _cards)folds[card[@"section"][@"key"]]=card[@"collapsed"];
|
||||
NSString *key=_cards[sender.tag][@"section"][@"key"];folds[key]=@(![_cards[sender.tag][@"collapsed"]boolValue]);token.folds=folds;
|
||||
[set setCustomParameterValue:token toParameter:DYInspectorParameterID atTime:action.currentTime];
|
||||
}@finally{[action endAction:self];}[self postChanged];
|
||||
}
|
||||
- (void)useCST:(id)sender {
|
||||
id<FxCustomParameterActionAPI_v4> a=[self actionAPI];if(!a)return;[a startAction:self];
|
||||
@try{id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];[set setFloatValue:1 toParameter:2236 atTime:a.currentTime];[self clearPrimaryBypasses:set time:a.currentTime];} @finally{[a endAction:self];}[self postChanged];
|
||||
}
|
||||
- (void)resetSection:(NSButton *)sender {
|
||||
if(_embedded){[self resetRepeatedTool];return;}
|
||||
[self cancelAssetLoads];
|
||||
if(sender.tag>=_cards.count)return;
|
||||
NSDictionary *section=_cards[sender.tag][@"section"];
|
||||
@@ -802,11 +880,16 @@ static NSImage *DYWheelImage(void) {
|
||||
[action startAction:self];
|
||||
@try {
|
||||
CMTime t=action.currentTime;id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];
|
||||
for(NSDictionary *d in section[@"rows"]) {[set setFloatValue:[d[@"default"] doubleValue] toParameter:[d[@"pid"] unsignedIntValue] atTime:t];if(d[@"enabled"])[set setFloatValue:1 toParameter:[d[@"enabled"] unsignedIntValue] atTime:t];}
|
||||
for(NSDictionary *d in section[@"rows"]) {if(!d[@"pid"])continue;[set setFloatValue:[d[@"default"] doubleValue] toParameter:[d[@"pid"] unsignedIntValue] atTime:t];if(d[@"enabled"])[set setFloatValue:1 toParameter:[d[@"enabled"] unsignedIntValue] atTime:t];}
|
||||
double defaultEnabled=[section[@"defaultEnabled"]doubleValue];
|
||||
NSNumber *enabled=section[@"enabled"];if(enabled)[set setFloatValue:defaultEnabled toParameter:enabled.unsignedIntValue atTime:t];
|
||||
if([@[@"input",@"primary",@"output"]containsObject:section[@"key"]])[set setFloatValue:1 toParameter:2236 atTime:t];
|
||||
if([section[@"key"]isEqual:@"blackwhite"]){DYInspectorToken *old=nil;[[_manager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getCustomParameterValue:&old fromParameter:DYInspectorParameterID atTime:t];if(old.schema<2){DYInspectorToken *current=[[old copy]autorelease];current.schema=2;[set setCustomParameterValue:current toParameter:DYInspectorParameterID atTime:t];[set setFloatValue:-1 toParameter:2236 atTime:t];}}
|
||||
|
||||
NSNumber *extra=section[@"extraEnabled"];if(extra)[set setFloatValue:defaultEnabled toParameter:extra.unsignedIntValue atTime:t];
|
||||
NSString *key=section[@"key"]?:@"";
|
||||
if([key isEqual:@"primary"]){for(NSDictionary *d in DYDescriptors())if([d[@"key"]hasPrefix:@"cm"])[set setFloatValue:[d[@"default"]doubleValue] toParameter:[d[@"pid"]unsignedIntValue] atTime:t];[set setFloatValue:1 toParameter:2236 atTime:t];for(NSNumber *linked in section[@"enableParameters"])[set setFloatValue:1 toParameter:linked.unsignedIntValue atTime:t];[set setFloatValue:0 toParameter:2013 atTime:t];DYAssetState *state=[[DYReadAssets(_manager,t)copy]autorelease];NSMutableDictionary *paths=[[state.paths mutableCopy]autorelease];[paths removeObjectForKey:@"input"];state.paths=paths;DYWriteAssets(_manager,state,t);}
|
||||
if([key isEqual:@"spider"]){DYAssetState *state=[[DYReadAssets(_manager,t)copy]autorelease];auto m=DYSpiderMesh(state.spiderMesh);m=dy::neutralMesh(m.hues,m.rings+1);state.spiderMesh=[NSData dataWithBytes:&m length:sizeof(m)];DYWriteAssets(_manager,state,t);}
|
||||
if([key localizedCaseInsensitiveContainsString:@"input"]||[key localizedCaseInsensitiveContainsString:@"look"]) {
|
||||
DYAssetState *assets=[[DYReadAssets(_manager,t) copy] autorelease];
|
||||
if(!assets)assets=[[[DYAssetState alloc] init] autorelease];
|
||||
@@ -826,7 +909,9 @@ static NSImage *DYWheelImage(void) {
|
||||
@try {
|
||||
CMTime t=action.currentTime;id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];
|
||||
for(NSDictionary *d in DYDescriptors())[set setFloatValue:[d[@"default"] doubleValue] toParameter:[d[@"pid"] unsignedIntValue] atTime:t];
|
||||
DYAssetState *assets=[[[DYAssetState alloc] init] autorelease];assets.paths=@{};DYWriteAssets(_manager,assets,t);
|
||||
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"]]);
|
||||
} @finally {[action endAction:self];}
|
||||
[self postChanged];
|
||||
}
|
||||
@@ -873,14 +958,29 @@ static NSImage *DYWheelImage(void) {
|
||||
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];
|
||||
_browser=[[DYLUTBrowser alloc]initWithLibrary:_library preview:[_renderer lookLUTPreview] selectedPath:selected palette:DYThemePalette() selection:^NSProgress *(NSString *path,void (^completion)(NSError *)){return [owner setAssetPath:path forKey:key completion:completion];}];[selected release];
|
||||
id<FxRemoteWindowAPI> remote=[_manager apiForProtocol:@protocol(FxRemoteWindowAPI_v3)];
|
||||
if(!remote)remote=[_manager apiForProtocol:@protocol(FxRemoteWindowAPI_v2)];if(!remote)remote=[_manager apiForProtocol:@protocol(FxRemoteWindowAPI)];
|
||||
DYLUTBrowser *browser=_browser;id<FxRemoteWindowAPI_v3> closer=[_manager apiForProtocol:@protocol(FxRemoteWindowAPI_v3)];
|
||||
if(remote){[remote remoteWindowOfSize:CGSizeMake(760,560) reply:^(FxXPView *parent,NSError *error){dispatch_async(dispatch_get_main_queue(),^{
|
||||
if(_browser!=browser)return;
|
||||
if(parent){[browser showInRemoteParent:parent close:^{[closer closeRemoteWindow];}];}
|
||||
else [browser showRelativeToView:sender];
|
||||
});}];}else [browser showRelativeToView:sender];
|
||||
// Remote-window APIs must be acquired and invoked inside the custom
|
||||
// parameter action, while the SDK's API permissions are still installed.
|
||||
[a 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)];
|
||||
DYLUTBrowser *browser=_browser;
|
||||
void (^attach)(FxXPView *,NSError *)=^(FxXPView *parent,NSError *error){
|
||||
void (^views)(void)=^{
|
||||
if(owner->_browser!=browser)return;
|
||||
if(parent)[browser showInRemoteParent:parent close:^{
|
||||
id<FxCustomParameterActionAPI_v4> action=[owner actionAPI];if(!action)return;[action startAction:owner];
|
||||
@try{[v3 closeRemoteWindow];}@finally{[action endAction:owner];}
|
||||
}];else [browser showRelativeToView:sender];
|
||||
};
|
||||
// Attach before reply returns: the SDK immediately reads child size.
|
||||
if(NSThread.isMainThread)views();else dispatch_sync(dispatch_get_main_queue(),views);
|
||||
};
|
||||
if(sizable)[sizable remoteWindowWithMinimumSize:DYLUTBrowser.minimumContentSize maximumSize:DYLUTBrowser.maximumContentSize reply:attach];
|
||||
else if(remote)[remote remoteWindowOfSize:DYLUTBrowser.preferredContentSize reply:attach];
|
||||
else [_browser showRelativeToView:sender];
|
||||
}@finally{[a endAction:self];}
|
||||
}
|
||||
- (void)lookEnabled:(NSButton *)sender {NSInteger slot=[[sender.identifier substringFromIndex:4]integerValue];if(slot<1||slot>4)return;[self writeGraphicValues:@{[NSString stringWithFormat:@"look%ldEnabled",(long)slot+1]:@(sender.state==NSControlStateValueOn)}];}
|
||||
- (void)openLibraryFolder:(id)sender {
|
||||
@@ -923,7 +1023,7 @@ static NSImage *DYWheelImage(void) {
|
||||
if(path.length)paths[key]=path;else [paths removeObjectForKey:key];
|
||||
assets.paths=paths;written=DYWriteAssets(_manager,assets,t);
|
||||
} @finally {[action endAction:self];}
|
||||
if(written)[self postChanged];else if(error)*error=[NSError errorWithDomain:@"com.dayu.color" code:1 userInfo:@{NSLocalizedDescriptionKey:@"宿主未接受此 LUT,原来的选择已保留"}];
|
||||
if(written){if(path.length&&[key hasPrefix:@"look"])[_library recordUsedPath:path];[self postChanged];}else if(error)*error=[NSError errorWithDomain:@"com.dayu.color" code:1 userInfo:@{NSLocalizedDescriptionKey:@"宿主未接受此 LUT,原来的选择已保留"}];
|
||||
return written;
|
||||
}
|
||||
- (void)showError:(NSString *)message {
|
||||
@@ -931,14 +1031,15 @@ static NSImage *DYWheelImage(void) {
|
||||
}
|
||||
- (NSDictionary *)presetSnapshot {
|
||||
id<FxCustomParameterActionAPI_v4> action=[self actionAPI];if(!action)return nil;
|
||||
NSMutableDictionary *values=[NSMutableDictionary dictionary];NSDictionary *paths=@{};
|
||||
NSMutableDictionary *values=[NSMutableDictionary dictionary];NSDictionary *paths=@{},*spider=nil;NSString *tools=nil;
|
||||
[action startAction:self];
|
||||
@try {
|
||||
CMTime t=action.currentTime;id<FxParameterRetrievalAPI_v6> get=[_manager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];
|
||||
for(NSDictionary *d in DYDescriptors()) {double v=[d[@"default"] doubleValue];[get getFloatValue:&v fromParameter:[d[@"pid"] unsignedIntValue] atTime:t];if(std::isfinite(v))values[d[@"key"]]=@(v);}
|
||||
paths=[[DYReadAssets(_manager,t).paths copy] autorelease]?:@{};
|
||||
DYUniforms effective;DYReadUniforms(_manager,t,&effective);values[@"cmConfigured"]=@(effective.cm.configured);values[@"blackWhiteMix"]=@(effective.cm.blackWhiteMix);
|
||||
DYAssetState *state=DYReadAssets(_manager,t);paths=[[state.paths copy]autorelease]?:@{};spider=DYSpiderJSON(state.spiderMesh,state.spiderLinked);NSData *toolData=[NSPropertyListSerialization dataWithPropertyList:DYReadTools(_manager,t).document format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil];tools=[toolData base64EncodedStringWithOptions:0];
|
||||
} @finally {[action endAction:self];}
|
||||
return @{@"format":@"com.dayu.color.preset",@"version":@1,@"values":values,@"paths":paths};
|
||||
return @{@"format":@"com.dayu.color.preset",@"version":@4,@"values":values,@"paths":paths,@"spider":spider,@"tools":tools?:@""};
|
||||
}
|
||||
- (void)savePreset:(id)sender {
|
||||
NSDictionary *snapshot=[self presetSnapshot];if(!snapshot)return;
|
||||
@@ -951,13 +1052,14 @@ static NSImage *DYWheelImage(void) {
|
||||
NSOpenPanel *panel=[NSOpenPanel openPanel];panel.allowedFileTypes=@[@"json"];panel.allowsMultipleSelection=NO;panel.canChooseDirectories=NO;
|
||||
if([panel runModal]!=NSModalResponseOK)return;
|
||||
NSError *error=nil;NSData *data=[NSData dataWithContentsOfURL:panel.URL options:0 error:&error];
|
||||
if(!data||data.length>2*1024*1024){[self showError:error.localizedDescription?:@"预设文件过大"];return;}
|
||||
if(!data||data.length>32*1024*1024){[self showError:error.localizedDescription?:@"预设文件过大"];return;}
|
||||
id json=[NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
|
||||
if(![json isKindOfClass:NSDictionary.class]||![json[@"format"] isEqual:@"com.dayu.color.preset"]||![json[@"version"] isEqual:@1]||![json[@"values"] isKindOfClass:NSDictionary.class]||![json[@"paths"] isKindOfClass:NSDictionary.class]){[self showError:@"这不是有效的大鱼调色预设。"];return;}
|
||||
NSDictionary *values=json[@"values"],*paths=json[@"paths"];
|
||||
if(![json isKindOfClass:NSDictionary.class]||![json[@"format"] isEqual:@"com.dayu.color.preset"]||![@[@1,@2,@3,@4]containsObject:json[@"version"]]||![json[@"values"] isKindOfClass:NSDictionary.class]||![json[@"paths"] isKindOfClass:NSDictionary.class]){[self showError:@"这不是有效的大鱼调色预设。"];return;}
|
||||
NSDictionary *values=json[@"values"],*paths=json[@"paths"];NSData *mesh=[json[@"version"]integerValue]>=3?DYSpiderFromJSON(json[@"spider"]):nil;if([json[@"version"]integerValue]>=3&&!mesh){[self showError:@"预设包含无效蜘蛛盘,当前调色未修改。"];return;}
|
||||
NSDictionary *tools=[[[DYToolDocument alloc]init]autorelease].document;if([json[@"version"]integerValue]>=4){id encoded=json[@"tools"];NSData *binary=[encoded isKindOfClass:NSString.class]?[[[NSData alloc]initWithBase64EncodedString:encoded options:0]autorelease]:nil;tools=binary?[NSPropertyListSerialization propertyListWithData:binary options:NSPropertyListImmutable format:NULL error:nil]:nil;if(!DYValidToolDocument(tools)){[self showError:@"预设包含无效工具或蒙版,当前调色未修改。"];return;}}
|
||||
for(NSDictionary *d in DYDescriptors()) {
|
||||
id v=values[d[@"key"]];if(!v)continue;
|
||||
if(![v isKindOfClass:NSNumber.class]||!std::isfinite([v doubleValue])||[v doubleValue]<[d[@"min"] doubleValue]||[v doubleValue]>[d[@"max"] doubleValue]){[self showError:@"预设包含无效参数,尚未修改当前调色。"];return;}
|
||||
if(![v isKindOfClass:NSNumber.class]||!std::isfinite([v doubleValue])||[v doubleValue]<[d[@"min"] doubleValue]||[v doubleValue]>[d[@"max"] doubleValue]||(d[@"values"]&&![d[@"values"]containsObject:v])){[self showError:@"预设包含无效参数,尚未修改当前调色。"];return;}
|
||||
}
|
||||
NSMutableDictionary *validPaths=[NSMutableDictionary dictionary];NSMutableArray *missing=[NSMutableArray array];
|
||||
for(NSString *key in @[@"input",@"look0",@"look1",@"look2",@"look3",@"look4"]) {
|
||||
@@ -965,19 +1067,21 @@ static NSImage *DYWheelImage(void) {
|
||||
if(![path isKindOfClass:NSString.class]||![path isAbsolutePath]||![[path pathExtension].lowercaseString isEqual:@"cube"]){[self showError:@"预设包含无效 LUT 路径,尚未修改当前调色。"];return;}
|
||||
if([[NSFileManager defaultManager] isReadableFileAtPath:path])validPaths[key]=path;else [missing addObject:[path lastPathComponent]];
|
||||
}
|
||||
NSMutableDictionary *restoredTools=DYMutablePlist(tools);for(NSMutableDictionary *node in restoredTools[@"layers"]){NSMutableDictionary *nodePaths=node[@"paths"];for(NSString *key in [[nodePaths.allKeys copy]autorelease])if(![NSFileManager.defaultManager isReadableFileAtPath:nodePaths[key]]){[missing addObject:[nodePaths[key]lastPathComponent]];[nodePaths removeObjectForKey:key];}}tools=restoredTools;
|
||||
[self cancelAssetLoads];
|
||||
id<FxCustomParameterActionAPI_v4> action=[self actionAPI];if(!action)return;
|
||||
[action startAction:self];
|
||||
@try {
|
||||
CMTime t=action.currentTime;id<FxParameterSettingAPI_v6> set=[_manager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];
|
||||
for(NSDictionary *d in DYDescriptors())if(values[d[@"key"]])[set setFloatValue:[values[d[@"key"]] doubleValue] toParameter:[d[@"pid"] unsignedIntValue] atTime:t];
|
||||
DYAssetState *assets=[[[DYAssetState alloc] init] autorelease];assets.paths=validPaths;DYWriteAssets(_manager,assets,t);
|
||||
if([json[@"version"]isEqual:@1]&&!values[@"cmConfigured"]){[set setFloatValue:-1 toParameter:2236 atTime:t];[set setFloatValue:1 toParameter:2270 atTime:t];}
|
||||
DYAssetState *assets=[[[DYAssetState alloc] init] autorelease];assets.paths=validPaths;assets.spiderMesh=mesh;assets.spiderLinked=mesh?[json[@"spider"][@"linked"]boolValue]:YES;DYWriteAssets(_manager,assets,t);DYWriteTools(_manager,tools,t);
|
||||
} @finally {[action endAction:self];}
|
||||
[self postChanged];
|
||||
if(missing.count)[self showError:[@"调色参数已恢复,以下 LUT 文件需要重新选择:\n" stringByAppendingString:[missing componentsJoinedByString:@"\n"]]];
|
||||
}
|
||||
- (void)autoGrade:(id)sender { [[NSNotificationCenter defaultCenter]postNotificationName:@"DYAutoGrade" object:_manager]; }
|
||||
- (void)autoWhiteBalance:(id)sender { [[NSNotificationCenter defaultCenter]postNotificationName:@"DYAutoWhiteBalance" object:_manager]; }
|
||||
- (void)autoGrade:(id)sender { if(_embedded){[self writeGraphicValues:DYAutoGrade([_renderer preview])];return;}[[NSNotificationCenter defaultCenter]postNotificationName:@"DYAutoGrade" object:_manager]; }
|
||||
- (void)autoWhiteBalance:(id)sender { if(_embedded){[self writeGraphicValues:DYAutoWhiteBalance([_renderer preview])];return;}[[NSNotificationCenter defaultCenter]postNotificationName:@"DYAutoWhiteBalance" object:_manager]; }
|
||||
- (void)sampleWhiteBalance:(id)sender { [self sampleColorForWhiteBalance:YES]; }
|
||||
- (void)sampleCustomColor:(id)sender { [self sampleColorForWhiteBalance:NO]; }
|
||||
- (void)sampleColorForWhiteBalance:(BOOL)whiteBalance {
|
||||
@@ -986,7 +1090,8 @@ static NSImage *DYWheelImage(void) {
|
||||
[_sampler showSamplerWithSelectionHandler:^(NSColor *selectedColor) {
|
||||
NSColor *color=[selectedColor colorUsingColorSpace:NSColorSpace.sRGBColorSpace];
|
||||
if(color) {
|
||||
if(whiteBalance)[[NSNotificationCenter defaultCenter]postNotificationName:@"DYWhiteBalanceColor" object:_manager userInfo:@{@"color":color}];
|
||||
if(whiteBalance&&_embedded){float t=0,i=0;if([DYColorTables neutralizeColor:(vector_float3){(float)color.redComponent,(float)color.greenComponent,(float)color.blueComponent} temperature:&t tint:&i])[self writeGraphicValues:@{@"temperature":@(t),@"tint":@(i)}];}
|
||||
else if(whiteBalance)[[NSNotificationCenter defaultCenter]postNotificationName:@"DYWhiteBalanceColor" object:_manager userInfo:@{@"color":color}];
|
||||
else [self writeGraphicValues:@{@"sample0":@(color.redComponent),@"sample1":@(color.greenComponent),@"sample2":@(color.blueComponent)}];
|
||||
}
|
||||
[_sampler release];_sampler=nil;
|
||||
|
||||
@@ -7,6 +7,9 @@ typedef NSProgress * (^DYLUTSelectionHandler)(NSString *path,void (^completion)(
|
||||
/// after decoding, GPU preparation and the host edit have actually succeeded.
|
||||
@interface DYLUTBrowser : NSWindowController
|
||||
@property(nonatomic,readonly) BOOL visible;
|
||||
+ (NSSize)minimumContentSize;
|
||||
+ (NSSize)maximumContentSize;
|
||||
+ (NSSize)preferredContentSize;
|
||||
- (instancetype)initWithLibrary:(DYLUTLibrary *)library
|
||||
preview:(NSData *)rgba
|
||||
selectedPath:(NSString *)path
|
||||
|
||||
+98
-40
@@ -15,6 +15,11 @@ static NSColor *DYBrowserColor(NSDictionary *palette, NSString *key) {
|
||||
|
||||
static NSString *const DYBrowserSizePreference=@"com.dayu.color.lookLUTPreview.thumbnailSize";
|
||||
static NSString *const DYBrowserFolderPreference=@"com.dayu.color.lookLUTPreview.selectedFolder";
|
||||
static NSString *const DYBrowserFramePreference=@"com.dayu.color.lookLUTPreview.windowFrame";
|
||||
static NSString *const DYBrowserLayoutPreference=@"com.dayu.color.lookLUTPreview.layout";
|
||||
static NSString *const DYBrowserSidebarPreference=@"com.dayu.color.lookLUTPreview.sidebarWidth";
|
||||
static NSString *const DYBrowserRecentFolder=@"@recent";
|
||||
static NSString *DYBrowserPreference(NSString *key,DYLUTLibrary *library){return [NSString stringWithFormat:@"%@|%@",key,library.rootURL.path];}
|
||||
|
||||
@interface DYBrowserCanvas : NSView
|
||||
@property(copy) NSDictionary *palette;
|
||||
@@ -41,6 +46,7 @@ static NSString *const DYBrowserFolderPreference=@"com.dayu.color.lookLUTPreview
|
||||
@property(copy) NSDictionary *palette;
|
||||
@property BOOL chosen;
|
||||
@property BOOL doubleClicked;
|
||||
@property BOOL listLayout;
|
||||
@end
|
||||
@implementation DYBrowserTile
|
||||
- (BOOL)isFlipped{return YES;}
|
||||
@@ -56,7 +62,7 @@ static NSString *const DYBrowserFolderPreference=@"com.dayu.color.lookLUTPreview
|
||||
NSRect bounds=NSInsetRect(self.bounds,1,1);
|
||||
NSBezierPath *outline=[NSBezierPath bezierPathWithRoundedRect:bounds xRadius:7 yRadius:7];
|
||||
[DYBrowserColor(_palette,_chosen?@"field":@"card") setFill];[outline fill];
|
||||
NSRect imageRect=NSMakeRect(2,2,MAX(1,bounds.size.width-2),MAX(1,bounds.size.height-25));
|
||||
NSRect imageRect=_listLayout?NSMakeRect(3,3,104,bounds.size.height-4):NSMakeRect(2,2,MAX(1,bounds.size.width-2),MAX(1,bounds.size.height-25));
|
||||
if(_thumbnail){
|
||||
[NSGraphicsContext saveGraphicsState];
|
||||
[[NSBezierPath bezierPathWithRoundedRect:imageRect xRadius:4 yRadius:4]addClip];
|
||||
@@ -71,8 +77,8 @@ static NSString *const DYBrowserFolderPreference=@"com.dayu.color.lookLUTPreview
|
||||
NSSize size=[message sizeWithAttributes:attributes];
|
||||
[message drawAtPoint:NSMakePoint(NSMidX(imageRect)-size.width/2,NSMidY(imageRect)-size.height/2) withAttributes:attributes];
|
||||
}
|
||||
NSMutableParagraphStyle *paragraph=[[[NSMutableParagraphStyle alloc]init]autorelease];paragraph.alignment=NSTextAlignmentCenter;paragraph.lineBreakMode=NSLineBreakByTruncatingMiddle;
|
||||
[_displayName drawInRect:NSMakeRect(7,NSMaxY(bounds)-24,bounds.size.width-14,18) withAttributes:@{NSFontAttributeName:[NSFont systemFontOfSize:11 weight:_chosen?NSFontWeightSemibold:NSFontWeightRegular],NSForegroundColorAttributeName:DYBrowserColor(_palette,@"text"),NSParagraphStyleAttributeName:paragraph}];
|
||||
NSMutableParagraphStyle *paragraph=[[[NSMutableParagraphStyle alloc]init]autorelease];paragraph.alignment=_listLayout?NSTextAlignmentLeft:NSTextAlignmentCenter;paragraph.lineBreakMode=NSLineBreakByTruncatingMiddle;
|
||||
[_displayName drawInRect:(_listLayout?NSMakeRect(120,NSMidY(bounds)-9,MAX(1,bounds.size.width-136),20):NSMakeRect(7,NSMaxY(bounds)-24,bounds.size.width-14,18)) withAttributes:@{NSFontAttributeName:[NSFont systemFontOfSize:11 weight:_chosen?NSFontWeightSemibold:NSFontWeightRegular],NSForegroundColorAttributeName:DYBrowserColor(_palette,@"text"),NSParagraphStyleAttributeName:paragraph}];
|
||||
[DYBrowserColor(_palette,_chosen?@"accent":@"border")setStroke];outline.lineWidth=_chosen?2:1;[outline stroke];
|
||||
}
|
||||
- (void)mouseDown:(NSEvent *)event{self.doubleClicked=event.clickCount>1;[super mouseDown:event];}
|
||||
@@ -100,7 +106,7 @@ static NSString *const DYBrowserFolderPreference=@"com.dayu.color.lookLUTPreview
|
||||
@end
|
||||
@implementation DYBrowserWork @end
|
||||
|
||||
@interface DYLUTBrowser () <NSWindowDelegate,NSPopoverDelegate,NSSearchFieldDelegate> {
|
||||
@interface DYLUTBrowser () <NSWindowDelegate,NSPopoverDelegate,NSSearchFieldDelegate,NSSplitViewDelegate> {
|
||||
DYLUTLibrary *_library;
|
||||
NSData *_preview;
|
||||
NSString *_selectedPath,*_folder;
|
||||
@@ -108,6 +114,7 @@ static NSString *const DYBrowserFolderPreference=@"com.dayu.color.lookLUTPreview
|
||||
DYLUTSelectionHandler _selection;
|
||||
void (^_closeAction)(void);
|
||||
NSPopover *_popover;
|
||||
NSWindow *_presentationWindow;NSSplitView *_splitView;NSPopUpButton *_layoutMenu;
|
||||
DYBrowserCanvas *_root,*_folderDocument,*_gridDocument;
|
||||
NSScrollView *_folderScroll,*_gridScroll;
|
||||
NSTextField *_titleLabel,*_countLabel,*_statusLabel,*_sizeLabel,*_emptyLabel;
|
||||
@@ -121,25 +128,35 @@ static NSString *const DYBrowserFolderPreference=@"com.dayu.color.lookLUTPreview
|
||||
NSCache *_thumbnailCache;
|
||||
dispatch_queue_t _previewQueue;
|
||||
DYBrowserWork *_work;
|
||||
BOOL _closed,_sizing,_visible,_remoteMode,_importing,_layingOut;
|
||||
BOOL _closed,_sizing,_visible,_remoteMode,_importing,_layingOut,_detached;
|
||||
NSProgress *_libraryTask,*_selectionTask;
|
||||
NSTimer *_progressTimer;
|
||||
NSUInteger _libraryGeneration,_selectionGeneration;
|
||||
NSInteger _columns;
|
||||
CGFloat _tileWidth,_tileHeight;
|
||||
CGFloat _tileWidth,_tileHeight,_sidebarWidth;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation DYLUTBrowser
|
||||
+ (NSSize)minimumContentSize{return NSMakeSize(720,420);}
|
||||
+ (NSSize)maximumContentSize{return NSMakeSize(1800,1200);}
|
||||
+ (NSSize)preferredContentSize{
|
||||
NSString *key=[NSString stringWithFormat:@"%@|%@",DYBrowserFramePreference,DYLUTLibrary.defaultRootURL.path];
|
||||
NSString *saved=[[NSUserDefaults standardUserDefaults]stringForKey:key];NSRect frame=saved?NSRectFromString(saved):NSZeroRect;
|
||||
if(!std::isfinite(frame.size.width)||!std::isfinite(frame.size.height)||frame.size.width<720||frame.size.height<420)return NSMakeSize(900,620);
|
||||
return NSMakeSize(MIN(1800,frame.size.width),MIN(1200,MAX(420,frame.size.height-28)));
|
||||
}
|
||||
static NSTextField *BrowserLabel(NSString *title,CGFloat size){NSTextField *label=[NSTextField labelWithString:title];label.font=[NSFont systemFontOfSize:size];label.lineBreakMode=NSLineBreakByTruncatingTail;return label;}
|
||||
static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *button=[NSButton buttonWithTitle:title target:target action:action];button.font=[NSFont systemFontOfSize:11];button.bezelStyle=NSBezelStyleRounded;return button;}
|
||||
- (instancetype)initWithLibrary:(DYLUTLibrary *)library preview:(NSData *)rgba selectedPath:(NSString *)path palette:(NSDictionary *)palette selection:(DYLUTSelectionHandler)selection{
|
||||
NSPanel *panel=[[[NSPanel alloc]initWithContentRect:NSMakeRect(0,0,760,560) styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO]autorelease];
|
||||
if((self=[super initWithWindow:panel])){
|
||||
NSString *savedFolder=[[NSUserDefaults standardUserDefaults]stringForKey:DYBrowserFolderPreference];
|
||||
NSString *savedFolder=[[NSUserDefaults standardUserDefaults]stringForKey:DYBrowserPreference(DYBrowserFolderPreference,library)]?:[[NSUserDefaults standardUserDefaults]stringForKey:DYBrowserFolderPreference];
|
||||
if(!library.recentPaths.count&&path.length)[library recordUsedPath:path];
|
||||
if(!savedFolder)savedFolder=library.recentPaths.count?DYBrowserRecentFolder:@"*";
|
||||
_library=[library retain];_preview=[rgba copy];_selectedPath=[path copy];_folder=[(savedFolder?:@"*") copy];_selection=[selection copy];
|
||||
_folderButtons=[NSMutableArray new];_tiles=[NSMutableDictionary new];_queuedPaths=[NSMutableSet new];_thumbnailCache=[NSCache new];_thumbnailCache.countLimit=600;_thumbnailCache.totalCostLimit=64*1024*1024;_previewQueue=dispatch_queue_create("com.dayu.color.lut-thumbnails",DISPATCH_QUEUE_SERIAL);dispatch_set_target_queue(_previewQueue,dispatch_get_global_queue(QOS_CLASS_UTILITY,0));
|
||||
panel.title=@"风格 LUT";panel.minSize=NSMakeSize(760,420);panel.releasedWhenClosed=NO;panel.hidesOnDeactivate=NO;panel.delegate=self;
|
||||
panel.title=@"风格 LUT";panel.contentMinSize=self.class.minimumContentSize;panel.contentMaxSize=self.class.maximumContentSize;panel.releasedWhenClosed=NO;panel.hidesOnDeactivate=NO;panel.delegate=self;
|
||||
_root=[[DYBrowserCanvas alloc]initWithFrame:NSMakeRect(0,0,760,560)];_root.accessibilityLabel=@"LUT 缩略图浏览库";panel.contentView=_root;
|
||||
_titleLabel=[BrowserLabel(@"LUT 文件夹",14)retain];_titleLabel.font=[NSFont systemFontOfSize:14 weight:NSFontWeightSemibold];
|
||||
_countLabel=[BrowserLabel(@"0 个 LUT",11)retain];
|
||||
@@ -153,7 +170,11 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
|
||||
_refresh=[BrowserButton(@"刷新",self,@selector(reloadLibrary:))retain];
|
||||
_none=[BrowserButton(@"无 LUT",self,@selector(clearSelection:))retain];
|
||||
_done=[BrowserButton(@"完成",self,@selector(done:))retain];_done.keyEquivalent=@"\r";
|
||||
double size=[[NSUserDefaults standardUserDefaults]objectForKey:DYBrowserSizePreference]?[[NSUserDefaults standardUserDefaults]doubleForKey:DYBrowserSizePreference]:96;
|
||||
NSUserDefaults *preferences=NSUserDefaults.standardUserDefaults;
|
||||
NSNumber *storedSize=[preferences objectForKey:DYBrowserPreference(DYBrowserSizePreference,library)]?:[preferences objectForKey:DYBrowserSizePreference];double size=storedSize?storedSize.doubleValue:120;
|
||||
_layoutMenu=[[NSPopUpButton alloc]initWithFrame:NSZeroRect pullsDown:NO];[_layoutMenu addItemsWithTitles:@[@"网格",@"列表"]];_layoutMenu.font=[NSFont systemFontOfSize:11];_layoutMenu.target=self;_layoutMenu.action=@selector(layoutChanged:);_layoutMenu.accessibilityLabel=@"LUT 浏览布局";
|
||||
[_layoutMenu selectItemAtIndex:[preferences integerForKey:DYBrowserPreference(DYBrowserLayoutPreference,library)]==1?1:0];
|
||||
double sidebar=[preferences doubleForKey:DYBrowserPreference(DYBrowserSidebarPreference,library)];_sidebarWidth=std::isfinite(sidebar)&&sidebar>=128?MIN(360,sidebar):162;
|
||||
if(!std::isfinite(size))size=96;
|
||||
_sizeSlider=[[NSSlider alloc]initWithFrame:NSZeroRect];_sizeSlider.minValue=70;_sizeSlider.maxValue=255;_sizeSlider.doubleValue=fmax(70,fmin(255,size));_sizeSlider.continuous=YES;_sizeSlider.target=self;_sizeSlider.action=@selector(sizeChanged:);_sizeSlider.accessibilityLabel=@"LUT 缩略图大小";
|
||||
_folderScroll=[[NSScrollView alloc]initWithFrame:NSZeroRect];_folderScroll.hasVerticalScroller=YES;_folderScroll.autohidesScrollers=YES;_folderScroll.borderType=NSNoBorder;_folderScroll.drawsBackground=NO;_folderScroll.accessibilityLabel=@"LUT 文件夹列表";
|
||||
@@ -164,12 +185,14 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(folderScrolled:) name:NSViewBoundsDidChangeNotification object:_folderScroll.contentView];
|
||||
_gridScroll.contentView.postsBoundsChangedNotifications=YES;
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(gridScrolled:) name:NSViewBoundsDidChangeNotification object:_gridScroll.contentView];
|
||||
for(NSView *view in @[_titleLabel,_countLabel,_statusLabel,_sizeLabel,_search,_importFiles,_importFolder,_reveal,_refresh,_none,_done,_sizeSlider,_folderScroll,_gridScroll])[_root addSubview:view];
|
||||
_splitView=[[NSSplitView alloc]initWithFrame:NSMakeRect(12,80,736,425)];_splitView.vertical=YES;_splitView.dividerStyle=NSSplitViewDividerStyleThin;_splitView.accessibilityLabel=@"调整 LUT 文件夹与预览宽度";
|
||||
_folderScroll.frame=NSMakeRect(0,0,162,425);_gridScroll.frame=NSMakeRect(163,0,573,425);[_splitView addSubview:_folderScroll];[_splitView addSubview:_gridScroll];
|
||||
for(NSView *view in @[_titleLabel,_countLabel,_statusLabel,_sizeLabel,_search,_importFiles,_importFolder,_reveal,_refresh,_none,_done,_sizeSlider,_layoutMenu,_splitView])[_root addSubview:view];
|
||||
[_gridDocument addSubview:_emptyLabel];
|
||||
_root.postsFrameChangedNotifications=YES;_root.postsBoundsChangedNotifications=YES;
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(browserRootResized:) name:NSViewFrameDidChangeNotification object:_root];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(browserRootResized:) name:NSViewBoundsDidChangeNotification object:_root];
|
||||
[self reloadLibrary:nil];[self updatePalette:palette];[self layoutBrowser];
|
||||
_splitView.delegate=self;[self reloadLibrary:nil];[self updatePalette:palette];[self layoutBrowser];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -181,40 +204,65 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
|
||||
[_library release];[_preview release];[_selectedPath release];[_folder release];[_palette release];[_selection release];[_closeAction release];
|
||||
[_root release];[_folderDocument release];[_gridDocument release];[_folderScroll release];[_gridScroll release];
|
||||
[_titleLabel release];[_countLabel release];[_statusLabel release];[_sizeLabel release];[_emptyLabel release];[_search release];
|
||||
[_importFiles release];[_importFolder release];[_reveal release];[_refresh release];[_none release];[_done release];[_sizeSlider release];
|
||||
[_importFiles release];[_importFolder release];[_reveal release];[_refresh release];[_none release];[_done release];[_sizeSlider release];[_layoutMenu release];_splitView.delegate=nil;[_splitView release];[_presentationWindow release];
|
||||
[_folderButtons release];[_folderPaths release];[_tiles release];[_visibleEntries release];[_queuedPaths release];[_thumbnailCache release];
|
||||
dispatch_release(_previewQueue);[super dealloc];
|
||||
}
|
||||
- (void)showRelativeToView:(NSView *)view{
|
||||
if(_closed||_remoteMode||!view.window)return;
|
||||
if(_popover.shown)return;
|
||||
// A plug-in process is prohibited from making its own NSPanel key. Only
|
||||
// FxRemoteWindow or a host-anchored popover may present this content.
|
||||
if(_closed||_remoteMode||!view.window||_popover.shown)return;
|
||||
self.window.contentView=[[[NSView alloc]initWithFrame:NSMakeRect(0,0,1,1)]autorelease];
|
||||
[_root removeFromSuperview];_root.frame=NSMakeRect(0,0,760,560);_root.autoresizingMask=NSViewWidthSizable|NSViewHeightSizable;
|
||||
_popover=[[NSPopover alloc]init];_popover.behavior=NSPopoverBehaviorTransient;_popover.animates=YES;_popover.delegate=self;_popover.contentSize=NSMakeSize(760,560);
|
||||
NSViewController *controller=[[[NSViewController alloc]init]autorelease];controller.view=_root;_popover.contentViewController=controller;
|
||||
NSSize size=self.class.preferredContentSize;[_root removeFromSuperview];_root.frame=(NSRect){NSZeroPoint,size};_root.autoresizingMask=NSViewWidthSizable|NSViewHeightSizable;
|
||||
_popover=[[NSPopover alloc]init];_popover.behavior=NSPopoverBehaviorSemitransient;_popover.animates=YES;_popover.delegate=self;_popover.contentSize=size;
|
||||
NSViewController *controller=[[[NSViewController alloc]init]autorelease];controller.title=@"风格 LUT";controller.view=_root;_popover.contentViewController=controller;
|
||||
[self layoutBrowser];
|
||||
@try {[_popover showRelativeToRect:view.bounds ofView:view preferredEdge:NSRectEdgeMaxX];_visible=_popover.shown;}
|
||||
@catch(NSException *exception){[self finishClosing];}
|
||||
}
|
||||
- (BOOL)visible{return !_closed&&(_remoteMode?_visible:_popover.shown);}
|
||||
- (BOOL)visible{return !_closed&&((_remoteMode||_detached)?_visible:_popover.shown);}
|
||||
- (void)showInRemoteParent:(NSView *)parent close:(void (^)(void))closeAction{
|
||||
if(_closed||!parent||self.visible)return;
|
||||
_remoteMode=YES;_visible=YES;[_closeAction release];_closeAction=[closeAction copy];
|
||||
self.window.contentView=[[[NSView alloc]initWithFrame:NSMakeRect(0,0,1,1)]autorelease];
|
||||
[_root removeFromSuperview];_root.frame=parent.bounds;_root.autoresizingMask=NSViewWidthSizable|NSViewHeightSizable;parent.autoresizesSubviews=YES;_root.hidden=NO;
|
||||
[parent addSubview:_root];[self layoutBrowser];[_root setNeedsDisplay:YES];
|
||||
// The SDK reads the first child size as soon as its reply returns.
|
||||
// Restore geometry only after that first synchronous attachment is complete.
|
||||
dispatch_async(dispatch_get_main_queue(),^{if(!_closed)[self configurePresentationWindow];});
|
||||
NSAccessibilityPostNotification(parent,NSAccessibilityLayoutChangedNotification);
|
||||
}
|
||||
- (void)configurePresentationWindow{
|
||||
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];
|
||||
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(presentationWindowClosed:) name:NSWindowWillCloseNotification object:window];
|
||||
}
|
||||
window.title=@"风格 LUT";window.contentMinSize=self.class.minimumContentSize;window.contentMaxSize=self.class.maximumContentSize;
|
||||
if(_detached)window.styleMask|=NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable;
|
||||
NSString *saved=[NSUserDefaults.standardUserDefaults stringForKey:DYBrowserPreference(DYBrowserFramePreference,_library)];
|
||||
NSRect frame=saved?NSRectFromString(saved):[window frameRectForContentRect:(NSRect){window.frame.origin,self.class.preferredContentSize}];
|
||||
if(std::isfinite(frame.origin.x)&&std::isfinite(frame.origin.y)&&std::isfinite(frame.size.width)&&std::isfinite(frame.size.height)&&frame.size.width>=720&&frame.size.height>=420){
|
||||
NSRect screen=(window.screen?:NSScreen.mainScreen).visibleFrame;frame.size.width=MIN(MAX(720,frame.size.width),MIN(1800,screen.size.width));frame.size.height=MIN(MAX(448,frame.size.height),MIN(1228,screen.size.height));
|
||||
frame.origin.x=MAX(NSMinX(screen),MIN(frame.origin.x,NSMaxX(screen)-frame.size.width));frame.origin.y=MAX(NSMinY(screen),MIN(frame.origin.y,NSMaxY(screen)-frame.size.height));[window setFrame:frame display:YES];
|
||||
}
|
||||
[self layoutBrowser];
|
||||
}
|
||||
- (void)presentationGeometryChanged:(NSNotification *)notification{
|
||||
if(_closed||!_presentationWindow)return;NSRect frame=_presentationWindow.frame;
|
||||
if(std::isfinite(frame.size.width)&&std::isfinite(frame.size.height)&&frame.size.width>=720&&frame.size.height>=420)[NSUserDefaults.standardUserDefaults setObject:NSStringFromRect(frame) forKey:DYBrowserPreference(DYBrowserFramePreference,_library)];
|
||||
[self layoutBrowser];
|
||||
}
|
||||
- (void)presentationWindowClosed:(NSNotification *)notification{[self finishClosing];}
|
||||
- (BOOL)popoverShouldDetach:(NSPopover *)popover{return YES;}
|
||||
- (void)popoverDidDetach:(NSPopover *)popover{_detached=YES;_visible=YES;[self configurePresentationWindow];}
|
||||
- (void)browserRootResized:(NSNotification *)notification{if(!_closed)[self layoutBrowser];}
|
||||
- (void)windowDidResize:(NSNotification *)notification{[self layoutBrowser];}
|
||||
- (void)windowWillClose:(NSNotification *)notification{[self finishClosing];}
|
||||
- (BOOL)popoverShouldClose:(NSPopover *)popover{return !_importing;}
|
||||
- (void)popoverDidClose:(NSNotification *)notification{[self finishClosing];}
|
||||
- (void)popoverDidClose:(NSNotification *)notification{if([notification.userInfo[NSPopoverCloseReasonKey]isEqual:NSPopoverCloseReasonDetachToWindow])return;[self finishClosing];}
|
||||
- (void)close{
|
||||
if(_closed)return;
|
||||
if(_popover.shown){[_popover close];if(!_closed)[self finishClosing];}
|
||||
if(_detached&&_presentationWindow){[_presentationWindow performClose:nil];if(!_closed)[self finishClosing];}
|
||||
else if(_popover.shown){[_popover close];if(!_closed)[self finishClosing];}
|
||||
else [self finishClosing];
|
||||
}
|
||||
- (void)finishClosing{
|
||||
@@ -232,25 +280,32 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
|
||||
}
|
||||
- (void)layoutBrowser{
|
||||
if(_layingOut)return;_layingOut=YES;
|
||||
CGFloat w=_root.bounds.size.width,h=_root.bounds.size.height,left=162;
|
||||
_titleLabel.frame=NSMakeRect(12,15,145,20);_countLabel.frame=NSMakeRect(12,39,145,18);
|
||||
_search.frame=NSMakeRect(left+14,14,MAX(125,w-left-351),24);
|
||||
_importFiles.frame=NSMakeRect(w-322,12,100,28);_importFolder.frame=NSMakeRect(w-218,12,113,28);_refresh.frame=NSMakeRect(w-101,12,82,28);
|
||||
_folderScroll.frame=NSMakeRect(12,66,150,MAX(80,h-121));_gridScroll.frame=NSMakeRect(left+12,50,MAX(80,w-left-26),MAX(80,h-105));
|
||||
_reveal.frame=NSMakeRect(14,h-44,left-23,27);_none.frame=NSMakeRect(left+13,h-44,75,27);
|
||||
_sizeLabel.frame=NSMakeRect(left+101,h-39,74,18);_sizeSlider.frame=NSMakeRect(left+173,h-41,MAX(70,MIN(150,w-left-420)),20);
|
||||
CGFloat w=_root.bounds.size.width,h=_root.bounds.size.height;
|
||||
_titleLabel.frame=NSMakeRect(14,12,160,20);_countLabel.frame=NSMakeRect(180,14,120,18);
|
||||
_search.frame=NSMakeRect(14,46,MAX(125,w-350),24);
|
||||
_importFiles.frame=NSMakeRect(w-322,44,100,28);_importFolder.frame=NSMakeRect(w-218,44,113,28);_refresh.frame=NSMakeRect(w-101,44,82,28);
|
||||
_splitView.frame=NSMakeRect(12,80,MAX(400,w-24),MAX(140,h-135));[_splitView adjustSubviews];
|
||||
CGFloat sidebar=MAX(128,MIN(_sidebarWidth,MIN(360,_splitView.bounds.size.width*.45)));[_splitView setPosition:sidebar ofDividerAtIndex:0];
|
||||
_reveal.frame=NSMakeRect(w-153,9,139,27);_none.frame=NSMakeRect(14,h-44,75,27);_layoutMenu.frame=NSMakeRect(100,h-44,97,27);
|
||||
_sizeLabel.frame=NSMakeRect(211,h-39,74,18);_sizeSlider.frame=NSMakeRect(288,h-41,MIN(150,MAX(80,w-550)),20);
|
||||
_done.frame=NSMakeRect(w-98,h-44,78,27);
|
||||
CGFloat statusX=NSMaxX(_sizeSlider.frame)+14;_statusLabel.frame=NSMakeRect(statusX,h-39,MAX(0,w-statusX-112),18);
|
||||
CGFloat fw=MAX(100,_folderScroll.contentSize.width);
|
||||
_folderDocument.frame=NSMakeRect(0,0,fw,MAX(_folderPaths.count*35+4,_folderScroll.contentSize.height));
|
||||
[self updateVisibleFolders];
|
||||
CGFloat available=MAX(80,_gridScroll.contentSize.width),tileWidth=_sizeSlider.doubleValue,gap=10;
|
||||
NSInteger columns=MAX(1,(NSInteger)floor((available+gap)/(tileWidth+gap)));tileWidth=MIN(tileWidth,(available-gap*(columns-1)-14)/columns);tileWidth=MAX(70,tileWidth);
|
||||
_columns=columns;_tileWidth=tileWidth;_tileHeight=ceil(tileWidth*9/16)+24;
|
||||
BOOL list=_layoutMenu.indexOfSelectedItem==1;NSInteger columns=list?1:MAX(1,(NSInteger)floor((available+gap)/(tileWidth+gap)));tileWidth=list?MAX(110,available-14):MIN(tileWidth,(available-gap*(columns-1)-14)/columns);tileWidth=MAX(70,tileWidth);
|
||||
_columns=columns;_tileWidth=tileWidth;_tileHeight=list?70:ceil(tileWidth*9/16)+24;
|
||||
NSInteger rows=(_visibleEntries.count+columns-1)/columns;CGFloat contentHeight=MAX(_gridScroll.contentSize.height,rows*(_tileHeight+gap)+12);
|
||||
_gridDocument.frame=NSMakeRect(0,0,available,contentHeight);_emptyLabel.frame=NSMakeRect(20,MAX(36,_gridScroll.contentSize.height/2-45),MAX(50,available-40),90);
|
||||
_layingOut=NO;[self updateVisibleTiles];
|
||||
}
|
||||
- (CGFloat)splitView:(NSSplitView *)split constrainMinCoordinate:(CGFloat)proposed ofSubviewAt:(NSInteger)index{return 128;}
|
||||
- (CGFloat)splitView:(NSSplitView *)split constrainMaxCoordinate:(CGFloat)proposed ofSubviewAt:(NSInteger)index{return MIN(360,split.bounds.size.width*.45);}
|
||||
- (void)splitViewDidResizeSubviews:(NSNotification *)notification{
|
||||
if(_closed||_layingOut)return;_sidebarWidth=_folderScroll.frame.size.width;[NSUserDefaults.standardUserDefaults setDouble:_sidebarWidth forKey:DYBrowserPreference(DYBrowserSidebarPreference,_library)];[self layoutBrowser];
|
||||
}
|
||||
- (void)layoutChanged:(id)sender{[NSUserDefaults.standardUserDefaults setInteger:_layoutMenu.indexOfSelectedItem forKey:DYBrowserPreference(DYBrowserLayoutPreference,_library)];[self layoutBrowser];}
|
||||
- (void)resetThumbnailWork {
|
||||
_work.cancelled=YES;_work.owner=nil;[_work release];_work=[DYBrowserWork new];_work.owner=self;[_queuedPaths removeAllObjects];
|
||||
}
|
||||
@@ -263,7 +318,7 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
|
||||
for(NSUInteger i=first;i<end;i++){
|
||||
NSDictionary *entry=_visibleEntries[i];NSString *path=entry[@"path"];[wanted addObject:path];DYBrowserTile *tile=_tiles[path];
|
||||
if(!tile){tile=[[[DYBrowserTile alloc]initWithFrame:NSZeroRect]autorelease];tile.identifier=path;tile.displayName=entry[@"name"];tile.toolTip=entry[@"relativePath"]?:path;tile.palette=_palette;tile.chosen=[path isEqualToString:_selectedPath];tile.target=self;tile.action=@selector(thumbnailClicked:);tile.enabled=YES;[_gridDocument addSubview:tile];_tiles[path]=tile;changed=YES;}
|
||||
tile.frame=NSMakeRect(7+(i%_columns)*(_tileWidth+10),8+(i/_columns)*step,_tileWidth,_tileHeight);
|
||||
tile.listLayout=_layoutMenu.indexOfSelectedItem==1;tile.frame=NSMakeRect(7+(i%_columns)*(_tileWidth+10),8+(i/_columns)*step,_tileWidth,_tileHeight);
|
||||
}
|
||||
for(NSString *path in _tiles.allKeys)if(![wanted containsObject:path]){[_tiles[path]removeFromSuperview];[_tiles removeObjectForKey:path];changed=YES;}
|
||||
if(changed||!_work)[self resetThumbnailWork];
|
||||
@@ -277,7 +332,7 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
|
||||
self.window.backgroundColor=DYBrowserColor(_palette,@"background");self.window.appearance=[NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
|
||||
_root.appearance=[NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
|
||||
for(NSTextField *label in @[_titleLabel,_countLabel,_statusLabel,_sizeLabel,_emptyLabel])label.textColor=DYBrowserColor(_palette,label==_titleLabel?@"text":@"secondary");
|
||||
for(NSButton *button in @[_importFiles,_importFolder,_reveal,_refresh,_none,_done])button.contentTintColor=DYBrowserColor(_palette,@"accent");
|
||||
for(NSButton *button in @[_importFiles,_importFolder,_reveal,_refresh,_none,_done,_layoutMenu])button.contentTintColor=DYBrowserColor(_palette,@"accent");
|
||||
_search.textColor=DYBrowserColor(_palette,@"text");_search.backgroundColor=DYBrowserColor(_palette,@"field");
|
||||
for(DYBrowserFolderButton *button in _folderButtons){button.palette=_palette;[button setNeedsDisplay:YES];}
|
||||
for(DYBrowserTile *tile in _tiles.allValues){tile.palette=_palette;[tile setNeedsDisplay:YES];}
|
||||
@@ -292,7 +347,7 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
|
||||
}
|
||||
- (void)setStatus:(NSString *)status{_statusLabel.stringValue=status?:@"";_statusLabel.toolTip=status;}
|
||||
- (void)rebuildFolders{
|
||||
NSMutableArray *paths=[NSMutableArray arrayWithObject:@"*"];NSMutableSet *seen=[NSMutableSet setWithObject:@"*"];
|
||||
NSMutableArray *paths=[NSMutableArray arrayWithObjects:DYBrowserRecentFolder,@"*",nil];NSMutableSet *seen=[NSMutableSet setWithArray:paths];
|
||||
for(NSString *folder in _library.folders){NSString *top=folder.length?[folder componentsSeparatedByString:@"/"].firstObject:@"";if(![seen containsObject:top]){[paths addObject:top];[seen addObject:top];}}
|
||||
if(![seen containsObject:_folder]){[_folder release];_folder=[@"*" copy];}
|
||||
[_folderPaths release];_folderPaths=[paths copy];[self updateVisibleFolders];
|
||||
@@ -306,7 +361,7 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
|
||||
for(NSUInteger i=first;i<end;i++){
|
||||
NSString *path=_folderPaths[i];DYBrowserFolderButton *button=existing[path];
|
||||
if(!button){button=[[[DYBrowserFolderButton alloc]initWithFrame:NSZeroRect]autorelease];button.bordered=NO;button.target=self;button.action=@selector(folderClicked:);button.identifier=path;
|
||||
button.title=[path isEqualToString:@"*"]?@"全部 LUT":path.length?[@"▸ " stringByAppendingString:path]:@"未分类";button.toolTip=path.length?path:_library.rootURL.path;button.palette=_palette;button.accessibilityLabel=[@"LUT 文件夹:" stringByAppendingString:button.title];[_folderDocument addSubview:button];}
|
||||
button.title=[path isEqual:DYBrowserRecentFolder]?@"最近使用":[path isEqualToString:@"*"]?@"全部 LUT":path.length?[@"▸ " stringByAppendingString:path]:@"未分类";button.toolTip=path.length?path:_library.rootURL.path;button.palette=_palette;button.accessibilityLabel=[@"LUT 文件夹:" stringByAppendingString:button.title];[_folderDocument addSubview:button];}
|
||||
button.chosen=[path isEqualToString:_folder];button.frame=NSMakeRect(4,4+i*35,MAX(92,_folderScroll.contentSize.width-8),33);[button setNeedsDisplay:YES];[buttons addObject:button];
|
||||
}
|
||||
for(NSButton *button in _folderButtons)if(![buttons containsObject:button])[button removeFromSuperview];[_folderButtons setArray:buttons];
|
||||
@@ -334,14 +389,14 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
|
||||
}
|
||||
- (void)folderClicked:(NSButton *)sender{
|
||||
[_folder release];_folder=[sender.identifier copy];
|
||||
[[NSUserDefaults standardUserDefaults]setObject:_folder forKey:DYBrowserFolderPreference];
|
||||
[[NSUserDefaults standardUserDefaults]setObject:_folder forKey:DYBrowserPreference(DYBrowserFolderPreference,_library)];
|
||||
for(DYBrowserFolderButton *button in _folderButtons){button.chosen=[button.identifier isEqualToString:_folder];[button setNeedsDisplay:YES];}
|
||||
[self rebuildGrid];
|
||||
}
|
||||
- (void)searchChanged:(id)sender{[self rebuildGrid];}
|
||||
- (void)controlTextDidChange:(NSNotification *)notification{if(notification.object==_search)[self rebuildGrid];}
|
||||
- (void)sizeChanged:(id)sender{
|
||||
[[NSUserDefaults standardUserDefaults]setDouble:_sizeSlider.doubleValue forKey:DYBrowserSizePreference];
|
||||
[[NSUserDefaults standardUserDefaults]setDouble:_sizeSlider.doubleValue forKey:DYBrowserPreference(DYBrowserSizePreference,_library)];
|
||||
_sizing=YES;[self layoutBrowser];
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(refreshThumbnailSize) object:nil];
|
||||
[self performSelector:@selector(refreshThumbnailSize) withObject:nil afterDelay:.22];
|
||||
@@ -384,11 +439,14 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
|
||||
[self resetThumbnailWork];
|
||||
for(NSView *tile in _tiles.allValues)[tile removeFromSuperview];[_tiles removeAllObjects];
|
||||
NSString *query=[_search.stringValue stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];NSMutableArray *entries=[NSMutableArray array];
|
||||
for(NSDictionary *entry in _library.entries){
|
||||
BOOL recent=[_folder isEqual:DYBrowserRecentFolder];NSArray *history=_library.recentPaths;
|
||||
for(NSDictionary *entry in (recent?_library.recentEntries:_library.entries)){
|
||||
NSString *folder=entry[@"relativeFolder"]?:@"";
|
||||
BOOL folderMatch=[_folder isEqualToString:@"*"]||[folder isEqualToString:_folder]||(_folder.length&&[folder hasPrefix:[_folder stringByAppendingString:@"/"]]);
|
||||
BOOL folderMatch=recent||[_folder isEqualToString:@"*"]||[folder isEqualToString:_folder]||(_folder.length&&[folder hasPrefix:[_folder stringByAppendingString:@"/"]]);
|
||||
if(folderMatch&&(!query.length||[entry[@"name"]localizedCaseInsensitiveContainsString:query]||[entry[@"relativePath"]localizedCaseInsensitiveContainsString:query]))[entries addObject:entry];
|
||||
}
|
||||
if(!recent)[entries sortUsingComparator:^NSComparisonResult(NSDictionary *a,NSDictionary *b){NSUInteger i=[history indexOfObject:a[@"path"]],j=[history indexOfObject:b[@"path"]];if(i==j)return [a[@"relativePath"]localizedStandardCompare:b[@"relativePath"]];return i<j?NSOrderedAscending:NSOrderedDescending;}];
|
||||
_emptyLabel.stringValue=recent?@"尚未使用 LUT。成功应用后会在这里按最近使用排序。":@"此文件夹还没有 LUT。\n点“导入文件”或“导入文件夹”添加 .cube 文件。";
|
||||
[_visibleEntries release];_visibleEntries=[entries copy];_countLabel.stringValue=[NSString stringWithFormat:@"%lu 个 LUT",(unsigned long)entries.count];_emptyLabel.hidden=entries.count>0;
|
||||
[_gridScroll.contentView scrollToPoint:NSZeroPoint];[self layoutBrowser];[_gridScroll reflectScrolledClipView:_gridScroll.contentView];
|
||||
NSAccessibilityPostNotification(_gridDocument,NSAccessibilityLayoutChangedNotification);
|
||||
@@ -400,7 +458,7 @@ static NSButton *BrowserButton(NSString *title,id target,SEL action){NSButton *b
|
||||
void (^applied)(NSError *)=^(NSError *error){
|
||||
if(_closed||generation!=_selectionGeneration)return;[_selectionTask release];_selectionTask=nil;
|
||||
if(error){[self setStatus:error.localizedDescription];return;}
|
||||
[_selectedPath release];_selectedPath=[path copy];
|
||||
[_selectedPath release];_selectedPath=[path copy];[_library recordUsedPath:path];[self rebuildGrid];
|
||||
for(DYBrowserTile *tile in _tiles.allValues){tile.chosen=[tile.identifier isEqualToString:path];[tile setNeedsDisplay:YES];}
|
||||
[self setStatus:[@"已选择 " stringByAppendingString:name]];if(closeAfter)[self close];
|
||||
};
|
||||
|
||||
@@ -48,6 +48,10 @@ FOUNDATION_EXPORT NSImage * _Nullable DYLUTThumbnail(NSString * _Nullable path,
|
||||
/// Relative folder names, including the root empty string; sorted naturally.
|
||||
@property(nonatomic,readonly,copy) NSArray<NSString *> *folders;
|
||||
@property(nonatomic,readonly,copy) NSSet<NSString *> *favoritePaths;
|
||||
/// Most recently acknowledged applications, newest first, scoped to this library.
|
||||
@property(nonatomic,readonly,copy) NSArray<NSString *> *recentPaths;
|
||||
@property(nonatomic,readonly,copy) NSArray<NSDictionary<NSString *,NSString *> *> *recentEntries;
|
||||
- (void)recordUsedPath:(NSString *)path;
|
||||
+ (NSURL *)defaultRootURL;
|
||||
- (instancetype)init;
|
||||
- (instancetype)initWithRootURL:(NSURL *)rootURL NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@@ -373,6 +373,33 @@ static BOOL DYLUTEnsureDirectory(NSURL *directory,NSURL *root,NSError **error) {
|
||||
- (NSArray *)entries {@synchronized(self){return [[_entries copy]autorelease];}}
|
||||
- (NSArray *)folders {@synchronized(self){return [[_folders copy]autorelease];}}
|
||||
- (NSSet *)favoritePaths {@synchronized(self){return [[_favoritePaths copy]autorelease];}}
|
||||
- (NSString *)recentPreferenceKey {return [@"com.dayu.color.lookLUTPreview.recentPaths|" stringByAppendingString:_rootURL.path];}
|
||||
- (NSArray *)recentPaths {
|
||||
id saved=[[NSUserDefaults standardUserDefaults]objectForKey:[self recentPreferenceKey]];
|
||||
NSMutableArray *paths=[NSMutableArray array];
|
||||
if([saved isKindOfClass:NSArray.class])for(id path in saved){
|
||||
if([path isKindOfClass:NSString.class]&&[path isAbsolutePath]&&[[path pathExtension]caseInsensitiveCompare:@"cube"]==NSOrderedSame&&![paths containsObject:path])[paths addObject:path];
|
||||
if(paths.count==40)break;
|
||||
}
|
||||
return [[paths copy]autorelease];
|
||||
}
|
||||
- (NSArray *)recentEntries {
|
||||
NSMutableDictionary *known=[NSMutableDictionary dictionary];for(NSDictionary *entry in self.entries)known[entry[@"path"]]=entry;
|
||||
NSMutableArray *entries=[NSMutableArray array];for(NSString *path in self.recentPaths){
|
||||
NSDictionary *entry=known[path];
|
||||
if(!entry)entry=@{@"name":path.lastPathComponent.stringByDeletingPathExtension,@"path":path,@"relativePath":path,@"relativeFolder":@""};
|
||||
[entries addObject:entry];
|
||||
}
|
||||
return [[entries copy]autorelease];
|
||||
}
|
||||
- (void)recordUsedPath:(NSString *)path {
|
||||
if(![path isKindOfClass:NSString.class]||!path.isAbsolutePath||[path.pathExtension caseInsensitiveCompare:@"cube"]!=NSOrderedSame)return;
|
||||
@synchronized(NSUserDefaults.class){
|
||||
NSArray *saved=self.recentPaths;NSMutableArray *next=[[saved mutableCopy]autorelease];[next removeObject:path];[next insertObject:path atIndex:0];
|
||||
if(next.count>40)[next removeObjectsInRange:NSMakeRange(40,next.count-40)];
|
||||
if(![next isEqual:saved])[[NSUserDefaults standardUserDefaults]setObject:next forKey:[self recentPreferenceKey]];
|
||||
}
|
||||
}
|
||||
- (BOOL)reload:(NSError **)error {return [self reloadProgress:nil error:error];}
|
||||
- (BOOL)reloadProgress:(NSProgress *)progress error:(NSError **)error {@synchronized(_fileLock){
|
||||
BOOL isDirectory=NO;NSFileManager *fm=NSFileManager.defaultManager;
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
// Native per-tool mask editor, shared by original and repeated tool cards.
|
||||
@interface DYToolMaskPanel : DYFlippedView
|
||||
@property(nonatomic,readonly) CGFloat contentHeight;
|
||||
- (instancetype)initWithManager:(id<PROAPIAccessing>)manager nodeID:(NSString*)nodeID;
|
||||
- (void)refreshWithDocument:(NSDictionary*)document time:(CMTime)time;
|
||||
- (void)addMenu:(NSView*)anchor;
|
||||
@end
|
||||
@implementation DYToolMaskPanel {
|
||||
id<PROAPIAccessing> _host;NSString *_nodeID,*_maskID;NSDictionary *_document;CMTime _time;
|
||||
NSPopUpButton *_list,*_combine;NSButton *_eye,*_add,*_remove,*_invert,*_canvas,*_clear,*_penRedraw,*_penFinish,*_penCancel;NSMutableArray *_rows,*_tracking;NSTextField *_trackingTitle,*_status;BOOL _refreshing,_drawing,_canvasActive;CGFloat _contentHeight;
|
||||
}
|
||||
@synthesize contentHeight=_contentHeight;
|
||||
- (instancetype)initWithManager:(id<PROAPIAccessing>)manager nodeID:(NSString*)nodeID{
|
||||
if((self=[super initWithFrame:NSZeroRect])){_host=manager;_nodeID=[nodeID copy];_rows=[NSMutableArray new];_tracking=[NSMutableArray new];self.identifier=@"toolMasks";
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(trackingStatus:) name:@"DYToolTrackingStatus" object:_host];
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(canvasSelected:) name:@"DYToolCanvasSelection" object:_host];
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(canvasState:) name:@"DYToolCanvasState" object:_host];
|
||||
}return self;
|
||||
}
|
||||
- (void)buildControls{if(_list)return;
|
||||
_list=[[NSPopUpButton alloc]initWithFrame:NSZeroRect pullsDown:NO];_list.target=self;_list.action=@selector(selection:);_list.font=[NSFont systemFontOfSize:13 weight:NSFontWeightMedium];_list.controlSize=NSControlSizeRegular;_list.accessibilityLabel=@"本层蒙版";[self addSubview:_list];
|
||||
_eye=[DYButton(@"",self,@selector(enabled:))retain];_eye.image=[NSImage imageWithSystemSymbolName:@"eye" accessibilityDescription:@"蒙版启用"];_eye.imageScaling=NSImageScaleProportionallyUpOrDown;_eye.bordered=NO;[_eye setButtonType:NSButtonTypePushOnPushOff];[self addSubview:_eye];
|
||||
_add=[DYButton(@"+",self,@selector(add:))retain];_add.toolTip=@"再添加一个蒙版";_add.accessibilityLabel=_add.toolTip;[self addSubview:_add];
|
||||
_remove=[DYButton(@"−",self,@selector(remove:))retain];_remove.toolTip=@"删除选中的蒙版";_remove.accessibilityLabel=_remove.toolTip;[self addSubview:_remove];
|
||||
_combine=[[NSPopUpButton alloc]initWithFrame:NSZeroRect pullsDown:NO];[_combine addItemsWithTitles:@[@"相加",@"减去",@"相交"]];_combine.font=[NSFont systemFontOfSize:13];_combine.controlSize=NSControlSizeRegular;_combine.target=self;_combine.action=@selector(combine:);_combine.accessibilityLabel=@"蒙版组合方式";[self addSubview:_combine];
|
||||
_invert=[[NSButton checkboxWithTitle:@"反转" target:self action:@selector(inverted:)]retain];_invert.font=[NSFont systemFontOfSize:13];_invert.controlSize=NSControlSizeRegular;[self addSubview:_invert];
|
||||
_canvas=[DYButton(@"画面编辑",self,@selector(canvas:))retain];_canvas.toolTip=@"在宿主画面拖动中心、大小、旋转与钢笔节点;回车闭合钢笔";_canvas.accessibilityLabel=@"编辑本层蒙版画面控件";[self addSubview:_canvas];
|
||||
_penRedraw=[DYButton(@"重画钢笔",self,@selector(redrawPen:))retain];_penRedraw.toolTip=@"从空白重画钢笔;完成前保留原路径,可随时取消";_penRedraw.accessibilityLabel=@"重画钢笔蒙版";[self addSubview:_penRedraw];
|
||||
_penFinish=[DYButton(@"完成绘制",self,@selector(penCommand:))retain];_penFinish.toolTip=@"闭合当前钢笔路径并保存";_penFinish.accessibilityLabel=@"完成钢笔绘制";[self addSubview:_penFinish];
|
||||
_penCancel=[DYButton(@"取消绘制",self,@selector(penCommand:))retain];_penCancel.toolTip=@"取消当前绘制,保留原蒙版路径";_penCancel.accessibilityLabel=@"取消钢笔绘制";[self addSubview:_penCancel];
|
||||
_clear=[DYButton(@"清除轨迹",self,@selector(clear:))retain];[self addSubview:_clear];
|
||||
NSArray *names=@[@"强度",@"羽化",@"中心 X",@"中心 Y",@"宽度",@"高度",@"旋转",@"渐变宽度",@"色相中心",@"色相范围",@"色相柔边",@"饱和度下限",@"饱和度上限",@"亮度下限",@"亮度上限",@"输入黑",@"输入白",@"输入伽马"];
|
||||
for(NSInteger i=0;i<names.count;i++){NSTextField *label=[DYLabel(names[i],13)retain];label.font=[NSFont systemFontOfSize:13 weight:NSFontWeightMedium];NSSlider *slider=[[NSSlider alloc]initWithFrame:NSZeroRect];slider.tag=i;slider.target=self;slider.action=@selector(valueChanged:);slider.continuous=NO;slider.controlSize=NSControlSizeRegular;slider.accessibilityLabel=[names[i]stringByAppendingString:@"蒙版"];NSTextField *field=[[NSTextField alloc]initWithFrame:NSZeroRect];field.cell=[[[DYNumberFieldCell alloc]initTextCell:@"0"]autorelease];field.font=[NSFont monospacedDigitSystemFontOfSize:13 weight:NSFontWeightMedium];field.textColor=DYInk();field.backgroundColor=DYThemeColor(@"field");field.bezeled=NO;field.bordered=NO;field.drawsBackground=NO;field.tag=i;field.target=self;field.action=@selector(valueChanged:);field.accessibilityLabel=[names[i]stringByAppendingString:@"蒙版数值"];field.alignment=NSTextAlignmentCenter;[self addSubview:label];[self addSubview:slider];[self addSubview:field];[_rows addObject:@{@"label":label,@"slider":slider,@"field":field}];[label release];[slider release];[field release];}
|
||||
NSArray *titles=@[@"反向单帧",@"反向跟踪",@"双向跟踪",@"正向跟踪",@"正向单帧",@"取消跟踪"];
|
||||
for(int i=0;i<6;i++){NSButton *b=DYButton(titles[i],self,@selector(track:));b.tag=((int[]){-2,-1,0,1,2,9})[i];b.font=[NSFont systemFontOfSize:13 weight:NSFontWeightMedium];b.controlSize=NSControlSizeRegular;b.accessibilityLabel=@[@"反向跟踪一帧",@"反向蒙版跟踪",@"双向蒙版跟踪",@"正向蒙版跟踪",@"正向跟踪一帧",@"取消蒙版跟踪"][i];[self addSubview:b];[_tracking addObject:b];}
|
||||
for(NSButton *b in @[_eye,_add,_remove,_canvas,_clear,_penRedraw,_penFinish,_penCancel]){b.controlSize=NSControlSizeRegular;b.font=[NSFont systemFontOfSize:(b==_add||b==_remove)?18:13 weight:NSFontWeightMedium];}
|
||||
_trackingTitle=[DYLabel(@"运动跟踪",13)retain];_trackingTitle.font=[NSFont systemFontOfSize:13 weight:NSFontWeightSemibold];[self addSubview:_trackingTitle];
|
||||
_status=[DYLabel(@"",12)retain];_status.maximumNumberOfLines=3;_status.lineBreakMode=NSLineBreakByWordWrapping;[self addSubview:_status];_contentHeight=0;
|
||||
}
|
||||
- (void)dealloc{[NSNotificationCenter.defaultCenter removeObserver:self];[_nodeID release];[_maskID release];[_document release];[_list release];[_combine release];[_eye release];[_add release];[_remove release];[_invert release];[_canvas release];[_clear release];[_penRedraw release];[_penFinish release];[_penCancel release];[_rows release];[_tracking release];[_trackingTitle release];[_status release];[super dealloc];}
|
||||
- (NSDictionary*)mask{for(NSDictionary *m in DYMasksForTool(_document,_nodeID))if([m[@"id"]isEqual:_maskID])return m;return nil;}
|
||||
- (void)refreshWithDocument:(NSDictionary*)doc time:(CMTime)time{
|
||||
_refreshing=YES;NSDictionary *saved=[doc copy];[_document release];_document=saved;_time=time;NSArray *masks=DYMasksForTool(doc,_nodeID);if(masks.count)[self buildControls];[_list removeAllItems];NSInteger selected=0,index=0;
|
||||
for(NSDictionary *m in masks){DYMaskParameters p=DYMaskAtTime(m,time);[_list addItemWithTitle:[NSString stringWithFormat:@"%@ %ld",@[@"椭圆",@"矩形",@"钢笔",@"线性渐变",@"HSL 选区",@"亮度选区"][p.kind],(long)index+1]];if([m[@"id"]isEqual:_maskID])selected=index;index++;}
|
||||
if(!masks.count){_contentHeight=0;_drawing=_canvasActive=NO;_refreshing=NO;return;}[_list selectItemAtIndex:selected];if(![_maskID isEqual:masks[selected][@"id"]])_drawing=_canvasActive=NO;[_maskID release];_maskID=[masks[selected][@"id"]copy];NSDictionary *m=[self mask];DYMaskParameters p=DYMaskAtTime(m,time);if(p.kind!=DYMaskBezier)_drawing=NO;
|
||||
_eye.state=[m[@"enabled"]boolValue]?NSControlStateValueOn:NSControlStateValueOff;_eye.image=[NSImage imageWithSystemSymbolName:[m[@"enabled"]boolValue]?@"eye":@"eye.slash" accessibilityDescription:@"启用蒙版"];[_combine selectItemAtIndex:[m[@"combine"]integerValue]];_invert.state=(p.flags&DYMaskInvert)?NSControlStateValueOn:NSControlStateValueOff;
|
||||
float values[]={p.strength,p.feather,p.centerX,p.centerY,p.width,p.height,float(p.angle*180.f/M_PI),p.gradientWidth,p.hueCenterTurns*360.f,p.hueCoreHalfWidth*360.f,p.hueSoftWidth*360.f,p.saturationRange.low,p.saturationRange.high,p.lightnessRange.low,p.lightnessRange.high,p.inputBlack,p.inputWhite,p.inputGamma};
|
||||
NSInteger visible=0;for(NSInteger i=0;i<_rows.count;i++){BOOL show=i==0||(i==1&&p.kind<3)||(i>=2&&i<=6&&p.kind<4)||(i==7&&p.kind==3)||(i>=8&&i<=14&&p.kind==4)||(i>=15&&p.kind>=4);NSDictionary *row=_rows[i];for(NSView *v in row.allValues)v.hidden=!show;if(!show)continue;visible++;double lo=0,hi=1;if(i==2||i==3)lo=-1,hi=2;if(i==4||i==5||i==7)lo=.001,hi=2;if(i==6)lo=-180,hi=180;if(i==8)hi=360;if(i==9||i==10)hi=180;if(i==15)hi=.99;if(i==16)lo=.01,hi=2;if(i==17)lo=.01,hi=4;NSSlider *slider=row[@"slider"];slider.minValue=lo;slider.maxValue=hi;slider.doubleValue=values[i];[row[@"field"]setStringValue:[NSString stringWithFormat:@"%.3f",values[i]]];}
|
||||
BOOL shape=p.kind<3;for(NSButton *b in _tracking)b.hidden=!shape;_trackingTitle.hidden=!shape;_clear.hidden=!shape;_clear.enabled=[m[@"keys"]count]>0;
|
||||
BOOL pen=p.kind==DYMaskBezier;_penRedraw.hidden=!pen;_penFinish.hidden=!pen;_penCancel.hidden=!pen;
|
||||
[self updateDrawingControls];
|
||||
_status.stringValue=m[@"status"]?:([m[@"keys"]count]?[NSString stringWithFormat:@"%lu 个轨迹键 · 修改几何会在当前帧建立手工键",(unsigned long)[m[@"keys"]count]]:pen?@"重画钢笔后,点击起点或“完成绘制”闭合;取消或 Esc 保留原路径。":@"各蒙版只影响当前工具层");
|
||||
// Keep every scalar readable at the narrowest native inspector width. A
|
||||
// label/value line and a separate full-width slider avoid compressed controls.
|
||||
_contentHeight=136+(pen?84:0)+visible*58+(shape?184:0)+58;[self setNeedsLayout:YES];_refreshing=NO;
|
||||
}
|
||||
- (void)layout{
|
||||
[super layout];CGFloat w=self.bounds.size.width;
|
||||
_eye.frame=NSMakeRect(0,4,32,34);_list.frame=NSMakeRect(38,4,MAX(60,w-114),34);_add.frame=NSMakeRect(w-70,4,32,34);_remove.frame=NSMakeRect(w-32,4,32,34);
|
||||
CGFloat combineWidth=MIN(112,MAX(90,w*.45));_combine.frame=NSMakeRect(0,46,combineWidth,34);_invert.frame=NSMakeRect(combineWidth+12,49,MAX(70,w-combineWidth-12),28);_canvas.frame=NSMakeRect(0,88,w,36);
|
||||
CGFloat y=136;if(_penRedraw&&!_penRedraw.hidden){CGFloat bw=(w-8)/2;_penRedraw.frame=NSMakeRect(0,y,bw,34);_penFinish.frame=NSMakeRect(bw+8,y,bw,34);_penCancel.frame=NSMakeRect(0,y+40,w,34);y+=84;}for(NSDictionary *r in _rows){NSTextField *label=r[@"label"];if(label.hidden)continue;label.frame=NSMakeRect(2,y+6,MAX(60,w-100),22);[r[@"field"]setFrame:NSMakeRect(w-90,y,88,32)];[r[@"slider"]setFrame:NSMakeRect(0,y+32,w,24)];y+=58;}
|
||||
if(_tracking.count&&![_tracking[0]isHidden]){_trackingTitle.frame=NSMakeRect(2,y+2,w-4,20);y+=28;CGFloat bw=(w-8)/2;const int order[]={0,4,1,3,2,5};for(int i=0;i<6;i++)[_tracking[order[i]]setFrame:NSMakeRect((i%2)*(bw+8),y+(i/2)*38,bw,34)];y+=114;_clear.frame=NSMakeRect(0,y,w,34);y+=42;}
|
||||
_status.frame=NSMakeRect(2,y+2,w-4,52);
|
||||
}
|
||||
- (void)edit:(NSString*)title block:(void (^)(NSMutableDictionary*,NSMutableDictionary*))block{
|
||||
id<FxCustomParameterActionAPI_v4>a=[_host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(_host,a.currentTime).document);NSMutableArray *masks=(id)DYMasksForTool(doc,_nodeID);NSMutableDictionary *mask=nil;for(NSMutableDictionary *m in masks)if([m[@"id"]isEqual:_maskID])mask=m;if(!mask)return;block(doc,mask);if(!DYValidToolDocument(doc)){NSBeep();return;}id<FxUndoAPI>undo=[_host apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:title];DYWriteTools(_host,doc,a.currentTime);[undo endUndoGroup];}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_host];}
|
||||
- (void)add:(id)sender{[self addMenu:_add];}
|
||||
- (void)addMenu:(NSView*)anchor{NSMenu *menu=[[[NSMenu alloc]initWithTitle:@"添加蒙版"]autorelease];for(int i=0;i<6;i++){NSMenuItem *item=[menu addItemWithTitle:@[@"椭圆",@"矩形",@"钢笔",@"线性渐变",@"HSL 选区",@"亮度选区"][i] action:@selector(addKind:) keyEquivalent:@""];item.target=self;item.tag=i;}[menu popUpMenuPositioningItem:nil atLocation:NSMakePoint(0,anchor.bounds.size.height) inView:anchor];}
|
||||
- (void)addKind:(NSMenuItem*)sender{
|
||||
id<FxCustomParameterActionAPI_v4>a=[_host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(_host,a.currentTime).document);NSMutableArray *masks=[[DYMasksForTool(doc,_nodeID)mutableCopy]autorelease];if(masks.count>=DYToolMaskLimit){NSBeep();return;}NSDictionary *mask=DYNewMask(sender.tag);[masks addObject:mask];if(!DYSetToolMasks(doc,_nodeID,masks))return;[_maskID release];_maskID=[mask[@"id"]copy];NSDictionary *staged=[doc copy];[_document release];_document=staged;[self sendCanvasDrawing:sender.tag==DYMaskBezier];id<FxUndoAPI>undo=[_host apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"添加工具蒙版"];DYWriteTools(_host,doc,a.currentTime);[undo endUndoGroup];[_maskID release];_maskID=[mask[@"id"]copy];}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_host];[self sendCanvasDrawing:sender.tag==DYMaskBezier];}
|
||||
- (void)selection:(id)sender{NSArray *m=DYMasksForTool(_document,_nodeID);if(_list.indexOfSelectedItem<0||_list.indexOfSelectedItem>=m.count)return;[_maskID release];_maskID=[m[_list.indexOfSelectedItem][@"id"]copy];[self refreshWithDocument:_document time:_time];[self canvas:nil];[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_host];}
|
||||
- (void)remove:(id)sender{[self edit:@"删除工具蒙版" block:^(NSMutableDictionary *doc,NSMutableDictionary *mask){NSMutableArray *masks=[[DYMasksForTool(doc,self->_nodeID)mutableCopy]autorelease];[masks removeObject:mask];DYSetToolMasks(doc,self->_nodeID,masks);}];[self canvas:nil];}
|
||||
- (void)enabled:(NSButton*)sender{[self edit:@"启停蒙版" block:^(NSMutableDictionary *d,NSMutableDictionary *m){m[@"enabled"]=@(sender.state==NSControlStateValueOn);}];}
|
||||
- (void)combine:(id)sender{[self edit:@"蒙版组合" block:^(NSMutableDictionary *d,NSMutableDictionary *m){m[@"combine"]=@(self->_combine.indexOfSelectedItem);}];}
|
||||
- (void)inverted:(NSButton*)sender{[self edit:@"反转蒙版" block:^(NSMutableDictionary *d,NSMutableDictionary *m){DYMaskParameters p;[m[@"parameters"]getBytes:&p length:sizeof(p)];if(sender.state)p.flags|=DYMaskInvert;else p.flags&=~DYMaskInvert;m[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];}];}
|
||||
- (void)valueChanged:(NSControl*)sender{if(_refreshing)return;double value=sender.doubleValue;if(!std::isfinite(value)){NSBeep();return;}NSInteger i=sender.tag;[self edit:@"调整工具蒙版" block:^(NSMutableDictionary *d,NSMutableDictionary *m){DYMaskParameters p=DYMaskAtTime(m,self->_time);float *fields[]={&p.strength,&p.feather,&p.centerX,&p.centerY,&p.width,&p.height,&p.angle,&p.gradientWidth,&p.hueCenterTurns,&p.hueCoreHalfWidth,&p.hueSoftWidth,&p.saturationRange.low,&p.saturationRange.high,&p.lightnessRange.low,&p.lightnessRange.high,&p.inputBlack,&p.inputWhite,&p.inputGamma};*fields[i]=(i==6?value*M_PI/180:i>=8&&i<=10?value/360:value);if(p.kind==DYMaskHSLKey)p.flags|=DYMaskHueEnabled|DYMaskSaturationEnabled|DYMaskLightnessEnabled;if(!dyValidMaskParameters(p))return;if([m[@"keys"]count]&&i<8){NSMutableArray *keys=[[m[@"keys"]mutableCopy]autorelease];[keys filterUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSDictionary *key,NSDictionary *bindings){CMTime t=CMTimeMakeWithEpoch([key[@"value"]longLongValue],[key[@"scale"]intValue],[key[@"epoch"]longLongValue]);return CMTimeCompare(t,self->_time)!=0;}]];[keys addObject:DYMaskKey(self->_time,p,YES,1)];[keys sortUsingComparator:^NSComparisonResult(NSDictionary *a,NSDictionary *b){CMTime x=CMTimeMakeWithEpoch([a[@"value"]longLongValue],[a[@"scale"]intValue],[a[@"epoch"]longLongValue]),y=CMTimeMakeWithEpoch([b[@"value"]longLongValue],[b[@"scale"]intValue],[b[@"epoch"]longLongValue]);return (NSComparisonResult)CMTimeCompare(x,y);}];m[@"keys"]=keys;}else m[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];}];}
|
||||
- (void)updateDrawingControls{for(NSButton *button in _tracking)button.enabled=!_drawing;_clear.enabled=!_drawing&&[[self mask][@"keys"]count]>0;_penFinish.enabled=_drawing;_penCancel.enabled=_drawing;}
|
||||
- (void)canvasSelected:(NSNotification*)n{_canvasActive=[n.userInfo[@"node"]isEqual:_nodeID]&&[n.userInfo[@"mask"]length];if(_canvasActive){NSString *ID=[n.userInfo[@"mask"]copy];[_maskID release];_maskID=ID;_drawing=[n.userInfo[@"draw"]boolValue];}else _drawing=NO;[self updateDrawingControls];}
|
||||
- (void)canvasState:(NSNotification*)n{if(!_canvasActive||![n.userInfo[@"node"]isEqual:_nodeID]||![n.userInfo[@"mask"]isEqual:_maskID])return;_drawing=[n.userInfo[@"drawing"]boolValue];[self updateDrawingControls];}
|
||||
- (void)sendCanvasDrawing:(BOOL)drawing{[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasSelection" object:_host userInfo:@{@"node":_nodeID,@"mask":_maskID?:@"",@"document":_document?:@{},@"draw":@(drawing)}];}
|
||||
- (void)canvas:(id)sender{[self sendCanvasDrawing:NO];}
|
||||
- (void)redrawPen:(id)sender{[self sendCanvasDrawing:YES];}
|
||||
- (void)penCommand:(NSButton*)sender{[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasCommand" object:_host userInfo:@{@"node":_nodeID,@"mask":_maskID?:@"",@"command":sender==_penFinish?@"finish":@"cancel",@"timeValue":@(_time.value),@"timeScale":@(_time.timescale),@"timeEpoch":@(_time.epoch)}];}
|
||||
- (void)clear:(id)sender{if(_drawing)return;[self edit:@"清除蒙版轨迹" block:^(NSMutableDictionary *d,NSMutableDictionary *m){DYMaskParameters p=DYMaskAtTime(m,self->_time);m[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];m[@"keys"]=@[];[m removeObjectForKey:@"status"];}];}
|
||||
- (void)track:(NSButton*)sender{if(_drawing)return;[self canvas:nil];[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolTrack" object:_host userInfo:@{@"node":_nodeID,@"mask":_maskID?:@"",@"direction":@(sender.tag)}];}
|
||||
- (void)trackingStatus:(NSNotification*)n{if([n.userInfo[@"node"]isEqual:_nodeID])_status.stringValue=n.userInfo[@"message"]?:@"";}
|
||||
@end
|
||||
@@ -0,0 +1,47 @@
|
||||
// Native inspector geometry/readability and pen command routing, without a GUI
|
||||
// document. Include inside DYDiagnostics' existing run/manager/renderer scope.
|
||||
{
|
||||
BOOL readable=YES,contained=YES,noOverlap=YES,penVisibility=YES;
|
||||
DYToolDocument *empty=[[[DYToolDocument alloc]init]autorelease];
|
||||
for(int kind=0;kind<6;kind++){
|
||||
NSMutableDictionary *document=DYMutablePlist(empty.document);
|
||||
document[@"baseMasks"][@"hsl"]=[NSMutableArray arrayWithObject:DYNewMask(kind)];
|
||||
DYWriteTools(manager,document,kCMTimeZero);
|
||||
DYInspector *inspector=[[[DYInspector alloc]initWithAPIManager:manager renderer:renderer]autorelease];
|
||||
[inspector refresh];NSDictionary *hslCard=nil;
|
||||
for(NSDictionary *card in [inspector valueForKey:@"_cards"])if([card[@"section"][@"key"]isEqual:@"hsl"])hslCard=card;
|
||||
NSView *panel=hslCard[@"maskPanel"];
|
||||
if(!panel){readable=contained=noOverlap=penVisibility=NO;continue;}
|
||||
NSArray *rows=[panel valueForKey:@"_rows"],*tracking=[panel valueForKey:@"_tracking"];
|
||||
NSButton *redraw=[panel valueForKey:@"_penRedraw"],*finish=[panel valueForKey:@"_penFinish"],*cancel=[panel valueForKey:@"_penCancel"];
|
||||
penVisibility&=redraw.hidden==(kind!=DYMaskBezier)&&finish.hidden==redraw.hidden&&cancel.hidden==redraw.hidden;
|
||||
for(NSNumber *width in @[@220,@300,@420]){
|
||||
CGFloat height=[[panel valueForKey:@"contentHeight"]doubleValue];[panel setFrameSize:NSMakeSize(width.doubleValue,height)];[panel layoutSubtreeIfNeeded];
|
||||
for(NSView *view in panel.subviews)if(!view.hidden)contained&=NSContainsRect(panel.bounds,view.frame)&&view.frame.size.width>0&&view.frame.size.height>0;
|
||||
for(NSDictionary *row in rows){NSTextField *label=row[@"label"],*field=row[@"field"];NSSlider *slider=row[@"slider"];if(label.hidden)continue;
|
||||
readable&=label.font.pointSize>=13&&field.font.pointSize>=13&&field.frame.size.width>=80&&field.frame.size.height>=30&&slider.frame.size.height>=24;
|
||||
noOverlap&=!NSIntersectsRect(label.frame,field.frame)&&!NSIntersectsRect(label.frame,slider.frame)&&!NSIntersectsRect(field.frame,slider.frame);
|
||||
}
|
||||
for(NSButton *button in tracking)if(!button.hidden)readable&=button.font.pointSize>=13&&button.frame.size.width>=100&&button.frame.size.height>=32;
|
||||
if(kind==DYMaskBezier)for(NSButton *button in @[redraw,finish,cancel])readable&=button.font.pointSize>=13&&button.frame.size.width>=100&&button.frame.size.height>=32;
|
||||
}
|
||||
if(kind==DYMaskBezier){
|
||||
NSMutableArray *events=[NSMutableArray array];NSNotificationCenter *center=NSNotificationCenter.defaultCenter;
|
||||
id selection=[center addObserverForName:@"DYToolCanvasSelection" object:manager queue:nil usingBlock:^(NSNotification *note){[events addObject:@{@"name":note.name,@"payload":note.userInfo?:@{}}];}];
|
||||
id command=[center addObserverForName:@"DYToolCanvasCommand" object:manager queue:nil usingBlock:^(NSNotification *note){[events addObject:@{@"name":note.name,@"payload":note.userInfo?:@{}}];}];
|
||||
[redraw performClick:nil];[finish performClick:nil];[cancel performClick:nil];
|
||||
BOOL routed=events.count==3&&[events[0][@"payload"][@"draw"]boolValue]&&[events[0][@"payload"][@"node"]isEqual:@"base:hsl"]&&[events[0][@"payload"][@"document"]isEqual:document]&&[events[1][@"payload"][@"command"]isEqual:@"finish"]&&[events[2][@"payload"][@"command"]isEqual:@"cancel"];
|
||||
for(NSDictionary *event in events)routed&=[event[@"payload"][@"mask"]isEqual:document[@"baseMasks"][@"hsl"][0][@"id"]];
|
||||
routed&=[events.lastObject[@"payload"][@"timeScale"]intValue]==kCMTimeZero.timescale;
|
||||
run.record(@"native-pen-panel-routes-redraw-finish-and-cancel-to-own-mask",routed);[center removeObserver:selection];[center removeObserver:command];
|
||||
[inspector refresh];BOOL drawingProtected=[[panel valueForKey:@"_drawing"]boolValue];for(NSButton *button in tracking)drawingProtected&=!button.enabled;drawingProtected&=![[panel valueForKey:@"_clear"]isEnabled];
|
||||
[center postNotificationName:@"DYToolCanvasState" object:manager userInfo:@{@"node":@"base:hsl",@"mask":@"different-mask",@"drawing":@NO}];drawingProtected&=[[panel valueForKey:@"_drawing"]boolValue];
|
||||
[center postNotificationName:@"DYToolCanvasState" object:manager userInfo:@{@"node":@"base:hsl",@"mask":document[@"baseMasks"][@"hsl"][0][@"id"],@"drawing":@NO}];BOOL restored=![[panel valueForKey:@"_drawing"]boolValue];for(NSButton *button in tracking)restored&=button.enabled;restored&=!finish.enabled&&!cancel.enabled;
|
||||
run.record(@"pen-panel-disables-tracking-through-refresh-and-restores-after-own-finish",drawingProtected&&restored);
|
||||
}
|
||||
}
|
||||
run.record(@"mask-panel-readable-fields-and-button-targets-at-native-narrow-width",readable);
|
||||
run.record(@"six-mask-panel-layouts-fit-220-300-and-420-point-widths",contained&&noOverlap);
|
||||
run.record(@"pen-drawing-actions-visible-only-for-bezier-mask",penVisibility);
|
||||
DYWriteTools(manager,empty.document,kCMTimeZero);
|
||||
}
|
||||
@@ -12,8 +12,12 @@ FOUNDATION_EXPORT void DYReadUniforms(id<PROAPIAccessing> manager,CMTime time,DY
|
||||
|
||||
@interface DYAssetState : NSObject<NSSecureCoding,NSCopying,FxCustomParameterInterpolation_v2>
|
||||
@property(copy) NSDictionary *paths;
|
||||
@property(nonatomic,copy) NSData *spiderMesh;
|
||||
@property BOOL spiderLinked;
|
||||
@end
|
||||
@interface DYInspectorToken : NSObject<NSSecureCoding,NSCopying,FxCustomParameterInterpolation_v2>
|
||||
@property(copy) NSDictionary *folds;
|
||||
@property NSInteger schema;
|
||||
@end
|
||||
FOUNDATION_EXPORT DYAssetState *DYReadAssets(id<PROAPIAccessing> manager,CMTime time);
|
||||
FOUNDATION_EXPORT BOOL DYWriteAssets(id<PROAPIAccessing> manager,DYAssetState *assets,CMTime time);
|
||||
+128
-17
@@ -1,5 +1,7 @@
|
||||
#import "DYModel.h"
|
||||
#import "DYToolState.h"
|
||||
#include <cmath>
|
||||
#include "DYSpiderState.h"
|
||||
NSString *const DYModelChanged=@"DYModelChanged";
|
||||
static NSMutableArray *sections,*descriptors;
|
||||
static UInt32 PID(NSUInteger offset){return 2000+(UInt32)offset/4;}
|
||||
@@ -7,16 +9,116 @@ static NSDictionary *row(NSString*k,NSString*t,NSUInteger o,double lo,double hi,
|
||||
NSMutableDictionary*r=[@{@"key":k,@"title":t,@"pid":@(PID(o)),@"offset":@(o),@"min":@(lo),@"max":@(hi),@"default":@(d),@"step":@(hi-lo>10?1:.01),@"kind":kind?:@"float"}mutableCopy];
|
||||
[descriptors addObject:r];return [r autorelease];
|
||||
}
|
||||
static void section(NSString*k,NSString*t,NSUInteger offset,NSArray*rows,double def=0){
|
||||
static void section(NSString*k,NSString*t,NSUInteger offset,NSArray*rows,double def=1){
|
||||
NSDictionary*e=row([k stringByAppendingString:@"Enabled"],t,offset,0,1,def,@"bool");
|
||||
[sections addObject:@{@"key":k,@"title":t,@"enabled":e[@"pid"],@"defaultEnabled":@(def),@"rows":rows}];
|
||||
}
|
||||
static NSDictionary *scalar(NSString*k,NSString*t,NSUInteger o,double lo=-100,double hi=100,double def=0){return row(k,t,o,lo,hi,def,@"float");}
|
||||
NSArray<NSDictionary *> *DYCMSceneSpaces(void) { return @[
|
||||
@{ @"id":@99, @"name":@"KOLOR Default" },
|
||||
@{ @"id":@1, @"name":@"ACEScct" },
|
||||
@{ @"id":@2, @"name":@"Apple Log" },
|
||||
@{ @"id":@3, @"name":@"Apple Log 2" },
|
||||
@{ @"id":@4, @"name":@"ARRI LogC3" },
|
||||
@{ @"id":@5, @"name":@"ARRI LogC4" },
|
||||
@{ @"id":@6, @"name":@"Blackmagic Film Gen 5" },
|
||||
@{ @"id":@7, @"name":@"Canon C-Log" },
|
||||
@{ @"id":@8, @"name":@"Canon C-Log 2" },
|
||||
@{ @"id":@9, @"name":@"Canon C-Log 3" },
|
||||
@{ @"id":@10, @"name":@"DaVinci Intermediate" },
|
||||
@{ @"id":@11, @"name":@"DJI D-Log" },
|
||||
@{ @"id":@12, @"name":@"DJI D-Log 2" },
|
||||
@{ @"id":@13, @"name":@"DJI D-Log M" },
|
||||
@{ @"id":@14, @"name":@"Fujifilm F-Log" },
|
||||
@{ @"id":@15, @"name":@"Fujifilm F-Log2" },
|
||||
@{ @"id":@16, @"name":@"Fujifilm F-Log2 C" },
|
||||
@{ @"id":@17, @"name":@"GoPro GP-Log" },
|
||||
@{ @"id":@18, @"name":@"GoPro GP-Log2" },
|
||||
@{ @"id":@30, @"name":@"GoPro GP-Log2 (Official, 0 EV)" },
|
||||
@{ @"id":@29, @"name":@"Insta I-Log" },
|
||||
@{ @"id":@19, @"name":@"Leica L-Log" },
|
||||
@{ @"id":@20, @"name":@"Linear" },
|
||||
@{ @"id":@21, @"name":@"Nikon N-Log" },
|
||||
@{ @"id":@22, @"name":@"Panasonic V-Log" },
|
||||
@{ @"id":@23, @"name":@"Phantom Log 1" },
|
||||
@{ @"id":@24, @"name":@"Phantom Log 2" },
|
||||
@{ @"id":@25, @"name":@"REDLog3G10" },
|
||||
@{ @"id":@26, @"name":@"Samsung Log" },
|
||||
@{ @"id":@27, @"name":@"Sony S-Log2" },
|
||||
@{ @"id":@28, @"name":@"Sony S-Log3" }
|
||||
]; }
|
||||
NSArray<NSDictionary *> *DYCMDisplaySpaces(void) { return @[
|
||||
@{ @"id":@1001, @"name":@"Gamma 2.2" },
|
||||
@{ @"id":@1002, @"name":@"Gamma 2.4" },
|
||||
@{ @"id":@1003, @"name":@"Gamma 2.6" }
|
||||
]; }
|
||||
NSArray<NSDictionary *> *DYCMGamuts(void) { return @[
|
||||
@{ @"id":@99, @"name":@"KOLOR Default" },
|
||||
@{ @"id":@1, @"name":@"ACES AP0" },
|
||||
@{ @"id":@2, @"name":@"ACES AP1" },
|
||||
@{ @"id":@3, @"name":@"Apple Log 2" },
|
||||
@{ @"id":@4, @"name":@"ARRI WG3" },
|
||||
@{ @"id":@5, @"name":@"ARRI WG4" },
|
||||
@{ @"id":@6, @"name":@"Blackmagic Wide Gamut" },
|
||||
@{ @"id":@7, @"name":@"Canon Cinema Gamut" },
|
||||
@{ @"id":@16, @"name":@"DaVinci Wide Gamut" },
|
||||
@{ @"id":@8, @"name":@"DJI Action 5" },
|
||||
@{ @"id":@9, @"name":@"DJI Air 2S" },
|
||||
@{ @"id":@10, @"name":@"DJI D-Gamut" },
|
||||
@{ @"id":@28, @"name":@"DJI D-Gamut 2" },
|
||||
@{ @"id":@11, @"name":@"DJI Mavic2 Pro" },
|
||||
@{ @"id":@12, @"name":@"DJI Mavic 3 Pro" },
|
||||
@{ @"id":@13, @"name":@"DJI Mini 4 Pro" },
|
||||
@{ @"id":@14, @"name":@"DJI Mini 5 Pro" },
|
||||
@{ @"id":@15, @"name":@"DJI Pocket 3" },
|
||||
@{ @"id":@17, @"name":@"Fujifilm F-GamutC" },
|
||||
@{ @"id":@18, @"name":@"GoPro GP-Log" },
|
||||
@{ @"id":@19, @"name":@"P3-DCI" },
|
||||
@{ @"id":@20, @"name":@"P3 D65" },
|
||||
@{ @"id":@21, @"name":@"Panasonic V-Gamut" },
|
||||
@{ @"id":@22, @"name":@"Rec.709 / BT.709" },
|
||||
@{ @"id":@23, @"name":@"Rec.2020 / BT.2020" },
|
||||
@{ @"id":@24, @"name":@"RED Wide Gamut RGB" },
|
||||
@{ @"id":@25, @"name":@"Sony S-Gamut" },
|
||||
@{ @"id":@26, @"name":@"Sony S-Gamut3" },
|
||||
@{ @"id":@27, @"name":@"Sony S-Gamut3.Cine" }
|
||||
]; }
|
||||
|
||||
static NSDictionary *cmRow(NSString*k,NSString*t,NSUInteger o,double lo,double hi,double def,int tab,NSArray *choices=nil){
|
||||
NSMutableDictionary *d=[[row(k,t,offsetof(DYUniforms,cm)+o,lo,hi,def,choices?@"popup":@"float")mutableCopy]autorelease];d[@"cmTab"]=@(tab);
|
||||
if(choices){d[@"notAnimatable"]=@YES;d[@"options"]=[choices valueForKey:@"name"];d[@"values"]=[choices valueForKey:@"id"];}
|
||||
[descriptors replaceObjectAtIndex:descriptors.count-1 withObject:d];return d;
|
||||
}
|
||||
static void initialize(){static dispatch_once_t once;dispatch_once(&once,^{
|
||||
sections=[[NSMutableArray alloc]init];descriptors=[[NSMutableArray alloc]init];
|
||||
NSMutableDictionary*profile=[[scalar(@"inputProfile",@"相机输入",52,0,17)mutableCopy]autorelease];profile[@"kind"]=@"popup";profile[@"options"]=@[@"无",@"Apple Log",@"ARRI LogC3",@"ARRI LogC4",@"Blackmagic Film Gen5",@"Canon C-Log",@"Canon C-Log2",@"Canon C-Log3",@"DJI D-Log",@"DJI D-Log M",@"Fujifilm F-Log",@"Fujifilm F-Log2",@"Nikon N-Log",@"Panasonic V-Log",@"RED Log3G10",@"Sony S-Log2",@"Sony S-Log3",@"Sony HLG"];
|
||||
[descriptors replaceObjectAtIndex:0 withObject:profile];
|
||||
section(@"input",@"输入 / LUT",132,@[profile,scalar(@"preLUTStrength",@"输入强度",56,0,1,1)]);
|
||||
// Legacy IDs remain registered for existing FCP documents and presets.
|
||||
scalar(@"preLUTStrength",@"旧版输入强度",56,0,1,1);
|
||||
row(@"cmConfigured",@"CST 配置版本",offsetof(DYUniforms,cm)+offsetof(DYCMSettings,configured),-1,1,0,@"bool");
|
||||
NSArray *transfers=[DYCMSceneSpaces() arrayByAddingObjectsFromArray:DYCMDisplaySpaces()];
|
||||
NSMutableArray *cm=[NSMutableArray array];
|
||||
#define CM(f,t,lo,hi,def,tab) [cm addObject:cmRow(@"cm" #f,t,offsetof(DYCMSettings,f),lo,hi,def,tab)]
|
||||
#define CH(f,t,def,tab,list) [cm addObject:cmRow(@"cm" #f,t,offsetof(DYCMSettings,f),0,1003,def,tab,list)]
|
||||
CM(inputEnabled,@"输入转换启用",0,1,1,0);
|
||||
CH(inputTransfer,@"输入曲线",28,0,transfers);CH(inputGamut,@"输入色域",27,0,DYCMGamuts());
|
||||
CH(workingTransfer,@"工作曲线",10,0,transfers);CH(workingGamut,@"工作色域",16,0,DYCMGamuts());
|
||||
CM(mix,@"CST 混合",0,1,1,0);
|
||||
CM(basisEnabled,@"一级调色启用",0,1,1,1);
|
||||
CM(exposure,@"一级曝光",-5,5,0,1);CM(balanceAngle,@"色彩平衡方向",0,360,0,1);CM(balanceStrength,@"色彩平衡强度",0,1,0,1);CM(saturation,@"一级饱和度",0,2,1,1);
|
||||
CM(contrast,@"一级对比度",-1,1,0,1);CM(pivot,@"对比度轴心",-3,3,0,1);CM(hiContrast,@"高光对比度",-1,1,0,1);CM(hiPivot,@"高光轴心",-1,1,0,1);CM(shadowContrast,@"阴影对比度",-1,1,0,1);CM(shadowPivot,@"阴影轴心",-1,1,0,1);
|
||||
CM(white,@"白点",.5,1.5,1,1);CM(shoulder,@"肩部压缩",0,1,.5,1);CM(highlights,@"一级高光",-1,1,0,1);CM(midtones,@"一级中间调",-1,1,0,1);CM(shadows,@"一级阴影",-1,1,0,1);CM(black,@"黑点",-1,1,0,1);CM(toe,@"趾部压缩",0,1,.5,1);CM(chromaMix,@"色度混合",0,1,.5,1);
|
||||
CM(bypassExposure,@"旁路一级曝光",0,1,0,1);CM(bypassBalance,@"旁路一级色彩",0,1,0,1);CM(bypassContrast,@"旁路一级对比",0,1,0,1);CM(bypassTone,@"旁路一级影调",0,1,0,1);
|
||||
CM(outputEnabled,@"输出转换启用",0,1,1,2);CH(outputTransfer,@"输出曲线",1002,2,transfers);CH(outputGamut,@"输出色域",22,2,DYCMGamuts());
|
||||
[cm addObject:cmRow(@"cmtoneMapping",@"自动色调映射",offsetof(DYCMSettings,toneMapping),0,1,0,2,@[@{@"id":@0,@"name":@"关闭"},@{@"id":@1,@"name":@"开启"}])];
|
||||
#undef CM
|
||||
#undef CH
|
||||
NSMutableArray *input=[NSMutableArray array],*primary=[NSMutableArray array],*output=[NSMutableArray array];
|
||||
for(NSDictionary *d in cm){NSString *key=d[@"key"];if([@[@"cminputEnabled",@"cmbasisEnabled",@"cmoutputEnabled"]containsObject:key])continue;[([d[@"cmTab"]intValue]==0?input:[d[@"cmTab"]intValue]==1?primary:output) addObject:d];}
|
||||
section(@"input",@"输入转换 / CST",132,input);
|
||||
// Enable descriptors already exist; do not register the same offset twice.
|
||||
[sections addObject:@{@"key":@"primary",@"title":@"一级调色",@"enabled":@(PID(offsetof(DYUniforms,cm)+offsetof(DYCMSettings,basisEnabled))),@"defaultEnabled":@1,@"rows":primary}];
|
||||
[sections addObject:@{@"key":@"output",@"title":@"输出转换 / CST",@"enabled":@(PID(offsetof(DYUniforms,cm)+offsetof(DYCMSettings,outputEnabled))),@"defaultEnabled":@1,@"rows":output}];
|
||||
NSMutableArray*base=[NSMutableArray array];
|
||||
NSArray*names=@[@"曝光",@"对比度",@"高光",@"阴影",@"白色色阶",@"黑色色阶",@"色温",@"色调",@"饱和度",@"鲜艳度",@"纹理",@"清晰度",@"去朦胧"];
|
||||
NSArray*keys=@[@"exposure",@"contrast",@"highlights",@"shadows",@"whites",@"blacks",@"temperature",@"tint",@"saturation",@"vibrance",@"texture",@"clarity",@"dehaze"];
|
||||
@@ -26,9 +128,11 @@ static void initialize(){static dispatch_once_t once;dispatch_once(&once,^{
|
||||
[descriptors replaceObjectAtIndex:[descriptors indexOfObjectPassingTest:^BOOL(id obj,NSUInteger idx,BOOL*stop){return [obj[@"key"]isEqual:keys[i]];}] withObject:r];[base addObject:r];
|
||||
}
|
||||
NSDictionary*copyAuto=@{@"key":@"copyAutoGrade",@"title":@"复制时自动调色",@"pid":@8800,@"offset":@(-1),@"min":@0,@"max":@1,@"default":@0,@"step":@1,@"kind":@"bool",@"notAnimatable":@YES};[descriptors addObject:copyAuto];
|
||||
row(@"primaryMasterEnabled",@"一级调色总开关",offsetof(DYUniforms,primarySectionEnabled),0,1,1,@"bool");
|
||||
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)],0);
|
||||
section(@"skin",@"肤色保护",464,@[scalar(@"skinStrength",@"保护程度",468,0,100,60),scalar(@"skinHue",@"肤色色相",472,0,60,28)],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);
|
||||
@@ -49,36 +153,43 @@ static void initialize(){static dispatch_once_t once;dispatch_once(&once,^{
|
||||
[grade addObject:scalar(@"gradingBlending",@"混合",404,0,100,50)];[grade addObject:scalar(@"gradingBalance",@"平衡",408)];section(@"grading",@"颜色分级",400,grade);
|
||||
NSMutableArray*prim=[NSMutableArray array];for(int c=0;c<3;c++)for(int a=0;a<2;a++)[prim addObject:scalar([NSString stringWithFormat:@"primary%d_%d",c,a],[NSString stringWithFormat:@"%@原色 %@",@[@"红",@"绿",@"蓝"][c],a?@"饱和度":@"色相"],484+c*8+a*4)];section(@"primaries",@"三原色",480,prim);
|
||||
NSMutableArray*levels=[NSMutableArray array];for(int c=0;c<4;c++)for(int a=0;a<5;a++)[levels addObject:scalar([NSString stringWithFormat:@"level%d_%d",c,a],[NSString stringWithFormat:@"%@ %@",@[@"RGB",@"红",@"绿",@"蓝"][c],@[@"输入黑",@"伽马",@"输入白",@"输出黑",@"输出白"][a]],624+a*16+c*4,a==1?.1:0,a==1?10:255,a==1?1:(a==2||a==4)?255:0)];section(@"levels",@"色阶",608,levels);
|
||||
NSMutableArray*bw=[NSMutableArray array];for(int c=0;c<6;c++)[bw addObject:scalar([NSString stringWithFormat:@"bw%d",c],[NSString stringWithFormat:@"黑白 %@",@[@"红",@"黄",@"绿",@"青",@"蓝",@"洋红"][c]],c<4?720+c*4:736+(c-4)*4,0,200,((double[]){40,60,40,60,20,80})[c])];[bw addObject:scalar(@"bwHue",@"着色色相",744,0,360)];[bw addObject:scalar(@"bwSat",@"着色饱和度",748,0,100)];section(@"blackwhite",@"黑白混色",704,bw,0);
|
||||
NSMutableArray*bw=[NSMutableArray array];for(int c=0;c<6;c++)[bw addObject:scalar([NSString stringWithFormat:@"bw%d",c],[NSString stringWithFormat:@"黑白 %@",@[@"红",@"黄",@"绿",@"青",@"蓝",@"洋红"][c]],c<4?720+c*4:736+(c-4)*4,0,200,((double[]){40,60,40,60,20,80})[c])];[bw addObject:scalar(@"bwHue",@"着色色相",744,0,360)];[bw addObject:scalar(@"bwSat",@"着色饱和度",748,0,100)];[bw insertObject:scalar(@"blackWhiteMix",@"黑白混合",offsetof(DYUniforms,cm)+offsetof(DYCMSettings,blackWhiteMix),0,1,0) atIndex:0];section(@"blackwhite",@"黑白混色",704,bw,1);
|
||||
NSMutableArray*balance=[NSMutableArray arrayWithObject:row(@"preserveLuma",@"保持明度",756,0,1,1,@"bool")];for(int c=0;c<3;c++)for(int a=0;a<3;a++)[balance addObject:scalar([NSString stringWithFormat:@"balance%d_%d",c,a],[NSString stringWithFormat:@"%@ %@",@[@"阴影",@"中间调",@"高光"][c],@[@"青 ↔ 红",@"洋红 ↔ 绿",@"黄 ↔ 蓝"][a]],768+c*16+a*4)];section(@"balance",@"色彩平衡",752,balance);
|
||||
});}
|
||||
NSArray<NSDictionary*> *DYSections(void){initialize();return sections;} NSArray<NSDictionary*> *DYDescriptors(void){initialize();return descriptors;}
|
||||
void DYDefaultUniforms(DYUniforms*u){memset(u,0,sizeof(*u));for(NSDictionary*r in DYDescriptors())if([r[@"offset"]integerValue]>=0)*(float*)((uint8_t*)u+[r[@"offset"]unsignedIntegerValue])=[r[@"default"]floatValue];u->primariesM0=(DYFloat3){1,0,0};u->primariesM1=(DYFloat3){0,1,0};u->primariesM2=(DYFloat3){0,0,1};}
|
||||
void DYReadUniforms(id<PROAPIAccessing>m,CMTime t,DYUniforms*u){DYDefaultUniforms(u);id<FxParameterRetrievalAPI_v6>g=[m apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];for(NSDictionary*r in DYDescriptors()){if([r[@"offset"]integerValue]<0)continue;double v=[r[@"default"]doubleValue];if([g getFloatValue:&v fromParameter:[r[@"pid"]unsignedIntValue] atTime:t]&&std::isfinite(v))*(float*)((uint8_t*)u+[r[@"offset"]unsignedIntegerValue])=fmin([r[@"max"]doubleValue],fmax([r[@"min"]doubleValue],v));}}
|
||||
void DYReadUniforms(id<PROAPIAccessing>m,CMTime t,DYUniforms*u){DYDefaultUniforms(u);id<FxParameterRetrievalAPI_v6>g=[m apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];for(NSDictionary*r in DYDescriptors()){if([r[@"offset"]integerValue]<0)continue;double v=[r[@"default"]doubleValue];if([g getFloatValue:&v fromParameter:[r[@"pid"]unsignedIntValue] atTime:t]&&std::isfinite(v)){if(r[@"values"]&&![r[@"values"]containsObject:@((int)llround(v))])v=[r[@"default"]doubleValue];*(float*)((uint8_t*)u+[r[@"offset"]unsignedIntegerValue])=fmin([r[@"max"]doubleValue],fmax([r[@"min"]doubleValue],v));}}NSObject<NSSecureCoding,NSCopying> *token=nil;[g getCustomParameterValue:&token fromParameter:DYInspectorParameterID atTime:t];
|
||||
if([token isKindOfClass:DYInspectorToken.class]&&[(DYInspectorToken*)token schema]<2){if(u->cm.configured<.5)u->cm.configured=-1;u->cm.blackWhiteMix=1;}
|
||||
}
|
||||
BOOL DYCreateParameters(id<PROAPIAccessing>m,NSError**error){id<FxParameterCreationAPI_v5>a=[m apiForProtocol:@protocol(FxParameterCreationAPI_v5)];BOOL ok=a!=nil;
|
||||
ok=[a addCustomParameterWithName:@"大鱼调色" parameterID:DYInspectorParameterID defaultValue:[[[DYInspectorToken alloc]init]autorelease] parameterFlags:kFxParameterFlag_CUSTOM_UI|kFxParameterFlag_USE_FULL_VIEW_WIDTH|kFxParameterFlag_DONT_DISPLAY_IN_DASHBOARD|kFxParameterFlag_NOT_ANIMATABLE]&&ok;
|
||||
for(NSDictionary*r in DYDescriptors())ok=[a addFloatSliderWithName:r[@"title"] parameterID:[r[@"pid"]unsignedIntValue] defaultValue:[r[@"default"]doubleValue] parameterMin:[r[@"min"]doubleValue] parameterMax:[r[@"max"]doubleValue] sliderMin:[r[@"min"]doubleValue] sliderMax:[r[@"max"]doubleValue] delta:[r[@"step"]doubleValue] parameterFlags:kFxParameterFlag_HIDDEN|([r[@"notAnimatable"]boolValue]?kFxParameterFlag_NOT_ANIMATABLE:0)]&&ok;
|
||||
ok=[a addCustomParameterWithName:@"LUT 文件" parameterID:DYAssetsParameterID defaultValue:[[[DYAssetState alloc]init]autorelease] parameterFlags:kFxParameterFlag_HIDDEN|kFxParameterFlag_NOT_ANIMATABLE]&&ok;
|
||||
ok=[a addCustomParameterWithName:@"工具与蒙版" parameterID:DYToolsParameterID defaultValue:[[[DYToolDocument alloc]init]autorelease] parameterFlags:kFxParameterFlag_HIDDEN|kFxParameterFlag_NOT_ANIMATABLE]&&ok;
|
||||
ok=[a addStringParameterWithName:@"蒙版画布会话" parameterID:DYCanvasSessionParameterID defaultValue:@"" parameterFlags:kFxParameterFlag_HIDDEN|kFxParameterFlag_NOT_ANIMATABLE|kFxParameterFlag_DONT_SAVE]&&ok;
|
||||
if(!ok&&error)*error=[NSError errorWithDomain:FxPlugErrorDomain code:kFxError_InvalidParameter userInfo:@{NSLocalizedDescriptionKey:@"无法创建大鱼调色参数"}];return ok;}
|
||||
@implementation DYAssetState
|
||||
+ (BOOL)supportsSecureCoding{return YES;}
|
||||
- (instancetype)init{if((self=[super init]))_paths=[@{}copy];return self;}
|
||||
- (void)dealloc{[_paths release];[super dealloc];}
|
||||
- (void)encodeWithCoder:(NSCoder*)c{[c encodeObject:_paths forKey:@"paths"];}
|
||||
- (instancetype)initWithCoder:(NSCoder*)c{if((self=[self init])){NSSet*s=[NSSet setWithObjects:NSDictionary.class,NSString.class,nil];NSDictionary*d=[c decodeObjectOfClasses:s forKey:@"paths"];if(d)self.paths=d;}return self;}
|
||||
- (id)copyWithZone:(NSZone*)z{DYAssetState*v=[[[self class]allocWithZone:z]init];v.paths=_paths;return v;}
|
||||
- (instancetype)init{if((self=[super init])){_paths=[@{}copy];_spiderLinked=YES;}return self;}
|
||||
- (void)dealloc{[_spiderMesh release];[_paths release];[super dealloc];}
|
||||
- (void)encodeWithCoder:(NSCoder*)c{[c encodeObject:_paths forKey:@"paths"];[c encodeObject:_spiderMesh forKey:@"spiderMesh"];[c encodeBool:_spiderLinked forKey:@"spiderLinked"];}
|
||||
- (instancetype)initWithCoder:(NSCoder*)c{if((self=[self init])){NSSet*s=[NSSet setWithObjects:NSDictionary.class,NSString.class,nil];NSDictionary*d=[c decodeObjectOfClasses:s forKey:@"paths"];if(d)self.paths=d;if([c containsValueForKey:@"spiderMesh"])self.spiderMesh=[c decodeObjectOfClass:NSData.class forKey:@"spiderMesh"];_spiderLinked=[c containsValueForKey:@"spiderLinked"]?[c decodeBoolForKey:@"spiderLinked"]:YES;}return self;}
|
||||
- (id)copyWithZone:(NSZone*)z{DYAssetState*v=[[[self class]allocWithZone:z]init];v.paths=_paths;v.spiderMesh=_spiderMesh;v.spiderLinked=_spiderLinked;return v;}
|
||||
- (id)interpolateBetween:(id)r withWeight:(float)w{return w<.5?[[self copy]autorelease]:[[r copy]autorelease];}
|
||||
- (BOOL)isEqual:(id)o{return [o isKindOfClass:self.class]&&[_paths isEqual:[o paths]];}
|
||||
- (NSUInteger)hash{return _paths.hash;}
|
||||
- (BOOL)isEqual:(id)o{return [o isKindOfClass:self.class]&&[_paths isEqual:[o paths]]&&[_spiderMesh?:[NSData data] isEqual:[o spiderMesh]?:[NSData data]]&&_spiderLinked==[o spiderLinked];}
|
||||
- (void)setSpiderMesh:(NSData *)data{if(data.length&&!DYSpiderMeshIsValid(data))return;if(_spiderMesh!=data){[_spiderMesh release];_spiderMesh=[data copy];}}
|
||||
- (NSUInteger)hash{return _paths.hash^_spiderMesh.hash^_spiderLinked;}
|
||||
@end
|
||||
@implementation DYInspectorToken
|
||||
+ (BOOL)supportsSecureCoding{return YES;}
|
||||
- (void)encodeWithCoder:(NSCoder*)c{[c encodeInt:1 forKey:@"schema"];}
|
||||
- (instancetype)initWithCoder:(NSCoder*)c{return [self init];}
|
||||
- (id)copyWithZone:(NSZone*)z{return [[[self class]allocWithZone:z]init];}
|
||||
- (instancetype)init{if((self=[super init])){_folds=[@{} copy];_schema=2;}return self;}
|
||||
- (void)dealloc{[_folds release];[super dealloc];}
|
||||
- (void)encodeWithCoder:(NSCoder*)c{[c encodeInteger:_schema forKey:@"schema"];[c encodeObject:_folds forKey:@"folds"];}
|
||||
- (instancetype)initWithCoder:(NSCoder*)c{if((self=[self init])){NSDictionary *v=[c containsValueForKey:@"folds"]?[c decodeObjectOfClasses:[NSSet setWithObjects:NSDictionary.class,NSString.class,NSNumber.class,nil] forKey:@"folds"]:nil;if(v)self.folds=v;_schema=[c decodeIntegerForKey:@"schema"];}return self;}
|
||||
- (id)copyWithZone:(NSZone*)z{DYInspectorToken *v=[[[self class]allocWithZone:z]init];v.folds=_folds;v.schema=_schema;return v;}
|
||||
- (id)interpolateBetween:(id)r withWeight:(float)w{return [[self copy]autorelease];}
|
||||
- (BOOL)isEqual:(id)o{return [o isKindOfClass:self.class];}
|
||||
- (NSUInteger)hash{return 1;}
|
||||
- (BOOL)isEqual:(id)o{return [o isKindOfClass:self.class]&&_schema==[o schema]&&[_folds isEqual:[o folds]];}
|
||||
- (NSUInteger)hash{return _folds.hash;}
|
||||
@end
|
||||
DYAssetState*DYReadAssets(id<PROAPIAccessing>m,CMTime t){DYAssetState*v=nil;id<FxParameterRetrievalAPI_v6>g=[m apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)];[g getCustomParameterValue:&v fromParameter:DYAssetsParameterID atTime:t];return [v isKindOfClass:DYAssetState.class]?v:[[[DYAssetState alloc]init]autorelease];}
|
||||
BOOL DYWriteAssets(id<PROAPIAccessing>m,DYAssetState*v,CMTime t){id<FxParameterSettingAPI_v6>s=[m apiForProtocol:@protocol(FxParameterSettingAPI_v6)];return [s setCustomParameterValue:v toParameter:DYAssetsParameterID atTime:t];}
|
||||
@@ -0,0 +1,86 @@
|
||||
// Native spider geometry/gestures and CST wheel interaction are ported from
|
||||
// the recorded sibling source repositories; the adapter writes this host model.
|
||||
#include "DYSpiderDisc.inc.h"
|
||||
@interface DYSpiderPanel : DYFlippedView
|
||||
@property(nonatomic,assign) id<DYGraphicDelegate> delegate;
|
||||
- (void)setMesh:(NSData *)mesh linked:(BOOL)linked;
|
||||
@end
|
||||
@implementation DYSpiderPanel {
|
||||
DYSpiderDisc *_disc; NSPopUpButton *_hues,*_saturation; NSButton *_link;
|
||||
NSTextField *_status; BOOL _linked;
|
||||
}
|
||||
- (instancetype)initWithFrame:(NSRect)frame {
|
||||
if((self=[super initWithFrame:frame])){
|
||||
_linked=YES;_disc=[[DYSpiderDisc alloc]initWithFrame:NSZeroRect];[self addSubview:_disc];
|
||||
__block DYSpiderPanel *owner=self;
|
||||
_disc.changed=^(DYGrade g,NSData *pins){if(owner.delegate)[owner.delegate writeSpiderMesh:owner->_disc.meshData linked:owner->_linked];};
|
||||
_disc.gesture=^(BOOL begin){[owner.delegate graphicGesture:begin title:@"调整蜘蛛盘"];};
|
||||
_status=[DYLabel(@"拖动一点,同列自由点联动。⌘ 多选,Shift 固定,右键复位。",10)retain];_status.maximumNumberOfLines=2;[self addSubview:_status];
|
||||
_disc.selectionChanged=^(NSString *text){owner->_status.stringValue=text;};
|
||||
for(int axis=0;axis<2;axis++){
|
||||
NSPopUpButton *menu=[[NSPopUpButton alloc]initWithFrame:NSZeroRect pullsDown:NO];for(int n:{6,8,12,16,24}){[menu addItemWithTitle:[NSString stringWithFormat:@"%d",n]];menu.lastItem.tag=n;}
|
||||
menu.font=[NSFont systemFontOfSize:11];menu.target=self;menu.action=@selector(resolutionChanged:);menu.accessibilityLabel=axis?@"蜘蛛盘饱和度点数":@"蜘蛛盘色相点数";[self addSubview:menu];if(axis)_saturation=menu;else _hues=menu;
|
||||
NSTextField *label=DYLabel(axis?@"饱和度":@"色相",10);label.tag=101+axis;[self addSubview:label];
|
||||
}
|
||||
_link=[[NSButton checkboxWithTitle:@"联动" target:self action:@selector(linkChanged:)]retain];_link.font=[NSFont systemFontOfSize:10];_link.accessibilityLabel=@"联动蜘蛛盘点数";[self addSubview:_link];
|
||||
NSArray *titles=@[@"固定 / 取消固定",@"重置蜘蛛盘",@"选择整环",@"选择色相列",@"复位所选"];
|
||||
for(int i=0;i<5;i++){NSButton *b=DYButton(titles[i],self,@selector(command:));b.tag=201+i;b.font=[NSFont systemFontOfSize:10];b.accessibilityLabel=titles[i];[self addSubview:b];}
|
||||
[self setMesh:nil linked:YES];
|
||||
}return self;
|
||||
}
|
||||
- (void)dealloc{_disc.changed=nil;_disc.gesture=nil;_disc.selectionChanged=nil;[_disc release];[_hues release];[_saturation release];[_link release];[_status release];[super dealloc];}
|
||||
- (void)setMesh:(NSData *)data linked:(BOOL)linked{auto m=DYSpiderMesh(data);_disc.meshData=[NSData dataWithBytes:&m length:sizeof(m)];_linked=linked;[_hues selectItemWithTag:m.hues];[_saturation selectItemWithTag:m.rings+1];_link.state=linked?NSControlStateValueOn:NSControlStateValueOff;}
|
||||
- (void)layout{[super layout];CGFloat w=self.bounds.size.width;_disc.frame=NSMakeRect(0,0,w,300);
|
||||
[[self viewWithTag:101]setFrame:NSMakeRect(0,307,32,20)];_hues.frame=NSMakeRect(33,301,60,27);
|
||||
[[self viewWithTag:102]setFrame:NSMakeRect(99,307,43,20)];_saturation.frame=NSMakeRect(142,301,60,27);_link.frame=NSMakeRect(MAX(205,w-61),304,61,23);
|
||||
_status.frame=NSMakeRect(2,334,w-4,36);CGFloat gap=5,bw=(w-gap)/2;
|
||||
for(int i=0;i<2;i++)[[self viewWithTag:201+i]setFrame:NSMakeRect(i*(bw+gap),375,bw,27)];bw=(w-gap*2)/3;
|
||||
for(int i=0;i<3;i++)[[self viewWithTag:203+i]setFrame:NSMakeRect(i*(bw+gap),406,bw,27)];}
|
||||
- (void)resolutionChanged:(NSPopUpButton *)sender{int h=(int)_hues.selectedTag,s=(int)_saturation.selectedTag;if(_linked)h=s=(int)sender.selectedTag;[_disc changeHueCount:h saturationCount:s];}
|
||||
- (void)linkChanged:(NSButton *)sender{_linked=sender.state==NSControlStateValueOn;if(_linked&&_disc.hueCount!=_disc.saturationCount)[_disc changeHueCount:(int)_disc.hueCount saturationCount:(int)_disc.hueCount];else[_delegate writeSpiderMesh:_disc.meshData linked:_linked];}
|
||||
- (void)command:(NSButton *)sender{switch(sender.tag){case 201:[_disc toggleLock];break;case 202:[_disc resetMesh];break;case 203:[_disc selectRing];break;case 204:[_disc selectSpoke];break;case 205:[_disc resetSelected];break;}}
|
||||
@end
|
||||
|
||||
@interface DYPrimaryBalanceWheel : NSView
|
||||
@property(nonatomic,assign) id<DYGraphicDelegate> delegate;
|
||||
- (void)setValues:(NSDictionary *)values;
|
||||
@end
|
||||
@implementation DYPrimaryBalanceWheel {
|
||||
NSPoint _offset,_dragStartMouse,_dragStartOffset;BOOL _dragging,_gestureActive;
|
||||
NSImage *_wheel;NSButton *_reset;float _angle,_strength;
|
||||
}
|
||||
- (instancetype)initWithFrame:(NSRect)frame{if((self=[super initWithFrame:frame])){NSString *path=[[NSBundle bundleForClass:self.class]pathForResource:@"Basis_balanceWheel" ofType:@"png"];if(path)_wheel=[[NSImage alloc]initWithContentsOfFile:path];self.accessibilityLabel=@"一级白平衡色轮";self.toolTip=@"拖动调整一级白平衡(精细移动);双击复位。方向键微调。";
|
||||
_reset=[DYButton(@"复位",self,@selector(resetBalance:))retain];_reset.accessibilityLabel=@"复位一级白平衡";_reset.toolTip=@"仅复位一级白平衡的方向和强度";[self addSubview:_reset];}return self;}
|
||||
- (void)dealloc{[self finishGesture];[_wheel release];[_reset release];[super dealloc];}
|
||||
- (void)layout{[super layout];_reset.frame=NSMakeRect(MAX(0,self.bounds.size.width-62),0,60,24);}
|
||||
- (BOOL)isAccessibilityElement{return YES;}
|
||||
- (NSString *)accessibilityRole{return NSAccessibilityButtonRole;}
|
||||
- (NSArray *)accessibilityChildren{return @[_reset];}
|
||||
- (NSString *)accessibilityHelp{return self.toolTip;}
|
||||
- (id)accessibilityValue{return [NSString stringWithFormat:@"方向 %.1f 度,强度 %.1f%%",_angle,_strength*100];}
|
||||
- (BOOL)accessibilityPerformPress{[self.window makeFirstResponder:self];return YES;}
|
||||
- (BOOL)acceptsFirstResponder{return YES;}
|
||||
- (BOOL)acceptsFirstMouse:(NSEvent *)e{return YES;}
|
||||
- (CGFloat)maxDistance{return MAX(1,MIN(self.bounds.size.width,self.bounds.size.height-28)*.5-12);}
|
||||
- (NSPoint)center{return NSMakePoint(NSMidX(self.bounds),NSMidY(self.bounds)+10);}
|
||||
- (void)setValues:(NSDictionary *)values{_angle=[values[@"cmbalanceAngle"]floatValue];_strength=[values[@"cmbalanceStrength"]floatValue];double angle=(_angle+104)*M_PI/180;_offset=NSMakePoint(cos(angle)*_strength*self.maxDistance,sin(angle)*_strength*self.maxDistance);[self setNeedsDisplay:YES];}
|
||||
- (void)finishGesture{if(_gestureActive){_gestureActive=NO;[_delegate graphicGesture:NO title:@"调整一级白平衡"];}}
|
||||
- (void)resetBalance:(id)sender{[self finishGesture];_dragging=NO;[_delegate graphicGesture:YES title:@"复位一级白平衡"];_offset=NSZeroPoint;_angle=_strength=0;[_delegate writeGraphicValues:@{@"cmbalanceAngle":@0,@"cmbalanceStrength":@0}];[_delegate graphicGesture:NO title:@"复位一级白平衡"];[self setNeedsDisplay:YES];}
|
||||
- (void)viewWillMoveToWindow:(NSWindow *)w{if(!w)[self finishGesture];[super viewWillMoveToWindow:w];}
|
||||
- (void)pushValue{
|
||||
_strength=(float)(hypot(_offset.x,_offset.y)/self.maxDistance);_angle=(float)fmod(atan2(_offset.y,_offset.x)*180/M_PI+360-104,360);
|
||||
[_delegate writeGraphicValues:@{@"cmbalanceAngle":@(_angle),@"cmbalanceStrength":@(_strength)}];[self setNeedsDisplay:YES];
|
||||
}
|
||||
- (void)drawRect:(NSRect)dirty{NSPoint c=self.center;CGFloat r=self.maxDistance;[_wheel drawInRect:NSMakeRect(c.x-r,c.y-r,2*r,2*r) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1];
|
||||
[NSColor.whiteColor setFill];[[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(c.x+_offset.x-4,c.y+_offset.y-4,8,8)]fill];
|
||||
NSString *text=[NSString stringWithFormat:@"一级白平衡 %.1f° · %.1f%%",_angle,_strength*100];[text drawAtPoint:NSMakePoint(8,3) withAttributes:@{NSFontAttributeName:[NSFont systemFontOfSize:10],NSForegroundColorAttributeName:DYInk()}];
|
||||
}
|
||||
- (void)mouseDown:(NSEvent *)e{[self.window makeFirstResponder:self];if(e.clickCount==2){[self resetBalance:nil];return;}
|
||||
NSPoint p=[self convertPoint:e.locationInWindow fromView:nil],c=self.center;NSPoint knob=NSMakePoint(c.x+_offset.x,c.y+_offset.y);if(hypot(p.x-knob.x,p.y-knob.y)<self.maxDistance){_dragging=YES;_dragStartMouse=p;_dragStartOffset=_offset;}}
|
||||
- (void)mouseDragged:(NSEvent *)e{if(!_dragging)return;if(!_gestureActive){_gestureActive=YES;[_delegate graphicGesture:YES title:@"调整一级白平衡"];}
|
||||
NSPoint p=[self convertPoint:e.locationInWindow fromView:nil],v=NSMakePoint(_dragStartOffset.x+(p.x-_dragStartMouse.x)/5,_dragStartOffset.y+(p.y-_dragStartMouse.y)/5);double length=hypot(v.x,v.y);if(length>self.maxDistance){v.x=v.x/length*self.maxDistance;v.y=v.y/length*self.maxDistance;}_offset=v;[self pushValue];}
|
||||
- (void)mouseUp:(NSEvent *)e{if(_dragging)[self mouseDragged:e];_dragging=NO;[self finishGesture];}
|
||||
- (void)keyDown:(NSEvent *)e{unichar c=e.charactersIgnoringModifiers.length?[e.charactersIgnoringModifiers characterAtIndex:0]:0;float step=self.maxDistance*((e.modifierFlags&NSEventModifierFlagShift)?.02f:.005f);NSPoint v=_offset;
|
||||
if(c==NSLeftArrowFunctionKey)v.x-=step;else if(c==NSRightArrowFunctionKey)v.x+=step;else if(c==NSUpArrowFunctionKey)v.y+=step;else if(c==NSDownArrowFunctionKey)v.y-=step;else if(c==NSDeleteCharacter||c==NSBackspaceCharacter)v=NSZeroPoint;else{[super keyDown:e];return;}
|
||||
double length=hypot(v.x,v.y);if(length>self.maxDistance){v.x*=self.maxDistance/length;v.y*=self.maxDistance/length;}[_delegate graphicGesture:YES title:@"调整一级白平衡"];_offset=v;[self pushValue];[_delegate graphicGesture:NO title:@"调整一级白平衡"];}
|
||||
@end
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#import <FxPlug/FxPlugSDK.h>
|
||||
@interface DYPlugIn : NSObject<FxTileableEffect,FxCustomParameterViewHost_v2>
|
||||
@interface DYPlugIn : NSObject<FxTileableEffect,FxCustomParameterViewHost_v2,FxAnalyzer>
|
||||
@property(assign) id<PROAPIAccessing> apiManager;
|
||||
@end
|
||||
+18
-8
@@ -4,30 +4,40 @@
|
||||
#import "DYInspector.h"
|
||||
#import "DYColorTables.h"
|
||||
#import "DYAutoGrade.h"
|
||||
#import "DYToolState.h"
|
||||
#import <CoreImage/CoreImage.h>
|
||||
#import <os/log.h>
|
||||
#include "MaskCore/DYTracker.hpp"
|
||||
#include <atomic>
|
||||
#include "DYToolHostDeclarations.inc.h"
|
||||
#include "DYToolFlow.inc.h"
|
||||
@implementation DYPlugIn {
|
||||
DYRenderer *_renderer;
|
||||
BOOL _copyAnalyzed;
|
||||
#include "DYToolHostIvars.inc.h"
|
||||
}
|
||||
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager{if((self=[super init])){_apiManager=manager;_renderer=[DYRenderer new];NSNotificationCenter*n=NSNotificationCenter.defaultCenter;[n addObserver:self selector:@selector(exportRequested:) name:@"DYExportLUT" object:manager];[n addObserver:self selector:@selector(autoRequested:) name:@"DYAutoGrade" object:manager];[n addObserver:self selector:@selector(autoRequested:) name:@"DYAutoWhiteBalance" object:manager];[n addObserver:self selector:@selector(whiteBalanceRequested:) name:@"DYWhiteBalanceColor" object:manager];}return self;}
|
||||
- (void)dealloc{[NSNotificationCenter.defaultCenter removeObserver:self];[_renderer release];[super dealloc];}
|
||||
#include "DYToolHostMethods.inc.h"
|
||||
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager{if((self=[super init])){_apiManager=manager;_renderer=[DYRenderer new];[self initializeToolHost];NSNotificationCenter*n=NSNotificationCenter.defaultCenter;[n addObserver:self selector:@selector(exportRequested:) name:@"DYExportLUT" object:manager];[n addObserver:self selector:@selector(autoRequested:) name:@"DYAutoGrade" object:manager];[n addObserver:self selector:@selector(autoRequested:) name:@"DYAutoWhiteBalance" object:manager];[n addObserver:self selector:@selector(whiteBalanceRequested:) name:@"DYWhiteBalanceColor" object:manager];}return self;}
|
||||
- (void)dealloc{[self tearDownToolHost];[NSNotificationCenter.defaultCenter removeObserver:self];[_renderer release];[super dealloc];}
|
||||
- (BOOL)properties:(NSDictionary**)p error:(NSError**)e{*p=@{kFxPropertyKey_MayRemapTime:@NO,kFxPropertyKey_PixelTransformSupport:@(kFxPixelTransform_ScaleTranslate),kFxPropertyKey_VariesWhenParamsAreStatic:@NO,kFxPropertyKey_DesiredProcessingColorInfo:@(kFxImageColorInfo_RGB_LINEAR),kFxPropertyKey_NeedsFullBuffer:@YES};return YES;}
|
||||
- (BOOL)addParametersWithError:(NSError**)e{return DYCreateParameters(_apiManager,e);}
|
||||
- (NSSet<Class>*)classesForCustomParameterID:(UInt32)pid{return pid==DYAssetsParameterID?[NSSet setWithObjects:DYAssetState.class,NSDictionary.class,NSString.class,nil]:[NSSet setWithObject:DYInspectorToken.class];}
|
||||
- (NSView*)createViewForParameterID:(UInt32)pid{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==2013||pid==2014||pid==DYAssetsParameterID)[_renderer invalidatePreview];dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self.apiManager];});return YES;}
|
||||
- (NSSet<Class>*)classesForCustomParameterID:(UInt32)pid{return pid==DYToolsParameterID?[NSSet setWithObjects:DYToolDocument.class,NSDictionary.class,NSArray.class,NSString.class,NSNumber.class,NSData.class,nil]:pid==DYAssetsParameterID?[NSSet setWithObjects:DYAssetState.class,NSDictionary.class,NSString.class,NSData.class,nil]:[NSSet setWithObjects:DYInspectorToken.class,NSDictionary.class,NSString.class,NSNumber.class,nil];}
|
||||
- (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);DYAssetState*a=DYReadAssets(_apiManager,t);double copyAuto=0;[[_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getFloatValue:©Auto fromParameter:8800 atTime:t];NSDictionary*s=@{@"schema":@1,@"copyAuto":@(copyAuto>.5),@"uniforms":[NSData dataWithBytes:&u length:sizeof(u)],@"paths":a.paths?:@{}};*state=[NSPropertyListSerialization dataWithPropertyList:s format:NSPropertyListBinaryFormat_v1_0 options:0 error:e];return *state!=nil;
|
||||
DYUniforms u;DYReadUniforms(_apiManager,t,&u);DYAssetState*a=DYReadAssets(_apiManager,t);DYToolDocument *tools=DYReadTools(_apiManager,t);[self adoptToolCanvasDocument:tools.document];double copyAuto=0;[[_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getFloatValue:©Auto fromParameter:8800 atTime:t];NSDictionary*s=@{@"schema":@2,@"tools":DYToolRenderSnapshot(tools.document,t),@"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(![p[@"schema"]isEqual:@1]||![b isKindOfClass:NSData.class]||b.length!=sizeof(DYUniforms)||![p[@"paths"]isKindOfClass:NSDictionary.class])return NO;DYUniforms u;[b getBytes:&u length:sizeof(u)];BOOL ok=[_renderer renderSource:src[0] destination:dst uniforms:u paths:p[@"paths"] error:e];if(ok){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)];BOOL ok=[_renderer renderSource:src[0] destination:dst uniforms:u paths:p[@"paths"] spider:p[@"spider"] tools:p[@"tools"] error:e];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;
|
||||
}
|
||||
- (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{
|
||||
NSURL*url=n.userInfo[@"url"];if(![url isKindOfClass:NSURL.class])return;id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];[a startAction:self];DYUniforms u;DYReadUniforms(_apiManager,a.currentTime,&u);NSDictionary*paths=[DYReadAssets(_apiManager,a.currentTime).paths copy];[a endAction:self];NSError*e=nil;BOOL ok=[_renderer exportLUT:url uniforms:u paths:paths error:&e];[paths release];if(!ok)[self alert:e.localizedDescription];
|
||||
NSURL*url=n.userInfo[@"url"];if(![url isKindOfClass:NSURL.class])return;id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];[a startAction:self];DYUniforms u;DYReadUniforms(_apiManager,a.currentTime,&u);DYAssetState *assets=DYReadAssets(_apiManager,a.currentTime);NSDictionary*paths=[assets.paths copy];NSData *mesh=[assets.spiderMesh copy];NSDictionary *tools=[DYReadTools(_apiManager,a.currentTime).document copy];[a endAction:self];NSError*e=nil;BOOL ok=[_renderer exportLUT:url uniforms:u paths:paths spider:mesh tools:tools error:&e];[tools release];[mesh release];[paths release];if(!ok)[self alert:e.localizedDescription];
|
||||
}
|
||||
- (void)applyValues:(NSDictionary*)values{if(!values){[self alert:@"尚未拿到当前片段画面,请移动播放头后重试。"];return;}id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];[a startAction:self];@try{id<FxParameterSettingAPI_v6>s=[_apiManager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];for(NSDictionary*r in DYDescriptors()){NSNumber*v=values[r[@"key"]];if(v)[s setFloatValue:v.doubleValue toParameter:[r[@"pid"]unsignedIntValue] atTime:a.currentTime];}}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:_apiManager];}
|
||||
- (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 "DYToolOSC.inc.h"
|
||||
@@ -2,12 +2,17 @@
|
||||
#import <Metal/Metal.h>
|
||||
#import <FxPlug/FxPlugSDK.h>
|
||||
#import "DYUniforms.h"
|
||||
#import "DYToolState.h"
|
||||
@interface DYRenderer : NSObject
|
||||
/// Decode and upload before committing a host parameter. The renderer retains
|
||||
/// the immutable selected contents independently of the thumbnail cache.
|
||||
- (NSProgress *)prepareLUTPath:(NSString *)path completion:(void (^)(NSError *error))completion;
|
||||
- (BOOL)renderSource:(FxImageTile*)source destination:(FxImageTile*)destination uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths error:(NSError**)error;
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths error:(NSError**)error;
|
||||
- (BOOL)renderSource:(FxImageTile*)source destination:(FxImageTile*)destination uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths spider:(NSData*)spider error:(NSError**)error;
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths spider:(NSData*)spider error:(NSError**)error;
|
||||
- (BOOL)renderSource:(FxImageTile*)source destination:(FxImageTile*)destination uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error;
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)uniforms paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error;
|
||||
- (NSData*)preview;
|
||||
/// Display-encoded float RGBA, 320×180, with the visually top row first.
|
||||
/// Analysis preview retains the host texture's original row order separately.
|
||||
|
||||
+100
-12
@@ -1,4 +1,7 @@
|
||||
#import "DYRenderer.h"
|
||||
#import "DYModel.h"
|
||||
#include "DYSpiderState.h"
|
||||
#include "DYToolGPU.h"
|
||||
#import "DYColorTables.h"
|
||||
#import "DYLUTLibrary.h"
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
@@ -8,6 +11,47 @@
|
||||
static BOOL fail(NSError**e,NSString*m){if(e)*e=[NSError errorWithDomain:@"com.dayu.color" code:1 userInfo:@{NSLocalizedDescriptionKey:m?:@"Metal 调色失败"}];return NO;}
|
||||
static NSArray *inputFiles(){return @[@"",@"apple_log_to_rec709",@"arri_logc3_to_rec709",@"arri_logc4_to_rec709",@"blackmagic_film_gen5_to_rec709",@"canon_clog_bt709_to_rec709",@"canon_clog2_cinema_gamut_to_rec709",@"canon_clog3_cinema_gamut_to_rec709",@"dji_dlog_to_rec709",@"dji_dlog_m_to_rec709",@"fujifilm_flog_to_rec709",@"fujifilm_flog2_to_rec709",@"nikon_nlog_to_rec709",@"panasonic_vlog_vgamut_to_rec709",@"red_log3g10_rwg_to_rec709",@"sony_slog2_sgamut_to_rec709",@"sony_slog3_sgamut3cine_to_rec709",@"sony_hlg_bt2020_to_rec709"];}
|
||||
static id<MTLTexture> texture3D(id<MTLDevice>d,const float*values,NSUInteger n){MTLTextureDescriptor*t=[MTLTextureDescriptor new];t.textureType=MTLTextureType3D;t.pixelFormat=MTLPixelFormatRGBA32Float;t.width=n;t.height=n;t.depth=n;t.storageMode=MTLStorageModeShared;t.usage=MTLTextureUsageShaderRead;id<MTLTexture>x=[d newTextureWithDescriptor:t];[t release];if(x)[x replaceRegion:MTLRegionMake3D(0,0,0,n,n,n) mipmapLevel:0 slice:0 withBytes:values bytesPerRow:n*16 bytesPerImage:n*n*16];return [x autorelease];}
|
||||
// A synthetic texture lattice uses exactly the production render path for Cube export.
|
||||
@interface DYExportTile : FxImageTile { id<MTLTexture> _tex; uint64_t _registry; FxRect _bounds;FxImageOrigin _origin; double _pixelAspect; }
|
||||
- (instancetype)initWithTexture:(id<MTLTexture>)texture registry:(uint64_t)registry;
|
||||
- (void)setBounds:(FxRect)bounds origin:(FxImageOrigin)origin;
|
||||
- (void)setPixelAspect:(double)aspect;
|
||||
@end
|
||||
@implementation DYExportTile
|
||||
- (instancetype)initWithTexture:(id<MTLTexture>)texture registry:(uint64_t)registry{if((self=[super init])){_tex=[texture retain];_registry=registry;_bounds=(FxRect){0,0,(SInt32)texture.width,(SInt32)texture.height};_origin=kFxImageOrigin_TOP_LEFT;_pixelAspect=1;}return self;}
|
||||
- (void)dealloc{[_tex release];[super dealloc];}
|
||||
- (id<MTLTexture>)metalTextureForDevice:(id<MTLDevice>)d{return d.registryID==_registry?_tex:nil;}
|
||||
- (void)setBounds:(FxRect)bounds origin:(FxImageOrigin)origin{_bounds=bounds;_origin=origin;}
|
||||
- (FxRect)tilePixelBounds{return _bounds;}
|
||||
- (FxRect)imagePixelBounds{return self.tilePixelBounds;}
|
||||
- (uint64_t)deviceRegistryID{return _registry;}
|
||||
- (FxImageOrigin)imageOrigin{return _origin;}
|
||||
- (double)pixelAspect{return _pixelAspect;}
|
||||
- (void)setPixelAspect:(double)aspect{_pixelAspect=aspect>0?aspect:1;}
|
||||
@end
|
||||
static BOOL managed(DYUniforms u,NSDictionary *paths){return u.cm.configured>=0&&(u.cm.configured>.5||(![paths[@"input"]length]&&u.inputProfile<.5));}
|
||||
static BOOL identityCM(DYUniforms u){
|
||||
DYCMSettings s=u.cm;
|
||||
BOOL neutral=s.basisEnabled<.5||(s.exposure==0&&s.balanceStrength==0&&s.saturation==1&&s.contrast==0&&s.hiContrast==0&&s.shadowContrast==0&&s.white==1&&s.highlights==0&&s.midtones==0&&s.shadows==0&&s.black==0&&s.toe==.5f&&s.shoulder==.5f&&s.chromaMix==.5f);
|
||||
BOOL transforms=(u.inputSectionEnabled>.5)==(s.outputEnabled>.5)&&((u.inputSectionEnabled<.5)||(s.inputTransfer==s.outputTransfer&&s.inputGamut==s.outputGamut&&s.toneMapping<.5));
|
||||
return neutral&&transforms;
|
||||
}
|
||||
// An enabled but untouched display tool is mathematically neutral. Bypass its
|
||||
// finite-domain lookup so that the default "all eyes on" does not clip CST HDR.
|
||||
static void bypassNeutralTools(DYUniforms *u){
|
||||
for(NSDictionary *section in DYSections()){
|
||||
if(![@[@"curve",@"hsl",@"grading",@"primaries",@"levels",@"balance"]containsObject:section[@"key"]])continue;
|
||||
BOOL neutral=YES;for(NSDictionary *row in section[@"rows"]){NSInteger offset=[row[@"offset"]integerValue];if(offset<0)continue;if(*(float*)((uint8_t*)u+offset)!=[row[@"default"]floatValue]){neutral=NO;break;}}
|
||||
if(neutral)for(NSDictionary *row in DYDescriptors())if([row[@"pid"]isEqual:section[@"enabled"]])*(float*)((uint8_t*)u+[row[@"offset"]unsignedIntegerValue])=0;
|
||||
}
|
||||
}
|
||||
static void bypassIdleSkin(DYUniforms *u){
|
||||
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;
|
||||
for(int i=0;i<13;i++){BOOL group=(i>=6&&i<=9)?u->colorSectionEnabled>.5:u->baseSectionEnabled>.5;if(group&&enabled[i]>.5&&values[i]!=0)return;}
|
||||
u->skinProtection.x=0;
|
||||
}
|
||||
@interface DYRenderer(){
|
||||
NSMutableDictionary *_devices,*_luts,*_preparedLUTs;
|
||||
NSSet *_activeLUTPaths;
|
||||
@@ -16,9 +60,12 @@ static id<MTLTexture> texture3D(id<MTLDevice>d,const float*values,NSUInteger n){
|
||||
NSObject *_previewLock;
|
||||
NSData *_preview,*_lookLUTPreview;
|
||||
CFTimeInterval _lastPreview;
|
||||
BOOL _exporting;
|
||||
NSDictionary *_toolDocument;
|
||||
}
|
||||
@end
|
||||
@implementation DYRenderer
|
||||
#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];[_previewLock release];[super dealloc];}
|
||||
- (void)trimPreparedLUTsKeeping:(NSString *)path {
|
||||
@@ -52,7 +99,7 @@ static id<MTLTexture> texture3D(id<MTLDevice>d,const float*values,NSUInteger n){
|
||||
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"]){id<MTLFunction>f=[lib newFunctionWithName:fn];if(!f){fail(err,[fn stringByAppendingString:@" 缺失"]);[lib release];[q release];[d release];return nil;}id<MTLComputePipelineState>p=[d newComputePipelineStateWithFunction:f error:err];[f release];if(!p){[lib release];[q release];[d release];return nil;}entry[fn]=p;[p release];}
|
||||
for(NSString*fn in @[@"dyUnpremultiply",@"dyWhitesSceneStatistics",@"dyLUTExportKernel",@"dyInputAnalysis",@"dyColorManagement",@"dyToolBlend",@"dyToolSkin"]){id<MTLFunction>f=[lib newFunctionWithName:fn];if(!f){fail(err,[fn stringByAppendingString:@" 缺失"]);[lib release];[q release];[d release];return nil;}id<MTLComputePipelineState>p=[d newComputePipelineStateWithFunction:f error:err];[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.
|
||||
@@ -67,9 +114,9 @@ static id<MTLTexture> texture3D(id<MTLDevice>d,const float*values,NSUInteger n){
|
||||
return [self textureForTable:table entry:e error:err];
|
||||
}
|
||||
- (NSArray*)textures:(NSDictionary*)paths uniforms:(DYUniforms*)u entry:(NSDictionary*)e error:(NSError**)err{
|
||||
// Normalize only this render copy. Folded groups retain their host parameters
|
||||
// Normalize only this render copy. Disabled groups retain their host parameters
|
||||
// and paths, while inactive LUTs neither load files nor affect any layer.
|
||||
BOOL inputEnabled=u->inputSectionEnabled>.5;
|
||||
BOOL inputEnabled=u->inputSectionEnabled>.5&&!managed(*u,paths);
|
||||
NSString*input=inputEnabled?paths[@"input"]:nil;int profile=inputEnabled?(int)roundf(u->inputProfile):0;
|
||||
if(!inputEnabled){u->inputProfile=0;u->preLUTStrength=0;}
|
||||
if(!input.length&&profile>0&&profile<(int)inputFiles().count)input=[[NSBundle bundleForClass:self.class]pathForResource:inputFiles()[profile] ofType:@"dylut" inDirectory:@"InputLUTs"];
|
||||
@@ -81,22 +128,52 @@ static id<MTLTexture> texture3D(id<MTLDevice>d,const float*values,NSUInteger n){
|
||||
[DYColorTables fillPrimaries:u];id<MTLDevice>d=e[@"device"];
|
||||
id<MTLTexture>h=[_tables hslForDevice:d uniforms:u],w=[_tables whiteBalanceForDevice:d uniforms:u],g=[_tables gradingForDevice:d uniforms:u];if(!h||!w||!g){fail(err,_tables.lastError?:@"颜色查表构建失败");return nil;}[ts addObjectsFromArray:@[h,w,g]];return ts;
|
||||
}
|
||||
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths error:(NSError**)err{@synchronized(self){@autoreleasepool{
|
||||
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths error:(NSError**)err{return [self renderSource:src destination:dst uniforms:u paths:paths spider:nil error:err];}
|
||||
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData *)spider error:(NSError**)err{return [self renderLegacy:src destination:dst uniforms:u paths:paths spider:spider masks:@{} error:err];}
|
||||
- (BOOL)renderLegacy:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData *)spider masks:(NSDictionary*)masks error:(NSError**)err{return [self renderLegacy:src destination:dst uniforms:u paths:paths spider:spider masks:masks stageFirst:-1 stageLast:-1 skinReference:nil originalReference:nil captureOriginal:nullptr suppressBlackWhite:NO error:err];}
|
||||
- (BOOL)renderLegacy:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData *)spider masks:(NSDictionary*)masks stageFirst:(NSInteger)stageFirst stageLast:(NSInteger)stageLast skinReference:(FxImageTile*)skinReference originalReference:(FxImageTile*)originalReference captureOriginal:(DYExportTile**)captureOriginal suppressBlackWhite:(BOOL)suppressBlackWhite error:(NSError**)err{@synchronized(self){@autoreleasepool{
|
||||
BOOL segmented=stageFirst>=0;if(segmented&&(stageFirst>stageLast||stageLast>11))return fail(err,@"原生工具分段范围无效");
|
||||
if(spider.length&&!DYSpiderMeshIsValid(spider))return fail(err,@"蜘蛛盘数据无效");
|
||||
if(u.primarySectionEnabled<.5){u.inputSectionEnabled=0;u.cm.basisEnabled=0;u.cm.outputEnabled=0;}
|
||||
|
||||
[_activeLUTPaths release];_activeLUTPaths=[[NSSet alloc]initWithArray:paths.allValues?:@[]];
|
||||
NSMutableDictionary*e=[self device:dst.deviceRegistryID error:err];if(!e)return NO;id<MTLDevice>d=e[@"device"];id<MTLTexture>input=[src metalTextureForDevice:d],output=[dst metalTextureForDevice:d];if(!input||!output)return fail(err,@"宿主图像纹理不可用");
|
||||
NSArray*ts=[self textures:paths uniforms:&u entry:e error:err];if(!ts)return NO;
|
||||
NSMutableDictionary*ps=e[@"pipelines"];NSNumber*format=@(output.pixelFormat);id<MTLRenderPipelineState>pipeline=ps[format];if(!pipeline){MTLRenderPipelineDescriptor*p=[MTLRenderPipelineDescriptor new];p.vertexFunction=[e[@"library"]newFunctionWithName:@"dyVertex"];p.fragmentFunction=[e[@"library"]newFunctionWithName:@"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];}
|
||||
BOOL useCM=managed(u,paths)&&(!segmented||stageFirst==0);bypassNeutralTools(&u);float bwMix=fmaxf(0,fminf(1,u.cm.blackWhiteMix));if(bwMix<=0)u.blackWhiteSectionEnabled=0;
|
||||
NSArray*ts=[self textures:paths uniforms:&u entry:e error:err];if(!ts)return NO;bypassIdleSkin(&u);
|
||||
// Only a deformed active mesh allocates samples; device entries retain the
|
||||
// current buffer across frames. Neutral grids are exact identity at all densities.
|
||||
simd_int2 spiderSize={0,0};id<MTLBuffer>spiderBuffer=nil;
|
||||
if(u.spiderSectionEnabled>.5&&u.spiderMix>0&&spider.length){
|
||||
if(![e[@"spiderData"]isEqual:spider]){auto mesh=DYSpiderMesh(spider);auto samples=dy::meshSamples(mesh);BOOL changed=NO;for(float value:samples)changed|=value!=0;
|
||||
e[@"spiderData"]=spider;e[@"spiderActive"]=@(changed);if(changed){id<MTLBuffer>b=[d newBufferWithBytes:samples.data() length:samples.size()*sizeof(float) options:MTLResourceStorageModeShared];if(!b)return fail(err,@"无法分配蜘蛛盘缓冲区");e[@"spiderBuffer"]=b;[b release];e[@"spiderHues"]=@(mesh.hues);e[@"spiderRings"]=@(mesh.rings);}else[e removeObjectForKey:@"spiderBuffer"];
|
||||
}
|
||||
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,@"无法分配蒙版缓冲区");
|
||||
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];
|
||||
if(useCM&&!identityCM(u)&&u.cm.mix>0){
|
||||
DayuRenderParams cm=DYCMRender(u.cm);cm.stages=(cm.stages&~1)|(u.inputSectionEnabled>.5?1:0);
|
||||
if(cm.stages){id<MTLTexture>converted=[d newTextureWithDescriptor:td];if(!converted){[straight release];return fail(err,@"无法分配 CST 缓冲区");}
|
||||
ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyColorManagement"]];[ce setTexture:straight atIndex:0];[ce setTexture:converted atIndex:1];[ce setBytes:&cm length:sizeof(cm) atIndex:0];[ce setBytes:&u.cm.mix length:4 atIndex:1];[ce dispatchThreads:MTLSizeMake(input.width,input.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[ce endEncoding];if(hasMasks){id<MTLTexture>blended=[d newTextureWithDescriptor:td];if(!blended){[converted release];[straight release];return fail(err,@"无法分配一级蒙版缓冲区");}maskHeader.section=0;maskHeader.premultiplied=0;[self encodeBlend:straight after:converted output:blended masks:maskBuffer header:maskHeader entry:e commands:cb];[converted release];converted=blended;}[straight release];straight=converted;
|
||||
}
|
||||
}
|
||||
// Keep the actual post-CST straight source alive across all native segments.
|
||||
// Both native spatial helpers and whites statistics historically read this
|
||||
// source; the current segment's center color is a different input.
|
||||
id<MTLTexture>nativeSource=segmented&&originalReference?[originalReference metalTextureForDevice:d]:straight;
|
||||
if(!nativeSource){[straight release];return fail(err,@"原生工具参考纹理不可用");}
|
||||
if(segmented&&captureOriginal&&!*captureOriginal){DYExportTile *reference=[[DYExportTile alloc]initWithTexture:nativeSource registry:d.registryID];[reference setBounds:src.tilePixelBounds origin:src.imageOrigin];[reference setPixelAspect:src.pixelAspect];*captureOriginal=reference;}
|
||||
float level=.5;id<MTLBuffer>scene=[d newBufferWithBytes:&level length:4 options:MTLResourceStorageModeShared];
|
||||
if(u.whites>0&&u.whitesEnabled>.5&&u.baseSectionEnabled>.5){ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyWhitesSceneStatistics"]];[ce setTexture:straight atIndex:0];[ce setTexture:ts[7] atIndex:1];[ce setBytes:&u length:sizeof(u) atIndex:0];[ce setBuffer:scene offset:0 atIndex:1];[ce dispatchThreadgroups:MTLSizeMake(1,1,1) threadsPerThreadgroup:MTLSizeMake(256,1,1)];[ce endEncoding];}
|
||||
BOOL preview=NO;@synchronized(_previewLock){preview=CACurrentMediaTime()-_lastPreview>.5;}id<MTLBuffer>pb=nil;if(preview){pb=[d newBufferWithLength:320*180*16 options:MTLResourceStorageModeShared];ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyInputAnalysis"]];[ce setTexture:straight atIndex:0];[ce setTexture:ts[0] atIndex:1];float inputStrength=u.inputSectionEnabled>.5?u.preLUTStrength:0;[ce setBytes:&inputStrength length:4 atIndex:1];[ce setBuffer:pb offset:0 atIndex:0];[ce dispatchThreads:MTLSizeMake(320,180,1) threadsPerThreadgroup:MTLSizeMake(8,8,1)];[ce endEncoding];}
|
||||
if(!_exporting&&(!segmented||(stageFirst<=2&&stageLast>=2))&&u.whites>0&&u.whitesEnabled>.5&&u.baseSectionEnabled>.5){ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyWhitesSceneStatistics"]];[ce setTexture:nativeSource atIndex:0];[ce setTexture:ts[7] atIndex:1];[ce setBytes:&u length:sizeof(u) atIndex:0];[ce setBuffer:scene offset:0 atIndex:1];[ce dispatchThreadgroups:MTLSizeMake(1,1,1) threadsPerThreadgroup:MTLSizeMake(256,1,1)];[ce endEncoding];}
|
||||
BOOL preview=NO;@synchronized(_previewLock){preview=(!segmented||stageFirst==0)&&!_exporting&&CACurrentMediaTime()-_lastPreview>.5;}id<MTLBuffer>pb=nil;if(preview){pb=[d newBufferWithLength:320*180*16 options:MTLResourceStorageModeShared];ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyInputAnalysis"]];[ce setTexture:straight atIndex:0];[ce setTexture:ts[0] atIndex:1];float inputStrength=u.inputSectionEnabled>.5?u.preLUTStrength:0;[ce setBytes:&inputStrength length:4 atIndex:1];[ce setBuffer:pb offset:0 atIndex:0];[ce dispatchThreads:MTLSizeMake(320,180,1) threadsPerThreadgroup:MTLSizeMake(8,8,1)];[ce endEncoding];}
|
||||
MTLRenderPassDescriptor*rp=[MTLRenderPassDescriptor renderPassDescriptor];rp.colorAttachments[0].texture=output;rp.colorAttachments[0].loadAction=MTLLoadActionDontCare;rp.colorAttachments[0].storeAction=MTLStoreActionStore;id<MTLRenderCommandEncoder>re=[cb renderCommandEncoderWithDescriptor:rp];[re setRenderPipelineState:pipeline];
|
||||
float w=output.width,h=output.height;FxRect s=src.tilePixelBounds,t=dst.tilePixelBounds;float sw=s.right-s.left,sh=s.top-s.bottom;float l=(t.left-s.left)/sw,r=(t.right-s.left)/sw,top=(s.top-t.top)/sh,bottom=(s.top-t.bottom)/sh;
|
||||
if(src.imageOrigin==kFxImageOrigin_BOTTOM_LEFT){top=1-top;bottom=1-bottom;}
|
||||
DYVertex2D vs[]={{{w/2,-h/2},{r,bottom}},{{-w/2,-h/2},{l,bottom}},{{w/2,h/2},{r,top}},{{-w/2,h/2},{l,top}}};
|
||||
if(dst.imageOrigin==kFxImageOrigin_BOTTOM_LEFT)for(int i=0;i<4;i++)vs[i].position.y=-vs[i].position.y;
|
||||
vector_uint2 vp={(unsigned)output.width,(unsigned)output.height};[re setVertexBytes:vs length:sizeof(vs) atIndex:0];[re setVertexBytes:&vp length:sizeof(vp) atIndex:1];[re setViewport:(MTLViewport){0,0,w,h,0,1}];[re setFragmentTexture:straight atIndex:0];for(NSUInteger i=0;i<ts.count;i++)[re setFragmentTexture:ts[i] atIndex:i+1];[re setFragmentBytes:&u length:sizeof(u) atIndex:0];[re setFragmentBuffer:scene offset:0 atIndex:1];DYRenderOptions options={1,0,0,0};[re setFragmentBytes:&options length:sizeof(options) atIndex:2];[re drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4];[re endEncoding];[cb commit];[cb waitUntilCompleted];BOOL ok=cb.status==MTLCommandBufferStatusCompleted;
|
||||
vector_uint2 vp={(unsigned)output.width,(unsigned)output.height};[re setVertexBytes:vs length:sizeof(vs) atIndex:0];[re setVertexBytes:&vp length:sizeof(vp) atIndex:1];[re setViewport:(MTLViewport){0,0,w,h,0,1}];[re setFragmentTexture:straight atIndex:0];for(NSUInteger i=0;i<ts.count;i++)[re setFragmentTexture:ts[i] atIndex:i+1];[re setFragmentBytes:&u length:sizeof(u) atIndex:0];[re setFragmentBuffer:scene offset:0 atIndex:1];DYRenderOptions options={1,bwMix,0,0};[re setFragmentBytes:&options length:sizeof(options) atIndex:2];DYUniforms color=u;color.blackWhiteSectionEnabled=0;[re setFragmentBytes:&color length:sizeof(color) atIndex:3];if(spiderBuffer)[re setFragmentBuffer:spiderBuffer offset:0 atIndex:4];else{float empty[2]={0,0};[re setFragmentBytes:empty length:sizeof(empty) atIndex:4];}[re setFragmentBytes:&spiderSize length:sizeof(spiderSize) atIndex:5];if(hasMasks||segmented){[re setFragmentBuffer:maskBuffer offset:0 atIndex:6];[re setFragmentBytes:&maskHeader length:sizeof(maskHeader) atIndex:7];}if(segmented){DYToolStageRange range={(int)stageFirst,(int)stageLast,(int)suppressBlackWhite};[re setFragmentBytes:&range length:sizeof(range) atIndex:8];[re setFragmentTexture:skinReference?[skinReference metalTextureForDevice:d]:input atIndex:10];[re setFragmentTexture:nativeSource atIndex:11];}[re drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4];[re endEncoding];[cb commit];[cb waitUntilCompleted];BOOL ok=cb.status==MTLCommandBufferStatusCompleted;
|
||||
if(ok&&pb){@synchronized(_previewLock){
|
||||
[_preview release];_preview=[[NSData alloc]initWithBytes:pb.contents length:320*180*16];
|
||||
// The analysis kernel reads physical texture rows. Its result remains intact
|
||||
@@ -111,8 +188,19 @@ static id<MTLTexture> texture3D(id<MTLDevice>d,const float*values,NSUInteger n){
|
||||
}}
|
||||
if(!ok)fail(err,cb.error.localizedDescription);[pb release];[straight release];[scene release];return ok;
|
||||
}}}
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)u paths:(NSDictionary*)paths error:(NSError**)err{@synchronized(self){
|
||||
NSMutableDictionary*e=[self device:0 error:err];if(!e)return NO;NSArray*ts=[self textures:paths uniforms:&u entry:e error:err];if(!ts)return NO;id<MTLDevice>d=e[@"device"];uint32_t n=33;NSUInteger count=n*n*n;id<MTLBuffer>out=[d newBufferWithLength:count*3*4 options:MTLResourceStorageModeShared];if(!out)return fail(err,@"无法分配 LUT 输出");id<MTLCommandBuffer>cb=[e[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>ce=[cb computeCommandEncoder];[ce setComputePipelineState:e[@"dyLUTExportKernel"]];for(NSUInteger i=0;i<ts.count;i++)[ce setTexture:ts[i] atIndex:i];[ce setBytes:&u length:sizeof(u) atIndex:0];[ce setBuffer:out offset:0 atIndex:1];[ce setBytes:&n length:4 atIndex:2];[ce dispatchThreads:MTLSizeMake(count,1,1) threadsPerThreadgroup:MTLSizeMake(64,1,1)];[ce endEncoding];[cb commit];[cb waitUntilCompleted];if(cb.status!=MTLCommandBufferStatusCompleted){[out release];return fail(err,cb.error.localizedDescription);}
|
||||
NSMutableString*s=[NSMutableString stringWithString:@"TITLE \"大鱼调色\"\n# 仅包含逐像素颜色;纹理、清晰度和画面分析不写入 LUT。\nLUT_3D_SIZE 33\nDOMAIN_MIN 0 0 0\nDOMAIN_MAX 1 1 1\n"];float*v=(float*)out.contents;for(NSUInteger i=0;i<count;i++){if(!std::isfinite(v[i*3])||!std::isfinite(v[i*3+1])||!std::isfinite(v[i*3+2])){[out release];return fail(err,@"LUT GPU 输出含无效值");}[s appendFormat:@"%.8f %.8f %.8f\n",v[i*3],v[i*3+1],v[i*3+2]];}[out release];return [s writeToURL:url atomically:YES encoding:NSUTF8StringEncoding error:err];
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)u paths:(NSDictionary*)paths error:(NSError**)err{return [self exportLUT:url uniforms:u paths:paths spider:nil error:err];}
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider error:(NSError**)err{@synchronized(self){
|
||||
NSMutableDictionary *e=[self device:0 error:err];if(!e)return NO;id<MTLDevice>d=e[@"device"];const NSUInteger n=33,count=n*n*n,width=n*n,height=n;
|
||||
MTLTextureDescriptor *desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA16Float width:width height:height mipmapped:NO];desc.storageMode=MTLStorageModeShared;desc.usage=MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite|MTLTextureUsageRenderTarget;
|
||||
id<MTLTexture>input=[d newTextureWithDescriptor:desc],output=[d newTextureWithDescriptor:desc];if(!input||!output){[input release];[output release];return fail(err,@"无法分配 LUT 色格");}
|
||||
std::vector<__fp16>values(count*4);for(NSUInteger i=0;i<count;i++){float v[3]={(float)(i%n)/(n-1),(float)((i/n)%n)/(n-1),(float)(i/(n*n))/(n-1)};for(int c=0;c<3;c++)values[i*4+c]=v[c]<=.04045f?v[c]/12.92f:powf((v[c]+.055f)/1.055f,2.4f);values[i*4+3]=1;}
|
||||
[input replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:values.data() bytesPerRow:width*8];
|
||||
DYExportTile *source=[[[DYExportTile alloc]initWithTexture:input registry:d.registryID]autorelease],*dest=[[[DYExportTile alloc]initWithTexture:output registry:d.registryID]autorelease];
|
||||
u.textureEnabled=0;u.clarityEnabled=0;u.dehazeEnabled=0;BOOL ok=NO;_exporting=YES;
|
||||
@try{ok=[self renderSource:source destination:dest uniforms:u paths:paths spider:spider tools:_toolDocument error:err];}@finally{_exporting=NO;}
|
||||
if(ok)[output getBytes:values.data() bytesPerRow:width*8 fromRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0];[input release];[output release];if(!ok)return NO;
|
||||
NSMutableString *text=[NSMutableString stringWithString:@"TITLE \"大鱼调色\"\n# 包含 CST 与逐像素颜色;不包含纹理、清晰度和逐画面分析。\nLUT_3D_SIZE 33\nDOMAIN_MIN 0 0 0\nDOMAIN_MAX 1 1 1\n"];
|
||||
for(NSUInteger i=0;i<count;i++){float rgb[3];for(int c=0;c<3;c++){float v=values[i*4+c];rgb[c]=v<=.0031308f?v*12.92f:1.055f*powf(v,1/2.4f)-.055f;if(!std::isfinite(rgb[c]))return fail(err,@"LUT 输出含无效值");}[text appendFormat:@"%.8f %.8f %.8f\n",rgb[0],rgb[1],rgb[2]];}
|
||||
return [text writeToURL:url atomically:YES encoding:NSUTF8StringEncoding error:err];
|
||||
}}
|
||||
@end
|
||||
@@ -0,0 +1,96 @@
|
||||
// Ported from dayu-colorplate; provenance in research/SpiderAndBalanceSources.json.
|
||||
@interface DYSpiderDisc : NSView
|
||||
@property(nonatomic) DYGrade grade;
|
||||
@property(nonatomic,copy) NSData *meshData;
|
||||
@property(nonatomic,readonly) NSInteger hueCount,saturationCount;
|
||||
- (void)changeHueCount:(int)hues saturationCount:(int)saturation;
|
||||
- (void)resetMesh;
|
||||
@property(nonatomic) NSInteger selected;
|
||||
@property(nonatomic,retain) NSMutableIndexSet *pinned,*selection;
|
||||
@property(nonatomic,copy) NSData *pinData;
|
||||
@property(nonatomic) BOOL interactionEnabled;
|
||||
- (void)selectRing;
|
||||
- (void)selectSpoke;
|
||||
- (void)resetSelected;
|
||||
@property(nonatomic,copy) void(^changed)(DYGrade,NSData*);
|
||||
@property(nonatomic,copy) void(^selectionChanged)(NSString*);
|
||||
@property(nonatomic,copy) void(^gesture)(BOOL);
|
||||
- (void)toggleLock;
|
||||
@end
|
||||
@implementation DYSpiderDisc {BOOL _dragging,_marquee,_gestureActive;NSPoint _dragOrigin,_marqueeEnd;DYGrade _dragGrade;dy::SpiderMesh _mesh,_dragMesh;BOOL _variableMesh;NSMutableIndexSet*_selectionStart,*_pinsStart;}
|
||||
- (void)dealloc{[self finishGesture];[_pinned release];[_selection release];[_selectionStart release];[_pinsStart release];[_changed release];[_selectionChanged release];[_gesture release];[super dealloc];}
|
||||
- (BOOL)isFlipped{return YES;}
|
||||
- (BOOL)acceptsFirstResponder{return YES;}
|
||||
- (BOOL)acceptsFirstMouse:(NSEvent*)event{return YES;}
|
||||
- (BOOL)isAccessibilityElement{return YES;}
|
||||
- (NSString*)accessibilityRole{return NSAccessibilityButtonRole;}
|
||||
- (NSString*)accessibilityHelp{return @"拖动一点,同一色相列的自由点自动联动。固定点仍可直接拖动。Command 多选,Shift 固定,右键复位。Tab 切点,方向键微调,Escape 取消。";}
|
||||
- (id)accessibilityValue{NSInteger i=_selected>=0?_selected:(NSInteger)_selection.firstIndex;return i>=0&&i<[self nodeCount]?[NSString stringWithFormat:@"已选 %lu 点,主点 %ld,X %.4f,Y %.4f,固定点仍可拖动",(unsigned long)_selection.count,(long)i+1,_mesh.x[i],_mesh.y[i]]:@"拖动一点,周围自由点自动联动";}
|
||||
- (BOOL)accessibilityPerformPress{[self.window makeFirstResponder:self];if(!_selection.count)[_selection addIndex:0];[self describeSelection];self.needsDisplay=YES;return YES;}
|
||||
- (void)finishGesture{if(_gestureActive){_gestureActive=NO;if(_gesture)_gesture(NO);}}
|
||||
- (void)viewWillMoveToWindow:(NSWindow*)window{if(!window)[self finishGesture];[super viewWillMoveToWindow:window];}
|
||||
- (NSInteger)nodeCount{return dy::meshCount(_mesh);}
|
||||
- (NSInteger)hueCount{return _mesh.hues;}
|
||||
- (NSInteger)saturationCount{return _mesh.rings+1;}
|
||||
- (NSData*)meshData{return _variableMesh?[NSData dataWithBytes:&_mesh length:sizeof(_mesh)]:nil;}
|
||||
- (void)setMeshData:(NSData*)data{dy::SpiderMesh m{};BOOL variable=data.length==sizeof(m);if(variable){memcpy(&m,data.bytes,sizeof(m));if(!dy::validMesh(m))return;}else m=dy::legacyMesh(_grade,(const uint8_t*)self.pinData.bytes);BOOL topology=m.hues!=_mesh.hues||m.rings!=_mesh.rings;_mesh=m;_variableMesh=variable;if(topology){_dragging=_marquee=NO;[self finishGesture];[_selection removeAllIndexes];_selected=-1;}[self updatePins];self.needsDisplay=YES;}
|
||||
- (void)updatePins{self.pinned=[NSMutableIndexSet indexSet];for(int i=0;i<[self nodeCount];i++)if(_mesh.pins[i])[_pinned addIndex:i];}
|
||||
- (NSData*)pinData{uint8_t flags[81]={};auto m=dy::resampleMesh(_mesh,16,6);for(int i=0;i<81;i++)flags[i]=m.pins[i];return [NSData dataWithBytes:flags length:81];}
|
||||
- (void)setPinData:(NSData*)data{if(!_variableMesh){const uint8_t*p=data.length==81?(const uint8_t*)data.bytes:nullptr;_mesh=dy::legacyMesh(_grade,p);[self updatePins];}self.needsDisplay=YES;}
|
||||
- (void)notifyChange{for(int i=0;i<[self nodeCount];i++)_mesh.pins[i]=dy::meshBoundary(_mesh,i)||[_pinned containsIndex:i];_grade=dy::meshLegacyGrade(_grade,_mesh);if(_changed)_changed(_grade,self.pinData);[self describeSelection];self.needsDisplay=YES;}
|
||||
- (void)changeHueCount:(int)hues saturationCount:(int)saturation{if(!_interactionEnabled||!dySpiderResolution(hues)||!dySpiderResolution(saturation))return;if(hues==_mesh.hues&&saturation==_mesh.rings+1)return;[self finishGesture];_dragging=_marquee=NO;_mesh=dy::resampleMesh(_mesh,hues,saturation);_variableMesh=YES;[_selection removeAllIndexes];_selected=-1;[self updatePins];[self notifyChange];}
|
||||
- (void)resetMesh{_mesh=dy::neutralMesh(_mesh.hues,_mesh.rings+1);_variableMesh=YES;[_selection removeAllIndexes];_selected=-1;[self updatePins];[self notifyChange];}
|
||||
- (void)moveFrom:(DYGrade)g x:(float)x y:(float)y {
|
||||
if(!_selection.count||(x==0&&y==0))return;std::bitset<dy::SpiderMeshCapacity>selected;for(int i=0;i<[self nodeCount];i++)selected[i]=[_selection containsIndex:i];
|
||||
auto start=_dragging?_dragMesh:_mesh;auto moved=dy::moveMesh(start,selected,x,y);if(!memcmp(&moved,&_mesh,sizeof(moved)))return;_mesh=moved;_grade=g;_grade.spiderEnabled=1;[self updatePins];[self notifyChange];
|
||||
}
|
||||
- (void)keyDown:(NSEvent*)e {
|
||||
if(!_interactionEnabled)return;unichar c=e.charactersIgnoringModifiers.length?[e.charactersIgnoringModifiers characterAtIndex:0]:0;
|
||||
if(c==27){if(_dragging){_grade=_dragGrade;_mesh=_dragMesh;self.pinned=[[_pinsStart mutableCopy]autorelease];[self notifyChange];}if(_marquee)self.selection=[[_selectionStart mutableCopy]autorelease];_dragging=_marquee=NO;[self finishGesture];self.needsDisplay=YES;return;}
|
||||
if((e.modifierFlags&NSEventModifierFlagCommand)&&c=='a'){[_selection addIndexesInRange:NSMakeRange(0,[self nodeCount])];[self describeSelection];self.needsDisplay=YES;return;}
|
||||
if(c=='\t'){_selected=(_selected+(e.modifierFlags&NSEventModifierFlagShift?[self nodeCount]-1:1)+[self nodeCount])%[self nodeCount];[_selection removeAllIndexes];[_selection addIndex:_selected];[self describeSelection];self.needsDisplay=YES;return;}
|
||||
if(c==' '){[self toggleLock];return;}if(c==NSDeleteCharacter||c==NSBackspaceCharacter){[self resetSelected];return;}
|
||||
float step=e.modifierFlags&NSEventModifierFlagShift?.02f:.005f;
|
||||
if(c==NSLeftArrowFunctionKey)[self moveFrom:_grade x:-step y:0];else if(c==NSRightArrowFunctionKey)[self moveFrom:_grade x:step y:0];else if(c==NSUpArrowFunctionKey)[self moveFrom:_grade x:0 y:-step];else if(c==NSDownArrowFunctionKey)[self moveFrom:_grade x:0 y:step];else[super keyDown:e];
|
||||
}
|
||||
- (instancetype)initWithFrame:(NSRect)r{if((self=[super initWithFrame:r])){_grade=dyDefaultGrade();_mesh=dy::legacyMesh(_grade);_selected=-1;self.pinData=nil;self.selection=[NSMutableIndexSet indexSet];_interactionEnabled=YES;self.accessibilityLabel=@"蜘蛛盘,拖动一点联动同列自由点";}return self;}
|
||||
- (NSRect)discRect{CGFloat s=MIN(self.bounds.size.width,self.bounds.size.height)-32;return NSMakeRect((self.bounds.size.width-s)/2,(self.bounds.size.height-s)/2,s,s);}
|
||||
- (NSPoint)point:(NSInteger)i{NSRect r=self.discRect;return NSMakePoint(r.origin.x+_mesh.x[i]*r.size.width,r.origin.y+_mesh.y[i]*r.size.height);}
|
||||
- (void)setGrade:(DYGrade)g{if(memcmp(g.spiderX,_grade.spiderX,sizeof(g.spiderX))||memcmp(g.spiderY,_grade.spiderY,sizeof(g.spiderY))){_grade=g;self.meshData=nil;}else _grade=g;self.needsDisplay=YES;}
|
||||
- (void)drawRect:(NSRect)dirty{
|
||||
NSRect r=self.discRect;NSPoint c=NSMakePoint(NSMidX(r),NSMidY(r));CGFloat rad=r.size.width/2;
|
||||
for(int s=0;s<64;s++)for(int ring=1;ring<=5;ring++){double a=s*M_PI/32,b=(s+1)*M_PI/32;NSBezierPath*p=[NSBezierPath bezierPath];[p moveToPoint:NSMakePoint(c.x+cos(a)*(ring-1)*rad/5,c.y+sin(a)*(ring-1)*rad/5)];[p lineToPoint:NSMakePoint(c.x+cos(a)*ring*rad/5,c.y+sin(a)*ring*rad/5)];[p lineToPoint:NSMakePoint(c.x+cos(b)*ring*rad/5,c.y+sin(b)*ring*rad/5)];[p lineToPoint:NSMakePoint(c.x+cos(b)*(ring-1)*rad/5,c.y+sin(b)*(ring-1)*rad/5)];[p closePath];[[NSColor colorWithCalibratedHue:s/64. saturation:ring/5. brightness:.47 alpha:1]setFill];[p fill];}
|
||||
[[NSColor colorWithWhite:1 alpha:.30]setStroke];for(int ring=1;ring<=_mesh.rings;ring++){NSBezierPath *p=[NSBezierPath bezierPath];for(int s=0;s<=_mesh.hues;s++){NSPoint q=[self point:dy::meshIndex(_mesh,s%_mesh.hues,ring)];if(s==0)[p moveToPoint:q];else[p lineToPoint:q];}[p stroke];}
|
||||
for(int s=0;s<_mesh.hues;s++){NSBezierPath*p=[NSBezierPath bezierPath];[p moveToPoint:[self point:[self nodeCount]-1]];for(int ring=1;ring<=_mesh.rings;ring++)[p lineToPoint:[self point:dy::meshIndex(_mesh,s,ring)]];[p stroke];}
|
||||
for(int i=0;i<[self nodeCount];i++){NSPoint p=[self point:i];CGFloat z=[_selection containsIndex:i]?4.5:2.6;NSBezierPath *d=[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(p.x-z,p.y-z,z*2,z*2)];[([_selection containsIndex:i]?DYAccent():[NSColor colorWithWhite:1 alpha:.85])setFill];[d fill];if([_selection containsIndex:i]){[NSColor.whiteColor setStroke];[d stroke];}if([_pinned containsIndex:i]){[NSColor.blackColor setFill];NSRectFill(NSMakeRect(p.x-1,p.y-1,2,2));}}
|
||||
if(_marquee){
|
||||
NSRect box=NSMakeRect(MIN(_dragOrigin.x,_marqueeEnd.x),MIN(_dragOrigin.y,_marqueeEnd.y),fabs(_dragOrigin.x-_marqueeEnd.x),fabs(_dragOrigin.y-_marqueeEnd.y));
|
||||
NSBezierPath*outline=[NSBezierPath bezierPathWithRect:box];outline.lineWidth=1.25;
|
||||
[DYAccent()setStroke];[outline stroke];
|
||||
}
|
||||
}
|
||||
- (void)describeSelection{if(_selectionChanged)_selectionChanged([NSString stringWithFormat:@"拖动主点,同列自由点联动 · 已选 %lu 点\n⌘ 多选 · Shift 固定 · 右键复位",(unsigned long)_selection.count]);}
|
||||
- (void)toggleLock{if(!_interactionEnabled||!_selection.count)return;BOOL all=YES;for(NSUInteger i=_selection.firstIndex;i!=NSNotFound;i=[_selection indexGreaterThanIndex:i])if(![_pinned containsIndex:i])all=NO;for(NSUInteger i=_selection.firstIndex;i!=NSNotFound;i=[_selection indexGreaterThanIndex:i]){if(all&&!dy::meshBoundary(_mesh,int(i)))[_pinned removeIndex:i];else[_pinned addIndex:i];}[self notifyChange];}
|
||||
- (void)selectRing{NSIndexSet*old=[[_selection copy]autorelease];for(NSUInteger i=old.firstIndex;i!=NSNotFound;i=[old indexGreaterThanIndex:i])if(i<[self nodeCount]-1)for(int s=0;s<_mesh.hues;s++)[_selection addIndex:dy::meshIndex(_mesh,s,int(i%_mesh.rings)+1)];[self describeSelection];self.needsDisplay=YES;}
|
||||
- (void)selectSpoke{NSIndexSet*old=[[_selection copy]autorelease];for(NSUInteger i=old.firstIndex;i!=NSNotFound;i=[old indexGreaterThanIndex:i])if(i<[self nodeCount]-1)for(int r=1;r<=_mesh.rings;r++)[_selection addIndex:dy::meshIndex(_mesh,int(i/_mesh.rings),r)];[self describeSelection];self.needsDisplay=YES;}
|
||||
- (void)resetSelected{if(!_interactionEnabled)return;auto d=dy::neutralMesh(_mesh.hues,_mesh.rings+1);for(NSUInteger i=_selection.firstIndex;i!=NSNotFound;i=[_selection indexGreaterThanIndex:i]){_mesh.x[i]=d.x[i];_mesh.y[i]=d.y[i];if(!dy::meshBoundary(_mesh,int(i)))[_pinned removeIndex:i];}[self notifyChange];}
|
||||
- (NSInteger)hitPoint:(NSPoint)p{float best=14;NSInteger chosen=-1;for(int i=0;i<[self nodeCount];i++){NSPoint q=[self point:i];float d=hypot(p.x-q.x,p.y-q.y);if(d<best){best=d;chosen=i;}}return chosen;}
|
||||
- (void)rightMouseDown:(NSEvent*)e{if(!_interactionEnabled)return;NSInteger i=[self hitPoint:[self convertPoint:e.locationInWindow fromView:nil]];if(i<0)return;_selected=i;[_selection removeAllIndexes];[_selection addIndex:i];[self resetSelected];[_selection removeAllIndexes];[self describeSelection];}
|
||||
- (void)mouseDown:(NSEvent*)e {
|
||||
if(!_interactionEnabled)return;[self.window makeFirstResponder:self];NSPoint p=[self convertPoint:e.locationInWindow fromView:nil];NSInteger chosen=[self hitPoint:p];
|
||||
_dragOrigin=_marqueeEnd=p;_dragGrade=_grade;_dragMesh=_mesh;[_selectionStart release];_selectionStart=[_selection mutableCopy];[_pinsStart release];_pinsStart=[_pinned mutableCopy];_dragging=_marquee=NO;_selected=chosen;
|
||||
BOOL additive=(e.modifierFlags&NSEventModifierFlagCommand)!=0;
|
||||
if(chosen>=0&&(e.modifierFlags&NSEventModifierFlagShift)){[_pinned addIndex:chosen];[self notifyChange];return;}
|
||||
if(chosen<0){_marquee=YES;if(!additive)[_selection removeAllIndexes];if(!additive)[_selectionStart removeAllIndexes];}
|
||||
else if(additive){if([_selection containsIndex:chosen])[_selection removeIndex:chosen];else[_selection addIndex:chosen];}
|
||||
else {if(![_selection containsIndex:chosen]){[_selection removeAllIndexes];[_selection addIndex:chosen];}if(e.clickCount>=2)[self resetSelected];else _dragging=YES;}
|
||||
[self describeSelection];self.needsDisplay=YES;
|
||||
}
|
||||
- (void)mouseDragged:(NSEvent*)e {
|
||||
if(!_interactionEnabled)return;NSPoint p=[self convertPoint:e.locationInWindow fromView:nil];
|
||||
if(_marquee){_marqueeEnd=p;NSRect box=NSMakeRect(MIN(_dragOrigin.x,p.x),MIN(_dragOrigin.y,p.y),fabs(p.x-_dragOrigin.x),fabs(p.y-_dragOrigin.y));self.selection=[[_selectionStart mutableCopy]autorelease];for(int i=0;i<[self nodeCount];i++)if(NSPointInRect([self point:i],box))[_selection addIndex:i];[self describeSelection];self.needsDisplay=YES;}
|
||||
else if(_dragging){if(!_gestureActive){_gestureActive=YES;if(_gesture)_gesture(YES);}NSRect r=self.discRect;[self moveFrom:_dragGrade x:(p.x-_dragOrigin.x)/r.size.width y:(p.y-_dragOrigin.y)/r.size.height];}
|
||||
}
|
||||
- (void)mouseUp:(NSEvent*)e{_dragging=_marquee=NO;[self finishGesture];self.needsDisplay=YES;}
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#import <Foundation/Foundation.h>
|
||||
#include "SpiderCore/DYSpiderMesh.hpp"
|
||||
static inline BOOL DYSpiderMeshIsValid(NSData *data){dy::SpiderMesh m{};if(data.length!=sizeof(m))return NO;memcpy(&m,data.bytes,sizeof(m));return dy::validMesh(m);}
|
||||
static inline dy::SpiderMesh DYSpiderMesh(NSData *data){dy::SpiderMesh m=dy::neutralMesh();if(DYSpiderMeshIsValid(data))memcpy(&m,data.bytes,sizeof(m));return m;}
|
||||
static inline NSDictionary *DYSpiderJSON(NSData *data,BOOL linked){auto m=DYSpiderMesh(data);NSMutableArray *x=[NSMutableArray array],*y=[NSMutableArray array],*pins=[NSMutableArray array];for(int i=0;i<dy::meshCount(m);i++){[x addObject:@(m.x[i])];[y addObject:@(m.y[i])];[pins addObject:@(m.pins[i])];}return @{@"hues":@(m.hues),@"saturation":@(m.rings+1),@"x":x,@"y":y,@"pins":pins,@"linked":@(linked)};}
|
||||
static inline NSData *DYSpiderFromJSON(id json){
|
||||
if(![json isKindOfClass:NSDictionary.class])return nil;
|
||||
for(NSString *key in @[@"hues",@"saturation",@"linked"])if(![json[key]isKindOfClass:NSNumber.class])return nil;
|
||||
double hues=[json[@"hues"]doubleValue],sat=[json[@"saturation"]doubleValue];if(!std::isfinite(hues)||!std::isfinite(sat)||hues!=floor(hues)||sat!=floor(sat)||hues<6||hues>24||sat<6||sat>24||!dySpiderResolution((int)hues)||!dySpiderResolution((int)sat))return nil;
|
||||
auto m=dy::neutralMesh((int)hues,(int)sat);NSUInteger count=dy::meshCount(m);for(NSString *key in @[@"x",@"y",@"pins"])if(![json[key]isKindOfClass:NSArray.class]||[json[key]count]!=count)return nil;
|
||||
for(NSUInteger i=0;i<count;i++){for(NSString *key in @[@"x",@"y",@"pins"])if(![json[key][i]isKindOfClass:NSNumber.class])return nil;double pin=[json[@"pins"][i]doubleValue];if(pin!=0&&pin!=1)return nil;m.x[i]=[json[@"x"][i]floatValue];m.y[i]=[json[@"y"][i]floatValue];m.pins[i]=(uint8_t)pin;}
|
||||
return dy::validMesh(m)?[NSData dataWithBytes:&m length:sizeof(m)]:nil;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,&error);DYToolCanvasProbe *host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero;
|
||||
NSMutableDictionary *doc=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].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+.1;while(NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.005]];};drain();
|
||||
NSDictionary *snapshot=[plugin toolCanvasMaskAtTime:kCMTimeZero];run.record(@"canvas-cold-load-selects-saved-mask-from-immutable-snapshot",[snapshot[@"id"]isEqual:mask[@"id"]]&&[snapshot[@"parameters"]length]==sizeof(DYMaskParameters));
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasSelection" object:host userInfo:@{@"node":@"base:hsl",@"mask":mask[@"id"],@"document":doc}];
|
||||
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];Pixels pixels=read(overlay,gpu);NSUInteger opaque=0;BOOL finite=YES;for(NSUInteger i=0;i<640*400;i++){float a=pixels[i*4+3];opaque+=a>.01;finite&=std::isfinite(a);}run.record(@"native-osc-real-metal-overlay-transparent-around-controls",finite&&opaque>100&&opaque<640*400*.2,@{@"coveredPixels":@(opaque)});
|
||||
NSInteger part=0;[osc hitTestOSCAtMousePositionX:320 mousePositionY:212.5 activePart:&part atTime:kCMTimeZero];run.record(@"native-osc-object-to-canvas-center-hit",part==1);
|
||||
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];
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// OSC callbacks only mutate a locked in-memory draft. Host parameter writes are
|
||||
// deferred until the gesture has finished and the callback has returned.
|
||||
- (void)postToolCanvasStatus:(NSString*)message {
|
||||
NSString *node=nil,*maskID=nil;uint64_t revision;@synchronized(self){node=[_selectedToolNode copy];maskID=[_selectedToolMask copy];revision=_toolCanvasRevision;}
|
||||
dispatch_async(dispatch_get_main_queue(),^{BOOL drawing;@synchronized(self){if(revision!=self->_toolCanvasRevision||![node isEqual:self->_selectedToolNode]||![maskID isEqual:self->_selectedToolMask])return;drawing=self->_toolDrawingPen||self->_toolCanvasCommitPending;}if(message)[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolTrackingStatus" object:self->_apiManager userInfo:@{@"node":node?:@"",@"message":message}];[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasState" object:self->_apiManager userInfo:@{@"node":node?:@"",@"mask":maskID?:@"",@"drawing":@(drawing)}];});[node release];[maskID release];
|
||||
}
|
||||
- (void)discardToolCanvasDraft {
|
||||
@synchronized(self){[_toolCanvasDraft release];_toolCanvasDraft=nil;[_toolCanvasOriginal release];_toolCanvasOriginal=nil;_toolDrawingPen=NO;_toolCanvasHasHover=NO;_toolCanvasEditTime=kCMTimeInvalid;++_toolCanvasRevision;}[self postToolCanvasStatus:nil];
|
||||
}
|
||||
- (void)commitToolCanvasDraftAtTime:(CMTime)eventTime {
|
||||
NSDictionary *draft=nil,*original=nil;NSString *node=nil,*maskID=nil;CMTime time;uint64_t revision;
|
||||
@synchronized(self){if(!_toolCanvasDraft||!_toolCanvasOriginal)return;if(!CMTIME_IS_NUMERIC(eventTime)||CMTimeCompare(eventTime,_toolCanvasEditTime)!=0){[self discardToolCanvasDraft];[self postToolCanvasStatus:@"播放头已移动,请重新绘制。"];return;}draft=[_toolCanvasDraft copy];original=[_toolCanvasOriginal copy];node=[_selectedToolNode copy];maskID=[_selectedToolMask copy];time=_toolCanvasEditTime;[self discardToolCanvasDraft];revision=_toolCanvasRevision;_toolCanvasCommitPending=YES;}
|
||||
dispatch_async(dispatch_get_main_queue(),^{@try{
|
||||
@synchronized(self){if(self->_trackingActive.load()||revision!=self->_toolCanvasRevision||![node isEqual:self->_selectedToolNode]||![maskID isEqual:self->_selectedToolMask])return;}
|
||||
id<FxCustomParameterActionAPI_v4>a=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;BOOL changed=NO;
|
||||
[a startAction:self];@try{
|
||||
NSMutableDictionary *doc=DYMutablePlist(DYReadTools(self->_apiManager,time).document),*current=[self toolMask:maskID node:node document:doc];
|
||||
if(!current||![current isEqual:original]){[self postToolCanvasStatus:@"蒙版已在其它位置修改,本次画面草稿未覆盖它。"];return;}
|
||||
NSMutableDictionary *result=DYMutablePlist(draft);
|
||||
if([current[@"keys"]count]){DYMaskParameters p=DYMaskAtTime(result,time);NSMutableArray *keys=[[current[@"keys"]mutableCopy]autorelease];NSIndexSet *same=[keys indexesOfObjectsPassingTest:^BOOL(NSDictionary *key,NSUInteger i,BOOL *stop){return CMTimeCompare(CMTimeMakeWithEpoch([key[@"value"]longLongValue],[key[@"scale"]intValue],[key[@"epoch"]longLongValue]),time)==0;}];[keys removeObjectsAtIndexes:same];[keys addObject:DYMaskKey(time,p,YES,1)];result[@"keys"]=@[];if(!DYMergeTracking(result,keys))return;}
|
||||
if(DYValidToolMask(result)&&![current isEqual:result]){[current setDictionary:result];id<FxUndoAPI>undo=[self->_apiManager apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"编辑工具蒙版"];changed=DYWriteTools(self->_apiManager,doc,time);[undo endUndoGroup];if(changed){DYToolDocument *saved=[[[DYToolDocument alloc]init]autorelease];saved.document=doc;[self adoptToolCanvasDocument:saved.document];}}
|
||||
}@finally{[a endAction:self];}
|
||||
if(changed)[self postToolCanvasStatus:@"蒙版已保存 · 可一次撤销"];
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];
|
||||
}@finally{@synchronized(self){self->_toolCanvasCommitPending=NO;}[self postToolCanvasStatus:nil];}});[draft release];[original release];[node release];[maskID release];
|
||||
}
|
||||
- (void)toolCanvasCommand:(NSNotification*)notification {
|
||||
NSDictionary *info=notification.userInfo;@synchronized(self){if(![info[@"node"]isEqual:_selectedToolNode]||![info[@"mask"]isEqual:_selectedToolMask])return;}
|
||||
CMTime time=CMTimeMakeWithEpoch([info[@"timeValue"]longLongValue],[info[@"timeScale"]intValue],[info[@"timeEpoch"]longLongValue]);
|
||||
id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(a){[a startAction:self];@try{time=a.currentTime;}@finally{[a endAction:self];}}if(!CMTIME_IS_NUMERIC(time))return;NSString *command=info[@"command"];
|
||||
if([command isEqual:@"finish"]||[command isEqual:@"cancel"])[self toolCanvasEvent:NSEventTypeKeyDown point:NSZeroPoint part:1 modifiers:0 key:[command isEqual:@"finish"]?13:27 time:time];
|
||||
}
|
||||
- (void)toolCanvasEvent:(NSEventType)type point:(NSPoint)point part:(NSInteger)part modifiers:(FxModifierKeys)modifiers key:(unichar)key time:(CMTime)time {
|
||||
if(!CMTIME_IS_NUMERIC(time)||!std::isfinite(point.x)||!std::isfinite(point.y))return;
|
||||
@synchronized(self){if(_trackingActive.load()||!_selectedToolNode||!_selectedToolMask)return;if(_toolCanvasCommitPending){NSString *node=[_selectedToolNode copy],*maskID=[_selectedToolMask copy];dispatch_async(dispatch_get_main_queue(),^{@synchronized(self){if(![node isEqual:self->_selectedToolNode]||![maskID isEqual:self->_selectedToolMask])return;}[self toolCanvasEvent:type point:point part:part modifiers:modifiers key:key time:time];});[node release];[maskID release];return;}
|
||||
if(part>=10000&&type==NSEventTypeLeftMouseDown){
|
||||
NSInteger item=part-10000;
|
||||
if(item==7){_toolShowCoverage=!_toolShowCoverage;return;}
|
||||
if(item==8||item==10){[self discardToolCanvasDraft];if(item==8)_toolCanvasHidden=YES;[self postToolCanvasStatus:@"已取消绘制,保留原蒙版。"];return;}
|
||||
if(item==9){[self toolCanvasEvent:NSEventTypeKeyDown point:point part:1 modifiers:0 key:13 time:time];return;}
|
||||
if(item==0){if(_toolDrawingPen&&[_toolCanvasDraft[@"nodes"]length]>=3*sizeof(DYBezierNode))[self commitToolCanvasDraftAtTime:time];else [self discardToolCanvasDraft];return;}
|
||||
if(item<1||item>6)return;
|
||||
NSString *node=[_selectedToolNode copy];[self discardToolCanvasDraft];
|
||||
dispatch_async(dispatch_get_main_queue(),^{
|
||||
@synchronized(self){if(self->_trackingActive.load()||![node isEqual:self->_selectedToolNode])return;}
|
||||
id<FxCustomParameterActionAPI_v4>a=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;
|
||||
[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(self->_apiManager,time).document);NSMutableArray *masks=[[DYMasksForTool(doc,node)mutableCopy]autorelease];if(masks.count>=DYToolMaskLimit)return;NSInteger kind=((int[]){0,2,1,0,3,4,5})[item];NSDictionary *mask=DYNewMask(kind);[masks addObject:mask];if(!DYSetToolMasks(doc,node,masks))return;
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasSelection" object:self->_apiManager userInfo:@{@"node":node,@"mask":mask[@"id"],@"draw":@(kind==2),@"document":doc}];
|
||||
id<FxUndoAPI>u=[self->_apiManager apiForProtocol:@protocol(FxUndoAPI)];[u startUndoGroup:@"添加工具蒙版"];DYWriteTools(self->_apiManager,doc,time);[u endUndoGroup];
|
||||
}@finally{[a endAction:self];}[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];
|
||||
});[node release];return;
|
||||
}
|
||||
if(type==NSEventTypeKeyDown&&key==27){[self discardToolCanvasDraft];[self postToolCanvasStatus:@"已取消绘制,保留原蒙版。"];return;}
|
||||
if(type==NSEventTypeKeyDown&&(key==13||key==10||key==3)&&_toolDrawingPen){if([_toolCanvasDraft[@"nodes"]length]<3*sizeof(DYBezierNode)){[self postToolCanvasStatus:@"至少放置三个点,再点首节点或完成绘制。"];return;}[self commitToolCanvasDraftAtTime:time];return;}
|
||||
if(type==NSEventTypeKeyDown&&(key==8||key==127)&&_toolDrawingPen){NSMutableData *nodes=[[_toolCanvasDraft[@"nodes"]mutableCopy]autorelease];if(nodes.length)[nodes setLength:nodes.length-sizeof(DYBezierNode)];if(nodes)_toolCanvasDraft[@"nodes"]=nodes;[self postToolCanvasStatus:@"已移除最后一个钢笔点,继续点击放置。"];return;}
|
||||
if(type==NSEventTypeKeyDown&&(key==8||key==127)&&!_toolDrawingPen&&_toolDragPart>=1000){
|
||||
NSDictionary *mask=[self toolMask:_selectedToolMask node:_selectedToolNode document:_toolCanvasDocument];DYMaskParameters parameters=DYMaskAtTime(mask,time);NSUInteger count=[mask[@"nodes"]length]/sizeof(DYBezierNode),index=(_toolDragPart-1000)/3;if(parameters.kind!=DYMaskBezier||index>=count)return;
|
||||
if(count<=3){[self postToolCanvasStatus:@"闭合路径至少保留三个点;可使用重画钢笔重新绘制。"];return;}
|
||||
[self toolCanvasEvent:NSEventTypeLeftMouseDown point:point part:_toolDragPart modifiers:modifiers key:0 time:time];NSMutableData *nodes=[[_toolCanvasDraft[@"nodes"]mutableCopy]autorelease];[nodes replaceBytesInRange:NSMakeRange(index*sizeof(DYBezierNode),sizeof(DYBezierNode)) withBytes:NULL length:0];_toolCanvasDraft[@"nodes"]=nodes;[self commitToolCanvasDraftAtTime:time];return;
|
||||
}
|
||||
if(type==NSEventTypeMouseMoved){if(_toolDrawingPen){if(_toolCanvasDraft&&CMTimeCompare(time,_toolCanvasEditTime)!=0){[self discardToolCanvasDraft];return;}_toolCanvasHoverPoint=point;_toolCanvasHasHover=[_toolCanvasDraft[@"nodes"]length]>0;}return;}
|
||||
if(type==NSEventTypeLeftMouseDown){
|
||||
_toolCanvasHasHover=NO;
|
||||
if(_toolDrawingPen&&part==1000&&[_toolCanvasDraft[@"nodes"]length]>=3*sizeof(DYBezierNode)){[self commitToolCanvasDraftAtTime:time];return;}
|
||||
if(!_toolCanvasDraft){NSDictionary *mask=[self toolMask:_selectedToolMask node:_selectedToolNode document:_toolCanvasDocument];if(!mask)return;++_toolCanvasRevision;_toolCanvasOriginal=[DYMutablePlist(mask)retain];_toolCanvasDraft=[DYMutablePlist(mask)retain];_toolCanvasEditTime=time;_toolDragParameters=DYMaskAtTime(mask,time);_toolDragParameters.imageAspect=_toolSourceFrame.valid()?float(_toolSourceFrame.width)/_toolSourceFrame.height:1;_toolCanvasDraft[@"parameters"]=[NSData dataWithBytes:&_toolDragParameters length:sizeof(DYMaskParameters)];_toolCanvasDraft[@"keys"]=@[];if(_toolDrawingPen)_toolCanvasDraft[@"nodes"]=[NSData data];}
|
||||
if(CMTimeCompare(time,_toolCanvasEditTime)!=0){[self discardToolCanvasDraft];[self postToolCanvasStatus:@"播放头已移动,请重新绘制。"];return;}
|
||||
_toolDragStart=point;_toolDragPart=part;_toolDragParameters=DYMaskAtTime(_toolCanvasDraft,time);
|
||||
if(_toolDrawingPen){DYMaskParameters p=_toolDragParameters;float a=p.imageAspect,dx=(point.x-p.centerX)*a,dy=point.y-p.centerY,c=cos(p.angle),s=sin(p.angle),x=(dx*c+dy*s)/(p.width*a),y=(-dx*s+dy*c)/p.height;DYBezierNode n={x,y,x,y,x,y};NSMutableData *nodes=[[_toolCanvasDraft[@"nodes"]mutableCopy]autorelease];if(nodes.length>=32*sizeof(n)){[self postToolCanvasStatus:@"已达到32个钢笔点,请完成绘制。"];return;}[nodes appendBytes:&n length:sizeof(n)];_toolCanvasDraft[@"nodes"]=nodes;[self postToolCanvasStatus:[NSString stringWithFormat:@"钢笔已放置%lu个点 · 拖出曲柄;点首节点或完成绘制闭合。",(unsigned long)(nodes.length/sizeof(n))]];}return;
|
||||
}
|
||||
if(!_toolCanvasDraft)return;
|
||||
if(CMTimeCompare(time,_toolCanvasEditTime)!=0){[self discardToolCanvasDraft];return;}
|
||||
if(type==NSEventTypeLeftMouseDragged){_toolCanvasHasHover=NO;DYMaskParameters p=_toolDragParameters;float dx=point.x-_toolDragStart.x,dy=point.y-_toolDragStart.y;
|
||||
if(_toolDrawingPen||_toolDragPart>=1000){NSMutableData *data=[[_toolCanvasDraft[@"nodes"]mutableCopy]autorelease];NSUInteger count=data.length/sizeof(DYBezierNode);if(count){auto *nodes=(DYBezierNode*)data.mutableBytes;NSUInteger index=_toolDrawingPen?count-1:(_toolDragPart-1000)/3,handle=_toolDrawingPen?2:(_toolDragPart-1000)%3;float a=p.imageAspect,c=cos(p.angle),s=sin(p.angle),x=((point.x-p.centerX)*a*c+(point.y-p.centerY)*s)/(p.width*a),y=(-(point.x-p.centerX)*a*s+(point.y-p.centerY)*c)/p.height;if(index<count){if(handle==0){float mx=x-nodes[index].x,my=y-nodes[index].y;nodes[index].x=x;nodes[index].y=y;nodes[index].inX+=mx;nodes[index].inY+=my;nodes[index].outX+=mx;nodes[index].outY+=my;}else if(handle==1){nodes[index].inX=x;nodes[index].inY=y;}else{nodes[index].outX=x;nodes[index].outY=y;if(_toolDrawingPen){nodes[index].inX=2*nodes[index].x-x;nodes[index].inY=2*nodes[index].y-y;}}_toolCanvasDraft[@"nodes"]=data;}}}
|
||||
else if(_toolDragPart==6)p.angle=atan2((point.y-p.centerY),(point.x-p.centerX)*p.imageAspect)+M_PI/2;
|
||||
else if(_toolDragPart>=2&&_toolDragPart<=5){float a=p.imageAspect,c=cos(p.angle),s=sin(p.angle),x=(point.x-p.centerX)*a,y=point.y-p.centerY;p.width=MAX(.001f,2*fabs(x*c+y*s)/a);p.height=MAX(.001f,2*fabs(-x*s+y*c));}
|
||||
else{p.centerX+=dx;p.centerY+=dy;}if(dyValidMaskParameters(p))_toolCanvasDraft[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];return;
|
||||
}
|
||||
if(type==NSEventTypeLeftMouseUp&&!_toolDrawingPen)[self commitToolCanvasDraftAtTime:time];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Nontrivial authoring and GPU regressions; runs as part of the signed CLI self-test.
|
||||
{
|
||||
DYToolDocument *empty=[[[DYToolDocument alloc]init]autorelease];NSMutableDictionary *doc=DYMutablePlist(empty.document);
|
||||
NSMutableDictionary *first=DYMutablePlist(DYNewTool(@"hsl")),*second=DYMutablePlist(DYNewTool(@"hsl"));doc[@"layers"]=[NSMutableArray arrayWithObjects:first,second,nil];
|
||||
run.need(@"tool-document-two-independent-hsl",DYValidToolDocument(doc)&&![first[@"id"]isEqual:second[@"id"]]);
|
||||
first[@"values"][@"hsl0_0"]=@32;second[@"values"][@"hsl1_2"]=@55;
|
||||
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(@"tool-document-secure-archive-roundtrip",[restored isEqual:authored]&&restored.hash==authored.hash);
|
||||
DYToolManager *one=[[[DYToolManager alloc]initWithHost:manager node:first]autorelease];DYWriteTools(manager,doc,kCMTimeZero);id<FxCustomParameterActionAPI_v4>action=(id)one;[action startAction:one];
|
||||
[(id<FxParameterSettingAPI_v6>)one setFloatValue:17 toParameter:2068 atTime:kCMTimeZero];[(id<FxParameterSettingAPI_v6>)one setFloatValue:26 toParameter:2076 atTime:kCMTimeZero];[action endAction:one];NSDictionary *written=DYReadTools(manager,kCMTimeZero).document;
|
||||
run.record(@"instance-proxy-batches-multiple-fields-without-clobber",[DYToolWithID(written,first[@"id"])[@"values"][@"hsl0_0"]isEqual:@17]&&[DYToolWithID(written,first[@"id"])[@"values"][@"hsl1_0"]isEqual:@26]&&[DYToolWithID(written,second[@"id"])[@"values"][@"hsl1_2"]isEqual:@55]);
|
||||
DYInspector *stackInspector=[[[DYInspector alloc]initWithAPIManager:manager renderer:renderer]autorelease];[stackInspector refresh];[stackInspector setFrameSize:NSMakeSize(360,780)];[stackInspector layoutSubtreeIfNeeded];NSDictionary *stackViews=[stackInspector valueForKey:@"_stackViews"];BOOL nativeViews=stackViews.count==2;for(NSString *ID in stackViews){NSArray *c=[stackViews[ID]valueForKey:@"_cards"];nativeViews&=c.count==1&&c[0][@"maskButton"]&&c[0][@"repeatButton"]&&[c[0][@"section"][@"key"]isEqual:@"hsl"];}run.record(@"two-native-hsl-panels-with-mask-and-repeat-buttons",nativeViews);
|
||||
NSMutableDictionary *invalid=DYMutablePlist(doc);invalid[@"layers"][1][@"id"]=first[@"id"];run.record(@"tool-document-rejects-duplicate-identity",!DYValidToolDocument(invalid));invalid=DYMutablePlist(doc);invalid[@"layers"][0][@"values"][@"hsl0_0"]=@(NAN);run.record(@"tool-document-rejects-nonfinite",!DYValidToolDocument(invalid));
|
||||
NSMutableDictionary *mask=DYMutablePlist(DYNewMask(DYMaskRectangle));DYMaskParameters p=DYMaskAtTime(mask,kCMTimeZero);p.feather=0;p.width=.5;p.height=.5;mask[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];CMTime a=CMTimeMake(1001,24000),b=CMTimeMake(2002,24000);DYMaskParameters moved=p;moved.centerX=.7;moved.width=.6;moved.angle=.2;mask[@"keys"]=@[DYMaskKey(a,p,YES,1),DYMaskKey(b,moved,NO,.9)];
|
||||
DYMaskParameters mid=DYMaskAtTime(mask,CMTimeMake(3003,48000));run.record(@"mask-rational-time-interpolates-independent-geometry",fabs(mid.centerX-.6)<1e-6&&fabs(mid.width-.55)<1e-6&&fabs(mid.angle-.1)<1e-6);
|
||||
DYMaskParameters replacement=p;replacement.centerX=.8;BOOL merged=DYMergeTracking(mask,@[DYMaskKey(a,replacement,NO,.8),DYMaskKey(b,replacement,NO,.8)]);run.record(@"tracking-merge-preserves-manual-keys",merged&&fabs(DYMaskAtTime(mask,a).centerX-.5)<1e-6&&fabs(DYMaskAtTime(mask,b).centerX-.8)<1e-6);
|
||||
doc=DYMutablePlist(empty.document);doc[@"baseMasks"][@"hsl"]=[NSMutableArray arrayWithObject:mask];NSDictionary *snapshot=DYToolRenderSnapshot(doc,CMTimeMake(3003,48000));DYMaskParameters resolved=DYMaskAtTime(snapshot[@"baseMasks"][@"hsl"][0],kCMTimeZero);run.record(@"render-snapshot-freezes-time-without-author-keys",[snapshot[@"baseMasks"][@"hsl"][0][@"keys"]count]==0&&fabs(resolved.centerX-.65)<1e-6&&[mask[@"keys"]count]==2);
|
||||
auto renderTools=[&](NSDictionary *tools,DYUniforms u,NSData *mesh,NSString *name){NSError *failure=nil;BOOL ok=[renderer renderSource:source destination:destination uniforms:u paths:@{} spider:mesh tools:tools error:&failure];run.need(name,ok,@{@"error":reason(failure)});return read(destination,gpu);};
|
||||
[[source metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:input.data() bytesPerRow:width*8];
|
||||
Pixels baseline=renderTools(empty.document,defaults,nil,@"empty-tool-document-render");run.record(@"empty-tool-document-preserves-legacy-pixels-exactly",difference(baseline,neutral).maximum==0);
|
||||
doc=DYMutablePlist(empty.document);for(NSString *type in DYToolTypes())[doc[@"layers"]addObject:DYNewTool(type)];Pixels initialized=renderTools(doc,defaults,nil,@"all-twelve-initialized-tool-types-render");run.record(@"initialized-repeated-tools-are-exactly-neutral",difference(initialized,neutral).maximum==0);
|
||||
// Reference is two explicit isolated native operations, which catches shared
|
||||
// uniform or lookup caches, ordering, repeated CST and accidental base replay.
|
||||
DYUniforms layerOne=DYToolUniforms(first),layerTwo=DYToolUniforms(second);render(run,renderer,source,destination,gpu,layerOne,@{},@"hsl-stack-first-reference");DYDiagnosticTile *intermediate=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:width height:height]autorelease];Pixels single=read(destination,gpu);[[intermediate metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,width,height) mipmapLevel:0 withBytes:single.data() bytesPerRow:width*8];Pixels expected=render(run,renderer,intermediate,destination,gpu,layerTwo,@{},@"hsl-stack-second-reference");
|
||||
doc=DYMutablePlist(empty.document);doc[@"layers"]=[NSMutableArray arrayWithObjects:first,second,nil];Pixels actual=renderTools(doc,defaults,nil,@"two-hsl-stack-render");run.record(@"two-hsl-stack-matches-independent-sequential-reference",difference(expected,actual).maximum<.003&&difference(actual,single).different>20,measure(difference(expected,actual)));
|
||||
// A hard rectangle's exterior must match the bypassed tool and its interior
|
||||
// must match the active tool; alpha cannot change on either side.
|
||||
DYUniforms hu=defaults;hu.hslHueA.x=32;hu.skinProtection.x=0;Pixels unmasked=render(run,renderer,source,destination,gpu,hu,@{},@"mask-hsl-active-reference");DYUniforms off=hu;off.hslSectionEnabled=0;Pixels noHSL=render(run,renderer,source,destination,gpu,off,@{},@"mask-hsl-bypass-reference");
|
||||
for(int kind=0;kind<6;kind++){@autoreleasepool{NSMutableDictionary *m=DYMutablePlist(DYNewMask(kind));DYMaskParameters params=DYMaskAtTime(m,kCMTimeZero);params.feather=0;params.width=.5;params.height=.5;params.angle=.21;if(kind==DYMaskLumaKey){params.inputBlack=.2;params.inputWhite=.8;}m[@"parameters"]=[NSData dataWithBytes:¶ms length:sizeof(params)];doc=DYMutablePlist(empty.document);doc[@"baseMasks"][@"hsl"]=[NSMutableArray arrayWithObject:m];Pixels pixels=renderTools(doc,hu,nil,[NSString stringWithFormat:@"mask-type-%d-gpu",kind]);BOOL finite=difference(pixels,pixels).nonfinite==0,alpha=YES;for(NSUInteger i=0;i<width*height;i++)alpha&=pixels[i*4+3]==input[i*4+3];run.record([NSString stringWithFormat:@"mask-type-%d-preserves-alpha-finite",kind],finite&&alpha);
|
||||
DYMaskPath path=dyFlattenMask((const DYBezierNode*)[m[@"nodes"]bytes],[m[@"nodes"]length]/sizeof(DYBezierNode));params.imageAspect=float(width)/height;double worst=0;for(NSUInteger y=0;y<height;y++)for(NSUInteger x=0;x<width;x++){auto index=(y*width+x)*4;float a=input[index+3];if(!(a>0))continue;float3 code;auto encode=[](float v){return v<=.0031308f?v*12.92f:1.055f*powf(MAX(0.f,v),1/2.4f)-.055f;};for(int c=0;c<3;c++)code[c]=encode((float)(__fp16)((float)input[index+c]/a));float coverage=dyMaskOperator((x+.5f)/width,(y+.5f)/height,code,params,path);for(int c=0;c<3;c++){float before=encode((float)noHSL[index+c]/a),after=encode((float)unmasked[index+c]/a),mixed=before+(after-before)*coverage;float expected=(mixed<=.04045f?mixed/12.92f:powf(MAX(0.f,(mixed+.055f)/1.055f),2.4f))*a;worst=MAX(worst,fabs(expected-(float)pixels[index+c]));}}run.record([NSString stringWithFormat:@"mask-type-%d-independent-cpu-coverage",kind],worst<.004,@{@"maximumError":@(worst)});}}
|
||||
mask=DYMutablePlist(DYNewMask(DYMaskRectangle));p=DYMaskAtTime(mask,kCMTimeZero);p.feather=0;p.width=p.height=.5;mask[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];doc=DYMutablePlist(empty.document);doc[@"baseMasks"][@"hsl"]=[NSMutableArray arrayWithObject:mask];actual=renderTools(doc,hu,nil,@"hsl-rectangle-isolated-render");BOOL region=YES;double maxRegion=0;for(NSUInteger y=0;y<height;y++)for(NSUInteger x=0;x<width;x++){BOOL inside=x>=width/4&&x<width*3/4&&y>=height/4&&y<height*3/4;for(int c=0;c<4;c++){auto index=(y*width+x)*4+c;double delta=fabs((float)actual[index]-(float)(inside?unmasked:noHSL)[index]);maxRegion=MAX(maxRegion,delta);region&=delta<.003;}}run.record(@"per-tool-mask-affects-only-own-region",region,@{@"maximumError":@(maxRegion)});
|
||||
mask[@"enabled"]=@NO;actual=renderTools(doc,hu,nil,@"mask-eye-disabled-render");run.record(@"disabled-mask-restores-unmasked-tool",difference(actual,unmasked).maximum==0);
|
||||
mask[@"enabled"]=@YES;p.width=p.height=4;mask[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];actual=renderTools(doc,hu,nil,@"all-one-mask-render");run.record(@"all-one-mask-preserves-native-operation",difference(actual,unmasked).maximum<.001);
|
||||
p.strength=0;mask[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];actual=renderTools(doc,hu,nil,@"all-zero-mask-render");run.record(@"all-zero-mask-bypasses-only-own-tool",difference(actual,noHSL).maximum<.003,measure(difference(actual,noHSL)));
|
||||
error=nil;NSURL *blocked=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"masked-export-must-not-exist.cube"]];BOOL exported=[renderer exportLUT:blocked uniforms:hu paths:@{} spider:nil tools:doc error:&error];run.record(@"cube-export-refuses-spatial-mask-with-clear-error",!exported&&error&&![NSFileManager.defaultManager fileExistsAtPath:blocked.path]);
|
||||
DYUniforms primary=defaults;primary.cm.exposure=.6;Pixels primaryFull=render(run,renderer,source,destination,gpu,primary,@{},@"primary-mask-full-reference");DYUniforms primaryOff=primary;primaryOff.primarySectionEnabled=0;Pixels primaryBypass=render(run,renderer,source,destination,gpu,primaryOff,@{},@"primary-mask-bypass-reference");mask=DYMutablePlist(DYNewMask(DYMaskRectangle));p=DYMaskAtTime(mask,kCMTimeZero);p.feather=0;p.width=p.height=.5;mask[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];doc=DYMutablePlist(empty.document);doc[@"baseMasks"][@"primary"]=[NSMutableArray arrayWithObject:mask];actual=renderTools(doc,primary,nil,@"primary-cst-mask-render");BOOL primaryRegion=YES;for(NSUInteger y=0;y<height;y++)for(NSUInteger x=0;x<width;x++)for(int c=0;c<4;c++){BOOL inside=x>=width/4&&x<width*3/4&&y>=height/4&&y<height*3/4;auto i=(y*width+x)*4+c;primaryRegion&=fabs((float)actual[i]-(float)(inside?primaryFull:primaryBypass)[i])<.003;}run.record(@"primary-mask-blends-cst-only-in-selected-region",primaryRegion);
|
||||
DYWriteTools(manager,empty.document,kCMTimeZero);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
|
||||
#import <Metal/Metal.h>
|
||||
|
||||
namespace {
|
||||
struct FlowOutput {float x,y,error,valid;};
|
||||
struct PyramidInfo {int width[5],height[5],offset[5],levels;};
|
||||
class MetalFlow final : public dy::FlowBackend {
|
||||
id<MTLDevice> device_=nil;
|
||||
id<MTLCommandQueue> queue_=nil;
|
||||
id<MTLComputePipelineState> pyramid_=nil,flow_=nil;
|
||||
id<MTLBuffer> frames_[2]={nil,nil},points_=nil,results_=nil;
|
||||
PyramidInfo info_{};
|
||||
int previous_=0;
|
||||
bool finish(id<MTLCommandBuffer> b) {
|
||||
[b commit];[b waitUntilCompleted];return b.status==MTLCommandBufferStatusCompleted;
|
||||
}
|
||||
void pyramid(id<MTLCommandBuffer> b,id<MTLBuffer> frame) {
|
||||
for(int i=1;i<info_.levels;i++) {
|
||||
id<MTLComputeCommandEncoder>e=[b computeCommandEncoder];[e setComputePipelineState:pyramid_];
|
||||
[e setBuffer:frame offset:0 atIndex:0];[e setBytes:&info_ length:sizeof(info_) atIndex:1];[e setBytes:&i length:sizeof(i) atIndex:2];
|
||||
[e dispatchThreads:MTLSizeMake(info_.width[i],info_.height[i],1) threadsPerThreadgroup:MTLSizeMake(16,8,1)];[e endEncoding];
|
||||
}
|
||||
}
|
||||
public:
|
||||
MetalFlow(NSURL* url,NSError** error) {
|
||||
device_=MTLCreateSystemDefaultDevice();queue_=[device_ newCommandQueue];
|
||||
id<MTLLibrary> l=[device_ newLibraryWithURL:url error:error];if(!l)return;
|
||||
id<MTLFunction> p=[l newFunctionWithName:@"dyTrackPyramid"],f=[l newFunctionWithName:@"dyTrackFlow"];
|
||||
pyramid_=[device_ newComputePipelineStateWithFunction:p error:error];flow_=[device_ newComputePipelineStateWithFunction:f error:error];[p release];[f release];[l release];
|
||||
}
|
||||
~MetalFlow(){for(int i=0;i<2;i++)[frames_[i] release];[points_ release];[results_ release];[pyramid_ release];[flow_ release];[queue_ release];[device_ release];}
|
||||
bool ready()const{return device_&&queue_&&pyramid_&&flow_&&flow_.threadExecutionWidth==32;}
|
||||
bool reset(const dy::GrayFrame& f) override {
|
||||
if(!ready()||!f.valid())return false;
|
||||
info_={};info_.levels=1;info_.width[0]=f.width;info_.height[0]=f.height;
|
||||
int total=f.width*f.height;
|
||||
while(info_.levels<dy::TrackerPyramidLevels&&info_.width[info_.levels-1]>=80&&info_.height[info_.levels-1]>=80) {
|
||||
int i=info_.levels++;info_.width[i]=info_.width[i-1]/2;info_.height[i]=info_.height[i-1]/2;
|
||||
info_.offset[i]=total;total+=info_.width[i]*info_.height[i];
|
||||
}
|
||||
for(int i=0;i<2;i++){[frames_[i] release];frames_[i]=nil;}[points_ release];points_=nil;[results_ release];results_=nil;
|
||||
for(int i=0;i<2;i++)frames_[i]=[device_ newBufferWithLength:total*sizeof(float) options:MTLResourceStorageModeShared];
|
||||
points_=[device_ newBufferWithLength:dy::TrackerFeatureLimit*sizeof(dy::FlowPoint) options:MTLResourceStorageModeShared];
|
||||
results_=[device_ newBufferWithLength:dy::TrackerFeatureLimit*sizeof(FlowOutput) options:MTLResourceStorageModeShared];
|
||||
if(!frames_[0]||!frames_[1]||!points_||!results_)return false;
|
||||
previous_=0;memcpy(frames_[0].contents,f.pixels.data(),f.pixels.size()*sizeof(float));
|
||||
id<MTLCommandBuffer>b=[queue_ commandBuffer];pyramid(b,frames_[0]);return finish(b);
|
||||
}
|
||||
bool advance(const dy::GrayFrame& f,const std::vector<dy::FlowPoint>& points,std::vector<dy::FlowMatch>& matches) override {
|
||||
if(!f.valid()||f.width!=info_.width[0]||f.height!=info_.height[0]||points.empty()||points.size()>dy::TrackerFeatureLimit)return false;
|
||||
int next=1-previous_;memcpy(frames_[next].contents,f.pixels.data(),f.pixels.size()*sizeof(float));
|
||||
memcpy(points_.contents,points.data(),points.size()*sizeof(dy::FlowPoint));
|
||||
id<MTLCommandBuffer>b=[queue_ commandBuffer];pyramid(b,frames_[next]);
|
||||
id<MTLComputeCommandEncoder>e=[b computeCommandEncoder];[e setComputePipelineState:flow_];
|
||||
[e setBuffer:frames_[previous_] offset:0 atIndex:0];[e setBuffer:frames_[next] offset:0 atIndex:1];
|
||||
[e setBuffer:points_ offset:0 atIndex:2];[e setBuffer:results_ offset:0 atIndex:3];[e setBytes:&info_ length:sizeof(info_) atIndex:4];
|
||||
[e dispatchThreads:MTLSizeMake(points.size()*32,1,1) threadsPerThreadgroup:MTLSizeMake(flow_.threadExecutionWidth,1,1)];[e endEncoding];
|
||||
if(!finish(b))return false;auto*r=static_cast<const FlowOutput*>(results_.contents);
|
||||
for(size_t i=0;i<points.size();i++)if(r[i].valid>0)matches.push_back({points[i],{r[i].x,r[i].y},r[i].error});
|
||||
previous_=next;return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
std::shared_ptr<dy::FlowBackend> DYToolCreateMetalFlow(NSURL* url,NSError** error) {
|
||||
auto backend=std::make_shared<MetalFlow>(url,error);if(backend->ready())return backend;
|
||||
if(error&&!*error)*error=[NSError errorWithDomain:@"com.dayu.color.tracking" code:1 userInfo:@{NSLocalizedDescriptionKey:@"Metal 跟踪引擎不可用"}];return {};
|
||||
}
|
||||
@@ -0,0 +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 DYToolStageRange {int first,last,suppressBlackWhite;};
|
||||
@@ -0,0 +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)
|
||||
- (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;
|
||||
@end
|
||||
@@ -0,0 +1,18 @@
|
||||
NSString *_toolSession,*_selectedToolNode,*_selectedToolMask;
|
||||
NSTimer *_toolAnalysisTimer;
|
||||
BOOL _toolCaptureEnabled,_toolCanvasHidden,_toolDrawingPen,_toolShowCoverage,_toolCanvasCommitPending;
|
||||
NSMutableDictionary *_toolCanvasDraft,*_toolCanvasOriginal;NSDictionary *_toolCanvasDocument;
|
||||
NSPoint _toolCanvasHoverPoint;BOOL _toolCanvasHasHover;
|
||||
NSPoint _toolDragStart;DYMaskParameters _toolDragParameters;NSInteger _toolDragPart;
|
||||
CMTime _toolCanvasEditTime;uint64_t _toolCanvasRevision;
|
||||
dy::GrayFrame _toolSourceFrame,_trackingReferenceFrame;
|
||||
CMTime _toolSourceTime,_trackingReferenceTime,_trackingFrameDuration,_trackingPreviousTime;
|
||||
std::atomic_bool _trackingActive,_trackingFinishing,_trackingInFrame,_trackingCancelled;
|
||||
BOOL _trackingBackward,_trackingBoth,_trackingSingle,_trackingFlip,_trackingDiscard;
|
||||
uint64_t _trackingGeneration;double _trackingStarted;
|
||||
NSString *_trackingNode,*_trackingMaskID,*_trackingMessage;
|
||||
NSDictionary *_trackingFrozenMask;NSMutableDictionary *_trackingCandidate;
|
||||
NSMutableArray *_trackingSamples;
|
||||
DYMaskParameters _trackingSeed;
|
||||
dy::Tracker _toolTracker;
|
||||
NSMutableDictionary *_toolCaptureDevices;
|
||||
@@ -0,0 +1,85 @@
|
||||
- (void)initializeToolHost {
|
||||
_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 {
|
||||
[_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];
|
||||
}
|
||||
- (void)adoptToolCanvasDocument:(NSDictionary*)document {
|
||||
if(!document)return;@synchronized(self){[_toolCanvasDocument release];_toolCanvasDocument=[document copy];if([self toolMask:_selectedToolMask node:_selectedToolNode document:document])return;NSString *node=nil,*maskID=nil;for(NSString *type in DYToolTypes())for(NSDictionary *mask in document[@"baseMasks"][type])if(!node&&[mask[@"enabled"]boolValue]){node=[@"base:" stringByAppendingString:type];maskID=mask[@"id"];}for(NSDictionary *layer in document[@"layers"])for(NSDictionary *mask in layer[@"masks"])if(!node&&[mask[@"enabled"]boolValue]){node=layer[@"id"];maskID=mask[@"id"];}[_selectedToolNode release];_selectedToolNode=[node copy];[_selectedToolMask release];_selectedToolMask=[maskID copy];}
|
||||
}
|
||||
- (void)scheduleToolCanvasRegistration {
|
||||
_toolCaptureEnabled=YES;dispatch_async(dispatch_get_main_queue(),^{id<FxCustomParameterActionAPI_v4>a=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{if(!self->_toolSession){NSString *session=NSUUID.UUID.UUIDString;id<FxParameterSettingAPI_v6>s=[self->_apiManager apiForProtocol:@protocol(FxParameterSettingAPI_v6)];BOOL accepted=[s setStringParameterValue:session toParameter:DYCanvasSessionParameterID];os_log(OS_LOG_DEFAULT,"dayu_tool_canvas_registered accepted=%{public}d",(int)accepted);{self->_toolSession=[session copy];@synchronized(DYToolCanvasSessions()){[DYToolCanvasSessions()setObject:self forKey:session];}}}}@finally{[a endAction:self];}});
|
||||
}
|
||||
- (dy::GrayFrame)toolGrayFrame:(FxImageTile*)tile error:(NSError**)error {
|
||||
@synchronized(_toolCaptureDevices){FxRect b=tile.tilePixelBounds,image=tile.imagePixelBounds;if(b.left!=image.left||b.right!=image.right||b.bottom!=image.bottom||b.top!=image.top)return {};
|
||||
NSNumber *key=@(tile.deviceRegistryID);NSMutableDictionary *entry=_toolCaptureDevices[key];if(!entry){NSArray *devices=MTLCopyAllDevices();id<MTLDevice>d=nil;for(id<MTLDevice>candidate in devices)if(candidate.registryID==tile.deviceRegistryID)d=candidate;if(d){id<MTLLibrary>library=[d newLibraryWithURL:[[NSBundle bundleForClass:self.class]URLForResource:@"default" withExtension:@"metallib"]error:error];id<MTLFunction>function=[library newFunctionWithName:@"dyToolCapture"];id<MTLComputePipelineState>pipeline=function?[d newComputePipelineStateWithFunction:function error:error]:nil;id<MTLCommandQueue>queue=[d newCommandQueue];if(pipeline&&queue){entry=[NSMutableDictionary dictionaryWithDictionary:@{@"device":d,@"pipeline":pipeline,@"queue":queue}];_toolCaptureDevices[key]=entry;}[pipeline release];[queue release];[function release];[library release];}[devices release];if(!entry)return {};}
|
||||
id<MTLTexture>texture=[tile metalTextureForDevice:entry[@"device"]];if(!texture)return {};double aspect=tile.pixelAspect;if(!std::isfinite(aspect)||aspect<=0)return {};aspect=MAX(.01,aspect);double displayHeight=texture.height/aspect,scale=MIN(1.,MIN(3840./texture.width,2160./displayHeight));unsigned width=(unsigned)floor(texture.width*scale),height=(unsigned)floor(displayHeight*scale);if(width<16||height<16||height>2160||width>3840)return {};
|
||||
id<MTLBuffer>buffer=[entry[@"device"]newBufferWithLength:width*height*sizeof(float) options:MTLResourceStorageModeShared];if(!buffer)return {};vector_uint3 info={width,height,(unsigned)(tile.imageOrigin==kFxImageOrigin_BOTTOM_LEFT)};id<MTLCommandBuffer>commands=[entry[@"queue"]commandBuffer];id<MTLComputeCommandEncoder>encoder=[commands computeCommandEncoder];[encoder setComputePipelineState:entry[@"pipeline"]];[encoder setTexture:texture atIndex:0];[encoder setBuffer:buffer offset:0 atIndex:0];[encoder setBytes:&info length:sizeof(info) atIndex:1];[encoder dispatchThreads:MTLSizeMake(width,height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];[encoder endEncoding];[commands commit];[commands waitUntilCompleted];dy::GrayFrame frame;if(commands.status==MTLCommandBufferStatusCompleted){frame={int(width),int(height),std::vector<float>(width*height)};memcpy(frame.pixels.data(),buffer.contents,width*height*sizeof(float));}[buffer release];return frame;
|
||||
}
|
||||
}
|
||||
- (NSMutableDictionary*)toolMask:(NSString*)maskID node:(NSString*)nodeID document:(NSDictionary*)doc {for(NSMutableDictionary *m in DYMasksForTool(doc,nodeID))if([m[@"id"]isEqual:maskID])return m;return nil;}
|
||||
- (void)toolStatus:(NSString*)message {
|
||||
NSString *node=[[_trackingNode?:_selectedToolNode copy]autorelease];dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolTrackingStatus" object:self->_apiManager userInfo:@{@"node":node?:@"",@"message":message?:@""}];});
|
||||
}
|
||||
- (void)toolCanvasSelection:(NSNotification*)notification {
|
||||
NSString *node=notification.userInfo[@"node"],*mask=notification.userInfo[@"mask"];if(!node||!mask)return;NSDictionary *document=notification.userInfo[@"document"];if(document&&DYValidToolDocument(document)){DYToolDocument *immutable=[[[DYToolDocument alloc]init]autorelease];immutable.document=document;[self adoptToolCanvasDocument:immutable.document];}os_log(OS_LOG_DEFAULT,"dayu_tool_canvas_selected");
|
||||
@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;}}
|
||||
- (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)};}
|
||||
}
|
||||
- (void)toolTrackRequested:(NSNotification*)notification {
|
||||
NSInteger direction=[notification.userInfo[@"direction"]integerValue];if(direction==9){_trackingCancelled.store(true);return;}@synchronized(self){if(_toolDrawingPen||_toolCanvasCommitPending){[self postToolCanvasStatus:@"请先完成或取消钢笔绘制,再开始跟踪。"];return;}}if(_trackingActive.load()){[self toolStatus:@"请先取消当前跟踪"];return;}
|
||||
id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{
|
||||
id<FxAnalysisAPI>analysis=[_apiManager apiForProtocol:@protocol(FxAnalysisAPI)];FxAnalysisState state=[analysis analysisStateForEffect];if(!analysis||state==kFxAnalysisState_AnalysisRequested||state==kFxAnalysisState_AnalysisStarted){[self toolStatus:@"宿主未就绪,请等待当前分析结束"];return;}
|
||||
CMTime time=a.currentTime;NSDictionary *doc=DYReadTools(_apiManager,time).document;NSDictionary *mask=[self toolMask:notification.userInfo[@"mask"] node:notification.userInfo[@"node"] document:doc];if(!mask||![mask[@"enabled"]boolValue]){[self toolStatus:@"请先选择当前工具的启用蒙版"];return;}DYMaskParameters seed=DYMaskAtTime(mask,time);if(seed.kind>DYMaskBezier||(seed.kind==DYMaskBezier&&[mask[@"nodes"]length]<3*sizeof(DYBezierNode))){[self toolStatus:@"跟踪需要矩形、椭圆或闭合钢笔区域"];return;}
|
||||
@synchronized(self){if(!_toolSourceFrame.valid()||!CMTIME_IS_NUMERIC(_toolSourceTime)||CMTimeCompare(_toolSourceTime,time)!=0){[self toolStatus:@"请移动播放头至起点,等待当前画面完成后再开始跟踪"];return;}_trackingReferenceFrame=_toolSourceFrame;}
|
||||
id<FxTimingAPI_v4>timing=[_apiManager apiForProtocol:@protocol(FxTimingAPI_v4)];NSUInteger numerator=[timing timelineFpsNumeratorForEffect:self],denominator=[timing timelineFpsDenominatorForEffect:self];_trackingFrameDuration=numerator&&denominator&&numerator<=INT32_MAX?CMTimeMake(denominator,(int32_t)numerator):kCMTimeInvalid;if(!CMTIME_IS_NUMERIC(_trackingFrameDuration)||_trackingFrameDuration.value<=0){[self toolStatus:@"宿主未提供精确帧长,跟踪未启动"];return;}
|
||||
[_trackingNode release];_trackingNode=[notification.userInfo[@"node"]copy];[_trackingMaskID release];_trackingMaskID=[notification.userInfo[@"mask"]copy];[_trackingFrozenMask release];_trackingFrozenMask=[mask copy];[_trackingCandidate release];_trackingCandidate=[DYMutablePlist(mask)retain];[_trackingSamples release];_trackingSamples=[NSMutableArray new];[_trackingMessage release];_trackingMessage=nil;
|
||||
_trackingReferenceTime=time;_trackingSeed=seed;_trackingBackward=direction<0;_trackingBoth=direction==0;_trackingSingle=std::abs((int)direction)==2;_trackingDiscard=NO;_trackingCancelled.store(false);_trackingFinishing.store(false);_trackingActive.store(true);++_trackingGeneration;_trackingStarted=NSProcessInfo.processInfo.systemUptime;
|
||||
NSError *error=nil;BOOL started=_trackingBackward?[analysis startBackwardAnalysis:kFxAnalysisLocation_GPU error:&error]:[analysis startForwardAnalysis:kFxAnalysisLocation_GPU error:&error];if(!started){_trackingActive.store(false);[self toolStatus:error.localizedDescription?:@"宿主未启动逐帧分析"];return;}
|
||||
[self toolStatus:@"正在读取宿主源帧并跟踪…"];if(!_toolAnalysisTimer)_toolAnalysisTimer=[[NSTimer scheduledTimerWithTimeInterval:.3 target:self selector:@selector(pollToolAnalysis:) userInfo:nil repeats:YES]retain];
|
||||
}@finally{[a endAction:self];}
|
||||
}
|
||||
- (void)pollToolAnalysis:(NSTimer*)timer {
|
||||
if(!_trackingActive.load()||_trackingFinishing.load()||_trackingInFrame.load())return;id<FxCustomParameterActionAPI_v4>a=[_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{id<FxAnalysisAPI>api=[_apiManager apiForProtocol:@protocol(FxAnalysisAPI)];FxAnalysisState state=[api analysisStateForEffect];if(state==kFxAnalysisState_AnalysisCompleted||state==kFxAnalysisState_AnalysisInterrupted||(state==kFxAnalysisState_NotAnalyzing&&NSProcessInfo.processInfo.systemUptime-_trackingStarted>2))[self cleanupAnalysis:nil];}@finally{[a endAction:self];}
|
||||
}
|
||||
- (BOOL)stopToolAnalysis:(NSString*)message error:(NSError**)error {
|
||||
if(message){[_trackingMessage release];_trackingMessage=[message copy];if(error)*error=[NSError errorWithDomain:@"com.dayu.color.tracking" code:2 userInfo:@{NSLocalizedDescriptionKey:message}];}[self cleanupAnalysis:nil];return NO;
|
||||
}
|
||||
- (BOOL)desiredAnalysisTimeRange:(CMTimeRange*)out forInputWithTimeRange:(CMTimeRange)input error:(NSError**)error {
|
||||
CMTime end=CMTimeRangeGetEnd(input),ref=_trackingReferenceTime,step=_trackingFrameDuration;if(!CMTIME_IS_NUMERIC(input.start)||!CMTIME_IS_NUMERIC(end)||!CMTIME_IS_NUMERIC(ref)||ref.epoch!=input.start.epoch||ref.epoch!=end.epoch||CMTimeCompare(ref,input.start)<0||CMTimeCompare(ref,end)>=0||!CMTIME_IS_NUMERIC(step)||step.value<=0)return [self stopToolAnalysis:@"跟踪起点或帧长无效" error:error];
|
||||
CMTime lo=_trackingBackward?input.start:ref,hi=_trackingBackward?CMTimeAdd(ref,step):end;if(_trackingSingle){if(_trackingBackward){lo=CMTimeSubtract(ref,step);if(CMTimeCompare(lo,input.start)<0)lo=input.start;}else hi=CMTimeAdd(ref,CMTimeMultiply(step,2));}if(CMTimeCompare(hi,end)>0)hi=end;if(_trackingBackward&&CMTimeCompare(ref,input.start)==0)return [self stopToolAnalysis:@"已到片段边界,未产生新轨迹" error:error];*out=CMTimeRangeFromTimeToTime(lo,hi);return out->duration.value>0;
|
||||
}
|
||||
- (BOOL)setupAnalysisForTimeRange:(CMTimeRange)range frameDuration:(CMTime)duration error:(NSError**)error {
|
||||
if(!CMTIME_IS_NUMERIC(duration)||duration.value<=0||duration.epoch!=0)return [self stopToolAnalysis:@"宿主分析帧长无效" error:error];_trackingFrameDuration=duration;_trackingPreviousTime=kCMTimeInvalid;_trackingFlip=NO;[_trackingSamples removeAllObjects];auto backend=DYToolCreateMetalFlow([[NSBundle bundleForClass:self.class]URLForResource:@"default" withExtension:@"metallib"],error);if(!backend)return [self stopToolAnalysis:@"Metal 跟踪后端无法启动" error:error];_toolTracker.setBackend(backend);
|
||||
std::vector<dy::FlowPoint>polygon;NSData *nodes=_trackingCandidate[@"nodes"];if(_trackingSeed.kind==DYMaskBezier){auto path=dyFlattenMask((const DYBezierNode*)nodes.bytes,nodes.length/sizeof(DYBezierNode));for(int i=0;i<path.count;i++)polygon.push_back({path.x[i],path.y[i]});}else if(_trackingSeed.kind==DYMaskRectangle)polygon={{-.5f,-.5f},{.5f,-.5f},{.5f,.5f},{-.5f,.5f}};else for(int i=0;i<128;i++){float angle=i*(2.f*M_PI/128);polygon.push_back({.5f*std::cos(angle),.5f*std::sin(angle)});}_toolTracker.setMask(std::move(polygon));return YES;
|
||||
}
|
||||
- (BOOL)analyzeFrame:(FxImageTile*)tile atTime:(CMTime)time error:(NSError**)error {
|
||||
if(!_trackingActive.load()||_trackingFinishing.load())return NO;_trackingInFrame.store(true);@try{
|
||||
if(_trackingCancelled.load())return [self stopToolAnalysis:@"已取消;保留最后连续可信轨迹" error:nil];if(_trackingSingle&&_trackingSamples.count>=2)return [self stopToolAnalysis:nil error:nil];if(_trackingSamples.count>=DYToolKeyLimit)return [self stopToolAnalysis:@"轨迹已到数量上限,保留已完成部分" error:error];
|
||||
CMTime expected=CMTIME_IS_NUMERIC(_trackingPreviousTime)?(_trackingBackward?CMTimeSubtract(_trackingPreviousTime,_trackingFrameDuration):CMTimeAdd(_trackingPreviousTime,_trackingFrameDuration)):_trackingReferenceTime;if(!CMTIME_IS_NUMERIC(time)||time.epoch!=expected.epoch||CMTimeCompare(time,expected)!=0)return [self stopToolAnalysis:@"宿主帧序列不连续,停在最后可信帧" error:error];
|
||||
dy::GrayFrame frame=[self toolGrayFrame:tile error:error];if(!frame.valid()||frame.width!=_trackingReferenceFrame.width||frame.height!=_trackingReferenceFrame.height)return [self stopToolAnalysis:@"宿主未返回完整源画面" error:error];
|
||||
if(!_trackingSamples.count){double same=0,flip=0;size_t count=0;for(int y=0;y<frame.height;y+=8)for(int x=0;x<frame.width;x+=8){float p=frame.pixels[y*frame.width+x];same+=fabs(p-_trackingReferenceFrame.pixels[y*frame.width+x]);flip+=fabs(p-_trackingReferenceFrame.pixels[(frame.height-1-y)*frame.width+x]);count++;}same/=MAX(size_t(1),count);flip/=MAX(size_t(1),count);BOOL direct=same<.035&&((same+.008<flip&&same<flip*.8)||flip<.008),reversed=flip<.035&&flip+.008<same&&flip<same*.8;if(!direct&&!reversed)return [self stopToolAnalysis:@"参考画面与分析帧不一致,请重新选择清晰起点" error:error];_trackingFlip=reversed;}
|
||||
if(_trackingFlip)for(int y=0;y<frame.height/2;y++)for(int x=0;x<frame.width;x++)std::swap(frame.pixels[y*frame.width+x],frame.pixels[(frame.height-1-y)*frame.width+x]);
|
||||
if(!_trackingSamples.count){if(!_toolTracker.reset(frame,{_trackingSeed.centerX,_trackingSeed.centerY,_trackingSeed.width,_trackingSeed.height,_trackingSeed.angle}))return [self stopToolAnalysis:@"蒙版内纹理不足,未生成不可靠轨迹" error:error];}else if(!_toolTracker.track(frame).valid)return [self stopToolAnalysis:@"失去可靠跟踪,保留最后可信帧" error:error];
|
||||
auto result=_toolTracker.result();DYMaskParameters p=DYMaskAtTime(_trackingFrozenMask,time);p.centerX=result.cx;p.centerY=result.cy;p.width=_trackingSeed.width*result.scaleX;p.height=_trackingSeed.height*result.scaleY;p.angle=_trackingSeed.angle+result.rotation;if(!dyValidMaskParameters(p))return [self stopToolAnalysis:@"跟踪变换无效,未写入错误结果" error:error];[_trackingSamples addObject:DYMaskKey(time,p,NO,result.confidence)];_trackingPreviousTime=time;
|
||||
if(_trackingSamples.count%15==0)[self toolStatus:[NSString stringWithFormat:@"已分析 %lu 帧 · 置信度 %.0f%%",(unsigned long)_trackingSamples.count,result.confidence*100]];return YES;
|
||||
}@finally{_trackingInFrame.store(false);}
|
||||
}
|
||||
- (BOOL)cleanupAnalysis:(NSError**)error {
|
||||
if(!_trackingActive.load()||_trackingFinishing.exchange(true))return YES;BOOL changed=_trackingSamples.count>1;if(changed&&!DYMergeTracking(_trackingCandidate,_trackingSamples)){[_trackingMessage release];_trackingMessage=[@"轨迹合并失败,原蒙版已保留" copy];_trackingDiscard=YES;}
|
||||
uint64_t generation=_trackingGeneration;BOOL second=_trackingBoth&&!_trackingBackward&&!_trackingCancelled.load()&&!_trackingDiscard;
|
||||
dispatch_async(dispatch_get_main_queue(),^{if(self->_trackingGeneration!=generation)return;
|
||||
if(second){self->_trackingBackward=YES;self->_trackingFinishing.store(false);self->_trackingStarted=NSProcessInfo.processInfo.systemUptime;id<FxCustomParameterActionAPI_v4>a=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];BOOL started=NO;if(a){[a startAction:self];@try{started=[[self->_apiManager apiForProtocol:@protocol(FxAnalysisAPI)]startBackwardAnalysis:kFxAnalysisLocation_GPU error:nil];}@finally{[a endAction:self];}}if(started){[self toolStatus:@"正向完成,正在从同一起点反向跟踪…"];return;}self->_trackingFinishing.store(true);}
|
||||
BOOL hasResults=![self->_trackingCandidate[@"keys"]isEqual:self->_trackingFrozenMask[@"keys"]];NSString *message=self->_trackingMessage?:[NSString stringWithFormat:@"%@跟踪完成 · %lu 个轨迹键",self->_trackingBoth?@"双向":(self->_trackingBackward?@"反向":@"正向"),(unsigned long)[self->_trackingCandidate[@"keys"]count]];
|
||||
if(hasResults&&!self->_trackingDiscard){id<FxCustomParameterActionAPI_v4>a=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(a){[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(self->_apiManager,a.currentTime).document);NSMutableDictionary *mask=[self toolMask:self->_trackingMaskID node:self->_trackingNode document:doc];if(mask&&[mask isEqual:self->_trackingFrozenMask]){self->_trackingCandidate[@"status"]=message;[mask setDictionary:self->_trackingCandidate];id<FxUndoAPI>undo=[self->_apiManager apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"蒙版区域跟踪"];BOOL written=DYWriteTools(self->_apiManager,doc,a.currentTime);[undo endUndoGroup];if(!written)message=@"宿主未接受轨迹,原蒙版已保留";}else message=@"目标工具或蒙版已更改,已丢弃过期跟踪结果";}@finally{[a endAction:self];}}}
|
||||
CMTime stepTime=self->_trackingPreviousTime;BOOL advance=self->_trackingSingle&&hasResults&&!self->_trackingDiscard&&!self->_trackingCancelled.load()&&CMTIME_IS_NUMERIC(stepTime);
|
||||
self->_trackingActive.store(false);if(advance){id<FxCustomParameterActionAPI_v4>seek=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(seek){[seek startAction:self];@try{id<FxCommandAPI_v2>command=[self->_apiManager apiForProtocol:@protocol(FxCommandAPI_v2)];[command movePlayheadToTime:stepTime error:nil];}@finally{[seek endAction:self];}}}[self->_toolAnalysisTimer invalidate];[self->_toolAnalysisTimer release];self->_toolAnalysisTimer=nil;[self toolStatus:message];[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];
|
||||
});return YES;
|
||||
}
|
||||
|
||||
#include "DYToolCanvasEditing.inc.h"
|
||||
@@ -0,0 +1,44 @@
|
||||
// Stable insertion identities, on-card layout and noncommuting render oracles.
|
||||
{
|
||||
DYToolDocument *empty=[[[DYToolDocument alloc]init]autorelease];NSMutableDictionary *doc=DYMutablePlist(empty.document);
|
||||
NSDictionary *one=DYInsertTool(doc,@"hsl",@"base:hsl"),*two=DYInsertTool(doc,@"hsl",one[@"id"]),*newest=DYInsertTool(doc,@"hsl",@"base:hsl");NSArray *order=DYToolDisplayOrder(doc);NSUInteger hslIndex=[order indexOfObject:@"base:hsl"];
|
||||
run.need(@"inserted-tool-documents-have-validated-anchors",DYValidToolDocument(doc)&&[doc[@"schema"]isEqual:@2]);
|
||||
run.record(@"repeat-splices-immediately-after-clicked-base-or-extra",[order[hslIndex+1]isEqual:newest[@"id"]]&&[order[hslIndex+2]isEqual:one[@"id"]]&&[order[hslIndex+3]isEqual:two[@"id"]]&&[order[hslIndex+4]isEqual:@"base:curve"]);
|
||||
run.record(@"inserted-tools-start-with-independent-initial-values",[one[@"values"]count]==0&&[two[@"values"]count]==0&&[newest[@"values"]count]==0&&![one[@"id"]isEqual:two[@"id"]]);
|
||||
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));
|
||||
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];};
|
||||
upload(source,input);DYUniforms base=DYToolUniforms(@{@"type":@"hsl",@"values":@{@"hsl0_0":@28}});base.colorGradingSectionEnabled=1;base.colorGradingHueSatA.x=210;base.colorGradingHueSatA.y=42;base.colorGradingLuma.x=18;
|
||||
Pixels original=renderInserted(empty.document,base,@"insertion-original-fused-oracle");doc=DYMutablePlist(empty.document);DYInsertTool(doc,@"hsl",@"base:hsl");Pixels idle=renderInserted(doc,base,@"insertion-neutral-child-render");run.record(@"untouched-inserted-tool-preserves-original-fused-pixels-exactly",difference(original,idle).maximum==0);
|
||||
NSMutableDictionary *extra=(id)doc[@"layers"][0];extra[@"values"][@"hsl1_2"]=@55;DYUniforms baseHSLOnly=base;baseHSLOnly.colorGradingSectionEnabled=0;Pixels first=render(run,renderer,source,destination,gpu,baseHSLOnly,@{},@"insertion-base-hsl-reference");DYDiagnosticTile *intermediate=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:width height:height]autorelease];upload(intermediate,first);Pixels second=render(run,renderer,intermediate,destination,gpu,DYToolUniforms(extra),@{},@"insertion-extra-hsl-reference");upload(intermediate,second);DYUniforms grading=DYToolUniforms(@{@"type":@"grading"});grading.colorGradingHueSatA.x=210;grading.colorGradingHueSatA.y=42;grading.colorGradingLuma.x=18;Pixels expected=render(run,renderer,intermediate,destination,gpu,grading,@{},@"insertion-later-native-grading-reference");Pixels actual=renderInserted(doc,base,@"anchored-hsl-before-grading-render");run.record(@"anchored-hsl-executes-before-later-native-grading",difference(expected,actual).maximum<.004,measure(difference(expected,actual)));
|
||||
NSMutableDictionary *tail=DYMutablePlist(doc);[tail[@"layers"][0]removeObjectForKey:@"after"];tail[@"schema"]=@1;Pixels oldTail=renderInserted(tail,base,@"historical-tail-hsl-render");run.record(@"anchored-hsl-is-not-only-a-visual-move-from-tail",difference(actual,oldTail).different>20,measure(difference(actual,oldTail)));
|
||||
// Two anchors must follow the legacy native operation order, not insertion time.
|
||||
doc=DYMutablePlist(empty.document);NSMutableDictionary *hsl=(id)DYInsertTool(doc,@"hsl",@"base:hsl");hsl[@"values"][@"hsl0_0"]=@35;NSMutableDictionary *curve=(id)DYInsertTool(doc,@"curve",@"base:curve");curve[@"values"][@"curveY4"]=@32;curve[@"values"][@"curveY5"]=@(-24);curve[@"values"][@"channel0X0"]=@.25;curve[@"values"][@"channel0X1"]=@.75;
|
||||
DYUniforms neutralBase=DYToolUniforms(@{@"type":@"hsl"});first=render(run,renderer,source,destination,gpu,DYToolUniforms(curve),@{},@"anchored-curve-first-reference");run.record(@"curve-anchor-reference-materially-adjusts-red-channel",difference(first,input).different>20&&difference(first,input).maximum>.01,measure(difference(first,input)));upload(intermediate,first);expected=render(run,renderer,intermediate,destination,gpu,DYToolUniforms(hsl),@{},@"anchored-hsl-second-reference");actual=renderInserted(doc,neutralBase,@"two-native-anchor-render");run.record(@"two-anchors-preserve-native-curve-before-hsl-operation-order",difference(expected,actual).maximum<.004,measure(difference(expected,actual)));
|
||||
first=render(run,renderer,source,destination,gpu,DYToolUniforms(hsl),@{},@"wrong-hsl-before-curve-reference");upload(intermediate,first);Pixels wrong=render(run,renderer,intermediate,destination,gpu,DYToolUniforms(curve),@{},@"wrong-curve-after-hsl-reference");run.record(@"anchor-reference-operations-are-noncommuting",difference(expected,wrong).different>20&&difference(expected,wrong).maximum>.005,measure(difference(expected,wrong)));
|
||||
|
||||
// A changed tool with a zero-strength mask forces the anchored scheduler but
|
||||
// contributes no correction. Compare against the untouched fused operation to
|
||||
// catch replayed CST, lost global-white statistics, a displaced spatial source,
|
||||
// lost pre-HSL skin reference, or moving the original Spider before color work.
|
||||
auto boundary=[&](NSString *name,DYUniforms u,NSString *anchor,NSData *mesh,NSDictionary *baseMasks=nil){
|
||||
NSMutableDictionary *control=DYMutablePlist(empty.document),*baselineDocument=DYMutablePlist(empty.document);if(baseMasks){control[@"baseMasks"]=DYMutablePlist(baseMasks);baselineDocument[@"baseMasks"]=DYMutablePlist(baseMasks);}NSMutableDictionary *node=(id)DYInsertTool(control,@"hsl",anchor);node[@"values"][@"hsl0_0"]=@32;NSMutableDictionary *mask=DYMutablePlist(DYNewMask(DYMaskRectangle));DYMaskParameters p=DYMaskAtTime(mask,kCMTimeZero);p.strength=0;mask[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];[node[@"masks"]addObject:mask];NSError *failure=nil;
|
||||
BOOL baselineOK=[renderer renderSource:source destination:destination uniforms:u paths:@{} spider:mesh tools:baselineDocument error:&failure];Pixels before=read(destination,gpu);BOOL insertedOK=[renderer renderSource:source destination:destination uniforms:u paths:@{} spider:mesh tools:control error:&failure];Pixels after=read(destination,gpu);Difference delta=difference(before,after);BOOL alpha=YES;for(NSUInteger i=0;i<width*height;i++)alpha&=before[i*4+3]==after[i*4+3];run.record(name,baselineOK&&insertedOK&&alpha&&delta.nonfinite==0&&delta.maximum<.006,measure(delta));
|
||||
};
|
||||
DYUniforms cstBoundary=defaults;cstBoundary.cm.configured=1;cstBoundary.cm.exposure=-.6;boundary(@"anchored-primary-cst-runs-once-before-native-stages",cstBoundary,@"base:primary",nil);
|
||||
DYUniforms skinBoundary=base;skinBoundary.skinProtection.x=1;skinBoundary.skinProtection.y=85;skinBoundary.skinProtection.z=28;boundary(@"anchored-split-retains-native-pre-hsl-skin-reference",skinBoundary,@"base:hsl",nil);
|
||||
DYUniforms textureBoundary=DYToolUniforms(@{@"type":@"base"});textureBoundary.whites=48;textureBoundary.texture=35;textureBoundary.clarity=25;textureBoundary.dehaze=15;textureBoundary.primariesSectionEnabled=1;textureBoundary.redPrimaryHue=20;textureBoundary.redPrimarySaturation=15;boundary(@"anchored-prefix-preserves-whites-statistics-and-spatial-base-input",textureBoundary,@"base:primaries",nil);
|
||||
DYUniforms oldInputBoundary=textureBoundary;oldInputBoundary.primarySectionEnabled=1;oldInputBoundary.inputSectionEnabled=1;oldInputBoundary.cm.configured=-1;oldInputBoundary.inputProfile=17;oldInputBoundary.preLUTStrength=1;boundary(@"anchored-legacy-input-lut-remains-available-to-spatial-neighbors",oldInputBoundary,@"base:primaries",nil);
|
||||
NSMutableDictionary *lumaMask=DYMutablePlist(DYNewMask(DYMaskLumaKey));DYMaskParameters luma=DYMaskAtTime(lumaMask,kCMTimeZero);luma.inputBlack=.25;luma.inputWhite=.8;lumaMask[@"parameters"]=[NSData dataWithBytes:&luma length:sizeof(luma)];boundary(@"anchored-original-color-mask-keeps-post-cst-source-reference",textureBoundary,@"base:primaries",nil,@{@"base":@[lumaMask]});
|
||||
DYUniforms chromaBoundary=base;chromaBoundary.baseSectionEnabled=1;chromaBoundary.colorSectionEnabled=1;chromaBoundary.saturation=45;chromaBoundary.vibrance=20;boundary(@"anchored-split-preserves-second-base-chroma-stage",chromaBoundary,@"base:hsl",nil);
|
||||
auto boundaryMesh=dy::neutralMesh();for(int i=0;i<dy::meshCount(boundaryMesh);i++){boundaryMesh.x[i]+=.04f;boundaryMesh.y[i]-=.02f;}NSData *meshData=[NSData dataWithBytes:&boundaryMesh length:sizeof(boundaryMesh)];DYUniforms spiderBoundary=base;spiderBoundary.spiderSectionEnabled=1;spiderBoundary.spiderMix=.8;boundary(@"anchored-spider-remains-after-native-color-stages",spiderBoundary,@"base:spider",meshData);
|
||||
DYUniforms bwBoundary=skinBoundary;bwBoundary.blackWhiteSectionEnabled=1;bwBoundary.cm.blackWhiteMix=.45;boundary(@"anchored-bw-suffix-defers-color-mixture-until-after-native-skin",bwBoundary,@"base:blackwhite",nil);bwBoundary.spiderSectionEnabled=1;bwBoundary.spiderMix=.8;boundary(@"anchored-look-suffix-keeps-bw-mixture-before-single-spider",bwBoundary,@"base:look",meshData);
|
||||
Pixels hdr=input;for(NSUInteger i=0;i<width*height;i++){float a=hdr[i*4+3];hdr[i*4]=a*1.35f;hdr[i*4+1]=a*.4f;hdr[i*4+2]=-a*.06f;}upload(source,hdr);boundary(@"zero-strength-extra-mask-preserves-hdr-and-negative-colors",neutralBase,@"base:primary",nil);upload(source,input);
|
||||
NSURL *cubeURL=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"inserted-tool-stack.cube"]];error=nil;BOOL exported=[renderer exportLUT:cubeURL uniforms:neutralBase paths:@{} spider:nil tools:doc error:&error];NSString *text=exported?[NSString stringWithContentsOfURL:cubeURL encoding:NSUTF8StringEncoding error:&error]:nil;std::vector<float>values;for(NSString *line in [text componentsSeparatedByCharactersInSet:NSCharacterSet.newlineCharacterSet]){float r,g,b;if(sscanf(line.UTF8String,"%f %f %f",&r,&g,&b)==3){values.push_back(r);values.push_back(g);values.push_back(b);}}
|
||||
float codes[3]={.5f,.25f,.75f};Pixels solid(input.size());for(NSUInteger i=0;i<width*height;i++){for(int c=0;c<3;c++)solid[i*4+c]=powf((codes[c]+.055f)/1.055f,2.4f);solid[i*4+3]=1;}upload(source,solid);actual=renderInserted(doc,neutralBase,@"inserted-cube-production-sample");BOOL matches=exported&&values.size()==33*33*33*3;for(int c=0;c<3&&matches;c++){float code=values[((24*33+8)*33+16)*3+c],linear=code<=.04045f?code/12.92f:powf((code+.055f)/1.055f,2.4f);matches&=fabs(linear-(float)actual[c])<.004;}run.record(@"cube-export-follows-identical-anchored-tool-order",matches,@{@"error":reason(error)});
|
||||
upload(source,input);DYWriteTools(manager,empty.document,kCMTimeZero);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
- (void)synchronizeTools {
|
||||
id<FxCustomParameterActionAPI_v4>a=[self actionAPI];if(!a)return;[a startAction:self];NSDictionary *document=nil;@try{document=[DYReadTools(_manager,a.currentTime).document copy];}@finally{[a endAction:self];}
|
||||
NSMutableArray *order=[NSMutableArray array];NSMutableDictionary *numbers=[NSMutableDictionary dictionary],*roots=[NSMutableDictionary dictionary];
|
||||
for(NSString *orderedID in DYToolDisplayOrder(document)){NSDictionary *node=DYToolWithID(document,orderedID);if(!node)continue;NSString *ID=node[@"id"],*type=node[@"type"];[order addObject:ID];roots[ID]=DYToolRootAnchor(document,ID)?:@"tail";NSInteger number=MAX(1,[numbers[type]integerValue])+1;numbers[type]=@(number);
|
||||
DYInspector *view=_stackViews[ID];if(!view){DYToolManager *manager=[[[DYToolManager alloc]initWithHost:_manager node:node]autorelease];view=[[[DYInspector alloc]initWithAPIManager:manager renderer:_renderer]autorelease];_stackViews[ID]=view;[_document addSubview:view];}
|
||||
if(view->_cards.count){NSDictionary *section=view->_cards[0][@"section"];[view->_cards[0][@"header"]setTitle:[NSString stringWithFormat:@"%@ %ld",section[@"title"],(long)number]];}
|
||||
[view refresh];[view setNeedsLayout:YES];
|
||||
}
|
||||
for(NSString *ID in [[_stackViews.allKeys copy]autorelease])if(![order containsObject:ID]){[_stackViews[ID]removeFromSuperview];[_stackViews removeObjectForKey:ID];}
|
||||
[_stackOrder release];_stackOrder=[order copy];[_stackRoots release];_stackRoots=[roots copy];[document release];[self setNeedsLayout:YES];
|
||||
}
|
||||
- (void)toolMask:(NSButton*)sender{if(sender.tag<0||sender.tag>=_cards.count)return;[(DYToolMaskPanel*)_cards[sender.tag][@"maskPanel"]addMenu:sender];}
|
||||
- (void)repeatTool:(NSButton*)sender{
|
||||
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];NSDictionary *node=DYInsertTool(doc,type,anchor);if(!node)return;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)removeTool:(id)sender{if(!_embedded)return;id<PROAPIAccessing>host=[(DYToolManager*)_manager host];id<FxCustomParameterActionAPI_v4>a=[host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(host,a.currentTime).document);if(!DYRemoveTool(doc,[(DYToolManager*)_manager nodeID]))return;id<FxUndoAPI>undo=[host apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"删除独立工具层"];DYWriteTools(host,doc,a.currentTime);[undo endUndoGroup];}@finally{[a endAction:self];}dispatch_async(dispatch_get_main_queue(),^{[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:host];});}
|
||||
|
||||
- (CGFloat)layoutRepeatedToolsAfter:(NSString*)anchor y:(CGFloat)y width:(CGFloat)w {if(_embedded)return y;for(NSString *ID in _stackOrder)if([_stackRoots[ID]isEqual:anchor]){DYInspector *child=_stackViews[ID];child.frame=NSMakeRect(0,y,w,MAX(60,child->_stackHeight));[child layoutSubtreeIfNeeded];CGFloat height=MAX(60,child->_stackHeight);child.frame=NSMakeRect(0,y,w,height);y+=height;}return y;}
|
||||
|
||||
- (void)resetRepeatedTool{if(!_embedded)return;id<PROAPIAccessing>host=[(DYToolManager*)_manager host];id<FxCustomParameterActionAPI_v4>a=[host apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(!a)return;[a startAction:self];@try{NSMutableDictionary *doc=DYMutablePlist(DYReadTools(host,a.currentTime).document);NSMutableDictionary *node=(id)DYToolWithID(doc,[(DYToolManager*)_manager nodeID]);if(!node)return;NSDictionary *fresh=DYNewTool(node[@"type"]);node[@"values"]=fresh[@"values"];node[@"paths"]=@{};[node removeObjectForKey:@"spider"];node[@"spiderLinked"]=@YES;id<FxUndoAPI>undo=[host apiForProtocol:@protocol(FxUndoAPI)];[undo startUndoGroup:@"还原独立工具层"];DYWriteTools(host,doc,a.currentTime);[undo endUndoGroup];}@finally{[a endAction:self];}[self postChanged];}
|
||||
@@ -0,0 +1,64 @@
|
||||
// Host-provided canvas coordinates, normalized to the actual object transform.
|
||||
@interface DYToolOSC : NSObject<FxOnScreenControl_v4>
|
||||
@property(nonatomic,assign) id<PROAPIAccessing> apiManager;
|
||||
@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;
|
||||
}
|
||||
- (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];}
|
||||
- (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);}
|
||||
- (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;
|
||||
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){
|
||||
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(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];}
|
||||
}else if(p.kind<2){int count=p.kind==DYMaskEllipse?96:4;for(int i=0;i<count;i++){float angle=i*(2.f*M_PI/count),x=p.kind==DYMaskEllipse?.5f*cosf(angle):((float[]){-.5,.5,.5,-.5})[i],y=p.kind==DYMaskEllipse?.5f*sinf(angle):((float[]){-.5,-.5,.5,.5})[i];NSPoint point=[self canvasPoint:x y:y parameters:p];if(i==0)[_outline moveToPoint:point];else[_outline lineToPoint:point];}[_outline closePath];}
|
||||
else if(p.kind==DYMaskLinearGradient){[_outline moveToPoint:[self canvasPoint:0 y:-2 parameters:p]];[_outline lineToPoint:[self canvasPoint:0 y:2 parameters:p]];}
|
||||
if([mask[@"coverage"]boolValue]&&p.kind<3){[[NSColor colorWithCalibratedRed:1 green:.7 blue:.05 alpha:.2]setFill];[_outline fill];}
|
||||
[[NSColor colorWithWhite:0 alpha:.8]setStroke];_outline.lineWidth=3.5*_uiScale;[_outline stroke];[[NSColor colorWithCalibratedRed:1 green:.8 blue:.15 alpha:1]setStroke];_outline.lineWidth=1.5*_uiScale;[_outline stroke];
|
||||
if(p.kind<4&&![mask[@"drawing"]boolValue]){[self addHandle:[self canvasPoint:0 y:0 parameters:p] part:1];if(p.kind!=DYMaskBezier){for(int i=0;i<4;i++)[self addHandle:[self canvasPoint:((float[]){-.5,.5,.5,-.5})[i] y:((float[]){-.5,-.5,.5,.5})[i] parameters:p] part:2+i];}[self addHandle:[self canvasPoint:0 y:-.68 parameters:p] part:6];}
|
||||
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];}
|
||||
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}];}
|
||||
[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 {
|
||||
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);}}
|
||||
- (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;
|
||||
}}
|
||||
- (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)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)keyUpAtPositionX:(double)x positionY:(double)y keyPressed:(unsigned short)key modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update didHandle:(BOOL*)handled atTime:(CMTime)t{if(update)*update=NO;if(handled)*handled=NO;}
|
||||
@end
|
||||
@@ -0,0 +1,31 @@
|
||||
// Exercises the inspector entry, real native OSC events and persisted path data.
|
||||
{
|
||||
DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,&error);DYToolCanvasProbe *host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=kCMTimeZero;
|
||||
NSMutableDictionary *doc=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document);NSDictionary *other=DYNewMask(DYMaskEllipse);doc[@"baseMasks"][@"hsl"]=[NSMutableArray arrayWithObject:other];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+.1;while(NSProcessInfo.processInfo.systemUptime<end)[[NSRunLoop mainRunLoop]runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:.005]];};drain();
|
||||
id panel=[[[NSClassFromString(@"DYToolMaskPanel")alloc]initWithManager:host nodeID:@"base:hsl"]autorelease];[panel refreshWithDocument:DYReadTools(base,kCMTimeZero).document time:kCMTimeZero];NSMenuItem *item=[[[NSMenuItem alloc]initWithTitle:@"钢笔" action:nil keyEquivalent:@""]autorelease];item.tag=2;[panel performSelector:@selector(addKind:) withObject:item];
|
||||
NSDictionary *author=DYReadTools(base,kCMTimeZero).document,*mask=[author[@"baseMasks"][@"hsl"]lastObject];NSString *maskID=mask[@"id"];NSDictionary *snapshot=[plugin toolCanvasMaskAtTime:kCMTimeZero];
|
||||
run.record(@"inspector-add-pen-enters-empty-drawing-mode",[snapshot[@"drawing"]boolValue]&&[snapshot[@"nodes"]length]==0&&[snapshot[@"id"]isEqual:maskID]);
|
||||
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];
|
||||
NSInteger part=0;[osc hitTestOSCAtMousePositionX:152 mousePositionY:307 activePart:&part atTime:kCMTimeZero];run.record(@"pen-can-start-anywhere-in-image-outside-default-shape",part==1);
|
||||
int undo=base->_undoStarts;BOOL update=NO;
|
||||
auto click=[&](double x,double y){[osc mouseDownAtPositionX:x positionY:y activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseUpAtPositionX:x positionY:y activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];};
|
||||
click(152,307);snapshot=[plugin toolCanvasMaskAtTime:kCMTimeZero];run.record(@"pen-point-snapshot-updates-before-main-queue-without-author-write",[snapshot[@"nodes"]length]==sizeof(DYBezierNode)&&base->_undoStarts==undo&&[DYReadTools(base,kCMTimeZero).document isEqual:author]);
|
||||
[osc mouseMovedAtPositionX:240 positionY:280 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];snapshot=[plugin toolCanvasMaskAtTime:kCMTimeZero];run.record(@"pen-cursor-previews-next-segment-without-parameter-or-undo-writes",update&&[snapshot[@"hover"]count]==2&&base->_undoStarts==undo&&[DYReadTools(base,kCMTimeZero).document isEqual:author]);
|
||||
[osc mouseDownAtPositionX:488 positionY:307 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseDraggedAtPositionX:509 positionY:290 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];[osc mouseUpAtPositionX:509 positionY:290 activePart:1 modifiers:0 forceUpdate:&update atTime:kCMTimeZero];click(320,118);
|
||||
snapshot=[plugin toolCanvasMaskAtTime:kCMTimeZero];NSData *nodes=snapshot[@"nodes"];const DYBezierNode *v=(const DYBezierNode*)nodes.bytes;BOOL handles=nodes.length==3*sizeof(DYBezierNode)&&fabs(v[1].inX+v[1].outX-2*v[1].x)<1e-5&&fabs(v[1].inY+v[1].outY-2*v[1].y)<1e-5&&fabs(v[1].outX-v[1].x)>.01;run.record(@"pen-drag-creates-mirrored-cubic-handles",handles);
|
||||
[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];[osc hitTestOSCAtMousePositionX:152 mousePositionY:307 activePart:&part atTime:kCMTimeZero];run.record(@"pen-first-anchor-hit-closes-path-after-three-points",part==1000);[osc mouseDownAtPositionX:152 positionY:307 activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];drain();
|
||||
author=DYReadTools(base,kCMTimeZero).document;mask=[author[@"baseMasks"][@"hsl"]lastObject];run.record(@"pen-closed-cubic-path-persists-once-and-keeps-neighbor-mask",[mask[@"nodes"]length]==3*sizeof(DYBezierNode)&&base->_undoStarts==undo+1&&[author[@"baseMasks"][@"hsl"][0]isEqual:other]&&![[plugin toolCanvasMaskAtTime:kCMTimeZero][@"drawing"]boolValue]);
|
||||
NSData *archive=[NSKeyedArchiver archivedDataWithRootObject:DYReadTools(base,kCMTimeZero) requiringSecureCoding:YES error:&error];DYToolDocument *restored=[NSKeyedUnarchiver unarchivedObjectOfClass:DYToolDocument.class fromData:archive error:&error];run.record(@"pen-cubic-nodes-survive-secure-document-roundtrip",[restored.document isEqual:author]);
|
||||
auto redraw=[&](){[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasSelection" object:host userInfo:@{@"node":@"base:hsl",@"mask":maskID,@"document":DYReadTools(base,kCMTimeZero).document,@"draw":@YES}];};
|
||||
redraw();click(180,280);click(420,280);BOOL handled=NO;[osc keyDownAtPositionX:420 positionY:280 keyPressed:127 modifiers:0 forceUpdate:&update didHandle:&handled atTime:kCMTimeZero];run.record(@"pen-delete-removes-last-uncommitted-point",handled&&[[plugin toolCanvasMaskAtTime:kCMTimeZero][@"nodes"]length]==sizeof(DYBezierNode));
|
||||
[osc keyDownAtPositionX:180 positionY:280 keyPressed:27 modifiers:0 forceUpdate:&update didHandle:&handled atTime:kCMTimeZero];drain();run.record(@"pen-escape-cancels-without-overwriting-saved-curve",[DYReadTools(base,kCMTimeZero).document isEqual:author]&&base->_undoStarts==undo+1);
|
||||
redraw();click(180,280);click(450,260);click(330,145);[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasCommand" object:host userInfo:@{@"node":@"base:hsl",@"mask":maskID,@"command":@"finish",@"timeValue":@0,@"timeScale":@1,@"timeEpoch":@0}];drain();NSDictionary *buttonSaved=DYReadTools(base,kCMTimeZero).document;run.record(@"pen-inspector-finish-commits-without-viewer-keyboard-focus",![buttonSaved isEqual:author]&&base->_undoStarts==undo+2&&[[buttonSaved[@"baseMasks"][@"hsl"]lastObject][@"nodes"]length]==3*sizeof(DYBezierNode));
|
||||
redraw();click(160,270);[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasCommand" object:host userInfo:@{@"node":@"base:hsl",@"mask":maskID,@"command":@"cancel",@"timeValue":@0,@"timeScale":@1,@"timeEpoch":@0}];drain();run.record(@"pen-inspector-cancel-preserves-saved-curve-and-undo-count",[DYReadTools(base,kCMTimeZero).document isEqual:buttonSaved]&&base->_undoStarts==undo+2);
|
||||
redraw();click(190,280);click(460,280);click(300,150);[osc keyDownAtPositionX:300 positionY:150 keyPressed:13 modifiers:0 forceUpdate:&update didHandle:&handled atTime:kCMTimeZero];drain();run.record(@"pen-return-closes-and-saves-native-path",handled&&base->_undoStarts==undo+3&&![[plugin toolCanvasMaskAtTime:kCMTimeZero][@"drawing"]boolValue]);
|
||||
// Finish and the next drag can arrive before the main queue gets a turn.
|
||||
redraw();click(170,275);click(445,275);click(300,140);int queuedUndo=base->_undoStarts;[osc keyDownAtPositionX:300 positionY:140 keyPressed:13 modifiers:0 forceUpdate:&update didHandle:&handled atTime:kCMTimeZero];[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 *queuedDoc=DYReadTools(base,kCMTimeZero).document;DYMaskParameters moved=DYMaskAtTime([queuedDoc[@"baseMasks"][@"hsl"]lastObject],kCMTimeZero);run.record(@"pen-finish-and-next-gesture-serialize-without-dropping-either",base->_undoStarts==queuedUndo+2&&fabs(moved.centerX-.55)<1e-5&&fabs(moved.centerY-.55)<1e-5);
|
||||
redraw();click(170,275);click(445,275);click(300,140);[osc keyDownAtPositionX:300 positionY:140 keyPressed:13 modifiers:0 forceUpdate:&update didHandle:&handled atTime:CMTimeMake(1,25)];drain();run.record(@"pen-refuses-to-finish-stale-draft-after-playhead-moves",[DYReadTools(base,kCMTimeZero).document isEqual:queuedDoc]&&base->_undoStarts==queuedUndo+2&&![[plugin toolCanvasMaskAtTime:CMTimeMake(1,25)][@"drawing"]boolValue]);
|
||||
[osc release];[plugin release];
|
||||
}
|
||||
已加载 100/116 个文件。由于本次变更涉及的文件过多,其余文件未显示。
显示更多
在新工单中引用
屏蔽一个用户