diff options
Diffstat (limited to 'editor')
| -rw-r--r-- | editor/editor.cpp | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp index 40f187a..0743db9 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -511,29 +511,21 @@ void RecordImGuiModalCreateAsset() { ImGui::InputText("Asset Key", assetKey, AssetKeyLength); - static bool bShader = false, bModel = false, bTexture = false, bAudio = false; - if (ImGui::Checkbox("Shader", &bShader)) { - bModel = false; - bTexture = false; - bAudio = false; + static uint32_t assetTypeMask = 0U; + if (ImGui::CheckboxFlags("Shader", &assetTypeMask, 1U << static_cast<AssetType_T>(PKE_ASSET_TYPE_SHADER))) { + assetTypeMask = assetTypeMask & (1U << static_cast<AssetType_T>(PKE_ASSET_TYPE_SHADER)); type = PKE_ASSET_TYPE_SHADER; } - if (ImGui::Checkbox("Model", &bModel)) { - bShader = false; - bTexture = false; - bAudio = false; + if (ImGui::CheckboxFlags("Model", &assetTypeMask, 1U << static_cast<AssetType_T>(PKE_ASSET_TYPE_MODEL))) { + assetTypeMask = assetTypeMask & (1U << static_cast<AssetType_T>(PKE_ASSET_TYPE_MODEL)); type = PKE_ASSET_TYPE_MODEL; } - if (ImGui::Checkbox("Texture", &bTexture)) { - bShader = false; - bModel = false; - bAudio = false; + if (ImGui::CheckboxFlags("Texture", &assetTypeMask, 1U << static_cast<AssetType_T>(PKE_ASSET_TYPE_TEXTURE))) { + assetTypeMask = assetTypeMask & (1U << static_cast<AssetType_T>(PKE_ASSET_TYPE_TEXTURE)); type = PKE_ASSET_TYPE_TEXTURE; } - if (ImGui::Checkbox("Audio", &bAudio)) { - bShader = false; - bModel = false; - bTexture = false; + if (ImGui::CheckboxFlags("Audio", &assetTypeMask, 1U << static_cast<AssetType_T>(PKE_ASSET_TYPE_AUDIO))) { + assetTypeMask = assetTypeMask & (1U << static_cast<AssetType_T>(PKE_ASSET_TYPE_AUDIO)); type = PKE_ASSET_TYPE_AUDIO; } @@ -562,10 +554,7 @@ void RecordImGuiModalCreateAsset() { if (shouldClose) { type = PKE_ASSET_TYPE_UNSET; - bModel = false; - bTexture = false; - bModel = false; - bAudio = false; + assetTypeMask = 0U; assetKey[0] = '\0'; assetPath[0] = '\0'; ImGui::CloseCurrentPopup(); |
