比较提交
| 作者 | SHA1 | 提交日期 | |
|---|---|---|---|
|
|
46153a26ed | ||
|
|
1659f3d385 | ||
|
|
dff9134be7 | ||
|
|
1f1b7917e7 | ||
|
|
4fb008e100 | ||
|
|
07601e50bf | ||
|
|
9977b5c41b | ||
|
|
ca8a5433d3 | ||
|
|
213d01dbd8 | ||
|
|
0782b5e654 | ||
|
|
504e08e425 | ||
|
|
bbb258e495 |
没有与搜索条件相匹配的文件
@@ -0,0 +1,15 @@
|
||||
# 大鱼调色项目规则
|
||||
|
||||
本文件适用于当前 Git 仓库及其子目录。沿用本机全局开发、正式交付和 Git 备份约定。
|
||||
|
||||
## 接手
|
||||
|
||||
- 新对话先读 [开发交接.md](开发交接.md) 的当前基线和待跟进事项。核对实际工作区、分支、远端、正式安装版本和交付锁,再依据用户本轮要求继续。
|
||||
- 按范围查阅专项交接、`verification/` 和 [RECOVERY.md](RECOVERY.md)。旧版本文档用于查找历史,当前状态以实际结果和对应版本的验证记录为准。
|
||||
|
||||
## 每次任务结束都要更新交接
|
||||
|
||||
- 无论本轮是开发、排查、发布、纯文档工作,还是暂时受阻,结束前都在 [开发交接.md](开发交接.md) 记录本轮工作。更新受影响的当前基线和待跟进事项,保留前序任务记录。
|
||||
- 写清任务日期与目标、实际完成的改动和关键路径、验证结果及覆盖范围、交付状态,以及仍待处理的事项和接手第一步。涉及发行时分别标明实际编译提交、版本标签、本机安装、Git Release、站点文章和主 APP 更新通道,注明对应版本和核验依据。
|
||||
- 区分本机实测、用户确认、自动检查与尚待复现的反馈。保留有助于继续排查的限制、假设和阻塞,引用已有报告。凭据、用户素材和未脱敏日志留在各自受控位置。
|
||||
- 在本轮结束前按 Git 约定提交交接文档,推送并回读远端。最后回复附上交接入口;远端核验受阻时注明本地提交与具体原因。
|
||||
@@ -0,0 +1,9 @@
|
||||
## 大鱼调色 1.13.0(83)
|
||||
|
||||
- 画布右下角新增仿制图章。点击画面选取样中心,再拖出带羽化的椭圆覆盖区域。可以叠加多个图章。
|
||||
- 选中图章后,可在画布上向前、向后或双向跟踪。覆盖区域随轨迹移动、缩放和旋转,取样中心固定。工作区可调整强度、羽化、位置和大小,或清除轨迹、停用和删除图章。
|
||||
- 缩小空闲画布浮层的位图范围,减少工具状态刷新中的重复编解码。
|
||||
|
||||
本公测版本适用于 Apple Silicon Mac,要求 macOS 14.6 或更高版本。安装前保存剪辑并正常退出 Final Cut Pro 或 Motion。
|
||||
|
||||
安装包 SHA-256 `7999233dd4a3b797a879cc0f37a20f0c35f925c5f6823720b40e684464a452e8`,45,350,463 字节。
|
||||
@@ -0,0 +1,9 @@
|
||||
## 大鱼调色 1.13.1(85)
|
||||
|
||||
选中仿制图章后,可拖动青色取样十字来调整取样位置。松手后重新取样并保存为一次撤销,按 Esc 可取消拖动。覆盖区域及已有位置轨迹随项目保留。
|
||||
|
||||
图章按 1:1 像素平移复制。改变椭圆宽高只改变覆盖范围,跟踪只移动目标中心。原画面的像素尺寸和方向保持一致。
|
||||
|
||||
本公测版本适用于 Apple Silicon Mac,要求 macOS 14.6 或更高版本。
|
||||
|
||||
安装包 SHA-256 `8a19afadda6317d186541f37a221c46261a22ddabcdddec90d02e1315b693965`,45,352,349 字节。
|
||||
+21
@@ -8,6 +8,8 @@ APP 公证 `8a070adc-a38c-44df-a8b6-ee36198a0cbc` Accepted,签名、票据、
|
||||
|
||||
正式 PKG `../发行包/大鱼调色-1.12.1.pkg` 为 45,337,206 字节,SHA-256 `ae65ac0dcaf7cead701b8ac543ee60ae62e55fd9e19646877d5ef9d9d7351b6f`。Installer 签名、公证 `ffefbde6-10f2-40e3-a8c4-ef4123053c74` Accepted、票据及 20 项展开验包通过。发行标签为 `v1.12.1-canvas-inspector-20261105`,安装包与发布附件的核验分别见 [Package.json](verification/Package.json) 和 [Release.json](verification/Release.json)。
|
||||
|
||||
Git Release 390 的附件 34 已公开为公测版,草稿与正式链接均完成全量下载校验。发行标签完整提交为 `9f0adbeb3b1b902b66ac4be7169b919f82675f21`。独立远程检出核对了 607 个跟踪文件及交付记录,标签的编译输入与实际编译提交一致。已清理本轮 79 和 80 的恢复 APP、公证 ZIP、草稿下载及临时检出。[Git Release](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.12.1-canvas-inspector-20261105) · [恢复核验](verification/CanvasInspectorRecovery1.12.1.json)
|
||||
|
||||
# 2026-11-05 统一工作区与共享蒙版:1.12.0(79)
|
||||
|
||||
当前唯一正式安装为1.12.0(79),实际编译源码 `beccf2fc01f8dc06c5d3d505f88289885d209bc8`,APP公证 `f66d9934-b015-49d1-bada-717d7399e673` Accepted,票据、Gatekeeper、唯一PluginKit路径、834项正式原生检查和FCP反馈验收通过。实际记录为verification/Delivery.json、HostFeedback78.json和HostFeedback79.json。
|
||||
@@ -127,6 +129,25 @@ Release384/附件28已发布,草稿浏览器完整下载和发布后再次完
|
||||
|
||||
# 大鱼调色恢复说明
|
||||
|
||||
## 1.13.1(85)等像素仿制图章
|
||||
|
||||
实际编译提交 `1659f3d3853e2574f06a45687141fb444b5d02ca`。正式 APP 固定路径、Bundle ID 与签名团队沿用 1.13.0。Apple 公证 `e1d669d2-821b-46a8-99bc-05c847c91a15` Accepted,票据、Gatekeeper、PluginKit 唯一正式位置、864 项原生检查和 FCP 12.4 读入旧图章通过。84 版验证了取样点拖动后被 85 版替代,未单独打包。83 和 84 的临时 APP 回退副本已清理。
|
||||
|
||||
独立远端克隆核对 613 个编译节点文件,Git full/strict、逐文件 SHA-256 通过,无 LFS 或子模块。继续沿用 Xcode 27.1、Metal 工具链、FxPlug SDK 4.3.5 与 macOS 14.6+ Apple Silicon。构建使用 `tools/deliver.py`,打包使用 `Packaging/build_pkg.py`。[宿主验收](verification/HostCloneSource1.13.1.json) · [独立源码恢复](verification/CloneSourceRecovery1.13.1.json)
|
||||
|
||||
正式安装包 `../发行包/大鱼调色-1.13.1.pkg`,45,352,349 字节,SHA-256 `8a19afadda6317d186541f37a221c46261a22ddabcdddec90d02e1315b693965`,公证 `b85219d9-d465-4827-bdb6-3023eb161159` Accepted。Developer ID Installer 签名、票据、Gatekeeper 和 20 项实际展开检查通过。版本标签为 `v1.13.1-pixel-clone-20261105`。本机使用独立 APP 安装验收。
|
||||
|
||||
## 1.13.0(83)画布响应与仿制图章
|
||||
|
||||
实际编译提交为 `9977b5c41b07e0b08e6408c492498ba6e396c981`。正式 APP 固定在 `/Library/Plug-Ins/FxPlug/大鱼调色.app`,外层 `com.dayu.color`,XPC `com.dayu.color.XPC`。团队 B3W25FX5H5,Apple 公证 `a9134875-aea9-4150-9e61-3051d23cd809` 为 Accepted,票据、Gatekeeper 和 PluginKit 通过。82 版实窗发现系统符号未渲染,由绘制自有图标的 83 版替代。81 和 82 的本轮临时回退副本在验收后清理,历史发行包保留。
|
||||
|
||||
从大鱼远程独立克隆并恢复编译提交,610 个文件逐字节摘要匹配,Git full/strict 检查通过,无 LFS 和子模块。依赖沿用 Xcode 27.1、Metal 工具链、FxPlug SDK 4.3.5、Apple Silicon 与 macOS 14.6+。构建入口 `tools/deliver.py`,打包入口 `Packaging/build_pkg.py`。签名凭据单独恢复。宿主证据和源码恢复证据分别见 [HostCloneStamp1.13.0.json](verification/HostCloneStamp1.13.0.json) 和 [CloneStampRecovery1.13.0.json](verification/CloneStampRecovery1.13.0.json)。
|
||||
|
||||
|
||||
正式安装包 `../发行包/大鱼调色-1.13.0.pkg`,45,350,463 字节,SHA-256 `7999233dd4a3b797a879cc0f37a20f0c35f925c5f6823720b40e684464a452e8`。Developer ID Installer 签名、公证 `13d6f418-4d36-4ef8-a92d-591610cb7682` Accepted、票据、Gatekeeper 和 20 项实际展开检查通过。版本标签为 `v1.13.0-clone-stamp-20261105`。本机已通过独立 APP 安装验收。
|
||||
|
||||
[公测 Release 391](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.13.0-clone-stamp-20261105) 的附件 35 已通过草稿下载和正式附件二次下载校验。标签完整提交 `07601e50bf604e7721bccf8be10e403a2bd030d1`,独立恢复版本标签和安装包记录通过。[发布证据](verification/Release.json)
|
||||
|
||||
## 当前1.8.0(55):版本化 ACES 色彩管理
|
||||
|
||||
远程 `https://dayu.media/git/dayu/dayu-color.git`,main;发行标签 `v1.8.0-cms-20261103`。实际编译源码 `11a88518280f0665f3cd0f388d1d66e5446ece14`,可先以该完整 SHA 恢复程序,标签与安装包的最终远程核验见 `verification/Release.json`。无 LFS 或子模块。固定 OCIO 2.5.2 / ACES 1.3 配置与全部必要依赖源码包、SHA-256 和许可证已放入 `ColorManagement/`,不依赖兄弟应用或其工作副本。
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
{
|
||||
"status": "resolved-published-and-download-verified",
|
||||
"releaseID": 389,
|
||||
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.12.0-unified-workspace-20261105",
|
||||
"tag": "v1.12.0-unified-workspace-20261105",
|
||||
"commit": "b72e6b31724def5c174b692ef0a46b76992e780b",
|
||||
"assetID": 33,
|
||||
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.12.0-unified-workspace-20261105/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.12.0.pkg",
|
||||
"bytes": 45329742,
|
||||
"sha256": "d4b557fec283f5e06f605bc6b1d99a0c8649f9d65e405eba452f525e8454cdfe",
|
||||
"resolvedBy": "verification/Release.json",
|
||||
"draftBrowserCopyRemovedAfterVerification": true
|
||||
"status": "published-after-verified-draft-download",
|
||||
"releaseID": 391,
|
||||
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.13.0-clone-stamp-20261105",
|
||||
"tag": "v1.13.0-clone-stamp-20261105",
|
||||
"commit": "07601e50bf604e7721bccf8be10e403a2bd030d1",
|
||||
"assetID": 35,
|
||||
"downloadURL": "https://dayu.media/git/attachments/35e71dab-93d6-46a7-9b8b-f89ac553822d",
|
||||
"bytes": 45350463,
|
||||
"sha256": "7999233dd4a3b797a879cc0f37a20f0c35f925c5f6823720b40e684464a452e8",
|
||||
"finalDownloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.13.0-clone-stamp-20261105/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.13.0.pkg"
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"tag": "v1.12.1-canvas-inspector-20261105",
|
||||
"commit": "9f0adbeb3b1b902b66ac4be7169b919f82675f21",
|
||||
"trackedFileCount": 607,
|
||||
"gitFsck": true,
|
||||
"compiledSource": "43320c7ccdfc6738ba3c380888bb7f3ea75ebb87",
|
||||
"verifiedRecordsAndSources": true,
|
||||
"temporaryCloneCleaned": true,
|
||||
"compiledInputsIdenticalInTag": true,
|
||||
"releaseID": 390,
|
||||
"assetID": 34,
|
||||
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.12.1-canvas-inspector-20261105",
|
||||
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.12.1-canvas-inspector-20261105/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.12.1.pkg",
|
||||
"bytes": 45337206,
|
||||
"sha256": "ae65ac0dcaf7cead701b8ac543ee60ae62e55fd9e19646877d5ef9d9d7351b6f",
|
||||
"verifiedDownloadCopyRemoved": true,
|
||||
"generatedAppBackupsCleaned": true,
|
||||
"formalPluginKitPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"status": "verified",
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"compiledSource": "1659f3d3853e2574f06a45687141fb444b5d02ca",
|
||||
"trackedFiles": 613,
|
||||
"fsck": "full strict",
|
||||
"content": "All tracked files matched by SHA-256",
|
||||
"lfs": false,
|
||||
"submodules": false,
|
||||
"independentBuild": false
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"status": "verified",
|
||||
"repository": "https://dayu.media/git/dayu/dayu-color.git",
|
||||
"compiledSource": "9977b5c41b07e0b08e6408c492498ba6e396c981",
|
||||
"trackedFiles": 610,
|
||||
"fsck": "full strict",
|
||||
"content": "all tracked files match the compiled commit by SHA-256",
|
||||
"lfs": false,
|
||||
"submodules": false,
|
||||
"independentBuild": false,
|
||||
"versionTag": {
|
||||
"tag": "v1.13.0-clone-stamp-20261105",
|
||||
"commit": "07601e50bf604e7721bccf8be10e403a2bd030d1",
|
||||
"trackedFiles": 613,
|
||||
"content": "All tracked files and verified PKG record match."
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,15 @@
|
||||
"status": "verified",
|
||||
"path": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"bundleID": "com.dayu.color",
|
||||
"version": "1.12.1",
|
||||
"build": "81",
|
||||
"version": "1.13.1",
|
||||
"build": "85",
|
||||
"team": "B3W25FX5H5",
|
||||
"notaryID": "8a070adc-a38c-44df-a8b6-ee36198a0cbc",
|
||||
"notaryID": "e1d669d2-821b-46a8-99bc-05c847c91a15",
|
||||
"notaryStatus": "Accepted",
|
||||
"gatekeeper": "/Library/Plug-Ins/FxPlug/大鱼调色.app: accepted\nsource=Notarized Developer ID",
|
||||
"sourceCommit": "43320c7ccdfc6738ba3c380888bb7f3ea75ebb87",
|
||||
"sourceCommit": "1659f3d3853e2574f06a45687141fb444b5d02ca",
|
||||
"templatePath": "/Users/mac/Movies/Motion Templates.localized/Effects.localized/大鱼调色/大鱼调色/大鱼调色.moef",
|
||||
"templateSHA256": "eaf60224f8d970f8841a03fe0325adc4af73d1c017375b020bcc0e256f0cd803",
|
||||
"shaderSHA256": "7d05797e5e68ec8c23886c74d37a32826843c541e13a3f35424c1903e28bff56",
|
||||
"hostVerification": "verification/HostCanvasInspector1.12.1.json"
|
||||
"shaderSHA256": "70340ce29720745e568ce1152ca4d73974062dfd12434bd4c308c7cf4ae3a694",
|
||||
"hostVerification": "verification/HostCloneSource1.13.1.json"
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"status": "passed",
|
||||
"version": "1.13.1",
|
||||
"build": "85",
|
||||
"compiledSource": "1659f3d3853e2574f06a45687141fb444b5d02ca",
|
||||
"formalPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"host": "Final Cut Pro 12.4",
|
||||
"hostPID": 29418,
|
||||
"servicePID": 29424,
|
||||
"qaProject": "1.12.0_76_OpenCV真实帧跟踪 2, independent QA copy",
|
||||
"nativeChecks": 864,
|
||||
"nativeCloneChecks": [
|
||||
{
|
||||
"keys": 2,
|
||||
"name": "native-osc-drag-moves-only-the-stamp-source-and-keeps-tracking-keys",
|
||||
"part": 7,
|
||||
"pass": true,
|
||||
"source": [
|
||||
0.35,
|
||||
0.35,
|
||||
0.20000000298023224,
|
||||
0.20000000298023224
|
||||
],
|
||||
"undoGroups": 1
|
||||
},
|
||||
{
|
||||
"name": "native-osc-escape-cancels-the-stamp-source-drag-without-another-undo",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "native-osc-stamp-resizes-coverage-without-rotation-handle-or-track-changes",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "clone-stamp-ignores-legacy-tracking-scale-and-rotation",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "clone-stamp-resized-production-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "clone-stamp-resize-extends-coverage-with-pixel-exact-translation",
|
||||
"pass": true
|
||||
}
|
||||
],
|
||||
"live": {
|
||||
"inspectorVersion": "1.13.1",
|
||||
"loadedAndRenderedBuild83Preset": true,
|
||||
"trackingKeys": 99,
|
||||
"roundTripIdentical": true,
|
||||
"axes": "Source marker, center and four extent handles visible. No rotation handle or parameter row.",
|
||||
"sourceDrag": "Live synthesized drag did not produce an OSC write. Source drag and undo verified by installed production callback tests.",
|
||||
"helpText": "Workspace picture-edit button retains generic mask help text that mentions rotation."
|
||||
},
|
||||
"cleanup": {
|
||||
"build83TemporaryBackupRemoved": true,
|
||||
"historicPackagesRetained": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"status": "passed",
|
||||
"version": "1.13.0",
|
||||
"build": "83",
|
||||
"compiledSource": "9977b5c41b07e0b08e6408c492498ba6e396c981",
|
||||
"formalPath": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"host": "Final Cut Pro 12.4",
|
||||
"hostPID": 26760,
|
||||
"actualServicePID": 26777,
|
||||
"nativeChecks": 858,
|
||||
"qaProject": "1.12.0_76_OpenCV真实帧跟踪 1 (copy in the isolated APFS QA library)",
|
||||
"live": {
|
||||
"installedInspector": "1.13.0",
|
||||
"stampGlyph": "Custom glyph visible in the lower-right rail",
|
||||
"render": "Feathered sampled pixels visible in the target ellipse, with a separate source crosshair and three tracking actions",
|
||||
"forwardTracker": "Started from the workspace, using FCP supplied frames",
|
||||
"coldReopenedAndExported": true,
|
||||
"trackKeys": 99,
|
||||
"storedStatus": "正向跟踪完成 · 99 个轨迹键",
|
||||
"sourcePatch": [
|
||||
0.23,
|
||||
0.28,
|
||||
0.18,
|
||||
0.21
|
||||
],
|
||||
"targetStart": [
|
||||
0.5,
|
||||
0.5,
|
||||
0.18000000715255737,
|
||||
0.20999999344348907,
|
||||
0.0
|
||||
],
|
||||
"targetEnd": [
|
||||
0.4583296775817871,
|
||||
0.46296340227127075,
|
||||
0.1800152063369751,
|
||||
0.2099945992231369,
|
||||
-5.047291051596403e-05
|
||||
]
|
||||
},
|
||||
"limits": [
|
||||
"GUI mouse automation did not enter live OSC mouse handlers. Actual OSC creation, single undo, and forward track-button dispatch passed the native FxPlug callback probe. The host rendering and tracking test imported a synthetic stamp preset and used the native workspace tracking control.",
|
||||
"Original lag report did not include a reproduction sequence. No end-to-end latency measurement in the reporter’s project.",
|
||||
"Motion, older macOS, and Intel were not verified."
|
||||
],
|
||||
"performance": {
|
||||
"idle4KOverlay": [
|
||||
1000,
|
||||
134
|
||||
],
|
||||
"fullCanvas": [
|
||||
3840,
|
||||
2160
|
||||
],
|
||||
"sourcePixelFraction": 0.016155478395061727,
|
||||
"syntheticTrackedMasks": 4,
|
||||
"keysPerMask": 2400,
|
||||
"copyIterations": 40,
|
||||
"legacyMeanMs": 18.018,
|
||||
"updatedMeanMs": 10.949
|
||||
},
|
||||
"cleanup": {
|
||||
"build81TemporaryBackupRemoved": true,
|
||||
"historicPackagesRetained": true
|
||||
}
|
||||
}
|
||||
+110
-12
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"bundlePath": "/Library/Plug-Ins/FxPlug/大鱼调色.app/Contents/PlugIns/大鱼调色 XPC Service.pluginkit",
|
||||
"checks": 844,
|
||||
"checks": 864,
|
||||
"gpu": "Apple M4",
|
||||
"limitations": [
|
||||
"Finite states and a 64x48 frame; live FCP discovery, inspector interaction, timeline persistence and real host export require separate acceptance.",
|
||||
@@ -12,7 +12,7 @@
|
||||
"error": "未提供错误信息",
|
||||
"name": "runtime-directory",
|
||||
"pass": true,
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/4CFD9CD2-4D6C-48E1-B497-34BFE79CC4F2"
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/20CBB99A-34B2-4BBE-981D-09D8641EFB89"
|
||||
},
|
||||
{
|
||||
"descriptors": 285,
|
||||
@@ -898,7 +898,7 @@
|
||||
"error": "未提供错误信息",
|
||||
"name": "renderer-export-33cube",
|
||||
"pass": true,
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/4CFD9CD2-4D6C-48E1-B497-34BFE79CC4F2/diagnostic-export.cube"
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/20CBB99A-34B2-4BBE-981D-09D8641EFB89/diagnostic-export.cube"
|
||||
},
|
||||
{
|
||||
"bytes": 1186074,
|
||||
@@ -918,7 +918,7 @@
|
||||
},
|
||||
{
|
||||
"heartbeats": 0,
|
||||
"maximumGapMS": 74.71933332271874,
|
||||
"maximumGapMS": 65.95633330289274,
|
||||
"name": "external-activation-main-loop-responsive",
|
||||
"pass": true
|
||||
},
|
||||
@@ -1389,7 +1389,7 @@
|
||||
"closePixels": 128,
|
||||
"name": "workspace-offscreen-compact-icons-and-close-render-pixels",
|
||||
"pass": true,
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/4CFD9CD2-4D6C-48E1-B497-34BFE79CC4F2/workspace-topbar.png",
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/20CBB99A-34B2-4BBE-981D-09D8641EFB89/workspace-topbar.png",
|
||||
"toolbarPixels": 3557
|
||||
},
|
||||
{
|
||||
@@ -1452,7 +1452,7 @@
|
||||
},
|
||||
{
|
||||
"name": "workspace-independent-style-fixture-inserted",
|
||||
"node": "02DF4028-91F1-4670-8E46-BE0625FEC949",
|
||||
"node": "FB1CBAFD-DDEE-42DB-8612-971F1C60F2DC",
|
||||
"pass": true,
|
||||
"validDocument": true
|
||||
},
|
||||
@@ -1461,10 +1461,10 @@
|
||||
"error": "none",
|
||||
"name": "workspace-independent-style1-writes-target-node-inside-undo",
|
||||
"nodePaths": {
|
||||
"look0": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/4CFD9CD2-4D6C-48E1-B497-34BFE79CC4F2/node.cube"
|
||||
"look0": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/20CBB99A-34B2-4BBE-981D-09D8641EFB89/node.cube"
|
||||
},
|
||||
"pass": true,
|
||||
"rootStyle1": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/4CFD9CD2-4D6C-48E1-B497-34BFE79CC4F2/user-new.cube",
|
||||
"rootStyle1": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/20CBB99A-34B2-4BBE-981D-09D8641EFB89/user-new.cube",
|
||||
"undoStartsAfter": 3,
|
||||
"undoStartsBefore": 2,
|
||||
"written": true
|
||||
@@ -2747,7 +2747,7 @@
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"coveredPixels": 14182,
|
||||
"coveredPixels": 15135,
|
||||
"name": "native-osc-real-metal-overlay-transparent-around-controls",
|
||||
"pass": true
|
||||
},
|
||||
@@ -2825,6 +2825,40 @@
|
||||
"name": "canvas-curve-histogram-updates-from-final-output-at-the-same-playhead",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "native-osc-renders-the-cropped-toolbar-on-a-transparent-texture",
|
||||
"opaquePixels": 11311,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "native-osc-creates-one-stamp-and-one-undo-from-source-click-and-drag",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"keys": 2,
|
||||
"name": "native-osc-drag-moves-only-the-stamp-source-and-keeps-tracking-keys",
|
||||
"part": 7,
|
||||
"pass": true,
|
||||
"source": [
|
||||
0.35,
|
||||
0.35,
|
||||
0.20000000298023224,
|
||||
0.20000000298023224
|
||||
],
|
||||
"undoGroups": 1
|
||||
},
|
||||
{
|
||||
"name": "native-osc-escape-cancels-the-stamp-source-drag-without-another-undo",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "native-osc-stamp-resizes-coverage-without-rotation-handle-or-track-changes",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "native-osc-stamp-forward-action-starts-the-existing-host-tracker",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "inspector-add-pen-enters-empty-drawing-mode",
|
||||
"pass": true
|
||||
@@ -4018,7 +4052,18 @@
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "viewer-lower-right-rail-has-five-image-tools-and-three-persistent-mask-shapes",
|
||||
"name": "viewer-lower-right-rail-has-six-image-tools-and-three-persistent-mask-shapes",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "viewer-stamp-arms-and-disarms-without-changing-the-grade",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"canvasPixelFraction": 0.016155478395061727,
|
||||
"name": "viewer-idle-4k-toolbar-rasterizes-under-five-percent-of-the-canvas",
|
||||
"overlayHeight": 134,
|
||||
"overlayWidth": 1000,
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
@@ -4140,7 +4185,7 @@
|
||||
{
|
||||
"name": "viewer-real-osc-draws-minimal-curve-on-clear-canvas",
|
||||
"pass": true,
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/4CFD9CD2-4D6C-48E1-B497-34BFE79CC4F2/viewer-workspace.png"
|
||||
"path": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/20CBB99A-34B2-4BBE-981D-09D8641EFB89/viewer-workspace.png"
|
||||
},
|
||||
{
|
||||
"name": "canvas-hsl-plot-captures-outside-and-commits-one-undo",
|
||||
@@ -4275,8 +4320,61 @@
|
||||
{
|
||||
"name": "face-no-detection-clears-prior-frame-and-fails-closed",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "",
|
||||
"name": "clone-stamp-reference-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "clone-stamp-preserves-source-through-tracking-merge",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "clone-stamp-production-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "clone-stamp-copies-pixels-and-leaves-exterior-intact",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "clone-stamp-tracked-production-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "clone-stamp-tracked-target-moves-while-sampling-the-same-source",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "clone-stamp-ignores-legacy-tracking-scale-and-rotation",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "clone-stamp-resized-production-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "clone-stamp-resize-extends-coverage-with-pixel-exact-translation",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"error": "未提供错误信息",
|
||||
"name": "clone-stamp-disabled-render",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "clone-stamp-disabled-is-identical",
|
||||
"pass": true
|
||||
},
|
||||
{
|
||||
"name": "clone-stamp-spatial-state-refuses-static-cube-export",
|
||||
"pass": true
|
||||
}
|
||||
],
|
||||
"runtimePath": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/4CFD9CD2-4D6C-48E1-B497-34BFE79CC4F2",
|
||||
"runtimePath": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/verification-runtime/20CBB99A-34B2-4BBE-981D-09D8641EFB89",
|
||||
"scope": "Native model and renderer integration with real Metal/IOSurface textures and fake FxPlug host selectors; no GUI or live host document."
|
||||
}
|
||||
+14
-14
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.12.1.pkg",
|
||||
"sha256": "ae65ac0dcaf7cead701b8ac543ee60ae62e55fd9e19646877d5ef9d9d7351b6f",
|
||||
"bytes": 45337206,
|
||||
"package": "/Volumes/备份/大鱼调色/发行包/大鱼调色-1.13.1.pkg",
|
||||
"sha256": "8a19afadda6317d186541f37a221c46261a22ddabcdddec90d02e1315b693965",
|
||||
"bytes": 45352349,
|
||||
"testUnsigned": false,
|
||||
"installationExecuted": false,
|
||||
"checks": [
|
||||
@@ -31,27 +31,27 @@
|
||||
"source": "/Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"payload": "Library/Plug-Ins/FxPlug/大鱼调色.app",
|
||||
"bundleID": "com.dayu.color",
|
||||
"version": "1.12.1",
|
||||
"build": "81"
|
||||
"version": "1.13.1",
|
||||
"build": "85"
|
||||
},
|
||||
{
|
||||
"source": "/Users/mac/Library/Caches/CodexBuilds/com.dayu.color/pkg-inputs/大鱼调色",
|
||||
"payload": "Library/Application Support/PKGForge/Payload/com.dayu.color.installer.a3191f75-292a-4884-ace5-bdf0cce7e6e1/56195A87-1454-4E1A-B1FC-7F3E323F8B99/大鱼调色"
|
||||
"payload": "Library/Application Support/PKGForge/Payload/com.dayu.color.installer.b3198d7a-ad8a-4b51-a537-b8c44369b629/4CE89FC9-76E8-42BF-87F3-226B4C813483/大鱼调色"
|
||||
}
|
||||
],
|
||||
"signature": "Package \"大鱼调色-1.12.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-05 10:13:24 +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.12.1.pkg: accepted\nsource=Notarized Developer ID",
|
||||
"signature": "Package \"大鱼调色-1.13.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-05 14:30:06 +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.13.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": {
|
||||
"createdDate": "2026-11-05T10:13:26.454Z",
|
||||
"name": "大鱼调色-1.12.1.pkg",
|
||||
"id": "ffefbde6-10f2-40e3-a8c4-ef4123053c74",
|
||||
"createdDate": "2026-11-05T14:30:08.174Z",
|
||||
"id": "b85219d9-d465-4827-bdb6-3023eb161159",
|
||||
"name": "大鱼调色-1.13.1.pkg",
|
||||
"message": "Successfully received submission info",
|
||||
"status": "Accepted"
|
||||
},
|
||||
"appCompiledSource": "43320c7ccdfc6738ba3c380888bb7f3ea75ebb87",
|
||||
"appBuild": "81",
|
||||
"appCompiledSource": "1659f3d3853e2574f06a45687141fb444b5d02ca",
|
||||
"appBuild": "85",
|
||||
"packageBuilderRemote": "https://dayu.media/git/dayu/pkg-forge.git",
|
||||
"packageBuilderCommit": "eb53707c0e67d8ddeab8c1270bb079f1050cfafe",
|
||||
"templateSHA256": {
|
||||
@@ -59,6 +59,6 @@
|
||||
"large.png": "ab12611e8801cff86332ccc505a4cffa0c1120541c2efb9bb9908be2c9fe631a",
|
||||
"small.png": "41fec3138aee904fc39d6982e6fde809243ffec55298dbfe966f4f48d89caf8a"
|
||||
},
|
||||
"installedAppHostAcceptance": "verification/HostCanvasInspector1.12.1.json",
|
||||
"installedAppHostAcceptance": "verification/HostCloneSource1.13.1.json",
|
||||
"installScope": "本轮仅生成并验包,未再次执行系统安装;正式 APP 已有独立宿主验收。"
|
||||
}
|
||||
+14
-13
@@ -3,23 +3,24 @@
|
||||
"repository": "dayu/dayu-color",
|
||||
"repositoryID": 52,
|
||||
"private": false,
|
||||
"tag": "v1.12.0-unified-workspace-20261105",
|
||||
"releaseCommit": "b72e6b31724def5c174b692ef0a46b76992e780b",
|
||||
"releaseID": 389,
|
||||
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.12.0-unified-workspace-20261105",
|
||||
"tag": "v1.13.0-clone-stamp-20261105",
|
||||
"releaseCommit": "07601e50bf604e7721bccf8be10e403a2bd030d1",
|
||||
"releaseID": 391,
|
||||
"releaseURL": "https://dayu.media/git/dayu/dayu-color/releases/tag/v1.13.0-clone-stamp-20261105",
|
||||
"prerelease": true,
|
||||
"assetID": 33,
|
||||
"assetName": "大鱼调色-1.12.0.pkg",
|
||||
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.12.0-unified-workspace-20261105/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.12.0.pkg",
|
||||
"bytes": 45329742,
|
||||
"sha256": "d4b557fec283f5e06f605bc6b1d99a0c8649f9d65e405eba452f525e8454cdfe",
|
||||
"assetID": 35,
|
||||
"assetName": "大鱼调色-1.13.0.pkg",
|
||||
"downloadURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.13.0-clone-stamp-20261105/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.13.0.pkg",
|
||||
"bytes": 45350463,
|
||||
"sha256": "7999233dd4a3b797a879cc0f37a20f0c35f925c5f6823720b40e684464a452e8",
|
||||
"existingAssetReused": true,
|
||||
"verification": "Full draft download checked before publication; published attachment downloaded and checked again; release, tag and asset read-back verified.",
|
||||
"credentialSource": "macOS Keychain: dayu-git-api",
|
||||
"draftBrowserDownload": {
|
||||
"path": "/Users/mac/Downloads/大鱼调色-1.12.0.pkg",
|
||||
"sha256": "d4b557fec283f5e06f605bc6b1d99a0c8649f9d65e405eba452f525e8454cdfe",
|
||||
"bytes": 45329742,
|
||||
"sourceURL": "https://dayu.media/git/dayu/dayu-color/releases/download/v1.12.0-unified-workspace-20261105/%E5%A4%A7%E9%B1%BC%E8%B0%83%E8%89%B2-1.12.0.pkg"
|
||||
"path": "/Volumes/备份/大鱼调色-1.13.0.pkg",
|
||||
"sha256": "7999233dd4a3b797a879cc0f37a20f0c35f925c5f6823720b40e684464a452e8",
|
||||
"bytes": 45350463,
|
||||
"sourceURL": "https://dayu.media/git/attachments/35e71dab-93d6-46a7-9b8b-f89ac553822d",
|
||||
"localCopyRemoved": true
|
||||
}
|
||||
}
|
||||
@@ -58,3 +58,51 @@ if(faceFixture.length){
|
||||
DYDiagnosticTile *twoSource=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:1024 height:512]autorelease],*twoDest=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:1024 height:512]autorelease];Pixels two(1024*512*4);for(NSUInteger y=0;y<512;y++)for(NSUInteger x=0;x<1024;x++)memcpy(two.data()+(y*1024+x)*4,portrait.data()+(y*512+x%512)*4,8);[[twoSource metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,1024,512)mipmapLevel:0 withBytes:two.data()bytesPerRow:1024*8];u.skinProtection.x=1;BOOL twoOK=[face renderSource:twoSource destination:twoDest uniforms:u paths:@{}error:&maskError];NSData *twoEntries=[face valueForKey:@"faceEntries"];const DYToolMaskEntry *twoMasks=(const DYToolMaskEntry*)twoEntries.bytes;NSInteger faceCount=0;for(NSUInteger i=0;i<twoEntries.length/sizeof(*twoMasks);i++)faceCount+=twoMasks[i].section==-100;run.record(@"face-multiple-people-build-independent-support-regions",twoOK&&faceCount==2,@{@"faces":@(faceCount)});
|
||||
Pixels noFace(w*h*4);for(NSUInteger i=0;i<w*h;i++){noFace[i*4]=.35;noFace[i*4+1]=.18;noFace[i*4+2]=.1;noFace[i*4+3]=1;}upload(noFace);u.skinVisualize=0;Pixels noFaceProtected=render(run,face,src,dst,gpu,u,@{},@"face-none-protected-render");u.skinProtection.x=0;Pixels noFacePlain=render(run,face,src,dst,gpu,u,@{},@"face-none-unprotected-reference");run.record(@"face-no-detection-clears-prior-frame-and-fails-closed",difference(noFaceProtected,noFacePlain).maximum<.002);
|
||||
}
|
||||
|
||||
|
||||
// Verify the real Metal input stage with a moving target and a fixed source.
|
||||
{
|
||||
const NSUInteger w=64,h=48;
|
||||
DYDiagnosticTile *src=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease];
|
||||
DYDiagnosticTile *dst=[[[DYDiagnosticTile alloc]initWithDevice:gpu width:w height:h]autorelease];
|
||||
Pixels input(w*h*4);
|
||||
for(NSUInteger y=0;y<h;y++)for(NSUInteger x=0;x<w;x++){
|
||||
NSUInteger i=(y*w+x)*4;
|
||||
input[i]=x/128.f;input[i+1]=y/96.f;input[i+2]=.15f;input[i+3]=1;
|
||||
}
|
||||
[[src metalTextureForDevice:gpu]replaceRegion:MTLRegionMake2D(0,0,w,h) mipmapLevel:0 withBytes:input.data() bytesPerRow:w*8];
|
||||
DYRenderer *renderer=[[[DYRenderer alloc]init]autorelease];
|
||||
DYUniforms u=DYToolUniforms(@{@"type":@"lens"});
|
||||
Pixels baseline=render(run,renderer,src,dst,gpu,u,@{},@"clone-stamp-reference-render");
|
||||
NSMutableDictionary *doc=DYMutablePlist([[[DYToolDocument alloc]init]autorelease].document);
|
||||
NSMutableDictionary *stamp=(id)DYAddSharedMask(doc,DYMaskEllipse);
|
||||
DYMaskParameters p=DYMaskAtTime(stamp,kCMTimeZero);
|
||||
p.centerX=48.5f/w;p.centerY=24.5f/h;p.width=.25f;p.height=.25f;
|
||||
stamp[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];
|
||||
stamp[@"stampSource"]=@[@(16.5f/w),@(12.5f/h),@.25,@.25];
|
||||
CMTime next=CMTimeMake(1,25);DYMaskParameters moved=p;moved.centerY=34.5f/h;moved.width=.5f;moved.height=.12f;moved.angle=.65f;
|
||||
run.record(@"clone-stamp-preserves-source-through-tracking-merge",DYMergeTracking(stamp,@[DYMaskKey(kCMTimeZero,p,NO,1),DYMaskKey(next,moved,NO,1)])&&[stamp[@"stampSource"] count]==4);
|
||||
auto frame=[&](CMTime t,NSString *label){
|
||||
NSError *failure=nil;
|
||||
BOOL ok=[renderer renderSource:src destination:dst uniforms:u paths:@{} spider:nil tools:DYToolRenderSnapshot(doc,t) colorManagement:nil hostPrimaries:kFxColorPrimaries_Rec709 error:&failure];
|
||||
run.need(label,ok,@{@"error":reason(failure)});return read(dst,gpu);
|
||||
};
|
||||
auto pixel=[&](const Pixels &a,NSUInteger x,NSUInteger y,const Pixels &b,NSUInteger u,NSUInteger v){
|
||||
double delta=0;for(int c=0;c<4;c++)delta=MAX(delta,fabs((float)a[(y*w+x)*4+c]-(float)b[(v*w+u)*4+c]));return delta;
|
||||
};
|
||||
Pixels first=frame(kCMTimeZero,@"clone-stamp-production-render");
|
||||
run.record(@"clone-stamp-copies-pixels-and-leaves-exterior-intact",pixel(first,48,24,baseline,16,12)<.002&&pixel(first,0,0,baseline,0,0)==0&&pixel(first,16,12,baseline,16,12)==0);
|
||||
Pixels second=frame(next,@"clone-stamp-tracked-production-render");
|
||||
run.record(@"clone-stamp-tracked-target-moves-while-sampling-the-same-source",pixel(second,48,34,baseline,16,12)<.002&&pixel(second,48,24,baseline,48,24)==0);
|
||||
DYMaskParameters translated=DYMaskAtTime(stamp,next);
|
||||
run.record(@"clone-stamp-ignores-legacy-tracking-scale-and-rotation",translated.angle==0&&translated.width==p.width&&translated.height==p.height&&translated.centerY==moved.centerY&&pixel(second,51,35,baseline,19,13)==0);
|
||||
p.width=.5f;p.height=.35f;p.angle=.55f; // A legacy authored rotation must not rotate copied pixels.
|
||||
stamp[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];
|
||||
Pixels expanded=frame(kCMTimeZero,@"clone-stamp-resized-production-render");
|
||||
run.record(@"clone-stamp-resize-extends-coverage-with-pixel-exact-translation",pixel(expanded,51,25,baseline,19,13)==0&&pixel(expanded,58,24,baseline,26,12)==0&&pixel(first,58,24,baseline,58,24)==0);
|
||||
stamp[@"enabled"]=@NO;Pixels disabled=frame(next,@"clone-stamp-disabled-render");
|
||||
run.record(@"clone-stamp-disabled-is-identical",difference(disabled,baseline).maximum==0);
|
||||
stamp[@"enabled"]=@YES;NSError *failure=nil;
|
||||
NSURL *cube=[NSURL fileURLWithPath:[runtime stringByAppendingPathComponent:@"unsupported-clone.cube"]];
|
||||
run.record(@"clone-stamp-spatial-state-refuses-static-cube-export",![renderer exportLUT:cube uniforms:u paths:@{} spider:nil tools:doc error:&failure]&&failure);
|
||||
}
|
||||
@@ -346,3 +346,33 @@ kernel void dyLensRepair(texture2d<float> source [[texture(0)]],texture2d<float,
|
||||
if(p.x>=output.get_width()||p.y>=output.get_height())return;float2 uv=(float2(p)+.5f)/float2(output.get_width(),output.get_height()),center=float2(u.lensCenterX,u.lensCenterY);float2 q=(uv-center)/max(1.f,u.lensScale),metric=q*float2(aspect,1);float2 corner=max(center,1-center)*float2(aspect,1);float radius=dot(metric,metric)/max(1e-6f,dot(corner,corner));float2 sample=center+q*(1+clamp(u.lensStrength,-100.f,100.f)*.0025f*radius);
|
||||
constexpr sampler f(coord::normalized,address::clamp_to_zero,filter::linear);output.write(source.sample(f,sample),p);
|
||||
}
|
||||
|
||||
kernel void dyCloneStamps(texture2d<float,access::read> input [[texture(0)]],
|
||||
texture2d<float,access::write> output [[texture(1)]],
|
||||
constant DYCloneStamp *stamps [[buffer(0)]],
|
||||
constant uint &count [[buffer(1)]],
|
||||
constant uint &flip [[buffer(2)]],
|
||||
uint2 gid [[thread_position_in_grid]]) {
|
||||
uint2 size(output.get_width(),output.get_height());
|
||||
if(any(gid>=size))return;
|
||||
float2 uv=(float2(gid)+.5f)/float2(size);
|
||||
if(flip)uv.y=1-uv.y;
|
||||
float4 color=input.read(gid);
|
||||
for(uint i=0;i<count;i++){
|
||||
constant DYCloneStamp &stamp=stamps[i];
|
||||
float2 center=float2(stamp.centerX,stamp.centerY);
|
||||
float2 local=(uv-center)*float2(stamp.inverseRadiusX,stamp.inverseRadiusY);
|
||||
float radiusSquared=dot(local,local);
|
||||
if(radiusSquared>1)continue;
|
||||
// A single integer-pixel offset preserves scale, orientation and sample values.
|
||||
float2 offset=(float2(stamp.sourceX,stamp.sourceY)-center)*float2(size);
|
||||
if(flip)offset.y=-offset.y;
|
||||
int2 source=int2(gid)+int2(round(offset));
|
||||
if(any(source<0)||any(source>=int2(size)))continue;
|
||||
float coverage=stamp.feather>0?1-smoothstep(1-stamp.feather,1.f,sqrt(radiusSquared)):1;
|
||||
coverage=saturate((coverage-stamp.inputBlack)/(stamp.inputWhite-stamp.inputBlack));
|
||||
if(stamp.inputGamma!=1)coverage=pow(coverage,1/stamp.inputGamma);
|
||||
color=mix(color,input.read(uint2(source)),coverage*stamp.strength);
|
||||
}
|
||||
output.write(color,gid);
|
||||
}
|
||||
@@ -24,9 +24,54 @@
|
||||
- (BOOL)managedProfile:(DYColorProfile*)profile input:(id<MTLTexture>)input output:(id<MTLTexture>)output entry:(NSMutableDictionary*)entry error:(NSError**)error {
|
||||
if(!profile)return NO;NSMutableDictionary*cache=entry[@"managedProfiles"];if(!cache){cache=[NSMutableDictionary dictionary];entry[@"managedProfiles"]=cache;}DYColorProfileGPU*p=cache[profile.key];if(!p){p=[[[DYColorProfileGPU alloc]initWithDevice:entry[@"device"] profile:profile error:error]autorelease];if(!p)return NO;if(cache.count>=16)[cache removeAllObjects];cache[profile.key]=p;}return [p renderInput:input output:output alpha:dycm::Alpha::Premultiplied workspaceBudget:2ull*1024*1024*1024 cancelled:nullptr error:error];
|
||||
}
|
||||
// Each stamp reads the same original frame. A later stamp may cover an
|
||||
// earlier one, but overlapping source and destination never feed back.
|
||||
- (FxImageTile*)sourceByApplyingStamps:(NSArray*)masks source:(FxImageTile*)source registry:(uint64_t)registry error:(NSError**)error{
|
||||
std::vector<DYCloneStamp> stamps;
|
||||
FxRect image=source.imagePixelBounds,bounds=source.tilePixelBounds;
|
||||
if(image.right<=image.left||image.top<=image.bottom)return source;
|
||||
for(NSDictionary *mask in masks){
|
||||
NSArray *patch=mask[@"stampSource"];
|
||||
if(!patch||![mask[@"enabled"]boolValue])continue;
|
||||
DYMaskParameters p=DYMaskAtTime(mask,kCMTimeInvalid);
|
||||
if(p.strength<=0)continue;
|
||||
stamps.push_back({p.centerX,p.centerY,[patch[0]floatValue],[patch[1]floatValue],
|
||||
2/p.width,2/p.height,p.feather,p.strength,p.inputBlack,p.inputWhite,p.inputGamma});
|
||||
}
|
||||
if(stamps.empty())return source;
|
||||
if(image.left!=bounds.left||image.right!=bounds.right||image.top!=bounds.top||image.bottom!=bounds.bottom){
|
||||
fail(error,@"仿制图章需要宿主提供完整的源画面。");return nil;
|
||||
}
|
||||
NSDictionary *entry=[self device:registry error:error];if(!entry)return nil;
|
||||
id<MTLDevice>device=entry[@"device"];
|
||||
id<MTLTexture>input=[source metalTextureForDevice:device];
|
||||
if(!input||input.framebufferOnly){fail(error,@"仿制图章无法读取源画面。");return nil;}
|
||||
MTLTextureDescriptor *desc=[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormatRGBA32Float width:input.width height:input.height mipmapped:NO];
|
||||
desc.storageMode=MTLStorageModePrivate;desc.usage=MTLTextureUsageShaderRead|MTLTextureUsageShaderWrite;
|
||||
id<MTLTexture>output=[[device newTextureWithDescriptor:desc]autorelease];
|
||||
id<MTLCommandBuffer>commands=[entry[@"queue"]commandBuffer];
|
||||
id<MTLComputeCommandEncoder>encoder=[commands computeCommandEncoder];
|
||||
if(!output||!encoder){fail(error,@"无法分配仿制图章缓冲区。");return nil;}
|
||||
uint32_t count=(uint32_t)stamps.size(),flip=source.imageOrigin==kFxImageOrigin_BOTTOM_LEFT;
|
||||
[encoder setComputePipelineState:entry[@"dyCloneStamps"]];
|
||||
[encoder setTexture:input atIndex:0];[encoder setTexture:output atIndex:1];
|
||||
[encoder setBytes:stamps.data() length:count*sizeof(DYCloneStamp) atIndex:0];
|
||||
[encoder setBytes:&count length:sizeof(count) atIndex:1];[encoder setBytes:&flip length:sizeof(flip) atIndex:2];
|
||||
[encoder dispatchThreads:MTLSizeMake(output.width,output.height,1) threadsPerThreadgroup:MTLSizeMake(16,16,1)];
|
||||
[encoder endEncoding];[commands commit];[commands waitUntilCompleted];
|
||||
if(commands.status!=MTLCommandBufferStatusCompleted){fail(error,commands.error.localizedDescription);return nil;}
|
||||
DYExportTile *tile=[[[DYExportTile alloc]initWithTexture:output registry:registry]autorelease];
|
||||
[tile setBounds:bounds origin:source.imageOrigin];[tile setPixelAspect:source.pixelAspect];[tile inheritColorSpace:source.colorSpace];
|
||||
return tile;
|
||||
}
|
||||
- (BOOL)renderSource:(FxImageTile*)src destination:(FxImageTile*)dst uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools colorManagement:(NSDictionary*)state hostPrimaries:(NSInteger)primaries error:(NSError**)error {@synchronized(self){return DYRenderWithPool(error,[&]()->BOOL{
|
||||
if(state&&![state isKindOfClass:NSDictionary.class])return fail(error,@"色彩管理状态无效。");
|
||||
NSDictionary*context=DYHostColorContext(src,dst,primaries);@synchronized(_previewLock){[_colorContext release];_colorContext=[context copy];}
|
||||
if(tools[@"sharedMasks"]){
|
||||
if(!DYValidToolDocument(tools))return fail(error,@"调色层或蒙版数据无效。");
|
||||
FxImageTile *stamped=[self sourceByApplyingStamps:DYSharedMasks(tools) source:src registry:dst.deviceRegistryID error:error];if(!stamped)return NO;
|
||||
return [self renderSource:stamped destination:dst uniforms:u paths:paths spider:spider tools:DYResolvedToolDocument(tools) colorManagement:state hostPrimaries:primaries error:error];
|
||||
}
|
||||
if(!state.count)return [self renderSource:src destination:dst uniforms:u paths:paths spider:spider tools:tools error:error];
|
||||
if(!DYManagedColorValid(state,error))return NO;if(!tools)tools=@{@"schema":@2,@"layers":@[],@"baseMasks":@{}};if(!DYValidToolDocument(tools))return fail(error,@"调色层或蒙版数据无效。");
|
||||
if(tools[@"sharedMasks"])tools=DYResolvedToolDocument(tools);
|
||||
|
||||
@@ -55,16 +55,18 @@
|
||||
- (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++;}
|
||||
for(NSDictionary *m in masks){DYMaskParameters p=DYMaskAtTime(m,time);[_list addItemWithTitle:[NSString stringWithFormat:@"%@ %ld",m[@"stampSource"]?@"仿制图章":@[@"椭圆",@"矩形",@"钢笔",@"线性渐变",@"HSL 选区",@"亮度选区"][p.kind],(long)index+1]];if([m[@"id"]isEqual:_maskID])selected=index;index++;}
|
||||
if(!masks.count){_contentHeight=0;_drawing=_canvasActive=NO;[_maskID release];_maskID=nil;_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;
|
||||
BOOL stamp=m[@"stampSource"]!=nil;_combine.hidden=_invert.hidden=stamp;
|
||||
_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]]];}
|
||||
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&&(!stamp||i!=6))||(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 保留原路径。":@"各蒙版只影响当前工具层");
|
||||
if([_nodeID isEqual:@"shared"]){_list.accessibilityLabel=@"共享蒙版";_add.toolTip=@"添加共享蒙版";_remove.toolTip=@"删除此共享蒙版及其模块关联,可撤销";if(!m[@"status"]&&!pen&&![m[@"keys"]count])_status.stringValue=[NSString stringWithFormat:@"共享给 %lu 个模块 · 编辑与跟踪同步更新所有关联模块",(unsigned long)DYToolIDsForSharedMask(doc,_maskID).count];}
|
||||
if(stamp){_remove.toolTip=@"删除仿制图章,可撤销";if(!m[@"status"]&&![m[@"keys"]count])_status.stringValue=@"取样中心固定,跟踪覆盖区域。";}
|
||||
// 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;
|
||||
@@ -99,7 +101,7 @@
|
||||
- (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([sender isKindOfClass:NSTextField.class]){NSString *text=[sender.stringValue stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];NSScanner *scanner=[NSScanner scannerWithString:text];if(![scanner scanDouble:&value]||!scanner.isAtEnd){NSBeep();[self refreshWithDocument:_document time:_time];return;}}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)valueChanged:(NSControl*)sender{if(_refreshing)return;double value=sender.doubleValue;if([sender isKindOfClass:NSTextField.class]){NSString *text=[sender.stringValue stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];NSScanner *scanner=[NSScanner scannerWithString:text];if(![scanner scanDouble:&value]||!scanner.isAtEnd){NSBeep();[self refreshWithDocument:_document time:_time];return;}}if(!std::isfinite(value)){NSBeep();return;}NSInteger i=sender.tag;[self edit:@"调整工具蒙版" block:^(NSMutableDictionary *d,NSMutableDictionary *m){BOOL stamp=m[@"stampSource"]!=nil,position=i==2||i==3;DYMaskParameters p=DYMaskAtTime(m,stamp&&!position?kCMTimeInvalid: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]&&(stamp?position: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;}
|
||||
- (NSString*)canvasNodeID{return DYSharedMaskWithID(_document,_maskID)?@"shared":_nodeID;}
|
||||
- (BOOL)representsCanvasMask:(NSDictionary*)info{NSString *maskID=info[@"mask"];if(!maskID.length)return NO;if([info[@"node"]isEqual:_nodeID])return YES;if(!DYSharedMaskWithID(_document,maskID))return NO;for(NSDictionary *mask in DYMasksForTool(_document,_nodeID))if([mask[@"id"]isEqual:maskID])return YES;return NO;}
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
// remote parameter read and view rebuild for every scalar in the burst.
|
||||
if(!_modelRefreshPending.exchange(true)){id host=_apiManager;dispatch_async(dispatch_get_main_queue(),^{self->_modelRefreshPending.store(false);[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:host];});}return YES;}
|
||||
- (BOOL)pluginState:(NSData**)state atTime:(CMTime)t quality:(FxQuality)q error:(NSError**)e{
|
||||
DYUniforms u;DYReadUniforms(_apiManager,t,&u);CMTime frameDuration=kCMTimeInvalid,origin=kCMTimeZero;id<FxTimingAPI_v4>timing=[_apiManager apiForProtocol:@protocol(FxTimingAPI_v4)];if([timing respondsToSelector:@selector(frameDuration:)])[timing frameDuration:&frameDuration];if([timing respondsToSelector:@selector(startTimeForEffect:)])[timing startTimeForEffect:&origin];int64_t frame=DYFilmFrameIndex(t,frameDuration,origin);u.filmFrameKey=DYFilmFrameKey(frame,u.film.grainHold,u.film.grainSeed);DYAssetState*a=DYReadAssets(_apiManager,t);DYToolDocument *tools=DYReadTools(_apiManager,t);[self adoptToolCanvasDocument:tools.document];[_viewerParameterBridge publishUniforms:&u document:tools.document atTime:t];[_viewerParameterBridge publishAssets:a atTime:t];double copyAuto=0;[[_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getFloatValue:©Auto fromParameter:8800 atTime:t];NSMutableDictionary *snapshot=DYMutablePlist(DYToolRenderSnapshot(tools.document,t));for(NSMutableDictionary *node in snapshot[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"film"])node[@"filmFrameKey"]=@(DYFilmFrameKey(frame,layer.film.grainHold,layer.film.grainSeed));}NSInteger primaries=-1;id<FxColorGamutAPI_v2>gamut=[_apiManager apiForProtocol:@protocol(FxColorGamutAPI_v2)];if([gamut respondsToSelector:@selector(colorPrimaries)])primaries=gamut.colorPrimaries;NSDictionary*s=@{@"colorManagement":a.colorManagement?:@{},@"hostPrimaries":@(primaries),@"schema":@2,@"tools":snapshot,@"copyAuto":@(copyAuto>.5),@"uniforms":[NSData dataWithBytes:&u length:sizeof(u)],@"paths":a.paths?:@{},@"spider":a.spiderMesh?:[NSData data]};*state=[NSPropertyListSerialization dataWithPropertyList:s format:NSPropertyListBinaryFormat_v1_0 options:0 error:e];return *state!=nil;
|
||||
DYUniforms u;DYReadUniforms(_apiManager,t,&u);CMTime frameDuration=kCMTimeInvalid,origin=kCMTimeZero;id<FxTimingAPI_v4>timing=[_apiManager apiForProtocol:@protocol(FxTimingAPI_v4)];if([timing respondsToSelector:@selector(frameDuration:)])[timing frameDuration:&frameDuration];if([timing respondsToSelector:@selector(startTimeForEffect:)])[timing startTimeForEffect:&origin];int64_t frame=DYFilmFrameIndex(t,frameDuration,origin);u.filmFrameKey=DYFilmFrameKey(frame,u.film.grainHold,u.film.grainSeed);DYAssetState*a=DYReadAssets(_apiManager,t);DYToolDocument *tools=DYReadTools(_apiManager,t);[self adoptToolCanvasDocument:tools.document];[_viewerParameterBridge publishUniforms:&u document:tools.document atTime:t];[_viewerParameterBridge publishAssets:a atTime:t];double copyAuto=0;[[_apiManager apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getFloatValue:©Auto fromParameter:8800 atTime:t];NSDictionary *snapshot=DYToolRenderSnapshot(tools.document,t);for(NSMutableDictionary *node in snapshot[@"layers"])if([node[@"type"]isEqual:@"film"]){DYUniforms layer=DYToolUniforms(node);node[@"filmFrameKey"]=@(DYFilmFrameKey(frame,layer.film.grainHold,layer.film.grainSeed));}NSInteger primaries=-1;id<FxColorGamutAPI_v2>gamut=[_apiManager apiForProtocol:@protocol(FxColorGamutAPI_v2)];if([gamut respondsToSelector:@selector(colorPrimaries)])primaries=gamut.colorPrimaries;NSDictionary*s=@{@"colorManagement":a.colorManagement?:@{},@"hostPrimaries":@(primaries),@"schema":@2,@"tools":snapshot,@"copyAuto":@(copyAuto>.5),@"uniforms":[NSData dataWithBytes:&u length:sizeof(u)],@"paths":a.paths?:@{},@"spider":a.spiderMesh?:[NSData data]};*state=[NSPropertyListSerialization dataWithPropertyList:s format:NSPropertyListBinaryFormat_v1_0 options:0 error:e];return *state!=nil;
|
||||
}
|
||||
- (BOOL)destinationImageRect:(FxRect*)rect sourceImages:(NSArray<FxImageTile*>*)src destinationImage:(FxImageTile*)dst pluginState:(NSData*)s atTime:(CMTime)t error:(NSError**)e{if(!src.count)return NO;*rect=src[0].imagePixelBounds;return YES;}
|
||||
- (BOOL)sourceTileRect:(FxRect*)rect sourceImageIndex:(NSUInteger)i sourceImages:(NSArray<FxImageTile*>*)src destinationTileRect:(FxRect)dstRect destinationImage:(FxImageTile*)dst pluginState:(NSData*)s atTime:(CMTime)t error:(NSError**)e{if(i>=src.count)return NO;*rect=src[i].imagePixelBounds;return YES;}
|
||||
|
||||
@@ -33,17 +33,19 @@ template<class F> static BOOL DYRenderWithPool(NSError **error,F body){
|
||||
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; }
|
||||
@interface DYExportTile : FxImageTile { id<MTLTexture> _tex; uint64_t _registry; FxRect _bounds;FxImageOrigin _origin; double _pixelAspect; CGColorSpaceRef _tileSpace; BOOL _hasTileSpace; }
|
||||
- (instancetype)initWithTexture:(id<MTLTexture>)texture registry:(uint64_t)registry;
|
||||
- (void)setBounds:(FxRect)bounds origin:(FxImageOrigin)origin;
|
||||
- (void)setPixelAspect:(double)aspect;
|
||||
- (void)inheritColorSpace:(CGColorSpaceRef)space;
|
||||
@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];}
|
||||
- (void)dealloc{[_tex release];if(_tileSpace)CGColorSpaceRelease(_tileSpace);[super dealloc];}
|
||||
- (void)inheritColorSpace:(CGColorSpaceRef)space{if(space)CGColorSpaceRetain(space);if(_tileSpace)CGColorSpaceRelease(_tileSpace);_tileSpace=space;_hasTileSpace=YES;}
|
||||
- (id<MTLTexture>)metalTextureForDevice:(id<MTLDevice>)d{return d.registryID==_registry?_tex:nil;}
|
||||
- (void)setBounds:(FxRect)bounds origin:(FxImageOrigin)origin{_bounds=bounds;_origin=origin;}
|
||||
- (CGColorSpaceRef)colorSpace{static CGColorSpaceRef s;static dispatch_once_t once;dispatch_once(&once,^{s=CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);});return s;}
|
||||
- (CGColorSpaceRef)colorSpace{if(_hasTileSpace)return _tileSpace;static CGColorSpaceRef s;static dispatch_once_t once;dispatch_once(&once,^{s=CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);});return s;}
|
||||
- (FxRect)tilePixelBounds{return _bounds;}
|
||||
- (FxRect)imagePixelBounds{return self.tilePixelBounds;}
|
||||
- (uint64_t)deviceRegistryID{return _registry;}
|
||||
@@ -168,7 +170,7 @@ static NSArray *DYPrimaryActiveFinishing(DYUniforms u,NSDictionary *paths,NSData
|
||||
NSURL*url=[[NSBundle bundleForClass:self.class]URLForResource:@"default" withExtension:@"metallib"];
|
||||
id<MTLLibrary>lib=[d newLibraryWithURL:url error:err];if(!lib){[d release];return nil;}
|
||||
id<MTLCommandQueue>q=[d newCommandQueue];entry=[NSMutableDictionary dictionaryWithDictionary:@{@"device":d,@"library":lib,@"queue":q,@"pipelines":[NSMutableDictionary dictionary]}];
|
||||
for(NSString*fn in @[@"dyLensRepair",@"dyUnpremultiply",@"dyWhitesSceneStatistics",@"dyLUTExportKernel",@"dyInputAnalysis",@"dyScopeSample",@"dyColorManagement",@"dyToolBlend",@"dyToolSkin",@"dyFilmPoint",@"dyFilmNoise",@"dyFilmSparseBlur",@"dyFilmBloomEdges",@"dyFilmMix",@"dyFilmPrint"]){id<MTLFunction>f=[lib newFunctionWithName:fn];if(!f){fail(err,[fn stringByAppendingString:@" 缺失"]);[lib release];[q release];[d release];return nil;}uint64_t pipelineSpan=DYBetaSpanBegin(@"gpu_pipeline",@{@"pipeline":fn,@"gpu":d.name?:@"unknown"});id<MTLComputePipelineState>p=[d newComputePipelineStateWithFunction:f error:err];DYBetaSpanEnd(pipelineSpan,@{@"status":p?@"passed":@"failed"});[f release];if(!p){[lib release];[q release];[d release];return nil;}entry[fn]=p;[p release];}
|
||||
for(NSString*fn in @[@"dyLensRepair",@"dyUnpremultiply",@"dyWhitesSceneStatistics",@"dyLUTExportKernel",@"dyInputAnalysis",@"dyScopeSample",@"dyCloneStamps",@"dyColorManagement",@"dyToolBlend",@"dyToolSkin",@"dyFilmPoint",@"dyFilmNoise",@"dyFilmSparseBlur",@"dyFilmBloomEdges",@"dyFilmMix",@"dyFilmPrint"]){id<MTLFunction>f=[lib newFunctionWithName:fn];if(!f){fail(err,[fn stringByAppendingString:@" 缺失"]);[lib release];[q release];[d release];return nil;}uint64_t pipelineSpan=DYBetaSpanBegin(@"gpu_pipeline",@{@"pipeline":fn,@"gpu":d.name?:@"unknown"});id<MTLComputePipelineState>p=[d newComputePipelineStateWithFunction:f error:err];DYBetaSpanEnd(pipelineSpan,@{@"status":p?@"passed":@"failed"});[f release];if(!p){[lib release];[q release];[d release];return nil;}entry[fn]=p;[p release];}
|
||||
float identity[32];for(int z=0;z<2;z++)for(int y=0;y<2;y++)for(int x=0;x<2;x++){int i=((z*2+y)*2+x)*4;identity[i]=x;identity[i+1]=y;identity[i+2]=z;identity[i+3]=1;}id<MTLTexture>neutral=texture3D(d,identity,2);if(!neutral){fail(err,@"无法分配中性 LUT");return nil;}entry[@"identity"]=neutral;
|
||||
// Preparing before the first frame may use registry 0. Reuse those pipelines
|
||||
// when the host subsequently supplies that device's actual registry ID.
|
||||
|
||||
@@ -87,3 +87,69 @@
|
||||
run.record(@"canvas-curve-histogram-updates-from-final-output-at-the-same-playhead",before.length==sizeof(DYHistogram)&&after.length==sizeof(DYHistogram)&&![before isEqual:after]&&![bridge canvasHistogramAtTime:CMTimeMake(1,24)]);
|
||||
[plugin release];
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
DYDiagnosticManager *base=[[[DYDiagnosticManager alloc]init]autorelease];DYCreateParameters(base,&error);
|
||||
DYToolCanvasProbe *host=[[[DYToolCanvasProbe alloc]init]autorelease];host->_base=base;host->_time=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<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];
|
||||
id viewer=[(id)osc valueForKey:@"viewerControls"];NSRect button=NSZeroRect;
|
||||
for(NSDictionary *a in [viewer valueForKey:@"areas"])if([a[@"toolType"]isEqual:@"cloneStamp"])button=[a[@"rect"]rectValue];
|
||||
Pixels rendered=read(overlay,gpu);NSUInteger opaque=0;
|
||||
for(NSUInteger i=0;i<640*400;i++)opaque+=rendered[4*i+3]>.01;
|
||||
run.record(@"native-osc-renders-the-cropped-toolbar-on-a-transparent-texture",!NSIsEmptyRect(button)&&opaque>100&&opaque<640*400*.08&&rendered[(200*640+320)*4+3]==0,@{@"opaquePixels":@(opaque)});
|
||||
BOOL update=NO;
|
||||
auto down=[&](double x,double y){NSInteger part=0;[osc hitTestOSCAtMousePositionX:x mousePositionY:y activePart:&part atTime:kCMTimeZero];[osc mouseDownAtPositionX:x positionY:y activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];return part;};
|
||||
auto up=[&](double x,double y,NSInteger part){[osc mouseUpAtPositionX:x positionY:y activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];};
|
||||
auto click=[&](double x,double y){NSInteger part=down(x,y);up(x,y,part);};
|
||||
int undo=base->_undoStarts;
|
||||
click(NSMidX(button),400-NSMidY(button));
|
||||
click(180,291.25); // normalized source (0.25, 0.25)
|
||||
NSInteger part=down(348,244);
|
||||
[osc mouseDraggedAtPositionX:460 positionY:181 activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];
|
||||
up(460,181,part);drain();
|
||||
NSDictionary *stamp=[DYSharedMasks(DYReadTools(host,kCMTimeZero).document) firstObject];NSArray *source=stamp[@"stampSource"];
|
||||
DYMaskParameters target=DYMaskAtTime(stamp,kCMTimeZero);
|
||||
run.record(@"native-osc-creates-one-stamp-and-one-undo-from-source-click-and-drag",source.count==4&&fabs([source[0]doubleValue]-.25)<1e-6&&fabs([source[1]doubleValue]-.25)<1e-6&&fabs(target.centerX-.65)<1e-6&&fabs(target.centerY-.5)<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
|
||||
[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];
|
||||
NSString *stampID=[[stamp[@"id"]copy]autorelease];
|
||||
NSMutableDictionary *tracked=DYMutablePlist(DYReadTools(host,kCMTimeZero).document);
|
||||
NSMutableDictionary *trackedStamp=(id)DYSharedMaskWithID(tracked,stampID);
|
||||
DYMaskParameters moved=target;moved.centerX+=.05f;
|
||||
NSArray *keys=@[DYMaskKey(kCMTimeZero,target,NO,1),DYMaskKey(CMTimeMake(1,25),moved,NO,1)];
|
||||
trackedStamp[@"keys"]=keys;DYWriteTools(host,tracked,kCMTimeZero);
|
||||
[plugin pluginState:&state atTime:kCMTimeZero quality:(FxQuality)0 error:&error];
|
||||
[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];
|
||||
undo=base->_undoStarts;
|
||||
part=down(180,291.25);
|
||||
[osc mouseDraggedAtPositionX:236 positionY:259.75 activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];
|
||||
NSArray *preview=[plugin toolCanvasMaskAtTime:kCMTimeZero][@"stampSource"];
|
||||
up(236,259.75,part);drain();
|
||||
NSDictionary *edited=DYSharedMaskWithID(DYReadTools(host,kCMTimeZero).document,stampID);
|
||||
NSArray *relocated=edited[@"stampSource"];
|
||||
run.record(@"native-osc-drag-moves-only-the-stamp-source-and-keeps-tracking-keys",part==7&&fabs([relocated[0]doubleValue]-.35)<1e-6&&fabs([relocated[1]doubleValue]-.35)<1e-6&&[relocated isEqual:preview]&&[edited[@"parameters"]isEqual:trackedStamp[@"parameters"]]&&[edited[@"keys"]isEqual:keys]&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1,@{@"part":@(part),@"source":relocated?:@[],@"keys":@([edited[@"keys"]count]),@"undoGroups":@(base->_undoStarts-undo)});
|
||||
[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];
|
||||
part=down(236,259.75);
|
||||
[osc mouseDraggedAtPositionX:270 positionY:240 activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];
|
||||
BOOL handled=NO;
|
||||
[osc keyDownAtPositionX:270 positionY:240 keyPressed:27 modifiers:0 forceUpdate:&update didHandle:&handled atTime:kCMTimeZero];
|
||||
drain();
|
||||
run.record(@"native-osc-escape-cancels-the-stamp-source-drag-without-another-undo",handled&&[DYSharedMaskWithID(DYReadTools(host,kCMTimeZero).document,stampID)[@"stampSource"]isEqual:relocated]&&base->_undoStarts==undo+1);
|
||||
[osc drawOSCWithWidth:640 height:400 activePart:0 destinationImage:overlay atTime:kCMTimeZero];
|
||||
BOOL rotationHandle=NO;
|
||||
for(NSDictionary *handle in [(id)osc valueForKey:@"handles"])rotationHandle|=[handle[@"part"]integerValue]==6;
|
||||
part=down(348,244);
|
||||
[osc mouseDraggedAtPositionX:320 positionY:260 activePart:part modifiers:0 forceUpdate:&update atTime:kCMTimeZero];
|
||||
up(320,260,part);drain();
|
||||
NSDictionary *resized=DYSharedMaskWithID(DYReadTools(host,kCMTimeZero).document,stampID);
|
||||
DYMaskParameters enlarged=DYMaskAtTime(resized,kCMTimeZero);
|
||||
run.record(@"native-osc-stamp-resizes-coverage-without-rotation-handle-or-track-changes",!rotationHandle&&part==2&&enlarged.width>target.width&&enlarged.height>target.height&&enlarged.centerX==target.centerX&&enlarged.centerY==target.centerY&&[resized[@"keys"]isEqual:keys]);
|
||||
click(251,104);drain(); // top-down viewport y=30...345, forward button is x=212...290.
|
||||
run.record(@"native-osc-stamp-forward-action-starts-the-existing-host-tracker",host->_forwardStarts==1&&host->_backwardStarts==0);
|
||||
[plugin cleanupAnalysis:nil];drain();[(id)osc release];[(id)plugin release];
|
||||
}
|
||||
@@ -8,8 +8,8 @@
|
||||
@synchronized(self){[_toolCanvasDraft release];_toolCanvasDraft=nil;[_toolCanvasOriginal release];_toolCanvasOriginal=nil;_toolDrawingPen=_toolDrawingShape=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;
|
||||
NSDictionary *draft=nil,*original=nil;NSString *node=nil,*maskID=nil;CMTime time;uint64_t revision;BOOL sourceEdit,resizeStamp;
|
||||
@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;sourceEdit=_toolDragPart==DYCloneSourcePart;resizeStamp=draft[@"stampSource"]&&_toolDragPart>=2&&_toolDragPart<=5;
|
||||
// Keep the completed path visible until the authoritative write returns.
|
||||
// Discarding it here exposed the new pen mask's default rectangular nodes
|
||||
// during the OSC redraw that immediately follows the closing click.
|
||||
@@ -22,12 +22,17 @@
|
||||
if(!CMTIME_IS_NUMERIC(a.currentTime)||CMTimeCompare(DYHostDisplayedFrameTime(self->_apiManager,a.currentTime),time)!=0){[self postToolCanvasStatus:@"播放头已移动,本次蒙版草稿未写入其它帧。"];return;}
|
||||
NSMutableDictionary *doc=DYMutablePlist(DYReadTools(self->_apiManager,time).document),*current=[self toolMask:maskID node:node document:doc];
|
||||
if(!current||![current isEqual:original]){os_log(OS_LOG_DEFAULT,"dayu_pen_commit conflict current=%{public}d",current!=nil);[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];}}
|
||||
NSMutableDictionary *result=sourceEdit?[[draft mutableCopy]autorelease]:DYMutablePlist(draft);
|
||||
if(resizeStamp){
|
||||
DYMaskParameters p=DYMaskAtTime(result,kCMTimeInvalid),authored=DYMaskAtTime(current,kCMTimeInvalid);
|
||||
authored.width=p.width;authored.height=p.height;
|
||||
result[@"parameters"]=[NSData dataWithBytes:&authored length:sizeof(authored)];
|
||||
result[@"keys"]=current[@"keys"];
|
||||
}else if(!sourceEdit&&[current[@"keys"]count]){DYMaskParameters p=DYMaskAtTime(result,time);if(current[@"stampSource"])result[@"parameters"]=current[@"parameters"];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:sourceEdit?@"移动图章取样点":@"编辑工具蒙版"];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];}
|
||||
os_log(OS_LOG_DEFAULT,"dayu_pen_commit result=%{public}d valid=%{public}d",changed,DYValidToolMask(draft));
|
||||
if(changed)[self postToolCanvasStatus:@"蒙版已保存 · 可一次撤销"];
|
||||
if(changed)[self postToolCanvasStatus:sourceEdit?@"图章取样点已移动 · 可一次撤销":@"蒙版已保存 · 可一次撤销"];
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];
|
||||
}@finally{@synchronized(self){if(revision==self->_toolCanvasRevision){[self->_toolCanvasDraft release];self->_toolCanvasDraft=nil;[self->_toolCanvasOriginal release];self->_toolCanvasOriginal=nil;self->_toolCanvasEditTime=kCMTimeInvalid;}self->_toolCanvasCommitPending=NO;}[self postToolCanvasStatus:nil];}});[draft release];[original release];[node release];[maskID release];
|
||||
}
|
||||
@@ -74,6 +79,14 @@
|
||||
if(type==NSEventTypeLeftMouseDown){
|
||||
_toolCanvasHasHover=NO;
|
||||
if(_toolDrawingPen&&part==1000&&[_toolCanvasDraft[@"nodes"]length]>=3*sizeof(DYBezierNode)){[self commitToolCanvasDraftAtTime:time];return;}
|
||||
if(part==DYCloneSourcePart){
|
||||
NSDictionary *stamp=[self toolMask:_selectedToolMask node:_selectedToolNode document:_toolCanvasDocument];
|
||||
if([stamp[@"stampSource"]count]!=4)return;
|
||||
[self discardToolCanvasDraft];
|
||||
_toolCanvasOriginal=[stamp mutableCopy];_toolCanvasDraft=[stamp mutableCopy];_toolCanvasEditTime=time;
|
||||
_toolDragStart=point;_toolDragPart=part;
|
||||
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=_toolSourceAspect>0?_toolSourceAspect: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);
|
||||
@@ -83,6 +96,14 @@
|
||||
if(!_toolCanvasDraft)return;
|
||||
if(CMTimeCompare(time,_toolCanvasEditTime)!=0){[self discardToolCanvasDraft];return;}
|
||||
if(_toolDrawingShape&&(type==NSEventTypeLeftMouseDragged||type==NSEventTypeLeftMouseUp)){[self updateToolShapeDraftAtPoint:point];if(type==NSEventTypeLeftMouseUp){DYMaskParameters p=DYMaskAtTime(_toolCanvasDraft,time);if(p.width<=.001f||p.height<=.001f){[self discardToolCanvasDraft];[self postToolCanvasStatus:@"未拖出有效区域,原蒙版已保留。"];return;}[self commitToolCanvasDraftAtTime:time];}return;}
|
||||
if(_toolDragPart==DYCloneSourcePart&&(type==NSEventTypeLeftMouseDragged||type==NSEventTypeLeftMouseUp)){
|
||||
NSArray *source=_toolCanvasOriginal[@"stampSource"];
|
||||
double x=fmax(0,fmin(1,[source[0]doubleValue]+(point.x-_toolDragStart.x)));
|
||||
double y=fmax(0,fmin(1,[source[1]doubleValue]+(point.y-_toolDragStart.y)));
|
||||
_toolCanvasDraft[@"stampSource"]=@[@(x),@(y),source[2],source[3]];
|
||||
if(type==NSEventTypeLeftMouseUp)[self commitToolCanvasDraftAtTime:time];
|
||||
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;
|
||||
|
||||
@@ -3,3 +3,9 @@
|
||||
struct DYToolMaskEntry {DYResolvedMask mask;int section,combine;};
|
||||
struct DYToolMaskHeader {unsigned count;float offsetX,offsetY,scaleX,scaleY;int section,premultiplied,faceOnly,skinPreview;};
|
||||
struct DYToolStageRange {int first,last,suppressBlackWhite;};
|
||||
|
||||
// Destination coverage and source offset are independent.
|
||||
struct DYCloneStamp {
|
||||
float centerX,centerY,sourceX,sourceY;
|
||||
float inverseRadiusX,inverseRadiusY,feather,strength,inputBlack,inputWhite,inputGamma;
|
||||
};
|
||||
@@ -1,3 +1,4 @@
|
||||
static const NSInteger DYCloneSourcePart=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)
|
||||
@@ -5,4 +6,6 @@ static NSMapTable *DYToolCanvasSessions(void){static NSMapTable *map;static disp
|
||||
- (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;
|
||||
- (void)addCloneStampFrom:(NSPoint)source target:(NSRect)target atTime:(CMTime)time;
|
||||
- (void)trackCloneStamp:(NSString*)stampID direction:(NSInteger)direction;
|
||||
@end
|
||||
@@ -23,10 +23,44 @@
|
||||
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(DYSharedMaskWithID(_toolCanvasDocument,mask))node=@"shared";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];NSDictionary *shape=[self toolMask:mask node:node document:_toolCanvasDocument];DYMaskParameters shapeParameters=DYMaskAtTime(shape,kCMTimeInvalid);_toolDrawingShape=shape&&shapeParameters.kind<2&&[notification.userInfo[@"drawShape"]boolValue];if(_toolDrawingShape)_toolDrawingPen=NO;++_toolCanvasRevision;_toolCanvasEditTime=kCMTimeInvalid;_toolDragPart=0;_toolCanvasHasHover=NO;[_toolCanvasDraft release];_toolCanvasDraft=nil;[_toolCanvasOriginal release];_toolCanvasOriginal=nil;}[self postToolCanvasStatus:_toolDrawingPen?@"钢笔:点击放点,拖出曲柄;点首节点或完成绘制闭合。":_toolDrawingShape?@"在画面按下并拖出蒙版区域;Esc 取消。":@"已选中本层蒙版"];
|
||||
}
|
||||
- (void)addCloneStampFrom:(NSPoint)source target:(NSRect)target atTime:(CMTime)time {
|
||||
dispatch_async(dispatch_get_main_queue(),^{
|
||||
if(self->_trackingActive.load()||!CMTIME_IS_NUMERIC(time))return;
|
||||
id<FxCustomParameterActionAPI_v4>action=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];
|
||||
if(!action)return;
|
||||
NSDictionary *selection=nil;
|
||||
[action startAction:self];@try{
|
||||
if(CMTimeCompare(DYHostDisplayedFrameTime(self->_apiManager,action.currentTime),time)!=0)return;
|
||||
NSMutableDictionary *doc=DYMutablePlist(DYReadTools(self->_apiManager,time).document);
|
||||
NSMutableDictionary *stamp=(id)DYAddSharedMask(doc,DYMaskEllipse);
|
||||
if(!stamp){NSBeep();return;}
|
||||
DYMaskParameters p=DYMaskAtTime(stamp,kCMTimeInvalid);
|
||||
p.centerX=NSMidX(target);p.centerY=NSMidY(target);p.width=target.size.width;p.height=target.size.height;
|
||||
stamp[@"parameters"]=[NSData dataWithBytes:&p length:sizeof(p)];
|
||||
stamp[@"stampSource"]=@[@(source.x),@(source.y),@(p.width),@(p.height)];
|
||||
id<FxUndoAPI>undo=[self->_apiManager apiForProtocol:@protocol(FxUndoAPI)];
|
||||
BOOL grouped=[undo startUndoGroup:@"创建仿制图章"];
|
||||
if(DYWriteTools(self->_apiManager,doc,time))selection=@{@"node":@"shared",@"mask":stamp[@"id"],@"document":doc};
|
||||
else NSBeep();
|
||||
if(grouped)[undo endUndoGroup];
|
||||
}@finally{[action endAction:self];}
|
||||
if(selection){
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasSelection" object:self->_apiManager userInfo:selection];
|
||||
[self postToolCanvasStatus:@"仿制图章已保存 · 可跟踪目标区域"];
|
||||
}
|
||||
});
|
||||
}
|
||||
- (void)trackCloneStamp:(NSString*)stampID direction:(NSInteger)direction{
|
||||
if(!stampID)return;
|
||||
dispatch_async(dispatch_get_main_queue(),^{
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolTrack" object:self->_apiManager userInfo:@{@"node":@"shared",@"mask":stampID,@"direction":@(direction)}];
|
||||
});
|
||||
}
|
||||
- (BOOL)toolCanvasVisible {@synchronized(self){return _selectedToolNode&&_selectedToolMask&&!_toolCanvasHidden;}}
|
||||
- (DYViewerParameterBridge*)viewerParameterBridge{return _viewerParameterBridge;}
|
||||
- (NSDictionary*)toolCanvasMaskAtTime:(CMTime)time {
|
||||
@synchronized(self){if(_toolDrawingShape&&_toolCanvasDraft&&(!CMTIME_IS_NUMERIC(time)||CMTimeCompare(time,_toolCanvasEditTime)!=0)){[self discardToolCanvasDraft];[self postToolCanvasStatus:@"播放头已移动,已取消本次框选。"];}if(_toolCanvasHidden||!_selectedToolMask)return nil;BOOL draftTime=_toolCanvasDraft&&CMTIME_IS_NUMERIC(time)&&CMTIME_IS_NUMERIC(_toolCanvasEditTime)&&CMTimeCompare(time,_toolCanvasEditTime)==0;NSDictionary *m=draftTime?_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),@"drawShape":@(_toolDrawingShape),@"shapeStarted":@(_toolDrawingShape&&_toolCanvasDraft!=nil),@"hover":(_toolDrawingPen&&_toolCanvasHasHover)?@[@(_toolCanvasHoverPoint.x),@(_toolCanvasHoverPoint.y)]:@[],@"coverage":@(_toolShowCoverage)};}
|
||||
@synchronized(self){if(_toolDrawingShape&&_toolCanvasDraft&&(!CMTIME_IS_NUMERIC(time)||CMTimeCompare(time,_toolCanvasEditTime)!=0)){[self discardToolCanvasDraft];[self postToolCanvasStatus:@"播放头已移动,已取消本次框选。"];}if(_toolCanvasHidden||!_selectedToolMask)return nil;BOOL draftTime=_toolCanvasDraft&&CMTIME_IS_NUMERIC(time)&&CMTIME_IS_NUMERIC(_toolCanvasEditTime)&&CMTimeCompare(time,_toolCanvasEditTime)==0;NSDictionary *m=draftTime?_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),@"drawShape":@(_toolDrawingShape),@"shapeStarted":@(_toolDrawingShape&&_toolCanvasDraft!=nil),@"hover":(_toolDrawingPen&&_toolCanvasHasHover)?@[@(_toolCanvasHoverPoint.x),@(_toolCanvasHoverPoint.y)]:@[],@"coverage":@(_toolShowCoverage),@"stampSource":m[@"stampSource"]?:@[],@"tracking":@(_trackingActive.load())};}
|
||||
}
|
||||
- (void)toolTrackRequested:(NSNotification*)notification {
|
||||
NSInteger direction=[notification.userInfo[@"direction"]integerValue];if(direction==9){_trackingCancelled.store(true);return;}@synchronized(self){if(_toolDrawingPen||_toolDrawingShape||_toolCanvasCommitPending){[self postToolCanvasStatus:@"请先完成或取消蒙版绘制,再开始跟踪。"];return;}}if(_trackingActive.load()){[self toolStatus:@"请先取消当前跟踪"];return;}
|
||||
@@ -72,7 +106,7 @@
|
||||
if(!_trackingSamples.count){if(_trackingReferenceFrame.valid()&&frame.width==_trackingReferenceFrame.width&&frame.height==_trackingReferenceFrame.height){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);_trackingFlip=flip<.035&&flip+.008<same&&flip<same*.8;}os_log(OS_LOG_DEFAULT,"dayu_tool_track_seed width=%{public}d height=%{public}d flip=%{public}d time=%{public}.6f",frame.width,frame.height,(int)_trackingFlip,CMTimeGetSeconds(time));}
|
||||
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 finishToolAnalysis:@"蒙版内纹理不足,原蒙版已保留" error:error];}else if(!_toolTracker.track(frame).valid){auto lost=_toolTracker.result();NSString *reason=@"区域内运动不一致";switch(lost.failure){case dy::TrackFailure::InsufficientMatches:reason=@"可用特征点不足";break;case dy::TrackFailure::LowConfidence:reason=@"运动可信度不足";break;case dy::TrackFailure::OutsideFrame:reason=@"目标已离开画面";break;case dy::TrackFailure::InvalidTransform:reason=@"运动变换过大";break;case dy::TrackFailure::Backend:case dy::TrackFailure::InvalidFrame:reason=@"源画面或跟踪引擎异常";break;default:break;}os_log(OS_LOG_DEFAULT,"dayu_tool_track_loss time=%{public}.6f reason=%{public}d features=%{public}d matches=%{public}d inliers=%{public}d confidence=%{public}.3f residual=%{public}.3f",CMTimeGetSeconds(time),(int)lost.failure,lost.features,lost.matches,lost.inliers,lost.confidence,lost.medianError);return [self finishToolAnalysis:[NSString stringWithFormat:@"%@,已保留 %lu 帧可信轨迹;可调整蒙版后从此处继续",reason,(unsigned long)_trackingSamples.count] 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;
|
||||
auto result=_toolTracker.result();DYMaskParameters p=DYMaskAtTime(_trackingFrozenMask,time);p.centerX=result.cx;p.centerY=result.cy;if(!_trackingFrozenMask[@"stampSource"]){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==1||_trackingSamples.count%15==0)[self toolStatus:[NSString stringWithFormat:@"已分析 %lu 帧 · 置信度 %.0f%%",(unsigned long)_trackingSamples.count,result.confidence*100]];return YES;
|
||||
}@finally{_trackingInFrame.store(false);}
|
||||
}
|
||||
@@ -82,7 +116,7 @@
|
||||
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);NSString *node=DYSharedMaskWithID(doc,self->_trackingMaskID)?@"shared":self->_trackingNode;NSMutableDictionary *mask=[self toolMask:self->_trackingMaskID node:node 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];}}}
|
||||
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);NSString *node=DYSharedMaskWithID(doc,self->_trackingMaskID)?@"shared":self->_trackingNode;NSMutableDictionary *mask=[self toolMask:self->_trackingMaskID node:node 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:mask[@"stampSource"]?@"仿制图章跟踪":@"蒙版区域跟踪"];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&&changed&&!self->_trackingDiscard&&!self->_trackingCancelled.load()&&CMTIME_IS_NUMERIC(stepTime);
|
||||
@synchronized(self->_toolCaptureDevices){for(NSMutableDictionary *entry in self->_toolCaptureDevices.allValues)[entry removeObjectsForKeys:@[@"encoded",@"bytes",@"buffer"]];}
|
||||
self->_trackingActive.store(false);if(advance){id<FxCustomParameterActionAPI_v4>seek=[self->_apiManager apiForProtocol:@protocol(FxCustomParameterActionAPI_v4)];if(seek){[seek startAction:self];@try{id<FxTimingAPI_v4>timing=[self->_apiManager apiForProtocol:@protocol(FxTimingAPI_v4)];CMTime timelineTime=kCMTimeInvalid;[timing timelineTime:&timelineTime fromInputTime:stepTime];id<FxCommandAPI_v2>command=[self->_apiManager apiForProtocol:@protocol(FxCommandAPI_v2)];if(CMTIME_IS_NUMERIC(timelineTime)){NSError *seekError=nil;BOOL moved=[command movePlayheadToTime:timelineTime error:&seekError];if(!moved)os_log(OS_LOG_DEFAULT,"dayu_tool_track_seek timeline=%{public}.6f code=%{public}ld",CMTimeGetSeconds(timelineTime),(long)seekError.code);}else message=[message stringByAppendingString:@";宿主未提供有效播放头位置"];}@finally{[seek endAction:self];}}}[self->_toolAnalysisTimer invalidate];[self->_toolAnalysisTimer release];self->_toolAnalysisTimer=nil;[self toolStatus:message];[NSNotificationCenter.defaultCenter postNotificationName:DYModelChanged object:self->_apiManager];
|
||||
|
||||
+98
-5
@@ -5,6 +5,9 @@
|
||||
@implementation DYToolOSC {
|
||||
id<MTLDevice> _device;id<MTLCommandQueue> _queue;CIContext *_context;
|
||||
DYViewerControls *_viewerControls;CGFloat _height,_canvasWidth,_uiScale;BOOL _maskCapturing;DYPlugIn *_maskCaptureOwner;NSRect _imageRect;NSDictionary *_mask;NSMutableArray *_handles;NSBezierPath *_outline;NSInteger _lastRoute;NSUInteger _drawCount,_hitDiagnostics,_eventDiagnostics;
|
||||
BOOL _stampHasSource,_stampDragging;
|
||||
NSPoint _stampSource,_stampStart,_stampEnd;
|
||||
CMTime _stampTime;
|
||||
}
|
||||
- (instancetype)initWithAPIManager:(id<PROAPIAccessing>)manager{if((self=[super init])){_apiManager=manager;_viewerControls=[DYViewerControls new];_handles=[NSMutableArray new];_lastRoute=-1;_uiScale=1;os_log(OS_LOG_DEFAULT,"dayu_tool_osc_init");}return self;}
|
||||
- (void)dealloc{[_viewerControls release];[_device release];[_queue release];[_context release];[_mask release];[_handles release];[_outline release];[super dealloc];}
|
||||
@@ -20,6 +23,54 @@
|
||||
NSRect v=NSIntersectionRect(_imageRect,NSMakeRect(0,0,_canvasWidth,_height));CGFloat scale=MAX(.01,MIN(_uiScale,MIN(v.size.width/300.,v.size.height/100.)));
|
||||
return NSMakeRect(NSMinX(v)+(item==9?8:76)*scale,NSMaxY(v)-61*scale,64*scale,24*scale);
|
||||
}
|
||||
- (void)updateStampAtTime:(CMTime)time{
|
||||
if(!_viewerControls.stampArmed||!CMTIME_IS_NUMERIC(time)||!CMTIME_IS_NUMERIC(_stampTime)||CMTimeCompare(_stampTime,time)!=0){
|
||||
_stampHasSource=_stampDragging=NO;_stampTime=time;
|
||||
}
|
||||
}
|
||||
- (NSRect)stampControlRect:(NSInteger)index{
|
||||
NSRect viewport=NSIntersectionRect(_imageRect,NSMakeRect(0,0,_canvasWidth,_height));
|
||||
CGFloat scale=MIN(_uiScale,viewport.size.width/360.);
|
||||
return NSMakeRect(NSMinX(viewport)+(8+82*index)*scale,NSMaxY(viewport)-62*scale,78*scale,25*scale);
|
||||
}
|
||||
- (NSRect)stampTarget{
|
||||
return NSMakeRect(MIN(_stampStart.x,_stampEnd.x),MIN(_stampStart.y,_stampEnd.y),fabs(_stampStart.x-_stampEnd.x),fabs(_stampStart.y-_stampEnd.y));
|
||||
}
|
||||
- (NSPoint)canvasStampSource:(NSPoint)source{
|
||||
return NSMakePoint(NSMinX(_imageRect)+source.x*NSWidth(_imageRect),NSMinY(_imageRect)+source.y*NSHeight(_imageRect));
|
||||
}
|
||||
- (void)drawStampSource:(NSPoint)source{
|
||||
NSPoint p=[self canvasStampSource:source];
|
||||
CGFloat r=8*_uiScale;
|
||||
NSBezierPath *mark=[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(p.x-r,p.y-r,2*r,2*r)];
|
||||
[mark moveToPoint:NSMakePoint(p.x-r,p.y)];[mark lineToPoint:NSMakePoint(p.x+r,p.y)];
|
||||
[mark moveToPoint:NSMakePoint(p.x,p.y-r)];[mark lineToPoint:NSMakePoint(p.x,p.y+r)];
|
||||
[NSColor.blackColor setStroke];mark.lineWidth=3.5*_uiScale;[mark stroke];
|
||||
[NSColor.systemCyanColor setStroke];mark.lineWidth=1.5*_uiScale;[mark stroke];
|
||||
}
|
||||
- (void)drawStampControls{
|
||||
NSArray *source=_mask[@"stampSource"];
|
||||
if(_viewerControls.stampArmed){
|
||||
NSRect cell=NSUnionRect([self stampControlRect:0],[self stampControlRect:3]);
|
||||
DYDrawSoftControl(cell,4,NO,NO,NO);
|
||||
NSString *prompt=_stampHasSource?@"拖出要覆盖的椭圆 · Esc 取消":@"点击画面选择取样中心 · Esc 取消";
|
||||
[prompt drawInRect:NSInsetRect(cell,6,4) withAttributes:@{NSForegroundColorAttributeName:NSColor.whiteColor,NSFontAttributeName:[NSFont systemFontOfSize:MAX(8.,NSHeight(cell)*.48)]}];
|
||||
if(_stampHasSource)[self drawStampSource:_stampSource];
|
||||
if(_stampDragging){
|
||||
NSRect target=[self stampTarget];
|
||||
NSRect oval=NSMakeRect(NSMinX(_imageRect)+target.origin.x*NSWidth(_imageRect),NSMinY(_imageRect)+target.origin.y*NSHeight(_imageRect),target.size.width*NSWidth(_imageRect),target.size.height*NSHeight(_imageRect));
|
||||
NSBezierPath *outline=[NSBezierPath bezierPathWithOvalInRect:oval];outline.lineWidth=2*_uiScale;[NSColor.systemCyanColor setStroke];[outline stroke];
|
||||
}
|
||||
}else if(source.count==4){
|
||||
[self drawStampSource:NSMakePoint([source[0]doubleValue],[source[1]doubleValue])];
|
||||
BOOL tracking=[_mask[@"tracking"]boolValue];
|
||||
NSArray *titles=tracking?@[@"停止跟踪"]:@[@"向后跟踪",@"双向跟踪",@"向前跟踪"];
|
||||
for(NSUInteger i=0;i<titles.count;i++){
|
||||
NSRect cell=[self stampControlRect:i];DYDrawSoftControl(cell,4,NO,NO,NO);
|
||||
[titles[i] drawInRect:NSInsetRect(cell,6,4) withAttributes:@{NSForegroundColorAttributeName:NSColor.whiteColor,NSFontAttributeName:[NSFont systemFontOfSize:MAX(8.,NSHeight(cell)*.48)]}];
|
||||
}
|
||||
}
|
||||
}
|
||||
- (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];
|
||||
@@ -28,7 +79,14 @@
|
||||
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;
|
||||
[_viewerControls setBridge:[plugin viewerParameterBridge]];[_viewerControls setViewport:_imageRect];[_viewerControls prepareWithSize:NSMakeSize(canvasWidth,_height) scale:_uiScale atTime:time];
|
||||
if(plugin&&canvasWidth>0&&_height>0&&canvasWidth<16384&&_height<16384&&_imageRect.size.width>0&&_imageRect.size.height>0){
|
||||
NSBitmapImageRep *bitmap=[[[NSBitmapImageRep alloc]initWithBitmapDataPlanes:NULL pixelsWide:(NSInteger)canvasWidth pixelsHigh:(NSInteger)_height bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:(NSInteger)canvasWidth*4 bitsPerPixel:32]autorelease];memset(bitmap.bitmapData,0,bitmap.bytesPerRow*bitmap.pixelsHigh);[NSGraphicsContext saveGraphicsState];[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap]];NSAffineTransform *flip=[NSAffineTransform transform];[flip translateXBy:0 yBy:_height];[flip scaleXBy:1 yBy:-1];[flip concat];
|
||||
[self updateStampAtTime:time];
|
||||
NSRect region=mask||_viewerControls.stampArmed?NSMakeRect(0,0,canvasWidth,_height):NSIntegralRect([_viewerControls drawingBounds]);
|
||||
if(NSIsEmptyRect(region)){[commands commit];[commands waitUntilCompleted];return;}
|
||||
NSBitmapImageRep *bitmap=[[[NSBitmapImageRep alloc]initWithBitmapDataPlanes:NULL pixelsWide:(NSInteger)NSWidth(region) pixelsHigh:(NSInteger)NSHeight(region) bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:(NSInteger)NSWidth(region)*4 bitsPerPixel:32]autorelease];
|
||||
if(!bitmap){[commands commit];[commands waitUntilCompleted];return;}
|
||||
memset(bitmap.bitmapData,0,bitmap.bytesPerRow*bitmap.pixelsHigh);
|
||||
[NSGraphicsContext saveGraphicsState];[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap]];
|
||||
NSAffineTransform *flip=[NSAffineTransform transform];[flip translateXBy:-NSMinX(region) yBy:NSMaxY(region)];[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]];
|
||||
if(mask){BOOL blankShape=[mask[@"drawShape"]boolValue]&&![mask[@"shapeStarted"]boolValue];DYMaskParameters p;[mask[@"parameters"]getBytes:&p length:sizeof(p)];p.imageAspect=_imageRect.size.width/_imageRect.size.height;_outline=[[NSBezierPath bezierPath]retain];
|
||||
@@ -39,21 +97,30 @@
|
||||
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]&&![mask[@"drawShape"]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];}
|
||||
if(p.kind<4&&![mask[@"drawing"]boolValue]&&![mask[@"drawShape"]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];}if(![mask[@"stampSource"]count])[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];}
|
||||
if([mask[@"drawing"]boolValue]){
|
||||
NSShadow *shadow=[[[NSShadow alloc]init]autorelease];shadow.shadowColor=[NSColor colorWithWhite:0 alpha:.95];shadow.shadowBlurRadius=2;shadow.shadowOffset=NSZeroSize;
|
||||
NSMutableParagraphStyle *style=[[[NSMutableParagraphStyle alloc]init]autorelease];style.alignment=NSTextAlignmentCenter;
|
||||
for(NSInteger item=9;item<=10;item++){NSString *title=item==9?@"✓ 完成":@"取消";NSRect cell=[self toolbarRectForItem:item];CGFloat size=cell.size.height*.48;[title drawInRect:NSInsetRect(cell,0,MAX(0.,(cell.size.height-size-3)/2))withAttributes:@{NSFontAttributeName:[NSFont systemFontOfSize:size weight:NSFontWeightMedium],NSForegroundColorAttributeName:NSColor.whiteColor,NSShadowAttributeName:shadow,NSParagraphStyleAttributeName:style}];}
|
||||
}
|
||||
}[_viewerControls draw];
|
||||
[NSGraphicsContext restoreGraphicsState];CIImage *overlay=[CIImage imageWithCGImage:bitmap.CGImage options:@{kCIImageColorSpace:NSNull.null}];overlay=[overlay imageByApplyingTransform:CGAffineTransformMakeTranslation(0,texture.height-_height)];[_context render:overlay toMTLTexture:texture commandBuffer:commands bounds:CGRectMake(0,0,texture.width,texture.height) colorSpace:nil];
|
||||
}[self drawStampControls];[_viewerControls draw];
|
||||
[NSGraphicsContext restoreGraphicsState];CIImage *overlay=[CIImage imageWithCGImage:bitmap.CGImage options:@{kCIImageColorSpace:NSNull.null}];overlay=[overlay imageByApplyingTransform:CGAffineTransformMakeTranslation(NSMinX(region),texture.height-NSMaxY(region))];[_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 {
|
||||
BOOL drawing=[_mask[@"drawing"]boolValue];
|
||||
if(drawing)for(NSInteger i=9;i<=10;i++)if(NSPointInRect(point,[self toolbarRectForItem:i]))return 10000+i;
|
||||
NSInteger viewerHit=[_viewerControls partAtPoint:point];if(viewerHit)return viewerHit;
|
||||
if(_viewerControls.stampArmed)return NSPointInRect(point,_imageRect)?10014:0;
|
||||
NSArray *source=_mask[@"stampSource"];
|
||||
if(source.count==4){
|
||||
BOOL tracking=[_mask[@"tracking"]boolValue];
|
||||
NSInteger count=tracking?1:3;
|
||||
for(NSInteger i=0;i<count;i++)if(NSPointInRect(point,[self stampControlRect:i]))return 10011+i;
|
||||
NSPoint cross=[self canvasStampSource:NSMakePoint([source[0]doubleValue],[source[1]doubleValue])];
|
||||
if(!tracking&&NSPointInRect(point,_imageRect)&&hypot(cross.x-point.x,cross.y-point.y)<=12*_uiScale)return DYCloneSourcePart;
|
||||
}
|
||||
if(!_mask)return 0;if([_mask[@"drawShape"]boolValue])return NSPointInRect(point,_imageRect)?1:0;
|
||||
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;}
|
||||
@@ -64,6 +131,32 @@
|
||||
- (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);[_viewerControls setBridge:[plugin viewerParameterBridge]];[_viewerControls setViewport:_imageRect];[_viewerControls prepareWithSize:NSMakeSize(_canvasWidth,_height) scale:_uiScale atTime:time];NSPoint canvasPoint=NSMakePoint(x,_height-y);
|
||||
if(_maskCapturing&&plugin!=_maskCaptureOwner){_maskCapturing=NO;_maskCaptureOwner=nil;return NO;}
|
||||
[self updateStampAtTime:time];
|
||||
if(type==NSEventTypeKeyDown&&key==27&&_viewerControls.stampArmed){
|
||||
_viewerControls.stampArmed=NO;[self updateStampAtTime:time];return YES;
|
||||
}
|
||||
if(type==NSEventTypeLeftMouseDown&&part>=10011&&part<=10013){
|
||||
NSInteger direction=[_mask[@"tracking"]boolValue]?9:part-10012;
|
||||
[plugin trackCloneStamp:_mask[@"id"] direction:direction];return YES;
|
||||
}
|
||||
if(plugin&&_viewerControls.stampArmed&&NSWidth(_imageRect)>0&&NSHeight(_imageRect)>0){
|
||||
NSPoint uv=NSMakePoint(fmax(0,fmin(1,(x-NSMinX(_imageRect))/NSWidth(_imageRect))),fmax(0,fmin(1,(canvasPoint.y-NSMinY(_imageRect))/NSHeight(_imageRect))));
|
||||
if(type==NSEventTypeLeftMouseDown&&part==10014){
|
||||
if(!_stampHasSource){_stampSource=uv;_stampHasSource=YES;}
|
||||
else {_stampStart=_stampEnd=uv;_stampDragging=YES;}
|
||||
return YES;
|
||||
}
|
||||
if(_stampDragging&&(type==NSEventTypeLeftMouseDragged||type==NSEventTypeLeftMouseUp)){
|
||||
_stampEnd=uv;
|
||||
if(type==NSEventTypeLeftMouseUp){
|
||||
NSRect target=[self stampTarget];_stampDragging=NO;
|
||||
if(NSWidth(target)>=.001&&NSHeight(target)>=.001&&NSWidth(target)*NSWidth(_imageRect)>=3*_uiScale&&NSHeight(target)*NSHeight(_imageRect)>=3*_uiScale){
|
||||
[plugin addCloneStampFrom:_stampSource target:target atTime:time];_viewerControls.stampArmed=NO;[self updateStampAtTime:time];
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
BOOL ownedMask=_maskCapturing&&(type==NSEventTypeLeftMouseDragged||type==NSEventTypeLeftMouseUp);
|
||||
if(type==NSEventTypeKeyDown&&key==27&&[_viewerControls capturing])return [_viewerControls finishCapture];
|
||||
BOOL penAction=type==NSEventTypeLeftMouseDown&&(part==10009||part==10010);
|
||||
@@ -78,7 +171,7 @@
|
||||
- (void)mouseUpAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{BOOL result=[self event:NSEventTypeLeftMouseUp x:x y:y part:part modifiers:m key:0 time:t];if(update)*update=result;}
|
||||
- (void)keyDownAtPositionX:(double)x positionY:(double)y keyPressed:(unsigned short)key modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update didHandle:(BOOL*)handled atTime:(CMTime)t{BOOL result=(key==27||key==13||key==10||key==3||key==8||key==127)&&[self event:NSEventTypeKeyDown x:x y:y part:1 modifiers:m key:key time:t];if(update)*update=result;if(handled)*handled=result;}
|
||||
- (void)mouseMovedAtPositionX:(double)x positionY:(double)y activePart:(NSInteger)part modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{@synchronized(self){
|
||||
DYPlugIn*plugin=[self pluginAtTime:t];[_viewerControls setBridge:[plugin viewerParameterBridge]];[_viewerControls setViewport:_imageRect];[_viewerControls prepareWithSize:NSMakeSize(_canvasWidth,_height) scale:_uiScale atTime:t];NSPoint point=NSMakePoint(x,_height-y);NSInteger viewerHit=[_viewerControls partAtPoint:point];BOOL redraw=[_viewerControls mouseMoved:point];NSDictionary *mask=[plugin toolCanvasMaskAtTime:t];BOOL drawing=[mask[@"drawing"]boolValue]||[mask[@"drawShape"]boolValue];NSCursor *cursor=[_viewerControls headerAtPoint:point]?([_viewerControls capturing]?NSCursor.closedHandCursor:NSCursor.openHandCursor):viewerHit?NSCursor.pointingHandCursor:part>=10000?NSCursor.pointingHandCursor:(drawing||part>=1000)?NSCursor.crosshairCursor:part?NSCursor.openHandCursor:NSCursor.arrowCursor;[[_apiManager apiForProtocol:@protocol(FxOnScreenControlAPI_v4)]setCursor:cursor];if(drawing&&!viewerHit)[self event:NSEventTypeMouseMoved x:x y:y part:part modifiers:m key:0 time:t];if(update)*update=redraw||drawing;
|
||||
DYPlugIn*plugin=[self pluginAtTime:t];[_viewerControls setBridge:[plugin viewerParameterBridge]];[_viewerControls setViewport:_imageRect];[_viewerControls prepareWithSize:NSMakeSize(_canvasWidth,_height) scale:_uiScale atTime:t];NSPoint point=NSMakePoint(x,_height-y);NSInteger viewerHit=[_viewerControls partAtPoint:point];BOOL redraw=[_viewerControls mouseMoved:point];NSDictionary *mask=[plugin toolCanvasMaskAtTime:t];BOOL drawing=[mask[@"drawing"]boolValue]||[mask[@"drawShape"]boolValue];NSCursor *cursor=[_viewerControls headerAtPoint:point]?([_viewerControls capturing]?NSCursor.closedHandCursor:NSCursor.openHandCursor):viewerHit?NSCursor.pointingHandCursor:part==10014?NSCursor.crosshairCursor:part>=10000?NSCursor.pointingHandCursor:(drawing||part>=1000)?NSCursor.crosshairCursor:part?NSCursor.openHandCursor:NSCursor.arrowCursor;[[_apiManager apiForProtocol:@protocol(FxOnScreenControlAPI_v4)]setCursor:cursor];if([mask[@"drawing"]boolValue]&&!viewerHit)[self event:NSEventTypeMouseMoved x:x y:y part:part modifiers:m key:0 time:t];if(update)*update=redraw||[mask[@"drawing"]boolValue];
|
||||
}}
|
||||
- (void)mouseEnteredAtPositionX:(double)x positionY:(double)y modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{[self mouseMovedAtPositionX:x positionY:y activePart:0 modifiers:m forceUpdate:update atTime:t];}
|
||||
- (void)mouseExitedAtPositionX:(double)x positionY:(double)y modifiers:(FxModifierKeys)m forceUpdate:(BOOL*)update atTime:(CMTime)t{@synchronized(self){BOOL changed=[_viewerControls mouseExited];if(update)*update=changed;}}
|
||||
|
||||
@@ -101,6 +101,7 @@
|
||||
});}}
|
||||
- (BOOL)exportLUT:(NSURL*)url uniforms:(DYUniforms)u paths:(NSDictionary*)paths spider:(NSData*)spider tools:(NSDictionary*)tools error:(NSError**)error {@synchronized(self){
|
||||
if(tools&&!DYValidToolDocument(tools))return fail(error,@"工具或蒙版数据损坏,未更改原工程");DYApplyRemovedBaseTools(&u,tools);paths=DYVisibleBaseToolPaths(paths,tools);if(DYBaseToolRemoved(tools,@"spider"))spider=nil;
|
||||
for(NSDictionary *mask in DYSharedMasks(tools))if(mask[@"stampSource"]&&[mask[@"enabled"]boolValue])return fail(error,@"仿制图章属于空间处理,请保存完整预设。");
|
||||
if((u.lensSectionEnabled>.5&&(u.lensStrength!=0||u.lensScale!=1))||(u.skinProtection.x>.5&&u.skinVisualize>.5))return fail(error,@"镜头修复与肤色区域显示无法保存到 Cube,请保存完整预设。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"lens"]&&!DYToolIsNeutral(node))return fail(error,@"镜头畸变属于空间处理,请保存完整预设。");}
|
||||
DYUniforms effective=u;if(![paths[@"input"]length]&&effective.inputProfile==0)effective.preLUTStrength=0;if(![paths[@"look0"]length])effective.postLUTStrength=0;for(int i=0;i<4;i++)if(![paths[[NSString stringWithFormat:@"look%d",i+1]]length])effective.extraPostLUTStrengths[i]=0;bypassNeutralTools(&effective);bypassIdleSkin(&effective);if(effective.skinFaceOnly>.5&&effective.skinProtection.x>.5&&effective.skinProtection.y>0)return fail(error,@"人脸限定肤色保护属于空间选区,Cube 无法保存。请保存完整预设,或关闭人脸限定后导出。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"skin"]&&layer.skinProtection.x>.5&&layer.skinProtection.y>0&&(layer.skinFaceOnly>.5||layer.skinVisualize>.5))return fail(error,@"新增肤色层含人脸空间选区,请保存完整预设。");}
|
||||
if(DYFilmToolActive(u)&&DYFilmSpatialActive(u.film))return fail(error,@"当前胶片含晕光、辉光、颗粒或暗角,无法完整保存到静态 Cube。请保存完整预设,或关闭这些处理后再导出。");for(NSDictionary *node in tools[@"layers"]){DYUniforms layer=DYToolUniforms(node);if([node[@"type"]isEqual:@"film"]&&DYFilmToolActive(layer)&&DYFilmSpatialActive(layer.film))return fail(error,@"新增胶片层含空间或时间处理,无法完整保存到静态 Cube。请保存完整预设。");}
|
||||
|
||||
+49
-24
@@ -56,7 +56,10 @@ BOOL DYResetToolParameters(id<PROAPIAccessing> host,NSArray<NSDictionary *> *row
|
||||
for(NSDictionary *d in rows)if(![set setFloatValue:[d[@"default"]doubleValue] toParameter:[d[@"pid"]unsignedIntValue] atTime:time]){if(error)*error=[NSError errorWithDomain:@"com.dayu.color.ToolReset" code:1 userInfo:@{NSLocalizedDescriptionKey:[NSString stringWithFormat:@"未能还原“%@”,模块已保留。",d[@"title"]?:d[@"key"]]}];return NO;}
|
||||
return YES;
|
||||
}
|
||||
NSMutableDictionary *DYMutablePlist(NSDictionary *value){if(!value)return [NSMutableDictionary dictionary];NSData *data=[NSPropertyListSerialization dataWithPropertyList:value format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil];return [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListMutableContainersAndLeaves format:NULL error:nil];}
|
||||
NSMutableDictionary *DYMutablePlist(NSDictionary *value){
|
||||
if(!value)return [NSMutableDictionary dictionary];
|
||||
return [(NSMutableDictionary*)CFPropertyListCreateDeepCopy(kCFAllocatorDefault,(CFPropertyListRef)value,kCFPropertyListMutableContainersAndLeaves) autorelease];
|
||||
}
|
||||
static NSDictionary *DYEmptyTools(){return @{@"schema":@1,@"layers":@[],@"baseMasks":@{}};}
|
||||
static BOOL finiteNumber(id v){return [v isKindOfClass:NSNumber.class]&&std::isfinite([v doubleValue]);}
|
||||
static BOOL validID(id v){return [v isKindOfClass:NSString.class]&&[[[NSUUID alloc]initWithUUIDString:v]autorelease]!=nil;}
|
||||
@@ -68,45 +71,52 @@ NSDictionary *DYNewTool(NSString *type){if(![DYToolTypes()containsObject:type])r
|
||||
BOOL DYValidToolMask(NSDictionary *mask){
|
||||
if(![mask isKindOfClass:NSDictionary.class]||!validID(mask[@"id"])||!finiteNumber(mask[@"enabled"])||!finiteNumber(mask[@"combine"])||[mask[@"combine"]integerValue]<0||[mask[@"combine"]integerValue]>2)return NO;
|
||||
DYMaskParameters p;if(!readParameters(mask[@"parameters"],&p))return NO;NSData *nodes=mask[@"nodes"];if(![nodes isKindOfClass:NSData.class]||nodes.length%sizeof(DYBezierNode)||nodes.length>32*sizeof(DYBezierNode))return NO;
|
||||
id source=mask[@"stampSource"];
|
||||
if(source){
|
||||
if(p.kind!=DYMaskEllipse||![source isKindOfClass:NSArray.class]||[source count]!=4)return NO;
|
||||
for(NSUInteger i=0;i<4;i++)if(!finiteNumber(source[i])||[source[i] doubleValue]<(i<2?0:.001)||[source[i] doubleValue]>1)return NO;
|
||||
}
|
||||
const float *n=(const float*)nodes.bytes;for(NSUInteger i=0;i<nodes.length/4;i++)if(!std::isfinite(n[i])||fabs(n[i])>1000)return NO;
|
||||
NSArray *keys=mask[@"keys"];if(![keys isKindOfClass:NSArray.class]||keys.count>DYToolKeyLimit)return NO;CMTime last=kCMTimeInvalid;
|
||||
for(NSDictionary *k in keys){if(![k isKindOfClass:NSDictionary.class]||!finiteNumber(k[@"value"])||!finiteNumber(k[@"scale"])||!finiteNumber(k[@"epoch"])||!finiteNumber(k[@"manual"])||!finiteNumber(k[@"confidence"])||[k[@"confidence"]doubleValue]<0||[k[@"confidence"]doubleValue]>1)return NO;CMTime t=keyTime(k);DYMaskParameters q;if(!CMTIME_IS_NUMERIC(t)||!readParameters(k[@"parameters"],&q)||q.kind!=p.kind||(CMTIME_IS_NUMERIC(last)&&(last.epoch!=t.epoch||CMTimeCompare(last,t)>=0)))return NO;last=t;}return YES;
|
||||
}
|
||||
static BOOL validMasks(id masks,NSMutableSet *ids,NSSet *sharedIDs,BOOL references){
|
||||
if(![masks isKindOfClass:NSArray.class]||[masks count]>DYToolMaskLimit)return NO;NSMutableSet *links=[NSMutableSet set];
|
||||
for(NSDictionary *m in masks){if(![m isKindOfClass:NSDictionary.class])return NO;id shared=m[@"sharedID"];if(shared){if(!references||m.count!=1||![sharedIDs containsObject:shared]||[links containsObject:shared])return NO;[links addObject:shared];continue;}if(!DYValidToolMask(m)||[ids containsObject:m[@"id"]])return NO;[ids addObject:m[@"id"]];}return YES;
|
||||
for(NSDictionary *m in masks){if(![m isKindOfClass:NSDictionary.class])return NO;id shared=m[@"sharedID"];if(shared){if(!references||m.count!=1||![sharedIDs containsObject:shared]||[links containsObject:shared])return NO;[links addObject:shared];continue;}if(!DYValidToolMask(m)||m[@"stampSource"]||[ids containsObject:m[@"id"]])return NO;[ids addObject:m[@"id"]];}return YES;
|
||||
}
|
||||
BOOL DYValidToolDocument(NSDictionary *doc){
|
||||
if(![NSPropertyListSerialization propertyList:doc isValidForFormat:NSPropertyListBinaryFormat_v1_0])return NO;
|
||||
if(![doc isKindOfClass:NSDictionary.class]||(![doc[@"schema"]isEqual:@1]&&![doc[@"schema"]isEqual:@2]&&![doc[@"schema"]isEqual:@3])||![doc[@"layers"]isKindOfClass:NSArray.class]||[doc[@"layers"]count]>DYToolLimit||![doc[@"baseMasks"]isKindOfClass:NSDictionary.class]||[doc[@"baseMasks"]count]>DYToolTypes().count)return NO;
|
||||
BOOL references=[doc[@"schema"]isEqual:@3];id shared=doc[@"sharedMasks"];NSMutableSet *sharedIDs=[NSMutableSet set],*ids=[NSMutableSet set];if(shared){if(!references||![shared isKindOfClass:NSArray.class]||[shared count]>DYSharedMaskLimit)return NO;for(NSDictionary *mask in shared){if(!DYValidToolMask(mask)||[ids containsObject:mask[@"id"]]||mask[@"sharedID"])return NO;[ids addObject:mask[@"id"]];[sharedIDs addObject:mask[@"id"]];}}
|
||||
id removed=doc[@"removedBase"];if(removed){if(![removed isKindOfClass:NSArray.class]||[removed count]>DYToolTypes().count)return NO;NSMutableSet *unique=[NSMutableSet set];for(id type in removed){if(![type isKindOfClass:NSString.class]||![DYToolTypes()containsObject:type]||[unique containsObject:type]||[doc[@"baseMasks"][type]count])return NO;[unique addObject:type];}}
|
||||
for(NSString *key in doc[@"baseMasks"]){if(![DYToolTypes()containsObject:key]||!validMasks(doc[@"baseMasks"][key],ids,sharedIDs,references))return NO;}
|
||||
static NSData *DYValidatedToolData(NSDictionary *doc){
|
||||
if(![NSPropertyListSerialization propertyList:doc isValidForFormat:NSPropertyListBinaryFormat_v1_0])return nil;
|
||||
if(![doc isKindOfClass:NSDictionary.class]||(![doc[@"schema"]isEqual:@1]&&![doc[@"schema"]isEqual:@2]&&![doc[@"schema"]isEqual:@3])||![doc[@"layers"]isKindOfClass:NSArray.class]||[doc[@"layers"]count]>DYToolLimit||![doc[@"baseMasks"]isKindOfClass:NSDictionary.class]||[doc[@"baseMasks"]count]>DYToolTypes().count)return nil;
|
||||
BOOL references=[doc[@"schema"]isEqual:@3];id shared=doc[@"sharedMasks"];NSMutableSet *sharedIDs=[NSMutableSet set],*ids=[NSMutableSet set];if(shared){if(!references||![shared isKindOfClass:NSArray.class]||[shared count]>DYSharedMaskLimit)return nil;for(NSDictionary *mask in shared){if(!DYValidToolMask(mask)||[ids containsObject:mask[@"id"]]||mask[@"sharedID"])return nil;[ids addObject:mask[@"id"]];if(!mask[@"stampSource"])[sharedIDs addObject:mask[@"id"]];}}
|
||||
id removed=doc[@"removedBase"];if(removed){if(![removed isKindOfClass:NSArray.class]||[removed count]>DYToolTypes().count)return nil;NSMutableSet *unique=[NSMutableSet set];for(id type in removed){if(![type isKindOfClass:NSString.class]||![DYToolTypes()containsObject:type]||[unique containsObject:type]||[doc[@"baseMasks"][type]count])return nil;[unique addObject:type];}}
|
||||
for(NSString *key in doc[@"baseMasks"]){if(![DYToolTypes()containsObject:key]||!validMasks(doc[@"baseMasks"][key],ids,sharedIDs,references))return nil;}
|
||||
NSMutableDictionary *descriptors=[NSMutableDictionary dictionary];for(NSDictionary *d in DYDescriptors())descriptors[d[@"key"]]=d;
|
||||
for(NSDictionary *node in doc[@"layers"]){if(![node isKindOfClass:NSDictionary.class]||!validID(node[@"id"])||[ids containsObject:node[@"id"]]||![DYToolTypes()containsObject:node[@"type"]]||![node[@"values"]isKindOfClass:NSDictionary.class]||[node[@"values"]count]>descriptors.count||![node[@"paths"]isKindOfClass:NSDictionary.class]||[node[@"paths"]count]>6)return NO;[ids addObject:node[@"id"]];if(!validMasks(node[@"masks"],ids,sharedIDs,references))return NO;
|
||||
if(node[@"primaryFollow"]&&(![node[@"type"]isEqual:@"primary"]||!finiteNumber(node[@"primaryFollow"])||[node[@"primaryFollow"]doubleValue]!=floor([node[@"primaryFollow"]doubleValue])||[node[@"primaryFollow"]integerValue]<0||[node[@"primaryFollow"]integerValue]>7))return NO;
|
||||
for(NSString *key in node[@"values"]){NSDictionary *d=descriptors[key];id v=node[@"values"][key];if(!d||!finiteNumber(v)||[v doubleValue]<[d[@"min"]doubleValue]||[v doubleValue]>[d[@"max"]doubleValue]||(d[@"values"]&&![d[@"values"]containsObject:@((int)llround([v doubleValue]))]))return NO;}
|
||||
for(id key in node[@"paths"]){id p=node[@"paths"][key];if(![@[@"input",@"look0",@"look1",@"look2",@"look3",@"look4"]containsObject:key]||![p isKindOfClass:NSString.class]||[p length]>8192||![p isAbsolutePath]||![[p pathExtension].lowercaseString isEqual:@"cube"])return NO;}if(node[@"spider"]&&(![node[@"spider"]isKindOfClass:NSData.class]||!DYSpiderMeshIsValid(node[@"spider"])))return NO;
|
||||
for(NSDictionary *node in doc[@"layers"]){if(![node isKindOfClass:NSDictionary.class]||!validID(node[@"id"])||[ids containsObject:node[@"id"]]||![DYToolTypes()containsObject:node[@"type"]]||![node[@"values"]isKindOfClass:NSDictionary.class]||[node[@"values"]count]>descriptors.count||![node[@"paths"]isKindOfClass:NSDictionary.class]||[node[@"paths"]count]>6)return nil;[ids addObject:node[@"id"]];if(!validMasks(node[@"masks"],ids,sharedIDs,references))return nil;
|
||||
if(node[@"primaryFollow"]&&(![node[@"type"]isEqual:@"primary"]||!finiteNumber(node[@"primaryFollow"])||[node[@"primaryFollow"]doubleValue]!=floor([node[@"primaryFollow"]doubleValue])||[node[@"primaryFollow"]integerValue]<0||[node[@"primaryFollow"]integerValue]>7))return nil;
|
||||
for(NSString *key in node[@"values"]){NSDictionary *d=descriptors[key];id v=node[@"values"][key];if(!d||!finiteNumber(v)||[v doubleValue]<[d[@"min"]doubleValue]||[v doubleValue]>[d[@"max"]doubleValue]||(d[@"values"]&&![d[@"values"]containsObject:@((int)llround([v doubleValue]))]))return nil;}
|
||||
for(id key in node[@"paths"]){id p=node[@"paths"][key];if(![@[@"input",@"look0",@"look1",@"look2",@"look3",@"look4"]containsObject:key]||![p isKindOfClass:NSString.class]||[p length]>8192||![p isAbsolutePath]||![[p pathExtension].lowercaseString isEqual:@"cube"])return nil;}if(node[@"spider"]&&(![node[@"spider"]isKindOfClass:NSData.class]||!DYSpiderMeshIsValid(node[@"spider"])))return nil;
|
||||
}
|
||||
// Anchors are stable identities, never an array index or a translated title.
|
||||
// Reject unknown anchors/cycles so layout, rendering and undo share one order.
|
||||
for(NSDictionary *node in doc[@"layers"]){id after=node[@"after"];if(!after)continue;if([doc[@"schema"]isEqual:@1]||![after isKindOfClass:NSString.class])return NO;NSMutableSet *seen=[NSMutableSet setWithObject:node[@"id"]];while(after){if([after hasPrefix:@"base:"]){if(![DYToolTypes()containsObject:[after substringFromIndex:5]])return NO;break;}if([seen containsObject:after])return NO;[seen addObject:after];NSDictionary *parent=DYToolWithID(doc,after);if(!parent)return NO;after=parent[@"after"];}}
|
||||
NSUInteger totalKeys=0;for(NSDictionary *mask in shared)totalKeys+=[mask[@"keys"]count];for(NSArray *masks in [doc[@"baseMasks"]allValues])for(NSDictionary *mask in masks)totalKeys+=[mask[@"keys"]count];for(NSDictionary *node in doc[@"layers"])for(NSDictionary *mask in node[@"masks"])totalKeys+=[mask[@"keys"]count];if(totalKeys>65536)return NO;NSData *bounded=[NSPropertyListSerialization dataWithPropertyList:doc format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil];return bounded&&bounded.length<=24*1024*1024;
|
||||
for(NSDictionary *node in doc[@"layers"]){id after=node[@"after"];if(!after)continue;if([doc[@"schema"]isEqual:@1]||![after isKindOfClass:NSString.class])return nil;NSMutableSet *seen=[NSMutableSet setWithObject:node[@"id"]];while(after){if([after hasPrefix:@"base:"]){if(![DYToolTypes()containsObject:[after substringFromIndex:5]])return nil;break;}if([seen containsObject:after])return nil;[seen addObject:after];NSDictionary *parent=DYToolWithID(doc,after);if(!parent)return nil;after=parent[@"after"];}}
|
||||
NSUInteger totalKeys=0;for(NSDictionary *mask in shared)totalKeys+=[mask[@"keys"]count];for(NSArray *masks in [doc[@"baseMasks"]allValues])for(NSDictionary *mask in masks)totalKeys+=[mask[@"keys"]count];for(NSDictionary *node in doc[@"layers"])for(NSDictionary *mask in node[@"masks"])totalKeys+=[mask[@"keys"]count];if(totalKeys>65536)return nil;NSData *bounded=[NSPropertyListSerialization dataWithPropertyList:doc format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil];return bounded.length<=24*1024*1024?bounded:nil;
|
||||
}
|
||||
BOOL DYValidToolDocument(NSDictionary *doc){return DYValidatedToolData(doc)!=nil;}
|
||||
@implementation DYToolDocument
|
||||
+ (BOOL)supportsSecureCoding{return YES;}
|
||||
- (instancetype)init{if((self=[super init]))_document=[DYEmptyTools()copy];return self;}
|
||||
- (void)dealloc{[_document release];[super dealloc];}
|
||||
- (void)setDocument:(NSDictionary *)d{if(!DYValidToolDocument(d))return;NSData *b=[NSPropertyListSerialization dataWithPropertyList:d format:NSPropertyListBinaryFormat_v1_0 options:0 error:nil];NSDictionary *immutable=[NSPropertyListSerialization propertyListWithData:b options:NSPropertyListImmutable format:NULL error:nil];[_document release];_document=[immutable retain];}
|
||||
- (void)setDocument:(NSDictionary *)d{NSData *b=DYValidatedToolData(d);if(!b)return;NSDictionary *immutable=[NSPropertyListSerialization propertyListWithData:b options:NSPropertyListImmutable format:NULL error:nil];[self setImmutableDocument:immutable];}
|
||||
- (void)setImmutableDocument:(NSDictionary*)document{if(document==_document)return;[document retain];[_document release];_document=document;}
|
||||
- (void)encodeWithCoder:(NSCoder*)c{[c encodeObject:_document forKey:@"document"];}
|
||||
- (instancetype)initWithCoder:(NSCoder*)c{if((self=[self init])){NSDictionary *d=[c decodeObjectOfClasses:[NSSet setWithObjects:NSDictionary.class,NSArray.class,NSString.class,NSNumber.class,NSData.class,nil] forKey:@"document"];if(!DYValidToolDocument(d)){[self release];return nil;}self.document=d;}return self;}
|
||||
- (id)copyWithZone:(NSZone*)zone{DYToolDocument *v=[[[self class]allocWithZone:zone]init];v.document=_document;return v;}
|
||||
- (instancetype)initWithCoder:(NSCoder*)c{if((self=[self init])){NSDictionary *d=[c decodeObjectOfClasses:[NSSet setWithObjects:NSDictionary.class,NSArray.class,NSString.class,NSNumber.class,NSData.class,nil] forKey:@"document"];NSData *data=DYValidatedToolData(d);if(!data){[self release];return nil;}[self setImmutableDocument:[NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:NULL error:nil]];}return self;}
|
||||
- (id)copyWithZone:(NSZone*)zone{DYToolDocument *v=[[[self class]allocWithZone:zone]init];[v setImmutableDocument:_document];return v;}
|
||||
- (BOOL)isEqual:(id)o{return [o isKindOfClass:DYToolDocument.class]&&[_document isEqual:[o document]];}
|
||||
- (NSUInteger)hash{return _document.hash;}
|
||||
- (id)interpolateBetween:(id)other withWeight:(float)weight{return [[self copy]autorelease];}
|
||||
@end
|
||||
DYToolDocument *DYReadTools(id<PROAPIAccessing>m,CMTime t){DYToolDocument *d=nil;[[(id)m apiForProtocol:@protocol(FxParameterRetrievalAPI_v6)]getCustomParameterValue:&d fromParameter:DYToolsParameterID atTime:t];return [d isKindOfClass:DYToolDocument.class]?d:[[[DYToolDocument alloc]init]autorelease];}
|
||||
BOOL DYWriteTools(id<PROAPIAccessing>m,NSDictionary *d,CMTime t){if(!DYValidToolDocument(d))return NO;DYToolDocument *v=[[[DYToolDocument alloc]init]autorelease];v.document=d;return [[m apiForProtocol:@protocol(FxParameterSettingAPI_v6)]setCustomParameterValue:v toParameter:DYToolsParameterID atTime:t];}
|
||||
BOOL DYWriteTools(id<PROAPIAccessing>m,NSDictionary *d,CMTime t){NSData *data=DYValidatedToolData(d);if(!data)return NO;DYToolDocument *v=[[[DYToolDocument alloc]init]autorelease];[v setImmutableDocument:[NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:NULL error:nil]];return [[m apiForProtocol:@protocol(FxParameterSettingAPI_v6)]setCustomParameterValue:v toParameter:DYToolsParameterID atTime:t];}
|
||||
NSDictionary *DYToolWithID(NSDictionary *doc,NSString *ID){for(NSDictionary *n in doc[@"layers"])if([n[@"id"]isEqual:ID])return n;return nil;}
|
||||
static void DYAppendToolChildren(NSDictionary *doc,NSString *parent,NSMutableArray *order,NSMutableSet *seen){for(NSDictionary *node in doc[@"layers"])if([node[@"after"]isEqual:parent]&&![seen containsObject:node[@"id"]]){[seen addObject:node[@"id"]];[order addObject:node[@"id"]];DYAppendToolChildren(doc,node[@"id"],order,seen);}}
|
||||
NSArray *DYToolDisplayOrder(NSDictionary *doc){NSMutableArray *order=[NSMutableArray array];NSMutableSet *seen=[NSMutableSet set];for(NSString *type in DYToolTypes()){NSString *base=[@"base:" stringByAppendingString:type];[order addObject:base];DYAppendToolChildren(doc,base,order,seen);}for(NSDictionary *node in doc[@"layers"])if(!node[@"after"]&&![seen containsObject:node[@"id"]]){[seen addObject:node[@"id"]];[order addObject:node[@"id"]];DYAppendToolChildren(doc,node[@"id"],order,seen);}return order;}
|
||||
@@ -130,7 +140,7 @@ NSDictionary *DYAddSharedMask(NSMutableDictionary *doc,NSInteger kind){
|
||||
if(!DYValidToolDocument(doc)||DYSharedMasks(doc).count>=DYSharedMaskLimit)return nil;NSDictionary *fresh=DYNewMask(kind);if(!fresh)return nil;NSMutableDictionary *mask=DYMutablePlist(fresh);NSMutableArray *shared=[NSMutableArray arrayWithArray:DYSharedMasks(doc)];[shared addObject:mask];doc[@"schema"]=@3;doc[@"sharedMasks"]=shared;return mask;
|
||||
}
|
||||
BOOL DYSetSharedMaskAssigned(NSMutableDictionary *doc,NSString *maskID,NSString *nodeID,BOOL assigned){
|
||||
if(!DYSharedMaskWithID(doc,maskID)||[nodeID isEqual:@"shared"])return NO;if([nodeID hasPrefix:@"base:"]){NSString *type=[nodeID substringFromIndex:5];if(![DYToolTypes()containsObject:type]||DYBaseToolRemoved(doc,type))return NO;}else if(!DYToolWithID(doc,nodeID))return NO;
|
||||
NSDictionary *mask=DYSharedMaskWithID(doc,maskID);if(!mask||mask[@"stampSource"]||[nodeID isEqual:@"shared"])return NO;if([nodeID hasPrefix:@"base:"]){NSString *type=[nodeID substringFromIndex:5];if(![DYToolTypes()containsObject:type]||DYBaseToolRemoved(doc,type))return NO;}else if(!DYToolWithID(doc,nodeID))return NO;
|
||||
NSMutableArray *raw=[NSMutableArray arrayWithArray:DYRawMasksForTool(doc,nodeID)];NSUInteger index=[raw indexOfObjectPassingTest:^BOOL(NSDictionary *entry,NSUInteger i,BOOL *stop){return [entry[@"sharedID"]isEqual:maskID];}];if(assigned){if(index!=NSNotFound)return YES;if(raw.count>=DYToolMaskLimit)return NO;[raw addObject:@{@"sharedID":maskID}];}else if(index!=NSNotFound)[raw removeObjectAtIndex:index];return DYStoreRawMasks(doc,nodeID,raw);
|
||||
}
|
||||
NSArray *DYToolIDsForSharedMask(NSDictionary *doc,NSString *maskID){NSMutableArray *nodes=[NSMutableArray array];for(NSString *ID in DYToolDisplayOrder(doc))for(NSDictionary *entry in DYRawMasksForTool(doc,ID))if([entry[@"sharedID"]isEqual:maskID]){[nodes addObject:ID];break;}return nodes;}
|
||||
@@ -148,15 +158,30 @@ static NSDictionary *DYExpandSharedMasks(NSDictionary *doc,BOOL keepKeys){
|
||||
for(NSString *type in doc[@"baseMasks"])base[type]=resolve([@"base:" stringByAppendingString:type]);out[@"baseMasks"]=base;NSMutableArray *layers=[NSMutableArray array];for(NSDictionary *node in doc[@"layers"]){NSMutableDictionary *copy=[[node mutableCopy]autorelease];copy[@"masks"]=resolve(node[@"id"]);[layers addObject:copy];}out[@"layers"]=layers;out[@"schema"]=@2;[out removeObjectForKey:@"sharedMasks"];return out;
|
||||
}
|
||||
NSDictionary *DYResolvedToolDocument(NSDictionary *doc){return DYExpandSharedMasks(doc,NO);}
|
||||
DYMaskParameters DYMaskAtTime(NSDictionary *mask,CMTime time){DYMaskParameters p=dyDefaultMaskParameters();readParameters(mask[@"parameters"],&p);NSArray *keys=mask[@"keys"];if(!keys.count||!CMTIME_IS_NUMERIC(time))return p;if(keyTime(keys[0]).epoch!=time.epoch)return p;NSUInteger low=0,high=keys.count;while(low<high){NSUInteger mid=low+(high-low)/2;if(CMTimeCompare(keyTime(keys[mid]),time)<0)low=mid+1;else high=mid;}NSDictionary *left=keys[low?low-1:0],*right=keys[MIN(low,keys.count-1)];DYMaskParameters a,b;readParameters(left[@"parameters"],&a);readParameters(right[@"parameters"],&b);double duration=CMTimeGetSeconds(CMTimeSubtract(keyTime(right),keyTime(left)));float w=duration>0?fmax(0,fmin(1,CMTimeGetSeconds(CMTimeSubtract(time,keyTime(left)))/duration)):0;
|
||||
// Only temporal geometry/feather/strength interpolate; key selection and levels stay authored.
|
||||
float *v=&p.centerX,*av=&a.centerX,*bv=&b.centerX;for(int i=0;i<8;i++)v[i]=av[i]+(bv[i]-av[i])*w;return p;}
|
||||
DYMaskParameters DYMaskAtTime(NSDictionary *mask,CMTime time){DYMaskParameters p=dyDefaultMaskParameters();readParameters(mask[@"parameters"],&p);BOOL stamp=mask[@"stampSource"]!=nil;if(stamp)p.angle=0;NSArray *keys=mask[@"keys"];if(!keys.count||!CMTIME_IS_NUMERIC(time))return p;if(keyTime(keys[0]).epoch!=time.epoch)return p;NSUInteger low=0,high=keys.count;while(low<high){NSUInteger mid=low+(high-low)/2;if(CMTimeCompare(keyTime(keys[mid]),time)<0)low=mid+1;else high=mid;}NSDictionary *left=keys[low?low-1:0],*right=keys[MIN(low,keys.count-1)];DYMaskParameters a,b;readParameters(left[@"parameters"],&a);readParameters(right[@"parameters"],&b);double duration=CMTimeGetSeconds(CMTimeSubtract(keyTime(right),keyTime(left)));float w=duration>0?fmax(0,fmin(1,CMTimeGetSeconds(CMTimeSubtract(time,keyTime(left)))/duration)):0;
|
||||
// Clone stamps follow the center only. The authored extent is a coverage control.
|
||||
float *v=&p.centerX,*av=&a.centerX,*bv=&b.centerX;for(int i=0;i<(stamp?2:8);i++)v[i]=av[i]+(bv[i]-av[i])*w;return p;}
|
||||
NSDictionary *DYMaskKey(CMTime t,DYMaskParameters p,BOOL manual,float confidence){return @{@"value":@(t.value),@"scale":@(t.timescale),@"epoch":@(t.epoch),@"parameters":parameterData(p),@"manual":@(manual),@"confidence":@(confidence)};}
|
||||
BOOL DYMergeTracking(NSMutableDictionary *m,NSArray *samples){if(!samples.count)return YES;NSMutableArray *all=[NSMutableArray array];CMTime lo=keyTime(samples.firstObject),hi=keyTime(samples.lastObject);if(CMTimeCompare(lo,hi)>0)std::swap(lo,hi);for(NSDictionary *key in m[@"keys"])if([key[@"manual"]boolValue]||CMTimeCompare(keyTime(key),lo)<0||CMTimeCompare(keyTime(key),hi)>0)[all addObject:key];for(NSDictionary *key in samples){BOOL manual=NO;for(NSDictionary *old in all)if(CMTimeCompare(keyTime(old),keyTime(key))==0){manual=YES;break;}if(!manual)[all addObject:key];}[all sortUsingComparator:^NSComparisonResult(NSDictionary *a,NSDictionary *b){return (NSComparisonResult)CMTimeCompare(keyTime(a),keyTime(b));}];NSMutableDictionary *candidate=DYMutablePlist(m);candidate[@"keys"]=all;if(!DYValidToolMask(candidate))return NO;m[@"keys"]=all;return YES;}
|
||||
NSDictionary *DYToolRenderSnapshot(NSDictionary *doc,CMTime t){
|
||||
NSArray *shared=DYSharedMasks(doc);
|
||||
doc=DYExpandSharedMasks(doc,YES);
|
||||
auto resolve=[&](NSArray *masks){NSMutableArray *result=[NSMutableArray arrayWithCapacity:masks.count];for(NSDictionary *mask in masks){NSMutableDictionary *m=[[mask mutableCopy]autorelease];m[@"parameters"]=parameterData(DYMaskAtTime(mask,t));m[@"keys"]=@[];[result addObject:m];}return result;};
|
||||
NSMutableDictionary *out=[[doc mutableCopy]autorelease],*base=[NSMutableDictionary dictionary];for(NSString *type in doc[@"baseMasks"])base[type]=resolve(doc[@"baseMasks"][type]);out[@"baseMasks"]=base;NSMutableArray *layers=[NSMutableArray array];for(NSDictionary *node in doc[@"layers"]){NSMutableDictionary *layer=[[node mutableCopy]autorelease];layer[@"masks"]=resolve(node[@"masks"]);[layers addObject:layer];}out[@"layers"]=layers;return out;
|
||||
auto resolve=[&](NSArray *masks){
|
||||
NSMutableArray *result=[NSMutableArray arrayWithCapacity:masks.count];
|
||||
for(NSDictionary *mask in masks){
|
||||
if(![mask[@"keys"]count]){[result addObject:mask];continue;}
|
||||
NSMutableDictionary *m=[[mask mutableCopy]autorelease];m[@"parameters"]=parameterData(DYMaskAtTime(mask,t));m[@"keys"]=@[];[result addObject:m];
|
||||
}
|
||||
return result;
|
||||
};
|
||||
NSMutableDictionary *out=[[doc mutableCopy]autorelease],*base=[NSMutableDictionary dictionary];
|
||||
for(NSString *type in doc[@"baseMasks"])base[type]=resolve(doc[@"baseMasks"][type]);out[@"baseMasks"]=base;
|
||||
NSMutableArray *layers=[NSMutableArray array];
|
||||
for(NSDictionary *node in doc[@"layers"]){NSMutableDictionary *layer=[[node mutableCopy]autorelease];layer[@"masks"]=resolve(node[@"masks"]);[layers addObject:layer];}
|
||||
out[@"layers"]=layers;
|
||||
NSMutableArray *stamps=[NSMutableArray array];for(NSDictionary *mask in shared)if(mask[@"stampSource"])[stamps addObject:mask];
|
||||
if(stamps.count){out[@"schema"]=@3;out[@"sharedMasks"]=resolve(stamps);}
|
||||
return out;
|
||||
}
|
||||
DYUniforms DYToolUniforms(NSDictionary *node){DYUniforms u;DYDefaultUniforms(&u);NSString *type=node[@"type"];for(NSDictionary *s in DYSections())for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:s[@"enabled"]])*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])=0;u.primarySectionEnabled=0;u.cm.configured=-1;u.inputProfile=u.preLUTStrength=0;u.skinProtection.x=0;
|
||||
NSArray *parts=[type isEqual:@"primary"]?@[@"input",@"primary",@"output"]:[type isEqual:@"base"]?@[@"base",@"color"]:@[type];for(NSString *part in parts){NSDictionary *s=DYToolSection(part);for(NSDictionary *d in DYDescriptors())if([d[@"pid"]isEqual:s[@"enabled"]])*(float*)((uint8_t*)&u+[d[@"offset"]unsignedIntegerValue])=1;}
|
||||
|
||||
@@ -20,11 +20,29 @@ static void DYDrawDistortionGrid(NSRect rect,NSColor *color){
|
||||
}
|
||||
[color setStroke];[grid stroke];
|
||||
}
|
||||
static void DYDrawCloneStamp(NSRect rect,NSColor *color){
|
||||
CGFloat side=NSWidth(rect),x=NSMinX(rect),y=NSMinY(rect);
|
||||
NSBezierPath *handle=[NSBezierPath bezierPathWithRoundedRect:NSMakeRect(x+side*.31,y+side*.05,side*.38,side*.43) xRadius:side*.16 yRadius:side*.16];
|
||||
NSBezierPath *body=[NSBezierPath bezierPath];
|
||||
[body moveToPoint:NSMakePoint(x+side*.39,y+side*.31)];
|
||||
[body lineToPoint:NSMakePoint(x+side*.61,y+side*.31)];
|
||||
[body lineToPoint:NSMakePoint(x+side*.72,y+side*.55)];
|
||||
[body lineToPoint:NSMakePoint(x+side*.88,y+side*.55)];
|
||||
[body lineToPoint:NSMakePoint(x+side*.91,y+side*.78)];
|
||||
[body lineToPoint:NSMakePoint(x+side*.09,y+side*.78)];
|
||||
[body lineToPoint:NSMakePoint(x+side*.12,y+side*.55)];
|
||||
[body lineToPoint:NSMakePoint(x+side*.28,y+side*.55)];
|
||||
[body closePath];
|
||||
[color setFill];[handle fill];[body fill];
|
||||
[[NSBezierPath bezierPathWithRoundedRect:NSMakeRect(x+side*.10,y+side*.86,side*.80,side*.09) xRadius:side*.045 yRadius:side*.045]fill];
|
||||
}
|
||||
@interface DYViewerControls : NSObject
|
||||
@property(nonatomic,retain) DYViewerParameterBridge *bridge;
|
||||
- (void)setViewport:(NSRect)viewport;
|
||||
- (void)prepareWithSize:(NSSize)size scale:(CGFloat)scale atTime:(CMTime)time;
|
||||
- (void)draw;
|
||||
- (NSRect)drawingBounds;
|
||||
@property(nonatomic) BOOL stampArmed;
|
||||
- (NSInteger)partAtPoint:(NSPoint)point;
|
||||
- (BOOL)event:(NSEventType)type point:(NSPoint)point atTime:(CMTime)time;
|
||||
- (BOOL)mouseMoved:(NSPoint)point;
|
||||
@@ -35,15 +53,15 @@ static void DYDrawDistortionGrid(NSRect rect,NSColor *color){
|
||||
@end
|
||||
@implementation DYViewerControls {
|
||||
DYViewerParameterBridge *_bridge;NSMutableArray *_panels,*_areas;DYViewerParameterPanel *_capture;
|
||||
NSRect _viewport,_rail;NSSize _size;CGFloat _scale;CMTime _time;NSInteger _pressed,_hover,_railPage;BOOL _hasViewport,_pendingSkinPreview;
|
||||
NSRect _viewport,_rail;NSSize _size;CGFloat _scale,_backingScale;CMTime _time;NSInteger _pressed,_hover,_railPage;BOOL _hasViewport,_pendingSkinPreview;
|
||||
}
|
||||
@synthesize bridge=_bridge;
|
||||
- (instancetype)init{if((self=[super init])){_panels=[NSMutableArray new];_areas=[NSMutableArray new];_scale=1;_time=kCMTimeInvalid;}return self;}
|
||||
- (void)dealloc{[self finishCapture];[_bridge release];[_panels release];[_areas release];[super dealloc];}
|
||||
- (void)setBridge:(DYViewerParameterBridge*)bridge{if(bridge==_bridge)return;[self finishCapture];for(DYViewerParameterPanel*p in _panels)p.bridge=nil;[_panels removeAllObjects];[_bridge release];_bridge=[bridge retain];_pendingSkinPreview=NO;}
|
||||
- (void)setBridge:(DYViewerParameterBridge*)bridge{if(bridge==_bridge)return;[self finishCapture];for(DYViewerParameterPanel*p in _panels)p.bridge=nil;[_panels removeAllObjects];[_bridge release];_bridge=[bridge retain];_pendingSkinPreview=NO;_stampArmed=NO;}
|
||||
- (void)setViewport:(NSRect)viewport{_viewport=viewport;_hasViewport=YES;}
|
||||
- (void)prepareWithSize:(NSSize)size scale:(CGFloat)scale atTime:(CMTime)time{
|
||||
_size=size;_time=time;
|
||||
_size=size;_time=time;_backingScale=scale;
|
||||
if(_pendingSkinPreview){NSDictionary *snapshot=[_bridge snapshotAtTime:time];if(snapshot&&[self skinNodeInSnapshot:snapshot]){_pendingSkinPreview=NO;[self toggleSkinPreview];}}
|
||||
NSRect bounds=NSMakeRect(0,0,size.width,size.height),v=_hasViewport?NSIntersectionRect(_viewport,bounds):bounds;_viewport=v;
|
||||
_scale=MAX(.6,MIN(MAX(1.,scale),MIN(v.size.width/420.,v.size.height/350.)));CGFloat s=_scale;
|
||||
@@ -51,10 +69,10 @@ NSRect bounds=NSMakeRect(0,0,size.width,size.height),v=_hasViewport?NSIntersecti
|
||||
if(_capture&&![_capture capturing])_capture=nil;
|
||||
[_areas removeAllObjects];if(!_bridge||v.size.width<100||v.size.height<80)return;
|
||||
// Only tools that benefit from direct image interaction belong on the canvas.
|
||||
NSArray *types=@[@"curve",@"lens",@"skin",@"look",@"whiteBalance"],*titles=@[@"曲线",@"畸变修复",@"肤色",@"LUT",@"白平衡吸管"],*symbols=@[@"point.topleft.down.to.point.bottomright.curvepath",@"pincushion-grid",@"person.crop.circle",@"square.stack.3d.up",@"eyedropper"];
|
||||
CGFloat railScale=MIN(s,v.size.width/440.),y=NSMaxY(v)-33*railScale,w=36*railScale;
|
||||
CGFloat x=NSMaxX(v)-436*railScale;
|
||||
_rail=NSMakeRect(x,y,316*railScale,25*railScale);
|
||||
NSArray *types=@[@"curve",@"lens",@"skin",@"look",@"whiteBalance",@"cloneStamp"],*titles=@[@"曲线",@"畸变修复",@"肤色",@"LUT",@"白平衡吸管",@"仿制图章"],*symbols=@[@"point.topleft.down.to.point.bottomright.curvepath",@"pincushion-grid",@"person.crop.circle",@"square.stack.3d.up",@"eyedropper",@"clone-stamp"];
|
||||
CGFloat railScale=MIN(s,v.size.width/480.),y=NSMaxY(v)-33*railScale,w=36*railScale;
|
||||
CGFloat x=NSMaxX(v)-476*railScale;
|
||||
_rail=NSMakeRect(x,y,356*railScale,25*railScale);
|
||||
for(NSInteger i=0;i<3;i++)[_areas addObject:@{@"part":@(20010+i),@"kind":@"mask",@"index":@([@[@1,@0,@2][i]integerValue]),@"title":@[@"矩形",@"椭圆",@"钢笔"][i],@"symbol":@[@"rectangle",@"circle",@"pencil.tip"][i],@"rect":[NSValue valueWithRect:NSMakeRect(x+i*40*railScale,y,w,25*railScale)]}];
|
||||
for(NSInteger i=0;i<types.count;i++)[_areas addObject:@{@"part":@(20020+i),@"kind":@"tool",@"toolType":types[i],@"title":titles[i],@"symbol":symbols[i],@"rect":[NSValue valueWithRect:NSMakeRect(x+(i+3)*40*railScale,y,w,25*railScale)]}];
|
||||
CGFloat buttonWidth=100*railScale,buttonHeight=27*railScale;
|
||||
@@ -84,9 +102,17 @@ NSRect bounds=NSMakeRect(0,0,size.width,size.height),v=_hasViewport?NSIntersecti
|
||||
DYUniforms u;if([node hasPrefix:@"base:"]){NSData *raw=snapshot[@"uniforms"];if(raw.length!=sizeof(u))return;[raw getBytes:&u length:sizeof(u)];}else u=DYToolUniforms(DYToolWithID(snapshot[@"document"],node));
|
||||
for(NSDictionary *d in DYDescriptors())if([d[@"key"]isEqual:@"skinVisualize"]){[_bridge beginParameter:d node:node value:u.skinVisualize atTime:_time];[_bridge changeValue:u.skinVisualize>.5?0:1];[_bridge endGesture];break;}
|
||||
}
|
||||
- (NSRect)drawingBounds{
|
||||
if(!_areas.count)return NSZeroRect;
|
||||
NSRect rect=_rail;
|
||||
for(NSDictionary *area in _areas)rect=NSUnionRect(rect,[area[@"rect"] rectValue]);
|
||||
for(DYViewerParameterPanel *panel in _panels){NSRect bounds=[panel drawingBounds];if(!NSIsEmptyRect(bounds))rect=NSUnionRect(rect,bounds);}
|
||||
// Tooltips and control shadows extend beyond the buttons.
|
||||
return NSIntersectionRect(_viewport,NSInsetRect(rect,-24*_scale,-32*_scale));
|
||||
}
|
||||
- (void)draw{
|
||||
if(!_areas.count)return;[NSGraphicsContext saveGraphicsState];NSRectClip(_viewport);CGFloat s=_scale;for(DYViewerParameterPanel*p in _panels)[p draw];
|
||||
for(NSDictionary*a in _areas){NSRect r=[a[@"rect"]rectValue];BOOL selected=[a[@"toolType"]isEqual:@"skin"]&&[self skinPreviewEnabled];for(DYViewerParameterPanel*p in _panels)if([p.toolType isEqual:a[@"toolType"]])selected=YES;
|
||||
for(NSDictionary*a in _areas){NSRect r=[a[@"rect"]rectValue];BOOL selected=([a[@"toolType"]isEqual:@"skin"]&&[self skinPreviewEnabled])||([a[@"toolType"]isEqual:@"cloneStamp"]&&_stampArmed);for(DYViewerParameterPanel*p in _panels)if([p.toolType isEqual:a[@"toolType"]])selected=YES;
|
||||
BOOL hover=_hover==[a[@"part"]integerValue];
|
||||
BOOL pressed=_pressed==[a[@"part"]integerValue];DYDrawSoftControl(r,4*s,NO,selected||hover,pressed);
|
||||
if(a[@"symbol"]){
|
||||
@@ -94,6 +120,7 @@ NSRect bounds=NSMakeRect(0,0,size.width,size.height),v=_hasViewport?NSIntersecti
|
||||
CGFloat side=MIN(17*s,r.size.height*.7);
|
||||
NSRect glyph=NSMakeRect(NSMidX(r)-side/2,NSMidY(r)-side/2,side,side);
|
||||
if([a[@"symbol"]isEqual:@"pincushion-grid"])DYDrawDistortionGrid(NSInsetRect(glyph,1,1),ink);
|
||||
else if([a[@"symbol"]isEqual:@"clone-stamp"])DYDrawCloneStamp(glyph,ink);
|
||||
else{
|
||||
NSImage *icon=[NSImage imageWithSystemSymbolName:a[@"symbol"] accessibilityDescription:a[@"title"]];
|
||||
NSImageSymbolConfiguration *configuration=[[NSImageSymbolConfiguration configurationWithPointSize:14*s weight:NSFontWeightRegular]configurationByApplyingConfiguration:[NSImageSymbolConfiguration configurationWithPaletteColors:@[ink]]];
|
||||
@@ -112,6 +139,8 @@ NSRect bounds=NSMakeRect(0,0,size.width,size.height),v=_hasViewport?NSIntersecti
|
||||
[NSGraphicsContext restoreGraphicsState];
|
||||
}
|
||||
- (void)activateTool:(NSString*)type{
|
||||
if([type isEqual:@"cloneStamp"]){_stampArmed=!_stampArmed;return;}
|
||||
_stampArmed=NO;
|
||||
if([type isEqual:@"look"]){[_bridge requestWorkspacePage:@"lut"];return;}
|
||||
if([type isEqual:@"skin"]){[self toggleSkinPreview];return;}
|
||||
if([type isEqual:@"whiteBalance"]){[_bridge requestWhiteBalanceAtTime:_time];return;}
|
||||
@@ -120,15 +149,15 @@ NSRect bounds=NSMakeRect(0,0,size.width,size.height),v=_hasViewport?NSIntersecti
|
||||
[_panels addObject:p];
|
||||
}
|
||||
- (BOOL)event:(NSEventType)type point:(NSPoint)p atTime:(CMTime)time{
|
||||
if(!std::isfinite(p.x)||!std::isfinite(p.y))return NO;[self prepareWithSize:_size scale:_scale atTime:time];
|
||||
if(_capture){BOOL used=[_capture event:type point:p atTime:time];if(![_capture capturing]){_capture=nil;[self prepareWithSize:_size scale:_scale atTime:time];}return used;}
|
||||
if(!std::isfinite(p.x)||!std::isfinite(p.y))return NO;
|
||||
if(_capture){BOOL used=[_capture event:type point:p atTime:time];if(![_capture capturing]){_capture=nil;[self prepareWithSize:_size scale:_backingScale atTime:time];}return used;}
|
||||
NSInteger hit=[self partAtPoint:p];
|
||||
if(type==NSEventTypeLeftMouseDown){
|
||||
if(hit>=100000){NSInteger index=(hit-100000)/10000-1;if(index<0||index>=(NSInteger)_panels.count)return NO;DYViewerParameterPanel*panel=[[_panels[index]retain]autorelease];[_panels removeObjectIdenticalTo:panel];[_panels addObject:panel];_capture=panel;return [panel event:type point:p atTime:time];}
|
||||
if(!hit)return NO;_pressed=hit;return YES;
|
||||
}
|
||||
if(!_pressed)return NO;
|
||||
if(type==NSEventTypeLeftMouseUp){NSInteger pressed=_pressed;_pressed=0;if(hit==pressed){for(NSDictionary*a in _areas)if([a[@"part"]integerValue]==hit){NSString*kind=a[@"kind"];if([kind isEqual:@"tool"])[self activateTool:a[@"toolType"]];else if([kind isEqual:@"mask"])[_bridge requestMask:[a[@"index"]integerValue]];else if([kind isEqual:@"workspace"])[_bridge requestWorkspace];else if([kind isEqual:@"hidePanels"]){for(DYViewerParameterPanel*panel in _panels){[panel finishCapture];panel.bridge=nil;}[_panels removeAllObjects];}else if([kind isEqual:@"railPage"])_railPage++;break;}}[self prepareWithSize:_size scale:_scale atTime:time];}
|
||||
if(type==NSEventTypeLeftMouseUp){NSInteger pressed=_pressed;_pressed=0;if(hit==pressed){for(NSDictionary*a in _areas)if([a[@"part"]integerValue]==hit){NSString*kind=a[@"kind"];if([kind isEqual:@"tool"])[self activateTool:a[@"toolType"]];else if([kind isEqual:@"mask"]){_stampArmed=NO;[_bridge requestMask:[a[@"index"]integerValue]];}else if([kind isEqual:@"workspace"])[_bridge requestWorkspace];else if([kind isEqual:@"hidePanels"]){for(DYViewerParameterPanel*panel in _panels){[panel finishCapture];panel.bridge=nil;}[_panels removeAllObjects];}else if([kind isEqual:@"railPage"])_railPage++;break;}}[self prepareWithSize:_size scale:_backingScale atTime:time];}
|
||||
return YES;
|
||||
}
|
||||
- (BOOL)capturing{return _pressed||[_capture capturing];}
|
||||
|
||||
@@ -12,7 +12,15 @@
|
||||
publish();int undo=base->_undoStarts;NSDictionary *initial=[[base->_values copy]autorelease];
|
||||
NSMutableSet *types=[NSMutableSet set];NSInteger masks=0;CGFloat lastX=-1,y=-1;BOOL horizontal=YES;
|
||||
for(NSDictionary *a in [controls valueForKey:@"areas"]){if([a[@"kind"]isEqual:@"mask"])masks++;if([a[@"kind"]isEqual:@"tool"]){NSRect r=[a[@"rect"]rectValue];if(lastX>=0)horizontal&=r.origin.x>lastX&&r.origin.y==y;lastX=r.origin.x;y=r.origin.y;[types addObject:a[@"toolType"]];}}
|
||||
run.record(@"viewer-lower-right-rail-has-five-image-tools-and-three-persistent-mask-shapes",horizontal&&lastX>size.width*.8&&y>size.height*.9&&[types isEqual:[NSSet setWithArray:@[@"curve",@"lens",@"skin",@"look",@"whiteBalance"]]]&&masks==3&&[[controls valueForKey:@"panels"]count]==0);
|
||||
run.record(@"viewer-lower-right-rail-has-six-image-tools-and-three-persistent-mask-shapes",horizontal&&lastX>size.width*.8&&y>size.height*.9&&[types isEqual:[NSSet setWithArray:@[@"curve",@"lens",@"skin",@"look",@"whiteBalance",@"cloneStamp"]]]&&masks==3&&[[controls valueForKey:@"panels"]count]==0);
|
||||
NSDictionary *stamp=areaFor(controls,@"tool",@"cloneStamp");
|
||||
click(stamp);BOOL armed=controls.stampArmed;click(stamp);
|
||||
run.record(@"viewer-stamp-arms-and-disarms-without-changing-the-grade",armed&&!controls.stampArmed&&[initial isEqual:base->_values]&&base->_undoStarts==undo);
|
||||
[controls prepareWithSize:NSMakeSize(3840,2160) scale:2 atTime:host->_time];
|
||||
NSRect overlay=[controls drawingBounds];
|
||||
double fraction=NSWidth(overlay)*NSHeight(overlay)/(3840.*2160.);
|
||||
run.record(@"viewer-idle-4k-toolbar-rasterizes-under-five-percent-of-the-canvas",fraction>0&&fraction<.05,@{@"canvasPixelFraction":@(fraction),@"overlayWidth":@(NSWidth(overlay)),@"overlayHeight":@(NSHeight(overlay))});
|
||||
publish();
|
||||
NSDictionary *workspace=areaFor(controls,@"workspace",nil);NSRect workspaceRect=[workspace[@"rect"]rectValue];
|
||||
run.record(@"viewer-control-panel-entry-is-labelled-and-anchored-at-bottom",[workspace[@"title"]isEqual:@"控制面板"]&&NSMidY(workspaceRect)>size.height*.9);
|
||||
__block NSInteger workspaceRequests=0;__block NSString *requestedPage=nil;__block NSInteger requestedMask=-1;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
- (void)setViewport:(NSRect)viewport;
|
||||
- (void)prepareWithSize:(NSSize)size scale:(CGFloat)scale atTime:(CMTime)time;
|
||||
- (void)draw;
|
||||
- (NSRect)drawingBounds;
|
||||
@property(nonatomic) BOOL stampArmed;
|
||||
- (NSInteger)partAtPoint:(NSPoint)point;
|
||||
- (BOOL)event:(NSEventType)type point:(NSPoint)point atTime:(CMTime)time;
|
||||
- (BOOL)mouseMoved:(NSPoint)point;
|
||||
|
||||
@@ -13,7 +13,11 @@
|
||||
[document setObject:@[@"base"] forKey:@"removedBase"];
|
||||
run.record(@"viewer-bridge-published-snapshot-is-immutable-and-frame-bound",[snapshot[@"uniforms"]length]==sizeof(DYUniforms)&&![snapshot[@"document"][@"removedBase"]count]&&![bridge snapshotAtTime:CMTimeMake(1,24)]);
|
||||
int undo=base->_undoStarts;
|
||||
[bridge beginParameter:exposure node:@"base:base" value:0 atTime:kCMTimeZero];[bridge changeValue:.4];drain();
|
||||
[bridge beginParameter:exposure node:@"base:base" value:0 atTime:kCMTimeZero];[bridge changeValue:.4];
|
||||
// Wait for the asynchronous write itself, allowing a busy test runner to
|
||||
// service the main queue before asserting the still-open undo group.
|
||||
double writeDeadline=NSProcessInfo.processInfo.systemUptime+.5;
|
||||
while(fabs(value(exposure)-.4)>=1e-6&&NSProcessInfo.processInfo.systemUptime<writeDeadline)drain();
|
||||
run.record(@"viewer-bridge-drag-writes-before-mouse-up-asynchronously",fabs(value(exposure)-.4)<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo);
|
||||
[bridge changeValue:.8];[bridge endGesture];[bridge endGesture];drain();
|
||||
run.record(@"viewer-bridge-continuous-drag-closes-one-host-undo-group",fabs(value(exposure)-.8)<1e-6&&base->_undoStarts==undo+1&&base->_undoEnds==undo+1);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
@property(nonatomic,copy) NSString *toolType;
|
||||
@property(nonatomic) BOOL visible;
|
||||
- (void)setViewport:(NSRect)viewport;
|
||||
- (NSRect)drawingBounds;
|
||||
- (void)prepareWithSize:(NSSize)size scale:(CGFloat)scale atTime:(CMTime)time;
|
||||
- (void)draw;
|
||||
- (NSInteger)partAtPoint:(NSPoint)point;
|
||||
@@ -130,6 +131,7 @@
|
||||
if([d[@"kind"]isEqual:@"popup"]){NSArray*values=d[@"values"],*options=d[@"options"];NSInteger i=values?[values indexOfObject:@((NSInteger)llround(v))]:(NSInteger)llround(v);return i>=0&&i<(NSInteger)options.count?options[i]:@"—";}
|
||||
return [NSString stringWithFormat:[d[@"max"]doubleValue]-[d[@"min"]doubleValue]>20?@"%.1f":@"%.2f",v];
|
||||
}
|
||||
- (NSRect)drawingBounds{return _areas.count?_panel:NSZeroRect;}
|
||||
- (void)draw{
|
||||
if(!_areas.count)return;[NSGraphicsContext saveGraphicsState];NSRectClip(NSIntersectionRect(_panel,NSMakeRect(0,0,_size.width,_size.height)));CGFloat s=_scale;NSColor*ink=DYThemeColor(@"text")?:NSColor.whiteColor,*accent=DYThemeColor(@"accent")?:NSColor.systemCyanColor;
|
||||
NSBezierPath*panel=[NSBezierPath bezierPathWithRoundedRect:_panel xRadius:9*s yRadius:9*s];BOOL solid=NSWorkspace.sharedWorkspace.accessibilityDisplayShouldReduceTransparency;
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
NSString*title=titles[ID]?:DYToolSection(type)[@"title"]?:type;[rows addObject:@{@"node":ID,@"type":type,@"title":title,@"enabled":@(DYWorkspaceEnabled(node?DYToolUniforms(node):rootUniforms,type)),@"kind":@"tool",@"maskCount":@(DYMasksForTool(document,ID).count)}];
|
||||
for(NSDictionary*mask in DYMasksForTool(document,ID)){[assignedMasks addObject:mask[@"id"]];DYMaskParameters p=DYMaskAtTime(mask,_toolTime);NSString*name=@[@"椭圆",@"矩形",@"钢笔",@"渐变",@"HSL",@"亮度"][p.kind];[rows addObject:@{@"node":ID,@"mask":mask[@"id"],@"enabled":mask[@"enabled"],@"title":[@" ◩ " stringByAppendingString:name],@"kind":@"mask"}];}
|
||||
}
|
||||
for(NSDictionary*mask in DYSharedMasks(document))if(!DYToolIDsForSharedMask(document,mask[@"id"]).count){DYMaskParameters p=DYMaskAtTime(mask,_toolTime);[rows addObject:@{@"node":@"shared",@"mask":mask[@"id"],@"enabled":mask[@"enabled"],@"title":[@"◩ 未分配 · " stringByAppendingString:@[@"椭圆",@"矩形",@"钢笔",@"渐变",@"HSL",@"亮度"][p.kind]],@"kind":@"mask"}];}
|
||||
for(NSDictionary*mask in DYSharedMasks(document))if(!DYToolIDsForSharedMask(document,mask[@"id"]).count){DYMaskParameters p=DYMaskAtTime(mask,_toolTime);[rows addObject:@{@"node":@"shared",@"mask":mask[@"id"],@"enabled":mask[@"enabled"],@"title":mask[@"stampSource"]?@"◩ 仿制图章":[@"◩ 未分配 · " stringByAppendingString:@[@"椭圆",@"矩形",@"钢笔",@"渐变",@"HSL",@"亮度"][p.kind]],@"kind":@"mask"}];}
|
||||
}@finally{[action endAction:self];}
|
||||
[_toolDocument release];_toolDocument=document;[_layerRows release];_layerRows=[rows copy];[_layerTable reloadData];
|
||||
NSString *requested=note.userInfo[@"scrollToTool"];if(requested.length){_hasUserSelection=YES;[_selectedNode release];_selectedNode=[requested copy];[_selectedMask release];_selectedMask=nil;}
|
||||
@@ -90,7 +90,8 @@
|
||||
- (void)rebuildWorkspaceEditor {
|
||||
NSDictionary*node=DYToolWithID(_toolDocument,_selectedNode);NSString*type=node?node[@"type"]:[_selectedNode hasPrefix:@"base:"]?[_selectedNode substringFromIndex:5]:nil;
|
||||
if(_selectedMask)_editorMode=1;else if(![_editorNode isEqual:_selectedNode]||_editorMode==1)_editorMode=[type isEqual:@"look"]?2:0;
|
||||
_selectionTitle.stringValue=_selectedMask?@"蒙版 · 编辑与跟踪":DYToolSection(type)[@"title"]?:@"从上方添加模块";if(!_selectedMask)for(NSDictionary*row in _layerRows)if([row[@"node"]isEqual:_selectedNode]&&!row[@"mask"]){_selectionTitle.stringValue=row[@"title"];break;}
|
||||
BOOL stamp=DYSharedMaskWithID(_toolDocument,_selectedMask)[@"stampSource"]!=nil;
|
||||
_selectionTitle.stringValue=_selectedMask?(stamp?@"仿制图章 · 编辑与跟踪":@"蒙版 · 编辑与跟踪"):DYToolSection(type)[@"title"]?:@"从上方添加模块";if(!_selectedMask)for(NSDictionary*row in _layerRows)if([row[@"node"]isEqual:_selectedNode]&&!row[@"mask"]){_selectionTitle.stringValue=row[@"title"];break;}
|
||||
if(![_editorNode isEqual:_selectedNode]){[_toolEditor removeFromSuperview];[_toolEditor release];_toolEditor=nil;[_editorNode release];_editorNode=[_selectedNode copy];if(type){id<PROAPIAccessing>target=node?[[[DYToolManager alloc]initWithHost:[self rootHost]node:node]autorelease]:[self rootHost];_toolEditor=[[DYInspector alloc]initWithAPIManager:target renderer:_renderer workspaceType:type];[_editorHost addSubview:_toolEditor positioned:NSWindowBelow relativeTo:_maskPane];}}
|
||||
[_toolEditor refresh];
|
||||
if(_selectedNode.length&&![_selectedNode isEqual:@"shared"])[NSNotificationCenter.defaultCenter postNotificationName:@"DYWorkspaceToolSelection" object:[self rootHost]userInfo:@{@"node":_selectedNode}];
|
||||
@@ -126,9 +127,10 @@
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:@"DYToolCanvasSelection" object:host userInfo:@{@"node":@"shared",@"mask":ID,@"document":_toolDocument?:@{},@"draw":@(kind==2),@"drawShape":@(kind==0||kind==1)}];
|
||||
}
|
||||
- (void)rebuildMaskAssignments {
|
||||
DYWorkspaceList*list=[[[DYWorkspaceList alloc]init]autorelease];NSTextField*heading=[DYThemeLabel labelWithString:_selectedMask?@"应用到模块":@"选择或绘制蒙版"];heading.font=[NSFont systemFontOfSize:11 weight:NSFontWeightSemibold];[list addSubview:heading];
|
||||
BOOL stamp=DYSharedMaskWithID(_toolDocument,_selectedMask)[@"stampSource"]!=nil;
|
||||
DYWorkspaceList*list=[[[DYWorkspaceList alloc]init]autorelease];NSTextField*heading=[DYThemeLabel labelWithString:stamp?@"仿制图章":_selectedMask?@"应用到模块":@"选择或绘制蒙版"];heading.font=[NSFont systemFontOfSize:11 weight:NSFontWeightSemibold];[list addSubview:heading];
|
||||
NSArray*assigned=DYToolIDsForSharedMask(_toolDocument,_selectedMask);
|
||||
for(NSDictionary*row in _layerRows)if([row[@"kind"]isEqual:@"tool"]){NSButton*check=[NSButton checkboxWithTitle:row[@"title"]target:self action:@selector(maskAssignmentChanged:)];check.identifier=row[@"node"];check.font=[NSFont systemFontOfSize:11];check.state=[assigned containsObject:row[@"node"]]?NSControlStateValueOn:NSControlStateValueOff;check.enabled=_selectedMask.length>0;check.accessibilityLabel=[@"蒙版应用到 " stringByAppendingString:row[@"title"]];[list addSubview:check];}
|
||||
if(!stamp)for(NSDictionary*row in _layerRows)if([row[@"kind"]isEqual:@"tool"]){NSButton*check=[NSButton checkboxWithTitle:row[@"title"]target:self action:@selector(maskAssignmentChanged:)];check.identifier=row[@"node"];check.font=[NSFont systemFontOfSize:11];check.state=[assigned containsObject:row[@"node"]]?NSControlStateValueOn:NSControlStateValueOff;check.enabled=_selectedMask.length>0;check.accessibilityLabel=[@"蒙版应用到 " stringByAppendingString:row[@"title"]];[list addSubview:check];}
|
||||
_assignmentScroll.documentView=list;[self layoutMaskAssignments];
|
||||
}
|
||||
- (void)layoutMaskAssignments {
|
||||
|
||||
+3
-3
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.12.1</string>
|
||||
<string>1.13.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>81</string>
|
||||
<string>85</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>PlugInKit</key>
|
||||
@@ -71,7 +71,7 @@
|
||||
<key>uuid</key>
|
||||
<string>1C17B73B-F229-4C09-A434-EAF6DFF5F22A</string>
|
||||
<key>version</key>
|
||||
<string>1.12.1</string>
|
||||
<string>1.13.1</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>className</key>
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.12.1</string>
|
||||
<string>1.13.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>81</string>
|
||||
<string>85</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# 2026-11-04 画布工具与辅助工作区:1.10.0(72)验收完成
|
||||
|
||||
> 当前工程、正式版本和下一步见 [开发交接.md](开发交接.md)。本文件保留历史 FxPlug 交付和技术记录。
|
||||
|
||||
下一阶段完善自定控件,先读[自定控件开发交接](/Volumes/备份/大鱼调色/大鱼调色/自定控件开发交接.md)。该文件集中说明当前代码、尚未补齐的专用图形和后续验证方式;本文件保留完整产品交付与历史。
|
||||
|
||||
当前正式安装 **1.10.0(72)**,固定位置 `/Library/Plug-Ins/FxPlug/大鱼调色.app`,主 Bundle ID `com.dayu.color`,XPC `com.dayu.color.XPC`。实际编译源码 `80dec904bedf5f704b29d16325fa95d639f3a250`;Developer ID 团队 B3W25FX5H5,APP 公证 `c0209032-38d2-4434-8e37-7f911414c3c6` Accepted。票据、Gatekeeper、唯一 PluginKit 正式路径、正式安装的 **695 项原生检查**与用户实鼠验收通过。
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
> 当前主 APP、本机安装与公测通道版本见 [开发交接.md](开发交接.md)。本文件保留主 APP 的历史交付与设计记录。
|
||||
|
||||
> 2026-11-02 更新:主 APP 已交付 1.7.0(45)公测。自动更新和云端诊断已经接入,当前实现与部署/隐私/回滚说明见 [Backend/README.md](Backend/README.md),发行与验证见 [Packaging/Release-1.7.0.md](Packaging/Release-1.7.0.md) 和 [verification/BetaClientQA.json](verification/BetaClientQA.json)。下方原始交接保留作背景;登录、授权和业务加密仍未实施,不能把原规划当成已完成状态。
|
||||
|
||||
# 大鱼调色主 APP 开发交接
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
# 大鱼调色开发交接
|
||||
|
||||
更新于 2026-11-05(Asia/Shanghai)。这是新对话的接手入口。历史设计和实现细节按需查阅专项交接,复现和交付证据以对应版本的报告为准。
|
||||
|
||||
## 当前基线
|
||||
|
||||
| 项目 | 已核对状态 |
|
||||
| --- | --- |
|
||||
| 工程与源码 | `/Volumes/备份/大鱼调色/大鱼调色`,`大鱼调色.xcodeproj`,`Wrapper Application` / Release。远程为 `https://dayu.media/git/dayu/dayu-color.git`,分支 `main`。本轮开发基线为 `504e08e425e44a271e1e0be819cf6a593d4b786c`。 |
|
||||
| 本机正式安装 | **1.13.1(85)**,`/Library/Plug-Ins/FxPlug/大鱼调色.app`。外层 ID `com.dayu.color`,服务 ID `com.dayu.color.XPC`。实际编译源码 `1659f3d3853e2574f06a45687141fb444b5d02ca`。签名、公证、票据和本机正式路径通过。[交付](verification/Delivery.json) · [宿主验收](verification/HostCloneSource1.13.1.json) |
|
||||
| Git Release | **1.13.0(83)**,标签 `v1.13.0-clone-stamp-20261105` 指向 `07601e50bf604e7721bccf8be10e403a2bd030d1`。公测 Release 391/附件 35。草稿及发布后完整下载均匹配签名公证包。本地包 `/Volumes/备份/大鱼调色/发行包/大鱼调色-1.13.0.pkg`。[发布页](https://dayu.media/git/dayu/dayu-color/releases/tag/v1.13.0-clone-stamp-20261105) · [发布核验](verification/Release.json) |
|
||||
| 站点及自动更新 | 本次交接回读时,原文章与主 APP 公测通道均为 **1.12.0(79)**。主 APP 启动时自动检查,发现新版后由用户确认下载和安装。[原文章](https://dayu.media/15792/) · [文章核验](verification/Article1.12.0.json) · [更新通道核验](verification/BetaPublication1.12.0.json) |
|
||||
| 本机开发与验收 | AppKit / Objective-C++ / FxPlug 4 / Metal,Apple Silicon,macOS 14.6+。交付记录使用 Xcode 27.1、FxPlug SDK 4.3.5 和 FCP 12.4。构建缓存为 `/Users/mac/Library/Caches/CodexBuilds/com.dayu.color`,验收素材库位于其中的 `fcp-qa/大鱼调色_验收.fcpbundle`。产品交付锁为 `/Users/mac/.codex/app-delivery-locks/com.dayu.color.lock`,接手时重新检查。 |
|
||||
|
||||
## 1.13.1 等像素复制与取样十字拖动
|
||||
|
||||
- 选中图章后可拖动青色取样十字。拖动时更新标记,松手后换取样位置并形成一次撤销。Esc 取消,旧图章可直接编辑。源点调整适用于图章的全部帧,目标位置轨迹保持原样。
|
||||
- Metal 按整数像素偏移直接复制当前帧中的原像素,羽化只混合覆盖边缘。改变椭圆宽高只修改覆盖范围。画布和工作区移除图章旋转控件。跟踪继续用现有分析器求解运动,图章只应用中心位移。旧项目的轨迹键保留,历史缩放与旋转分量在图章求值时忽略。普通蒙版仍使用原有变换。
|
||||
- 入口为 `DYToolOSC.inc.h`、`DYToolCanvasEditing.inc.h`、`DYToolHostMethods.inc.h`、`DYToolState.mm` 和 `DYGrade.metal`。画布写回继续校验时间、图章 ID 和外部修改冲突。原生检查覆盖一次撤销、Esc 取消、拖动和调尺寸时保持跟踪键,以及实际 Metal 输出的等像素复制。
|
||||
|
||||
## 1.13.0 历史交付 · 画布响应与仿制图章
|
||||
|
||||
- 旧版工具栏重绘会清零并上传整张 CPU 位图。无蒙版、未进入图章取样时,新版只绘制工具栏和已打开面板所需的区域,并沿用宿主提供的透明画布。4K、2 倍缩放的空闲工具栏位图为 1000×134,约占 3840×2160 的 1.6%。蒙版与图章绘制仍可能使用整画布。
|
||||
- 工具文档复制改用内存深拷贝,已验证的不可变文档副本共享内容。每帧快照直接从选中的关键帧生成,不再绕一次序列化往返,也只为胶片层读取颗粒参数。M4 合成测试用四条各含 2400 个键的轨迹,40 次复制平均耗时从 18.018 ms 降到 10.949 ms。上述是局部测量,第三方反馈缺少触发动作、素材和工程,尚无法对同一场景前后复测。
|
||||
- 点击画布右下角仿制图章,点选取样中心,再拖出椭圆覆盖区。Esc 取消未保存操作。选中图章可直接在画布启动正向、反向或双向跟踪,也可在工作区选择图章,调整几何、强度和羽化、清除轨迹、旁路或删除。
|
||||
- 图章用现有共享蒙版文档和跟踪轨迹保存,使用独立标识,每次创建为一组撤销。取样位置和原取样尺寸固定,目标跟踪位移、缩放和旋转。Metal 从每帧同一源画面采样,在调色前处理预乘 RGBA,重叠图章按创建顺序合成。完整预设保留图章,启用图章时拒绝导出无法表达空间修改的 Cube。
|
||||
- 关键路径为 `DYToolOSC.inc.h`、`DYViewerControls.inc.h`、`DYToolHostMethods.inc.h`、`DYToolState.mm`、`DYManagedRender.inc.h` 和 `DYGrade.metal`。下一次排查卡顿时,先区分空闲画布、曲线拖动、工作区示波器和有蒙版的 4K 播放,再抓取对应场景的运行时间。
|
||||
|
||||
## 1.12.1 历史交付
|
||||
|
||||
- 检视器以紧凑高度打开,顶部按钮固定在参数滚动区外。80 版在接入宿主后强改视图高度,造成顶部裁切。81 版由 FCP 管理已挂载视图的空间,超出可用高度的模块在参数区内滚动。
|
||||
- 画布工具栏与曲线默认在右下。曲线顶部手柄可移动面板。松手后保留最终点位,等宿主写回后接续正式参数;保留时间和图层校验及一次手势一次撤销。
|
||||
- 画布与检视器的曲线直方图取样自当前效果的输出。画布按显示帧匹配,检视器接收效果输出更新。曲线直方图与工作区四宫格示波器各有显示用途,继续沿用各自的取样和色彩说明。
|
||||
- 画布新增白平衡吸管,复用基础调整的求解和参数写入;畸变修复使用枕形网格图标。独立图层被宿主拒绝写入时增加本机诊断 `dayu_tool_save_rejected`。
|
||||
|
||||
## 接手时的代码入口
|
||||
|
||||
下表中的文件位于 `大鱼调色/Plugin/`。
|
||||
|
||||
| 范围 | 入口 |
|
||||
| --- | --- |
|
||||
| 检视器高度、滚动和曲线刷新 | `DYInspector.mm` 的 `layout`、`curveOutputChanged:` |
|
||||
| 画布工具、曲线拖动和写回 | `DYViewerControls.inc.h`、`DYViewerParameterPanel.inc.h`、`DYViewerParameterBridge.inc.h` |
|
||||
| 效果输出取样与直方图 | `DYScopeCapture.inc.h`、`DYScopeSample.mm`、`DYHistogram.h` |
|
||||
| 画布白平衡与宿主写入诊断 | `DYPlugIn.mm`、`DYColorTables.h`、`DYToolState.mm` |
|
||||
| 工作区、共享蒙版与跟踪 | `DYColorWorkspace.mm`、`DYToolState.mm`、`DYToolOSC.inc.h`。共享蒙版以工具文档 schema 3 为编辑源,渲染展开副本只用于渲染。[工作区与跟踪专项交接](自定控件开发交接.md) |
|
||||
|
||||
## 验收与待跟进
|
||||
|
||||
- **85 版像素复制与十字。** 正式安装的 864 项原生检查通过,实际 Metal 输出验证扩大覆盖只增加复制面积,重合像素逐值相同。FCP 12.4 独立项目副本读入 83 版图章,画布和工作区都只提供中心与尺寸控制,导出后原图章和 99 个轨迹键逐项一致。实窗自动拖动未产生宿主写入,十字拖动、一次撤销和 Esc 取消由正式安装版的原生回调覆盖。工作区“画面编辑”按钮仍沿用通用蒙版提示文字。[验收证据](verification/HostCloneSource1.13.1.json)
|
||||
|
||||
- **83 版图章与跟踪。** 安装后的 858 项原生检查通过。FCP 12.4 独立验收项目副本中已看到图标、取样十字、目标区及实际贴图。工作区触发真实正向跟踪,冷重开后导出的预设保留 99 个轨迹键,目标几何变化,取样坐标和尺寸一致。宿主测试通过载入验收预设创建图章。画布点击及拖选由原生 FxPlug 回调测试覆盖,自动鼠标输入没有进入实窗的 OSC 回调。[验收证据](verification/HostCloneStamp1.13.0.json)
|
||||
|
||||
- 正式 81 版通过 844 项原生检查。FCP 12.4 冷重开后,检视器顶部完整显示,曲线读到 57,600 个输出样本,原调色参数成功读回。同帧输出变更和检视器直方图刷新已通过原生检查。用户手动确认的是 80 版的画布曲线和实时直方图。[宿主验收](verification/HostCanvasInspector1.12.1.json)
|
||||
- **画布白平衡待实机复核。** 已验证取样入口分发、播放头改变后的写入保护、白平衡求解、色温和色调写入及一次撤销。下一次实机验收补做系统取样界面的点选和取消,核对取样后色温与色调的实际变化。[宿主验收范围](verification/HostCanvasInspector1.12.1.json)
|
||||
- **第三方 FCP 保存告警待反馈。** 本机内置 APFS 验收库未复现,退出重开读回正常。收到报错前的操作、时间、FCP 和插件版本、素材库位置后,再区分卷写入故障、素材库异常与特定插件写入触发;先保护原库与备份,复现在独立验收库进行。[保存告警排查](research/FinalCutSaveFailure-20261105.md)
|
||||
- 站点文章和自动更新通道与 Git Release 是独立交付。后续若要将站点或更新通道升到 81,按发布任务核对现有线上版本、正式安装包和生产回滚记录。[更新部署说明](Backend/README.md)
|
||||
|
||||
## 继续工作
|
||||
|
||||
1. 核对 `git status --short --branch`、远端引用、正式安装版本与交付锁。先在独立 FCP 验收库重现用户本轮指定的问题,保留原工程和既有参数语义。
|
||||
2. 代码变更按 [RECOVERY.md](RECOVERY.md) 恢复和验收。常用入口为 `tools/checkpoint.py`、`tools/deliver.py` 与 `Packaging/build_pkg.py`;交付脚本等待宿主验收时,通过后才输入 `complete`。
|
||||
3. 按 [AGENTS.md](AGENTS.md) 在结束前更新本文并提交、推送、回读。
|
||||
|
||||
可复制到新对话:
|
||||
|
||||
> 在 `/Volumes/备份/大鱼调色/大鱼调色` 继续优化大鱼调色。先读项目 `AGENTS.md` 和 `开发交接.md`,以核实后的正式安装和验收记录为基线,按我接下来指定的内容修改。完成后更新交接文档。
|
||||
|
||||
## 任务记录
|
||||
|
||||
| 日期 | 任务 | 结果与接续 |
|
||||
| --- | --- | --- |
|
||||
| 2026-11-05 | 检视器、画布控件与保存告警排查 | 81 版正式安装并发布。80 版的画布反馈已复核,81 版修复检视器裁切与直方图刷新。剩余实机取样和第三方告警见上。 |
|
||||
| 2026-11-05 | 建立每次任务的交接流程 | 新建本入口及项目规则,为历史专项交接加指引。回读核对了正式安装 81、远程版本标签、站点文章及公测通道 79。本轮成果为项目文档。 |
|
||||
| 2026-11-05 | 画布响应与仿制图章 | 83 版正式安装,补齐图章渲染、现有跟踪复用及工作区编辑。性能局部测量、FCP 实帧和冷重开证据见本页,反馈场景待复现。 |
|
||||
| 2026-11-05 | 仿制图章等像素复制与取样十字拖动 | 加入源点拖动和撤销,复制改为整数像素平移,目标跟踪保留中心位移。 |
|
||||
+2
@@ -1,5 +1,7 @@
|
||||
# 大鱼调色自定控件开发交接
|
||||
|
||||
> 当前正式版本、最新控件行为和待验收事项见 [开发交接.md](开发交接.md)。下文保留 1.12.0 及更早版本的实现与研究记录。
|
||||
|
||||
更新日期:2026-11-05,Asia/Shanghai。
|
||||
|
||||
当前正式安装为 **1.12.0(79)统一工作区与共享蒙版**,编译源码beccf2fc01f8dc06c5d3d505f88289885d209bc8,834项正式原生检查及本轮FCP反馈验收通过。实际交付进度以 `verification/Delivery.json`、`HostFeedback78.json`、`HostFeedback79.json`、`Package.json`、`Release.json` 为准;正式安装包签名、公证、20项验包、Release389草稿与发布后完整下载校验均完成。新增最近LUT快捷缩略图与左下横排画布图标,肤色线、片尾时间修复和真实跟踪误差见research/WorkspaceFeedback-20261105.md。
|
||||
|
||||
在新工单中引用
屏蔽一个用户