d065eb9498
* wip fixes for entity viewport icons displaying in the correct order and handling selection correctly Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * add additional comment about z value Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * move manual sorting and some small tidy-up Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * update comment Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * updates following initial round of PR feedback Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * additional changes to support tests for entity icon intersection Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * add support to enable/disable icons separately from helpers Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * final tests added and small tidy-up to display EntityId correctly Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * update some manipulator test framework calls after utility functions were moved Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * fix for implicit cast Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * move icon scale values to AZ_CVARS Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * fix failing tests caught in AR and update some naming conventions for tests Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * update naming convention for members of ProjectedViewportRay Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * update other references to ProjectedViewportRay Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * update more references to ProjectedViewportRay change Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com> * update menus for python tests Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>
244 lines
6.6 KiB
C++
244 lines
6.6 KiB
C++
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project.
|
|
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
|
|
|
|
// Description : Display Settings implementation.
|
|
|
|
#include "EditorDefs.h"
|
|
|
|
#include "DisplaySettings.h"
|
|
|
|
// Qt
|
|
#include <QSettings>
|
|
|
|
// Editor
|
|
#include "Settings.h"
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
CDisplaySettings::CDisplaySettings()
|
|
{
|
|
m_flags = SETTINGS_NOLABELS | SETTINGS_NOCOLLISION;
|
|
m_objectHideMask = 0;
|
|
|
|
// All flags besides GI enabled by default
|
|
m_renderFlags = RENDER_FLAG_LAST_ONE - 1;
|
|
m_renderFlags &= ~(RENDER_FLAG_BBOX);
|
|
m_renderFlags &= ~(RENDER_FLAG_GI);
|
|
m_debugFlags = 0;
|
|
m_labelsDistance = 100;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
CDisplaySettings::~CDisplaySettings()
|
|
{
|
|
}
|
|
|
|
void CDisplaySettings::SaveRegistry()
|
|
{
|
|
SaveValue("Settings", "ObjectHideMask", m_objectHideMask);
|
|
SaveValue("Settings", "RenderFlags", m_renderFlags);
|
|
SaveValue("Settings", "DisplayFlags", m_flags & SETTINGS_SERIALIZABLE_FLAGS_MASK);
|
|
SaveValue("Settings", "DebugFlags", m_debugFlags);
|
|
SaveValue("Settings", "LabelsDistance", static_cast<int>(m_labelsDistance));
|
|
}
|
|
|
|
void CDisplaySettings::LoadRegistry()
|
|
{
|
|
LoadValue("Settings", "ObjectHideMask", m_objectHideMask);
|
|
LoadValue("Settings", "RenderFlags", m_renderFlags);
|
|
LoadValue("Settings", "DisplayFlags", m_flags);
|
|
m_flags &= SETTINGS_SERIALIZABLE_FLAGS_MASK;
|
|
LoadValue("Settings", "DebugFlags", m_debugFlags);
|
|
int temp = static_cast<int>(m_labelsDistance);
|
|
LoadValue("Settings", "LabelsDistance", temp);
|
|
m_labelsDistance = static_cast<float>(temp);
|
|
|
|
gSettings.objectHideMask = m_objectHideMask;
|
|
}
|
|
|
|
void CDisplaySettings::SetObjectHideMask(int hideMask)
|
|
{
|
|
m_objectHideMask = hideMask;
|
|
|
|
gSettings.objectHideMask = m_objectHideMask;
|
|
};
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::PostInitApply()
|
|
{
|
|
SetRenderFlags(m_renderFlags);
|
|
SetDebugFlags(m_debugFlags);
|
|
}
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::SetRenderFlags(int flags)
|
|
{
|
|
m_renderFlags = flags;
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::SetDebugFlags(int flags)
|
|
{
|
|
m_debugFlags = flags;
|
|
|
|
//
|
|
//SetCVar( "ai_DebugDraw",m_debugFlags&DBG_AI_DEBUGDRAW );
|
|
//SetCVarInt( "r_TexLog",(m_debugFlags&DBG_TEXTURE_MEMINFO) ? 2:0 );
|
|
//SetCVarInt( "MemStats",(m_debugFlags&DBG_MEMSTATS) ? 1000:0 );
|
|
//SetCVarInt( "p_draw_helpers",(m_debugFlags&DBG_PHYSICS_DEBUGDRAW) ? 5634:0 );
|
|
|
|
//SetCVar( "r_ProfileShaders",(m_debugFlags&DBG_RENDERER_PROFILESHADERS) );
|
|
|
|
SetCVarInt("r_MeasureOverdraw", (m_debugFlags & DBG_RENDERER_OVERDRAW) ? 1 : 0); //Eric@conffx display Overdraw in Particle editor preview window
|
|
//SetCVarInt( "r_Stats",(m_debugFlags&DBG_RENDERER_RESOURCES) ? 4:0 );
|
|
//SetCVarInt( "sys_enable_budgetmonitoring",(m_debugFlags&DBG_BUDGET_MONITORING) ? 4:0 );
|
|
|
|
//SetCVarInt( "Profile",(m_debugFlags&DBG_FRAMEPROFILE) ? 1:0 );
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::SetCVar(const char* cvar, bool value)
|
|
{
|
|
ICVar* var = GetIEditor()->GetSystem()->GetIConsole()->GetCVar(cvar);
|
|
if (var)
|
|
{
|
|
var->Set((value) ? 1 : 0);
|
|
}
|
|
else
|
|
{
|
|
CLogFile::FormatLine("Console Variable %s not declared", cvar);
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::SetCVarInt(const char* cvar, int value)
|
|
{
|
|
ICVar* var = GetIEditor()->GetSystem()->GetIConsole()->GetCVar(cvar);
|
|
if (var)
|
|
{
|
|
var->Set(value);
|
|
}
|
|
else
|
|
{
|
|
CLogFile::FormatLine("Console Variable %s not declared", cvar);
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::DisplayLabels(bool bEnable)
|
|
{
|
|
if (bEnable)
|
|
{
|
|
m_flags &= ~SETTINGS_NOLABELS;
|
|
}
|
|
else
|
|
{
|
|
m_flags |= SETTINGS_NOLABELS;
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::DisplayTracks(bool bEnable)
|
|
{
|
|
if (bEnable)
|
|
{
|
|
m_flags &= ~SETTINGS_HIDE_TRACKS;
|
|
}
|
|
else
|
|
{
|
|
m_flags |= SETTINGS_HIDE_TRACKS;
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::DisplayLinks(bool bEnable)
|
|
{
|
|
if (bEnable)
|
|
{
|
|
m_flags &= ~SETTINGS_HIDE_LINKS;
|
|
}
|
|
else
|
|
{
|
|
m_flags |= SETTINGS_HIDE_LINKS;
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::DisplayHelpers(bool bEnable)
|
|
{
|
|
if (bEnable)
|
|
{
|
|
m_flags &= ~SETTINGS_HIDE_HELPERS;
|
|
}
|
|
else
|
|
{
|
|
m_flags |= SETTINGS_HIDE_HELPERS;
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::DisplayDimensionFigures(bool bEnable)
|
|
{
|
|
if (bEnable)
|
|
{
|
|
m_flags |= SETTINGS_SHOW_DIMENSIONFIGURES;
|
|
}
|
|
else
|
|
{
|
|
m_flags &= ~SETTINGS_SHOW_DIMENSIONFIGURES;
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::SetHighlightBreakable(bool bHighlight)
|
|
{
|
|
if (bHighlight)
|
|
{
|
|
m_debugFlags |= DBG_HIGHLIGHT_BREAKABLE;
|
|
}
|
|
else
|
|
{
|
|
m_debugFlags &= ~DBG_HIGHLIGHT_BREAKABLE;
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::SetHighlightMissingSurfaceType(bool bHighlight)
|
|
{
|
|
if (bHighlight)
|
|
{
|
|
m_debugFlags |= DBG_HIGHLIGHT_MISSING_SURFACE_TYPE;
|
|
}
|
|
else
|
|
{
|
|
m_debugFlags &= ~DBG_HIGHLIGHT_MISSING_SURFACE_TYPE;
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::SaveValue(const char* sSection, const char* sKey, int value)
|
|
{
|
|
QSettings settings;
|
|
settings.setValue(QStringLiteral("%1/%2").arg(sSection, sKey), value);
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::LoadValue(const char* sSection, const char* sKey, int& value)
|
|
{
|
|
QSettings settings;
|
|
value = settings.value(QStringLiteral("%1/%2").arg(sSection, sKey), value).toInt();
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CDisplaySettings::LoadValue(const char* sSection, const char* sKey, bool& value)
|
|
{
|
|
QSettings settings;
|
|
value = settings.value(QStringLiteral("%1/%2").arg(sSection, sKey), value).toInt();
|
|
}
|