[LYN-3419] Removed now unused viewportSearch from ViewportTitleDlg and all related code.

This commit is contained in:
Chris Galvan
2021-04-30 06:58:16 -05:00
parent 217ba1e816
commit 9da11f9d3b
11 changed files with 2 additions and 537 deletions
-14
View File
@@ -476,11 +476,9 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_OPEN_ASSET_BROWSER, OnOpenAssetBrowserView)
ON_COMMAND(ID_OPEN_AUDIO_CONTROLS_BROWSER, OnOpenAudioControlsEditor)
ON_COMMAND(ID_GOTO_VIEWPORTSEARCH, OnGotoViewportSearch)
ON_COMMAND(ID_DISPLAY_SHOWHELPERS, OnShowHelpers)
ON_COMMAND(ID_OPEN_TRACKVIEW, OnOpenTrackView)
ON_COMMAND(ID_OPEN_UICANVASEDITOR, OnOpenUICanvasEditor)
ON_COMMAND(ID_GOTO_VIEWPORTSEARCH, OnGotoViewportSearch)
ON_COMMAND(ID_TERRAIN_TIMEOFDAY, OnTimeOfDay)
ON_COMMAND(ID_TERRAIN_TIMEOFDAYBUTTON, OnTimeOfDay)
@@ -4317,18 +4315,6 @@ void CCryEditApp::OnUpdateGameSpec(QAction* action)
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnGotoViewportSearch()
{
if (MainWindow::instance())
{
CLayoutViewPane* viewPane = MainWindow::instance()->GetActiveView();
if (viewPane)
{
viewPane->SetFocusToViewportSearch();
}
}
}
RecentFileList* CCryEditApp::GetRecentFileList()
{
static RecentFileList list;
-1
View File
@@ -438,7 +438,6 @@ private:
void OnOpenTrackView();
void OnOpenAudioControlsEditor();
void OnOpenUICanvasEditor();
void OnGotoViewportSearch();
void OnTimeOfDay();
void OnChangeGameSpec(UINT nID);
void SetGameSpecCheck(ESystemConfigSpec spec, ESystemConfigPlatform platform, int &nCheck, bool &enable);
@@ -2338,10 +2338,7 @@ void CObjectManager::UpdateVisibilityList()
// in the view (frustum) to the visible objects list so we can draw feedback for
// entities being hidden in the viewport when selected in the entity outliner
// (EditorVisibleEntityDataCache must be populated even if entities are 'hidden')
if (visible)
{
m_visibleObjects.push_back(obj);
}
m_visibleObjects.push_back(obj);
}
m_isUpdateVisibilityList = false;
-1
View File
@@ -265,7 +265,6 @@
#define ID_OPEN_ASSET_BROWSER 34077
#define ID_SNAP_TO_GRID_RANGE_BEGIN 34087
#define ID_SNAP_TO_GRID_RANGE_END 34106
#define ID_GOTO_VIEWPORTSEARCH 34137
#define ID_TOOLS_EXPORT_SHORTCUTS 34138
#define ID_TOOLS_IMPORT_SHORTCUTS 34139
#define ID_TOOLS_VALIDATEOBJECTPOSITIONS 34143
-2
View File
@@ -254,8 +254,6 @@ SEditorSettings::SEditorSettings()
bForceSkyUpdate = true;
bIsSearchFilterActive = false;
backgroundUpdatePeriod = 0;
g_TemporaryLevelName = nullptr;
-1
View File
@@ -477,7 +477,6 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
bool bVisualizeNavigationAccessibility;
int navigationDebugAgentType;
bool bIsSearchFilterActive;
int backgroundUpdatePeriod;
const char* g_TemporaryLevelName;
-6
View File
@@ -665,12 +665,6 @@ void CLayoutViewPane::SetFullscreenViewport(bool b)
}
}
//////////////////////////////////////////////////////////////////////////
void CLayoutViewPane::SetFocusToViewportSearch()
{
m_viewportTitleDlg.SetFocusToSearchField();
}
//////////////////////////////////////////////////////////////////////////
void CLayoutViewPane::SetFocusToViewport()
{
-1
View File
@@ -73,7 +73,6 @@ public:
void ShowTitleMenu();
void ToggleMaximize();
void SetFocusToViewportSearch();
void SetFocusToViewport();
void ResizeViewport(int width, int height);
-435
View File
@@ -63,33 +63,9 @@ inline namespace Helpers
}
}
const int SEARCH_BY_NAME = 1;
const int SEARCH_BY_TYPE = 2;
const int SEARCH_BY_ASSET = 3;
const int HIDE_OTHERS = 4;
const int FREEZE_OTHERS = 5;
const int JUST_SELLECT = 6;
const int LOGICAL_AND = 7;
const int LOGICAL_OR = 8;
const int INPUT_NAMES_FROM_SELECTION = 9;
CViewportTitleDlg::CViewportTitleDlg(QWidget* pParent)
: QWidget(pParent)
, m_searchMode(ESM_BY_NAME)
, m_searchResultHandling(ESRH_HIDE_OTHERS)
, m_bOR(false)
, m_ui(new Ui::ViewportTitleDlg)
, m_searchModeActionGroup(nullptr)
, m_searchByNameAction(nullptr)
, m_searchByTypeAction(nullptr)
, m_searchByAssetAction(nullptr)
, m_searchResultHandlingActionGroup(nullptr)
, m_searchHideOthersAction(nullptr)
, m_searchFreezeOthersAction(nullptr)
, m_searchJustSelectAction(nullptr)
, m_searchMatchTypeActionGroup(nullptr)
, m_searchAndAction(nullptr)
, m_searchOrAction(nullptr)
{
auto container = new QWidget(this);
m_ui->setupUi(container);
@@ -106,9 +82,6 @@ CViewportTitleDlg::CViewportTitleDlg(QWidget* pParent)
LoadCustomPresets("AspectRatioPresets", "AspectRatioPreset", m_customAspectRatioPresets);
LoadCustomPresets("ResPresets", "ResPreset", m_customResPresets);
m_ui->m_viewportSearch->setEnabled(false);
m_ui->m_viewportSearch->setVisible(false);
OnInitDialog();
connect(m_ui->m_fovLabel, &QWidget::customContextMenuRequested, this, &CViewportTitleDlg::PopUpFOVMenu);
@@ -142,8 +115,6 @@ void CViewportTitleDlg::OnInitDialog()
m_ui->m_titleBtn->setText(m_title);
m_ui->m_sizeStaticCtrl->setText(QString());
UpdateSearchOptionsText();
m_ui->m_toggleHelpersBtn->setChecked(GetIEditor()->GetDisplaySettings()->IsDisplayHelpers());
ICVar* pDisplayInfo(gEnv->pConsole->GetCVar("r_displayInfo"));
@@ -160,77 +131,6 @@ void CViewportTitleDlg::OnInitDialog()
m_ui->m_toggleHelpersBtn->setProperty("class", "big");
m_ui->m_toggleDisplayInfoBtn->setProperty("class", "big");
// ON_EN_CHANGE(IDC_VIEWPORT_SEARCH, OnSearchTermChange)
}
//////////////////////////////////////////////////////////////////////////
QMenu * CViewportTitleDlg::InitializeViewportSearchMenu()
{
QMenu* menu = new QMenu(this);
m_searchByNameAction = menu->addAction(tr("By Name"));
m_searchByNameAction->setData(SEARCH_BY_NAME);
m_searchByNameAction->setCheckable(true);
m_searchByNameAction->setChecked(m_searchMode == ESM_BY_NAME);
m_searchByTypeAction = menu->addAction(tr("By Type"));
m_searchByTypeAction->setData(SEARCH_BY_TYPE);
m_searchByTypeAction->setCheckable(true);
m_searchByTypeAction->setChecked(m_searchMode == ESM_BY_TYPE);
m_searchByAssetAction = menu->addAction(tr("By Asset"));
m_searchByAssetAction->setData(SEARCH_BY_ASSET);
m_searchByAssetAction->setCheckable(true);
m_searchByAssetAction->setChecked(m_searchMode == ESM_BY_ASSET);
menu->addSeparator();
m_searchHideOthersAction = menu->addAction(tr("Hide others"));
m_searchHideOthersAction->setData(HIDE_OTHERS);
m_searchHideOthersAction->setCheckable(true);
m_searchHideOthersAction->setChecked(m_searchResultHandling == ESRH_HIDE_OTHERS);
m_searchFreezeOthersAction = menu->addAction(tr("Freeze others"));
m_searchFreezeOthersAction->setData(FREEZE_OTHERS);
m_searchFreezeOthersAction->setCheckable(true);
m_searchFreezeOthersAction->setChecked(m_searchResultHandling == ESRH_FREEZE_OTHERS);
m_searchJustSelectAction = menu->addAction(tr("Just Select"));
m_searchJustSelectAction->setData(JUST_SELLECT);
m_searchJustSelectAction->setCheckable(true);
m_searchJustSelectAction->setChecked(m_searchResultHandling == ESRH_JUST_SELECT);
menu->addSeparator();
m_searchAndAction = menu->addAction(tr("AND"));
m_searchAndAction->setData(LOGICAL_AND);
m_searchAndAction->setCheckable(true);
m_searchAndAction->setChecked(!m_bOR);
m_searchOrAction = menu->addAction(tr("OR"));
m_searchOrAction->setData(LOGICAL_OR);
m_searchOrAction->setCheckable(true);
m_searchOrAction->setChecked(m_bOR);
menu->addSeparator();
menu->addAction(tr("Input names from selection"))->setData(INPUT_NAMES_FROM_SELECTION);
// Add the search mode, search result handling, and match type actions to
// exclusive action groups so that only one can be checked at a time, and
// you can't un-check the active action
m_searchModeActionGroup = new QActionGroup(this);
m_searchModeActionGroup->setExclusive(true);
m_searchModeActionGroup->addAction(m_searchByNameAction);
m_searchModeActionGroup->addAction(m_searchByTypeAction);
m_searchModeActionGroup->addAction(m_searchByAssetAction);
m_searchResultHandlingActionGroup = new QActionGroup(this);
m_searchResultHandlingActionGroup->setExclusive(true);
m_searchResultHandlingActionGroup->addAction(m_searchHideOthersAction);
m_searchResultHandlingActionGroup->addAction(m_searchFreezeOthersAction);
m_searchResultHandlingActionGroup->addAction(m_searchJustSelectAction);
m_searchMatchTypeActionGroup = new QActionGroup(this);
m_searchMatchTypeActionGroup->setExclusive(true);
m_searchMatchTypeActionGroup->addAction(m_searchAndAction);
m_searchMatchTypeActionGroup->addAction(m_searchOrAction);
return menu;
}
//////////////////////////////////////////////////////////////////////////
@@ -238,8 +138,6 @@ void CViewportTitleDlg::SetTitle(const QString& title)
{
m_title = title;
m_ui->m_titleBtn->setText(m_title);
m_ui->m_viewportSearch->setVisible(false);
}
//////////////////////////////////////////////////////////////////////////
@@ -624,339 +522,6 @@ void CViewportTitleDlg::OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_
}
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::InputNamesToSearchFromSelection()
{
IObjectManager* pObjMgr = GetIEditor()->GetObjectManager();
CSelectionGroup* pSelected = pObjMgr->GetSelection();
QString names;
for (int i = 0; i < pSelected->GetCount(); ++i)
{
names += pSelected->GetObject(i)->GetName();
names += QStringLiteral(" ");
}
m_ui->m_viewportSearch->setText(names);
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::OnViewportSearchButtonClicked(const QAction* clickedAction)
{
int cmd = clickedAction ? clickedAction->data().toInt() : 0;
#define ASSIGN(dst, src) do { if ((dst) != (src)) { (dst) = (src); OnSearchTermChange(); } \
} \
while (0)
if (cmd == SEARCH_BY_NAME)
{
ASSIGN(m_searchMode, ESM_BY_NAME);
}
else if (cmd == SEARCH_BY_TYPE)
{
ASSIGN(m_searchMode, ESM_BY_TYPE);
}
else if (cmd == SEARCH_BY_ASSET)
{
ASSIGN(m_searchMode, ESM_BY_ASSET);
}
else if (cmd == HIDE_OTHERS)
{
ASSIGN(m_searchResultHandling, ESRH_HIDE_OTHERS);
}
else if (cmd == FREEZE_OTHERS)
{
ASSIGN(m_searchResultHandling, ESRH_FREEZE_OTHERS);
}
else if (cmd == JUST_SELLECT)
{
ASSIGN(m_searchResultHandling, ESRH_JUST_SELECT);
}
else if (cmd == LOGICAL_AND)
{
ASSIGN(m_bOR, false);
}
else if (cmd == LOGICAL_OR)
{
ASSIGN(m_bOR, true);
}
else if (cmd == INPUT_NAMES_FROM_SELECTION)
{
InputNamesToSearchFromSelection();
m_bOR = true;
m_searchOrAction->setChecked(true);
OnSearchTermChange();
}
UpdateSearchOptionsText();
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::OnViewportSearchClear()
{
UnhideUnfreezeAll();
//clear edit control
gSettings.bIsSearchFilterActive = false;
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::SetFocusToSearchField()
{
if (m_ui->m_viewportSearch->isVisible())
{
m_ui->m_viewportSearch->setFocus();
}
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::OnSearchTermChange()
{
// Get individual search terms.
const QString searchTerm = m_ui->m_viewportSearch->text();
if (!searchTerm.isEmpty())
{
gSettings.bIsSearchFilterActive = true;
}
else
{
gSettings.bIsSearchFilterActive = false;
}
const int MIN_CHARS_AS_A_SEARCH_TERM = 3;
QStringList terms;
QStringList splitTerms = searchTerm.split(QStringLiteral(" "));
for (const QString& term : splitTerms)
{
if (term.length() >= MIN_CHARS_AS_A_SEARCH_TERM)
{
terms.append(term);
}
}
if (terms.isEmpty())
{
UnhideUnfreezeAll();
return;
}
// Make sure to lower case all terms because later we lower case all inputs to compare against
for (QString& term : terms)
{
term = term.toLower();
}
// Perform a search.
if (m_searchMode == ESM_BY_NAME)
{
SearchByName(terms);
}
else if (m_searchMode == ESM_BY_TYPE)
{
SearchByType(terms);
}
else if (m_searchMode == ESM_BY_ASSET)
{
SearchByAsset(terms);
}
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::UnhideUnfreezeAll()
{
IObjectManager* pObjMgr = GetIEditor()->GetObjectManager();
int objCount = pObjMgr->GetObjectCount();
CBaseObjectsArray objects;
pObjMgr->GetObjects(objects);
for (int i = 0; i < objCount; ++i)
{
CBaseObject* pObject = objects[i];
pObjMgr->FreezeObject(pObject, false);
pObjMgr->HideObject(pObject, false);
}
}
//////////////////////////////////////////////////////////////////////////
static bool DoesTextSatisfyTerms(const QString& text, const QStringList& terms, bool bOR)
{
if (bOR) // OR
{
for (const QString& term : terms)
{
if (text.contains(term))
{
return true;
}
}
return false;
}
else // AND
{
for (const QString& term : terms)
{
if (!text.contains(term))
{
return false;
}
}
return true;
}
}
//////////////////////////////////////////////////////////////////////////
static void HandleMatched(CBaseObject* pObject)
{
IObjectManager* pObjMgr = GetIEditor()->GetObjectManager();
pObjMgr->FreezeObject(pObject, false);
pObjMgr->HideObject(pObject, false);
pObjMgr->SelectObject(pObject);
}
//////////////////////////////////////////////////////////////////////////
static void HandleFiltered(CBaseObject* pObject, CViewportTitleDlg::ESearchResultHandling searchResultHandling)
{
IObjectManager* pObjMgr = GetIEditor()->GetObjectManager();
pObjMgr->UnselectObject(pObject);
if (searchResultHandling == CViewportTitleDlg::ESRH_HIDE_OTHERS)
{
pObjMgr->FreezeObject(pObject, false);
pObjMgr->HideObject(pObject, true);
}
else if (searchResultHandling == CViewportTitleDlg::ESRH_FREEZE_OTHERS)
{
pObjMgr->HideObject(pObject, false);
pObjMgr->FreezeObject(pObject, true);
}
else if (searchResultHandling == CViewportTitleDlg::ESRH_JUST_SELECT)
{
pObjMgr->FreezeObject(pObject, false);
pObjMgr->HideObject(pObject, false);
}
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::SearchByType(const QStringList& terms)
{
IObjectManager* pObjMgr = GetIEditor()->GetObjectManager();
int objCount = pObjMgr->GetObjectCount();
CBaseObjectsArray objects;
pObjMgr->GetObjects(objects);
for (int i = 0; i < objCount; ++i)
{
CBaseObject* pObject = objects[i];
QString type = pObject->GetTypeDescription();
if (DoesTextSatisfyTerms(type.toLower(), terms, m_bOR))
{
HandleMatched(pObject);
}
else
{
HandleFiltered(pObject, m_searchResultHandling);
}
}
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::SearchByName(const QStringList& terms)
{
IObjectManager* pObjMgr = GetIEditor()->GetObjectManager();
int objCount = pObjMgr->GetObjectCount();
CBaseObjectsArray objects;
pObjMgr->GetObjects(objects);
for (int i = 0; i < objCount; ++i)
{
CBaseObject* pObject = objects[i];
QString name = pObject->GetName();
if (DoesTextSatisfyTerms(name.toLower(), terms, m_bOR))
{
HandleMatched(pObject);
}
else
{
HandleFiltered(pObject, m_searchResultHandling);
}
}
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::SearchByAsset(const QStringList& terms)
{
IObjectManager* pObjMgr = GetIEditor()->GetObjectManager();
int objCount = pObjMgr->GetObjectCount();
CBaseObjectsArray objects;
pObjMgr->GetObjects(objects);
for (int i = 0; i < objCount; ++i)
{
CBaseObject* pObject = objects[i];
CUsedResources usedAssets;
pObject->GatherUsedResources(usedAssets);
CUsedResources::TResourceFiles::const_iterator itr = usedAssets.files.begin(),
end = usedAssets.files.end();
bool bMatch = false;
for (; itr != end; ++itr)
{
QString filename = *itr;
if (DoesTextSatisfyTerms(filename.toLower(), terms, m_bOR))
{
bMatch = true;
break;
}
}
if (bMatch)
{
HandleMatched(pObject);
}
else
{
HandleFiltered(pObject, m_searchResultHandling);
}
}
}
//////////////////////////////////////////////////////////////////////////
void CViewportTitleDlg::UpdateSearchOptionsText()
{
QString str = "";
if (m_searchMode == ESM_BY_NAME)
{
str += tr("By Name");
}
else if (m_searchMode == ESM_BY_TYPE)
{
str += tr("By Type");
}
else //if(m_searchMode == ESM_BY_ASSET)
{
str += tr("By Asset");
}
if (m_searchResultHandling == ESRH_HIDE_OTHERS)
{
str += tr(", Hide filtered");
}
else if (m_searchResultHandling == ESRH_FREEZE_OTHERS)
{
str += tr(", Freeze filtered");
}
else if (m_searchResultHandling == ESRH_JUST_SELECT)
{
str += tr(", Just Select");
}
if (m_bOR)
{
str += tr(", OR");
}
else
{
str += tr(", AND");
}
m_ui->m_viewportSearch->setPlaceholderText(str);
}
void CViewportTitleDlg::LoadCustomPresets(const QString& section, const QString& keyName, QStringList& outCustompresets)
{
QSettings settings("Amazon", "O3DE"); // Temporary solution until we have the global Settings class.
-44
View File
@@ -28,7 +28,6 @@ class CLayoutViewPane;
class CPopupMenuItem;
class QAbstractButton;
class QActionGroup;
class QMenu;
struct ICVar;
@@ -53,22 +52,6 @@ public:
void SetTitle(const QString& title);
void OnViewportSizeChanged(int width, int height);
void OnViewportFOVChanged(float fov);
void SetFocusToSearchField();
// Dialog Data
enum ESearchResultHandling
{
ESRH_HIDE_OTHERS = 0,
ESRH_FREEZE_OTHERS,
ESRH_JUST_SELECT,
};
enum ESearchMode
{
ESM_BY_NAME = 0,
ESM_BY_TYPE,
ESM_BY_ASSET,
};
static void AddFOVMenus(QMenu* menu, std::function<void(float)> callback, const QStringList& customPresets);
static void AddAspectRatioMenus(QMenu* menu, std::function<void(int, int)> callback, const QStringList& customPresets);
@@ -87,7 +70,6 @@ public:
protected:
virtual void OnInitDialog();
QMenu *InitializeViewportSearchMenu();
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam) override;
@@ -95,18 +77,11 @@ protected:
void OnMaximize();
void OnToggleHelpers();
void OnToggleDisplayInfo();
void OnSearchTermChange();
void OnViewportSearchButtonClicked(const QAction* clickedAction);
void OnViewportSearchClear();
QString m_title;
CLayoutViewPane* m_pViewPane;
ESearchMode m_searchMode;
ESearchResultHandling m_searchResultHandling;
bool m_bOR;
static const int MAX_NUM_CUSTOM_PRESETS = 10;
QStringList m_customResPresets;
QStringList m_customFOVPresets;
@@ -114,13 +89,6 @@ protected:
uint64 m_displayInfoCallbackIndex;
void UnhideUnfreezeAll();
void SearchByType(const QStringList& terms);
void SearchByName(const QStringList& terms);
void SearchByAsset(const QStringList& terms);
void UpdateSearchOptionsText();
void InputNamesToSearchFromSelection();
void OnMenuFOVCustom();
void CreateFOVMenu();
@@ -139,18 +107,6 @@ protected:
QMenu* m_resolutionMenu = nullptr;
QScopedPointer<Ui::ViewportTitleDlg> m_ui;
QActionGroup* m_searchModeActionGroup;
QAction* m_searchByNameAction;
QAction* m_searchByTypeAction;
QAction* m_searchByAssetAction;
QActionGroup* m_searchResultHandlingActionGroup;
QAction* m_searchHideOthersAction;
QAction* m_searchFreezeOthersAction;
QAction* m_searchJustSelectAction;
QActionGroup* m_searchMatchTypeActionGroup;
QAction* m_searchAndAction;
QAction* m_searchOrAction;
};
namespace AzToolsFramework
+1 -28
View File
@@ -28,7 +28,7 @@
<height>29</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,2,0,0,0,0,0,0,0,0">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,0,0,0,0,0,0,0">
<property name="leftMargin">
<number>10</number>
</property>
@@ -60,28 +60,6 @@
</property>
</widget>
</item>
<item>
<widget class="AzQtComponents::SearchLineEdit" name="m_viewportSearch">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>147</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>147</width>
<height>22</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_fovLabel">
<property name="contextMenuPolicy">
@@ -208,11 +186,6 @@
<header>AzQtComponents/Components/ButtonDivider.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>AzQtComponents::SearchLineEdit</class>
<extends>QLineEdit</extends>
<header>AzQtComponents/Components/SearchLineEdit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>