@@ -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" )
@@ -172,24 +198,11 @@ void LabUi::build_object_list()
172198 }
173199}
174200
175- void LabUi::build_prop_list ()
201+ void LabUi::build_prop_list () const
176202{
177203 with_TreeNode (" Prop Classes" )
178204 {
179- int prop_info_idx = 0 ;
180-
181- for (auto const & class_def : Prop_info) {
182- SCP_string node_label;
183- sprintf (node_label, " ##PropClassIndex%i" , prop_info_idx);
184- TreeNodeEx (node_label.c_str (),
185- ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen,
186- " %s" ,
187- class_def.name );
188- if (IsItemClicked () && !IsItemToggledOpen ()) {
189- getLabManager ()->changeDisplayedObject (LabMode::Prop, prop_info_idx);
190- }
191- prop_info_idx++;
192- }
205+ build_prop_subtype_list ();
193206 }
194207}
195208
@@ -294,9 +307,9 @@ void LabUi::show_object_selector() const
294307
295308 build_weapon_list ();
296309
297- build_object_list ();
298-
299310 build_prop_list ();
311+
312+ build_object_list ();
300313 }
301314 }
302315}
0 commit comments