mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-06 14:03:16 -05:00
Plug-ins: react to selection, layer, open and save events
A plug-in at API level 2 with the new `events` permission can name any of `selection.changed`, `document.opened`, `document.saved` and `layer.changed` in its manifest's `events` list. Its `vc_event` export is then called with a small JSON event after each change of that kind has finished, outside any undo step. Changes between two deliveries are one event. The desktop app delivers twice a frame, after the work that finished in the background and at the end of the frame after the canvas, panels and dialogs ran; control-channel requests run in the desktop app and are delivered by the frame. vectorcraft-cli and headless MCP deliver after each request. A plug-in installed after a change is not given it, and a change made after an install reaches the new plug-in at the next delivery. - A handler only reads. It may call ten commands that read (dataset.list, graphicStyle.list, guide.list, image.info, object.blend.info, swatch.list, symbol.list, text.getRange, transparency.info and variable.list); any other call fails before it runs with an error naming the event. After each call every document with its selection, current layer and undo history, the active document, the paint defaults, the active Appearance row and the preferences are put back, and a call that changed a document is refused. - A handler gets 5 M instructions and 200 ms, shared by the module's start function, `vc_alloc` and `vc_event`. A handler that fails 3 times in a row gets no more events until VectorCraft starts again. - An event raised while a handler runs waits for the next delivery. - Events carry the document number and counts; selected ids (at most 2,048) only with `doc.read`. No paths or file contents. - A save that finishes after its document closed is still reported. - A document opened or created since the last delivery is compared with its state when the command that added it ended, so the first change made to it is an event. - A waiting event is dropped for a plug-in that was removed, so the same module installed again is not given it. - The desktop app delivers the events of a script in the frame the script ends in. plugin.list and plugin.info report `events`, `eventsOff` and `lastEventError`. Docs: docs/plugins.md (Events), docs/mcp.md and one progress line in docs/target-app-parity.md. The new plug-in messages, the status lines for a failed handler and the permission's words in Install Plug-in... have rows in every complete catalog.
This commit is contained in:
1 parent
eb3a9ba335
commit
54cd14b3cd
54 files changed
+1976
-18
No files matched your search
@@ -1003,7 +1003,8 @@ fn open_loaded(
|
||||
st.import_losses = losses;
|
||||
st.links_from = read_from;
|
||||
let opened = &s.documents()[index];
|
||||
let (title, file_info_title) = (opened.title(), opened.doc.info_title().to_string());
|
||||
let (title, file_info_title, uid) = (opened.title(), opened.doc.info_title().to_string(), opened.uid);
|
||||
s.note_plugin_event(vectorcraft_plugins::Event::DocumentOpened, uid);
|
||||
Ok(super::merge(
|
||||
json!({ "index": index, "title": title, "fileInfoTitle": file_info_title, "format": format.id, "warnings": warnings, "restored": restored }),
|
||||
links.to_json(),
|
||||
|
||||
@@ -1201,6 +1201,8 @@ impl SaveJob {
|
||||
}
|
||||
if saved {
|
||||
crate::cmd::recovery::forget(s, uid);
|
||||
// Also when the document closed while its file was being written.
|
||||
s.note_plugin_event(vectorcraft_plugins::Event::DocumentSaved, uid);
|
||||
}
|
||||
if let Some(path) = written {
|
||||
if native {
|
||||
|
||||
@@ -104,6 +104,9 @@ pub fn describe(p: &Plugin) -> Value {
|
||||
if m.paint_output {
|
||||
v["paintOutput"] = json!(true);
|
||||
}
|
||||
if !m.events.is_empty() {
|
||||
v["events"] = json!(m.events);
|
||||
}
|
||||
if !m.command_allowlist.is_empty() {
|
||||
v["commandAllowlist"] = json!(m.command_allowlist);
|
||||
}
|
||||
@@ -886,6 +889,7 @@ fn install(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
s.store_disabled_plugins_in(&turn);
|
||||
}
|
||||
drop(turn);
|
||||
s.plugins_changed_for_events();
|
||||
let mut v = describe_installed(&installed);
|
||||
if !unknown.is_empty() {
|
||||
v["unknownCommands"] = json!(unknown);
|
||||
@@ -1198,12 +1202,17 @@ fn set_enabled(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
Ok(json!({"changed": changed, "saved": saved, "disabled": safe_mode::disabled().iter().map(shown_item).collect::<Vec<_>>()}))
|
||||
}
|
||||
|
||||
fn info(_: &mut Session, p: &Value) -> Result<Value> {
|
||||
fn info(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let plugin = plugin_by_id("plugin.info", p)?;
|
||||
let mut v = describe_installed(&plugin);
|
||||
v["manifest"] = serde_json::to_value(plugin.manifest()).unwrap_or(Value::Null);
|
||||
v["defaults"] = Value::Object(plugin.manifest().defaults());
|
||||
v["lastError"] = json!(effect::last_error(plugin.id()));
|
||||
if !plugin.manifest().events.is_empty() {
|
||||
let (off, last) = s.plugin_event_status(&plugin);
|
||||
v["eventsOff"] = json!(off);
|
||||
v["lastEventError"] = json!(last);
|
||||
}
|
||||
Ok(v)
|
||||
}
|
||||
|
||||
@@ -1241,6 +1250,7 @@ fn remove(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
if !stored && (!installed || !registry::remove(id)) {
|
||||
return Err(err(vectorcraft_plugins::Error::NotFound(id.into())));
|
||||
}
|
||||
s.plugins_changed_for_events();
|
||||
Ok(json!({"removed": id}))
|
||||
}
|
||||
|
||||
@@ -1270,7 +1280,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"List Plug-ins",
|
||||
[],
|
||||
None,
|
||||
"{} → {plugins: [{id, name, version, kind: \"filter\"|\"effect\"|\"exporter\"|\"importer\", author, description, params (doc), paramsSchema, effect? (the effect id of a live effect: plugin.<id>), format? and extensions? (an exporter's or importer's format id, plugin.<id>, for document.export or document.open's importer, and its file extensions), budget?: \"heavy\" (a filter that may compute for longer, see plugin.install's allowHeavy), inputs?: [\"type\"|\"image\"|\"symbolInstance\"] (the objects besides paths a filter reads, see plugin.run), size, source, permissions: [name] (what it may do: the ones its manifest lists, else the ones its kind implies; progress: it may report its progress, see Cancel and write log lines; settings: it may keep settings of its own; cache: it may keep a cache of its own; commands: a filter may run the commands its commandAllowlist names, see docs/plugins.md), commandAllowlist?: [command id] (the commands a filter with the commands permission may run while it runs, with vc_call), hash (the module's SHA-256), api (the plug-in API level it was built for, 1 or 2), paintOutput?: true (a live effect whose pieces have paints of their own, see docs/plugins.md), cacheBytes (the bytes its cache holds; see plugin.clearCache), commands?: [{id, command (its command id, plugin.<id>.<command id>, which runs it), label, params (doc), paramsSchema}] (the menu commands a filter or live effect adds)}], folder: the Additional Plug-ins Folder load report {folder, loaded, failed: [{file, error}], leftOut} | null (under automation read roots, a folder outside them is null, and a failed file and a plug-in's source outside them are named by their file name), safeMode: bool (no plug-in loads or runs, see plugin.safeMode), disabled: [{id, file, name, label}] (turned off for the next launch, see plugin.setEnabled)}",
|
||||
"{} → {plugins: [{id, name, version, kind: \"filter\"|\"effect\"|\"exporter\"|\"importer\", author, description, params (doc), paramsSchema, effect? (the effect id of a live effect: plugin.<id>), format? and extensions? (an exporter's or importer's format id, plugin.<id>, for document.export or document.open's importer, and its file extensions), budget?: \"heavy\" (a filter that may compute for longer, see plugin.install's allowHeavy), inputs?: [\"type\"|\"image\"|\"symbolInstance\"] (the objects besides paths a filter reads, see plugin.run), size, source, permissions: [name] (what it may do: the ones its manifest lists, else the ones its kind implies; progress: it may report its progress, see Cancel and write log lines; settings: it may keep settings of its own; cache: it may keep a cache of its own; commands: a filter may run the commands its commandAllowlist names, see docs/plugins.md; events: it reacts to the events it names, see events), commandAllowlist?: [command id] (the commands a filter with the commands permission may run while it runs, with vc_call), hash (the module's SHA-256), api (the plug-in API level it was built for, 1 or 2), paintOutput?: true (a live effect whose pieces have paints of their own, see docs/plugins.md), events?: [\"selection.changed\"|\"document.opened\"|\"document.saved\"|\"layer.changed\"] (the events its vc_event handler is given after each change of that kind, see docs/plugins.md), cacheBytes (the bytes its cache holds; see plugin.clearCache), commands?: [{id, command (its command id, plugin.<id>.<command id>, which runs it), label, params (doc), paramsSchema}] (the menu commands a filter or live effect adds)}], folder: the Additional Plug-ins Folder load report {folder, loaded, failed: [{file, error}], leftOut} | null (under automation read roots, a folder outside them is null, and a failed file and a plug-in's source outside them are named by their file name), safeMode: bool (no plug-in loads or runs, see plugin.safeMode), disabled: [{id, file, name, label}] (turned off for the next launch, see plugin.setEnabled)}",
|
||||
always,
|
||||
list
|
||||
),
|
||||
@@ -1279,7 +1289,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Plug-in Info",
|
||||
[],
|
||||
None,
|
||||
"{id} → plugin.list's entry plus {manifest, defaults, lastError (a live effect's last failure, null; for a live effect with paintOutput, its name and the refused field, such as objects[1].strokes[0].width)}",
|
||||
"{id} → plugin.list's entry plus {manifest, defaults, lastError (a live effect's last failure, null; for a live effect with paintOutput, its name and the refused field, such as objects[1].strokes[0].width), eventsOff? (with events: true once 3 handlers in a row failed, until the app starts again or another module is installed with its id), lastEventError? (with events: its handler's last failure, null)}",
|
||||
always,
|
||||
info
|
||||
),
|
||||
|
||||
@@ -461,6 +461,78 @@ pub(crate) fn call(s: &mut Session, run: &Calls, id: &str, args: &Value) -> std:
|
||||
Ok(value)
|
||||
}
|
||||
|
||||
/// The commands a plug-in's event handler may call ([`event_call`]), in order: each one only reads
|
||||
/// the document and returns what it found. Every other command is refused before it runs.
|
||||
pub(crate) const EVENT_READS: &[&str] = &[
|
||||
"dataset.list",
|
||||
"graphicStyle.list",
|
||||
"guide.list",
|
||||
"image.info",
|
||||
"object.blend.info",
|
||||
"swatch.list",
|
||||
"symbol.list",
|
||||
"text.getRange",
|
||||
"transparency.info",
|
||||
"variable.list",
|
||||
];
|
||||
|
||||
/// Makes call `id` with `args` from a plug-in's handler of event `event` ([`crate::plugin_events`])
|
||||
/// as [`call`] does, for a command in [`EVENT_READS`]; any other command is refused before it runs,
|
||||
/// with an error that names the event. The call runs inside [`read_only`]: every document and the
|
||||
/// session state the commands a plug-in may call change go back to how they were afterwards, and a
|
||||
/// call that changed a document, its selection, current layer or layer rows, or which document is
|
||||
/// active, is refused.
|
||||
pub(crate) fn event_call(s: &mut Session, run: &Calls, event: &str, id: &str, args: &Value) -> std::result::Result<Value, CallFailure> {
|
||||
if super::find_command(id).is_none() {
|
||||
return Err(CallFailure { code: CALL_UNKNOWN_COMMAND, why: super::params::unknown_command(id).to_string() });
|
||||
}
|
||||
if !EVENT_READS.contains(&id) {
|
||||
return Err(CallFailure { code: CALL_DENIED_COMMAND, why: format!("a {event} handler only reads: `{id}` is not a command it may call") });
|
||||
}
|
||||
let (r, changed) = read_only(s, |s| call(s, run, id, args));
|
||||
if changed {
|
||||
return Err(CallFailure { code: CALL_DENIED_COMMAND, why: format!("a {event} handler only reads: `{id}` changed the document") });
|
||||
}
|
||||
r
|
||||
}
|
||||
|
||||
/// Runs `f` and then puts every open document (its art, selection, current layer, rows and
|
||||
/// history), which document is active and the session state the commands a plug-in may call change
|
||||
/// ([`Saved`]) back to how they were → `f`'s result, and whether `f` changed a document, its
|
||||
/// selection, current layer or layer rows, opened or closed one, or changed which one is active.
|
||||
/// A document `f` changed is given a newer revision, so it redraws.
|
||||
fn read_only<R>(s: &mut Session, f: impl FnOnce(&mut Session) -> R) -> (R, bool) {
|
||||
let saved = Saved::of(s);
|
||||
let pending_paint = s.pending_paint.clone();
|
||||
let start = s.docs.clone();
|
||||
let active = s.active;
|
||||
let r = f(s);
|
||||
let now = std::mem::replace(&mut s.docs, start);
|
||||
let mut changed = s.active != active || now.len() != s.docs.len();
|
||||
for st in &mut s.docs {
|
||||
let Some(n) = now.iter().find(|d| d.uid == st.uid) else {
|
||||
changed = true;
|
||||
continue;
|
||||
};
|
||||
if n.revision != st.revision
|
||||
|| !Arc::ptr_eq(&n.doc, &st.doc)
|
||||
|| n.selection != st.selection
|
||||
|| n.active_layer != st.active_layer
|
||||
|| n.layer_rows != st.layer_rows
|
||||
{
|
||||
st.revision = st.revision.max(n.revision).saturating_add(1);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
s.active = active;
|
||||
saved.restore(s);
|
||||
s.pending_paint = pending_paint;
|
||||
if changed {
|
||||
s.sync_front_profiles();
|
||||
}
|
||||
(r, changed)
|
||||
}
|
||||
|
||||
/// Runs command `id` with `args` in `s` with no file or folder readable or writable: every path the
|
||||
/// command reaches through the checked file access ([`crate::file_access`]) is refused, whatever
|
||||
/// param carries it.
|
||||
@@ -917,4 +989,50 @@ mod tests {
|
||||
assert!(!names_key("{pathData: 1}", "path"));
|
||||
assert!(names_key("path: x", "path"));
|
||||
}
|
||||
|
||||
/// Each command an event handler may call is one a plug-in may call and one the journal does
|
||||
/// not record, listed once, in order.
|
||||
#[test]
|
||||
fn event_reads_are_reviewed_reads() {
|
||||
for id in EVENT_READS {
|
||||
let Some(spec) = crate::cmd::find_command(id) else { panic!("no command {id}") };
|
||||
assert_eq!(denied(spec), None, "{id} is refused to every plug-in");
|
||||
assert!(!spec.journal, "{id} is journaled");
|
||||
}
|
||||
assert!(EVENT_READS.windows(2).all(|w| w[0] < w[1]), "in order, once each");
|
||||
}
|
||||
|
||||
/// [`read_only`] puts back what its function changed: the document, its selection, the
|
||||
/// preferences and the paint defaults, and says that the document changed; a function that
|
||||
/// changes nothing is no change.
|
||||
#[test]
|
||||
fn read_only_puts_everything_back() {
|
||||
use serde_json::json;
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", &json!({})).unwrap();
|
||||
let id = s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 5, "height": 5})).unwrap()["id"].clone();
|
||||
s.execute("select.none", &json!({})).unwrap();
|
||||
let st = s.doc().unwrap();
|
||||
let (doc, revision, history) = (st.doc.clone(), st.revision, st.history.undo.len());
|
||||
let (prefs, paint) = (s.prefs.history_states, s.paint.clone());
|
||||
let ((), changed) = read_only(&mut s, |s| {
|
||||
s.execute("select.set", &json!({"ids": [id]})).unwrap();
|
||||
s.execute("object.move", &json!({"dx": 10, "dy": 0})).unwrap();
|
||||
s.prefs.history_states += 1;
|
||||
s.paint.stroke_width += 3.0;
|
||||
});
|
||||
assert!(changed);
|
||||
let st = s.doc().unwrap();
|
||||
assert!(Arc::ptr_eq(&st.doc, &doc), "the same document");
|
||||
assert!(st.selection.objects.is_empty(), "the selection as it was");
|
||||
assert_eq!(st.history.undo.len(), history, "no undo step");
|
||||
assert!(st.revision > revision, "a newer revision, so it redraws");
|
||||
assert_eq!((s.prefs.history_states, &s.paint), (prefs, &paint));
|
||||
let revision = st.revision;
|
||||
let ((), changed) = read_only(&mut s, |s| {
|
||||
s.execute("variable.list", &json!({})).unwrap();
|
||||
});
|
||||
assert!(!changed, "a read changes nothing");
|
||||
assert_eq!(s.doc().unwrap().revision, revision);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ pub mod guard;
|
||||
pub mod inspect;
|
||||
pub mod journal;
|
||||
pub mod link_watch;
|
||||
pub mod plugin_events;
|
||||
pub mod schemas;
|
||||
pub mod steps;
|
||||
pub mod store;
|
||||
@@ -317,6 +318,12 @@ pub struct Session {
|
||||
/// While the active tool's actions run: their commands aren't "a command from outside the
|
||||
/// tool" ([`Session::after_command`]).
|
||||
pub(crate) in_tool_actions: bool,
|
||||
/// The events plug-ins react to that wait for delivery, and how the documents were at the last
|
||||
/// check ([`plugin_events`]).
|
||||
pub(crate) plugin_events: plugin_events::PluginEvents,
|
||||
/// The frontend delivers plug-in events by the frame ([`Session::deliver_plugin_events`]). Off,
|
||||
/// each top-level command delivers them when it ends.
|
||||
pub plugin_event_frames: bool,
|
||||
/// The warnings of the previews that settling an interaction applied, while a top-level command
|
||||
/// or the tool's actions collect them ([`Session::collect_settled_warnings`]).
|
||||
settled_warnings: Option<Vec<String>>,
|
||||
|
||||
@@ -0,0 +1,515 @@
|
||||
//! Events plug-ins react to ([`vectorcraft_plugins::events`]): the session notices a changed
|
||||
//! selection, current layer or set of layers by comparing each open document with how it was at the
|
||||
//! last check, and hears of each successful open and save ([`Session::note_plugin_event`]). It then
|
||||
//! calls the `vc_event` handler of each installed plug-in whose manifest names the event, after the
|
||||
//! change has finished and outside any undo step.
|
||||
//!
|
||||
//! - A check runs after each top-level command, or when a frontend that sets
|
||||
//! [`Session::plugin_event_frames`] delivers ([`Session::deliver_plugin_events`]), by the frame.
|
||||
//! Changes between two checks are one event: a burst of selection changes is one
|
||||
//! `selection.changed` with the final selection. No check runs while an interaction is open (a
|
||||
//! drag being previewed). A document opened or created since the last check is compared with how
|
||||
//! it was when the command that added it ended ([`Session::plugin_events_see_new_documents`]).
|
||||
//! - At most [`MAX_PENDING`] events wait; past that the oldest is dropped. An event raised while a
|
||||
//! handler runs waits for the next delivery: handlers never run inside one another.
|
||||
//! - A handler only reads. The host applies nothing it returns, and it may call only the commands
|
||||
//! in [`super::cmd::plugin_call::EVENT_READS`]; any other call is refused with an error that names
|
||||
//! the event, and what a call changes is put back ([`super::cmd::plugin_call::event_call`]).
|
||||
//! - A handler that fails is reported once a streak; after
|
||||
//! [`vectorcraft_plugins::events::MAX_EVENT_FAILURES`] failures in a row the plug-in's events stop
|
||||
//! until the session ends, or until another module is installed under its id.
|
||||
//! - When no installed plug-in reacts to events, a check returns before comparing anything.
|
||||
|
||||
use std::collections::{BTreeMap, VecDeque};
|
||||
use std::sync::Arc;
|
||||
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_doc::{Document, NodeId, NodeKind, Selection};
|
||||
use vectorcraft_plugins::events::{Event, MAX_EVENT_FAILURES, MAX_EVENT_IDS};
|
||||
use vectorcraft_plugins::permissions::Permission;
|
||||
use vectorcraft_plugins::{LogLevel, Plugin, registry};
|
||||
|
||||
use crate::Session;
|
||||
|
||||
/// Most events that wait for delivery.
|
||||
pub const MAX_PENDING: usize = 32;
|
||||
|
||||
/// Most notices kept for the frontend to show; older ones are dropped.
|
||||
pub const MAX_NOTICES: usize = 64;
|
||||
|
||||
/// The reasons a `layer.changed` event gives, in the order it lists them.
|
||||
pub const LAYER_REASONS: [&str; 5] = ["current", "added", "deleted", "reordered", "options"];
|
||||
|
||||
/// A document as the last check saw it.
|
||||
struct Seen {
|
||||
uid: u64,
|
||||
doc: Arc<Document>,
|
||||
selection: Selection,
|
||||
layer: Option<NodeId>,
|
||||
}
|
||||
|
||||
/// A plug-in an event is for: its id and the hash of its module.
|
||||
type Recipient = (String, String);
|
||||
|
||||
/// The recipient `p` is.
|
||||
fn recipient(p: &Plugin) -> Recipient {
|
||||
(p.id().to_string(), p.hash().to_string())
|
||||
}
|
||||
|
||||
/// An event waiting for delivery: what changed, in which document, for `layer.changed` why, and
|
||||
/// the plug-ins it is for: those installed when it happened.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
struct Pending {
|
||||
event: Event,
|
||||
document: u64,
|
||||
reasons: Vec<&'static str>,
|
||||
to: Vec<Recipient>,
|
||||
}
|
||||
|
||||
/// One plug-in's failed handlers in a row, for the module with `hash`.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
struct Failures {
|
||||
hash: String,
|
||||
count: u32,
|
||||
disabled: bool,
|
||||
last_error: Option<String>,
|
||||
}
|
||||
|
||||
/// A line a handler wrote with `vc_log`, or a handler's failure, for the frontend to show.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Notice {
|
||||
/// The plug-in's id and name.
|
||||
pub plugin: String,
|
||||
pub name: String,
|
||||
/// The event its handler was given.
|
||||
pub event: &'static str,
|
||||
pub level: LogLevel,
|
||||
/// The text, in English for a failure.
|
||||
pub text: String,
|
||||
}
|
||||
|
||||
/// The session's plug-in event state.
|
||||
#[derive(Default)]
|
||||
pub struct PluginEvents {
|
||||
seen: Vec<Seen>,
|
||||
/// The plug-ins that reacted to events when `seen` was taken.
|
||||
seen_by: Vec<Recipient>,
|
||||
pending: VecDeque<Pending>,
|
||||
dispatching: bool,
|
||||
failures: BTreeMap<String, Failures>,
|
||||
notices: VecDeque<Notice>,
|
||||
/// The installed plug-ins that react to events, as of a registry revision.
|
||||
subscribers: Option<(u64, Vec<Arc<Plugin>>)>,
|
||||
}
|
||||
|
||||
impl PluginEvents {
|
||||
/// The installed plug-ins that react to events (none in Safe Mode).
|
||||
fn subscribers(&mut self) -> Vec<Arc<Plugin>> {
|
||||
if vectorcraft_plugins::safe_mode::active() {
|
||||
return Vec::new();
|
||||
}
|
||||
let revision = registry::revision();
|
||||
if let Some((at, subs)) = &self.subscribers
|
||||
&& *at == revision
|
||||
{
|
||||
return subs.clone();
|
||||
}
|
||||
let subs: Vec<Arc<Plugin>> = registry::list().into_iter().filter(|p| !p.manifest().events.is_empty()).collect();
|
||||
self.subscribers = Some((revision, subs.clone()));
|
||||
subs
|
||||
}
|
||||
|
||||
/// Queues `event` for document `uid`, for the plug-ins `to`. A `selection.changed` or
|
||||
/// `layer.changed` already waiting for that document takes it in (a layer event adds the new
|
||||
/// reasons to its own, and the new plug-ins to its own); past [`MAX_PENDING`] the oldest event is
|
||||
/// dropped.
|
||||
fn queue(&mut self, event: Event, uid: u64, reasons: Vec<&'static str>, to: Vec<Recipient>) {
|
||||
if matches!(event, Event::SelectionChanged | Event::LayerChanged)
|
||||
&& let Some(p) = self.pending.iter_mut().find(|p| p.event == event && p.document == uid)
|
||||
{
|
||||
for r in reasons {
|
||||
if !p.reasons.contains(&r) {
|
||||
p.reasons.push(r);
|
||||
}
|
||||
}
|
||||
p.reasons.sort_by_key(|r| LAYER_REASONS.iter().position(|x| x == r));
|
||||
for r in to {
|
||||
if !p.to.contains(&r) {
|
||||
p.to.push(r);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if self.pending.len() >= MAX_PENDING
|
||||
&& let Some(dropped) = self.pending.pop_front()
|
||||
{
|
||||
log::warn!("plug-in events: dropped a waiting {} event, past {MAX_PENDING} waiting", dropped.event.name());
|
||||
}
|
||||
self.pending.push_back(Pending { event, document: uid, reasons, to });
|
||||
}
|
||||
|
||||
fn notice(&mut self, n: Notice) {
|
||||
if self.notices.len() >= MAX_NOTICES {
|
||||
self.notices.pop_front();
|
||||
}
|
||||
self.notices.push_back(n);
|
||||
}
|
||||
|
||||
/// The failures of plug-in `p`, started again when another module was installed under its id.
|
||||
fn failures_of(&mut self, p: &Plugin) -> &mut Failures {
|
||||
let f = self.failures.entry(p.id().to_string()).or_default();
|
||||
if f.hash != p.hash() {
|
||||
*f = Failures { hash: p.hash().to_string(), ..Failures::default() };
|
||||
}
|
||||
f
|
||||
}
|
||||
}
|
||||
|
||||
/// A layer or sublayer: its id, its parent (`None` at the top), the layer itself without its
|
||||
/// contents (for comparing its options) and the ids of the rows directly in it, in order.
|
||||
type LayerRow = (NodeId, Option<NodeId>, vectorcraft_doc::Node, Vec<NodeId>);
|
||||
|
||||
/// Each layer and sublayer of `doc`, in order.
|
||||
fn layer_rows(doc: &Document) -> Vec<LayerRow> {
|
||||
let mut out = Vec::new();
|
||||
let mut stack: Vec<(&Arc<vectorcraft_doc::Node>, Option<NodeId>)> = doc.layers.iter().rev().map(|l| (l, None)).collect();
|
||||
while let Some((n, parent)) = stack.pop() {
|
||||
let NodeKind::Layer { children, .. } = &n.kind else { continue };
|
||||
stack.extend(children.iter().rev().filter(|c| c.is_layer()).map(|c| (c, Some(n.id))));
|
||||
let rows = children.iter().map(|c| c.id).collect();
|
||||
let mut bare = (**n).clone();
|
||||
if let Some(c) = bare.children_mut() {
|
||||
c.clear();
|
||||
}
|
||||
out.push((n.id, parent, bare, rows));
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Whether a layer's place among the rows beside it differs between `old` (of `before`) and `new`
|
||||
/// (of `after`), counting only the rows on both sides, so an object added or deleted next to a
|
||||
/// sublayer is not a move.
|
||||
fn layers_moved_among_rows(before: &Document, old: &[LayerRow], after: &Document, new: &[LayerRow]) -> bool {
|
||||
use std::collections::{HashMap, HashSet};
|
||||
let layers: HashSet<NodeId> = old.iter().map(|r| r.0).collect();
|
||||
let lists = |doc: &Document, rows: &[LayerRow]| {
|
||||
let mut m: HashMap<Option<NodeId>, Vec<NodeId>> = rows.iter().map(|r| (Some(r.0), r.3.clone())).collect();
|
||||
m.insert(None, doc.layers.iter().map(|l| l.id).collect());
|
||||
m
|
||||
};
|
||||
let (a, b) = (lists(before, old), lists(after, new));
|
||||
a.iter().any(|(parent, xs)| {
|
||||
let Some(ys) = b.get(parent) else { return false };
|
||||
let (in_x, in_y): (HashSet<NodeId>, HashSet<NodeId>) = (xs.iter().copied().collect(), ys.iter().copied().collect());
|
||||
let places = |list: &[NodeId], other: &HashSet<NodeId>| {
|
||||
list.iter().filter(|id| other.contains(id)).enumerate().filter(|(_, id)| layers.contains(id)).map(|(i, id)| (i, *id)).collect::<Vec<_>>()
|
||||
};
|
||||
places(xs, &in_y) != places(ys, &in_x)
|
||||
})
|
||||
}
|
||||
|
||||
/// Why the layers of `after` (with current layer `layer_after`) differ from those of `before`
|
||||
/// (with `layer_before`), in [`LAYER_REASONS`] order; empty when they don't.
|
||||
fn layer_reasons(before: &Arc<Document>, layer_before: Option<NodeId>, after: &Arc<Document>, layer_after: Option<NodeId>) -> Vec<&'static str> {
|
||||
let mut reasons = Vec::new();
|
||||
if layer_before != layer_after {
|
||||
reasons.push("current");
|
||||
}
|
||||
if Arc::ptr_eq(before, after) {
|
||||
return reasons;
|
||||
}
|
||||
let (old, new) = (layer_rows(before), layer_rows(after));
|
||||
if new.iter().any(|(id, ..)| !old.iter().any(|(o, ..)| o == id)) {
|
||||
reasons.push("added");
|
||||
}
|
||||
if old.iter().any(|(id, ..)| !new.iter().any(|(n, ..)| n == id)) {
|
||||
reasons.push("deleted");
|
||||
}
|
||||
let kept =
|
||||
|rows: &[LayerRow], other: &[LayerRow]| rows.iter().filter(|r| other.iter().any(|o| o.0 == r.0)).map(|r| (r.0, r.1)).collect::<Vec<_>>();
|
||||
if kept(&old, &new) != kept(&new, &old) || layers_moved_among_rows(before, &old, after, &new) {
|
||||
reasons.push("reordered");
|
||||
}
|
||||
if old.iter().any(|r| new.iter().any(|o| o.0 == r.0 && o.2 != r.2)) {
|
||||
reasons.push("options");
|
||||
}
|
||||
reasons
|
||||
}
|
||||
|
||||
impl Session {
|
||||
/// Hears that `event` (`document.opened` or `document.saved`) happened to document `uid`, which
|
||||
/// the next delivery hands the plug-ins that react to it. Nothing is kept when none does.
|
||||
pub(crate) fn note_plugin_event(&mut self, event: Event, uid: u64) {
|
||||
let to: Vec<Recipient> = self.plugin_events.subscribers().iter().filter(|p| p.manifest().reacts_to(event)).map(|p| recipient(p)).collect();
|
||||
if to.is_empty() {
|
||||
return;
|
||||
}
|
||||
self.plugin_events.queue(event, uid, Vec::new(), to);
|
||||
}
|
||||
|
||||
/// Compares each open document with how the last check saw it and queues the events its changes
|
||||
/// give the installed plug-ins: `selection.changed` and `layer.changed`. A document neither the
|
||||
/// last check nor [`Session::plugin_events_see_new_documents`] saw gives none, and a plug-in
|
||||
/// installed since the last check is given none: the
|
||||
/// change may have come before it. A waiting event is no longer for a plug-in that is not
|
||||
/// installed now, so a module removed and installed again is not given it. Nothing is compared
|
||||
/// while an interaction is open, nor when no plug-in reacts to events.
|
||||
fn check_plugin_events(&mut self) {
|
||||
let subs = self.plugin_events.subscribers();
|
||||
if subs.is_empty() {
|
||||
self.plugin_events.seen.clear();
|
||||
self.plugin_events.seen_by.clear();
|
||||
self.plugin_events.pending.clear();
|
||||
return;
|
||||
}
|
||||
let installed: Vec<Recipient> = subs.iter().map(|p| recipient(p)).collect();
|
||||
self.plugin_events.pending.retain_mut(|p| {
|
||||
p.to.retain(|r| installed.contains(r));
|
||||
!p.to.is_empty()
|
||||
});
|
||||
if self.docs.iter().any(|d| d.interaction.is_some()) {
|
||||
return;
|
||||
}
|
||||
let mut events = std::mem::take(&mut self.plugin_events);
|
||||
let before = std::mem::take(&mut events.seen);
|
||||
let before_by = std::mem::take(&mut events.seen_by);
|
||||
let to = |e: Event| -> Vec<Recipient> {
|
||||
subs.iter().filter(|p| p.manifest().reacts_to(e)).map(|p| recipient(p)).filter(|r| before_by.contains(r)).collect()
|
||||
};
|
||||
let (selection, layers) = (to(Event::SelectionChanged), to(Event::LayerChanged));
|
||||
let mut seen = Vec::with_capacity(self.docs.len());
|
||||
for st in &self.docs {
|
||||
if let Some(old) = before.iter().find(|s| s.uid == st.uid) {
|
||||
if !selection.is_empty() && old.selection != st.selection {
|
||||
events.queue(Event::SelectionChanged, st.uid, Vec::new(), selection.clone());
|
||||
}
|
||||
if !layers.is_empty() {
|
||||
let reasons = layer_reasons(&old.doc, old.layer, &st.doc, st.active_layer);
|
||||
if !reasons.is_empty() {
|
||||
events.queue(Event::LayerChanged, st.uid, reasons, layers.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
seen.push(Seen { uid: st.uid, doc: st.doc.clone(), selection: st.selection.clone(), layer: st.active_layer });
|
||||
}
|
||||
events.seen = seen;
|
||||
events.seen_by = subs.iter().map(|p| recipient(p)).collect();
|
||||
events.pending.retain(|p| p.event.outlives_document() || self.docs.iter().any(|d| d.uid == p.document));
|
||||
self.plugin_events = events;
|
||||
}
|
||||
|
||||
/// Checks the open documents for changes ([`Session::check_plugin_events`]) and calls the
|
||||
/// handlers of the events waiting, oldest first, one handler at a time. While a handler runs,
|
||||
/// this returns at once: what the handler's calls change waits for the next delivery.
|
||||
pub fn deliver_plugin_events(&mut self) {
|
||||
if self.plugin_events.dispatching {
|
||||
return;
|
||||
}
|
||||
self.check_plugin_events();
|
||||
if self.plugin_events.pending.is_empty() {
|
||||
return;
|
||||
}
|
||||
let subs = self.plugin_events.subscribers();
|
||||
self.plugin_events.dispatching = true;
|
||||
// The commands a handler calls run nested, never journaled; a panic in one leaves the depth
|
||||
// as it was found.
|
||||
let depth = self.depth;
|
||||
self.depth += 1;
|
||||
while let Some(p) = self.plugin_events.pending.pop_front() {
|
||||
if !p.event.outlives_document() && !self.docs.iter().any(|d| d.uid == p.document) {
|
||||
continue;
|
||||
}
|
||||
for plugin in subs.iter().filter(|s| s.manifest().reacts_to(p.event) && p.to.contains(&recipient(s))) {
|
||||
if self.plugin_events.failures_of(plugin).disabled {
|
||||
continue;
|
||||
}
|
||||
self.run_handler(plugin, &p);
|
||||
}
|
||||
}
|
||||
self.depth = depth;
|
||||
self.plugin_events.dispatching = false;
|
||||
}
|
||||
|
||||
/// The JSON event `p` as plug-in `plugin` is given it: the selected object ids of a
|
||||
/// `selection.changed` only with `doc.read`.
|
||||
fn event_json(&self, plugin: &Plugin, p: &Pending) -> Value {
|
||||
let mut v = json!({ "type": p.event.name(), "document": p.document });
|
||||
let Some(st) = self.docs.iter().find(|d| d.uid == p.document) else { return v };
|
||||
match p.event {
|
||||
Event::SelectionChanged => {
|
||||
let objects = &st.selection.objects;
|
||||
v["count"] = json!(objects.len());
|
||||
v["truncated"] = json!(false);
|
||||
v["ids"] = Value::Null;
|
||||
if plugin.manifest().permissions().contains(&Permission::DocRead) {
|
||||
v["ids"] = json!(objects.iter().take(MAX_EVENT_IDS).map(|i| i.0).collect::<Vec<_>>());
|
||||
v["truncated"] = json!(objects.len() > MAX_EVENT_IDS);
|
||||
}
|
||||
}
|
||||
Event::LayerChanged => {
|
||||
v["layer"] = json!(st.active_layer.map(|l| l.0));
|
||||
v["reasons"] = json!(p.reasons);
|
||||
}
|
||||
Event::DocumentOpened | Event::DocumentSaved => {}
|
||||
}
|
||||
v
|
||||
}
|
||||
|
||||
/// Calls `plugin`'s handler with event `p` and records what it wrote and whether it failed.
|
||||
fn run_handler(&mut self, plugin: &Arc<Plugin>, p: &Pending) {
|
||||
let event = p.event.name();
|
||||
let text = serde_json::to_vec(&self.event_json(plugin, p)).unwrap_or_default();
|
||||
let m = plugin.manifest();
|
||||
let may = m.permissions();
|
||||
let (r, report) = if may.contains(&Permission::Commands) && !m.command_allowlist.is_empty() {
|
||||
let calls = crate::cmd::plugin_call::Calls::of(self, may.contains(&Permission::DocRead), false);
|
||||
let mut bridge = |id: &str, args: &Value| crate::cmd::plugin_call::event_call(self, &calls, event, id, args);
|
||||
plugin.run_event(&text, Some(&mut bridge))
|
||||
} else {
|
||||
plugin.run_event(&text, None)
|
||||
};
|
||||
let (id, name) = (plugin.id().to_string(), m.name.clone());
|
||||
for line in report.lines {
|
||||
self.plugin_events.notice(Notice { plugin: id.clone(), name: name.clone(), event, level: line.level, text: line.text });
|
||||
}
|
||||
let failures = self.plugin_events.failures_of(plugin);
|
||||
let e = match r {
|
||||
Ok(()) => {
|
||||
failures.count = 0;
|
||||
return;
|
||||
}
|
||||
Err(e) => e.to_string(),
|
||||
};
|
||||
failures.count += 1;
|
||||
failures.last_error = Some(e.clone());
|
||||
let (count, first) = (failures.count, failures.count == 1);
|
||||
log::warn!("plug-in {id}: its {event} handler failed: {e}");
|
||||
if first {
|
||||
let text = format!("its {event} handler failed: {e}");
|
||||
self.plugin_events.notice(Notice { plugin: id.clone(), name: name.clone(), event, level: LogLevel::Error, text });
|
||||
}
|
||||
if count >= MAX_EVENT_FAILURES {
|
||||
self.plugin_events.failures_of(plugin).disabled = true;
|
||||
let text = format!("its events are off until VectorCraft starts again, after {count} failed handlers in a row");
|
||||
self.plugin_events.notice(Notice { plugin: id, name, event, level: LogLevel::Error, text });
|
||||
}
|
||||
}
|
||||
|
||||
/// Takes each open document the last check didn't see, one opened or created since, as it is
|
||||
/// now, so the next check compares it with this state: a change made to it before the next
|
||||
/// delivery gives its event. Called after each top-level command and when a document is added
|
||||
/// outside one. Nothing is kept when no plug-in reacted to events at the last check, nor for a
|
||||
/// document in an interaction.
|
||||
pub(crate) fn plugin_events_see_new_documents(&mut self) {
|
||||
if self.plugin_events.seen_by.is_empty() {
|
||||
return;
|
||||
}
|
||||
for st in &self.docs {
|
||||
if st.interaction.is_none() && !self.plugin_events.seen.iter().any(|s| s.uid == st.uid) {
|
||||
self.plugin_events.seen.push(Seen { uid: st.uid, doc: st.doc.clone(), selection: st.selection.clone(), layer: st.active_layer });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Delivers the events of a top-level command that just ended, unless the frontend delivers
|
||||
/// them once a frame ([`Session::plugin_event_frames`]) or a script is running.
|
||||
pub(crate) fn plugin_events_after_command(&mut self) {
|
||||
self.plugin_events_see_new_documents();
|
||||
if !self.plugin_event_frames && !self.script_in_run {
|
||||
self.deliver_plugin_events();
|
||||
}
|
||||
}
|
||||
|
||||
/// After a plug-in was installed or removed, compares the open documents with the last check
|
||||
/// ([`Session::check_plugin_events`]): what changed before is given only to the plug-ins that
|
||||
/// were installed then, and what changes from now on to every plug-in installed now, also
|
||||
/// before the next delivery.
|
||||
pub(crate) fn plugins_changed_for_events(&mut self) {
|
||||
if !self.plugin_events.dispatching {
|
||||
self.check_plugin_events();
|
||||
}
|
||||
}
|
||||
|
||||
/// The handlers' log lines and failures since the last call, oldest first.
|
||||
pub fn take_plugin_event_notices(&mut self) -> Vec<Notice> {
|
||||
self.plugin_events.notices.drain(..).collect()
|
||||
}
|
||||
|
||||
/// Whether this session stopped delivering events to plug-in `p` after its handlers failed, and
|
||||
/// the last failure's error.
|
||||
pub fn plugin_event_status(&self, p: &Plugin) -> (bool, Option<String>) {
|
||||
match self.plugin_events.failures.get(p.id()).filter(|f| f.hash == p.hash()) {
|
||||
Some(f) => (f.disabled, f.last_error.clone()),
|
||||
None => (false, None),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn waiting_selection_and_layer_events_of_a_document_merge() {
|
||||
let mut e = PluginEvents::default();
|
||||
e.queue(Event::SelectionChanged, 1, vec![], vec![]);
|
||||
e.queue(Event::LayerChanged, 1, vec!["options"], vec![]);
|
||||
e.queue(Event::SelectionChanged, 1, vec![], vec![]);
|
||||
e.queue(Event::LayerChanged, 1, vec!["current", "options"], vec![]);
|
||||
e.queue(Event::SelectionChanged, 2, vec![], vec![]);
|
||||
e.queue(Event::DocumentSaved, 1, vec![], vec![]);
|
||||
e.queue(Event::DocumentSaved, 1, vec![], vec![]);
|
||||
let got: Vec<(Event, u64, Vec<&str>)> = e.pending.iter().map(|p| (p.event, p.document, p.reasons.clone())).collect();
|
||||
assert_eq!(
|
||||
got,
|
||||
[
|
||||
(Event::SelectionChanged, 1, vec![]),
|
||||
(Event::LayerChanged, 1, vec!["current", "options"]),
|
||||
(Event::SelectionChanged, 2, vec![]),
|
||||
(Event::DocumentSaved, 1, vec![]),
|
||||
(Event::DocumentSaved, 1, vec![]),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/// While a handler runs, a delivery returns at once; the change waits for the next one, which
|
||||
/// hands it over once.
|
||||
#[test]
|
||||
fn an_event_raised_while_a_handler_runs_waits_for_the_next_delivery() {
|
||||
use serde_json::json;
|
||||
use vectorcraft_plugins::wat as tpl;
|
||||
let id = "test.events.nested";
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", &json!({})).unwrap();
|
||||
s.allow_plugin_grants_from_requests();
|
||||
let r = s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 5, "height": 5})).unwrap()["id"].clone();
|
||||
s.execute("select.none", &json!({})).unwrap();
|
||||
let manifest =
|
||||
format!(r#"{{"id":"{id}","name":"Test","kind":"filter","api":2,"permissions":["progress","events"],"events":["selection.changed"]}}"#);
|
||||
let wasm = wat::parse_str(tpl::reacting(&manifest, tpl::HOST_IMPORTS, tpl::LOG_EVENT)).unwrap();
|
||||
let grant = json!(["progress", "events"]);
|
||||
s.execute("plugin.install", &json!({"dataBase64": vectorcraft_format::base64_encode(&wasm), "grant": grant, "replace": true})).unwrap();
|
||||
s.plugin_event_frames = true;
|
||||
let given = |s: &mut Session| s.take_plugin_event_notices().into_iter().filter(|n| n.plugin == id).count();
|
||||
s.plugin_events.dispatching = true;
|
||||
s.execute("select.set", &json!({"ids": [r]})).unwrap();
|
||||
s.deliver_plugin_events();
|
||||
assert_eq!(given(&mut s), 0, "not inside the running handler");
|
||||
s.plugin_events.dispatching = false;
|
||||
s.deliver_plugin_events();
|
||||
assert_eq!(given(&mut s), 1);
|
||||
s.deliver_plugin_events();
|
||||
assert_eq!(given(&mut s), 0, "once");
|
||||
s.execute("plugin.remove", &json!({"id": id})).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn at_most_32_events_wait() {
|
||||
let mut e = PluginEvents::default();
|
||||
for uid in 0..(MAX_PENDING as u64 + 5) {
|
||||
e.queue(Event::DocumentOpened, uid, vec![], vec![]);
|
||||
}
|
||||
assert_eq!(e.pending.len(), MAX_PENDING);
|
||||
assert_eq!(e.pending.front().map(|p| p.document), Some(5), "the oldest are dropped");
|
||||
}
|
||||
}
|
||||
@@ -136,6 +136,8 @@ impl Session {
|
||||
screens_hand_off: None,
|
||||
recovery: Default::default(),
|
||||
in_tool_actions: false,
|
||||
plugin_events: Default::default(),
|
||||
plugin_event_frames: false,
|
||||
settled_warnings: None,
|
||||
previewing: false,
|
||||
decoded_images: Default::default(),
|
||||
@@ -365,6 +367,10 @@ impl Session {
|
||||
{
|
||||
self.begin_named_undo_group(label);
|
||||
}
|
||||
if self.depth == 0 {
|
||||
// Inside a command, this happens once the command has finished.
|
||||
self.plugin_events_see_new_documents();
|
||||
}
|
||||
i
|
||||
}
|
||||
|
||||
|
||||
@@ -249,6 +249,7 @@ impl Session {
|
||||
self.journal_in_undo_groups(doc, &grouped, journal);
|
||||
self.trim_histories();
|
||||
self.after_command(Some(id));
|
||||
self.plugin_events_after_command();
|
||||
} else if matches!(id, "edit.undo" | "edit.redo") {
|
||||
// A step of `command.batch`: the tool hears of it as it does of the command alone.
|
||||
self.notify_text_tool(id);
|
||||
|
||||
@@ -145,6 +145,7 @@ mod perspgrid;
|
||||
mod pixelalign;
|
||||
mod place;
|
||||
mod placed_document;
|
||||
mod plugin_events;
|
||||
mod plugins;
|
||||
mod prefs;
|
||||
mod prefs_file;
|
||||
|
||||
@@ -0,0 +1,459 @@
|
||||
//! Events plug-ins react to (`events`, `vc_event`): each event reaches the plug-ins that name it,
|
||||
//! once, after the change; a burst of selection changes in one frame is one event; a handler only
|
||||
//! reads; and a handler that keeps failing stops being called.
|
||||
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_plugins::LogLevel;
|
||||
use vectorcraft_plugins::wat as tpl;
|
||||
|
||||
use crate::*;
|
||||
|
||||
fn run(s: &mut Session, cmd: &str, p: Value) -> Value {
|
||||
s.execute(cmd, &p).unwrap_or_else(|e| panic!("{cmd}: {e}"))
|
||||
}
|
||||
|
||||
/// A session with a 400 × 200 document that takes `grant` from requests.
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", &json!({"width": 400, "height": 200})).unwrap();
|
||||
s.allow_plugin_grants_from_requests();
|
||||
s
|
||||
}
|
||||
|
||||
fn rect(s: &mut Session, x: f64) -> NodeId {
|
||||
NodeId(run(s, "shape.rectangle", json!({"x": x, "y": 10, "width": 10, "height": 10}))["id"].as_u64().unwrap())
|
||||
}
|
||||
|
||||
/// Installs plug-in `id` that reacts to `events` (a JSON list) with the vc_event body `handler`,
|
||||
/// writes log lines and also has the permissions `more`; `imports` are module fields its handler
|
||||
/// uses besides the host imports, and `allowlist` the commands it may call.
|
||||
fn install(s: &mut Session, id: &str, events: &str, more: &[&str], imports: &str, handler: &str, allowlist: &[&str]) {
|
||||
let mut grant = vec!["progress", "events"];
|
||||
grant.extend_from_slice(more);
|
||||
let allow = if allowlist.is_empty() { String::new() } else { format!(r#","commandAllowlist":{}"#, json!(allowlist)) };
|
||||
let manifest = format!(r#"{{"id":"{id}","name":"Test {id}","kind":"filter","api":2,"permissions":{},"events":{events}{allow}}}"#, json!(grant));
|
||||
let wasm = wat::parse_str(tpl::reacting(&manifest, &format!("{} {imports}", tpl::HOST_IMPORTS), handler)).unwrap();
|
||||
run(s, "plugin.install", json!({"dataBase64": vectorcraft_format::base64_encode(&wasm), "grant": grant, "replace": true}));
|
||||
}
|
||||
|
||||
/// The events plug-in `id`'s handler was given since the last call, as it logged them.
|
||||
fn given(s: &mut Session, id: &str) -> Vec<Value> {
|
||||
let notices = s.take_plugin_event_notices();
|
||||
notices.iter().filter(|n| n.plugin == id && n.level == LogLevel::Info).map(|n| serde_json::from_str(&n.text).unwrap()).collect()
|
||||
}
|
||||
|
||||
fn types(events: &[Value]) -> Vec<&str> {
|
||||
events.iter().map(|e| e["type"].as_str().unwrap()).collect()
|
||||
}
|
||||
|
||||
/// A selection change, a new layer, a save and an open each reach the plug-in that names them once,
|
||||
/// after the change, with the document they happened in; a plug-in that names only `document.saved`
|
||||
/// is given only the save.
|
||||
#[test]
|
||||
fn each_event_reaches_the_plugins_that_name_it_once() {
|
||||
let (all, saves) = ("test.events.all", "test.events.saves");
|
||||
let mut s = session();
|
||||
let r = rect(&mut s, 10.0);
|
||||
run(&mut s, "select.none", json!({}));
|
||||
install(&mut s, all, r#"["selection.changed","document.opened","document.saved","layer.changed"]"#, &["doc.read"], "", tpl::LOG_EVENT, &[]);
|
||||
install(&mut s, saves, r#"["document.saved"]"#, &[], "", tpl::LOG_EVENT, &[]);
|
||||
assert!(given(&mut s, all).is_empty(), "installing replays nothing");
|
||||
let doc = s.doc().unwrap().uid;
|
||||
|
||||
run(&mut s, "select.set", json!({"ids": [r.0]}));
|
||||
let notices = s.take_plugin_event_notices();
|
||||
let got: Vec<Value> = notices.iter().filter(|n| n.plugin == all).map(|n| serde_json::from_str(&n.text).unwrap()).collect();
|
||||
assert_eq!(got, [json!({"type": "selection.changed", "document": doc, "count": 1, "ids": [r.0], "truncated": false})]);
|
||||
assert!(notices.iter().all(|n| n.plugin != saves), "not named, not given");
|
||||
|
||||
run(&mut s, "select.set", json!({"ids": [r.0]}));
|
||||
assert!(given(&mut s, all).is_empty(), "the same selection again is no change");
|
||||
|
||||
let layer = run(&mut s, "layer.new", json!({"name": "Notes"}))["id"].as_u64().unwrap();
|
||||
let got = given(&mut s, all);
|
||||
assert_eq!(types(&got), ["layer.changed"]);
|
||||
assert_eq!(got[0]["layer"], json!(layer));
|
||||
assert!(got[0]["reasons"].as_array().unwrap().contains(&json!("added")), "{}", got[0]);
|
||||
|
||||
let dir = std::env::temp_dir().join(format!("vectorcraft-engine-plugin-events-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
let path = dir.join("events.vectorcraft").to_string_lossy().into_owned();
|
||||
run(&mut s, "document.save", json!({"path": path}));
|
||||
let notices = s.take_plugin_event_notices();
|
||||
for id in [all, saves] {
|
||||
let got: Vec<Value> = notices.iter().filter(|n| n.plugin == id).map(|n| serde_json::from_str(&n.text).unwrap()).collect();
|
||||
assert_eq!(got, [json!({"type": "document.saved", "document": doc})], "{id}");
|
||||
}
|
||||
|
||||
run(&mut s, "document.open", json!({"path": path}));
|
||||
let opened = s.doc().unwrap().uid;
|
||||
assert_ne!(opened, doc);
|
||||
assert_eq!(given(&mut s, all), [json!({"type": "document.opened", "document": opened})], "a new document's own selection is no change");
|
||||
|
||||
std::fs::remove_dir_all(&dir).ok();
|
||||
run(&mut s, "plugin.remove", json!({"id": all}));
|
||||
run(&mut s, "plugin.remove", json!({"id": saves}));
|
||||
}
|
||||
|
||||
/// A save of a document that closes before the frame's delivery still reaches the plug-in, with
|
||||
/// the document's number; its selection change does not. So does a save written on another thread
|
||||
/// that finishes after its document closed.
|
||||
#[test]
|
||||
fn a_save_reaches_the_plugin_when_its_document_closes_first() {
|
||||
let id = "test.events.closed";
|
||||
let mut s = session();
|
||||
let doc = s.doc().unwrap().uid;
|
||||
let r = rect(&mut s, 10.0);
|
||||
run(&mut s, "select.none", json!({}));
|
||||
install(&mut s, id, r#"["selection.changed","document.saved"]"#, &[], "", tpl::LOG_EVENT, &[]);
|
||||
s.plugin_event_frames = true;
|
||||
run(&mut s, "select.set", json!({"ids": [r.0]}));
|
||||
let dir = std::env::temp_dir().join(format!("vectorcraft-engine-plugin-events-closed-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
run(&mut s, "document.save", json!({"path": dir.join("closed.vectorcraft").to_string_lossy()}));
|
||||
run(&mut s, "file.close", json!({}));
|
||||
assert!(s.docs.iter().all(|d| d.uid != doc), "the document closed");
|
||||
s.deliver_plugin_events();
|
||||
assert_eq!(given(&mut s, id), [json!({"type": "document.saved", "document": doc})]);
|
||||
|
||||
run(&mut s, "file.new", json!({"width": 100, "height": 100}));
|
||||
let later = s.doc().unwrap().uid;
|
||||
let p = json!({"path": dir.join("later.vectorcraft").to_string_lossy()});
|
||||
let plan = crate::cmd::fileio::save_plan(&s, crate::cmd::fileio::SaveMode::SaveAs, &p).unwrap();
|
||||
let job = crate::cmd::fileio::save_job(&mut s, plan).unwrap();
|
||||
job.write(|path, bytes| std::fs::write(path, bytes).map_err(|e| EngineError::Other(e.to_string()))).unwrap();
|
||||
run(&mut s, "file.close", json!({}));
|
||||
assert!(s.docs.iter().all(|d| d.uid != later), "the document closed");
|
||||
job.complete(&mut s, later);
|
||||
s.deliver_plugin_events();
|
||||
assert_eq!(given(&mut s, id), [json!({"type": "document.saved", "document": later})]);
|
||||
std::fs::remove_dir_all(&dir).ok();
|
||||
run(&mut s, "plugin.remove", json!({"id": id}));
|
||||
}
|
||||
|
||||
/// A plug-in installed after a save or a selection change, before the frame's delivery, is given
|
||||
/// neither; the plug-in installed before is given both, and the next change reaches both.
|
||||
#[test]
|
||||
fn a_plugin_installed_before_the_delivery_gets_no_earlier_events() {
|
||||
let (early, late) = ("test.events.early", "test.events.late");
|
||||
let events = r#"["selection.changed","document.saved"]"#;
|
||||
let mut s = session();
|
||||
let doc = s.doc().unwrap().uid;
|
||||
let (a, b) = (rect(&mut s, 10.0), rect(&mut s, 40.0));
|
||||
run(&mut s, "select.none", json!({}));
|
||||
install(&mut s, early, events, &[], "", tpl::LOG_EVENT, &[]);
|
||||
s.plugin_event_frames = true;
|
||||
let dir = std::env::temp_dir().join(format!("vectorcraft-engine-plugin-events-late-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
run(&mut s, "document.save", json!({"path": dir.join("late.vectorcraft").to_string_lossy()}));
|
||||
run(&mut s, "select.set", json!({"ids": [a.0]}));
|
||||
install(&mut s, late, events, &[], "", tpl::LOG_EVENT, &[]);
|
||||
s.deliver_plugin_events();
|
||||
let notices = s.take_plugin_event_notices();
|
||||
let of = |id: &str| -> Vec<Value> { notices.iter().filter(|n| n.plugin == id).map(|n| serde_json::from_str(&n.text).unwrap()).collect() };
|
||||
assert_eq!(types(&of(early)), ["document.saved", "selection.changed"]);
|
||||
assert!(of(late).is_empty(), "{:?}", of(late));
|
||||
run(&mut s, "select.set", json!({"ids": [b.0]}));
|
||||
s.deliver_plugin_events();
|
||||
let notices = s.take_plugin_event_notices();
|
||||
for id in [early, late] {
|
||||
let got: Vec<Value> = notices.iter().filter(|n| n.plugin == id).map(|n| serde_json::from_str(&n.text).unwrap()).collect();
|
||||
assert_eq!(got, [json!({"type": "selection.changed", "document": doc, "count": 1, "ids": null, "truncated": false})], "{id}");
|
||||
}
|
||||
std::fs::remove_dir_all(&dir).ok();
|
||||
run(&mut s, "plugin.remove", json!({"id": early}));
|
||||
run(&mut s, "plugin.remove", json!({"id": late}));
|
||||
}
|
||||
|
||||
/// With delivery once a frame, a selection change made after a plug-in was installed, in the same
|
||||
/// frame, reaches it.
|
||||
#[test]
|
||||
fn a_change_after_the_install_in_the_same_frame_reaches_the_plugin() {
|
||||
let id = "test.events.same_frame";
|
||||
let mut s = session();
|
||||
let doc = s.doc().unwrap().uid;
|
||||
let r = rect(&mut s, 10.0);
|
||||
run(&mut s, "select.none", json!({}));
|
||||
s.plugin_event_frames = true;
|
||||
install(&mut s, id, r#"["selection.changed"]"#, &["doc.read"], "", tpl::LOG_EVENT, &[]);
|
||||
run(&mut s, "select.set", json!({"ids": [r.0]}));
|
||||
s.deliver_plugin_events();
|
||||
assert_eq!(given(&mut s, id), [json!({"type": "selection.changed", "document": doc, "count": 1, "ids": [r.0], "truncated": false})]);
|
||||
run(&mut s, "plugin.remove", json!({"id": id}));
|
||||
}
|
||||
|
||||
/// With delivery once a frame, a change made to a document created or opened since the last
|
||||
/// delivery gives its event at the next one; an opened document's `document.opened` comes first,
|
||||
/// once.
|
||||
#[test]
|
||||
fn a_change_to_a_document_opened_since_the_last_delivery_gives_its_event() {
|
||||
let id = "test.events.new_doc";
|
||||
let mut s = session();
|
||||
let dir = std::env::temp_dir().join(format!("vectorcraft-engine-plugin-events-new-doc-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
let path = dir.join("new-doc.vectorcraft").to_string_lossy().into_owned();
|
||||
run(&mut s, "document.save", json!({"path": path}));
|
||||
install(&mut s, id, r#"["selection.changed","document.opened","layer.changed"]"#, &["doc.read"], "", tpl::LOG_EVENT, &[]);
|
||||
s.plugin_event_frames = true;
|
||||
s.deliver_plugin_events();
|
||||
assert!(given(&mut s, id).is_empty());
|
||||
|
||||
run(&mut s, "file.new", json!({"width": 100, "height": 100}));
|
||||
let created = s.doc().unwrap().uid;
|
||||
let r = rect(&mut s, 10.0);
|
||||
run(&mut s, "select.set", json!({"ids": [r.0]}));
|
||||
s.deliver_plugin_events();
|
||||
assert_eq!(given(&mut s, id), [json!({"type": "selection.changed", "document": created, "count": 1, "ids": [r.0], "truncated": false})]);
|
||||
|
||||
run(&mut s, "document.open", json!({"path": path}));
|
||||
let opened = s.doc().unwrap().uid;
|
||||
let layer = run(&mut s, "layer.new", json!({"name": "Notes"}))["id"].as_u64().unwrap();
|
||||
s.deliver_plugin_events();
|
||||
let got = given(&mut s, id);
|
||||
assert_eq!(types(&got), ["document.opened", "layer.changed"], "{got:?}");
|
||||
assert_eq!((got[0]["document"].clone(), got[1]["document"].clone(), got[1]["layer"].clone()), (json!(opened), json!(opened), json!(layer)));
|
||||
assert!(got[1]["reasons"].as_array().unwrap().contains(&json!("added")), "{}", got[1]);
|
||||
s.deliver_plugin_events();
|
||||
assert!(given(&mut s, id).is_empty(), "once");
|
||||
std::fs::remove_dir_all(&dir).ok();
|
||||
run(&mut s, "plugin.remove", json!({"id": id}));
|
||||
}
|
||||
|
||||
/// A save waiting for delivery is not given to the same module removed and installed again before
|
||||
/// the delivery.
|
||||
#[test]
|
||||
fn a_module_installed_again_gets_no_event_from_before_its_removal() {
|
||||
let id = "test.events.again";
|
||||
let mut s = session();
|
||||
s.plugin_event_frames = true;
|
||||
install(&mut s, id, r#"["document.saved"]"#, &[], "", tpl::LOG_EVENT, &[]);
|
||||
let dir = std::env::temp_dir().join(format!("vectorcraft-engine-plugin-events-again-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
run(&mut s, "document.save", json!({"path": dir.join("again.vectorcraft").to_string_lossy()}));
|
||||
run(&mut s, "plugin.remove", json!({"id": id}));
|
||||
install(&mut s, id, r#"["document.saved"]"#, &[], "", tpl::LOG_EVENT, &[]);
|
||||
s.deliver_plugin_events();
|
||||
assert!(given(&mut s, id).is_empty(), "the save came before this install");
|
||||
std::fs::remove_dir_all(&dir).ok();
|
||||
run(&mut s, "plugin.remove", json!({"id": id}));
|
||||
}
|
||||
|
||||
/// A `selection.changed` event of a plug-in without `doc.read` gives the count and no ids; one
|
||||
/// with it lists the selected ids.
|
||||
#[test]
|
||||
fn selected_ids_need_doc_read() {
|
||||
let id = "test.events.noread";
|
||||
let mut s = session();
|
||||
let (a, b) = (rect(&mut s, 10.0), rect(&mut s, 40.0));
|
||||
install(&mut s, id, r#"["selection.changed"]"#, &[], "", tpl::LOG_EVENT, &[]);
|
||||
run(&mut s, "select.set", json!({"ids": [a.0, b.0]}));
|
||||
let got = given(&mut s, id);
|
||||
assert_eq!(got.len(), 1);
|
||||
assert_eq!((got[0]["count"].clone(), got[0]["ids"].clone()), (json!(2), Value::Null));
|
||||
run(&mut s, "plugin.remove", json!({"id": id}));
|
||||
}
|
||||
|
||||
/// With delivery once a frame, the selection changes of one frame are one event with the selection
|
||||
/// the frame ended with, and changes that end where they started are none.
|
||||
#[test]
|
||||
fn selection_changes_in_one_frame_are_one_event() {
|
||||
let id = "test.events.burst";
|
||||
let mut s = session();
|
||||
let (a, b) = (rect(&mut s, 10.0), rect(&mut s, 40.0));
|
||||
run(&mut s, "select.none", json!({}));
|
||||
install(&mut s, id, r#"["selection.changed"]"#, &["doc.read"], "", tpl::LOG_EVENT, &[]);
|
||||
s.plugin_event_frames = true;
|
||||
for ids in [vec![a.0], vec![b.0], vec![], vec![a.0, b.0], vec![b.0]] {
|
||||
run(&mut s, "select.set", json!({"ids": ids}));
|
||||
}
|
||||
assert!(given(&mut s, id).is_empty(), "nothing before the frame");
|
||||
s.deliver_plugin_events();
|
||||
let got = given(&mut s, id);
|
||||
assert_eq!(types(&got), ["selection.changed"]);
|
||||
assert_eq!(got[0]["ids"], json!([b.0]));
|
||||
run(&mut s, "select.set", json!({"ids": [a.0]}));
|
||||
run(&mut s, "select.set", json!({"ids": [b.0]}));
|
||||
s.deliver_plugin_events();
|
||||
assert!(given(&mut s, id).is_empty(), "back where the frame started");
|
||||
run(&mut s, "plugin.remove", json!({"id": id}));
|
||||
}
|
||||
|
||||
/// `layer.changed` names what changed: a new name is `options`, the same name again is no change,
|
||||
/// another current layer is `current`, a moved layer `reordered` and a deleted one `deleted`.
|
||||
#[test]
|
||||
fn layer_changes_name_their_reasons() {
|
||||
let id = "test.events.layers";
|
||||
let mut s = session();
|
||||
let first = s.doc().unwrap().active_layer.unwrap();
|
||||
let second = NodeId(run(&mut s, "layer.new", json!({"name": "Two"}))["id"].as_u64().unwrap());
|
||||
install(&mut s, id, r#"["layer.changed"]"#, &[], "", tpl::LOG_EVENT, &[]);
|
||||
let reasons = |s: &mut Session, cmd: &str, p: Value| {
|
||||
run(s, cmd, p);
|
||||
given(s, id).iter().map(|e| e["reasons"].clone()).collect::<Vec<_>>()
|
||||
};
|
||||
assert_eq!(reasons(&mut s, "layer.setProps", json!({"id": second.0, "name": "Notes"})), [json!(["options"])]);
|
||||
assert!(reasons(&mut s, "layer.setProps", json!({"id": second.0, "name": "Notes"})).is_empty(), "same name, no change");
|
||||
assert_eq!(reasons(&mut s, "layer.setCurrent", json!({"id": first.0})), [json!(["current"])]);
|
||||
assert_eq!(reasons(&mut s, "layer.move", json!({"ids": [first.0], "target": second.0, "place": "above"})), [json!(["reordered"])]);
|
||||
let deleted = reasons(&mut s, "layer.delete", json!({"ids": [second.0]}));
|
||||
assert_eq!(deleted.len(), 1);
|
||||
assert!(deleted[0].as_array().unwrap().contains(&json!("deleted")), "{deleted:?}");
|
||||
|
||||
// A sublayer moved past an object beside it is reordered; an object drawn beside it is not.
|
||||
run(&mut s, "layer.setCurrent", json!({"id": first.0}));
|
||||
given(&mut s, id);
|
||||
let sub = NodeId(run(&mut s, "layer.newSublayer", json!({"parent": first.0, "name": "Sub"}))["id"].as_u64().unwrap());
|
||||
run(&mut s, "layer.setCurrent", json!({"id": first.0}));
|
||||
given(&mut s, id);
|
||||
let r = rect(&mut s, 10.0);
|
||||
assert!(given(&mut s, id).is_empty(), "drawing beside a sublayer moves no layer");
|
||||
assert_eq!(reasons(&mut s, "layer.move", json!({"ids": [sub.0], "target": r.0, "place": "above"})), [json!(["reordered"])]);
|
||||
run(&mut s, "plugin.remove", json!({"id": id}));
|
||||
}
|
||||
|
||||
/// A handler may call a command listed for handlers, and is given its result; one that calls a
|
||||
/// command that changes the document or the current layer, or a read not listed for handlers, is
|
||||
/// refused with an error that names the event, and the selection, the current layer and the undo
|
||||
/// history stay as the user left them.
|
||||
#[test]
|
||||
fn a_handler_only_reads() {
|
||||
let (reads, edits) = ("test.events.reads", "test.events.edits");
|
||||
let (unlisted, layers) = ("test.events.unlisted", "test.events.layer");
|
||||
let mut s = session();
|
||||
let first = s.doc().unwrap().active_layer.unwrap();
|
||||
let other = run(&mut s, "layer.new", json!({"name": "Other"}))["id"].as_u64().unwrap();
|
||||
run(&mut s, "layer.setCurrent", json!({"id": first.0}));
|
||||
let (a, _) = (rect(&mut s, 10.0), rect(&mut s, 40.0));
|
||||
run(&mut s, "select.none", json!({}));
|
||||
let expected = run(&mut s, "variable.list", json!({}));
|
||||
// The read's result, copied with `vc_call_result`, is written as a log line.
|
||||
let (imports, call) = calling("variable.list", "{}");
|
||||
let imports = format!(r#"{imports} (import "env" "vc_call_result" (func $vc_call_result (param i32 i32) (result i32)))"#);
|
||||
let handler = format!(
|
||||
"(drop {call}) (drop (call $vc_log (i32.const 2) (i32.const 0x4000) (call $vc_call_result (i32.const 0x4000) (i32.const 0x4000)))) (i32.const 0)"
|
||||
);
|
||||
install(&mut s, reads, r#"["selection.changed"]"#, &["doc.read", "commands"], &imports, &handler, &["variable.list"]);
|
||||
assert!(!find_command("addon.cleanup.check").unwrap().journal, "a query the journal does not record");
|
||||
let (imports, handler) = calling("addon.cleanup.check", "{}");
|
||||
install(&mut s, unlisted, r#"["selection.changed"]"#, &["doc.read", "commands"], &imports, &handler, &["addon.cleanup.check"]);
|
||||
let (imports, handler) = calling("select.all", "{}");
|
||||
install(&mut s, edits, r#"["selection.changed"]"#, &["doc.read", "commands"], &imports, &handler, &["select.all"]);
|
||||
let (imports, handler) = calling("layer.setCurrent", &format!(r#"{{"id":{other}}}"#));
|
||||
install(&mut s, layers, r#"["selection.changed"]"#, &["doc.read", "commands"], &imports, &handler, &["layer.setCurrent"]);
|
||||
let (undo, rows) = (s.doc().unwrap().history.undo.len(), s.doc().unwrap().layer_rows.clone());
|
||||
run(&mut s, "select.set", json!({"ids": [a.0]}));
|
||||
let notices = s.take_plugin_event_notices();
|
||||
let read: Vec<Value> = notices.iter().filter(|n| n.plugin == reads).map(|n| serde_json::from_str(&n.text).unwrap()).collect();
|
||||
assert_eq!(read, [expected], "the read call succeeds and gives its result: {notices:?}");
|
||||
for (id, cmd) in [(unlisted, "addon.cleanup.check"), (edits, "select.all"), (layers, "layer.setCurrent")] {
|
||||
let failed: Vec<&str> = notices.iter().filter(|n| n.plugin == id && n.level == LogLevel::Error).map(|n| n.text.as_str()).collect();
|
||||
assert_eq!(failed.len(), 1, "{failed:?}");
|
||||
assert!(failed[0].contains(&format!("a selection.changed handler only reads: `{cmd}` is not a command it may call")), "{}", failed[0]);
|
||||
}
|
||||
let st = s.doc().unwrap();
|
||||
assert_eq!(st.selection.objects, [a], "the selection the user made");
|
||||
assert_eq!((st.active_layer, &st.layer_rows), (Some(first), &rows), "the current layer the user chose");
|
||||
assert_eq!(st.history.undo.len(), undo, "no undo step");
|
||||
let info = run(&mut s, "plugin.info", json!({"id": edits}));
|
||||
assert!(info["lastEventError"].as_str().unwrap().contains("only reads"), "{info}");
|
||||
assert_eq!(info["eventsOff"], json!(false));
|
||||
assert_eq!(info["events"], json!(["selection.changed"]));
|
||||
run(&mut s, "plugin.remove", json!({"id": reads}));
|
||||
run(&mut s, "plugin.remove", json!({"id": unlisted}));
|
||||
run(&mut s, "plugin.remove", json!({"id": edits}));
|
||||
run(&mut s, "plugin.remove", json!({"id": layers}));
|
||||
}
|
||||
|
||||
/// A handler that calls a query the journal does not record but that changes the selection (Select
|
||||
/// All Instances) is refused before the query runs: the document, its revision, selection and undo
|
||||
/// history, and the session's paint and Appearance state, are as the user left them.
|
||||
#[test]
|
||||
fn a_handler_query_that_selects_is_refused_before_it_runs() {
|
||||
let id = "test.events.selects";
|
||||
let (cmd, args) = ("symbol.selectInstances", r#"{"name":"Dot"}"#);
|
||||
assert!(!find_command(cmd).unwrap().journal, "a query the journal does not record");
|
||||
let mut s = session();
|
||||
let dot = rect(&mut s, 10.0);
|
||||
run(&mut s, "symbol.new", json!({"name": "Dot", "ids": [dot.0]}));
|
||||
let b = rect(&mut s, 40.0);
|
||||
run(&mut s, "select.none", json!({}));
|
||||
let (imports, handler) = calling(cmd, args);
|
||||
install(&mut s, id, r#"["selection.changed"]"#, &["doc.read", "commands"], &imports, &handler, &[cmd]);
|
||||
s.plugin_event_frames = true;
|
||||
run(&mut s, "select.set", json!({"ids": [b.0]}));
|
||||
let st = s.doc().unwrap();
|
||||
let (doc, revision, undo) = (st.doc.clone(), st.revision, st.history.undo.len());
|
||||
let (paint, appearance, fill_active) = (s.paint.clone(), format!("{:?}", s.active_appearance_item), s.fill_active);
|
||||
s.deliver_plugin_events();
|
||||
let notices = s.take_plugin_event_notices();
|
||||
let failed: Vec<&str> = notices.iter().filter(|n| n.plugin == id && n.level == LogLevel::Error).map(|n| n.text.as_str()).collect();
|
||||
assert_eq!(failed.len(), 1, "{notices:?}");
|
||||
assert!(failed[0].contains(&format!("a selection.changed handler only reads: `{cmd}` is not a command it may call")), "{}", failed[0]);
|
||||
let st = s.doc().unwrap();
|
||||
assert!(std::sync::Arc::ptr_eq(&st.doc, &doc), "the same document");
|
||||
assert_eq!((st.revision, st.history.undo.len()), (revision, undo), "the same revision and undo history");
|
||||
assert_eq!(st.selection.objects, [b], "the selection the user made");
|
||||
assert_eq!((&s.paint, format!("{:?}", s.active_appearance_item), s.fill_active), (&paint, appearance, fill_active));
|
||||
run(&mut s, "plugin.remove", json!({"id": id}));
|
||||
}
|
||||
|
||||
/// A refused handler call leaves the Appearance panel's active row and the Fill or Stroke in
|
||||
/// front as the user chose them, also when the query it called selected art.
|
||||
#[test]
|
||||
fn a_refused_handler_call_keeps_the_active_appearance_row() {
|
||||
let id = "test.events.appearance";
|
||||
let (cmd, args) = ("addon.cleanup.show", r#"{"kind":"duplicateObjects","scope":"document"}"#);
|
||||
assert!(!find_command(cmd).unwrap().journal, "a query the journal does not record");
|
||||
let mut s = session();
|
||||
let (a, _) = (rect(&mut s, 10.0), rect(&mut s, 10.0));
|
||||
run(&mut s, "select.set", json!({"ids": [a.0]}));
|
||||
let (imports, handler) = calling(cmd, args);
|
||||
install(&mut s, id, r#"["layer.changed"]"#, &["doc.read", "commands"], &imports, &handler, &[cmd]);
|
||||
run(&mut s, "appearance.setActiveItem", json!({"index": 0}));
|
||||
let fill_active = s.fill_active;
|
||||
run(&mut s, "layer.new", json!({"name": "Other"}));
|
||||
let notices = s.take_plugin_event_notices();
|
||||
let failed: Vec<&str> = notices.iter().filter(|n| n.plugin == id && n.level == LogLevel::Error).map(|n| n.text.as_str()).collect();
|
||||
assert_eq!(failed.len(), 1, "{notices:?}");
|
||||
assert!(failed[0].contains(&format!("a layer.changed handler only reads: `{cmd}` is not a command it may call")), "{}", failed[0]);
|
||||
assert_eq!(s.doc().unwrap().selection.objects, [a], "the selection the user made");
|
||||
assert!(s.active_appearance_item.is_some(), "the active Appearance row");
|
||||
assert_eq!(s.fill_active, fill_active);
|
||||
run(&mut s, "plugin.remove", json!({"id": id}));
|
||||
}
|
||||
|
||||
/// Module fields that import `vc_call` and hold `cmd` and `args`, and a `vc_event` body that calls
|
||||
/// `cmd` with `args` and returns what the call returned.
|
||||
fn calling(cmd: &str, args: &str) -> (String, String) {
|
||||
let imports = format!(
|
||||
r#"(import "env" "vc_call" (func $vc_call (param i32 i32 i32 i32) (result i32)))
|
||||
(data (i32.const 0x2000) "{}") (data (i32.const 0x2100) "{}")"#,
|
||||
tpl::string(cmd),
|
||||
tpl::string(args)
|
||||
);
|
||||
let handler = format!("(call $vc_call (i32.const 0x2000) (i32.const {}) (i32.const 0x2100) (i32.const {}))", cmd.len(), args.len());
|
||||
(imports, handler)
|
||||
}
|
||||
|
||||
/// A handler that fails is reported once; after three failures in a row its events stop for the
|
||||
/// session, while each selection the user makes stays.
|
||||
#[test]
|
||||
fn a_handler_that_keeps_failing_is_turned_off() {
|
||||
let id = "test.events.failing";
|
||||
let mut s = session();
|
||||
let (a, b) = (rect(&mut s, 10.0), rect(&mut s, 40.0));
|
||||
run(&mut s, "select.none", json!({}));
|
||||
install(&mut s, id, r#"["selection.changed"]"#, &[], "", "unreachable", &[]);
|
||||
let mut notices = Vec::new();
|
||||
for ids in [vec![a.0], vec![b.0], vec![a.0], vec![b.0], vec![a.0]] {
|
||||
run(&mut s, "select.set", json!({"ids": ids.clone()}));
|
||||
assert_eq!(s.doc().unwrap().selection.objects.iter().map(|i| i.0).collect::<Vec<_>>(), ids, "the user's selection stays");
|
||||
notices.extend(s.take_plugin_event_notices().into_iter().filter(|n| n.plugin == id).map(|n| n.text));
|
||||
}
|
||||
assert_eq!(notices.len(), 2, "{notices:?}");
|
||||
assert!(notices[0].starts_with("its selection.changed handler failed") && notices[0].contains("trapped"), "{}", notices[0]);
|
||||
assert!(notices[1].contains("after 3 failed handlers in a row"), "{}", notices[1]);
|
||||
let info = run(&mut s, "plugin.info", json!({"id": id}));
|
||||
assert_eq!(info["eventsOff"], json!(true));
|
||||
run(&mut s, "plugin.remove", json!({"id": id}));
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
//! Events a plug-in may react to, from plug-in API level 2 on: its manifest's `events` names them
|
||||
//! ([`Event`]) and lists the `events` permission, and the module exports
|
||||
//! `vc_event(event_ptr: i32, event_len: i32) -> i32`. After a change has finished, the host calls
|
||||
//! `vc_event` in a fresh instance with a small JSON object that names the event and the document
|
||||
//! ([`crate::Plugin::run_event`]). A handler only reads: the host applies nothing it returns, and
|
||||
//! a command call that would change a document is refused ([`crate::host`]).
|
||||
//!
|
||||
//! The limits are VectorCraft's own values: [`EVENT_FUEL`] instructions and
|
||||
//! [`EVENT_WALL_TIME_MS`] for one handler, an event of at most [`MAX_EVENT_BYTES`], and
|
||||
//! [`MAX_EVENT_IDS`] selected ids in a `selection.changed` event.
|
||||
|
||||
/// The plug-in API level that adds `events`, the `events` permission and `vc_event`.
|
||||
pub const EVENTS_API: u32 = 2;
|
||||
|
||||
/// Instructions one handler may use, or the plug-in's own budget when that is smaller.
|
||||
pub const EVENT_FUEL: u64 = 5_000_000;
|
||||
|
||||
/// Wall-clock budget of one handler, in milliseconds, or the plug-in's own when that is shorter.
|
||||
pub const EVENT_WALL_TIME_MS: u64 = 200;
|
||||
|
||||
/// Largest event JSON the host hands a handler, in bytes.
|
||||
pub const MAX_EVENT_BYTES: usize = 64 * 1024;
|
||||
|
||||
/// Most selected object ids a `selection.changed` event lists; a larger selection sends the first
|
||||
/// ones with `truncated: true` and its whole `count`. That many ids of the largest value still fit
|
||||
/// in [`MAX_EVENT_BYTES`].
|
||||
pub const MAX_EVENT_IDS: usize = 2048;
|
||||
|
||||
/// Failed handlers in a row after which the host stops calling a plug-in's handler until the app
|
||||
/// starts again.
|
||||
pub const MAX_EVENT_FAILURES: u32 = 3;
|
||||
|
||||
/// One thing a plug-in may react to.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub enum Event {
|
||||
/// The selection in a document changed: other objects, anchors or segments, or nothing.
|
||||
SelectionChanged,
|
||||
/// A file opened as a document (File › Open, a recent file, New from Template).
|
||||
DocumentOpened,
|
||||
/// A document was saved to its own file (Save, Save As).
|
||||
DocumentSaved,
|
||||
/// The current layer changed, or a layer was added, deleted, moved or given other options.
|
||||
LayerChanged,
|
||||
}
|
||||
|
||||
impl Event {
|
||||
/// Every event, in the order the docs list them.
|
||||
pub const ALL: [Event; 4] = [Event::SelectionChanged, Event::DocumentOpened, Event::DocumentSaved, Event::LayerChanged];
|
||||
|
||||
/// Its name in a manifest's `events`, which is also the event's `type`.
|
||||
pub fn name(self) -> &'static str {
|
||||
match self {
|
||||
Event::SelectionChanged => "selection.changed",
|
||||
Event::DocumentOpened => "document.opened",
|
||||
Event::DocumentSaved => "document.saved",
|
||||
Event::LayerChanged => "layer.changed",
|
||||
}
|
||||
}
|
||||
|
||||
/// The event named `name`.
|
||||
pub fn parse(name: &str) -> Option<Event> {
|
||||
Event::ALL.into_iter().find(|e| e.name() == name)
|
||||
}
|
||||
|
||||
/// Whether the event is still delivered when its document has closed before the delivery:
|
||||
/// an open or a save is, a selection or layer change is not.
|
||||
pub fn outlives_document(self) -> bool {
|
||||
matches!(self, Event::DocumentOpened | Event::DocumentSaved)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn names_round_trip() {
|
||||
for e in Event::ALL {
|
||||
assert_eq!(Event::parse(e.name()), Some(e));
|
||||
}
|
||||
assert_eq!(Event::parse("selection.change"), None);
|
||||
assert_eq!(Event::parse(""), None);
|
||||
}
|
||||
|
||||
/// A `selection.changed` event that lists the most ids, each of the largest value, fits in the
|
||||
/// largest event a handler is given.
|
||||
#[test]
|
||||
fn the_largest_selection_event_fits() {
|
||||
let ids = vec![u64::MAX; MAX_EVENT_IDS];
|
||||
let event = serde_json::json!({"type": "selection.changed", "document": u64::MAX, "count": u64::MAX, "ids": ids, "truncated": true});
|
||||
let len = serde_json::to_vec(&event).unwrap().len();
|
||||
assert!(len <= MAX_EVENT_BYTES, "{len} bytes");
|
||||
}
|
||||
}
|
||||
@@ -31,12 +31,14 @@
|
||||
//! them well: labels, units, groups, help and conditions ([`dialog`]). What a plug-in may do is
|
||||
//! the set of [`permissions`] its manifest lists, which the user approves when it is installed. A
|
||||
//! filter or a live effect may also add menu commands of its own ([`Command`]), which the host
|
||||
//! runs through `vc_run` with the command's id in `_context`.
|
||||
//! runs through `vc_run` with the command's id in `_context`. Any kind may also react to the
|
||||
//! [`events`] its manifest names, through `vc_event`, without changing the document.
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
pub mod deferred;
|
||||
pub mod dialog;
|
||||
pub mod effect;
|
||||
pub mod events;
|
||||
pub mod export;
|
||||
pub mod host;
|
||||
pub mod import;
|
||||
@@ -51,6 +53,7 @@ pub mod storage;
|
||||
pub mod wat;
|
||||
|
||||
pub use dialog::ParamUi;
|
||||
pub use events::Event;
|
||||
pub use host::{LogLevel, LogLine, Report};
|
||||
pub use manifest::{Budget, Command, InputKind, Kind, Manifest, Param, ParamSpec};
|
||||
pub use runtime::{ABI_VERSION, HEAVY_FUEL, HEAVY_WALL_TIME_MS, LARGE_FUEL, Limits, Plugin, heavy_terms};
|
||||
|
||||
@@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Map, Value, json};
|
||||
|
||||
use crate::dialog::ParamUi;
|
||||
use crate::events::{EVENTS_API, Event};
|
||||
use crate::permissions::{self, API_LEVEL, INPUTS_API, PROGRESS_API, Permission};
|
||||
use crate::{Error, Result};
|
||||
|
||||
@@ -348,6 +349,11 @@ pub struct Manifest {
|
||||
/// lists any ([`Manifest::validate`]).
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub command_allowlist: Vec<String>,
|
||||
/// The events it reacts to, by [`Event::name`]: only a module at `api` 2 or later whose
|
||||
/// `permissions` list `events` lists any, and it exports `vc_event` ([`crate::events`]). Left
|
||||
/// out or empty, it reacts to none.
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty", deserialize_with = "event_names")]
|
||||
pub events: Vec<String>,
|
||||
}
|
||||
|
||||
impl Manifest {
|
||||
@@ -383,6 +389,7 @@ impl Manifest {
|
||||
paint_output: false,
|
||||
commands: Vec::new(),
|
||||
command_allowlist: Vec::new(),
|
||||
events: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,7 +447,42 @@ impl Manifest {
|
||||
}
|
||||
self.validate_params()?;
|
||||
self.validate_commands()?;
|
||||
self.validate_allowlist()
|
||||
self.validate_allowlist()?;
|
||||
self.validate_events()
|
||||
}
|
||||
|
||||
/// `events` names each [`Event`] at most once, and a list needs `api` 2 or later and the
|
||||
/// permission `events`, which needs a list.
|
||||
fn validate_events(&self) -> Result<()> {
|
||||
for (i, name) in self.events.iter().enumerate() {
|
||||
let shown = permissions::display_text(name, permissions::MAX_SHOWN_FIELD);
|
||||
if Event::parse(name).is_none() {
|
||||
return Err(Error::Manifest(format!(
|
||||
"`events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed"
|
||||
)));
|
||||
}
|
||||
if self.events.get(..i).is_some_and(|before| before.contains(name)) {
|
||||
return Err(Error::Manifest(format!("`events` lists `{shown}` twice")));
|
||||
}
|
||||
}
|
||||
let listed = self.permissions.as_ref().is_some_and(|p| p.iter().any(|n| n == Permission::Events.name()));
|
||||
if self.events.is_empty() == listed {
|
||||
return Err(Error::Manifest("`events` needs the permission `events`, and `events` needs a list of `events`".into()));
|
||||
}
|
||||
if listed && self.api < EVENTS_API {
|
||||
return Err(Error::Manifest(format!("`events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API}")));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The events it reacts to (`events`).
|
||||
pub fn event_kinds(&self) -> Vec<Event> {
|
||||
self.events.iter().filter_map(|n| Event::parse(n)).collect()
|
||||
}
|
||||
|
||||
/// Does it react to `event`?
|
||||
pub fn reacts_to(&self, event: Event) -> bool {
|
||||
self.events.iter().any(|n| n == event.name())
|
||||
}
|
||||
|
||||
/// `commandAllowlist` lists at most [`MAX_ALLOWED_COMMANDS`] distinct command ids
|
||||
@@ -733,6 +775,17 @@ fn input_names<'de, D: serde::Deserializer<'de>>(d: D) -> std::result::Result<Ve
|
||||
}
|
||||
}
|
||||
|
||||
/// Reads `events`: a list of names (`null`: none). Anything else is an error that names the key, as
|
||||
/// [`Manifest::validate_events`] names a wrong entry.
|
||||
fn event_names<'de, D: serde::Deserializer<'de>>(d: D) -> std::result::Result<Vec<String>, D::Error> {
|
||||
let wrong = || serde::de::Error::custom("`events` must be a list of event names, such as selection.changed");
|
||||
match Value::deserialize(d)? {
|
||||
Value::Null => Ok(Vec::new()),
|
||||
Value::Array(names) => names.into_iter().map(|n| if let Value::String(s) = n { Ok(s) } else { Err(wrong()) }).collect(),
|
||||
_ => Err(wrong()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Reads the `commands` list one entry at a time from the manifest itself, so each command's
|
||||
/// `params` keep their declaration order and a repeated parameter is refused. A malformed entry
|
||||
/// is an error that names it (its id when the id comes before the fault, otherwise its place in
|
||||
@@ -1394,6 +1447,52 @@ mod tests {
|
||||
assert!(Manifest::parse(manifest(MAX_PARAMS + 1, MAX_PARAMS).as_bytes()).is_err(), "too many in all");
|
||||
}
|
||||
|
||||
/// Any kind at `api` 2 that lists the permission `events` names the events it reacts to; an
|
||||
/// unknown or repeated name, a list without the permission or the permission without a list,
|
||||
/// and a list at `api` 1 are refused, and the error names the fault.
|
||||
#[test]
|
||||
fn events_are_listed_with_their_permission_at_api_2() {
|
||||
let m = Manifest::parse(
|
||||
br#"{"id":"a","name":"x","kind":"filter","api":2,"permissions":["events"],"events":["layer.changed","selection.changed"]}"#,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(m.event_kinds(), [Event::LayerChanged, Event::SelectionChanged]);
|
||||
assert!(m.reacts_to(Event::SelectionChanged) && !m.reacts_to(Event::DocumentSaved));
|
||||
assert_eq!(m.permissions(), [Permission::Events]);
|
||||
assert_eq!(serde_json::to_value(&m).unwrap()["events"], json!(["layer.changed", "selection.changed"]));
|
||||
let effect =
|
||||
br#"{"id":"a","name":"x","kind":"effect","api":2,"permissions":["doc.read","effect.render","events"],"events":["document.saved"]}"#;
|
||||
assert_eq!(Manifest::parse(effect).unwrap().event_kinds(), [Event::DocumentSaved]);
|
||||
let importer =
|
||||
br#"{"id":"a","name":"x","kind":"importer","api":2,"extensions":["q"],"permissions":["import.read","events"],"events":["document.opened"]}"#;
|
||||
assert!(Manifest::parse(importer).is_ok());
|
||||
let plain = Manifest::parse(br#"{"id":"a","name":"x","kind":"filter","events":null}"#).unwrap();
|
||||
assert!(plain.events.is_empty() && serde_json::to_value(&plain).unwrap().get("events").is_none());
|
||||
for (bad, says) in [
|
||||
(
|
||||
r#"{"id":"a","name":"x","kind":"filter","api":2,"permissions":["events"],"events":["selection.change"]}"#,
|
||||
"unknown event `selection.change`",
|
||||
),
|
||||
(
|
||||
r#"{"id":"a","name":"x","kind":"filter","api":2,"permissions":["events"],"events":["layer.changed","layer.changed"]}"#,
|
||||
"lists `layer.changed` twice",
|
||||
),
|
||||
(r#"{"id":"a","name":"x","kind":"filter","api":2,"events":["layer.changed"]}"#, "needs the permission `events`"),
|
||||
(
|
||||
r#"{"id":"a","name":"x","kind":"filter","api":2,"permissions":["doc.read"],"events":["layer.changed"]}"#,
|
||||
"needs the permission `events`",
|
||||
),
|
||||
(r#"{"id":"a","name":"x","kind":"filter","api":2,"permissions":["events"]}"#, "needs the permission `events`"),
|
||||
(r#"{"id":"a","name":"x","kind":"filter","api":2,"permissions":["events"],"events":[]}"#, "needs the permission `events`"),
|
||||
(r#"{"id":"a","name":"x","kind":"filter","permissions":["events"],"events":["layer.changed"]}"#, "needs plug-in API level 2"),
|
||||
(r#"{"id":"a","name":"x","kind":"filter","api":2,"permissions":["events"],"events":"layer.changed"}"#, "must be a list"),
|
||||
(r#"{"id":"a","name":"x","kind":"filter","api":2,"permissions":["events"],"events":[1]}"#, "must be a list"),
|
||||
] {
|
||||
let e = Manifest::parse(bad.as_bytes()).unwrap_err().to_string();
|
||||
assert!(e.contains(says), "{bad}: {e}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_bad_manifests() {
|
||||
for bad in [
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
//! `permissions` gets the ones its kind implies ([`Permission::implied`]): what every plug-in of
|
||||
//! that kind could do before manifests listed them. `progress`, `settings`, `cache` and `commands`,
|
||||
//! which let a plug-in use the host imports of API level 2 ([`crate::host`]), are never implied: a
|
||||
//! manifest lists them.
|
||||
//! manifest lists them. Nor is `events`, which lets a plug-in of any kind react to the events its
|
||||
//! manifest names ([`crate::events`]).
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -74,10 +75,14 @@ pub enum Permission {
|
||||
/// ([`crate::host::IMPORTS`]): a filter only.
|
||||
#[serde(rename = "commands")]
|
||||
Commands,
|
||||
/// Run on its own after the changes its manifest's `events` names ([`crate::events`]), with
|
||||
/// `vc_event`: any kind.
|
||||
#[serde(rename = "events")]
|
||||
Events,
|
||||
}
|
||||
|
||||
/// Every permission this host grants, in the order prompts list them.
|
||||
pub const ALL: [Permission; 10] = [
|
||||
pub const ALL: [Permission; 11] = [
|
||||
Permission::DocRead,
|
||||
Permission::DocWrite,
|
||||
Permission::State,
|
||||
@@ -88,6 +93,7 @@ pub const ALL: [Permission; 10] = [
|
||||
Permission::Settings,
|
||||
Permission::Cache,
|
||||
Permission::Commands,
|
||||
Permission::Events,
|
||||
];
|
||||
|
||||
/// The permissions of the host imports, which any kind may list and none implies; each needs plug-in
|
||||
@@ -109,6 +115,7 @@ impl Permission {
|
||||
Permission::Settings => "settings",
|
||||
Permission::Cache => "cache",
|
||||
Permission::Commands => "commands",
|
||||
Permission::Events => "events",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,13 +137,14 @@ impl Permission {
|
||||
Permission::Settings => "Keep settings of its own",
|
||||
Permission::Cache => "Keep a cache of its own, which you can clear",
|
||||
Permission::Commands => "Run these commands",
|
||||
Permission::Events => "Run on its own when the selection, a document or a layer changes",
|
||||
}
|
||||
}
|
||||
|
||||
/// May a plug-in of `kind` that declares `commands` or not list it: one [`Permission::allowed`]
|
||||
/// gives it, or one of the host imports' ([`HOST`]), which any kind may list.
|
||||
/// gives it, one of the host imports' ([`HOST`]) or `events`, which any kind may list.
|
||||
pub fn applies(self, kind: Kind, commands: bool) -> bool {
|
||||
HOST.contains(&self) || Permission::allowed(kind, commands).contains(&self)
|
||||
self == Permission::Events || HOST.contains(&self) || Permission::allowed(kind, commands).contains(&self)
|
||||
}
|
||||
|
||||
/// The permissions a manifest of `kind` without `permissions` gets. A manifest may also list
|
||||
|
||||
@@ -219,6 +219,9 @@ fn wasm_err(e: wasmi::Error) -> Error {
|
||||
/// `vc_run(input_ptr, input_len, params_ptr, params_len) -> len << 32 | ptr` (negative: error).
|
||||
type RunArgs = (i32, i32, i32, i32);
|
||||
|
||||
/// `vc_event(event_ptr, event_len) -> 0` (anything else: the handler failed).
|
||||
type EventArgs = (i32, i32);
|
||||
|
||||
impl Plugin {
|
||||
/// Validates and loads a module: checks the ABI version, the exports and reads the manifest, and
|
||||
/// checks that each host import it asks for is one the host offers ([`crate::host::IMPORTS`])
|
||||
@@ -269,6 +272,9 @@ impl Plugin {
|
||||
// The other exports must exist with the right types.
|
||||
live.func::<i32, i32>("vc_alloc")?;
|
||||
live.func::<RunArgs, i64>("vc_run")?;
|
||||
if !p.manifest.events.is_empty() {
|
||||
live.func::<EventArgs, i32>("vc_event")?;
|
||||
}
|
||||
Ok(p)
|
||||
}
|
||||
|
||||
@@ -315,13 +321,19 @@ impl Plugin {
|
||||
/// A new instance for `run`, with the host imports of the permissions `granted` linked. When the
|
||||
/// module's start function fails, what it reported through the host imports goes to `report`.
|
||||
fn instantiate(&self, run: Run, granted: &[Permission], report: &mut Report) -> Result<Live> {
|
||||
self.instantiate_with(run, granted, report, self.limits.fuel_base)
|
||||
}
|
||||
|
||||
/// [`Plugin::instantiate`] with the start function given at most `start_fuel` instructions;
|
||||
/// the instance's store holds what it left.
|
||||
fn instantiate_with(&self, run: Run, granted: &[Permission], report: &mut Report, start_fuel: u64) -> Result<Live> {
|
||||
let limits =
|
||||
StoreLimitsBuilder::new().memory_size(self.limits.max_memory_bytes).memories(1).tables(4).table_elements(100_000).instances(1).build();
|
||||
let mut store = Store::new(&self.engine, Host { limits, run });
|
||||
store.limiter(|h| &mut h.limits);
|
||||
// The start function (if any) runs on one slice of fuel: it runs before `call` can check
|
||||
// the deadline or a cancel between slices, so a heavy budget would let it run for minutes.
|
||||
store.set_fuel(self.limits.fuel_base.min(FUEL_SLICE)).map_err(wasm_err)?;
|
||||
store.set_fuel(start_fuel.min(FUEL_SLICE)).map_err(wasm_err)?;
|
||||
let linker = host::linker(&self.engine, granted);
|
||||
let instance = match linker.instantiate_and_start(&mut store, &self.module) {
|
||||
Ok(instance) => instance,
|
||||
@@ -360,16 +372,34 @@ impl Plugin {
|
||||
params: P,
|
||||
fuel: u64,
|
||||
deadline: &Deadline,
|
||||
bridge: Option<&mut Bridge<'_>>,
|
||||
) -> Result<R> {
|
||||
let mut budget = fuel;
|
||||
self.call_budget(live, f, params, &mut budget, deadline, bridge)
|
||||
}
|
||||
|
||||
/// [`Plugin::call_with`] on at most `budget` instructions, which holds what the call left
|
||||
/// unused when it returns `Ok`, for the next call to share.
|
||||
fn call_budget<P: WasmParams, R: WasmResults>(
|
||||
&self,
|
||||
live: &mut Live,
|
||||
f: &TypedFunc<P, R>,
|
||||
params: P,
|
||||
budget: &mut u64,
|
||||
deadline: &Deadline,
|
||||
mut bridge: Option<&mut Bridge<'_>>,
|
||||
) -> Result<R> {
|
||||
let mut left = fuel;
|
||||
let mut left = *budget;
|
||||
let give = left.min(FUEL_SLICE);
|
||||
left -= give;
|
||||
live.store.set_fuel(give).map_err(wasm_err)?;
|
||||
let mut call = slice(live, &mut left, |store| f.call_resumable(store, params))?;
|
||||
loop {
|
||||
match call {
|
||||
TypedResumableCall::Finished(r) => return Ok(r),
|
||||
TypedResumableCall::Finished(r) => {
|
||||
*budget = left.saturating_add(live.store.get_fuel().map_err(wasm_err)?);
|
||||
return Ok(r);
|
||||
}
|
||||
TypedResumableCall::HostTrap(inv) => {
|
||||
if inv.host_error().downcast_ref::<host::StorageStop>().is_some() {
|
||||
return Err(stop_reason(&mut live.store));
|
||||
@@ -505,4 +535,72 @@ impl Plugin {
|
||||
}
|
||||
live.read_packed(packed, "the output", limits.max_output_bytes)
|
||||
}
|
||||
|
||||
/// Its limits for one event handler: at most [`crate::events::EVENT_FUEL`] instructions and
|
||||
/// [`crate::events::EVENT_WALL_TIME_MS`], or its own budgets when they are smaller, and every
|
||||
/// other limit as it is.
|
||||
pub fn event_limits(&self) -> Limits {
|
||||
Limits {
|
||||
fuel_base: self.limits.fuel_base.min(crate::events::EVENT_FUEL),
|
||||
wall_time_ms: self.limits.wall_time_ms.min(crate::events::EVENT_WALL_TIME_MS),
|
||||
..self.limits.clone()
|
||||
}
|
||||
}
|
||||
|
||||
/// Calls `vc_event` with `event` (the event JSON) in a fresh instance under
|
||||
/// [`Plugin::event_limits`] → `Ok` when it returned 0, and what it reported through the host
|
||||
/// imports. With `bridge`, each `vc_call` of a command its `commandAllowlist` names is made with
|
||||
/// it; a failed call fails the handler. A module that doesn't react to events, an event past
|
||||
/// [`crate::events::MAX_EVENT_BYTES`] and Safe Mode run nothing.
|
||||
pub fn run_event(&self, event: &[u8], bridge: Option<&mut Bridge<'_>>) -> (Result<()>, Report) {
|
||||
let mut report = Report::default();
|
||||
if let Err(e) = crate::safe_mode::check() {
|
||||
return (Err(e), report);
|
||||
}
|
||||
if self.manifest.events.is_empty() {
|
||||
return (Err(Error::Abi("the module reacts to no events".into())), report);
|
||||
}
|
||||
if event.len() > crate::events::MAX_EVENT_BYTES {
|
||||
let (len, max) = (event.len(), crate::events::MAX_EVENT_BYTES);
|
||||
return (Err(Error::Limit(format!("event size ({len} bytes, limit {max})"))), report);
|
||||
}
|
||||
let run = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| self.event_inner(event, &mut report, bridge)));
|
||||
(run.map_err(|_| Error::Trap("the runtime panicked".into())).and_then(|r| r), report)
|
||||
}
|
||||
|
||||
fn event_inner(&self, event: &[u8], report: &mut Report, bridge: Option<&mut Bridge<'_>>) -> Result<()> {
|
||||
let limits = self.event_limits();
|
||||
let deadline = Deadline::new(limits.wall_time_ms);
|
||||
let m = &self.manifest;
|
||||
let run = Run::new(&m.id, false, true, deadline).with_storage(crate::registry::storage(&m.id));
|
||||
let mut live = self.instantiate_with(run, &m.permissions(), report, limits.fuel_base)?;
|
||||
// The start function, `vc_alloc` and `vc_event` share the one budget.
|
||||
let mut budget = live.store.get_fuel().map_err(wasm_err)?;
|
||||
if bridge.is_some() {
|
||||
live.store.data_mut().run.allow_calls(m.command_allowlist.clone());
|
||||
}
|
||||
let out = (|| {
|
||||
let alloc: TypedFunc<i32, i32> = live.func("vc_alloc")?;
|
||||
let handler: TypedFunc<EventArgs, i32> = live.func("vc_event")?;
|
||||
let ptr = self.call_budget(&mut live, &alloc, event.len().max(1) as i32, &mut budget, &deadline, None)? as u32 as usize;
|
||||
if ptr == 0 {
|
||||
return Err(Error::Failed("vc_alloc returned 0 (out of memory)".into()));
|
||||
}
|
||||
let outside = || Error::Abi("vc_alloc returned a block outside memory".into());
|
||||
let end = ptr.checked_add(event.len()).ok_or_else(outside)?;
|
||||
live.memory.data_mut(&mut live.store).get_mut(ptr..end).ok_or_else(outside)?.copy_from_slice(event);
|
||||
let code = self.call_budget(&mut live, &handler, (ptr as i32, event.len() as i32), &mut budget, &deadline, bridge)?;
|
||||
deadline.check()?;
|
||||
if code != 0 {
|
||||
return Err(Error::Failed(format!("vc_event returned {code}")));
|
||||
}
|
||||
Ok(())
|
||||
})();
|
||||
let state = &mut live.store.data_mut().run;
|
||||
*report = std::mem::take(&mut state.report);
|
||||
match (state.call_failure.take(), out) {
|
||||
(Some(e), _) => Err(e),
|
||||
(None, out) => out,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,18 @@ pub fn module(manifest: &str, run: &str, extra: &str, pages: u32) -> String {
|
||||
/// A `vc_run` body returning the input unchanged.
|
||||
pub const ECHO: &str = "(i64.or (i64.shl (i64.extend_i32_u (local.get $il)) (i64.const 32)) (i64.extend_i32_u (local.get $in)))";
|
||||
|
||||
/// A plug-in that reacts to events ([`crate::events`]): `manifest` (JSON that lists `events`), the
|
||||
/// module fields `imports` before the others, a `vc_event` whose body is `handler` (parameters
|
||||
/// `$ep $el`, result i32) and a `vc_run` that returns its input.
|
||||
pub fn reacting(manifest: &str, imports: &str, handler: &str) -> String {
|
||||
let extra = format!(r#"{imports} (func (export "vc_event") (param $ep i32) (param $el i32) (result i32) {handler})"#);
|
||||
module(manifest, ECHO, &extra, 1)
|
||||
}
|
||||
|
||||
/// A `vc_event` body that writes the event it is given as an information log line (with
|
||||
/// [`HOST_IMPORTS`]) and returns 0.
|
||||
pub const LOG_EVENT: &str = "(drop (call $vc_log (i32.const 2) (local.get $ep) (local.get $el))) (i32.const 0)";
|
||||
|
||||
/// A plug-in that always returns `output` (whatever it is given).
|
||||
pub fn returning(manifest: &str, output: &str) -> String {
|
||||
then_returning(manifest, "", output)
|
||||
|
||||
@@ -1025,6 +1025,79 @@ fn a_plugin_reaches_only_its_own_storage() {
|
||||
registry::set_storage("test.storage.theirs", None);
|
||||
}
|
||||
|
||||
/// The manifest of an event plug-in `id` that writes log lines and reacts to `events` (JSON list).
|
||||
fn reacting_manifest(id: &str, events: &str) -> String {
|
||||
format!(r#"{{"id":"{id}","name":"Test {id}","kind":"filter","api":2,"permissions":["progress","events"],"events":{events}}}"#)
|
||||
}
|
||||
|
||||
/// A module that lists `events` needs a `vc_event` export of the right type; one that lists none
|
||||
/// may leave it out.
|
||||
#[test]
|
||||
fn an_event_plugin_exports_vc_event() {
|
||||
let manifest = reacting_manifest("test.events.export", r#"["selection.changed"]"#);
|
||||
let e = Plugin::load(&build(&tpl::reporting(&manifest, "", INPUT)), Limits::default()).unwrap_err();
|
||||
assert!(e.to_string().contains("vc_event"), "{e}");
|
||||
let wrong = format!(r#"{} (func (export "vc_event") (param i32) (result i32) (i32.const 0))"#, tpl::HOST_IMPORTS);
|
||||
let e = Plugin::load(&build(&tpl::module(&manifest, tpl::ECHO, &wrong, 1)), Limits::default()).unwrap_err();
|
||||
assert!(e.to_string().contains("vc_event"), "{e}");
|
||||
assert!(Plugin::load(&build(&tpl::reacting(&manifest, tpl::HOST_IMPORTS, tpl::LOG_EVENT)), Limits::default()).is_ok());
|
||||
assert!(Plugin::load(&ok_module(tpl::ECHO), Limits::default()).is_ok(), "no events, no vc_event");
|
||||
}
|
||||
|
||||
/// `vc_event` is given the event JSON in its own memory and returns 0; anything else, a trap and a
|
||||
/// handler past its instruction budget fail it. A module without events runs no handler.
|
||||
#[test]
|
||||
fn vc_event_is_given_the_event_and_its_code_is_checked() {
|
||||
let manifest = reacting_manifest("test.events.run", r#"["layer.changed"]"#);
|
||||
let p = Plugin::load(&build(&tpl::reacting(&manifest, tpl::HOST_IMPORTS, tpl::LOG_EVENT)), Limits::default()).unwrap();
|
||||
let event = br#"{"type":"layer.changed","document":7}"#;
|
||||
let (r, report) = p.run_event(event, None);
|
||||
r.unwrap();
|
||||
assert_eq!(report.lines.iter().map(|l| l.text.as_str()).collect::<Vec<_>>(), [std::str::from_utf8(event).unwrap()]);
|
||||
for (handler, says) in [
|
||||
("(i32.const 3)", "vc_event returned 3"),
|
||||
("unreachable", "trapped"),
|
||||
// The instruction budget, or the time budget on a loaded machine.
|
||||
("(loop $l (br $l)) (i32.const 0)", "budget"),
|
||||
] {
|
||||
let p = Plugin::load(&build(&tpl::reacting(&manifest, tpl::HOST_IMPORTS, handler)), Limits::default()).unwrap();
|
||||
let e = p.run_event(event, None).0.unwrap_err().to_string();
|
||||
assert!(e.contains(says), "{handler}: {e}");
|
||||
}
|
||||
let e = p.run_event(&vec![b' '; vectorcraft_plugins::events::MAX_EVENT_BYTES + 1], None).0.unwrap_err();
|
||||
assert!(e.to_string().contains("event size"), "{e}");
|
||||
let plain = Plugin::load(&ok_module(tpl::ECHO), Limits::default()).unwrap();
|
||||
assert!(plain.run_event(event, None).0.is_err());
|
||||
let limits = p.event_limits();
|
||||
assert_eq!((limits.fuel_base, limits.wall_time_ms), (vectorcraft_plugins::events::EVENT_FUEL, vectorcraft_plugins::events::EVENT_WALL_TIME_MS));
|
||||
}
|
||||
|
||||
/// The start function, `vc_alloc` and `vc_event` share one event budget: work that fits it in the
|
||||
/// handler alone fits it no longer when the start function has done as much first.
|
||||
#[test]
|
||||
fn a_handler_and_its_start_function_share_the_event_budget() {
|
||||
let manifest = reacting_manifest("test.events.shared", r#"["layer.changed"]"#);
|
||||
let burn = r#"(func $burn (param $k i32) (block $b (loop $l
|
||||
(br_if $b (i32.eqz (local.get $k)))
|
||||
(local.set $k (i32.sub (local.get $k) (i32.const 1)))
|
||||
(br $l))))"#;
|
||||
let plugin = |start: u32, handler: u32| {
|
||||
let imports = format!("{} {burn} (func $s (call $burn (i32.const {start}))) (start $s)", tpl::HOST_IMPORTS);
|
||||
let body = format!("(call $burn (i32.const {handler})) (i32.const 0)");
|
||||
Plugin::load(&build(&tpl::reacting(&manifest, &imports, &body)), Limits::default()).unwrap()
|
||||
};
|
||||
let event = br#"{"type":"layer.changed","document":1}"#;
|
||||
// The most loop turns, doubling, that fit the budget in the handler alone: twice as many don't.
|
||||
let mut k = 1u32 << 16;
|
||||
while plugin(0, k * 2).run_event(event, None).0.is_ok() {
|
||||
k *= 2;
|
||||
assert!(k < 1 << 30, "a handler that never runs out of its budget");
|
||||
}
|
||||
assert!(plugin(0, k).run_event(event, None).0.is_ok());
|
||||
let e = plugin(k, k).run_event(event, None).0.unwrap_err().to_string();
|
||||
assert!(e.contains("budget"), "{e}");
|
||||
}
|
||||
|
||||
/// A heavy filter installs once the user agrees, which loading a folder doesn't ask: it is skipped
|
||||
/// and reported.
|
||||
#[test]
|
||||
|
||||
@@ -55,6 +55,9 @@ impl VectorcraftApp {
|
||||
session.place_cursor_requests = true;
|
||||
// A script runs a slice per frame, so the window keeps drawing and Stop can be pressed.
|
||||
session.script_frames = true;
|
||||
// Plug-in events are delivered by the frame: after the work that finished in the
|
||||
// background, and at the end of the UI pass ([`VectorcraftApp::deliver_plugin_events`]).
|
||||
session.plugin_event_frames = true;
|
||||
let views = session.documents().iter().map(View::of).collect();
|
||||
let view_uids = session.documents().iter().map(|d| d.uid).collect();
|
||||
let known = session.documents().iter().map(|d| d.uid).collect();
|
||||
@@ -270,6 +273,25 @@ impl VectorcraftApp {
|
||||
plugin_runs::poll(self);
|
||||
trace_runs::poll(self);
|
||||
placing::poll(self);
|
||||
let _ = self.deliver_plugin_events();
|
||||
}
|
||||
|
||||
/// Hands the plug-ins that react to events the changes of this frame
|
||||
/// ([`vectorcraft_engine::Session::deliver_plugin_events`]). The last warning or error a handler
|
||||
/// wrote, or the last handler failure, shows in the status bar after the plug-in's name. → Whether
|
||||
/// the status bar shows one.
|
||||
fn deliver_plugin_events(&mut self) -> bool {
|
||||
self.session.deliver_plugin_events();
|
||||
let shown = self
|
||||
.session
|
||||
.take_plugin_event_notices()
|
||||
.into_iter()
|
||||
.rev()
|
||||
.find(|n| matches!(n.level, vectorcraft_plugins::LogLevel::Error | vectorcraft_plugins::LogLevel::Warn));
|
||||
let Some(n) = shown else { return false };
|
||||
let name = vectorcraft_plugins::permissions::display_text(&n.name, vectorcraft_plugins::permissions::MAX_SHOWN_NAME);
|
||||
self.status(format!("{name}: {}", n.text));
|
||||
true
|
||||
}
|
||||
|
||||
/// The language the UI is drawn in: the Preferences dialog's choice while it is open (so a
|
||||
@@ -362,8 +384,14 @@ impl VectorcraftApp {
|
||||
// them, even if the worker below finishes them during this same tick.
|
||||
ctx.data_mut(|d| d.insert_temp(egui::Id::unique("clipboard.pending-at-tick"), self.clipboard_publishing.is_pending()));
|
||||
screen_color::poll(self, ctx);
|
||||
let script_was_running = self.session.script_running();
|
||||
self.poll_finished_work();
|
||||
crate::script_runs::poll(self);
|
||||
if script_was_running && !self.session.script_running() {
|
||||
// The work that waited for the script, and the plug-in events its changes give, are
|
||||
// taken in the frame it ended in: no repaint is asked for once it has ended.
|
||||
self.poll_finished_work();
|
||||
}
|
||||
// A panel's, a dialog's or the text input's commit journaled in the frame before.
|
||||
crate::panels::actions::after_journaled_edit(self);
|
||||
crate::scripts_menu::poll(self, ctx);
|
||||
@@ -670,6 +698,12 @@ impl VectorcraftApp {
|
||||
// A command run by a menu, panel or dialog in this pass may have queued its text copy
|
||||
// after the UI phase's input flush. Publish it now for the same reason as there.
|
||||
self.flush_clipboard_out(&ctx);
|
||||
// What the canvas, a panel or a dialog changed in this pass reaches the plug-ins that react
|
||||
// to it now, since an idle app draws no further frame; a line a handler wrote shows in the
|
||||
// next one.
|
||||
if !self.session.script_running() && self.deliver_plugin_events() {
|
||||
ctx.request_repaint();
|
||||
}
|
||||
if opening::long_operation_busy(self) {
|
||||
ctx.set_cursor_icon(egui::CursorIcon::Progress);
|
||||
}
|
||||
|
||||
@@ -720,6 +720,7 @@ impl PluginIntField {
|
||||
paint_output: false,
|
||||
commands: Vec::new(),
|
||||
command_allowlist: Vec::new(),
|
||||
events: Vec::new(),
|
||||
};
|
||||
let mut f = PluginIntField { ctx, d: Dialog::new(plugin::KIND, json!({ "seed": start })), m, pos: egui::Pos2::ZERO };
|
||||
fn number_rect(shape: &egui::Shape, text: &str) -> Option<egui::Rect> {
|
||||
|
||||
@@ -6690,6 +6690,7 @@ axis Y Axis Y ос
|
||||
Show its progress, see Cancel and write log lines Показване на напредъка, разпознаване на отказ и записване на редове в дневника
|
||||
Keep settings of its own Съхраняване на собствени настройки
|
||||
Keep a cache of its own, which you can clear Съхраняване на собствен кеш, който можете да изчистите
|
||||
Run on its own when the selection, a document or a layer changes Изпълняване самостоятелно, когато се промени селекцията, документ или слой
|
||||
Run these commands on the document: {ids} Изпълняване на тези команди върху документа: {ids}
|
||||
Clear Plug-in Cache Изчистване на кеша на добавката
|
||||
# Actions panel: action sets (#3712).
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -6718,6 +6718,7 @@ axis Y Axis Y osa
|
||||
Show its progress, see Cancel and write log lines Prikazati napredak, prepoznati otkazivanje i zapisivati redove dnevnika
|
||||
Keep settings of its own Čuvati vlastite postavke
|
||||
Keep a cache of its own, which you can clear Čuvati vlastitu predmemoriju koju možete očistiti
|
||||
Run on its own when the selection, a document or a layer changes Pokretati se samostalno kada se promijeni odabir, dokument ili sloj
|
||||
Run these commands on the document: {ids} Izvršavati ove naredbe na dokumentu: {ids}
|
||||
Clear Plug-in Cache Očisti predmemoriju dodatka
|
||||
@msg permission `{permission}` needs plug-in API level {PROGRESS_API}: give `api` {PROGRESS_API} dozvola `{permission}` zahtijeva nivo API-ja dodataka {PROGRESS_API}: navedite `api` {PROGRESS_API}
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -7842,6 +7842,7 @@ variable-list-end {0}, {1} {0} i {1}
|
||||
Show its progress, see Cancel and write log lines Mostrar el progrés, detectar la cancel·lació i escriure línies de registre
|
||||
Keep settings of its own Desar una configuració pròpia
|
||||
Keep a cache of its own, which you can clear Desar una memòria cau pròpia, que podeu buidar
|
||||
Run on its own when the selection, a document or a layer changes Executar-se per si sol quan canvia la selecció, un document o una capa
|
||||
Run these commands on the document: {ids} Executar aquestes ordres al document: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call «{name}» inclou `{id}` a `commandAllowlist`, que un complement no pot cridar
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7873,6 +7874,15 @@ variable-list-end {0}, {1} {0} i {1}
|
||||
@msg only a filter declares `inputs` només un filtre declara `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` anomena un tipus d’objecte desconegut `{shown}`: feu servir type, image o symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` inclou `{shown}` dues vegades
|
||||
@msg `events` lists `{shown}` twice `events` inclou `{shown}` dues vegades
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` anomena un esdeveniment desconegut `{shown}`: feu servir selection.changed, document.opened, document.saved o layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` necessita el nivell d’API de complements {EVENTS_API}: indiqueu `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` necessita el permís `events`, i `events` necessita una llista d’`events`
|
||||
@msg event size ({len} bytes, limit {max}) mida de l’esdeveniment ({len} bytes, límit {max})
|
||||
@msg the module reacts to no events el mòdul no reacciona a cap esdeveniment
|
||||
@msg vc_event returned {code} vc_event ha retornat {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: el seu gestor de {event} ha fallat: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: els seus esdeveniments estan desactivats fins que VectorCraft torni a iniciar-se, després de {count} gestors fallits seguits
|
||||
@msg `inputs` needs `api` 2 or later `inputs` requereix `api` 2 o posterior
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` requereix el permís `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) pressupost de memòria (l’objecte {_1} necessita {size} bytes d’entrada, en queden {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7452,6 +7452,7 @@ axis Y Axis osa Y
|
||||
Show its progress, see Cancel and write log lines Zobrazit průběh, rozpoznat zrušení a zapisovat řádky protokolu
|
||||
Keep settings of its own Uchovávat vlastní nastavení
|
||||
Keep a cache of its own, which you can clear Uchovávat vlastní mezipaměť, kterou můžete vymazat
|
||||
Run on its own when the selection, a document or a layer changes Spouštět se samostatně, když se změní výběr, dokument nebo vrstva
|
||||
Run these commands on the document: {ids} Spouštět v dokumentu tyto příkazy: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call „{name}“ uvádí v `commandAllowlist` příkaz `{id}`, který zásuvný modul nesmí volat
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7483,6 +7484,15 @@ axis Y Axis osa Y
|
||||
@msg only a filter declares `inputs` `inputs` deklaruje pouze filtr
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` uvádí neznámý druh objektu `{shown}`: použijte type, image nebo symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` uvádí `{shown}` dvakrát
|
||||
@msg `events` lists `{shown}` twice `events` uvádí `{shown}` dvakrát
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` uvádí neznámou událost `{shown}`: použijte selection.changed, document.opened, document.saved nebo layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` vyžaduje úroveň API zásuvných modulů {EVENTS_API}: uveďte `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` potřebuje oprávnění `events` a `events` potřebuje seznam `events`
|
||||
@msg event size ({len} bytes, limit {max}) velikost události ({len} bajtů, limit {max})
|
||||
@msg the module reacts to no events modul nereaguje na žádné události
|
||||
@msg vc_event returned {code} vc_event vrátila {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: jeho obslužná rutina {event} selhala: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: jeho události jsou vypnuté, dokud se VectorCraft znovu nespustí, po {count} neúspěšných obslužných rutinách za sebou
|
||||
@msg `inputs` needs `api` 2 or later `inputs` vyžaduje `api` 2 nebo vyšší
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` vyžaduje oprávnění `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) rozpočet paměti (objekt {_1} potřebuje {size} bajtů vstupu, zbývá {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -695,6 +695,15 @@ liquify-list-end {0}, {1} {0} og {1}
|
||||
@msg only a filter declares `inputs` kun et filter angiver `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` angiver en ukendt objekttype `{shown}`: brug type, image eller symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` angiver `{shown}` to gange
|
||||
@msg `events` lists `{shown}` twice `events` angiver `{shown}` to gange
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` angiver en ukendt hændelse `{shown}`: brug selection.changed, document.opened, document.saved eller layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` kræver plug-in-API-niveau {EVENTS_API}: angiv `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` kræver tilladelsen `events`, og `events` kræver en liste `events`
|
||||
@msg event size ({len} bytes, limit {max}) hændelsesstørrelse ({len} byte, grænse {max})
|
||||
@msg the module reacts to no events modulet reagerer ikke på nogen hændelser
|
||||
@msg vc_event returned {code} vc_event returnerede {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: dens {event}-handler mislykkedes: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: dens hændelser er slået fra, indtil VectorCraft starter igen, efter {count} mislykkede handlere i træk
|
||||
@msg `inputs` needs `api` 2 or later `inputs` kræver `api` 2 eller nyere
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` kræver tilladelsen `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) hukommelsesbudget (objekt {_1} kræver {size} byte input, {left} tilbage)
|
||||
@@ -9609,6 +9618,7 @@ axis Y Axis Y-akse
|
||||
Show its progress, see Cancel and write log lines Vise sin fremdrift, se en annullering og skrive logrækker
|
||||
Keep settings of its own Gemme sine egne indstillinger
|
||||
Keep a cache of its own, which you can clear Gemme sin egen cache, som du kan rydde
|
||||
Run on its own when the selection, a document or a layer changes Køre af sig selv, når markeringen, et dokument eller et lag ændres
|
||||
Run these commands on the document: {ids} Køre disse kommandoer på dokumentet: {ids}
|
||||
Clear Plug-in Cache Ryd plug-in-cache
|
||||
# Actions panel: action sets (#3712).
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7035,6 +7035,7 @@ axis Y Axis Y-Achse
|
||||
Show its progress, see Cancel and write log lines Den Fortschritt anzeigen, ein Abbrechen erkennen und Protokollzeilen schreiben
|
||||
Keep settings of its own Eigene Einstellungen speichern
|
||||
Keep a cache of its own, which you can clear Einen eigenen Cache anlegen, den Sie leeren können
|
||||
Run on its own when the selection, a document or a layer changes Von selbst ausgeführt werden, wenn sich die Auswahl, ein Dokument oder eine Ebene ändert
|
||||
Run these commands on the document: {ids} Diese Befehle im Dokument ausführen: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call „{name}“ führt `{id}` in `commandAllowlist` auf, den ein Plug-in nicht aufrufen darf
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7066,6 +7067,15 @@ axis Y Axis Y-Achse
|
||||
@msg only a filter declares `inputs` nur ein Filter deklariert `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` nennt eine unbekannte Objektart `{shown}`: verwenden Sie type, image oder symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` führt `{shown}` doppelt auf
|
||||
@msg `events` lists `{shown}` twice `events` führt `{shown}` doppelt auf
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` nennt ein unbekanntes Ereignis `{shown}`: verwenden Sie selection.changed, document.opened, document.saved oder layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` braucht die Plug-in-API-Stufe {EVENTS_API}: Geben Sie `api` {EVENTS_API} an
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` braucht die Berechtigung `events`, und `events` braucht eine Liste `events`
|
||||
@msg event size ({len} bytes, limit {max}) Ereignisgröße ({len} Byte, Grenze {max})
|
||||
@msg the module reacts to no events das Modul reagiert auf keine Ereignisse
|
||||
@msg vc_event returned {code} vc_event hat {code} zurückgegeben
|
||||
@msg {name}: its {event} handler failed: {e} {name}: sein Handler für {event} ist fehlgeschlagen: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: seine Ereignisse sind aus, bis VectorCraft neu startet, nach {count} fehlgeschlagenen Handlern in Folge
|
||||
@msg `inputs` needs `api` 2 or later `inputs` erfordert `api` 2 oder höher
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` erfordert die Berechtigung `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) Speicherbudget (Objekt {_1} benötigt {size} Byte Eingabe, {left} verbleiben)
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7442,6 +7442,7 @@ axis Y Axis Άξονας Y
|
||||
Show its progress, see Cancel and write log lines Εμφάνιση της προόδου, αναγνώριση της ακύρωσης και εγγραφή γραμμών καταγραφής
|
||||
Keep settings of its own Διατήρηση δικών του ρυθμίσεων
|
||||
Keep a cache of its own, which you can clear Διατήρηση δικής του κρυφής μνήμης, την οποία μπορείτε να εκκαθαρίσετε
|
||||
Run on its own when the selection, a document or a layer changes Εκτέλεση από μόνο του όταν αλλάζει η επιλογή, ένα έγγραφο ή ένα επίπεδο
|
||||
Run these commands on the document: {ids} Εκτέλεση αυτών των εντολών στο έγγραφο: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call το «{name}» αναφέρει το `{id}` στο `commandAllowlist`, το οποίο ένα πρόσθετο δεν επιτρέπεται να καλέσει
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7473,6 +7474,15 @@ axis Y Axis Άξονας Y
|
||||
@msg only a filter declares `inputs` μόνο ένα φίλτρο δηλώνει `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance το `inputs` αναφέρει άγνωστο είδος αντικειμένου `{shown}`: χρησιμοποιήστε type, image ή symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice το `inputs` αναφέρει το `{shown}` δύο φορές
|
||||
@msg `events` lists `{shown}` twice το `events` αναφέρει το `{shown}` δύο φορές
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed το `events` αναφέρει άγνωστο συμβάν `{shown}`: χρησιμοποιήστε selection.changed, document.opened, document.saved ή layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} το `events` χρειάζεται το επίπεδο API προσθέτων {EVENTS_API}: δώστε `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` το `events` χρειάζεται το δικαίωμα `events`, και το `events` χρειάζεται μια λίστα `events`
|
||||
@msg event size ({len} bytes, limit {max}) μέγεθος συμβάντος ({len} byte, όριο {max})
|
||||
@msg the module reacts to no events η λειτουργική μονάδα δεν αντιδρά σε κανένα συμβάν
|
||||
@msg vc_event returned {code} η vc_event επέστρεψε {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: ο χειριστής {event} του απέτυχε: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: τα συμβάντα του είναι απενεργοποιημένα μέχρι να ξεκινήσει ξανά το VectorCraft, μετά από {count} αποτυχημένους χειριστές στη σειρά
|
||||
@msg `inputs` needs `api` 2 or later το `inputs` απαιτεί `api` 2 ή νεότερο
|
||||
@msg `inputs` needs the permission `doc.read` το `inputs` απαιτεί το δικαίωμα `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) προϋπολογισμός μνήμης (το αντικείμενο {_1} χρειάζεται {size} byte εισόδου, απομένουν {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7428,6 +7428,7 @@ axis Y Axis Eje Y
|
||||
Show its progress, see Cancel and write log lines Mostrar su progreso, detectar la cancelación y escribir líneas de registro
|
||||
Keep settings of its own Guardar una configuración propia
|
||||
Keep a cache of its own, which you can clear Guardar una caché propia, que usted puede vaciar
|
||||
Run on its own when the selection, a document or a layer changes Ejecutarse por sí solo cuando cambia la selección, un documento o una capa
|
||||
Run these commands on the document: {ids} Ejecutar estos comandos en el documento: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call “{name}” incluye `{id}` en `commandAllowlist`, que un plugin no puede llamar
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7459,6 +7460,15 @@ axis Y Axis Eje Y
|
||||
@msg only a filter declares `inputs` solo un filtro declara `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` nombra un tipo de objeto desconocido `{shown}`: use type, image o symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` incluye `{shown}` dos veces
|
||||
@msg `events` lists `{shown}` twice `events` incluye `{shown}` dos veces
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` nombra un evento desconocido `{shown}`: use selection.changed, document.opened, document.saved o layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` necesita el nivel de API de plugins {EVENTS_API}: indique `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` necesita el permiso `events`, y `events` necesita una lista de `events`
|
||||
@msg event size ({len} bytes, limit {max}) tamaño del evento ({len} bytes, límite {max})
|
||||
@msg the module reacts to no events el módulo no reacciona a ningún evento
|
||||
@msg vc_event returned {code} vc_event devolvió {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: su controlador de {event} falló: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: sus eventos están desactivados hasta que VectorCraft se inicie de nuevo, tras {count} controladores fallidos seguidos
|
||||
@msg `inputs` needs `api` 2 or later `inputs` requiere `api` 2 o posterior
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` requiere el permiso `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) presupuesto de memoria (el objeto {_1} necesita {size} bytes de entrada, quedan {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7519,6 +7519,7 @@ axis Y Axis Y-akseli
|
||||
Show its progress, see Cancel and write log lines Näyttää edistymisensä, havaita peruutuksen ja kirjoittaa lokirivejä
|
||||
Keep settings of its own Säilyttää omat asetuksensa
|
||||
Keep a cache of its own, which you can clear Säilyttää oman välimuistin, jonka voit tyhjentää
|
||||
Run on its own when the selection, a document or a layer changes Käynnistyä itsestään, kun valinta, asiakirja tai taso muuttuu
|
||||
Run these commands on the document: {ids} Suorittaa nämä komennot asiakirjassa: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call ”{name}” luettelee `commandAllowlist`-luettelossa komennon `{id}`, jota laajennus ei saa kutsua
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7550,6 +7551,15 @@ axis Y Axis Y-akseli
|
||||
@msg only a filter declares `inputs` vain suodatin voi määrittää `inputs`-avaimen
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` nimeää tuntemattoman objektilajin `{shown}`: käytä arvoa type, image tai symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` luettelee kohteen `{shown}` kahdesti
|
||||
@msg `events` lists `{shown}` twice `events` luettelee kohteen `{shown}` kahdesti
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` nimeää tuntemattoman tapahtuman `{shown}`: käytä arvoa selection.changed, document.opened, document.saved tai layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` vaatii laajennus-API:n tason {EVENTS_API}: anna `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` tarvitsee käyttöoikeuden `events`, ja `events` tarvitsee `events`-luettelon
|
||||
@msg event size ({len} bytes, limit {max}) tapahtuman koko ({len} tavua, raja {max})
|
||||
@msg the module reacts to no events moduuli ei reagoi mihinkään tapahtumaan
|
||||
@msg vc_event returned {code} vc_event palautti {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: sen {event}-käsittelijä epäonnistui: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: sen tapahtumat ovat pois päältä, kunnes VectorCraft käynnistyy uudelleen, {count} peräkkäin epäonnistuneen käsittelijän jälkeen
|
||||
@msg `inputs` needs `api` 2 or later `inputs` edellyttää `api`-tasoa 2 tai uudempaa
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` edellyttää käyttöoikeutta `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) muistibudjetti (objekti {_1} tarvitsee {size} tavua syötettä, jäljellä {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7448,6 +7448,7 @@ axis Y Axis Axe Y
|
||||
Show its progress, see Cancel and write log lines Afficher sa progression, détecter l’annulation et écrire des lignes de journal
|
||||
Keep settings of its own Conserver ses propres réglages
|
||||
Keep a cache of its own, which you can clear Conserver son propre cache, que vous pouvez vider
|
||||
Run on its own when the selection, a document or a layer changes S’exécuter de lui-même quand la sélection, un document ou un calque change
|
||||
Run these commands on the document: {ids} Exécuter ces commandes sur le document : {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call « {name} » indique `{id}` dans `commandAllowlist`, qu’un module externe ne peut pas appeler
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}` : {why}
|
||||
@@ -7480,6 +7481,15 @@ axis Y Axis Axe Y
|
||||
@msg only a filter declares `inputs` seul un filtre déclare `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` désigne un type d’objet inconnu `{shown}` : utilisez type, image ou symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` mentionne `{shown}` deux fois
|
||||
@msg `events` lists `{shown}` twice `events` mentionne `{shown}` deux fois
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` désigne un événement inconnu `{shown}`, utilisez selection.changed, document.opened, document.saved ou layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` nécessite le niveau d’API de module externe {EVENTS_API}, indiquez `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` a besoin de l’autorisation `events`, et `events` a besoin d’une liste `events`
|
||||
@msg event size ({len} bytes, limit {max}) taille de l’événement ({len} octets, limite {max})
|
||||
@msg the module reacts to no events le module ne réagit à aucun événement
|
||||
@msg vc_event returned {code} vc_event a renvoyé {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name} : son gestionnaire {event} a échoué : {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name} : ses événements sont désactivés jusqu’au prochain démarrage de VectorCraft, après {count} gestionnaires en échec d’affilée
|
||||
@msg `inputs` needs `api` 2 or later `inputs` nécessite `api` 2 ou plus
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` nécessite l’autorisation `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) budget mémoire (l’objet {_1} nécessite {size} octets d’entrée, il en reste {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2023,6 +2023,7 @@
|
||||
Keep Shared Points Together વહેંચાયેલા પોઇન્ટ સાથે રાખો
|
||||
Keep Tools Beside the Canvas ટૂલ્સ કેનવાસની બાજુમાં રાખો
|
||||
Keep a cache of its own, which you can clear તેનું પોતાનું કેશ રાખો, જે તમે સાફ કરી શકો છો
|
||||
Run on its own when the selection, a document or a layer changes પસંદગી, દસ્તાવેજ અથવા લેયર બદલાય ત્યારે આપમેળે ચાલો
|
||||
Keep a link to an image file instead of only embedding it ઇમેજ ફાઇલને ફક્ત એમ્બેડ કરવાને બદલે તેની લિંક રાખો
|
||||
Keep both sides the same width બંને બાજુ સમાન પહોળાઈ રાખો
|
||||
Keep data of its own with the document દસ્તાવેજ સાથે પોતાનો ડેટા રાખો
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 72 and column 5.
|
@@ -6636,6 +6636,7 @@ arrowhead Feather पंख
|
||||
Show its progress, see Cancel and write log lines अपनी प्रगति दिखाना, रद्द करने का अनुरोध देखना और लॉग पंक्तियाँ लिखना
|
||||
Keep settings of its own अपनी सेटिंग्स रखना
|
||||
Keep a cache of its own, which you can clear अपना कैश रखना, जिसे आप साफ़ कर सकते हैं
|
||||
Run on its own when the selection, a document or a layer changes सिलेक्शन, कोई डॉक्यूमेंट या कोई लेयर बदलने पर अपने आप चलना
|
||||
Run these commands on the document: {ids} दस्तावेज़ पर ये कमांड चलाना: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call “{name}” `commandAllowlist` में `{id}` सूचीबद्ध करता है, जिसे कोई प्लग-इन कॉल नहीं कर सकता
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -6667,6 +6668,15 @@ arrowhead Feather पंख
|
||||
@msg only a filter declares `inputs` केवल फ़िल्टर `inputs` घोषित करता है
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` में अज्ञात ऑब्जेक्ट प्रकार `{shown}` है: type, image या symbolInstance का उपयोग करें
|
||||
@msg `inputs` lists `{shown}` twice `inputs` में `{shown}` दो बार सूचीबद्ध है
|
||||
@msg `events` lists `{shown}` twice `events` में `{shown}` दो बार सूचीबद्ध है
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` में अज्ञात इवेंट `{shown}` है: selection.changed, document.opened, document.saved या layer.changed का उपयोग करें
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` के लिए प्लग-इन API स्तर {EVENTS_API} चाहिए: `api` {EVENTS_API} दें
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` को `events` अनुमति चाहिए, और `events` को `events` की सूची चाहिए
|
||||
@msg event size ({len} bytes, limit {max}) इवेंट का आकार ({len} बाइट्स, सीमा {max})
|
||||
@msg the module reacts to no events मॉड्यूल किसी भी इवेंट पर प्रतिक्रिया नहीं करता
|
||||
@msg vc_event returned {code} vc_event ने {code} लौटाया
|
||||
@msg {name}: its {event} handler failed: {e} {name}: इसका {event} हैंडलर विफल हुआ: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: लगातार {count} हैंडलर विफल होने के बाद, VectorCraft के फिर से शुरू होने तक इसके इवेंट बंद हैं
|
||||
@msg `inputs` needs `api` 2 or later `inputs` के लिए `api` 2 या बाद का स्तर आवश्यक है
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` के लिए अनुमति `doc.read` आवश्यक है
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) मेमोरी बजट (ऑब्जेक्ट {_1} को इनपुट के {size} बाइट चाहिए, {left} शेष हैं)
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7437,6 +7437,7 @@ axis Y Axis Y tengely
|
||||
Show its progress, see Cancel and write log lines Megjelenítheti az előrehaladását, észlelheti a megszakítást és naplósorokat írhat
|
||||
Keep settings of its own Saját beállításokat tárolhat
|
||||
Keep a cache of its own, which you can clear Saját gyorsítótárat tárolhat, amelyet Ön kiüríthet
|
||||
Run on its own when the selection, a document or a layer changes Magától futhat, amikor a kijelölés, egy dokumentum vagy egy réteg megváltozik
|
||||
Run these commands on the document: {ids} Ezeket a parancsokat futtathatja a dokumentumon: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call a(z) „{name}” a(z) `{id}` parancsot sorolja fel a `commandAllowlist` listában, amelyet bővítmény nem hívhat meg
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7468,6 +7469,15 @@ axis Y Axis Y tengely
|
||||
@msg only a filter declares `inputs` `inputs` kulcsot csak szűrő adhat meg
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance az `inputs` ismeretlen objektumfajtát nevez meg: `{shown}`; használja a type, image vagy symbolInstance értéket
|
||||
@msg `inputs` lists `{shown}` twice az `inputs` kétszer sorolja fel ezt: `{shown}`
|
||||
@msg `events` lists `{shown}` twice az `events` kétszer sorolja fel ezt: `{shown}`
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed az `events` ismeretlen eseményt nevez meg: `{shown}`; használja a selection.changed, document.opened, document.saved vagy layer.changed értéket
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} az `events` listához {EVENTS_API}. szintű bővítmény-API kell: adja meg az `api` {EVENTS_API} értéket
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` az `events` listához az `events` engedély szükséges, az `events` engedélyhez pedig `events` lista
|
||||
@msg event size ({len} bytes, limit {max}) esemény mérete ({len} bájt, korlát {max})
|
||||
@msg the module reacts to no events a modul egyetlen eseményre sem reagál
|
||||
@msg vc_event returned {code} a vc_event {code} értéket adott vissza
|
||||
@msg {name}: its {event} handler failed: {e} {name}: a(z) {event} kezelője sikertelen volt: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: az eseményei ki vannak kapcsolva a VectorCraft következő indításáig, {count} egymást követő sikertelen kezelő után
|
||||
@msg `inputs` needs `api` 2 or later az `inputs` használatához `api` 2 vagy újabb szükséges
|
||||
@msg `inputs` needs the permission `doc.read` az `inputs` használatához a(z) `doc.read` engedély szükséges
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) memóriakeret (a(z) {_1} objektumnak {size} bájt bemenet kell, {left} maradt)
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -577,6 +577,15 @@
|
||||
@msg only a filter declares `inputs` hanya filter yang mendeklarasikan `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` menyebut jenis objek yang tidak dikenal `{shown}`: gunakan type, image atau symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` mencantumkan `{shown}` dua kali
|
||||
@msg `events` lists `{shown}` twice `events` mencantumkan `{shown}` dua kali
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` menyebut peristiwa yang tidak dikenal `{shown}`: gunakan selection.changed, document.opened, document.saved atau layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` memerlukan API plug-in tingkat {EVENTS_API}: berikan `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` memerlukan izin `events`, dan `events` memerlukan daftar `events`
|
||||
@msg event size ({len} bytes, limit {max}) ukuran peristiwa ({len} byte, batas {max})
|
||||
@msg the module reacts to no events modul tidak bereaksi terhadap peristiwa apa pun
|
||||
@msg vc_event returned {code} vc_event mengembalikan {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: handler {event}-nya gagal: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: event-nya dimatikan hingga VectorCraft dimulai lagi, setelah {count} handler gagal berturut-turut
|
||||
@msg `inputs` needs `api` 2 or later `inputs` memerlukan `api` 2 atau lebih baru
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` memerlukan izin `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) anggaran memori (objek {_1} memerlukan {size} byte masukan, tersisa {left})
|
||||
@@ -7394,6 +7403,7 @@ axis Y Axis Sumbu Y
|
||||
Show its progress, see Cancel and write log lines Menampilkan kemajuannya, mengenali pembatalan, dan menulis baris log
|
||||
Keep settings of its own Menyimpan pengaturannya sendiri
|
||||
Keep a cache of its own, which you can clear Menyimpan cache-nya sendiri, yang dapat Anda kosongkan
|
||||
Run on its own when the selection, a document or a layer changes Berjalan sendiri saat seleksi, dokumen, atau lapisan berubah
|
||||
Run these commands on the document: {ids} Menjalankan perintah ini pada dokumen: {ids}
|
||||
Clear Plug-in Cache Kosongkan cache plug-in
|
||||
# Actions panel: action sets (#3712).
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7074,6 +7074,7 @@ axis Y Axis Asse Y
|
||||
Show its progress, see Cancel and write log lines Mostrare il proprio avanzamento, rilevare l’annullamento e scrivere righe di registro
|
||||
Keep settings of its own Conservare impostazioni proprie
|
||||
Keep a cache of its own, which you can clear Conservare una cache propria, che è possibile svuotare
|
||||
Run on its own when the selection, a document or a layer changes Eseguirsi da solo quando cambia la selezione, un documento o un livello
|
||||
Run these commands on the document: {ids} Eseguire questi comandi sul documento: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call “{name}” elenca `{id}` in `commandAllowlist`, che un plug-in non può chiamare
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7105,6 +7106,15 @@ axis Y Axis Asse Y
|
||||
@msg only a filter declares `inputs` solo un filtro dichiara `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` indica un tipo di oggetto sconosciuto `{shown}`: usa type, image o symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` elenca `{shown}` due volte
|
||||
@msg `events` lists `{shown}` twice `events` elenca `{shown}` due volte
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` indica un evento sconosciuto `{shown}`: usa selection.changed, document.opened, document.saved o layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` richiede il livello API dei plug-in {EVENTS_API}: indicare `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` richiede l’autorizzazione `events`, e `events` richiede un elenco `events`
|
||||
@msg event size ({len} bytes, limit {max}) dimensione dell’evento ({len} byte, limite {max})
|
||||
@msg the module reacts to no events il modulo non reagisce ad alcun evento
|
||||
@msg vc_event returned {code} vc_event ha restituito {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: il suo gestore di {event} non è riuscito: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: i suoi eventi sono disattivati finché VectorCraft non si riavvia, dopo {count} gestori non riusciti di fila
|
||||
@msg `inputs` needs `api` 2 or later `inputs` richiede `api` 2 o successivo
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` richiede l’autorizzazione `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) budget di memoria (l’oggetto {_1} richiede {size} byte di input, ne restano {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7149,6 +7149,7 @@ axis Y Axis Y 軸
|
||||
Show its progress, see Cancel and write log lines 進行状況の表示、キャンセルの検知、ログ行の書き込み
|
||||
Keep settings of its own 独自の設定の保持
|
||||
Keep a cache of its own, which you can clear 消去できる独自のキャッシュの保持
|
||||
Run on its own when the selection, a document or a layer changes 選択、ドキュメント、またはレイヤーが変わったときの自動実行
|
||||
Run these commands on the document: {ids} ドキュメントでのこれらのコマンドの実行: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call 「{name}」は `commandAllowlist` にプラグインが呼び出せない `{id}` を挙げています
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7180,6 +7181,15 @@ axis Y Axis Y 軸
|
||||
@msg only a filter declares `inputs` `inputs` を宣言できるのはフィルターだけです
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` に不明なオブジェクトの種類 `{shown}` があります。type、image、symbolInstance のいずれかを使ってください
|
||||
@msg `inputs` lists `{shown}` twice `inputs` に `{shown}` が 2 回指定されています
|
||||
@msg `events` lists `{shown}` twice `events` に `{shown}` が 2 回指定されています
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` に不明なイベント `{shown}` があります。selection.changed、document.opened、document.saved、layer.changed のいずれかを使ってください
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` にはプラグイン API レベル {EVENTS_API} が必要です。`api` {EVENTS_API} を指定してください
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` には権限 `events` が必要で、`events` には `events` のリストが必要です
|
||||
@msg event size ({len} bytes, limit {max}) イベントサイズ ({len} バイト、上限 {max})
|
||||
@msg the module reacts to no events このモジュールはどのイベントにも反応しません
|
||||
@msg vc_event returned {code} vc_event が {code} を返しました
|
||||
@msg {name}: its {event} handler failed: {e} {name}: {event} のハンドラーが失敗しました: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: ハンドラーが {count} 回続けて失敗したため、VectorCraft を再起動するまでイベントはオフです
|
||||
@msg `inputs` needs `api` 2 or later `inputs` には `api` 2 以上が必要です
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` には権限 `doc.read` が必要です
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) メモリ予算 (オブジェクト {_1} には {size} バイトの入力が必要ですが、残りは {left} です)
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -9555,6 +9555,7 @@ axis Y Axis Y ღერძი
|
||||
Show its progress, see Cancel and write log lines პროგრესის ჩვენება, გაუქმების შემჩნევა და ჟურნალის სტრიქონების ჩაწერა
|
||||
Keep settings of its own საკუთარი პარამეტრების შენახვა
|
||||
Keep a cache of its own, which you can clear საკუთარი ქეშის შენახვა, რომლის გასუფთავებაც შეგიძლიათ
|
||||
Run on its own when the selection, a document or a layer changes თავისით გაშვება, როცა იცვლება მონიშნული, დოკუმენტი ან შრე
|
||||
Run these commands on the document: {ids} ამ ბრძანებების გაშვება დოკუმენტზე: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call „{name}“ `commandAllowlist`-ში ასახელებს `{id}`-ს, რომლის გამოძახებაც პლაგინს არ შეუძლია
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -9586,6 +9587,15 @@ axis Y Axis Y ღერძი
|
||||
@msg only a filter declares `inputs` `inputs`-ის გამოცხადება მხოლოდ ფილტრს შეუძლია
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` უცნობ ობიექტის სახეობას ასახელებს `{shown}`: გამოიყენეთ type, image ან symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs`-ში `{shown}` ორჯერაა ჩამოთვლილი
|
||||
@msg `events` lists `{shown}` twice `events`-ში `{shown}` ორჯერაა ჩამოთვლილი
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` უცნობ მოვლენას ასახელებს `{shown}`: გამოიყენეთ selection.changed, document.opened, document.saved ან layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events`-ს სჭირდება პლაგინის API-ის დონე {EVENTS_API}: მიუთითეთ `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events`-ს სჭირდება ნებართვა `events`, ხოლო `events`-ს სჭირდება `events`-ის სია
|
||||
@msg event size ({len} bytes, limit {max}) მოვლენის ზომა ({len} ბაიტი, ლიმიტი {max})
|
||||
@msg the module reacts to no events მოდული არცერთ მოვლენაზე არ რეაგირებს
|
||||
@msg vc_event returned {code} vc_event-მა დააბრუნა {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: მისი {event} დამმუშავებელი ვერ შესრულდა: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: მისი მოვლენები გამორთულია VectorCraft-ის ხელახლა გაშვებამდე, ზედიზედ {count} წარუმატებელი დამმუშავებლის შემდეგ
|
||||
@msg `inputs` needs `api` 2 or later `inputs`-ს სჭირდება `api` 2 ან უფრო ახალი
|
||||
@msg `inputs` needs the permission `doc.read` `inputs`-ს სჭირდება ნებართვა `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) მეხსიერების ბიუჯეტი (ობიექტს {_1} სჭირდება შეყვანის {size} ბაიტი, დარჩენილია {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7046,6 +7046,7 @@ axis Y Axis Y축
|
||||
Show its progress, see Cancel and write log lines 진행률 표시, 취소 감지 및 로그 줄 쓰기
|
||||
Keep settings of its own 자체 설정 보관
|
||||
Keep a cache of its own, which you can clear 지울 수 있는 자체 캐시 보관
|
||||
Run on its own when the selection, a document or a layer changes 선택 영역, 문서 또는 레이어가 바뀔 때 자동 실행
|
||||
Run these commands on the document: {ids} 문서에서 다음 명령 실행: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call “{name}”의 `commandAllowlist`에 플러그인이 호출할 수 없는 `{id}`가 있습니다
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7077,6 +7078,15 @@ axis Y Axis Y축
|
||||
@msg only a filter declares `inputs` 필터만 `inputs`를 선언할 수 있습니다
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs`에 알 수 없는 개체 종류 `{shown}`이(가) 있습니다. type, image 또는 symbolInstance를 사용하세요
|
||||
@msg `inputs` lists `{shown}` twice `inputs`에 `{shown}`이(가) 두 번 나열되어 있습니다
|
||||
@msg `events` lists `{shown}` twice `events`에 `{shown}`이(가) 두 번 나열되어 있습니다
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events`에 알 수 없는 이벤트 `{shown}`이(가) 있습니다. selection.changed, document.opened, document.saved 또는 layer.changed를 사용하세요
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events`에는 플러그인 API 수준 {EVENTS_API}이(가) 필요합니다. `api` {EVENTS_API}을(를) 지정하십시오
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events`에는 `events` 권한이 필요하고, `events`에는 `events` 목록이 필요합니다
|
||||
@msg event size ({len} bytes, limit {max}) 이벤트 크기({len}바이트, 제한 {max})
|
||||
@msg the module reacts to no events 이 모듈은 어떤 이벤트에도 반응하지 않습니다
|
||||
@msg vc_event returned {code} vc_event가 {code}을(를) 반환했습니다
|
||||
@msg {name}: its {event} handler failed: {e} {name}: {event} 처리기가 실패했습니다: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: 처리기가 {count}번 연속 실패하여 VectorCraft를 다시 시작할 때까지 이벤트가 꺼집니다
|
||||
@msg `inputs` needs `api` 2 or later `inputs`에는 `api` 2 이상이 필요합니다
|
||||
@msg `inputs` needs the permission `doc.read` `inputs`에는 `doc.read` 권한이 필요합니다
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) 메모리 예산(개체 {_1}에 입력 {size}바이트가 필요하지만 {left}바이트 남음)
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -541,6 +541,15 @@ liquify-list-end {0}, {1} {0} en {1}
|
||||
@msg only a filter declares `inputs` alleen een filter declareert `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` noemt een onbekend objectsoort `{shown}`: gebruik type, image of symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` noemt `{shown}` twee keer
|
||||
@msg `events` lists `{shown}` twice `events` noemt `{shown}` twee keer
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` noemt een onbekende gebeurtenis `{shown}`: gebruik selection.changed, document.opened, document.saved of layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` vereist plug-in-API-niveau {EVENTS_API}: geef `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` vereist de machtiging `events`, en `events` vereist een lijst `events`
|
||||
@msg event size ({len} bytes, limit {max}) gebeurtenisgrootte ({len} bytes, limiet {max})
|
||||
@msg the module reacts to no events de module reageert op geen enkele gebeurtenis
|
||||
@msg vc_event returned {code} vc_event gaf {code} terug
|
||||
@msg {name}: its {event} handler failed: {e} {name}: de handler voor {event} is mislukt: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: de gebeurtenissen staan uit tot VectorCraft opnieuw start, na {count} mislukte handlers op rij
|
||||
@msg `inputs` needs `api` 2 or later `inputs` vereist `api` 2 of hoger
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` vereist de machtiging `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) geheugenbudget (object {_1} heeft {size} bytes invoer nodig, {left} over)
|
||||
@@ -9447,6 +9456,7 @@ axis Y Axis Y-as
|
||||
Show its progress, see Cancel and write log lines De voortgang tonen, een annulering zien en logregels schrijven
|
||||
Keep settings of its own Eigen instellingen bewaren
|
||||
Keep a cache of its own, which you can clear Een eigen cache bewaren, die u kunt legen
|
||||
Run on its own when the selection, a document or a layer changes Vanzelf worden uitgevoerd wanneer de selectie, een document of een laag verandert
|
||||
Run these commands on the document: {ids} Deze opdrachten op het document uitvoeren: {ids}
|
||||
Clear Plug-in Cache Plug-incache legen
|
||||
# Actions panel: action sets (#3712).
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7307,6 +7307,7 @@ axis Y Axis Oś Y
|
||||
Show its progress, see Cancel and write log lines Pokazywać swój postęp, wykrywać anulowanie i zapisywać wiersze dziennika
|
||||
Keep settings of its own Przechowywać własne ustawienia
|
||||
Keep a cache of its own, which you can clear Przechowywać własną pamięć podręczną, którą możesz wyczyścić
|
||||
Run on its own when the selection, a document or a layer changes Uruchamiać się samodzielnie, gdy zmieni się zaznaczenie, dokument lub warstwa
|
||||
Run these commands on the document: {ids} Uruchamiać w dokumencie te polecenia: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call „{name}” wymienia w `commandAllowlist` polecenie `{id}`, którego wtyczka nie może wywołać
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7338,6 +7339,15 @@ axis Y Axis Oś Y
|
||||
@msg only a filter declares `inputs` tylko filtr deklaruje `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` wymienia nieznany rodzaj obiektu `{shown}`: użyj type, image lub symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` wymienia `{shown}` dwa razy
|
||||
@msg `events` lists `{shown}` twice `events` wymienia `{shown}` dwa razy
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` wymienia nieznane zdarzenie `{shown}`: użyj selection.changed, document.opened, document.saved lub layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` wymaga poziomu API wtyczek {EVENTS_API}: podaj `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` potrzebuje uprawnienia `events`, a `events` potrzebuje listy `events`
|
||||
@msg event size ({len} bytes, limit {max}) rozmiar zdarzenia ({len} bajtów, limit {max})
|
||||
@msg the module reacts to no events moduł nie reaguje na żadne zdarzenia
|
||||
@msg vc_event returned {code} vc_event zwróciła {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: jego procedura obsługi {event} nie powiodła się: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: jego zdarzenia są wyłączone do ponownego uruchomienia VectorCraft, po {count} nieudanych procedurach obsługi z rzędu
|
||||
@msg `inputs` needs `api` 2 or later `inputs` wymaga `api` 2 lub nowszego
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` wymaga uprawnienia `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) budżet pamięci (obiekt {_1} wymaga {size} bajtów danych wejściowych, pozostało {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7351,6 +7351,7 @@ axis Y Axis Eixo Y
|
||||
Show its progress, see Cancel and write log lines Mostrar seu progresso, detectar o cancelamento e gravar linhas de log
|
||||
Keep settings of its own Guardar configurações próprias
|
||||
Keep a cache of its own, which you can clear Guardar um cache próprio, que você pode limpar
|
||||
Run on its own when the selection, a document or a layer changes Executar-se sozinho quando a seleção, um documento ou uma camada muda
|
||||
Run these commands on the document: {ids} Executar estes comandos no documento: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call “{name}” lista `{id}` em `commandAllowlist`, que um plug-in não pode chamar
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7382,6 +7383,15 @@ axis Y Axis Eixo Y
|
||||
@msg only a filter declares `inputs` somente um filtro declara `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` cita um tipo de objeto desconhecido `{shown}`: use type, image ou symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` lista `{shown}` duas vezes
|
||||
@msg `events` lists `{shown}` twice `events` lista `{shown}` duas vezes
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` cita um evento desconhecido `{shown}`: use selection.changed, document.opened, document.saved ou layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` exige o nível de API de plug-in {EVENTS_API}: informe `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` precisa da permissão `events`, e `events` precisa de uma lista de `events`
|
||||
@msg event size ({len} bytes, limit {max}) tamanho do evento ({len} bytes, limite {max})
|
||||
@msg the module reacts to no events o módulo não reage a nenhum evento
|
||||
@msg vc_event returned {code} vc_event retornou {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: seu manipulador de {event} falhou: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: seus eventos estão desativados até o VectorCraft iniciar de novo, após {count} manipuladores com falha seguidos
|
||||
@msg `inputs` needs `api` 2 or later `inputs` exige `api` 2 ou posterior
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` exige a permissão `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) orçamento de memória (o objeto {_1} precisa de {size} bytes de entrada, restam {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7074,6 +7074,7 @@ axis Y Axis Ось Y
|
||||
Show its progress, see Cancel and write log lines Показывать свой ход выполнения, замечать отмену и записывать строки журнала
|
||||
Keep settings of its own Хранить собственные настройки
|
||||
Keep a cache of its own, which you can clear Хранить собственный кэш, который можно очистить
|
||||
Run on its own when the selection, a document or a layer changes Запускаться самостоятельно, когда меняется выделение, документ или слой
|
||||
Run these commands on the document: {ids} Выполнять в документе эти команды: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call «{name}» указывает в `commandAllowlist` команду `{id}`, которую модуль вызывать не может
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7105,6 +7106,15 @@ axis Y Axis Ось Y
|
||||
@msg only a filter declares `inputs` `inputs` может объявлять только фильтр
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance в `inputs` указан неизвестный вид объекта `{shown}`: используйте type, image или symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice в `inputs` `{shown}` указано дважды
|
||||
@msg `events` lists `{shown}` twice в `events` `{shown}` указано дважды
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed в `events` указано неизвестное событие `{shown}`: используйте selection.changed, document.opened, document.saved или layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} для `events` нужен уровень API модулей {EVENTS_API}: укажите `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` для `events` нужно разрешение `events`, а для `events` нужен список `events`
|
||||
@msg event size ({len} bytes, limit {max}) размер события ({len} байт, предел {max})
|
||||
@msg the module reacts to no events модуль не реагирует ни на какие события
|
||||
@msg vc_event returned {code} vc_event вернула {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: его обработчик {event} завершился ошибкой: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: его события отключены до следующего запуска VectorCraft после {count} неудачных обработчиков подряд
|
||||
@msg `inputs` needs `api` 2 or later для `inputs` нужен `api` 2 или выше
|
||||
@msg `inputs` needs the permission `doc.read` для `inputs` нужно разрешение `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) бюджет памяти (объекту {_1} нужно {size} байт входных данных, осталось {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7464,6 +7464,7 @@ axis Y Axis Y-axel
|
||||
Show its progress, see Cancel and write log lines Visa sitt förlopp, se när det avbryts och skriva loggrader
|
||||
Keep settings of its own Spara egna inställningar
|
||||
Keep a cache of its own, which you can clear Spara en egen cache, som du kan tömma
|
||||
Run on its own when the selection, a document or a layer changes Köras av sig själv när markeringen, ett dokument eller ett lager ändras
|
||||
Run these commands on the document: {ids} Köra dessa kommandon på dokumentet: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call ”{name}” anger `{id}` i `commandAllowlist`, som ett plugin inte får anropa
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7495,6 +7496,15 @@ axis Y Axis Y-axel
|
||||
@msg only a filter declares `inputs` bara ett filter anger `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` anger en okänd objekttyp `{shown}`: använd type, image eller symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` anger `{shown}` två gånger
|
||||
@msg `events` lists `{shown}` twice `events` anger `{shown}` två gånger
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` anger en okänd händelse `{shown}`: använd selection.changed, document.opened, document.saved eller layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` kräver plugin-API-nivå {EVENTS_API}: ange `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` behöver behörigheten `events`, och `events` behöver en lista `events`
|
||||
@msg event size ({len} bytes, limit {max}) händelsestorlek ({len} byte, gräns {max})
|
||||
@msg the module reacts to no events modulen reagerar inte på några händelser
|
||||
@msg vc_event returned {code} vc_event returnerade {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: dess {event}-hanterare misslyckades: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: dess händelser är avstängda tills VectorCraft startas igen, efter {count} misslyckade hanterare i rad
|
||||
@msg `inputs` needs `api` 2 or later `inputs` kräver `api` 2 eller senare
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` kräver behörigheten `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) minnesbudget (objekt {_1} behöver {size} byte indata, {left} återstår)
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -949,6 +949,33 @@ fn artboard_add_button_tooltips_are_in_complete_catalogs() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Install Plug-in… lists what each permission lets a plug-in do, so each complete catalog has a
|
||||
/// row for the `events` permission's words.
|
||||
#[test]
|
||||
fn plugin_events_permission_words_are_in_complete_catalogs() {
|
||||
let label = "Run on its own when the selection, a document or a layer changes";
|
||||
for lang in LANGUAGES.iter().filter(|lang| lang.complete_menus || COMPLETE_MESSAGES.contains(&lang.code)) {
|
||||
assert!(lang.catalog().plain(label).is_some_and(|t| !t.is_empty() && t != label), "{} is missing {label}", lang.code);
|
||||
}
|
||||
}
|
||||
|
||||
/// The status bar's lines for a plug-in whose event handler failed, which the engine writes after
|
||||
/// the plug-in's name, are translated in each language of [`COMPLETE_MESSAGES`].
|
||||
#[test]
|
||||
fn plugin_event_handler_failures_are_translated() {
|
||||
let failed = "Run Events: its selection.changed handler failed: vc_event returned 3";
|
||||
let off = "Run Events: its events are off until VectorCraft starts again, after 3 failed handlers in a row";
|
||||
for code in COMPLETE_MESSAGES {
|
||||
let lang = Lang::from_code(code).expect("registered");
|
||||
for s in [failed, off] {
|
||||
let shown = message(lang, s);
|
||||
assert!(shown != s && shown.starts_with("Run Events") && shown.contains('3'), "{code}: {shown}");
|
||||
}
|
||||
}
|
||||
assert_eq!(message(de(), failed), "Run Events: sein Handler für selection.changed ist fehlgeschlagen: vc_event hat 3 zurückgegeben");
|
||||
assert_eq!(message(de(), off), "Run Events: seine Ereignisse sind aus, bis VectorCraft neu startet, nach 3 fehlgeschlagenen Handlern in Folge");
|
||||
}
|
||||
|
||||
/// Preferences › Performance › Use Monitor Profile for Canvas and the note under it.
|
||||
#[test]
|
||||
fn monitor_profile_labels_are_in_complete_catalogs() {
|
||||
|
||||
@@ -7524,6 +7524,7 @@ axis Y Axis Y ekseni
|
||||
Show its progress, see Cancel and write log lines İlerlemesini gösterme, iptali algılama ve günlük satırları yazma
|
||||
Keep settings of its own Kendi ayarlarını saklama
|
||||
Keep a cache of its own, which you can clear Temizleyebileceğiniz kendi önbelleğini saklama
|
||||
Run on its own when the selection, a document or a layer changes Seçim, bir belge veya bir katman değiştiğinde kendiliğinden çalışma
|
||||
Run these commands on the document: {ids} Belgede şu komutları çalıştırma: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call “{name}”, `commandAllowlist` içinde bir eklentinin çağıramayacağı `{id}` komutunu listeliyor
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7555,6 +7556,15 @@ axis Y Axis Y ekseni
|
||||
@msg only a filter declares `inputs` `inputs` yalnızca bir filtrede bildirilebilir
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` bilinmeyen bir nesne türü belirtiyor: `{shown}`; type, image veya symbolInstance kullanın
|
||||
@msg `inputs` lists `{shown}` twice `inputs` `{shown}` değerini iki kez listeliyor
|
||||
@msg `events` lists `{shown}` twice `events` `{shown}` değerini iki kez listeliyor
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` bilinmeyen bir olay belirtiyor: `{shown}`; selection.changed, document.opened, document.saved veya layer.changed kullanın
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` için eklenti API düzeyi {EVENTS_API} gerekir: `api` {EVENTS_API} verin
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` için `events` izni, `events` izni için de bir `events` listesi gerekir
|
||||
@msg event size ({len} bytes, limit {max}) olay boyutu ({len} bayt, sınır {max})
|
||||
@msg the module reacts to no events modül hiçbir olaya tepki vermiyor
|
||||
@msg vc_event returned {code} vc_event {code} döndürdü
|
||||
@msg {name}: its {event} handler failed: {e} {name}: {event} işleyicisi başarısız oldu: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: art arda {count} işleyici başarısız olduğundan, VectorCraft yeniden başlayana kadar olayları kapalı
|
||||
@msg `inputs` needs `api` 2 or later `inputs` için `api` 2 veya üstü gerekir
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` için `doc.read` izni gerekir
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) bellek bütçesi (nesne {_1} için {size} bayt girdi gerekiyor, {left} kaldı)
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7056,6 +7056,7 @@ axis Y Axis Вісь Y
|
||||
Show its progress, see Cancel and write log lines Показувати свій поступ, помічати скасування і записувати рядки журналу
|
||||
Keep settings of its own Зберігати власні налаштування
|
||||
Keep a cache of its own, which you can clear Зберігати власний кеш, який можна очистити
|
||||
Run on its own when the selection, a document or a layer changes Запускатися самостійно, коли змінюється виділення, документ або шар
|
||||
Run these commands on the document: {ids} Виконувати в документі ці команди: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call «{name}» вказує в `commandAllowlist` команду `{id}`, яку модуль викликати не може
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7087,6 +7088,15 @@ axis Y Axis Вісь Y
|
||||
@msg only a filter declares `inputs` `inputs` може оголошувати лише фільтр
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance в `inputs` указано невідомий вид об’єкта `{shown}`: використовуйте type, image або symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice в `inputs` `{shown}` указано двічі
|
||||
@msg `events` lists `{shown}` twice в `events` `{shown}` указано двічі
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed в `events` указано невідому подію `{shown}`: використовуйте selection.changed, document.opened, document.saved або layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} для `events` потрібен рівень API модулів {EVENTS_API}: укажіть `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` для `events` потрібен дозвіл `events`, а для `events` потрібен список `events`
|
||||
@msg event size ({len} bytes, limit {max}) розмір події ({len} байтів, межа {max})
|
||||
@msg the module reacts to no events модуль не реагує на жодні події
|
||||
@msg vc_event returned {code} vc_event повернула {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: його обробник {event} завершився помилкою: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: його події вимкнено до наступного запуску VectorCraft після {count} невдалих обробників поспіль
|
||||
@msg `inputs` needs `api` 2 or later для `inputs` потрібен `api` 2 або новіший
|
||||
@msg `inputs` needs the permission `doc.read` для `inputs` потрібен дозвіл `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) бюджет пам’яті (об’єкту {_1} потрібно {size} байтів вхідних даних, залишилося {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7103,6 +7103,7 @@ axis Y Axis Trục Y
|
||||
Show its progress, see Cancel and write log lines Hiển thị tiến độ, nhận biết yêu cầu hủy và ghi các dòng nhật ký
|
||||
Keep settings of its own Lưu cài đặt riêng
|
||||
Keep a cache of its own, which you can clear Lưu bộ nhớ đệm riêng mà bạn có thể xóa
|
||||
Run on its own when the selection, a document or a layer changes Tự chạy khi vùng chọn, một tài liệu hoặc một lớp thay đổi
|
||||
Run these commands on the document: {ids} Chạy các lệnh này trên tài liệu: {ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call “{name}” liệt kê `{id}` trong `commandAllowlist`, lệnh mà plug-in không được gọi
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`: {why}
|
||||
@@ -7134,6 +7135,15 @@ axis Y Axis Trục Y
|
||||
@msg only a filter declares `inputs` chỉ bộ lọc mới khai báo `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` nêu một loại đối tượng không xác định `{shown}`: dùng type, image hoặc symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` liệt kê `{shown}` hai lần
|
||||
@msg `events` lists `{shown}` twice `events` liệt kê `{shown}` hai lần
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` nêu một sự kiện không xác định `{shown}`: dùng selection.changed, document.opened, document.saved hoặc layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` cần API plug-in cấp {EVENTS_API}: hãy đặt `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` cần quyền `events`, và `events` cần một danh sách `events`
|
||||
@msg event size ({len} bytes, limit {max}) kích thước sự kiện ({len} byte, giới hạn {max})
|
||||
@msg the module reacts to no events mô-đun không phản ứng với sự kiện nào
|
||||
@msg vc_event returned {code} vc_event trả về {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}: trình xử lý {event} của nó đã thất bại: {e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}: các sự kiện của nó bị tắt cho đến khi VectorCraft khởi động lại, sau {count} trình xử lý thất bại liên tiếp
|
||||
@msg `inputs` needs `api` 2 or later `inputs` cần `api` 2 trở lên
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` cần quyền `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) ngân sách bộ nhớ (đối tượng {_1} cần {size} byte đầu vào, còn lại {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7284,6 +7284,7 @@ axis Y Axis Y 轴
|
||||
Show its progress, see Cancel and write log lines 显示进度、检测取消请求并写入日志行
|
||||
Keep settings of its own 保存自己的设置
|
||||
Keep a cache of its own, which you can clear 保存自己的缓存,您可以清除它
|
||||
Run on its own when the selection, a document or a layer changes 在所选对象、文档或图层发生变化时自动运行
|
||||
Run these commands on the document: {ids} 在文档上运行这些命令:{ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call “{name}”在 `commandAllowlist` 中列出了增效工具不能调用的 `{id}`
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`:{why}
|
||||
@@ -7315,6 +7316,15 @@ axis Y Axis Y 轴
|
||||
@msg only a filter declares `inputs` 只有滤镜才能声明 `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` 列出了未知的对象类型 `{shown}`:请使用 type、image 或 symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` 列出了两次 `{shown}`
|
||||
@msg `events` lists `{shown}` twice `events` 列出了两次 `{shown}`
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` 列出了未知的事件 `{shown}`:请使用 selection.changed、document.opened、document.saved 或 layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` 需要增效工具 API 级别 {EVENTS_API}:请设置 `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` 需要权限 `events`,而 `events` 需要 `events` 列表
|
||||
@msg event size ({len} bytes, limit {max}) 事件大小({len} 字节,上限 {max})
|
||||
@msg the module reacts to no events 该模块不响应任何事件
|
||||
@msg vc_event returned {code} vc_event 返回了 {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}:其 {event} 处理程序失败:{e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}:处理程序连续 {count} 次失败,其事件已关闭,直到 VectorCraft 再次启动
|
||||
@msg `inputs` needs `api` 2 or later `inputs` 需要 `api` 2 或更高
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` 需要权限 `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) 内存预算(对象 {_1} 需要 {size} 字节的输入,剩余 {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -7105,6 +7105,7 @@ axis Y Axis Y 軸
|
||||
Show its progress, see Cancel and write log lines 顯示進度、偵測取消要求並寫入記錄行
|
||||
Keep settings of its own 保存自己的設定
|
||||
Keep a cache of its own, which you can clear 保存自己的快取,您可以清除它
|
||||
Run on its own when the selection, a document or a layer changes 在選取範圍、文件或圖層變更時自動執行
|
||||
Run these commands on the document: {ids} 在文件上執行這些指令:{ids}
|
||||
@msg “{name}” lists `{id}` in `commandAllowlist`, which a plug-in may not call 「{name}」在 `commandAllowlist` 中列出了增效模組不能呼叫的 `{id}`
|
||||
@msg vc_call `{shown}`: {why} vc_call `{shown}`:{why}
|
||||
@@ -7136,6 +7137,15 @@ axis Y Axis Y 軸
|
||||
@msg only a filter declares `inputs` 只有濾鏡才能宣告 `inputs`
|
||||
@msg `inputs` names an unknown object kind `{shown}`: use type, image or symbolInstance `inputs` 列出了未知的物件類型 `{shown}`:請使用 type、image 或 symbolInstance
|
||||
@msg `inputs` lists `{shown}` twice `inputs` 列出了兩次 `{shown}`
|
||||
@msg `events` lists `{shown}` twice `events` 列出了兩次 `{shown}`
|
||||
@msg `events` names an unknown event `{shown}`: use selection.changed, document.opened, document.saved or layer.changed `events` 列出了未知的事件 `{shown}`:請使用 selection.changed、document.opened、document.saved 或 layer.changed
|
||||
@msg `events` needs plug-in API level {EVENTS_API}: give `api` {EVENTS_API} `events` 需要增效模組 API 層級 {EVENTS_API}:請設定 `api` {EVENTS_API}
|
||||
@msg `events` needs the permission `events`, and `events` needs a list of `events` `events` 需要權限 `events`,而 `events` 需要 `events` 清單
|
||||
@msg event size ({len} bytes, limit {max}) 事件大小({len} 位元組,上限 {max})
|
||||
@msg the module reacts to no events 此模組不回應任何事件
|
||||
@msg vc_event returned {code} vc_event 傳回了 {code}
|
||||
@msg {name}: its {event} handler failed: {e} {name}:其 {event} 處理常式失敗:{e}
|
||||
@msg {name}: its events are off until VectorCraft starts again, after {count} failed handlers in a row {name}:處理常式連續 {count} 次失敗,其事件已關閉,直到 VectorCraft 再次啟動
|
||||
@msg `inputs` needs `api` 2 or later `inputs` 需要 `api` 2 或更高
|
||||
@msg `inputs` needs the permission `doc.read` `inputs` 需要權限 `doc.read`
|
||||
@msg memory budget (object {_1} needs {size} bytes of input, {left} left) 記憶體預算(物件 {_1} 需要 {size} 位元組的輸入,剩餘 {left})
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -239,6 +239,7 @@ fn permission_words(name: &str, commands: &[String]) -> String {
|
||||
Some(permissions::Permission::Progress) => tl!("Show its progress, see Cancel and write log lines"),
|
||||
Some(permissions::Permission::Settings) => tl!("Keep settings of its own"),
|
||||
Some(permissions::Permission::Cache) => tl!("Keep a cache of its own, which you can clear"),
|
||||
Some(permissions::Permission::Events) => tl!("Run on its own when the selection, a document or a layer changes"),
|
||||
None => return permissions::display_text(name, permissions::MAX_SHOWN_FIELD),
|
||||
};
|
||||
words.to_string()
|
||||
|
||||
@@ -720,3 +720,43 @@ fn installing_a_plugin_that_reports_progress_says_so() {
|
||||
assert_eq!(vectorcraft_plugins::registry::granted(id).map(|g| g.permissions.len()), Some(2));
|
||||
app.run("plugin.remove", json!({"id": id})).unwrap();
|
||||
}
|
||||
|
||||
/// A selection made in the UI pass, after the frame's background work (as a click on the canvas or
|
||||
/// a panel makes it), reaches a plug-in that reacts to `selection.changed` before that pass ends:
|
||||
/// nothing is left for a later delivery.
|
||||
#[test]
|
||||
fn a_change_made_in_a_ui_pass_is_delivered_in_that_pass() {
|
||||
let mut app = app();
|
||||
app.session.allow_plugin_grants_from_requests();
|
||||
let id = "test.UI.ui_pass_events";
|
||||
let grant = json!(["progress", "events"]);
|
||||
let manifest = format!(r#"{{"id":"{id}","name":"Pass Events","kind":"filter","api":2,"permissions":{grant},"events":["selection.changed"]}}"#);
|
||||
// The handler writes the event as an information line, which the status bar does not show, so
|
||||
// the plug-in leaves the status bar of other tests' sessions alone.
|
||||
let wasm = wat::parse_str(tpl::reacting(&manifest, tpl::HOST_IMPORTS, tpl::LOG_EVENT)).unwrap();
|
||||
app.run("plugin.install", json!({"dataBase64": vectorcraft_format::base64_encode(&wasm), "grant": grant, "replace": true})).unwrap();
|
||||
let r = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap()["id"].clone();
|
||||
app.run("select.none", json!({})).unwrap();
|
||||
let ctx = egui::Context::default();
|
||||
let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1200.0, 800.0));
|
||||
let pass = |app: &mut VectorcraftApp, select: bool| {
|
||||
app.begin_host_iteration();
|
||||
let mut out = ctx.run_ui(egui::RawInput { screen_rect: Some(screen), ..Default::default() }, |ui| {
|
||||
app.tick(ui.ctx());
|
||||
if select {
|
||||
app.session.execute("select.set", &json!({"ids": [r]})).unwrap();
|
||||
}
|
||||
app.ui(ui);
|
||||
});
|
||||
out.textures_delta.clear();
|
||||
};
|
||||
// Fonts install on the first pass and are ready on the second.
|
||||
pass(&mut app, false);
|
||||
pass(&mut app, false);
|
||||
pass(&mut app, true);
|
||||
app.session.deliver_plugin_events();
|
||||
let left: Vec<String> = app.session.take_plugin_event_notices().into_iter().filter(|n| n.plugin == id).map(|n| n.text).collect();
|
||||
assert!(left.is_empty(), "delivered in the pass that made the change, not later: {left:?}");
|
||||
assert_eq!(app.session.doc().unwrap().selection.objects.len(), 1, "the selection was made");
|
||||
app.run("plugin.remove", json!({"id": id})).unwrap();
|
||||
}
|
||||
@@ -244,6 +244,38 @@ fn finished_background_work_waits_for_the_run_to_end() {
|
||||
assert!(app.opening.activate.is_empty());
|
||||
}
|
||||
|
||||
/// The selection a script changes reaches a plug-in that reacts to `selection.changed` in the
|
||||
/// frame the script ends in: once it has ended, nothing asks for another frame.
|
||||
#[test]
|
||||
fn a_finished_run_delivers_its_plugin_events_in_the_frame_it_ends() {
|
||||
use vectorcraft_plugins::wat as tpl;
|
||||
let mut app = app();
|
||||
app.session.prefs.show_external_script_warning = false;
|
||||
app.session.allow_plugin_grants_from_requests();
|
||||
let id = "test.UI.script_run_events";
|
||||
let grant = json!(["progress", "events"]);
|
||||
let manifest = format!(r#"{{"id":"{id}","name":"Run Events","kind":"filter","api":2,"permissions":{grant},"events":["selection.changed"]}}"#);
|
||||
// The handler writes the event it is given as a warning, which the status bar shows.
|
||||
let warn = "(drop (call $vc_log (i32.const 1) (local.get $ep) (local.get $el))) (i32.const 0)";
|
||||
let wasm = wat::parse_str(tpl::reacting(&manifest, tpl::HOST_IMPORTS, warn)).unwrap();
|
||||
app.run("plugin.install", json!({"dataBase64": vectorcraft_format::base64_encode(&wasm), "grant": grant, "replace": true})).unwrap();
|
||||
app.poll_finished_work();
|
||||
let source = format!("{DRAW} vc.run('select.all', {{}});");
|
||||
menus::run_ui_command(&mut app, "ui.runScript", &json!({ "source": source })).unwrap().unwrap();
|
||||
let ctx = egui::Context::default();
|
||||
for _ in 0..10_000 {
|
||||
if !app.session.script_running() {
|
||||
break;
|
||||
}
|
||||
app.begin_host_iteration();
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| app.tick(ui.ctx()));
|
||||
out.textures_delta.clear();
|
||||
}
|
||||
assert!(!app.session.script_running(), "the script did not end");
|
||||
assert!(app.ui.status.starts_with("Run Events: "), "{}", app.ui.status);
|
||||
assert!(app.ui.status.contains("selection.changed"), "{}", app.ui.status);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn quitting_asks_to_stop_and_stop_undoes_the_run() {
|
||||
let mut app = app();
|
||||
|
||||
+4
-1
@@ -13262,7 +13262,10 @@ while it runs, through `vc_call`: the calls and its output are one undo step, an
|
||||
fails leaves the documents, selections and history as they were. Without `doc.read` every call fails. A command that
|
||||
reads or writes files, uses the clipboard, changes preferences or the view, runs a script, an action or a plug-in,
|
||||
switches documents or undoes is never called; `plugin.install` refuses a manifest that lists one, and `plugin.inspect` lists such ids as
|
||||
`refusedCommands` and ids no command has as `unknownCommands` (`plugin.install` lists those too). A live-effect plug-in is an effect with
|
||||
`refusedCommands` and ids no command has as `unknownCommands` (`plugin.install` lists those too). A plug-in at API level 2
|
||||
whose manifest lists the `events` permission and `events` (in its `plugin.list` entry) is given `selection.changed`,
|
||||
`document.opened`, `document.saved` and `layer.changed` events through `vc_event` once the change has finished;
|
||||
its handler only reads, and `plugin.info` gives `eventsOff` and `lastEventError` (see `docs/plugins.md`). A live-effect plug-in is an effect with
|
||||
id `plugin.<id>`: `effect.apply`, `effect.setParams` and `effect.expandAppearance` work as for built-in effects, and
|
||||
`effect.list` lists it. One whose manifest declares `paintOutput` (at plug-in API level 2; `plugin.list` gives `api`
|
||||
and `paintOutput: true`) draws the pieces it returns with paints of their own, and `effect.expandAppearance` writes them
|
||||
|
||||
+63
-4
@@ -210,6 +210,7 @@ capability model proposed for PhotoCraft plug-ins
|
||||
| `settings` | all | Keep settings of its own between runs and sessions ([settings and cache](#settings-and-cache)). Needs `api` 2. |
|
||||
| `cache` | all | Keep a cache of its own, which the user can clear ([settings and cache](#settings-and-cache)). Needs `api` 2. |
|
||||
| `commands` | filter | Run the commands its `commandAllowlist` lists on the document ([command calls](#command-calls)). Needs `api` 2. |
|
||||
| `events` | all | Run on its own when the selection, a document or a layer changes, for the `events` it names ([events](#events-api-level-2)). Needs `api` 2. |
|
||||
|
||||
- A manifest without `permissions` gets the ones its kind implies, as plug-ins did before the key existed: a filter
|
||||
`doc.read`, `doc.write` and `state`; an effect `doc.read` and `effect.render`, and also `doc.write` and `state`
|
||||
@@ -219,9 +220,9 @@ capability model proposed for PhotoCraft plug-ins
|
||||
- An effect, an exporter or an importer that lists permissions lists all of its implied ones (`doc.read` and
|
||||
`effect.render`; `doc.read` and `export.write`; `import.read`). An effect with commands may add `doc.write` and
|
||||
`state`, which only its commands use. A filter may list any of its three, and `commands` with a `commandAllowlist`.
|
||||
Any kind may add `progress`, `settings` and `cache`, which no kind implies. An unknown name, a name listed twice, a
|
||||
name that doesn't apply to the kind, more than 16 names, `progress`, `settings`, `cache` or `commands` with an `api`
|
||||
below 2, or one of the names kept for a later plug-in API (`ui.panel`, `ui.tool`) is refused when the module is
|
||||
Any kind may add `progress`, `settings`, `cache` and `events`, which no kind implies. An unknown name, a name listed
|
||||
twice, a name that doesn't apply to the kind, more than 16 names, `progress`, `settings`, `cache`, `commands` or
|
||||
`events` with an `api` below 2, or one of the names kept for a later plug-in API (`ui.panel`, `ui.tool`) is refused when the module is
|
||||
installed, and the error names it.
|
||||
- **Installing asks first.** Install Plug-in… and File › Open show the plug-in's name, id, version, the SHA-256 of
|
||||
the file and each permission in plain words, and install it once the user clicks OK, if the file still has the
|
||||
@@ -371,6 +372,7 @@ pointers are offsets into the module's memory.
|
||||
| `vc_manifest` | `() -> i64` | `(len << 32) \| ptr` of the UTF-8 manifest JSON (≤ 64 KiB). |
|
||||
| `vc_alloc` | `(size) -> ptr` | A block of `size` bytes the host may write, or `0` on failure. Never freed: each run gets a fresh instance. |
|
||||
| `vc_run` | `(input, input_len, params, params_len) -> i64` | Runs the plug-in on the input JSON with the parameters JSON; returns `(len << 32) \| ptr` of the output JSON, or a negative error code. |
|
||||
| `vc_event` | `(event, event_len) -> i32` | Only in a module whose manifest lists [`events`](#events-api-level-2): reacts to the event JSON; returns `0` when it handled it, anything else when it failed. |
|
||||
|
||||
### Host imports (API level 2)
|
||||
|
||||
@@ -491,7 +493,8 @@ arguments as a JSON object, the params the command takes from any request:
|
||||
`-3` when the arguments are not a JSON object, `-4` when `commandAllowlist` doesn't list the id, `-5` when no command
|
||||
has the id, `-6` when a plug-in may not call the command, `-7` when the command can't run now (nothing is selected),
|
||||
`-8` when the command ran and failed, `-9` when a limit below is passed, and `-11` when nothing can be called (from
|
||||
the module's start function, in a run that isn't a filter's run on a document, or after a call in the run failed).
|
||||
the module's start function, in a run that isn't a filter's run on a document or an [event](#events-api-level-2)
|
||||
handler, or after a call in the run failed).
|
||||
|
||||
- Every code also fails the run, whatever the plug-in does next, and the error names the call and why it failed. The
|
||||
run's calls and its output are one undo step, named after the plug-in or its command. A run that fails, traps, runs
|
||||
@@ -522,6 +525,57 @@ the module's start function, in a run that isn't a filter's run on a document, o
|
||||
- A filter that calls commands runs on the app's main thread, so it can't ask for a heavy budget: a manifest with
|
||||
`commandAllowlist` and `budget: "heavy"` is refused.
|
||||
|
||||
### Events (API level 2)
|
||||
|
||||
A plug-in of any kind whose manifest gives `"api": 2`, lists the `events` permission and names events in `events`
|
||||
exports `vc_event`, and VectorCraft calls it after each change of those kinds:
|
||||
|
||||
```json
|
||||
{"id": "org.example.watch", "name": "Watch", "kind": "filter", "api": 2,
|
||||
"permissions": ["doc.read", "events"], "events": ["selection.changed", "document.saved"]}
|
||||
```
|
||||
|
||||
| Event | When | The event JSON |
|
||||
|---|---|---|
|
||||
| `selection.changed` | The selection in a document changed: other objects, anchors or segments, or nothing (`count` 0). | `{"type", "document", "count", "ids", "truncated"}`: `ids` lists the selected objects, at most 2,048 of them (`truncated` is then `true`), and is `null` without `doc.read`. |
|
||||
| `document.opened` | A file opened as a document (File › Open, Open Recent, New from Template). A new blank document is not one. | `{"type", "document"}` |
|
||||
| `document.saved` | Save or Save As wrote the document's own file. Save a Copy, a template and an export are not. | `{"type", "document"}` |
|
||||
| `layer.changed` | The current layer changed, or a layer or sublayer was added, deleted, moved or given other options. | `{"type", "document", "layer", "reasons"}`: `layer` is the current layer's id (`null` when there is none), `reasons` lists any of `current`, `added`, `deleted`, `reordered` and `options`. `reordered` means a layer's or sublayer's place among the rows beside it changed, also when an object moved past it. |
|
||||
|
||||
`document` is a number that names the open document for the rest of the session. No event carries a path, a file name
|
||||
or the document's contents.
|
||||
|
||||
- VectorCraft calls `vc_event(event, event_len)` in a fresh instance with the UTF-8 event JSON in a block from
|
||||
`vc_alloc`, after the change has finished: after the command, after Undo or Redo, after the file was written or the
|
||||
document opened. Nothing happens while a drag is still being previewed, for a failed command, or for a command that
|
||||
leaves the document as it was (a Layer Options that sets the name it had). Installing a plug-in hands it no past
|
||||
events, also none that were waiting for the next delivery when it was installed. A change made to a document opened
|
||||
or created since the last delivery is an event at the next one, after that document's `document.opened`.
|
||||
- Changes between two deliveries are one event with the state they ended with. The desktop app delivers in each
|
||||
frame, after the work that finished in the background and again at the end of the frame, after the canvas, panels
|
||||
and dialogs have run, so a burst of selection changes in one frame is one `selection.changed` and an idle window does
|
||||
not hold an event back. Requests through the control channel, and through MCP in remote mode, run in the desktop app
|
||||
and are delivered by the frame too, and several of them can run in one frame. `vectorcraft-cli` and headless MCP
|
||||
deliver after each request. Opens and saves are each their own event, in order, and are delivered even when the
|
||||
document closed before the delivery. At most 32 events wait; past that the oldest is dropped.
|
||||
- A handler only reads. VectorCraft applies nothing it returns, and it is outside any undo step. With `commands` and a
|
||||
`commandAllowlist`, it may [call](#command-calls) these commands, when the allowlist also names them, on the active
|
||||
document: `dataset.list`, `graphicStyle.list`, `guide.list`, `image.info`, `object.blend.info`, `swatch.list`,
|
||||
`symbol.list`, `text.getRange`, `transparency.info` and `variable.list`. A call of any other command fails with `-6`
|
||||
before it runs, the error names the event (`a selection.changed handler only reads: …`), and the handler fails.
|
||||
Afterwards VectorCraft puts back every document, its selection, current layer and undo history, which document is
|
||||
active, and the session state a command call can change (paint defaults, the Appearance panel's active row,
|
||||
preferences); a call that changed a document is refused the same way. An event raised while a handler runs waits
|
||||
for the next delivery: handlers never run inside one another.
|
||||
- A handler gets at most 5,000,000 instructions and 200 ms, or its plug-in's own budget when that is smaller, for the
|
||||
module's start function, `vc_alloc` and `vc_event` together; its settings, cache and log lines work as in a run.
|
||||
These limits are VectorCraft's own values. A handler that returns anything but `0`, traps or runs out of budget
|
||||
leaves the change it was told of as it is. Every failure goes to the log, and the first failure in a row also shows
|
||||
in the status bar; after 3 failures in a row, the plug-in gets no more events until VectorCraft
|
||||
starts again or another module is installed with its id. A warning or error line a handler writes with `vc_log`
|
||||
shows in the status bar after the plug-in's name. `plugin.info` gives `eventsOff` and `lastEventError`.
|
||||
- In Safe Mode no handler runs. When no installed plug-in names an event, VectorCraft does not compare anything.
|
||||
|
||||
### Manifest
|
||||
|
||||
```json
|
||||
@@ -574,6 +628,11 @@ the module's start function, in a run that isn't a filter's run on a document, o
|
||||
it): the ids of the commands the filter may [call](#command-calls), at most 256, each once (`"commandAllowlist":
|
||||
["select.all", "object.move"]`). An id is 1–128 characters from `A-Z a-z 0-9 . _ -` that starts with a letter, with
|
||||
no empty part between dots. A malformed list is refused when the module is installed, and the error names the id.
|
||||
- `events` (any kind at `api` 2, and only with the `events` permission, which needs it): the
|
||||
[events](#events-api-level-2) the plug-in reacts to, any of `"selection.changed"`, `"document.opened"`,
|
||||
`"document.saved"` and `"layer.changed"`, each at most once. The module then exports `vc_event`. An unknown or
|
||||
repeated name, an entry that isn't a string, `api` 1, a list without the permission, the permission without a list,
|
||||
and a missing or wrongly typed `vc_event` are refused when the module is installed, and the error names the fault.
|
||||
- `params`: in dialog order. Names are `[A-Za-z0-9_]`, not starting with `_`, and not `id`, `ids`, `params` or
|
||||
`preview`. The host validates the user's values before calling: missing values take the default, numbers are
|
||||
clamped to `min..max` (ints rounded), a wrong type or an unknown choice is an error. Numeric defaults are also clamped
|
||||
|
||||
@@ -2654,6 +2654,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- **Changed plug-in gradients lose spot plates (G17):** a gradient that a filter or importer changes loses each stop's swatch link, tint and process `plates` together, in fills and strokes, and keeps the stop's color, offset, opacity and midpoint; a gradient returned unchanged keeps all three. Regressions: `crates/plugins/src/objects/tests.rs` (`changed_gradient_fill_and_stroke_drop_spot_plates`, `unchanged_gradient_paint_keeps_spot_plates`). Scores and hours unchanged.
|
||||
- **Plug-in data kept with the document (G17):** a filter writes JSON of at most 1 MiB with `documentData` (one undo step with its objects; `null` removes it) and reads it back in `_context.documentData`, which no other filter is given. It is the document's foreign data (`unknown.pluginData`, by plug-in id), as the perspective grid is, so the native file keeps it with no section of its own; an exporter is given the whole document, so it can read every plug-in's. Regressions: `crates/engine/src/tests/plugins.rs`, `crates/engine/tests/plugin_export.rs` (the exporter), `crates/doc/src/plugin_data.rs`, `crates/plugins/src/objects/tests.rs`. Scores and hours unchanged.
|
||||
- **Heavy filter plug-ins (G17):** a filter's manifest may ask for `"budget": "heavy"`: 1 G instructions (20 times a light run's) and 300 s a run, for routing, packing or simulation. Install Plug-in… and File › Open ask the user first, `plugin.install` needs `allowHeavy: true` (`plugin.inspect` tells beforehand), the Additional Plug-ins Folder skips such filters, and the plug-in store keeps the answer. Its dialog has no Preview; the app runs it on a thread of its own with a progress window (Cancel, Continue in Background) and applies the result as `plugin.run` with the same parameters, one undo step, unless the document or the plug-in changed meanwhile. Regressions: `crates/plugins/tests/abi.rs`, `crates/plugins/src/manifest.rs`, `crates/engine/src/tests/plugins.rs`, `crates/ui-egui/src/tests/plugin_runs.rs`. Scores and hours unchanged.
|
||||
- **Plug-ins react to events (G17, VectorCraft's own API):** a plug-in at API level 2 with the `events` permission names any of `selection.changed`, `document.opened`, `document.saved` and `layer.changed` in its manifest, and its `vc_event` export is given a small JSON event after each change of that kind has finished, outside any undo step: changes between two deliveries (a frame in the desktop app, a request in `vectorcraft-cli` or headless MCP) are one event. A handler only reads: it may call only ten listed commands that read, any other call fails with an error naming the event, and what a call changed is put back. It gets 5 M instructions and 200 ms, a handler that fails 3 times in a row gets no more events for the session, and an event raised while a handler runs waits for the next delivery. Regressions: `crates/engine/src/tests/plugin_events.rs`, `crates/engine/src/plugin_events.rs`, `crates/plugins/tests/abi.rs`, `crates/plugins/src/manifest.rs`. Scores and hours unchanged.
|
||||
- **Plug-in instruction budget preference (G17, VectorCraft's own setting):** Preferences › Plug-ins & Scratch Disks › Plug-in Instruction Budget (`pluginInstructionBudget`) is Normal by default, which keeps the 50 M instructions a light filter run gets, or Large, which gives each object filter run 250 M plus the 4,000 per input byte, with the 60 s time budget, Cancel and the other limits unchanged. A heavy filter keeps its 1 G and 300 s with either choice; live effects, exporters and importers keep their own budgets. A change applies to the next run of an installed filter; `prefs.set` refuses any other value, and a saved file with another value reads as Normal. Regressions: `crates/plugins/tests/abi.rs`, `crates/engine/src/tests/plugins.rs`, `crates/engine/src/tests/prefs.rs`, `crates/ui-egui/src/prefs_dialog/tests.rs`. Scores and hours unchanged.
|
||||
- **Safe Mode for plug-ins (G17):** `vectorcraft --safe-mode` and `vectorcraft-cli --safe-mode <subcommand>` start without plug-ins. When a launch stopped while a plug-in was loading or drawing its first live effect, the next launch names that plug-in, without saying it caused the stop, and offers Disable and Continue, Start Normally or Start in Safe Mode. Help › Safe Mode lists the disabled plug-ins with Enable on Re-launch, which takes effect at the next launch, and the app bar and the window title show Safe Mode. The help page (https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf, pages 65 to 69) describes the same choice between diagnosing and starting normally, a Safe Mode with the problem item off and the rest of the app working, and turning the item back on at the next launch. In Safe Mode no plug-in loads or runs, and a live-effect plug-in draws its object's geometry unchanged while the object keeps the effect, which the Appearance panel marks "(Safe Mode)" with the plug-in's id in its tooltip and `effect.list` marks `skipped`; Expand Appearance refuses such an object. The web build keeps no plug-ins between page loads and has no marker. Each desktop launch with preferences keeps a marker in the `Launch` folder next to them; `vectorcraft-cli` and a desktop launch without preferences keep none, so a stop there leads to no choice at the next launch. Disabled plug-ins are listed in `Plug-ins/disabled.json`. `plugin.safeMode` reports Safe Mode and the disabled plug-ins, and `plugin.setEnabled` changes the list. Regressions: `crates/plugins/src/safe_mode.rs`, `crates/plugins/tests/safe_mode.rs`, `crates/engine/tests/plugin_safe_mode.rs`, `crates/ui-egui/tests/safe_mode.rs`. Scores and hours unchanged.
|
||||
- **Hang report and Copy Troubleshooting Info:** when the desktop app's interface thread stays in one part of a frame for 3 s (VectorCraft's own value), a watching thread writes a hang report to the log and to `logs/hang-report-<process id>.txt`, and removes the file when the interface answers again. A later launch that finds a report no process holds writes it to the log, keeps it as `logs/hang-report.1.txt` and, unless another start-up message is showing, says so in the status bar. Help › Copy Troubleshooting Info (`help.copyTroubleshootingInfo`) copies the platform facts, the recent commands and frame times, and the reports of this session and the last one. Regressions: `apps/vectorcraft/src/hang_watch/tests.rs`, `crates/ui-egui/src/hang_beacon.rs`, `crates/ui-egui/src/troubleshooting.rs`. Scores and hours unchanged.
|
||||
|
||||
Reference in new issue
Block a user