preset with expression

46 views
Skip to first unread message

Robert Kolbeins

unread,
Jul 29, 2024, 4:42:42 AMJul 29
to gaffer-dev
Hello,

with expression i can get a preset values like so,
value = parent["name"]

but if I try to use a variable to get different preset name I get Key Error:
name = "name"
value = parent[name]

Thanks,
R

John Haddon

unread,
Jul 31, 2024, 4:55:38 AMJul 31
to gaffe...@googlegroups.com
Hi Robert,
Gaffer parses the Python expression so that it can connect the expression node to the plugs the expression reads from and writes to. So those plug names need to be constants that can be determined during parsing, not variables that could differ at execution time. Hopefully that makes sense?
Cheers...
John

--
You received this message because you are subscribed to the Google Groups "gaffer-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gaffer-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gaffer-dev/56ec4864-106d-4361-ba7c-9dd12619c25fn%40googlegroups.com.

Robert Kolbeins

unread,
Jul 31, 2024, 5:00:27 AMJul 31
to gaffe...@googlegroups.com
Hi John,
Thanks for clarifying that.  My solution is to connect those preset plugs to the spreadsheet and then query the spreadsheet in expression which works nicely.
Cheers,
Robert

Reply all
Reply to author
Forward
0 new messages