Commit 9bfac1d
committed
Fix: ButtonItem callback compatibility - check parameter count before passing trigger
Fixes critical regression from v3.13.2 where all ButtonItem callbacks were
unconditionally passed a 5th parameter (trigger_auto_apply), breaking existing
callbacks that only accept 4 parameters.
Uses inspect.signature() to check callback parameter count at runtime:
- Callbacks with < 5 parameters: receive standard 4 args (backward compatible)
- Callbacks with >= 5 parameters: receive trigger_auto_apply as 5th arg
This maintains full backward compatibility while enabling the auto-apply feature
for DictItem/FloatArrayItem editors when callbacks opt-in by accepting the 5th
parameter.
Fixes: TypeError: callback() takes 4 positional arguments but 5 were given1 parent eab8470 commit 9bfac1d
2 files changed
+32
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
3 | 16 | | |
4 | 17 | | |
5 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
1555 | 1556 | | |
1556 | 1557 | | |
1557 | 1558 | | |
1558 | | - | |
1559 | | - | |
1560 | | - | |
1561 | | - | |
1562 | | - | |
1563 | | - | |
1564 | | - | |
1565 | | - | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
1566 | 1577 | | |
1567 | 1578 | | |
1568 | 1579 | | |
| |||
0 commit comments