| 178 | } |
| 179 | |
| 180 | void drawUI() |
| 181 | { |
| 182 | /////////////////////////////////////////////////////////////////////////////////////////// |
| 183 | // Assets Selection |
| 184 | /////////////////////////////////////////////////////////////////////////////////////////// |
| 185 | { |
| 186 | static int mode = 0; |
| 187 | ImGui::RadioButton("Replace", &mode, 0); ImGui::SameLine(); |
| 188 | ImGui::RadioButton("Append", &mode, 1); |
| 189 | |
| 190 | ImGui::ListBoxHeader("Assets", (int)m_assets.size()); |
| 191 | for (uint32_t i = 0; i < m_assets.size(); ++i) |
| 192 | { |
| 193 | ImVec4 color = m_assets[i]->getUIColor(); |
| 194 | color.w = color.w * (m_assets[i]->isLoaded() ? 1.0f : 0.5f); |
| 195 | ImGui::PushStyleColor(ImGuiCol_Text, color); |
| 196 | if (ImGui::Selectable(m_assets[i]->getName(), m_lastSpawnedAsset == i)) |
| 197 | { |
| 198 | m_lastSpawnedAsset = i; |
| 199 | if (mode == 0) |
| 200 | { |
| 201 | removeAllSceneActors(); |
| 202 | } |
| 203 | m_commonUIController.addDelayedCall([=]() { spawnAsset(m_lastSpawnedAsset); }, "Loading Asset"); |
| 204 | } |
| 205 | ImGui::PopStyleColor(); |
| 206 | } |
| 207 | ImGui::ListBoxFooter(); |
| 208 | } |
| 209 | |
| 210 | ImGui::Spacing(); |
| 211 | ImGui::Separator(); |
| 212 | |
| 213 | /////////////////////////////////////////////////////////////////////////////////////////// |
| 214 | // Actors Selection |
| 215 | /////////////////////////////////////////////////////////////////////////////////////////// |
| 216 | { |
| 217 | // actor's list |
| 218 | { |
| 219 | int itemCount = 0; |
| 220 | for (size_t i = 0; i < m_sceneActors.size(); ++i) |
| 221 | { |
| 222 | itemCount += 1 + m_sceneActors[i]->getSubactorCount(); |
| 223 | } |
| 224 | |
| 225 | ImGui::ListBoxHeader("Scene Actors", itemCount); |
| 226 | for (int i = 0; i < (int)m_sceneActors.size(); ++i) |
| 227 | { |
| 228 | ImVec4 color = m_sceneActors[i]->getUIColor(); |
| 229 | ImGui::PushStyleColor(ImGuiCol_Text, color); |
| 230 | |
| 231 | const bool isSelected = (m_selectedActor.index == i); |
| 232 | |
| 233 | ImGui::PushID(i); |
| 234 | if (ImGui::Selectable(m_sceneActors[i]->getName(), isSelected && m_selectedActor.subindex == -1)) |
| 235 | { |
| 236 | setSelectedActor(i); |
| 237 | } |
nothing calls this directly
no test coverage detected