Version 0.6.3- Update: Prior to running a chain, only validate actions that have no conditions, or those that have conditions that evaluate to true.
Version 0.6.4- Update: add selection_count template function instead of the old way of pre-calculating selection count as a global_var
The latest version has a
change that is not compatible with previous versions. If you have chain/action conditions that check the selection count using the globals(selection_count) function, you have to change that to use the newly introduced selection_count() template function. This new template function only works with the action chains plugin. I will correct all previous posts the reference globals(selection_count) to reflect the new change.
The problem is with the old approach is that it used to pre-calculate the selection count before running every chain and every action, in case there is a template asking for the selection count. The process of calculating the selection count can be expensive if you have a lot of rows selected, which slows down things, often unnecessarily when there are no templates asking for the selection count.
With the new template function, the selection count is only calculated on demand. Also caching is used whenever possible. e.g. checking all chain conditions happens before showing the menu; to disable items with conditions that evaluate to false. Since selections are not going to change when the menu is being shown, the first time the function is called, it caches the value to be re-used when checking subsequent chains, an flushes the cache after the menu is shown.
Likewise, globals(containing_folder) is replaced by containing_folder(). The globals() function is reserved for variables set by the user using the Chain Variables action, or set programmatically (by custom actions) using chain_tools.set_chain_vars() and chain_tools.set_book_vars().