Commit 695c7d0
committed
Fix button compatibility layer - don't override Chili Button globally
The previous implementation globally overrode Button and TabbedPanelButton,
breaking all Chili UI code. This caused crashes in links.lua trying to call
AutoDispose() on the fake Button object.
New approach:
- DON'T override Button or TabbedPanelButton globally
- Keep Chili buttons working normally
- During Editor:_FinalizeRmlUi(), convert Chili buttons to RmlUi buttons
- This happens only when an editor finalizes in RmlUi mode
Changes:
- rmlui_field_compat.lua:
- Remove global Button and TabbedPanelButton overrides
- Keep RmlUiButton and RmlUiTabbedPanelButton as conversion targets
- Updated RmlUiTabbedPanelButton to accept caption/image directly
- editor.lua:
- Add ConvertChiliButtonToRmlUi() helper function
- Detect Chili TabbedPanelButton by SetPressedState + children
- Detect Chili Button by caption + OnClick
- Extract caption/image from Chili button children
- Convert during _FinalizeRmlUi() instead of at creation time
- Handle buttons in field.ctrl.children for AddControl() buttons
Now editors create Chili buttons as normal, and they get converted to
RmlUi buttons only when rendering in RmlUi mode. Chili UI remains intact.1 parent 3574790 commit 695c7d0
2 files changed
+81
-51
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
724 | 724 | | |
725 | 725 | | |
726 | 726 | | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
727 | 772 | | |
728 | 773 | | |
729 | 774 | | |
730 | 775 | | |
731 | 776 | | |
732 | | - | |
| 777 | + | |
733 | 778 | | |
734 | 779 | | |
735 | 780 | | |
736 | 781 | | |
737 | 782 | | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
744 | 791 | | |
745 | 792 | | |
746 | 793 | | |
| |||
765 | 812 | | |
766 | 813 | | |
767 | 814 | | |
768 | | - | |
769 | | - | |
770 | | - | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
771 | 834 | | |
772 | | - | |
| 835 | + | |
773 | 836 | | |
774 | 837 | | |
775 | 838 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 70 | + | |
79 | 71 | | |
80 | 72 | | |
81 | 73 | | |
| |||
86 | 78 | | |
87 | 79 | | |
88 | 80 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
102 | 84 | | |
103 | 85 | | |
104 | 86 | | |
| |||
129 | 111 | | |
130 | 112 | | |
131 | 113 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | 114 | | |
0 commit comments