When creating a style, multiple instances of a module should follow order of creation, not the history stack
I had this problem with multiple instances of Profiled Denoise.
In darkroom, the order of process is always the order where the instances are created. When I create a new instance of a module, the new instance is executed after the existing instances (at least in darkroom and on export).
However, when creating a style that includes those instances, the order of instances follow the order of the history stack, then executed from top to bottom when the style is applied on export.
It works correctly when applying the style to an image in lighttable (darkroom shows the correct order in history stack, and the instances have appended numbers in the same order).
As a work-around, before creating a style, I just have to turn off then on the instances in reverse order so that they appear on the history stack in the correct order from top to bottom.
Took me 3 hours to pin point the problem, using only "-d perf" and identifying the instances based only on their different execution times. Fun!
I guess the order of creation is the fixed reference (since each instance is appended with a number in that order in the darkroom's module list). If so, when creating the style, we just need to follow that creation order instead of the order in the history stack.
I troubleshooted this problem on a freshly compiled version against master branch as of 10/14 (version 2.3.0+982~g487a471)
Fix MI in styles applied during export
There are still some issues wrt. styles and mi left, and I hope I didn't
break anything here.
#2 Updated by Tobias Ellinghaus over 1 year ago
I had a first look at the code and it seems that styles are not really supporting multiple instances of modules. There are some cases where it happens to work by accident, but in general we have to fix quite a few places to make it work as expected. Not sure if we will get that done in time for 2.4.0.
#3 Updated by Tobias Ellinghaus over 1 year ago
- % Done changed from 20 to 100
- Status changed from Triaged to Fixed
Applied in changeset darktable|83c90012209349e3947055d9c35370f063ef91db.
#4 Updated by Huy Hoang over 1 year ago
Thanks, Tobias, for the speedy fix. Love your comment "dt_dev_module_duplicate() doesn't work here, it's trying too hard to be clever" :-)
Recompiled from master, tested creating and applying a style with 3 instances of Profiled Denoise:
- correct order of the instances on history stack
- reverse order of the instances on history stack
- random order (2,1,3) of the instances on history stack
- with one instance turn off
- export the style then import back
All worked correctly.
Found one minor bug: when importing a style in, it appears on the style list right away, but the export module doesn't refresh to show it, had to click "edit" the style and save. Perhaps will submit as a new ticket.