.ai import: open the variable library and data sets from the editing data

Squashed from #5156 onto main.
This commit is contained in:
dotCooCoo
2026-11-02 16:19:19 +07:00
committed by bflatastic
parent 952446253f
commit 8ab68e4223
42 changed files with 1096 additions and 148 deletions
+5 -1
View File
@@ -140,8 +140,11 @@ fn names_param(p: &Value, cmd: &str, fallback: Option<String>, nothing: &str) ->
/// Refuse what a variable of `kind` can't be bound to: art that is locked, on a hidden or locked
/// layer, or on a locked artboard; a text variable only drives type; an image variable only drives
/// an image object.
/// an image object; a variable of unknown kind drives nothing.
fn check_bindable(doc: &vectorcraft_doc::Document, ids: &[NodeId], kind: VariableKind, cmd: &str) -> Result<()> {
if kind == VariableKind::Unknown {
return Err(bad(cmd, "a variable of unknown kind can't be bound to objects"));
}
let locks = doc.locked_artboards();
for id in ids {
match doc.node(*id) {
@@ -189,6 +192,7 @@ fn dataset_value(cmd: &str, var: &str, kind: VariableKind, v: &Value) -> Result<
.map(str::trim)
.filter(|t| !t.is_empty())
.and_then(|t| if t.len() > MAX_GRAPH_CSV { None } else { Some(DataValue::Graph(t.to_string())) }),
VariableKind::Unknown => None,
}
.ok_or_else(|| bad(cmd, format!("value for `{var}` must match its variable kind")))
}