hello , I would like to update the dependencies via script, but i can’t find the path to access this command , anyone knows what’s the string to update the dependencies via python? thank you very much
Looking at the source code, the button appears to be a direct function rather than a python operator:
but = uiDefIconTextBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_FILE_REFRESH, IFACE_("Update Dependencies"), 0, 0, 10 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, TIP_("Force updates of dependencies")); UI_but_func_set(but, driver_update_flags_cb, fcu, NULL);
The way I update a driver in my add-on is by adding and removing a space on the driver’s expression attribute. As far as I could tell, it acts the same way:
driver.expression += " " driver.expression = driver.expression[:-1]
thank you so much for the answer, so you are telling me that it might be possible to add a button that does it automatically, running this little script?
If you’re referring to the first block of code then no, that one I just pasted from Blender’s source C code to expose how the Update Dependencies button isn’t related to the Python side of Blender, which is why there’s no path to call it from a Python script.
As far as Python goes, in order to create a UI button with custom code you have to first create and register a new
Operator, which is what the second block of code becomes part of. The built-in text editor has templates that you can view to see how it’s done.
yes, i know that the second part is not the complete code, but it’s basically the core part that can be implemented in other scripts! thank you again for the clarification, by the way!
i noticed tht this script doesn’t run both for the 3D transform drivers and the shader drivers. any suggetion on how to make it work for the shaders?
Sorry, my version was only tested with shape key drivers. Though I’d hope that if there are any other non-intrusive operations that update other types of drivers’ dependencies, those would work as well when planted in code. I found this answer on Stack Exchange with extra details about Blender’s current and upcoming dependency graphs, if that helps.
Everytime I open a blender file Im working on it requires me to update all driver dependencies for the file to work. I need to update all dependencies at once. With script or something. I can’t click update dependencies on every driver everytime I try to work the project.
I tried the few codes here but didn’t get them work.