@@ -157,23 +157,54 @@ void ThumbnailCaptureScript::CaptureImage() {
157157void ThumbnailCaptureScript::InjectListeners () {
158158 RemoveListeners ();
159159 for (auto catUI : GetEditor ()->mpPartsPaletteUI ->mCategories ) {
160- for (auto pageUI : catUI->mPageUIs ) {
161- for (auto itemUI : pageUI.page ->mStandardItems ) {
162- itemUI->field_18 ->AddWinProc (this );
163- mItemViewers [itemUI->field_18 .get ()] = itemUI->mpViewer .get ();
160+ auto subCatUIs = catUI->mpSubcategoriesUI ;
161+ if (subCatUIs) {
162+ for (auto subCatUI : subCatUIs->mCategoryUIs ) {
163+ for (auto pageUI : catUI->mPageUIs ) {
164+ for (auto itemUI : pageUI.page ->mStandardItems ) {
165+ itemUI->field_18 ->AddWinProc (this );
166+ mItemViewers [itemUI->field_18 .get ()] = itemUI->mpViewer .get ();
167+ }
168+ }
169+ }
170+ }
171+ else {
172+ for (auto pageUI : catUI->mPageUIs ) {
173+ for (auto itemUI : pageUI.page ->mStandardItems ) {
174+ itemUI->field_18 ->AddWinProc (this );
175+ mItemViewers [itemUI->field_18 .get ()] = itemUI->mpViewer .get ();
176+ }
164177 }
165178 }
179+
180+
181+
166182 }
167183
168184 Renderer.RegisterLayer (this , 40 );
169185}
170186
171187void ThumbnailCaptureScript::RemoveListeners () {
188+
172189 for (auto catUI : GetEditor ()->mpPartsPaletteUI ->mCategories ) {
173- for (auto pageUI : catUI->mPageUIs ) {
174- for (auto itemUI : pageUI.page ->mStandardItems ) {
175- if (itemUI && itemUI->field_18 ) {
176- itemUI->field_18 ->RemoveWinProc (this );
190+ auto subCatUIs = catUI->mpSubcategoriesUI ;
191+ if (subCatUIs) {
192+ for (auto subCatUI : subCatUIs->mCategoryUIs ) {
193+ for (auto pageUI : catUI->mPageUIs ) {
194+ for (auto itemUI : pageUI.page ->mStandardItems ) {
195+ if (itemUI && itemUI->field_18 ) {
196+ itemUI->field_18 ->RemoveWinProc (this );
197+ }
198+ }
199+ }
200+ }
201+ }
202+ else {
203+ for (auto pageUI : catUI->mPageUIs ) {
204+ for (auto itemUI : pageUI.page ->mStandardItems ) {
205+ if (itemUI && itemUI->field_18 ) {
206+ itemUI->field_18 ->RemoveWinProc (this );
207+ }
177208 }
178209 }
179210 }
0 commit comments