[Bug-12923]Perspective - Binding to object visibility

I would like to bind the x position of one component to the visibility state of another component. No matter which way I try the binding (expression, property with transform, etc) it does not work. I can bind to other meta properties of the same object (e.g. name), but when I try to use the visible property, I get a variety of vague errors in the binding expression including “Bad_Stale” and “Error_ExpressionEval”. Should what I’m trying to do work?

The expression I’m trying is if({../Object_Name.meta.visible}, 240, 125)

It seems to be working for me:
Before (visible):


After (not visible):

Perhaps there is something else going on with the View? Did you manually define the path, or did you use the property selector GUI to locate the property?

Bad_Stale should only occur when dealing with Tags, and Error_ExpressionEval should only occur when the structure of the expression is not correct. If these are indeed the warnings you’re seeing, then the property is indeed fine and there is something else going on. Try deleting the expression and re-typing it (do not copy/paste) as sometimes copying characters from other locations can introduce unexpected characters which do not register as they should.

TL;DR: Yes, it should work, and it works for me.

After some more experimentation, it looks like you CAN encounter Error_ExpressionEval if the interpolated property (the part between the curly brackets) fails to resolve to an actual property, as the interpolated value returns something (an error) of a type the expression doesn’t expect.

Please check that the value you supplied actually resolves to a property, or use the square icon to the right of the Expression Binding editing window to manually select the desired property.

I used the square icon to select the property, and made certain that it was resolving correctly by binding to another meta parameter, e.g.
if({../My Object.meta.name} = 'My Object', 100, 150)
is entered and evaluates correctly, then I just backspace and change it to
if({../My Object.meta.visible} = true, 100, 150)
…and it errors out.

I tried it on a new view with two new components and it worked, so I went back to the components I was trying it on previously. I copied those components to a new view, I tried binding a new component to the existing components visibility, and I tried binding the existing component to a different components visibility. Same results all around.

After much poking and prodding, I found that if I accepted the expression binding with the error, then toggled the visibility of the component that the expression binding was looking at, the binding error disappeared and worked as intended. So it works, but something funny is still going on.

Agreed. I opened an internal ticket while I was investigating this more over the last hour or so. I believe it’s limited to specific properties (meta.visible being the ONLY one I’ve found so far) and only seems to be a problem immediately after View initialization; any modification of the meta.visible property after initialization corrects the quality of the binding from Bad_Stale (which I can see when binding to the property outside of an Expression Function) to Good, which results in the Expression Binding (and Expression Function) meeting all requirements and returning the expected value.

As a short-term workaround, you could supply a script transform after a Property Binding against meta.visible along the lines of

desired_value = 240
fallback_value = 125
if (value is None) or (not value):  # null or false
    return fallback_value
else:
    return desired_value

or

desired_value = 240
fallback_value = 125
if value:
    return desired_value
else:
    return fallback_value
1 Like

This issue was fixed in the build that was uploaded today (3/7).
Please let us know if you continue to see this behavior after upgrading.

1 Like