Skip to content

Commit

Permalink
#401: some Patch menu items disabled without a selected patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Mott committed Aug 9, 2022
1 parent 691ce2c commit 52d8545
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
6 changes: 6 additions & 0 deletions libs/selectionlib.h
Expand Up @@ -252,6 +252,12 @@ namespace pred
const auto& info = GlobalSelectionSystem().getSelectionInfo();
return info.totalCount == n && info.entityCount == n;
}

/// Return true if at least one patch is selected
inline bool havePatch()
{
return GlobalSelectionSystem().getSelectionInfo().patchCount > 0;
}
}

} // namespace selection
15 changes: 9 additions & 6 deletions radiant/ui/UserInterfaceModule.cpp
Expand Up @@ -425,12 +425,15 @@ void UserInterfaceModule::registerUICommands()
GlobalCommandSystem().addCommand("CreateNewLayerDialog", CreateLayerDialog::CreateNewLayer,
{ cmd::ARGTYPE_STRING | cmd::ARGTYPE_OPTIONAL });

GlobalCommandSystem().addCommand("BulgePatchDialog", BulgePatchDialog::BulgePatchCmd);
GlobalCommandSystem().addCommand("PatchCapDialog", PatchCapDialog::Show);
GlobalCommandSystem().addCommand("ThickenPatchDialog", PatchThickenDialog::Show);
GlobalCommandSystem().addCommand("CreateSimplePatchDialog", PatchCreateDialog::Show);

GlobalCommandSystem().addCommand("ExportCollisionModelDialog", ExportCollisionModelDialog::Show);
GlobalCommandSystem().addWithCheck("BulgePatchDialog", BulgePatchDialog::BulgePatchCmd,
selection::pred::havePatch);
GlobalCommandSystem().addWithCheck("PatchCapDialog", PatchCapDialog::Show,
selection::pred::havePatch);
GlobalCommandSystem().addWithCheck("ThickenPatchDialog", PatchThickenDialog::Show,
selection::pred::havePatch);
GlobalCommandSystem().addCommand("CreateSimplePatchDialog", PatchCreateDialog::Show);

GlobalCommandSystem().addCommand("ExportCollisionModelDialog", ExportCollisionModelDialog::Show);
GlobalCommandSystem().addWithCheck("QueryBrushPrefabSidesDialog", QuerySidesDialog::Show,
selection::pred::haveSelectedBrush, {cmd::ARGTYPE_INT});

Expand Down

0 comments on commit 52d8545

Please sign in to comment.