@@ -110,25 +110,7 @@ void Satisfactory3DMap::AssetWindow::renderGui() {
110110
111111 const int maxElement = std::min ((exportPageIdx_ + 1 ) * pageSize, static_cast <int >(exportMap.size ()));
112112 for (int i = exportPageIdx_ * pageSize; i < maxElement; i++) {
113- const auto & exportEntry = exportMap[i];
114- if (ImGui::Button ((" View##" + std::to_string (i)).c_str ())) {
115- showExport (i);
116- }
117- ImGui::SameLine ();
118- if (ImGui::Button ((" Export##" + std::to_string (i)).c_str ())) {
119- exportExport (i);
120- }
121- ImGui::Text (" [%i]" , i);
122- ImGui::Text (" CookedSerialOffset: %" PRIu64, exportEntry.CookedSerialOffset );
123- ImGui::Text (" CookedSerialSize: %" PRIu64, exportEntry.CookedSerialSize );
124- ImGui::Text (" ObjectName: %s" , asset_->getNameString (exportEntry.ObjectName ).c_str ());
125- UI::ShowPackageObjectIndex (" OuterIndex" , exportEntry.OuterIndex , pakExplorer_->pakManager ());
126- UI::ShowPackageObjectIndex (" ClassIndex" , exportEntry.ClassIndex , pakExplorer_->pakManager ());
127- UI::ShowPackageObjectIndex (" SuperIndex" , exportEntry.SuperIndex , pakExplorer_->pakManager ());
128- UI::ShowPackageObjectIndex (" TemplateIndex" , exportEntry.TemplateIndex , pakExplorer_->pakManager ());
129- ImGui::Text (" PublicExportHash: %" PRIu64, exportEntry.PublicExportHash );
130- ImGui::Text (" ObjectFlags: %" PRIu32, exportEntry.ObjectFlags );
131- ImGui::Text (" FilterFlags: %" PRIu8, exportEntry.FilterFlags );
113+ drawExportEntry (exportMap[i], i);
132114 ImGui::Separator ();
133115 }
134116 }
@@ -164,6 +146,27 @@ void Satisfactory3DMap::AssetWindow::renderGui() {
164146 }
165147}
166148
149+ void Satisfactory3DMap::AssetWindow::drawExportEntry (const SatisfactorySave::FExportMapEntry& exportEntry, int i) {
150+ if (ImGui::Button ((" View##" + std::to_string (i)).c_str ())) {
151+ showExport (i);
152+ }
153+ ImGui::SameLine ();
154+ if (ImGui::Button ((" Export##" + std::to_string (i)).c_str ())) {
155+ exportExport (i);
156+ }
157+ ImGui::Text (" [%i]" , i);
158+ ImGui::Text (" CookedSerialOffset: %" PRIu64, exportEntry.CookedSerialOffset );
159+ ImGui::Text (" CookedSerialSize: %" PRIu64, exportEntry.CookedSerialSize );
160+ ImGui::Text (" ObjectName: %s" , asset_->getNameString (exportEntry.ObjectName ).c_str ());
161+ UI::ShowPackageObjectIndex (" OuterIndex" , exportEntry.OuterIndex , pakExplorer_->pakManager ());
162+ UI::ShowPackageObjectIndex (" ClassIndex" , exportEntry.ClassIndex , pakExplorer_->pakManager ());
163+ UI::ShowPackageObjectIndex (" SuperIndex" , exportEntry.SuperIndex , pakExplorer_->pakManager ());
164+ UI::ShowPackageObjectIndex (" TemplateIndex" , exportEntry.TemplateIndex , pakExplorer_->pakManager ());
165+ ImGui::Text (" PublicExportHash: %" PRIu64, exportEntry.PublicExportHash );
166+ ImGui::Text (" ObjectFlags: %" PRIu32, exportEntry.ObjectFlags );
167+ ImGui::Text (" FilterFlags: %" PRIu8, exportEntry.FilterFlags );
168+ }
169+
167170void Satisfactory3DMap::AssetWindow::showExport (int idx) {
168171 if (asset_ == nullptr ) {
169172 return ;
@@ -202,15 +205,17 @@ void Satisfactory3DMap::AssetWindow::drawExportTree(const std::vector<std::size_
202205 if (exportEntry.ClassIndex .IsScriptImport ()) {
203206 name += " " + pakExplorer_->pakManager ()->tryGetScriptObjectFullName (exportEntry.ClassIndex );
204207 }
205- if (exportChildren_[n].empty ()) {
206- if (ImGui::TreeNodeEx (name.c_str (), ImGuiTreeNodeFlags_Leaf)) {
207- ImGui::TreePop ();
208- }
209- } else {
210- if (ImGui::TreeNodeEx (name.c_str (), 0 )) {
208+ const bool is_leaf = exportChildren_[n].empty ();
209+ const bool open = ImGui::TreeNodeEx (name.c_str (), is_leaf ? ImGuiTreeNodeFlags_Leaf : 0 );
210+ if (ImGui::BeginPopupContextItem ()) {
211+ drawExportEntry (exportEntry, static_cast <int >(n));
212+ ImGui::EndPopup ();
213+ }
214+ if (open) {
215+ if (!is_leaf) {
211216 drawExportTree (exportChildren_[n]);
212- ImGui::TreePop ();
213217 }
218+ ImGui::TreePop ();
214219 }
215220 ImGui::PopID ();
216221 }
0 commit comments