Isotropix Forums

Expressions not always updating, can we force it?

Discuss about expressions in Clarisse

Expressions not always updating, can we force it?

Unread postby bvz » Thu Sep 26, 2019 10:09 pm

We have run into a few instances where an expression simply will not update to its latest value. It hasn't been consistent, so I do not have a specific case that always causes it yet. But it is frequent enough that it can cause a problem, especially since it persists through re-starts of Clarisse.

We have expressions, for example, that look like this:

get_string(get_context(get_context()) + "/settings.diffuse_map")

Sometimes the result of this expression will get "locked" into a particular value. Even closing and restarting Clarisse will not get it to update. The only way we can force it to update at the moment is to delete the expression and then re-paste it.

Is there a python call that can force either a specific node to re-evaluate all of its expressions? Or maybe one that forces ALL nodes to re-evaluate?
bvz
 
Posts: 51
Joined: Tue Dec 03, 2013 9:55 am

Re: Expressions not always updating, can we force it?

Unread postby dcourtois » Fri Sep 27, 2019 8:30 am

To be sure to understand : by "get locked", do you mean that when you move an object that has such an expression bound to it, it doesn't update ?
I'll try to investigate, but it's weird that it's not consistent. Since the expression system is fairly new, there might be some bugs left in the dependency checks, but those kind of bugs are usually 100% reproducible.

Anyways, I'll check this. And to answer the question of your title, unfortunately the only way to force updating an expression is to remove it (set an empty expression) and set it again (can be done by script)
User avatar
dcourtois
 
Posts: 45
Joined: Tue Jul 25, 2017 3:15 pm

Re: Expressions not always updating, can we force it?

Unread postby bvz » Fri Sep 27, 2019 7:09 pm

Thanks.

As an example:

I have a streamed map file. On the file path field of this streamed map file, I have the following expression:

get_string(get_context(get_context()) + "/settings.diffuse_map")

Then two contexts above this streamed map file, I have a node named "settings". This node has a file_open field named "diffuse_map".

Occasionally, if I change the path in this settings node, the streamed map file will not update itself. It will remain "locked" to the result of the expression before I changed the value in the settings node. So, for example, if I had set the settings node to point to:

/path/to/file/A

then I change the settings node to:

/some/different/path

the underlying streamed map file still points to /path/to/file/A.

Restarting Clarisse will not force an update. The only way to get it to re-evaluate this expression is to, as you described, remove the expression and then re-attach it. This does not happen all the time, but it has happened a number of times now and is very hard to diagnose.

One scenario where it happens more often than others is when we have a referenced project. In this project we have the structure I described above:

A streamed map file with an expression.
A settings node that is a few contexts above the streamed map file.

When we reference this project, we set the values on the settings node via overrides. Sometimes the underlying streamed map file will not update itself to this new value. Again, restarts will not fix it. The only way to fix it that we have found so far is to delete the expression on the streamed map file (which is an override itself), and then re-paste it (again, this results in the "original" expression being pasted in as an override).

I will try to catch a project where this happens and see if I can send it in. But usually these projects are referencing a lot of other projects and files so I don't know if I can actually send it in successfully.

I noticed that when I have an expression, the evaluated value of the expression is also stored in the saved Clarisse project. I assume this evaluated value is what is being read and is somehow forcing itself to be the displayed value instead of a freshly evaluated value from the expression. It would be helpful if we could just tell Clarisse to dump its currently evaluated value and re-calculate the expression. That would be better than having to use a script to delete and re-attach the expression, especially when dealing with referenced projects.
bvz
 
Posts: 51
Joined: Tue Dec 03, 2013 9:55 am

Re: Expressions not always updating, can we force it?

Unread postby dcourtois » Mon Sep 30, 2019 1:00 pm

I noticed that when I have an expression, the evaluated value of the expression is also stored in the saved Clarisse project. I assume this evaluated value is what is being read and is somehow forcing itself to be the displayed value instead of a freshly evaluated value from the expression. It would be helpful if we could just tell Clarisse to dump its currently evaluated value and re-calculate the expression. That would be better than having to use a script to delete and re-attach the expression, especially when dealing with referenced projects.


Nope, this is not what's happening. What's happening is that there is a bug in the expression's dependencies that prevent the expression from being notified whenever the attribute it's using (e.g. your setting's diffuse_map attribute) is being updated.
The serialized value is only that: the current value which is the result of the latest expression's evaluation. It does nothing on itself and is completely overwritten by any expression evaluation (provided the expression is valid and there's no bug :p)

Did you notice any warning in the log when this problem occurs ? If you manage to reproduce this on a simple(r) setup, I'd be really interested in having it (I don't need anything other than the few objects/contexts involved in the bug, so you can strip the rest completely) I haven't been able to reproduce it so far :/
User avatar
dcourtois
 
Posts: 45
Joined: Tue Jul 25, 2017 3:15 pm


Return to Expressions