@@ -93,6 +93,32 @@ void LabUi::build_weapon_subtype_list() const
9393 }
9494}
9595
96+ void LabUi::build_prop_subtype_list () const
97+ {
98+ for (size_t i = 0 ; i < Prop_categories.size (); i++) {
99+ with_TreeNode (Prop_categories[i].name .c_str ())
100+ {
101+ int prop_idx = 0 ;
102+
103+ for (auto const & class_def : Prop_info) {
104+ if (lcase_equal (class_def.category , Prop_categories[i].name )) {
105+ SCP_string node_label;
106+ sprintf (node_label, " ##PropClassIndex%i" , prop_idx);
107+ TreeNodeEx (node_label.c_str (),
108+ ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen,
109+ " %s" ,
110+ class_def.name .c_str ());
111+
112+ if (IsItemClicked () && !IsItemToggledOpen ()) {
113+ getLabManager ()->changeDisplayedObject (LabMode::Prop, prop_idx);
114+ }
115+ }
116+ prop_idx++;
117+ }
118+ }
119+ }
120+ }
121+
96122void LabUi::build_asteroid_list ()
97123{
98124 with_TreeNode (" Asteroids" )
@@ -178,24 +204,11 @@ void LabUi::build_object_list()
178204 }
179205}
180206
181- void LabUi::build_prop_list ()
207+ void LabUi::build_prop_list () const
182208{
183209 with_TreeNode (" Prop Classes" )
184210 {
185- int prop_info_idx = 0 ;
186-
187- for (auto const & class_def : Prop_info) {
188- SCP_string node_label;
189- sprintf (node_label, " ##PropClassIndex%i" , prop_info_idx);
190- TreeNodeEx (node_label.c_str (),
191- ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen,
192- " %s" ,
193- class_def.name );
194- if (IsItemClicked () && !IsItemToggledOpen ()) {
195- getLabManager ()->changeDisplayedObject (LabMode::Prop, prop_info_idx);
196- }
197- prop_info_idx++;
198- }
211+ build_prop_subtype_list ();
199212 }
200213}
201214
@@ -300,9 +313,9 @@ void LabUi::show_object_selector() const
300313
301314 build_weapon_list ();
302315
303- build_object_list ();
304-
305316 build_prop_list ();
317+
318+ build_object_list ();
306319 }
307320 }
308321}
0 commit comments