Page 1 of 1

Relative path to parent context?

Unread postPosted: Tue Mar 19, 2019 2:30 am
by bvz2000
I am trying to set up a relative path to a parent context.

For example:

get_double("../light_settings.intensity")

But apparently that does not work. Is there any way to use relative paths to go "up" by one or more contexts?

Re: Relative path to parent context?

Unread postPosted: Tue Mar 19, 2019 11:51 am
by dcourtois
Hi,

This hasn't been implemented yet, but you can achieve the same thing using the `get_context` function. Here is how to do it:

Code: Select all
get_double(get_context(get_context()) + "/light_settings.intensity")


The inner`get_context` call (no parameter) returns the path to the context of the object owning the attribute the expression is bound on. The outer `get_context` call then returns the parent context.

Will probably add support for relative paths in the future, but for the moment, this is the way to go :)

Re: Relative path to parent context?

Unread postPosted: Tue Mar 19, 2019 6:11 pm
by bvz2000
This looks like it will work just fine for us. Thanks!