Not all users know about F8-binded "script.reload" operator. In User Preferences panel you can edit the path to the scripts, and this is convenient to reload them automatically.
Alexander (Blend4Web Team)
Differential D2467
Automatic scripts reload after path editing Authored by Alexander Romanov (a.romanov) on Jan 19 2017, 9:36 AM.
Details
Not all users know about F8-binded "script.reload" operator. In User Preferences panel you can edit the path to the scripts, and this is convenient to reload them automatically. Alexander (Blend4Web Team)
Diff Detail Event TimelineComment Actions looks ok, I would take step further & also add to preferences addons header as the refresh & reload F8 appear to do different things. Comment Actions I think that any button should have some relations with options listed on the same Tab. In this case relation between "Scripts" field and "Reload Scripts" button is clear. And if we put it in "Addons", two buttons with similar names "refresh"~ "reload" can confuse. Comment Actions Not currently convinced this is a good change. Why would a normal artists want to use this button? Comment Actions It is useful for example for installation of some plugins which are placed in 'Scripts' folder. For example Blend4Web SDK use this installation method. And many artists use SDK instead of plugin due to it's advantages. Comment Actions
This seems like a really specific corner-case, though. In this case you'd still have to communicate this to the user somehow why they need to reload the scripts, in which case it's just as easy to tell them to use F8. My first reaction is the same as @Sergey Sharybin (sergey)'s. A normal user should never have to reload scripts, much less need to know why. Exposing the functionality is nice for power users, but that's already handled via F8 and so for most users adding the button is merely going to further complicate the user preferences. Comment Actions Could we auto reload when changing the scripts path? I think this indicates some weakness in the installation procedure, we shouldn't add buttons for manual steps but rather try to automate it better. Comment Actions The property is defined in C-code, but such kind of callbacks has no simple way to pass a Context, which is needed for calling 'SCRIPT_OT_reload'. So I think there is no simple way to do this update automatically. Comment Actions You can use RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); to get bContext passed to the property _update function. I think that would be okay as a solution for this corner case. Alternatively, we could place a button (icon only?) next to the Scripts text field to reload scripts manually. But indeed, an automatic approach would be preferable. Comment Actions Also requesting changes since consensus is that current patch isn't really the way to go. Comment Actions Implemented as automatic SCRIPT_OT_reload call in update callback. There is a comment /* TODO, editing should reset sys.path! */ What the correct behavior should be? Is resetting necessary? Comment Actions Unless this can work perfectly, I don't think its worth attempting. The tricky part is that the scripts path controls what blender does at startup (it may run scripts in the startup path, new add-ons are available) and since it's added to sys.path - the imports of all existing scripts could have a different outcome. In practice I'm sure it's possibly to mostly get this working, but suggest to reject this since:
|