Hey there. I’m trying to bind parameters of the custom component to the properties of my extension. It seem to work fine for everything except for dropdown menus. If you bind directly to the dependency object then it works fine, but you lose the option to have a callback for when the value is changed, so the code you have in the property.setter for that value is never executed.
Attached an example. Let me know if you have any further questions. Thank you. dropdown_bind_bug.toe (4.4 KB)
Hey Ivan. I’ve updated my example to be more clear. So in the base1 there are three parameters p1, p2 and p3. p1 and p2 are bound to the p1 and p2 property of the extension, while p3 is bound to p3 dependency object I guess? I’m not sure what’s the difference here, but the outcome is very different.
If you execute the script “set_random_values” you will see that in case of p1 and p2 we indeed entring the setters in the extension code, however the values in the base are not updated, which is supposed to happen since it’s a binding.
For p3 it’s the other way around: the value gets properly updated, but the setter for value 3 is never visited (print statement is never called)
Ah, yes, there is definitely something funky happening there! Thanks for the clear example, I will bring this to the team and see what we can figure out.
To be clear, this doesn’t seem to have anything to do with dropdown (as it says in the title), yeah? It’s the bind expression format that is the difference. Is there something I should be looking at as far as the dropdown?
Thank Ivan. For me the biggest problem is that there is no way to bind to a extension property if your parameter type is “menu”. I haven’t tried it with all par types available, but as you can see in the example the dropdown menu is never updated when the corresponding extension property is. So basically the binding mechainsm there is broken. For int and float par types it works fine, but as I mentioned I haven’t tried all possible par types.
case 1: update a value through interacting with dropdown menu action: choose a value in the dropdown menu of the component (p2 in our case) desired effect: value updated in the dropdown menu. Property value of the extension bound to that value is updated accordingly observed effect: Property value is updated, label of the dropdown menu still reads previous value
case 2: updating a value through modifying an extension property action: Update a value of the extension property via python script desired effect: Extension’s property value is updated, par label of the bound menu parameter is also updated observed effect: Property value is updated, menu label is not updated
Gotcha. Thanks I see this problem and will discuss with @rob.
We did decipher the other issue, where tuple notation works in bind to go through the property code but dot notation doesn’t. Basically, the dot notation returns an object that can be bound to (the dependency) so the parameter binds to that directly instead of the property. The tuple notation, however, is evaluated every time and ends up going through the property. Not sure if we are going to be able to change that.
All that said, the menu thing is definitely a problem and I’m pretty sure we can get that working for tuple notation.
We did some research… not going to be able to make the normal dot notation work to go through extension properties. You will actually have to use the tuple notation, as you discovered, but menu will actually work! We’ll test the fix in experimental with a high probability of it being backported to 2022 official.