afterpresets 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/native-runtime/CMakeLists.txt +82 -0
- package/native-runtime/README.md +40 -0
- package/native-runtime/THIRD_PARTY_NOTICES.md +14 -0
- package/native-runtime/include/ap_native.h +223 -0
- package/native-runtime/src/apply.cpp +199 -0
- package/native-runtime/src/crypto.cpp +225 -0
- package/native-runtime/src/crypto.hpp +51 -0
- package/native-runtime/src/dialog.cpp +62 -0
- package/native-runtime/src/dialog.hpp +35 -0
- package/native-runtime/src/engine.cpp +909 -0
- package/native-runtime/src/engine.hpp +232 -0
- package/native-runtime/src/fsutil.cpp +291 -0
- package/native-runtime/src/fsutil.hpp +57 -0
- package/native-runtime/src/json.cpp +326 -0
- package/native-runtime/src/json.hpp +70 -0
- package/native-runtime/src/platform.hpp +83 -0
- package/native-runtime/src/platform_common.cpp +60 -0
- package/native-runtime/src/platform_mac.mm +314 -0
- package/native-runtime/src/platform_win.cpp +277 -0
- package/native-runtime/src/runtime.cpp +473 -0
- package/native-runtime/src/util.cpp +169 -0
- package/native-runtime/src/util.hpp +32 -0
- package/native-runtime/src/zip.cpp +243 -0
- package/native-runtime/src/zip.hpp +58 -0
- package/native-runtime/third_party/monocypher/LICENCE.md +167 -0
- package/native-runtime/third_party/monocypher/monocypher-ed25519.c +500 -0
- package/native-runtime/third_party/monocypher/monocypher-ed25519.h +140 -0
- package/native-runtime/third_party/monocypher/monocypher.c +2956 -0
- package/native-runtime/third_party/monocypher/monocypher.h +321 -0
- package/native-runtime/third_party/tinf/LICENSE +22 -0
- package/native-runtime/third_party/tinf/crc32.c +57 -0
- package/native-runtime/third_party/tinf/tinf.h +140 -0
- package/native-runtime/third_party/tinf/tinflate.c +636 -0
- package/native-runtime/vendor-files.json +39 -0
- package/package.json +6 -3
- package/runtime/docs/cep/host.md +8 -0
- package/runtime/docs/common/README.md +1 -1
- package/runtime/docs/native/README.md +44 -0
- package/runtime/docs/native/debugging.md +140 -0
- package/runtime/docs/native/rules.md +402 -0
- package/runtime/docs/native/testing.md +154 -0
- package/runtime/package.json +1 -1
- package/runtime/scripts/ae-sdk-docs/config.js +102 -0
- package/runtime/scripts/ae-sdk-docs/convert.js +430 -0
- package/runtime/scripts/ae-sdk-docs/index.js +314 -0
- package/runtime/scripts/ae-sdk-docs/source.js +205 -0
- package/runtime/scripts/ae-sdk-docs/split.js +170 -0
- package/runtime/scripts/ae-sdk-docs.js +72 -0
- package/runtime/src/host.js +1 -1
- package/src/api/error-messages.js +1 -1
- package/src/check/check.js +3 -3
- package/src/check/native.js +14 -0
- package/src/check/pricing.js +1 -1
- package/src/cli.js +2 -2
- package/src/commands/build.js +8 -2
- package/src/commands/check.js +10 -2
- package/src/commands/dev.js +9 -2
- package/src/commands/docs.js +5 -1
- package/src/commands/init.js +10 -7
- package/src/commands/push.js +5 -2
- package/src/commands/sdk.js +14 -0
- package/src/commands/testers.js +1 -1
- package/src/commands/upgrade.js +2 -2
- package/src/commands/whoami.js +1 -1
- package/src/dev/bridge.js +8 -0
- package/src/dev/native.js +3 -0
- package/src/dev/session.js +4 -3
- package/src/mcp/extendscript.js +9 -8
- package/src/mcp/host-target.js +1 -0
- package/src/mcp/panels.js +1 -1
- package/src/mcp/png.js +1 -0
- package/src/mcp/server.js +2 -2
- package/src/mcp/tools/capture.js +3 -0
- package/src/mcp/tools/host.js +1 -1
- package/src/mcp/tools/native.js +6 -0
- package/src/mcp/tools/project.js +48 -32
- package/src/mcp/tools/releases.js +23 -20
- package/src/native/build.js +27 -0
- package/src/native/cmake/CMakeLists.txt +88 -0
- package/src/native/cmake/zig-windows.cmake +19 -0
- package/src/native/effect.js +3 -0
- package/src/native/install.js +8 -0
- package/src/native/installers.js +4 -0
- package/src/native/pipl.js +20 -0
- package/src/native/restart.js +2 -0
- package/src/native/sdk.js +8 -0
- package/src/project/docs.js +3 -3
- package/src/project/project.js +2 -2
- package/src/project/template.js +5 -4
- package/src/prompt.js +1 -1
- package/src/release/native.js +3 -0
- package/src/release/publish.js +1 -1
- package/src/system/run-command.js +1 -1
- package/src/targets.js +1 -1
- package/template/cep/AGENTS.md +99 -164
- package/template/cep/README.md +7 -2
- package/template/cep/docs/code_guide.md +67 -0
- package/template/cep/docs/initial_setup.md +58 -12
- package/template/cep/docs/release_checklist.md +24 -0
- package/template/hosts/AGENTS.two-apps.md +12 -0
- package/template/native/.mcp.json +8 -0
- package/template/native/AGENTS.md +105 -0
- package/template/native/README.md +71 -0
- package/template/native/docs/code_guide.md +72 -0
- package/template/native/docs/initial_setup.md +179 -0
- package/template/native/docs/release_checklist.md +24 -0
- package/template/native/effect.json +16 -0
- package/template/native/gitignore +8 -0
- package/template/native/package.json +14 -0
- package/template/native/src/Effect.cpp +224 -0
- package/template/native/src/License.cpp +95 -0
- package/template/native/src/License.h +29 -0
- package/template/native/src/Render.h +68 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#include "License.h"
|
|
2
|
+
|
|
3
|
+
#include <cstdio>
|
|
4
|
+
#include <cstdlib>
|
|
5
|
+
#include <string>
|
|
6
|
+
|
|
7
|
+
#include "ap_effect_config.h" // generated: AP_BUNDLE_ID, AP_VERSION, AP_API_BASE, AP_PUBLIC_KEY, ...
|
|
8
|
+
#include "ap_native.h"
|
|
9
|
+
|
|
10
|
+
namespace license {
|
|
11
|
+
namespace {
|
|
12
|
+
|
|
13
|
+
// Process-wide; set and cleared on the main thread only (GLOBAL_SETUP /
|
|
14
|
+
// GLOBAL_SETDOWN), read-only while frames render.
|
|
15
|
+
ap_runtime *g_ap = nullptr; // ap-check: allow mfr_global (written only in GLOBAL_SETUP/SETDOWN)
|
|
16
|
+
bool g_enforce = true; // ap-check: allow mfr_global (written only in GLOBAL_SETUP)
|
|
17
|
+
|
|
18
|
+
void copy(char *out, std::size_t size, const char *text) {
|
|
19
|
+
if (size) std::snprintf(out, size, "%s", text);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Dev builds render without the watermark so you can test the look. To see
|
|
23
|
+
// the locked state in a dev build, create the file
|
|
24
|
+
// ~/.afterpresets/native-dev-enforce-license (or start After Effects with
|
|
25
|
+
// AP_DEV_ENFORCE_LICENSE=1) and restart After Effects. Release builds always enforce.
|
|
26
|
+
bool dev_enforce_requested() {
|
|
27
|
+
if (std::getenv("AP_DEV_ENFORCE_LICENSE")) return true;
|
|
28
|
+
#ifdef _WIN32
|
|
29
|
+
const char *home = std::getenv("USERPROFILE");
|
|
30
|
+
#else
|
|
31
|
+
const char *home = std::getenv("HOME");
|
|
32
|
+
#endif
|
|
33
|
+
if (!home) return false;
|
|
34
|
+
std::string flag = std::string(home) + "/.afterpresets/native-dev-enforce-license";
|
|
35
|
+
FILE *f = std::fopen(flag.c_str(), "rb");
|
|
36
|
+
if (f) std::fclose(f);
|
|
37
|
+
return f != nullptr;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
} // namespace
|
|
41
|
+
|
|
42
|
+
void start() {
|
|
43
|
+
if (g_ap) return;
|
|
44
|
+
ap_config c;
|
|
45
|
+
ap_config_defaults(&c);
|
|
46
|
+
c.bundle_id = AP_BUNDLE_ID;
|
|
47
|
+
c.version = AP_VERSION;
|
|
48
|
+
c.api_base = AP_API_BASE;
|
|
49
|
+
c.public_key = AP_PUBLIC_KEY; // Ed25519 public key: verifies, cannot sign
|
|
50
|
+
c.product_url = AP_PRODUCT_URL[0] ? AP_PRODUCT_URL : nullptr;
|
|
51
|
+
c.manage_devices_url = AP_MANAGE_DEVICES_URL[0] ? AP_MANAGE_DEVICES_URL : nullptr;
|
|
52
|
+
c.license_enabled = AP_LICENSE_ENABLED;
|
|
53
|
+
c.offline_grace_days = AP_OFFLINE_GRACE_DAYS;
|
|
54
|
+
c.check_in_background = AP_CHECK_IN_BACKGROUND;
|
|
55
|
+
c.update_mode = AP_UPDATE_MODE;
|
|
56
|
+
c.dev = AP_DEV_BUILD; // dev builds never install updates
|
|
57
|
+
c.build_id = AP_BUILD_ID; // logged at start; `ap dev` reads it to know which build is loaded
|
|
58
|
+
g_ap = ap_init(&c); // NULL (config error): stays locked, never crashes
|
|
59
|
+
g_enforce = AP_LICENSE_ENABLED && (!AP_DEV_BUILD || dev_enforce_requested());
|
|
60
|
+
ap_apply_staged_update(g_ap); // an update staged in an earlier session
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
void stop() {
|
|
64
|
+
ap_log(g_ap, 1, "global setdown"); // lets tools confirm After Effects shut the effect down cleanly
|
|
65
|
+
ap_apply_staged_update(g_ap); // usually a no-op: updates apply right after download
|
|
66
|
+
ap_shutdown(g_ap);
|
|
67
|
+
g_ap = nullptr;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
bool unlocked() {
|
|
71
|
+
if (!g_enforce) return true;
|
|
72
|
+
return ap_is_unlocked(g_ap) != 0; // NULL runtime: locked
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
void options_dialog() { ap_options_dialog(g_ap, AP_EFFECT_NAME); }
|
|
76
|
+
|
|
77
|
+
void status_name(char *out, std::size_t size) {
|
|
78
|
+
char notice[256] = "";
|
|
79
|
+
if (g_ap && ap_update_notice(g_ap, notice, sizeof notice) && notice[0]) return copy(out, size, "Update: restart AE");
|
|
80
|
+
if (!AP_LICENSE_ENABLED) return copy(out, size, "AfterPresets");
|
|
81
|
+
if (!g_ap) return copy(out, size, "License: unavailable");
|
|
82
|
+
switch (ap_status_get(g_ap)) {
|
|
83
|
+
case AP_STATUS_DISABLED: return copy(out, size, "AfterPresets");
|
|
84
|
+
case AP_STATUS_ACTIVE: return copy(out, size, "License: active");
|
|
85
|
+
case AP_STATUS_OFFLINE_GRACE: return copy(out, size, "License: offline");
|
|
86
|
+
case AP_STATUS_SIGNING_IN: return copy(out, size, "License: signing in");
|
|
87
|
+
case AP_STATUS_CHECKING: return copy(out, size, "License: checking");
|
|
88
|
+
case AP_STATUS_SIGNED_OUT: return copy(out, size, "License: sign in");
|
|
89
|
+
default: return copy(out, size, "License: see Options");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const char *button_label() { return AP_LICENSE_ENABLED ? "License..." : "About..."; }
|
|
94
|
+
|
|
95
|
+
} // namespace license
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Glue between the effect and the AfterPresets runtime (ap_native): license
|
|
2
|
+
// state, the Options dialog, the update notice. Keep this file: it is how
|
|
3
|
+
// buyers sign in and how updates reach them. `ap docs` has the details.
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include <cstddef>
|
|
7
|
+
|
|
8
|
+
namespace license {
|
|
9
|
+
|
|
10
|
+
// PF_Cmd_GLOBAL_SETUP / PF_Cmd_GLOBAL_SETDOWN (main thread).
|
|
11
|
+
void start();
|
|
12
|
+
void stop();
|
|
13
|
+
|
|
14
|
+
// Any thread, including render threads (lock-free): true when the frame
|
|
15
|
+
// renders without the watermark. Read it once per frame in PreRender.
|
|
16
|
+
bool unlocked();
|
|
17
|
+
|
|
18
|
+
// Effect > Options, or the status button (main thread). Shows the
|
|
19
|
+
// AfterPresets dialog: license state, Sign in / Buy / Sign out, update notice.
|
|
20
|
+
void options_dialog();
|
|
21
|
+
|
|
22
|
+
// Short text for the status button's name (at most 31 bytes), e.g.
|
|
23
|
+
// "License: active" or "Update: restart AE". UI thread.
|
|
24
|
+
void status_name(char *out, std::size_t size);
|
|
25
|
+
|
|
26
|
+
// Caption on the status button.
|
|
27
|
+
const char *button_label();
|
|
28
|
+
|
|
29
|
+
} // namespace license
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Pixel work for the starter effect: tint toward a colour, blended by mode,
|
|
2
|
+
// optionally along a gradient (centre + angle). One template serves 8, 16 and
|
|
3
|
+
// 32 bits per channel. Pure functions of their inputs, so they are safe for
|
|
4
|
+
// multi-frame rendering (After Effects renders several frames at once).
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include <cmath>
|
|
8
|
+
#include <cstddef>
|
|
9
|
+
|
|
10
|
+
struct TintParams {
|
|
11
|
+
float amount; // 0..1
|
|
12
|
+
float r, g, b; // 0..1
|
|
13
|
+
int mode; // AP_MODE_* (1-based popup value)
|
|
14
|
+
bool gradient; // fade the tint across the layer
|
|
15
|
+
float cx, cy; // gradient centre, in the pixels of the buffers below
|
|
16
|
+
float dirx, diry; // unit vector the tint grows along
|
|
17
|
+
float span; // pixels over which the gradient goes from 0 to full
|
|
18
|
+
bool watermark; // not licensed: draw stripes
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
template <typename T> inline T clampv(T v, T lo, T hi) { return v < lo ? lo : (v > hi ? hi : v); }
|
|
22
|
+
|
|
23
|
+
// Premultiplied colour channel blend. s, c in 0..1 (s premultiplied by a).
|
|
24
|
+
inline float blend(int mode, float s, float c, float a) {
|
|
25
|
+
switch (mode) {
|
|
26
|
+
case 2: return s + c * a - s * c; // Screen
|
|
27
|
+
case 3: return s * c; // Multiply
|
|
28
|
+
default: return c * a; // Tint
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// PixelT: PF_Pixel / PF_Pixel16 / PF_PixelFloat. MAXV: 255, 32768 or 1 (float, unclamped).
|
|
33
|
+
template <typename PixelT, int MAXV, bool FLOAT>
|
|
34
|
+
void tint_rows(const char *src, long src_rowbytes, char *dst, long dst_rowbytes, int width, int height,
|
|
35
|
+
const TintParams &p) {
|
|
36
|
+
const float scale = FLOAT ? 1.f : (float)MAXV;
|
|
37
|
+
for (int y = 0; y < height; ++y) {
|
|
38
|
+
const PixelT *s = (const PixelT *)(src + (std::ptrdiff_t)y * src_rowbytes);
|
|
39
|
+
PixelT *d = (PixelT *)(dst + (std::ptrdiff_t)y * dst_rowbytes);
|
|
40
|
+
for (int x = 0; x < width; ++x) {
|
|
41
|
+
const float a = s[x].alpha / scale;
|
|
42
|
+
const float sr = s[x].red / scale, sg = s[x].green / scale, sb = s[x].blue / scale;
|
|
43
|
+
float t = p.amount;
|
|
44
|
+
if (p.gradient) {
|
|
45
|
+
const float along = ((float)x - p.cx) * p.dirx + ((float)y - p.cy) * p.diry;
|
|
46
|
+
t *= clampv(0.5f + along / p.span, 0.f, 1.f);
|
|
47
|
+
}
|
|
48
|
+
float r = sr + (blend(p.mode, sr, p.r, a) - sr) * t;
|
|
49
|
+
float g = sg + (blend(p.mode, sg, p.g, a) - sg) * t;
|
|
50
|
+
float b = sb + (blend(p.mode, sb, p.b, a) - sb) * t;
|
|
51
|
+
if (p.watermark && (((x + y) / 24) & 1)) {
|
|
52
|
+
r = r * 0.5f + 0.25f * a;
|
|
53
|
+
g = g * 0.5f + 0.25f * a;
|
|
54
|
+
b = b * 0.5f + 0.25f * a;
|
|
55
|
+
}
|
|
56
|
+
d[x].alpha = s[x].alpha;
|
|
57
|
+
if (FLOAT) {
|
|
58
|
+
d[x].red = (decltype(d[x].red))r;
|
|
59
|
+
d[x].green = (decltype(d[x].green))g;
|
|
60
|
+
d[x].blue = (decltype(d[x].blue))b;
|
|
61
|
+
} else {
|
|
62
|
+
d[x].red = (decltype(d[x].red))clampv(r * scale + 0.5f, 0.f, scale);
|
|
63
|
+
d[x].green = (decltype(d[x].green))clampv(g * scale + 0.5f, 0.f, scale);
|
|
64
|
+
d[x].blue = (decltype(d[x].blue))clampv(b * scale + 0.5f, 0.f, scale);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|