Merge branch 'development' of https://github.com/o3de/o3de into jckand/DynVegTestFix

Signed-off-by: jckand-amzn <82226555+jckand-amzn@users.noreply.github.com>
This commit is contained in:
jckand-amzn
2022-01-19 11:54:21 -06:00
210 changed files with 2382 additions and 4746 deletions
@@ -173,9 +173,11 @@ class TestMaterialEditorBasicTests(object):
"Document saved as copy is saved with changes: True",
"Document saved as child is saved with changes: True",
"Save All worked as expected: True",
"P1: Asset Browser visibility working as expected: True",
"P1: Inspector visibility working as expected: True",
]
unexpected_lines = [
"Traceback (most recent call last):"
# Including any lines in unexpected_lines will cause the test to run for the duration of the timeout
]
hydra.launch_and_validate_results(
@@ -125,11 +125,11 @@ def is_pane_visible(pane_name):
"""
:return: bool
"""
return atomtools.AtomToolsWindowRequestBus(bus.Broadcast, "IsDockWidgetVisible", pane_name)
return atomtools.AtomToolsMainWindowRequestBus(bus.Broadcast, "IsDockWidgetVisible", pane_name)
def set_pane_visibility(pane_name, value):
atomtools.AtomToolsWindowRequestBus(bus.Broadcast, "SetDockWidgetVisible", pane_name, value)
atomtools.AtomToolsMainWindowRequestBus(bus.Broadcast, "SetDockWidgetVisible", pane_name, value)
def select_lighting_config(config_name):
@@ -36,6 +36,19 @@ MATERIAL_TYPE_PATH = os.path.join(
CACHE_FILE_EXTENSION = ".azmaterial"
def verify_pane_visibility(pane_name: str):
"""
print log lines indicating Material Editor pane visibility function
:param pane_name: Name of the pane to be tested
"""
initial_value = material_editor.is_pane_visible(pane_name)
material_editor.set_pane_visibility(pane_name, not initial_value)
result = (material_editor.is_pane_visible(pane_name) is not initial_value)
material_editor.set_pane_visibility(pane_name, initial_value)
result = result and (initial_value is material_editor.is_pane_visible(pane_name))
print(f"P1: {pane_name} visibility working as expected: {result}")
def run():
"""
Summary:
@@ -49,9 +62,12 @@ def run():
7. Saving as a New Material
8. Saving as a Child Material
9. Saving all Open Materials
10. Verify Asset Browser pane visibility
11. Verify Material Inspector pane visibility
Expected Result:
All the above functions work as expected in Material Editor.
Pane visibility functions as expected
:return: None
"""
@@ -186,6 +202,14 @@ def run():
material_editor.set_property(document2_id, property2_name, initial_color)
material_editor.save_all()
material_editor.close_all_documents()
# 10) Verify Asset Browser pane visibility
verify_pane_visibility("Asset Browser")
# 11) Verify Material Inspector pane visibility
verify_pane_visibility("Inspector")
# Confirm documents closed and exit Material Editor
material_editor.wait_for_condition(lambda:
(not material_editor.is_open(document1_id)) and
(not material_editor.is_open(document2_id)) and
@@ -24,7 +24,6 @@
// Editor
#include "SelectLightAnimationDialog.h"
#include "SelectSequenceDialog.h"
#include "SelectEAXPresetDlg.h"
#include "QtViewPaneManager.h"
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
-170
View File
@@ -1,170 +0,0 @@
/*
* 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
*
*/
#include "EditorDefs.h"
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//#ifdef _CRTDBG_MAP_ALLOC
#ifdef CRTDBG_MAP_ALLOC
#pragma pack (push,1)
#define nNoMansLandSize 4
typedef struct MyCrtMemBlockHeader
{
struct MyCrtMemBlockHeader* pBlockHeaderNext;
struct MyCrtMemBlockHeader* pBlockHeaderPrev;
char* szFileName;
int nLine;
size_t nDataSize;
int nBlockUse;
long lRequest;
unsigned char gap[nNoMansLandSize];
/* followed by:
* unsigned char data[nDataSize];
* unsigned char anotherGap[nNoMansLandSize];
*/
} MyCrtMemBlockHeader;
#pragma pack (pop)
#define pbData(pblock) ((unsigned char*)((MyCrtMemBlockHeader*)pblock + 1))
#define pHdr(pbData) (((MyCrtMemBlockHeader*)pbData) - 1)
void crtdebug(const char* s, ...)
{
char str[32768];
va_list arg_ptr;
va_start(arg_ptr, s);
vsprintf(str, s, arg_ptr);
va_end(arg_ptr);
FILE* l = nullptr;
azfopen(&l, "crtdump.txt", "a+t");
if (l)
{
fprintf(l, "%s", str);
fclose(l);
}
}
int crtAllocHook(int nAllocType, void* pvData,
size_t nSize, int nBlockUse, long lRequest,
const unsigned char* szFileName, int nLine)
{
if (nBlockUse == _CRT_BLOCK)
{
return TRUE;
}
static int total_cnt = 0;
static int total_mem = 0;
if (nAllocType == _HOOK_ALLOC)
{
//total_mem += nSize;
//total_cnt++;
//_CrtMemState mem_state;
//_CrtMemCheckpoint( &mem_state );
//total_cnt = mem_state.lCounts[_NORMAL_BLOCK];
//total_mem = mem_state.lTotalCount;
if ((total_cnt & 0xF) == 0)
{
//_CrtCheckMemory();
}
total_cnt++;
total_mem += nSize;
//crtdebug( "<CRT> Alloc %d,size=%d,in: %s %d (total size=%d,num=%d)\n",lRequest,nSize,szFileName,nLine,total_mem,total_cnt );
crtdebug("Size=%d, [Total=%d,N=%d] [%s:%d]\n", nSize, total_mem, total_cnt, szFileName, nLine);
}
else if (nAllocType == _HOOK_FREE)
{
MyCrtMemBlockHeader* pHead;
pHead = pHdr(pvData);
total_cnt--;
total_mem -= pHead->nDataSize;
crtdebug("Size=%d, [Total=%d,N=%d] [%s:%d]\n", pHead->nDataSize, total_mem, total_cnt, pHead->szFileName, pHead->nLine);
//crtdebug( "<CRT> Free size=%d,in: %s %d (total size=%d,num=%d)\n",pHead->nDataSize,pHead->szFileName,pHead->nLine,total_mem,total_cnt );
//total_mem -= nSize;
//total_cnt--;
}
return TRUE;
}
int crtReportHook(int nRptType, char* szMsg, int* retVal)
{
static int gl_num_asserts = 0;
if (gl_num_asserts != 0)
{
return TRUE;
}
gl_num_asserts++;
switch (nRptType)
{
case _CRT_WARN:
crtdebug("<CRT WARNING> %s\n", szMsg);
break;
case _CRT_ERROR:
crtdebug("<CRT ERROR> %s\n", szMsg);
break;
case _CRT_ASSERT:
crtdebug("<CRT ASSERT> %s\n", szMsg);
break;
}
gl_num_asserts--;
return TRUE;
}
void InitCrt()
{
FILE* l = nullptr;
azfopen(&l, "crtdump.txt", "w");
if (l)
{
fclose(l);
}
//_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_DEBUG );
//_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG );
//_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_DEBUG );
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_WNDW);
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_WNDW);
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_WNDW);
//_CrtSetDbgFlag( _CRTDBG_CHECK_ALWAYS_DF|_CRTDBG_CHECK_CRT_DF|_CRTDBG_LEAK_CHECK_DF|_CRTDBG_DELAY_FREE_MEM_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) );
//_CrtSetDbgFlag( _CRTDBG_CHECK_CRT_DF|_CRTDBG_LEAK_CHECK_DF/*|_CRTDBG_DELAY_FREE_MEM_DF*/ | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) );
int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
flags &= ~_CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_CRT_DF;
_CrtSetDbgFlag(flags);
_CrtSetAllocHook (crtAllocHook);
_CrtSetReportHook(crtReportHook);
}
void DoneCrt()
{
//_CrtCheckMemory();
//_CrtDumpMemoryLeaks();
}
// Autoinit CRT.
//struct __autoinit_crt { __autoinit_crt() { InitCrt(); }; ~__autoinit_crt() { DoneCrt(); } } __autoinit_crt_var;
#endif
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
-16
View File
@@ -124,9 +124,6 @@ AZ_POP_DISABLE_WARNING
#include "ScopedVariableSetter.h"
#include "Util/3DConnexionDriver.h"
#include "DimensionsDialog.h"
#include "Util/AutoDirectoryRestoreFileDialog.h"
#include "Util/EditorAutoLevelLoadTest.h"
#include "AboutDialog.h"
@@ -1806,12 +1803,6 @@ bool CCryEditApp::InitInstance()
InitLevel(cmdInfo);
});
#ifdef USE_WIP_FEATURES_MANAGER
// load the WIP features file
CWipFeatureManager::Instance()->EnableManager(!cmdInfo.m_bDeveloperMode);
CWipFeatureManager::Init();
#endif
if (!m_bConsoleMode && !m_bPreviewMode)
{
GetIEditor()->UpdateViews();
@@ -2142,13 +2133,6 @@ int CCryEditApp::ExitInstance(int exitCode)
}
qobject_cast<Editor::EditorQtApplication*>(qApp)->UnloadSettings();
#ifdef USE_WIP_FEATURES_MANAGER
//
// close wip features manager
//
CWipFeatureManager::Shutdown();
#endif
if (IsInRegularEditorMode())
{
if (GetIEditor())
-1
View File
@@ -14,7 +14,6 @@
#if !defined(Q_MOC_RUN)
#include <AzCore/Outcome/Outcome.h>
#include <AzFramework/Asset/AssetSystemBus.h>
#include "WipFeatureManager.h"
#include "CryEditDoc.h"
#include "ViewPane.h"
+1 -25
View File
@@ -45,7 +45,6 @@
#include "ActionManager.h"
#include "Include/IObjectManager.h"
#include "ErrorReportDialog.h"
#include "SurfaceTypeValidator.h"
#include "Util/AutoLogTime.h"
#include "CheckOutDialog.h"
#include "GameExporter.h"
@@ -99,8 +98,7 @@ namespace Internal
// CCryEditDoc construction/destruction
CCryEditDoc::CCryEditDoc()
: doc_validate_surface_types(nullptr)
, m_modifiedModuleFlags(eModifiedNothing)
: m_modifiedModuleFlags(eModifiedNothing)
{
////////////////////////////////////////////////////////////////////////
// Set member variables to initial values
@@ -120,7 +118,6 @@ CCryEditDoc::CCryEditDoc()
GetIEditor()->SetDocument(this);
CLogFile::WriteLine("Document created");
RegisterConsoleVariables();
MainWindow::instance()->GetActionManager()->RegisterActionHandler(ID_FILE_SAVE_AS, this, &CCryEditDoc::OnFileSaveAs);
bool isPrefabSystemEnabled = false;
@@ -459,8 +456,6 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
}
}
CSurfaceTypeValidator().Validate();
LogLoadTime(GetTickCount() - t0);
// Loaded with success, remove event from log file
GetIEditor()->GetSettingsManager()->UnregisterEvent(loadEvent);
@@ -1910,25 +1905,6 @@ void CCryEditDoc::SetDocumentReady(bool bReady)
m_bDocumentReady = bReady;
}
void CCryEditDoc::RegisterConsoleVariables()
{
doc_validate_surface_types = gEnv->pConsole->GetCVar("doc_validate_surface_types");
if (!doc_validate_surface_types)
{
doc_validate_surface_types = REGISTER_INT_CB("doc_validate_surface_types", 0, 0,
"Flag indicating whether icons are displayed on the animation graph.\n"
"Default is 1.\n",
OnValidateSurfaceTypesChanged);
}
}
void CCryEditDoc::OnValidateSurfaceTypesChanged(ICVar*)
{
CErrorsRecorder errorsRecorder(GetIEditor());
CSurfaceTypeValidator().Validate();
}
void CCryEditDoc::OnStartLevelResourceList()
{
// after loading another level we clear the RFOM_Level list, the first time the list should be empty
-3
View File
@@ -176,9 +176,7 @@ protected:
virtual void OnFileSaveAs();
//! called immediately after saving the level.
void AfterSave();
void RegisterConsoleVariables();
void OnStartLevelResourceList();
static void OnValidateSurfaceTypesChanged(ICVar*);
QString GetCryIndexPath(const char* levelFilePath) const;
@@ -194,7 +192,6 @@ protected:
XmlNodeRef m_environmentTemplate;
std::list<IDocListener*> m_listeners;
bool m_bDocumentReady = false;
ICVar* doc_validate_surface_types = nullptr;
int m_modifiedModuleFlags;
// On construction, it assumes loaded levels have already been exported. Can be a big fat lie, though.
// The right way would require us to save to the level folder the export status of the level.
-213
View File
@@ -1,213 +0,0 @@
⼯䴠捩潲潳瑦嘠獩慵⭃‫敧敮慲整⁤敲潳牵散猠牣灩⹴
椣据畬敤∠敲潳牵散栮
搣晥湩⁥偁呓䑕佉剟䅅佄䱎彙奓䉍䱏
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯
⼯䜠湥牥瑡摥映潲桴⁥䕔员义䱃䑕⁅′敲潳牵散
椣据畬敤∠楷牮獥栮
椣据畬敤∠敲潳牵散栮
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯
産摮晥䄠卐啔䥄彏䕒䑁乏奌卟䵙佂卌
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯
⼯䔠杮楬桳⠠湕瑩摥匠慴整⥳爠獥畯捲獥
椣⁦搡晥湩摥䄨塆剟卅問䍒彅䱄⥌簠⁼敤楦敮⡤䙁彘䅔䝒䕟啎
䅌䝎䅕䕇䰠乁彇久䱇卉ⱈ匠䉕䅌䝎䕟䝎䥌䡓啟
椣摦晥䄠卐啔䥄彏义佖䕋
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯
⼯吠塅䥔䍎啌䕄
′䕔员义䱃䑕⁅
䕂䥇
††⌢湩汣摵⁥∢楷牮獥栮∢牜湜
††⌢湩汣摵⁥∢敲潳牵散栮∢牜湜
††尢∰
″䕔员义䱃䑕⁅
䕂䥇
††尢屲≮
††尢∰
‱䕔员义䱃䑕⁅
䕂䥇
††爢獥畯捲⹥屨∰
攣摮晩††⼯䄠卐啔䥄彏义佖䕋
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯
⼯䴠湥
䑉归䕍啎䱟噉䍅䕒呁⁅䕍啎
䕂䥇
††佐啐⁐☢楆敬
††䕂䥇
††††䕍啎呉䵅∠慓敶猠瑥楴杮≳‬†††††††䑉䙟䱉彅䅓䕖䕓呔义升
††††䕍啎呉䵅∠汃獯≥‬†††††††††††䑉䙟䱉彅䱃协彅䥌䕖剃䅅䕔噟䕉
††久
††佐啐⁐☢楖睥
††䕂䥇
††††䕍啎呉䵅∠楌敶牃慥整䰠杯敧≲‬†††††䑉噟䕉彗䥌䕖剃䅅䕔佌䝇剅‬䡃䍅䕋
††††䕍啎呉䵅∠楌敶牃慥整倠潲楦敬䔠楤潴≲‬†䑉噟䕉彗䥌䕖剃䅅䕔剐䙏䱉䕅䥄佔ⱒ䌠䕈䭃䑅
††††䕍啎呉䵅∠楌敶牃慥整䘠汩⁥祓据匠瑥楴杮≳‬䑉噟䕉彗䥌䕖剃䅅䕔䥆䕌奓䍎䕓呔义升‬䡃䍅䕋
††久
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯
⼯䐠慩潬
䑉彄䥌䕖剃䅅䕔偟䍉䕋⁒䥄䱁䝏塅〠‬ⰰ㌠㘱‬㔲
呓䱙⁅卄卟呅但呎簠䐠当位䅄䙌䅒䕍簠䐠当䥆䕘卄卙簠圠当佐啐⁐⁼南䍟偁䥔乏簠圠当奓䵓久
䅃呐佉⁎匢汥捥⁴慧敭戠極摬搠物捥潴祲
但呎㠠‬䴢⁓桓汥汄≧‬〴ⰰ〠‬砰
䕂䥇
††䕄偆单䉈呕佔⁎†伢≋䤬佄ⱋ〲ⰰ㌲ⰸ〵ㄬ
††啐䡓啂呔乏†††䌢湡散≬䤬䍄乁䕃ⱌ㔲ⰹ㌲ⰸ〵ㄬ
††佃呎佒⁌††††∢䤬䍄䑟剉䍅佔奒呟䕒ⱅ匢獹牔敥楖睥㈳Ⱒ噔当䅈䉓呕佔华簠吠卖䡟十䥌䕎⁓⁼噔当䥌䕎䅓剔住⁔⁼噔当䡓坏䕓䅌坌奁⁓⁼南䉟剏䕄⁒⁼南䡟䍓佒䱌簠圠当䅔卂佔ⱐⰷⰷ〳ⰲ㈲
䑉彄䥌䕖剃䅅䕔䅟䑄呟剁䕇協䐠䅉佌䕇⁘ⰰ〠‬〵ⰰ㐠〰
呓䱙⁅卄卟呅但呎簠䐠当位䅄䙌䅒䕍簠䐠当䥆䕘卄卙簠䐠当䕃呎剅簠圠当佐啐⁐⁼南䍟偁䥔乏簠圠当奓䵓久
䅃呐佉⁎䐢獩潣敶⁲楌敶牃慥整琠牡敧獴
但呎㠠‬䴢⁓桓汥汄≧‬〴ⰰ〠‬砰
䕂䥇
††啐䡓啂呔乏†††刢晥敲桳Ⱒ䑉彃䕒剆卅ⱈⰸⰸ〷ㄬ
††啐䡓啂呔乏†††䄢摤挠獵潴⹭⸮Ⱒ䑉彃啂呔乏䅟䑄偟䕅ⱒ㈸㠬㜬ⰰ㠱
††佃呎佒⁌††††唢敳眠摩牥猠慥捲⁨戨潲摡慣瑳∩䤬䍄䍟䕈䭃䕟䅎䱂䑅∬畂瑴湯Ⱒ卂䅟呕䍏䕈䭃佂⁘⁼南呟䉁呓偏㈬㌳ㄬⰲ〲ⰰ〱
††佃呎佒⁌††††∢䤬䍄䱟卉彔䕐剅ⱓ堢偔敒潰瑲Ⱒ南呟䉁呓偏㠬㌬ⰲ㠴ⰴ㐳ⰲ南䕟彘呓呁䍉䑅䕇
††䕄偆单䉈呕佔⁎†唢敳猠汥捥整≤䤬佄ⱋ㠱ⰰ㜳ⰹ〷ㄬ
††啐䡓啂呔乏†††䌢湡散≬䤬䍄乁䕃ⱌ㔲ⰹ㜳ⰹ〷ㄬ
††啐䡓啂呔乏†††䄢摤戠⁹偉⸮∮䤬䍄䉟呕佔彎䑁彄䅍䕔䥒䱁ㄬ㜵㠬㜬ⰰ㠱
䑉彄䥌䕖剃䅅䕔偟䕅归䥌呓䐠䅉佌䕇⁘ⰰ〠‬㤳ⰵ㈠㌱
呓䱙⁅卄卟呅但呎簠䐠当䥆䕘卄卙簠䐠当䕃呎剅簠圠当䡃䱉⁄⁼南噟卉䉉䕌簠圠当佂䑒剅簠圠当奓䵓久
但呎㠠‬䴢⁓桓汥汄≧‬〴ⰰ〠‬砰
䕂䥇
††呌塅⁔†††††倢敥獲∺䤬䍄卟䅔䥔ⱃ㜱㈬ⰷ㈲㠬
††啐䡓啂呔乏†††䄢摤⸮∮䤬䍄䉟呕佔彎䑁彄䕐剅㔬ⰶ㐲㔬ⰶ㘱
††啐䡓啂呔乏†††䔢楤⹴⸮Ⱒ䑉彃啂呔乏䕟䥄彔䕐剅ㄬ㘱㈬ⰴ㘵ㄬ
††啐䡓啂呔乏†††刢浥癯≥䤬䍄䉟呕佔彎䕄䕌䕔偟䕅ⱒ㜱ⰶ㐲㔬ⰲ㘱
††䕄偆单䉈呕佔⁎†匢慴瑲䄠汬Ⱒ䑉彃啂呔乏卟䅔呒䅟䱌㐬㐬㐬ⰸ㘱
††啐䡓啂呔乏†††刢獥瑥䄠汬Ⱒ䑉彃啂呔乏剟卅呅䅟䱌ㄬ㘷㐬㔬ⰲ㘱
††啐䡓啂呔乏†††䘢牯散匠湹⁣汁≬䤬䍄䉟呕佔彎但䍒彅奓䍎䅟䱌㔬ⰶⰴ㘵ㄬ
††啐䡓啂呔乏†††䌢敬湡䄠汬Ⱒ䑉彃啂呔乏䍟䕌乁䅟䱌㈬㈳㐬㔬ⰲ㘱
††啐䡓啂呔乏†††匢牣敥獮潨⁴汁≬䤬䍄䉟呕佔彎䍓䕒久䡓呏䅟䱌ㄬ㘱㐬㔬ⰶ㘱
††佃呎佒⁌††††∢䤬䍄䱟卉彔䕐剅ⱓ堢偔敒潰瑲Ⱒ南呟䉁呓偏㐬㐬ⰴ㠳ⰶ㘱ⰴ南䕟彘呓呁䍉䑅䕇
††䡃䍅䉋塏††††䰢癩䍥敲瑡≥䤬䍄䉟呕佔彎久䉁䕌䱟噉䍅䕒呁ⱅ㠲ⰸⰴ㈵㌬ⰶ卂偟单䱈䭉⁅⁼卂䵟䱕䥔䥌䕎
††䡃䍅䉋塏††††匢湹屣䍮浡牥≡䤬䍄䉟呕佔彎䅃䕍䅒卟乙ⱃ㐳ⰵⰴ㈵㌬ⰶ卂偟单䱈䭉⁅⁼卂䵟䱕䥔䥌䕎
††啐䡓啂呔乏†††䐢獩潣敶≲䤬䍄䉟呕佔彎䥄䍓噏剅偟䕅卒㈬㈳㈬ⰴ㈵ㄬ
䑉彄䑉彄䥌䕖剃䅅䕔卟呅䥔䝎当䅐䕎⁌䥄䱁䝏塅〠‬ⰰㄠ㘵‬〲
呓䱙⁅卄卟呅但呎簠圠当䡃䱉
但呎㠠‬䴢⁓桓汥汄⁧∲‬〴ⰰ〠‬砰
䕂䥇
††啐䡓啂呔乏†††䄢摤琠牡敧獴⸮∮䤬䍄䉟呕佔彎䥄䍓噏剅偟䕅卒㐬㐬㠬ⰰ㘱
䑉彄䥌䕖剃䅅䕔䕟䥄彔佃乎䍅䥔乏䐠䅉佌䕇⁘ⰰ〠‬㠲ⰸㄠ㌸
呓䱙⁅卄卟呅但呎簠䐠当位䅄䙌䅒䕍簠䐠当䥆䕘卄卙簠圠当佐啐⁐⁼南䍟偁䥔乏簠圠当奓䵓久
䅃呐佉⁎䰢癩䍥敲瑡⁥潨瑳猠瑥楴杮≳
但呎㠠‬䴢⁓桓汥汄≧‬〴ⰰ〠‬砰
䕂䥇
††䕄偆单䉈呕佔⁎†伢≋䤬佄ⱋ㔱ⰸ㔱ⰴ㠵㈬
††啐䡓啂呔乏†††䌢湡散≬䤬䍄乁䕃ⱌ㈲ⰱ㔱ⰴ㠵㈬
††呌塅⁔†††††丢浡㩥Ⱒ䑉彃呓呁䍉ㄬⰶ㘴㈬ⰲ
††䑅呉䕔员††††䑉彃䑅呉呟剁䕇彔䅎䕍㐬ⰴ㐴ㄬ〰ㄬⰴ卅䅟呕䡏䍓佒䱌
††呌塅⁔†††††䤢㩐Ⱒ䑉彃呓呁䍉ㄬ㈵㐬ⰶ〱㠬
††佃呎佒⁌††††∢䤬䍄呟剁䕇彔偉䑁剄卅ⱓ匢獹偉摁牤獥㍳∲圬当䅔卂佔ⱐ㘱ⰸ㐴ㄬ〰ㄬ
††呌塅⁔†††††倢慬晴牯㩭Ⱒ䑉彃呓呁䍉㠬㈬ⰶ〳㠬
††呌塅⁔†††††䈢極摬瀠瑡⁨愨瑵浯瑡捩㨩Ⱒ䑉彃呓呁䍉ㄬⰹ㈱ⰰ㐷㠬
††啐䡓啂呔乏†††吢獥⁴偉Ⱒ䑉彃啂呔乏呟卅彔佃乎䍅䥔乏ㄬ㠶㘬ⰰ〱ⰰ㘱
††佃䉍䉏塏††††䑉彃佃䉍彏䱐呁但䵒㐬ⰴ㐲ㄬ〰㠬ⰸ䉃当剄偏佄乗䥌呓簠圠当卖剃䱏⁌⁼南呟䉁呓偏
††啐䡓啂呔乏†††刢獥癯敬渠浡⁥潴䤠≐䤬䍄䉟呕佔彎䕒剆卅彈偉㐬ⰴ〶ㄬ〰ㄬ
††佃呎佒⁌††††䔢慮汢⁥桴獩瀠敥≲䤬䍄䍟䕈䭃䕟䅎䱂䑅∬畂瑴湯Ⱒ卂䅟呕䍏䕈䭃佂⁘⁼南呟䉁呓偏㠬㠬㘬ⰷ〱
††則問䉐塏††††䈢極摬猠瑥楴杮≳䤬䍄卟䅔䥔ⱃⰷ〸㈬㈷㜬
††呌塅⁔†††††䈢極摬攠數畣慴汢㩥Ⱒ䑉彃呓呁䍉ㄬⰹ㈹㔬ⰶ
††啐䡓啂呔乏†††⸢⸮Ⱒ䑉彃啂呔乏偟䍉彋䅇䕍䑟剉䍅佔奒㈬㤴ㄬ㐰㈬ⰲ㐱
††䑅呉䕔员††††䑉彃䑅呉䉟䥕䑌剟住彔䅐䡔㈬ⰰ〱ⰴ㈲ⰶ㐱䔬当啁佔午剃䱏
††䑅呉䕔员††††䑉彃䑅呉䉟䥕䑌䕟䕘啃䅔䱂ⱅ〲ㄬㄳ㈬㤴ㄬⰴ卅䅟呕䡏䍓佒䱌
䑉彄䥌䕖剃䅅䕔呟十彋䅗呉䐠䅉佌䕇⁘ⰰ〠‬㌲ⰸ㐠
呓䱙⁅卄卟呅但呎簠䐠当位䅄䙌䅒䕍簠䐠当䥆䕘卄卙簠圠当佐啐⁐⁼南䍟偁䥔乏簠圠当奓䵓久
䅃呐佉⁎䐢慩潬≧
但呎㠠‬䴢⁓桓汥汄≧‬〴ⰰ〠‬砰
䕂䥇
††啐䡓啂呔乏†††䌢湡散≬䤬䍄乁䕃ⱌ㐹㈬ⰰ〵ㄬ
††呌塅⁔†††††匢慴楴≣䤬䍄呟十彋剐䝏䕒卓呟塅ⱔⰷⰷ㈲ⰴ
䑉彄䥌䕖剃䅅䕔䅟䑄䉟彙偉䐠䅉佌䕇⁘ⰰ〠‬㌱ⰷ㜠
呓䱙⁅卄卟呅但呎簠䐠当位䅄䙌䅒䕍簠䐠当䥆䕘卄卙簠圠当佐啐⁐⁼南䍟偁䥔乏簠圠当奓䵓久
䅃呐佉⁎䄢摤䰠癩䍥敲瑡⁥祢䤠≐
但呎㠠‬䴢⁓桓汥汄≧‬〴ⰰ〠‬砰
䕂䥇
††䕄偆单䉈呕佔⁎†伢≋䤬佄ⱋⰷ㠴㔬ⰸ〲
††啐䡓啂呔乏†††䌢湡散≬䤬䍄乁䕃ⱌㄷ㐬ⰸ㠵㈬
††呌塅⁔†††††䤢㩐Ⱒㄭ㤬ㄬⰲ〱㠬
††䑅呉䕔员††††䤠䍄呟剁䕇彔偉䑁剄卅ⱓ㔲ㄬⰰ〱ⰰ㔱圬当䅔卂佔
††啐䡓啂呔乏†††吢獥⁴偉Ⱒ䑉彃啂呔乏呟卅彔佃乎䍅䥔乏㈬ⰵ㜲ㄬ〰ㄬ
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯
⼯䐠卅䝉䥎䙎
椣摦晥䄠卐啔䥄彏义佖䕋
啇䑉䱅义卅䐠卅䝉䥎䙎
䕂䥇
††䑉彄䥌䕖剃䅅䕔䅟䑄呟剁䕇協‬䥄䱁䝏
††䕂䥇
††久
††䑉彄䥌䕖剃䅅䕔䕟䥄彔佃乎䍅䥔乏‬䥄䱁䝏
††䕂䥇
††久
††䑉彄䥌䕖剃䅅䕔呟十彋䅗呉‬䥄䱁䝏
††䕂䥇
††††䕌呆䅍䝒义‬
††††䥒䡇䵔剁䥇ⱎ㈠ㄳ
††††佔䵐剁䥇ⱎ㜠
††††佂呔䵏䅍䝒义‬㐳
††久
††䑉彄䥌䕖剃䅅䕔䅟䑄䉟彙偉‬䥄䱁䝏
††䕂䥇
††久
攣摮晩††⼯䄠卐啔䥄彏义佖䕋
攣摮晩††⼯䔠杮楬桳⠠湕瑩摥匠慴整⥳爠獥畯捲獥
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯
椣湦敤⁦偁呓䑕佉䥟噎䭏䑅
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯
⼯䜠湥牥瑡摥映潲桴⁥䕔员义䱃䑕⁅″敲潳牵散
⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯⼯
攣摮晩††⼯渠瑯䄠卐啔䥄彏义佖䕋
-71
View File
@@ -1,71 +0,0 @@
/*
* 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
*
*/
#include "EditorDefs.h"
#include "DimensionsDialog.h"
// Qt
#include <QButtonGroup>
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include <ui_DimensionsDialog.h>
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
/////////////////////////////////////////////////////////////////////////////
CDimensionsDialog::CDimensionsDialog(QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_group(new QButtonGroup(this))
, ui(new Ui::CDimensionsDialog)
{
ui->setupUi(this);
setWindowTitle(tr("Generate Terrain Texture"));
m_group->addButton(ui->Dim512, 512);
m_group->addButton(ui->Dim1024, 1024);
m_group->addButton(ui->Dim2048, 2048);
m_group->addButton(ui->Dim4096, 4096);
m_group->addButton(ui->Dim8192, 8192);
m_group->addButton(ui->Dim16384, 16384);
}
//////////////////////////////////////////////////////////////////////////
CDimensionsDialog::~CDimensionsDialog()
{
}
//////////////////////////////////////////////////////////////////////////
void CDimensionsDialog::SetDimensions(unsigned int iWidth)
{
////////////////////////////////////////////////////////////////////////
// Select a dimension option button in the dialog
////////////////////////////////////////////////////////////////////////
QAbstractButton* button = m_group->button(iWidth);
assert(button);
button->setChecked(true);
}
UINT CDimensionsDialog::GetDimensions()
{
////////////////////////////////////////////////////////////////////////
// Get the currently selected dimension option button in the dialog
////////////////////////////////////////////////////////////////////////
assert(m_group->checkedId() != -1);
return m_group->checkedId();
}
#include <moc_DimensionsDialog.cpp>
-47
View File
@@ -1,47 +0,0 @@
/*
* 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
*
*/
#pragma once
#ifndef CRYINCLUDE_EDITOR_DIMENSIONSDIALOG_H
#define CRYINCLUDE_EDITOR_DIMENSIONSDIALOG_H
#if !defined(Q_MOC_RUN)
#include <QScopedPointer>
#include <QDialog>
#endif
class QButtonGroup;
namespace Ui {
class CDimensionsDialog;
}
class CDimensionsDialog
: public QDialog
{
Q_OBJECT
public:
CDimensionsDialog(QWidget* pParent = nullptr); // standard constructor
~CDimensionsDialog();
UINT GetDimensions();
void SetDimensions(unsigned int iWidth);
protected:
void UpdateData(bool fromUi = true); // DDX/DDV support
private:
QButtonGroup* m_group;
QScopedPointer<Ui::CDimensionsDialog> ui;
};
#endif // CRYINCLUDE_EDITOR_DIMENSIONSDIALOG_H
-120
View File
@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CDimensionsDialog</class>
<widget class="QDialog" name="CDimensionsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>465</width>
<height>237</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="STATIC2">
<property name="title">
<string>Texture Dimensions (Texture Dimensions divided by Terrain Size = Texels per meter)</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="Dim512">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="text">
<string>512 x 512</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="Dim1024">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="text">
<string>1024 x 1024</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="Dim2048">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="text">
<string>2048 x 2048</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="Dim4096">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="text">
<string>4096 x 4096</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="Dim8192">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="text">
<string>8192 x 8192</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="Dim16384">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="text">
<string>16384 x 16384</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>CDimensionsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>77</x>
<y>294</y>
</hint>
<hint type="destinationlabel">
<x>7</x>
<y>296</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+12 -10
View File
@@ -112,29 +112,31 @@ void EditorPreferencesDialog::showEvent(QShowEvent* event)
QDialog::showEvent(event);
}
void WidgetHandleKeyPressEvent(QWidget* widget, QKeyEvent* event)
bool WidgetConsumesKeyPressEvent(QKeyEvent* event)
{
// If the enter key is pressed during any text input, the dialog box will close
// making it inconvenient to do multiple edits. This routine captures the
// Key_Enter or Key_Return and clears the focus to give a visible cue that
// editing of that field has finished and then doesn't propogate it.
// editing of that field has finished and then doesn't propagate it.
if (event->key() != Qt::Key::Key_Enter && event->key() != Qt::Key::Key_Return)
{
QApplication::sendEvent(widget, event);
return false;
}
else
if (QWidget* editWidget = QApplication::focusWidget())
{
if (QWidget* editWidget = QApplication::focusWidget())
{
editWidget->clearFocus();
}
editWidget->clearFocus();
}
}
return true;
}
void EditorPreferencesDialog::keyPressEvent(QKeyEvent* event)
{
WidgetHandleKeyPressEvent(this, event);
if (!WidgetConsumesKeyPressEvent(event))
{
QDialog::keyPressEvent(event);
}
}
void EditorPreferencesDialog::OnTreeCurrentItemChanged()
+1 -1
View File
@@ -19,7 +19,7 @@ namespace Ui
class EditorPreferencesTreeWidgetItem;
void WidgetHandleKeyPressEvent(QWidget* widget, QKeyEvent* event);
bool WidgetConsumesKeyPressEvent(QKeyEvent* event);
class EditorPreferencesDialog
: public QDialog
-2
View File
@@ -42,8 +42,6 @@
#include "ViewManager.h"
#include "AnimationContext.h"
#include "UndoViewPosition.h"
#include "UndoViewRotation.h"
#include "MainWindow.h"
#include "Include/IObjectManager.h"
#include "ActionManager.h"
-30
View File
@@ -154,36 +154,6 @@
<file alias="error_report_warning.svg">res/error_report_warning.svg</file>
<file alias="error_report_comment.svg">res/error_report_comment.svg</file>
<file alias="error_report_helper.svg">res/error_report_helper.svg</file>
<file>particles_tree_00.png</file>
<file>particles_tree_01.png</file>
<file>particles_tree_02.png</file>
<file>particles_tree_03.png</file>
<file>particles_tree_04.png</file>
<file>particles_tree_05.png</file>
<file>particles_tree_06.png</file>
<file>particles_tree_07.png</file>
<file>arhitype_tree_00.png</file>
<file>arhitype_tree_01.png</file>
<file>arhitype_tree_02.png</file>
<file>arhitype_tree_03.png</file>
<file>bmp00005_00.png</file>
<file>bmp00005_01.png</file>
<file>bmp00005_02.png</file>
<file>bmp00005_03.png</file>
<file>bmp00005_04.png</file>
<file>bmp00005_05.png</file>
<file>bmp00005_06.png</file>
<file>bmp00005_07.png</file>
<file>bmp00005_08.png</file>
<file>bmp00005_09.png</file>
<file>bmp00006_00.png</file>
<file>bmp00006_01.png</file>
<file>bmp00006_02.png</file>
<file>bmp00006_03.png</file>
<file>bmp00006_04.png</file>
<file>bmp00006_05.png</file>
<file>bmp00006_06.png</file>
<file>bmp00006_07.png</file>
</qresource>
<qresource prefix="/cursors">
<file>res/arr_addkey.cur</file>
-3
View File
@@ -18,9 +18,6 @@
#include <QTimer>
#include <QToolButton>
// Editor
#include "NewTerrainDialog.h"
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include <ui_NewLevelDialog.h>
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
-168
View File
@@ -1,168 +0,0 @@
/*
* 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
*
*/
// NewTerrainDialog.cpp : implementation file
//
#include "EditorDefs.h"
#include "NewTerrainDialog.h"
AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option")
#include <ui_NewTerrainDialog.h>
AZ_POP_DISABLE_WARNING
CNewTerrainDialog::CNewTerrainDialog(QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_terrainResolutionIndex(0)
, m_terrainUnitsIndex(0)
, m_bUpdate(false)
, ui(new Ui::CNewTerrainDialog)
, m_initialized(false)
{
ui->setupUi(this);
setWindowTitle(tr("Terrain options"));
// Default is 1024x1024, and m_terrainResolution holds an index to the combo box
m_terrainResolutionIndex = 3;
connect(ui->TERRAIN_RESOLUTION, SIGNAL(activated(int)), this, SLOT(OnComboBoxSelectionTerrainResolution()));
connect(ui->TERRAIN_UNITS, SIGNAL(activated(int)), this, SLOT(OnComboBoxSelectionTerrainUnits()));
}
CNewTerrainDialog::~CNewTerrainDialog()
{
}
void CNewTerrainDialog::UpdateData(bool fromUi)
{
if (fromUi)
{
m_terrainResolutionIndex = ui->TERRAIN_RESOLUTION->currentIndex();
m_terrainUnitsIndex = ui->TERRAIN_UNITS->currentIndex();
}
else
{
ui->TERRAIN_RESOLUTION->setCurrentIndex(m_terrainResolutionIndex);
ui->TERRAIN_UNITS->setCurrentIndex(m_terrainUnitsIndex);
}
}
void CNewTerrainDialog::OnInitDialog()
{
// Initialize terrain values.
int resolution = Ui::START_TERRAIN_RESOLUTION;
// Fill terrain resolution combo box
for (int i = 0; i < 6; i++)
{
ui->TERRAIN_RESOLUTION->addItem(QString("%1x%1").arg(resolution));
resolution *= 2;
}
UpdateTerrainUnits();
UpdateTerrainInfo();
// Save data.
UpdateData(false);
}
void CNewTerrainDialog::UpdateTerrainUnits()
{
uint32 terrainRes = GetTerrainResolution();
int size = terrainRes * GetTerrainUnits();
int maxUnit = IntegerLog2(Ui::MAXIMUM_TERRAIN_RESOLUTION / terrainRes);
int units = Ui::START_TERRAIN_UNITS;
ui->TERRAIN_UNITS->clear();
for (int i = 0; i <= maxUnit; i++)
{
ui->TERRAIN_UNITS->addItem(QString::number(units));
units *= 2;
}
if (size > Ui::MAXIMUM_TERRAIN_RESOLUTION)
{
m_terrainUnitsIndex = 0;
}
ui->TERRAIN_UNITS->setCurrentText(QString::number(m_terrainUnitsIndex));
}
void CNewTerrainDialog::UpdateTerrainInfo()
{
int sizeX = GetTerrainResolution() * GetTerrainUnits();
int sizeY = GetTerrainResolution() * GetTerrainUnits();
QString str;
if (sizeX >= 1000)
{
str = tr("Terrain Size: %1 x %2 Kilometers").arg((float)sizeX / 1000.0f, 0, 'f', 3).arg((float)sizeY / 1000.0f, 0, 'f', 3);
}
else if (sizeX > 0)
{
str = tr("Terrain Size: %1 x %2 Meters").arg(sizeX).arg(sizeY);
}
else
{
str = tr("Level will have no terrain");
}
ui->TERRAIN_INFO->setText(str);
}
int CNewTerrainDialog::GetTerrainResolution() const
{
// convert combo box index into resolution value
return Ui::START_TERRAIN_RESOLUTION * (1 << m_terrainResolutionIndex);
}
int CNewTerrainDialog::GetTerrainUnits() const
{
// convert combo box index into units value
return Ui::START_TERRAIN_UNITS * (1 << m_terrainUnitsIndex);
}
void CNewTerrainDialog::OnComboBoxSelectionTerrainResolution()
{
UpdateData();
UpdateTerrainUnits();
UpdateTerrainInfo();
}
void CNewTerrainDialog::OnComboBoxSelectionTerrainUnits()
{
UpdateData();
UpdateTerrainInfo();
}
void CNewTerrainDialog::showEvent(QShowEvent* event)
{
if (!m_initialized)
{
OnInitDialog();
m_initialized = true;
}
QDialog::showEvent(event);
}
#include <moc_NewTerrainDialog.cpp>
-71
View File
@@ -1,71 +0,0 @@
/*
* 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
*
*/
#pragma once
#ifndef CRYINCLUDE_EDITOR_NEWTERRAINDIALOG_H
#define CRYINCLUDE_EDITOR_NEWTERRAINDIALOG_H
#if !defined(Q_MOC_RUN)
#include <QScopedPointer>
#include <vector>
#include <QDialog>
#endif
namespace Ui
{
class CNewTerrainDialog;
enum TerrainDialogConstants
{
START_TERRAIN_RESOLUTION_POWER_OF_TWO = 7,
START_TERRAIN_RESOLUTION = 1 << START_TERRAIN_RESOLUTION_POWER_OF_TWO,
MAXIMUM_TERRAIN_POWER_OF_TWO = 16,
MAXIMUM_TERRAIN_RESOLUTION = 1 << MAXIMUM_TERRAIN_POWER_OF_TWO,
POWER_OFFSET = (MAXIMUM_TERRAIN_POWER_OF_TWO - START_TERRAIN_RESOLUTION_POWER_OF_TWO),
START_TERRAIN_UNITS = 1
};
}
class CNewTerrainDialog
: public QDialog
{
Q_OBJECT
public:
CNewTerrainDialog(QWidget* pParent = nullptr); // standard constructor
~CNewTerrainDialog();
int GetTerrainResolution() const;
int GetTerrainUnits() const;
void IsResize(bool bIsResize);
protected:
void UpdateData(bool fromUi = true);
void OnInitDialog();
void UpdateTerrainUnits();
void UpdateTerrainInfo();
void showEvent(QShowEvent* event) override;
protected slots:
void OnComboBoxSelectionTerrainResolution();
void OnComboBoxSelectionTerrainUnits();
public:
int m_terrainResolutionIndex;
int m_terrainUnitsIndex;
bool m_bUpdate;
QScopedPointer<Ui::CNewTerrainDialog> ui;
bool m_initialized;
};
#endif // CRYINCLUDE_EDITOR_NEWTERRAINDIALOG_H
-112
View File
@@ -1,112 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CNewTerrainDialog</class>
<widget class="QDialog" name="CNewTerrainDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>292</width>
<height>160</height>
</rect>
</property>
<property name="modal">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QFrame" name="USE_TERRAIN">
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="2" column="0">
<widget class="QLabel" name="STATIC3">
<property name="text">
<string>Heightmap Resolution:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="buddy">
<cstring>TERRAIN_RESOLUTION</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="TERRAIN_RESOLUTION"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="STATIC4">
<property name="text">
<string>Meters Per Texel:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="buddy">
<cstring>TERRAIN_UNITS</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="TERRAIN_UNITS"/>
</item>
<item row="7" column="0" colspan="2">
<widget class="QLabel" name="TERRAIN_INFO">
<property name="text">
<string>Terrain Size: 32x32 Km</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>CNewTerrainDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>164</x>
<y>176</y>
</hint>
<hint type="destinationlabel">
<x>169</x>
<y>1</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>CNewTerrainDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>245</x>
<y>172</y>
</hint>
<hint type="destinationlabel">
<x>247</x>
<y>-1</y>
</hint>
</hints>
</connection>
</connections>
</ui>
-6
View File
@@ -1,6 +0,0 @@
<RCC>
<qresource prefix="/dialog/PakManager">
<file alias="file.png">res/pakmanager_file.png</file>
<file alias="folder.png">res/pakmanager_folder.png</file>
</qresource>
</RCC>
-202
View File
@@ -1,202 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CPakManagerDlg</class>
<widget class="QDialog" name="CPakManagerDlg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>661</width>
<height>494</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="BUTTON_OPEN_PAK">
<property name="minimumSize">
<size>
<width>0</width>
<height>45</height>
</size>
</property>
<property name="text">
<string>Open PAK...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="BUTTON_CREATE_PAK">
<property name="minimumSize">
<size>
<width>0</width>
<height>45</height>
</size>
</property>
<property name="text">
<string>Create PAK...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="BUTTON_ADD_FILES_TO_PAK">
<property name="minimumSize">
<size>
<width>0</width>
<height>45</height>
</size>
</property>
<property name="text">
<string>Add files...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="BUTTON_ADD_FOLDERS_TO_PAK">
<property name="minimumSize">
<size>
<width>0</width>
<height>45</height>
</size>
</property>
<property name="text">
<string>Add folder...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="BUTTON_EXTRACT_FILES_FROM_PAK">
<property name="minimumSize">
<size>
<width>0</width>
<height>45</height>
</size>
</property>
<property name="text">
<string>Extract...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="BUTTON_DELETE_FILES_FROM_PAK">
<property name="minimumSize">
<size>
<width>0</width>
<height>45</height>
</size>
</property>
<property name="text">
<string>Delete entries</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="BUTTON_CLOSE">
<property name="minimumSize">
<size>
<width>0</width>
<height>45</height>
</size>
</property>
<property name="text">
<string>&amp;Close</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="STATIC">
<property name="text">
<string>Path:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="STATIC_PATH">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>&lt;none&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableWidget" name="LIST_FILES">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectItems</enum>
</property>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>120</number>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Filename</string>
</property>
</column>
<column>
<property name="text">
<string>Size</string>
</property>
</column>
<column>
<property name="text">
<string>Modified</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QLabel" name="STATIC_PAK_STATUS">
<property name="text">
<string>Ready</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="PROGRESS">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="PakManagerDlg.qrc"/>
</resources>
<connections/>
</ui>
@@ -2599,11 +2599,12 @@ void OutlinerItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem&
optionV4.text.clear();
optionV4.widget->style()->drawControl(QStyle::CE_ItemViewItem, &optionV4, painter);
// Now we setup a Text Document so it can draw the rich text
int verticalOffset = GetEntityNameVerticalOffset(entityId);
painter->translate(textRect.topLeft() + QPoint(0, verticalOffset));
AzToolsFramework::RichTextHighlighter::PaintHighlightedRichText(entityNameRichText, painter, optionV4, textRect);
AzToolsFramework::RichTextHighlighter::PaintHighlightedRichText(
entityNameRichText, painter, optionV4, textRect, QPoint(0, verticalOffset));
painter->restore();
OutlinerListModel::s_paintingName = false;
}
-67
View File
@@ -1,67 +0,0 @@
/*
* 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
*
*/
#include "EditorDefs.h"
#include "SelectEAXPresetDlg.h"
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include "ui_SelectEAXPresetDlg.h"
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
CSelectEAXPresetDlg::CSelectEAXPresetDlg(QWidget* pParent)
: QDialog(pParent)
, m_ui(new Ui_CSelectEAXPresetDlg)
{
m_ui->setupUi(this);
}
CSelectEAXPresetDlg::~CSelectEAXPresetDlg()
{
}
void CSelectEAXPresetDlg::SetCurrPreset(const QString& sPreset)
{
QAbstractListModel* model = Model();
if (!model)
{
return;
}
QModelIndexList indexes = model->match(QModelIndex(), Qt::DisplayRole, sPreset, 1, Qt::MatchExactly);
if (!indexes.isEmpty())
{
m_ui->listView->setCurrentIndex(indexes.at(0));
}
}
QString CSelectEAXPresetDlg::GetCurrPreset() const
{
if (m_ui->listView->currentIndex().isValid())
{
return m_ui->listView->currentIndex().data().toString();
}
// EXCEPTION: OCX Property Pages should return false
return QString();
}
void CSelectEAXPresetDlg::SetModel(QAbstractListModel* model)
{
m_ui->listView->setModel(model);
}
QAbstractListModel* CSelectEAXPresetDlg::Model() const
{
return static_cast<QAbstractListModel*>(m_ui->listView->model());
}
#include "moc_SelectEAXPresetDlg.cpp"
-43
View File
@@ -1,43 +0,0 @@
/*
* 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
*
*/
#pragma once
// CSelectEAXPresetDlg dialog
#ifndef CRYINCLUDE_EDITOR_SELECTEAXPRESETDLG_H
#define CRYINCLUDE_EDITOR_SELECTEAXPRESETDLG_H
#if !defined(Q_MOC_RUN)
#include <QDialog>
#endif
class QAbstractListModel;
class Ui_CSelectEAXPresetDlg;
class CSelectEAXPresetDlg
: public QDialog
{
Q_OBJECT
public:
CSelectEAXPresetDlg(QWidget* pParent = nullptr); // standard constructor
~CSelectEAXPresetDlg();
void SetCurrPreset(const QString& sPreset);
QString GetCurrPreset() const;
protected:
void SetModel(QAbstractListModel* model);
QAbstractListModel* Model() const;
private:
Ui_CSelectEAXPresetDlg* m_ui;
};
#endif // CRYINCLUDE_EDITOR_SELECTEAXPRESETDLG_H
-67
View File
@@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CSelectEAXPresetDlg</class>
<widget class="QDialog" name="CSelectEAXPresetDlg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>197</width>
<height>233</height>
</rect>
</property>
<property name="windowTitle">
<string>Select Preset...</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListView" name="listView"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>listView</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>CSelectEAXPresetDlg</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>51</x>
<y>207</y>
</hint>
<hint type="destinationlabel">
<x>49</x>
<y>199</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>CSelectEAXPresetDlg</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>148</x>
<y>213</y>
</hint>
<hint type="destinationlabel">
<x>131</x>
<y>199</y>
</hint>
</hints>
</connection>
</connections>
</ui>
-23
View File
@@ -1,23 +0,0 @@
/*
* 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
*
*/
#include "EditorDefs.h"
#include "SurfaceTypeValidator.h"
// Editor
#include "Include/IObjectManager.h"
#include "Objects/BaseObject.h"
#include "ErrorReport.h"
void CSurfaceTypeValidator::Validate()
{
}
-24
View File
@@ -1,24 +0,0 @@
/*
* 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
*
*/
#ifndef CRYINCLUDE_EDITOR_SURFACETYPEVALIDATOR_H
#define CRYINCLUDE_EDITOR_SURFACETYPEVALIDATOR_H
#pragma once
class CSurfaceTypeValidator
{
public:
void Validate();
private:
};
#endif // CRYINCLUDE_EDITOR_SURFACETYPEVALIDATOR_H
-67
View File
@@ -1,67 +0,0 @@
/*
* 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 : Undo for Python function (PySetCurrentViewPosition)
#include "EditorDefs.h"
#include "UndoViewPosition.h"
// Editor
#include "ViewManager.h"
CUndoViewPosition::CUndoViewPosition(const QString& pUndoDescription)
{
m_undoDescription = pUndoDescription;
CViewport* pRenderViewport = GetIEditor()->GetViewManager()->GetGameViewport();
if (pRenderViewport)
{
Matrix34 tm = pRenderViewport->GetViewTM();
m_undo = tm.GetTranslation();
}
}
int CUndoViewPosition::GetSize()
{
return sizeof(*this);
}
QString CUndoViewPosition::GetDescription()
{
return m_undoDescription;
}
void CUndoViewPosition::Undo(bool bUndo)
{
CViewport* pRenderViewport = GetIEditor()->GetViewManager()->GetGameViewport();
if (pRenderViewport)
{
Matrix34 tm = pRenderViewport->GetViewTM();
if (bUndo)
{
m_redo = tm.GetTranslation();
}
tm.SetTranslation(m_undo);
pRenderViewport->SetViewTM(tm);
}
}
void CUndoViewPosition::Redo()
{
CViewport* pRenderViewport = GetIEditor()->GetViewManager()->GetGameViewport();
if (pRenderViewport)
{
Matrix34 tm = pRenderViewport->GetViewTM();
tm.SetTranslation(m_redo);
pRenderViewport->SetViewTM(tm);
}
}
-36
View File
@@ -1,36 +0,0 @@
/*
* 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 : Undo for Python function (PySetCurrentViewPosition)
#ifndef CRYINCLUDE_EDITOR_UNDOVIEWPOSITION_H
#define CRYINCLUDE_EDITOR_UNDOVIEWPOSITION_H
#pragma once
#include "Undo/IUndoObject.h"
class CUndoViewPosition
: public IUndoObject
{
public:
CUndoViewPosition(const QString& pUndoDescription = "Set Current View Position");
protected:
int GetSize();
QString GetDescription();
void Undo(bool bUndo);
void Redo();
private:
Vec3 m_undo;
Vec3 m_redo;
QString m_undoDescription;
};
#endif // CRYINCLUDE_EDITOR_UNDOVIEWPOSITION_H
-78
View File
@@ -1,78 +0,0 @@
/*
* 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 : Undo for Python function (PySetCurrentViewPosition)
#include "EditorDefs.h"
#include "UndoViewRotation.h"
// Editor
#include "ViewManager.h"
#include <AzCore/Math/Matrix3x3.h>
#include <AzCore/Math/Matrix3x4.h>
#include <AzFramework/Components/CameraBus.h>
#include <MathConversion.h>
Ang3 CUndoViewRotation::GetActiveCameraRotation()
{
AZ::Transform activeCameraTm = AZ::Transform::CreateIdentity();
Camera::ActiveCameraRequestBus::BroadcastResult(
activeCameraTm,
&Camera::ActiveCameraRequestBus::Events::GetActiveCameraTransform
);
const AZ::Matrix3x4 cameraMatrix = AZ::Matrix3x4::CreateFromTransform(activeCameraTm);
const Matrix33 cameraMatrixCry = AZMatrix3x3ToLYMatrix3x3(AZ::Matrix3x3::CreateFromMatrix3x4(cameraMatrix));
return RAD2DEG(Ang3::GetAnglesXYZ(cameraMatrixCry));
}
CUndoViewRotation::CUndoViewRotation(const QString& pUndoDescription)
{
m_undoDescription = pUndoDescription;
m_undo = GetActiveCameraRotation();
}
int CUndoViewRotation::GetSize()
{
return sizeof(*this);
}
QString CUndoViewRotation::GetDescription()
{
return m_undoDescription;
}
void CUndoViewRotation::Undo(bool bUndo)
{
CViewport* pRenderViewport = GetIEditor()->GetViewManager()->GetGameViewport();
if (pRenderViewport)
{
if (bUndo)
{
m_redo = GetActiveCameraRotation();
}
Matrix34 tm = pRenderViewport->GetViewTM();
tm.SetRotationXYZ(Ang3(DEG2RAD(m_undo.x), DEG2RAD(m_undo.y), DEG2RAD(m_undo.z)), tm.GetTranslation());
pRenderViewport->SetViewTM(tm);
}
}
void CUndoViewRotation::Redo()
{
CViewport* pRenderViewport = GetIEditor()->GetViewManager()->GetGameViewport();
if (pRenderViewport)
{
Matrix34 tm = pRenderViewport->GetViewTM();
tm.SetRotationXYZ(Ang3(DEG2RAD(m_redo.x), DEG2RAD(m_redo.y), DEG2RAD(m_redo.z)), tm.GetTranslation());
pRenderViewport->SetViewTM(tm);
}
}
-39
View File
@@ -1,39 +0,0 @@
/*
* 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 : Undo for Python function (PySetCurrentViewRotation)
#ifndef CRYINCLUDE_EDITOR_UNDOVIEWROTATION_H
#define CRYINCLUDE_EDITOR_UNDOVIEWROTATION_H
#pragma once
#include "Undo/IUndoObject.h"
class CUndoViewRotation
: public IUndoObject
{
public:
CUndoViewRotation(const QString& pUndoDescription = "Set Current View Rotation");
protected:
int GetSize();
QString GetDescription();
void Undo(bool bUndo);
void Redo();
private:
static Ang3 GetActiveCameraRotation();
Ang3 m_undo;
Ang3 m_redo;
QString m_undoDescription;
};
#endif // CRYINCLUDE_EDITOR_UNDOVIEWROTATION_H
-60
View File
@@ -1,60 +0,0 @@
/*
* 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
*
*/
#ifndef CRYINCLUDE_EDITOR_USERMESSAGEDEFINES_H
#define CRYINCLUDE_EDITOR_USERMESSAGEDEFINES_H
#pragma once
enum ESandboxUserMessages
{
// InPlaceComboBox
WM_USER_ON_SELECTION_CANCEL = WM_USER + 1,
WM_USER_ON_SELECTION_OK,
WM_USER_ON_NEW_SELECTION,
WM_USER_ON_EDITCHANGE,
WM_USER_ON_OPENDROPDOWN,
WM_USER_ON_EDITKEYDOWN,
WM_USER_ON_EDITCLICK,
// ACListWnd
ENAC_UPDATE,
// EditWithButton
WM_USER_EDITWITHBUTTON_CLICKED,
// FillSliderCtrl
WMU_FS_CHANGED,
WMU_FS_LBUTTONDOWN,
WMU_FS_LBUTTONUP,
FLM_EDITTEXTCHANGED,
FLM_FILTERTEXTCHANGED,
// NumberCtrlEdit
WMU_LBUTTONDOWN,
WMU_LBUTTONUP,
WM_ONWINDOWFOCUSCHANGES,
// SelectObjectDialog
IDT_TIMER_0,
IDT_TIMER_1,
// LensFlareEditor
WM_FLAREEDITOR_UPDATETREECONTROL,
// EquipPackDialog
UM_EQUIPLIST_CHECKSTATECHANGE,
// MaterialSender/MatEditMainDlg
WM_MATEDITPICK,
// GridMapWindow
WM_USER_ON_DBL_CLICK,
// LMCompDialog
WM_UPDATE_LIGHTMAP_GENERATION_PROGRESS,
WM_UPDATE_LIGHTMAP_GENERATION_MEMUSAGE,
WM_UPDATE_LIGHTMAP_GENERATION_MEMUSAGE_STATIC,
WM_UPDATE_GLM_NAME_EDIT,
// Viewport
WM_VIEWPORT_ON_TITLE_CHANGE,
// VisualLogControls
UWM_BUTTON_CLICKED,
};
#endif // CRYINCLUDE_EDITOR_USERMESSAGEDEFINES_H
-1
View File
@@ -38,7 +38,6 @@
#include "Viewport.h"
#include "LayoutConfigDialog.h"
#include "TopRendererWnd.h"
#include "UserMessageDefines.h"
#include "MainWindow.h"
#include "QtViewPaneManager.h"
#include "EditorViewportWidget.h"
-454
View File
@@ -1,454 +0,0 @@
/*
* 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
*
*/
#include "EditorDefs.h"
#include "WipFeatureManager.h"
#ifdef USE_WIP_FEATURES_MANAGER
#include "WipFeaturesDlg.h"
#if defined(AZ_PLATFORM_WINDOWS)
const char* CWipFeatureManager::kWipFeaturesFilename = "@user@\\Editor\\UI\\WipFeatures.xml";
#else
const char* CWipFeatureManager::kWipFeaturesFilename = "@user@/Editor/UI/WipFeatures.xml";
#endif
CWipFeatureManager* CWipFeatureManager::s_pInstance = nullptr;
static void WipFeatureVarChange(ICVar* pVar)
{
QString strParams = pVar->GetString();
QStringList params;
SplitString(strParams, params, ' ');
if (strParams == "edit")
{
static CWipFeaturesDlg dlg;
dlg.show();
return;
}
if (params.size() >= 2)
{
QString featName = params[0].trimmed();
QString attr = params[1].trimmed();
if (featName.isEmpty())
{
return;
}
int id = featName.toInt();
// if all features
if (featName == "*")
{
if (attr == "enable")
{
CWipFeatureManager::Instance()->EnableAllFeatures(true);
}
else
if (attr == "disable")
{
CWipFeatureManager::Instance()->EnableAllFeatures(false);
}
else
if (attr == "hide")
{
CWipFeatureManager::Instance()->ShowAllFeatures(false);
}
else
if (attr == "show")
{
CWipFeatureManager::Instance()->ShowAllFeatures(true);
}
else
if (attr == "safemode")
{
CWipFeatureManager::Instance()->SetAllFeaturesSafeMode(true);
}
else
if (attr == "fullmode")
{
CWipFeatureManager::Instance()->SetAllFeaturesSafeMode(false);
}
else
{
CWipFeatureManager::Instance()->SetAllFeaturesParams(attr.toUtf8().data());
}
return;
}
if (attr == "enable")
{
CWipFeatureManager::Instance()->EnableFeature(id, true);
}
else
if (attr == "disable")
{
CWipFeatureManager::Instance()->EnableFeature(id, false);
}
else
if (attr == "hide")
{
CWipFeatureManager::Instance()->ShowFeature(id, false);
}
else
if (attr == "show")
{
CWipFeatureManager::Instance()->ShowFeature(id, true);
}
else
if (attr == "safemode")
{
CWipFeatureManager::Instance()->SetFeatureSafeMode(id, true);
}
else
if (attr == "fullmode")
{
CWipFeatureManager::Instance()->SetFeatureSafeMode(id, false);
}
else
{
CWipFeatureManager::Instance()->SetFeatureParams(id, attr.toUtf8().data());
}
}
}
CWipFeatureManager::CWipFeatureManager()
{
m_bEnabled = true;
}
CWipFeatureManager::~CWipFeatureManager()
{
}
bool CWipFeatureManager::Init(bool bLoadXml)
{
if (!gEnv)
{
return false;
}
IConsole* pConsole = gEnv->pConsole;
if (!pConsole)
{
return false;
}
REGISTER_CVAR2_CB("e_wipfeature", (const char**)&CWipFeatureManager::Instance()->m_consoleCmdParams, "", VF_ALWAYSONCHANGE | VF_CHEAT, "wipfeature <featureName> enable|disable|hide|show|safemode|fullmode", WipFeatureVarChange);
if (bLoadXml)
{
CWipFeatureManager::Instance()->Load();
}
return true;
}
void CWipFeatureManager::Shutdown()
{
CWipFeatureManager::Instance()->Save();
delete s_pInstance;
s_pInstance = nullptr;
}
bool CWipFeatureManager::Load(const char* pFilename, bool bClearExisting)
{
if (!GetISystem())
{
return false;
}
XmlNodeRef root = GetISystem()->LoadXmlFromFile(pFilename);
if (!root)
{
return false;
}
if (bClearExisting)
{
m_features.clear();
}
Log("Loading WIP features file: '%s'...", pFilename);
for (size_t i = 0, iCount = root->getChildCount(); i < iCount; ++i)
{
SWipFeatureInfo wf;
XmlNodeRef node = root->getChild(static_cast<int>(i));
XmlString str;
node->getAttr("id", wf.m_id);
node->getAttr("displayName", str);
wf.m_displayName = str;
node->getAttr("visible", wf.m_bVisible);
node->getAttr("enabled", wf.m_bEnabled);
node->getAttr("safeMode", wf.m_bSafeMode);
node->getAttr("params", str);
wf.m_params = str;
wf.m_bLoadedFromXml = true;
TWipFeatures::iterator iter = m_features.find(wf.m_id);
if (iter == m_features.end())
{
m_features[wf.m_id] = wf;
}
else
{
m_features[wf.m_id].m_bVisible = wf.m_bVisible;
m_features[wf.m_id].m_bEnabled = wf.m_bEnabled;
m_features[wf.m_id].m_bSafeMode = wf.m_bSafeMode;
m_features[wf.m_id].m_params = wf.m_params;
}
}
Log("Loaded %d WIP features.", m_features.size());
return true;
}
bool CWipFeatureManager::Save(const char* pFilename)
{
if (!gEnv)
{
return false;
}
if (!GetISystem())
{
return false;
}
ISystem* pISystem = GetISystem();
XmlNodeRef root = pISystem->CreateXmlNode("features");
for (TWipFeatures::iterator iter = m_features.begin(), iterEnd = m_features.end(); iter != iterEnd; ++iter)
{
SWipFeatureInfo& wf = iter->second;
XmlNodeRef node = root->createNode("feature");
node->setAttr("id", wf.m_id);
node->setAttr("displayName", wf.m_displayName.c_str());
node->setAttr("visible", wf.m_bVisible);
node->setAttr("enabled", wf.m_bEnabled);
node->setAttr("safeMode", wf.m_bSafeMode);
node->setAttr("params", wf.m_params.c_str());
root->addChild(node);
}
root->saveToFile(pFilename);
return true;
}
int CWipFeatureManager::RegisterFeature(const char* pDisplayName, bool bVisible, bool bEnabled, bool bSafeMode, const char* pParams, bool bSaveToXml)
{
int aMaxId = -1;
for (TWipFeatures::iterator iter = m_features.begin(), iterEnd = m_features.end(); iter != iterEnd; ++iter)
{
if (iter->first > aMaxId)
{
aMaxId = iter->first;
}
}
++aMaxId;
SetFeature(aMaxId, pDisplayName, bVisible, bEnabled, bSafeMode, pParams, bSaveToXml);
return aMaxId;
}
void CWipFeatureManager::SetFeature(int aFeatureId, const char* pDisplayName, bool bVisible, bool bEnabled, bool bSafeMode, const char* pParams, bool bSaveToXml)
{
m_features[aFeatureId].m_id = aFeatureId;
m_features[aFeatureId].m_displayName = pDisplayName;
m_features[aFeatureId].m_bVisible = bVisible;
m_features[aFeatureId].m_bEnabled = bEnabled;
m_features[aFeatureId].m_bSafeMode = bSafeMode;
m_features[aFeatureId].m_bSaveToXml = bSaveToXml;
m_features[aFeatureId].m_params = pParams;
if (m_features[aFeatureId].m_pfnUpdateFeature)
{
m_features[aFeatureId].m_pfnUpdateFeature(aFeatureId, &bVisible, &bEnabled, &bSafeMode, pParams);
}
}
void CWipFeatureManager::SetDefaultFeatureStates(int aFeatureId, const char* pDisplayName, bool bVisible, bool bEnabled, bool bSafeMode, const char* pParams)
{
TWipFeatures::iterator iter = m_features.find(aFeatureId);
// set feature if not existing
if (iter == m_features.end() || (iter != m_features.end() && !iter->second.m_bLoadedFromXml))
{
m_features[aFeatureId].m_id = aFeatureId;
m_features[aFeatureId].m_displayName = pDisplayName;
m_features[aFeatureId].m_bVisible = bVisible;
m_features[aFeatureId].m_bEnabled = bEnabled;
m_features[aFeatureId].m_bSafeMode = bSafeMode;
m_features[aFeatureId].m_params = pParams;
}
else
if (iter != m_features.end() && iter->second.m_bLoadedFromXml)
{
m_features[aFeatureId].m_id = aFeatureId;
m_features[aFeatureId].m_displayName = pDisplayName;
}
if (m_features[aFeatureId].m_pfnUpdateFeature)
{
m_features[aFeatureId].m_pfnUpdateFeature(aFeatureId, &bVisible, &bEnabled, &bSafeMode, pParams);
}
}
bool CWipFeatureManager::IsFeatureVisible(int aFeatureId)
{
return m_features[aFeatureId].m_bVisible || !m_bEnabled;
}
bool CWipFeatureManager::IsFeatureEnabled(int aFeatureId)
{
return m_features[aFeatureId].m_bEnabled || !m_bEnabled;
}
bool CWipFeatureManager::IsFeatureInSafeMode(int aFeatureId)
{
if (!m_bEnabled)
{
return false;
}
return m_features[aFeatureId].m_bSafeMode;
}
const char* CWipFeatureManager::GetFeatureParams(int aFeatureId)
{
return m_features[aFeatureId].m_params.c_str();
}
void CWipFeatureManager::ShowFeature(int aFeatureId, bool bShow)
{
m_features[aFeatureId].m_bVisible = bShow;
if (m_features[aFeatureId].m_pfnUpdateFeature)
{
m_features[aFeatureId].m_pfnUpdateFeature(aFeatureId, &bShow, nullptr, nullptr, nullptr);
}
}
void CWipFeatureManager::EnableFeature(int aFeatureId, bool bEnable)
{
m_features[aFeatureId].m_bEnabled = bEnable;
if (m_features[aFeatureId].m_pfnUpdateFeature)
{
m_features[aFeatureId].m_pfnUpdateFeature(aFeatureId, nullptr, &bEnable, nullptr, nullptr);
}
}
void CWipFeatureManager::SetFeatureSafeMode(int aFeatureId, bool bSafeMode)
{
m_features[aFeatureId].m_bSafeMode = bSafeMode;
if (m_features[aFeatureId].m_pfnUpdateFeature)
{
m_features[aFeatureId].m_pfnUpdateFeature(aFeatureId, nullptr, nullptr, &bSafeMode, nullptr);
}
}
void CWipFeatureManager::SetFeatureParams(int aFeatureId, const char* pParams)
{
m_features[aFeatureId].m_params = pParams;
if (m_features[aFeatureId].m_pfnUpdateFeature)
{
m_features[aFeatureId].m_pfnUpdateFeature(aFeatureId, nullptr, nullptr, nullptr, pParams);
}
}
void CWipFeatureManager::ShowAllFeatures(bool bShow)
{
for (TWipFeatures::iterator iter = m_features.begin(), iterEnd = m_features.end(); iter != iterEnd; ++iter)
{
iter->second.m_bVisible = bShow;
if (iter->second.m_pfnUpdateFeature)
{
iter->second.m_pfnUpdateFeature(iter->first, &bShow, nullptr, nullptr, nullptr);
}
}
}
void CWipFeatureManager::EnableAllFeatures(bool bEnable)
{
for (TWipFeatures::iterator iter = m_features.begin(), iterEnd = m_features.end(); iter != iterEnd; ++iter)
{
iter->second.m_bEnabled = bEnable;
if (iter->second.m_pfnUpdateFeature)
{
iter->second.m_pfnUpdateFeature(iter->first, nullptr, &bEnable, nullptr, nullptr);
}
}
}
void CWipFeatureManager::SetAllFeaturesSafeMode(bool bSafeMode)
{
for (TWipFeatures::iterator iter = m_features.begin(), iterEnd = m_features.end(); iter != iterEnd; ++iter)
{
iter->second.m_bSafeMode = bSafeMode;
if (iter->second.m_pfnUpdateFeature)
{
iter->second.m_pfnUpdateFeature(iter->first, nullptr, nullptr, &bSafeMode, nullptr);
}
}
}
void CWipFeatureManager::SetAllFeaturesParams(const char* pParams)
{
for (TWipFeatures::iterator iter = m_features.begin(), iterEnd = m_features.end(); iter != iterEnd; ++iter)
{
iter->second.m_params = pParams;
if (iter->second.m_pfnUpdateFeature)
{
iter->second.m_pfnUpdateFeature(iter->first, nullptr, nullptr, nullptr, pParams);
}
}
}
void CWipFeatureManager::EnableManager(bool bEnable)
{
m_bEnabled = bEnable;
}
void CWipFeatureManager::SetFeatureUpdateCallback(int aFeatureId, TWipFeatureUpdateCallback pfnUpdate)
{
m_features[aFeatureId].m_pfnUpdateFeature = pfnUpdate;
}
AZStd::map<int, CWipFeatureManager::SWipFeatureInfo>& CWipFeatureManager::GetFeatures()
{
return m_features;
}
#endif
-162
View File
@@ -1,162 +0,0 @@
/*
* 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
*
*/
#ifndef CRYINCLUDE_EDITOR_WIPFEATUREMANAGER_H
#define CRYINCLUDE_EDITOR_WIPFEATUREMANAGER_H
#pragma once
#include <AzCore/std/string/string.h>
#include <AzCore/std/containers/map.h>
/*
This class is used to control work in progress features at runtime, so QA can test even if the end user will not see those features
You can use the console command: e_wipfeature <numeric featureId> enable|disable|hide|show|safemode|fullmode
******************************************************************************************************************************************
*** GOOD TO KNOW: "e_wipfeature edit" console command will display the WIP dialog and you can control the features from there
******************************************************************************************************************************************
*/
// undef this define to spot all wip feature usages within the editor at compile time
#define USE_WIP_FEATURES_MANAGER
#ifdef USE_WIP_FEATURES_MANAGER
// use this to register new wip features, usage from inside functions
// @param id is the numeric unique id of the feature, its good to have all feature ids in an enum in one file
// @param bVisible is the feature visible by default
// @param bEnabled is the feature enabled (usually visual enable like non-grayed) by default
// @param bSafeMode is the feature operating in some sort of safe mode (the safe mode behavior defined by the feature itself)
// @param pTWipFeatureUpdateCallback callback of type TWipFeatureUpdateCallback for when a feature state (visible,enabled and so on) was modified
#define REGISTER_WIP_FEATURE(id, bVisible, bEnabled, bSafeMode, pTWipFeatureUpdateCallback) \
static CWipFeatureManager::CWipFeatureRegisterer s_wipFeatureRegisterer_##id(id, ""#id, bVisible, bEnabled, bSafeMode, pTWipFeatureUpdateCallback);
#define IS_WIP_FEATURE_VISIBLE(id) CWipFeatureManager::Instance()->IsFeatureVisible(id)
#define IS_WIP_FEATURE_ENABLED(id) CWipFeatureManager::Instance()->IsFeatureEnabled(id)
#define IS_WIP_FEATURE_SAFEMODE(id) CWipFeatureManager::Instance()->IsFeatureInSafeMode(id)
// The feature manager singleton itself
class CWipFeatureManager
{
public:
static const char* kWipFeaturesFilename;
// Used to register a callback function to update the state of features whitin the editor
// pbVisible, pbEnabled, pbSafeMode, pParams - if the pointer is nullptr, then that attribute was not changed
typedef void (* TWipFeatureUpdateCallback)(int aFeatureId, const bool* const pbVisible, const bool* const pbEnabled, const bool* const pbSafeMode, const char* pParams);
// wip feature registerer auto create object, used for static auto feature creation with the REGISTER_WIP_FEATURE macro
class CWipFeatureRegisterer
{
public:
CWipFeatureRegisterer(int id, const char* pDisplayName, bool bVisible, bool bEnabled, bool bSafeMode, TWipFeatureUpdateCallback pTWipFeatureUpdateCallback)
{
CWipFeatureManager::Instance()->SetFeatureUpdateCallback(id, pTWipFeatureUpdateCallback);
CWipFeatureManager::Instance()->SetDefaultFeatureStates(id, pDisplayName, bVisible, bEnabled, bSafeMode);
}
};
struct SWipFeatureInfo
{
SWipFeatureInfo()
: m_id(0)
, m_displayName("")
, m_bVisible(true)
, m_bEnabled(true)
, m_bSafeMode(false)
, m_pfnUpdateFeature(nullptr)
, m_bLoadedFromXml(false)
{}
int m_id;
AZStd::string m_displayName, m_params;
bool m_bVisible, m_bEnabled, m_bSafeMode,
// if true, this feature will be saved into the xml file when Save(...) will be called
m_bSaveToXml, m_bLoadedFromXml;
TWipFeatureUpdateCallback m_pfnUpdateFeature;
};
typedef AZStd::map<int, SWipFeatureInfo> TWipFeatures;
private:
CWipFeatureManager();
~CWipFeatureManager();
static CWipFeatureManager* s_pInstance;
public:
static CWipFeatureManager* Instance()
{
if (!s_pInstance)
{
s_pInstance = new CWipFeatureManager();
AZ_Assert(s_pInstance, "Could not construct CWipFeatureManager");
}
return s_pInstance;
}
static bool Init(bool bLoadXml = true);
static void Shutdown();
bool Load(const char* pFilename = kWipFeaturesFilename, bool bClearExisting = true);
bool Save(const char* pFilename = kWipFeaturesFilename);
// Register a new feature
// @return a new feature ID
int RegisterFeature(const char* pDisplayName, bool bVisible, bool bEnabled, bool bSafeMode, const char* pParams = "", bool bSaveToXml = true);
// Set an existing feature
void SetFeature(int aFeatureId, const char* pDisplayName, bool bVisible, bool bEnabled, bool bSafeMode, const char* pParams = "", bool bSaveToXml = true);
// Create a new feature, but it will take into account the existing feature info from the loaded XML file, with persistent settings, if any
void SetDefaultFeatureStates(int aFeatureId, const char* pDisplayName, bool bVisible, bool bEnabled, bool bSafeMode, const char* pParams = "");
bool IsFeatureVisible(int aFeatureId);
bool IsFeatureEnabled(int aFeatureId);
bool IsFeatureInSafeMode(int aFeatureId);
const char* GetFeatureParams(int aFeatureId);
void ShowFeature(int aFeatureId, bool bShow = true);
void EnableFeature(int aFeatureId, bool bEnable = true);
void SetFeatureSafeMode(int aFeatureId, bool bSafeMode);
void SetFeatureParams(int aFeatureId, const char* pParams);
void ShowAllFeatures(bool bShow = true);
void EnableAllFeatures(bool bEnable = true);
void SetAllFeaturesSafeMode(bool bSafeMode);
void SetAllFeaturesParams(const char* pParams);
// if manager is disabled, then all queries about feature enable/visible/fullmode states will return true always
void EnableManager(bool bEnable = true);
void SetFeatureUpdateCallback(int aFeatureId, TWipFeatureUpdateCallback pfnUpdate);
TWipFeatures& GetFeatures();
private:
static const int kMaxWipCmdSize = 200;
TWipFeatures m_features;
char m_consoleCmdParams[kMaxWipCmdSize];
bool m_bEnabled;
};
#else
//
// no WIP feature manager in production build
//
#define REGISTER_WIP_FEATURE
#define IS_WIP_FEATURE_VISIBLE(id) true
#define IS_WIP_FEATURE_ENABLED(id) true
#define IS_WIP_FEATURE_SAFEMODE(id) true
#endif //USE_WIP_FEATURES_MANAGER
#endif // CRYINCLUDE_EDITOR_WIPFEATUREMANAGER_H
-239
View File
@@ -1,239 +0,0 @@
/*
* 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
*
*/
#include "EditorDefs.h"
#include "WipFeatureManager.h"
#include "WipFeaturesDlg.h"
// Qt
#include <QDialog>
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include "ui_WipFeaturesDlg.h"
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
#ifdef USE_WIP_FEATURES_MANAGER
// CWipFeaturesDlg dialog
class WipFeaturesModel
: public QAbstractTableModel
{
public:
WipFeaturesModel(QObject* parent = nullptr)
: QAbstractTableModel(parent)
{
}
int rowCount(const QModelIndex& parent = QModelIndex()) const override
{
return parent.isValid() ? 0 : static_cast<int>(CWipFeatureManager::Instance()->GetFeatures().size());
}
int columnCount(const QModelIndex& parent = QModelIndex()) const override
{
return parent.isValid() ? 0 : 5;
}
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override
{
if (orientation != Qt::Horizontal || section >= columnCount())
{
return QVariant();
}
switch (role)
{
case Qt::TextAlignmentRole:
return section == 0 ? Qt::AlignLeft : Qt::AlignCenter;
case Qt::DisplayRole:
switch (section)
{
case 0:
return tr("Name");
case 1:
return tr("Id");
case 2:
return tr("Visible");
case 3:
return tr("Enabled");
case 4:
return tr("SafeMode");
default:
return QVariant();
}
default:
return QVariant();
}
}
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override
{
if (!index.isValid() || index.column() >= columnCount(index.parent()) || index.row() >= rowCount(index.parent()))
{
return false;
}
if (role != Qt::EditRole || !value.canConvert<bool>())
{
return false;
}
auto it = CWipFeatureManager::Instance()->GetFeatures().begin();
std::advance(it, index.row());
auto id = it->first;
switch (index.column())
{
case 2:
CWipFeatureManager::Instance()->ShowFeature(id, value.toBool());
break;
case 3:
CWipFeatureManager::Instance()->EnableFeature(id, value.toBool());
break;
case 4:
CWipFeatureManager::Instance()->SetFeatureSafeMode(id, value.toBool());
break;
default:
return false;
}
emit dataChanged(index, index);
return true;
}
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override
{
if (!index.isValid() || index.column() >= columnCount(index.parent()) || index.row() >= rowCount(index.parent()))
{
return QVariant();
}
if (role == Qt::TextAlignmentRole)
{
return headerData(index.column(), Qt::Horizontal, role);
}
if (role != Qt::DisplayRole)
{
return QVariant();
}
auto it = CWipFeatureManager::Instance()->GetFeatures().begin();
std::advance(it, index.row());
auto feature = it->second;
switch (index.column())
{
case 0:
return QString(feature.m_displayName.c_str());
case 1:
return feature.m_id;
case 2:
return feature.m_bVisible ? tr("X") : QString();
case 3:
return feature.m_bEnabled ? tr("X") : QString();
case 4:
return feature.m_bSafeMode ? tr("X") : QString();
default:
return QVariant();
}
}
};
CWipFeaturesDlg::CWipFeaturesDlg(QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_ui(new Ui::WipFeaturesDlg)
{
m_ui->setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setFixedSize(size());
OnInitDialog();
connect(m_ui->buttonShow, &QPushButton::clicked, this, &CWipFeaturesDlg::OnBnClickedButtonShow);
connect(m_ui->buttonHide, &QPushButton::clicked, this, &CWipFeaturesDlg::OnBnClickedButtonHide);
connect(m_ui->buttonEnable, &QPushButton::clicked, this, &CWipFeaturesDlg::OnBnClickedButtonEnable);
connect(m_ui->buttonDisable, &QPushButton::clicked, this, &CWipFeaturesDlg::OnBnClickedButtonDisable);
connect(m_ui->buttonSafeMode, &QPushButton::clicked, this, &CWipFeaturesDlg::OnBnClickedButtonSafemode);
connect(m_ui->buttonNormalMode, &QPushButton::clicked, this, &CWipFeaturesDlg::OnBnClickedButtonNormalmode);
}
CWipFeaturesDlg::~CWipFeaturesDlg()
{
}
// CWipFeaturesDlg message handlers
void CWipFeaturesDlg::OnInitDialog()
{
m_ui->m_lstFeatures->setModel(new WipFeaturesModel(this));
m_ui->m_lstFeatures->horizontalHeader()->resizeSection(0, 300);
m_ui->m_lstFeatures->horizontalHeader()->resizeSection(1, 70);
m_ui->m_lstFeatures->horizontalHeader()->resizeSection(2, 70);
m_ui->m_lstFeatures->horizontalHeader()->resizeSection(3, 70);
m_ui->m_lstFeatures->horizontalHeader()->resizeSection(4, 70);
}
void CWipFeaturesDlg::OnBnClickedButtonShow()
{
for (auto index : m_ui->m_lstFeatures->selectionModel()->selectedRows())
{
m_ui->m_lstFeatures->model()->setData(index.sibling(index.row(), 2), true);
}
}
void CWipFeaturesDlg::OnBnClickedButtonHide()
{
for (auto index : m_ui->m_lstFeatures->selectionModel()->selectedRows())
{
m_ui->m_lstFeatures->model()->setData(index.sibling(index.row(), 2), false);
}
}
void CWipFeaturesDlg::OnBnClickedButtonEnable()
{
for (auto index : m_ui->m_lstFeatures->selectionModel()->selectedRows())
{
m_ui->m_lstFeatures->model()->setData(index.sibling(index.row(), 3), true);
}
}
void CWipFeaturesDlg::OnBnClickedButtonDisable()
{
for (auto index : m_ui->m_lstFeatures->selectionModel()->selectedRows())
{
m_ui->m_lstFeatures->model()->setData(index.sibling(index.row(), 3), false);
}
}
void CWipFeaturesDlg::OnBnClickedButtonSafemode()
{
for (auto index : m_ui->m_lstFeatures->selectionModel()->selectedRows())
{
m_ui->m_lstFeatures->model()->setData(index.sibling(index.row(), 4), true);
}
}
void CWipFeaturesDlg::OnBnClickedButtonNormalmode()
{
for (auto index : m_ui->m_lstFeatures->selectionModel()->selectedRows())
{
m_ui->m_lstFeatures->model()->setData(index.sibling(index.row(), 4), false);
}
}
#include <moc_WipFeaturesDlg.cpp>
#endif // USE_WIP_FEATURES_MANAGER
-58
View File
@@ -1,58 +0,0 @@
/*
* 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
*
*/
#pragma once
#ifndef CRYINCLUDE_EDITOR_WIPFEATURESDLG_H
#define CRYINCLUDE_EDITOR_WIPFEATURESDLG_H
#if !defined(Q_MOC_RUN)
#include <QDialog>
#endif
#ifdef USE_WIP_FEATURES_MANAGER
// CWipFeaturesDlg dialog
namespace Ui
{
class WipFeaturesDlg;
}
class CWipFeaturesDlg
: public QDialog
{
Q_OBJECT
public:
CWipFeaturesDlg(QWidget* pParent = nullptr); // standard constructor
virtual ~CWipFeaturesDlg();
private:
void OnInitDialog();
void OnBnClickedButtonShow();
void OnBnClickedButtonHide();
void OnBnClickedButtonEnable();
void OnBnClickedButtonDisable();
void OnBnClickedButtonSafemode();
void OnBnClickedButtonNormalmode();
private:
QScopedPointer<Ui::WipFeaturesDlg> m_ui;
};
#else
class CWipFeaturesDlg
: public QDialog
{
Q_OBJECT
};
#endif // USE_WIP_FEATURES_MANAGER
#endif // CRYINCLUDE_EDITOR_WIPFEATURESDLG_H
-5
View File
@@ -1,5 +0,0 @@
<RCC>
<qresource>
<file>res/work_in_progress_icon.png</file>
</qresource>
</RCC>
-184
View File
@@ -1,184 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WipFeaturesDlg</class>
<widget class="QDialog" name="WipFeaturesDlg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>620</width>
<height>342</height>
</rect>
</property>
<property name="windowTitle">
<string>Work in Progress Features</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1,0">
<item row="0" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Work in progress features:</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="8">
<widget class="QTableView" name="m_lstFeatures">
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>19</number>
</attribute>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="buttonShow">
<property name="text">
<string>Show</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="buttonHide">
<property name="text">
<string>Hide</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Ignored</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>74</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="buttonEnable">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="buttonDisable">
<property name="text">
<string>Disable</string>
</property>
</widget>
</item>
<item row="1" column="5">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Ignored</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>74</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="6">
<widget class="QPushButton" name="buttonNormalMode">
<property name="text">
<string>Normal Mode</string>
</property>
</widget>
</item>
<item row="1" column="7">
<widget class="QPushButton" name="buttonSafeMode">
<property name="text">
<string>Safe Mode</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="pixmap">
<pixmap resource="WipFeaturesDlg.qrc">:/res/work_in_progress_icon.png</pixmap>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>NOTE:&lt;br/&gt;The states of the WIP features will be saved in the Editor/UI/WipFeatures.xml file when the editor exits successfuly</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="WipFeaturesDlg.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>WipFeaturesDlg</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>647</x>
<y>339</y>
</hint>
<hint type="destinationlabel">
<x>674</x>
<y>314</y>
</hint>
</hints>
</connection>
</connections>
</ui>
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b9cc3783ba8ccc940e89039455f2a8617a67520400ce74c9ce4c3d16d942ead8
size 208
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b9cc3783ba8ccc940e89039455f2a8617a67520400ce74c9ce4c3d16d942ead8
size 208
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1f8b26d30e8c00514648cf72bb80fe8be3f665eb7473b6565b31a4b078816bfd
size 208
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1f8b26d30e8c00514648cf72bb80fe8be3f665eb7473b6565b31a4b078816bfd
size 208
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5e4a0284f8d3b2625c3f27d6505b19a0babb7af0825f08b4e08f40e647d10873
size 388
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:43f64ba8198c197f2dd91f00947df808fa41274411934d3d1f81e3eb44f78e7a
size 532
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:556929870bb8c26fe8ebf4e94536e74c2eb1084e6f566007ec3a5f2e6303fa53
size 392
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:239843fcd5a08e260106ee6eb3f69d3606321267e94df1e64ab25573d14980e1
size 486
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:98baf372c91fe63c423237a2a3ae5a043a4da41095698035ce86fd13f2051e44
size 514
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a570ae986b5f0b7e573094a7e75a8cfcc42f88b4766c47785bab26a9e8b1c2bb
size 239
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4c527f2b8c883c73aebba0b5f0df6215f73b7259db61b13fa5ff7aa7b96a7b9b
size 779
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8f7f84cb48b2f9031b3a23abeddaed95d54601de33c58057d6677073b3e083aa
size 501
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:804491b4251adfe017f8c52e00324dd74f00ebec445eedd947dea9356865cd56
size 682
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ecf6333b6b402e1834f3047b13e58e4f80e17a8eed3750017219b5694d1b6f67
size 625
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:70724fdada9cecd5a8d7ee5211ee713accc8f9642415e5dd93b6d621ed7273cf
size 139
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3d12de5789fb345c5ffe4b76246ec0ba4d7972fb14d15db3f36886f3beaed3ff
size 166
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fffdbe9b4e1630f4158c4a00985e713ddb6fae50bc71e8c100255bab04054c0a
size 235
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d5e4092107dbc45863abe1cbecb30c48135e17155b5a85afa07a4a90b3eb1221
size 274
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bc454d6cf883b78ae4cc32bfe4a81a6d5ee64e5e1bade9f2069e7e1b405ad9b1
size 373
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:359236f395259b21b75f8f3fa250dfeea9ef82b9d541c7344954cf93db5c9d47
size 616
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bc8e5dd88bb78f4f63ba8618e2bf0c1fd74d2dbdcf48261cfa57883c476619fe
size 1101
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1fbfb749ecfec92f461979d15642dfb940cc7895db3d27c47d040b0a7e2a1ae4
size 1288
-20
View File
@@ -347,7 +347,6 @@ set(FILES
MainStatusBar.cpp
MainStatusBar.h
MainStatusBarItems.h
CrtDebug.cpp
CryEdit.rc
CryEditDoc.cpp
CryEditDoc.h
@@ -358,7 +357,6 @@ set(FILES
LogFile.cpp
LogFile.h
Resource.h
UserMessageDefines.h
ActionManager.cpp
ActionManager.h
ShortcutDispatcher.cpp
@@ -397,9 +395,6 @@ set(FILES
ResizeResolutionDialog.cpp
ResizeResolutionDialog.h
ResizeResolutionDialog.ui
SelectEAXPresetDlg.cpp
SelectEAXPresetDlg.h
SelectEAXPresetDlg.ui
SelectLightAnimationDialog.cpp
SelectLightAnimationDialog.h
SelectSequenceDialog.cpp
@@ -421,9 +416,6 @@ set(FILES
IconListDialog.ui
UndoDropDown.cpp
UndoDropDown.h
DimensionsDialog.cpp
DimensionsDialog.h
DimensionsDialog.ui
NewLevelDialog.cpp
NewLevelDialog.h
NewLevelDialog.ui
@@ -456,12 +448,7 @@ set(FILES
ToolBox.h
TrackViewNewSequenceDialog.h
UndoConfigSpec.h
UndoViewPosition.h
UndoViewRotation.h
Util/GeometryUtil.h
WipFeaturesDlg.h
WipFeaturesDlg.ui
WipFeaturesDlg.qrc
LevelIndependentFileMan.cpp
LevelIndependentFileMan.h
LogFileImpl.cpp
@@ -550,11 +537,6 @@ set(FILES
TrackViewNewSequenceDialog.cpp
TrackViewNewSequenceDialog.ui
UndoConfigSpec.cpp
UndoViewPosition.cpp
UndoViewRotation.cpp
WipFeatureManager.cpp
WipFeatureManager.h
WipFeaturesDlg.cpp
Dialogs/ErrorsDlg.cpp
Dialogs/ErrorsDlg.h
Dialogs/ErrorsDlg.ui
@@ -571,8 +553,6 @@ set(FILES
ProcessInfo.cpp
ProcessInfo.h
Report.h
SurfaceTypeValidator.cpp
SurfaceTypeValidator.h
TrackView/AtomOutputFrameCapture.cpp
TrackView/AtomOutputFrameCapture.h
TrackView/TrackViewDialog.qrc
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b9cc3783ba8ccc940e89039455f2a8617a67520400ce74c9ce4c3d16d942ead8
size 208
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b9cc3783ba8ccc940e89039455f2a8617a67520400ce74c9ce4c3d16d942ead8
size 208
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:19b1ee36ba28ede080ef34bd13d37a8b579ad8e106089cd1b800b15aef1b58df
size 252
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9e6ef5e26d5d1566f51824c3bfa0ed3d2653cb49e38111aaf0572590b2fd15be
size 261
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:acbeaa97474bd203ac35bf87fdea49d8b3d60f18db62d64dd47c3b1b50e54816
size 303
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d92fc6ec4afc582ff5d019f5b26c48e3dbe6c5f3c753271d7918cd5ca95b8b32
size 254
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:02066aed1d53c3ffc53c0f844a88ba8870b6c2c9c846c47ef6443c21ce4b7d0c
size 224
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:67668cc830b553605d2f9ccad57f2fcd422da6a7515cfc4e9af0f43aa8591543
size 213
@@ -230,7 +230,10 @@ namespace AzToolsFramework
{
QModelIndex curIndex = selectedIndexes[0];
m_expandToEntriesByDefault = true;
m_treeStateSaver->ApplySnapshot();
if (m_treeStateSaver)
{
m_treeStateSaver->ApplySnapshot();
}
setCurrentIndex(curIndex);
scrollTo(curIndex);
@@ -240,8 +243,12 @@ namespace AzToolsFramework
// Flag our default expansion state so that we expand down to source entries after filtering
m_expandToEntriesByDefault = hasFilter;
// Then ask our state saver to apply its current snapshot again, falling back on asking us if entries should be expanded or not
m_treeStateSaver->ApplySnapshot();
if (m_treeStateSaver)
{
m_treeStateSaver->ApplySnapshot();
}
// If we're filtering for a valid entry, select the first valid entry
if (hasFilter && selectFirstValidEntry)
@@ -290,6 +290,7 @@ namespace AzToolsFramework
{
displayString = RichTextHighlighter::HighlightText(displayString, m_assetBrowserFilerModel->GetStringFilter()->GetFilterString());
}
RichTextHighlighter::PaintHighlightedRichText(displayString, painter, optionV4, remainingRect);
}
}
@@ -29,12 +29,11 @@ namespace AzToolsFramework
return highlightedString;
}
void RichTextHighlighter::PaintHighlightedRichText(const QString& highlightedString,QPainter* painter, QStyleOptionViewItem option, QRect availableRect)
void RichTextHighlighter::PaintHighlightedRichText(const QString& highlightedString,QPainter* painter, QStyleOptionViewItem option, QRect availableRect, QPoint offset /* = QPoint()*/)
{
// Now we setup a Text Document so it can draw the rich text
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
// Now we setup a Text Document so it can draw the rich text
QTextDocument textDoc;
textDoc.setDefaultFont(option.font);
if (option.state & QStyle::State_Enabled)
@@ -46,10 +45,9 @@ namespace AzToolsFramework
textDoc.setDefaultStyleSheet("body {color: #7C7C7C}");
}
textDoc.setHtml("<body>" + highlightedString + "</body>");
painter->translate(availableRect.topLeft());
painter->translate(availableRect.topLeft() + offset);
textDoc.setTextWidth(availableRect.width());
textDoc.drawContents(painter, QRectF(0, 0, availableRect.width(), availableRect.height()));
painter->restore();
}
} // namespace AzToolsFramework
@@ -30,7 +30,8 @@ namespace AzToolsFramework
RichTextHighlighter() = delete;
static QString HighlightText(const QString& displayString, const QString& matchingSubstring);
static void PaintHighlightedRichText(const QString& highlightedString,QPainter* painter, QStyleOptionViewItem option, QRect availableRect);
static void PaintHighlightedRichText(const QString& highlightedString,QPainter* painter, QStyleOptionViewItem option,
QRect availableRect, QPoint offset = QPoint());
};
} // namespace AzToolsFramework
@@ -2368,6 +2368,8 @@ namespace AzToolsFramework
AzToolsFramework::RichTextHighlighter::PaintHighlightedRichText(entityNameRichText, painter, optionV4, textRect);
painter->restore();
EntityOutlinerListModel::s_paintingName = false;
}
@@ -176,6 +176,7 @@ namespace AZ
void SetExcludeFromReflectionCubeMaps(const MeshHandle& meshHandle, bool excludeFromReflectionCubeMaps) override;
void SetRayTracingEnabled(const MeshHandle& meshHandle, bool rayTracingEnabled) override;
bool GetRayTracingEnabled(const MeshHandle& meshHandle) const override;
void SetVisible(const MeshHandle& meshHandle, bool visible) override;
void SetUseForwardPassIblSpecular(const MeshHandle& meshHandle, bool useForwardPassIblSpecular) override;
@@ -105,6 +105,8 @@ namespace AZ
virtual void SetExcludeFromReflectionCubeMaps(const MeshHandle& meshHandle, bool excludeFromReflectionCubeMaps) = 0;
//! Sets the option to exclude this mesh from raytracing
virtual void SetRayTracingEnabled(const MeshHandle& meshHandle, bool rayTracingEnabled) = 0;
//! Gets whether this mesh is excluded from raytracing
virtual bool GetRayTracingEnabled(const MeshHandle& meshHandle) const = 0;
//! Sets the mesh as visible or hidden. When the mesh is hidden it will not be rendered by the feature processor.
virtual void SetVisible(const MeshHandle& meshHandle, bool visible) = 0;
//! Sets the mesh to render IBL specular in the forward pass.
@@ -38,6 +38,7 @@ namespace UnitTest
MOCK_METHOD2(AcquireMesh, MeshHandle (const AZ::Render::MeshHandleDescriptor&, const AZ::Render::MaterialAssignmentMap&));
MOCK_METHOD2(AcquireMesh, MeshHandle (const AZ::Render::MeshHandleDescriptor&, const AZ::Data::Instance<AZ::RPI::Material>&));
MOCK_METHOD2(SetRayTracingEnabled, void (const MeshHandle&, bool));
MOCK_CONST_METHOD1(GetRayTracingEnabled, bool(const MeshHandle&));
MOCK_METHOD2(SetVisible, void (const MeshHandle&, bool));
MOCK_METHOD2(SetUseForwardPassIblSpecular, void (const MeshHandle&, bool));
};
@@ -49,7 +49,7 @@ namespace AZ
}
// Extract exactly which texture asset we need to load from the given material and map type (diffuse, normal, etc).
static AZ::Data::Asset<AZ::RPI::StreamingImageAsset> GetStreamingImageAsset(const AZ::RPI::MaterialAsset& materialAsset, const AZ::Name& propertyName)
static AZ::Data::Asset<AZ::RPI::StreamingImageAsset> GetStreamingImageAsset(AZ::RPI::MaterialAsset& materialAsset, const AZ::Name& propertyName)
{
if (!materialAsset.IsReady())
{
@@ -84,7 +84,7 @@ namespace AZ
static AZ::Data::Asset<AZ::RPI::StreamingImageAsset> GetStreamingImageAsset(const AZ::Data::Asset<Data::AssetData> materialAssetData, const AZ::Name& propertyName)
{
AZ_Assert(materialAssetData->IsReady(), "GetStreamingImageAsset() called with AssetData that is not ready.");
const AZ::RPI::MaterialAsset* materialAsset = materialAssetData.GetAs<AZ::RPI::MaterialAsset>();
AZ::RPI::MaterialAsset* materialAsset = materialAssetData.GetAs<AZ::RPI::MaterialAsset>();
return GetStreamingImageAsset(*materialAsset, propertyName);
}
}
@@ -141,7 +141,7 @@ namespace AZ
return m_textureArrayPacked[mapType];
}
bool DecalTextureArray::IsValidDecalMaterial(const AZ::RPI::MaterialAsset& materialAsset)
bool DecalTextureArray::IsValidDecalMaterial(AZ::RPI::MaterialAsset& materialAsset)
{
return GetStreamingImageAsset(materialAsset, GetMapName(DecalMapType_Diffuse)).IsReady();
}
@@ -57,7 +57,7 @@ namespace AZ
// often different (BC5 for normals, BC7 for diffuse, etc)
const Data::Instance<RPI::StreamingImage>& GetPackedTexture(const DecalMapType mapType) const;
static bool IsValidDecalMaterial(const RPI::MaterialAsset& materialAsset);
static bool IsValidDecalMaterial(RPI::MaterialAsset& materialAsset);
private:
@@ -25,7 +25,7 @@ namespace AZ
{
namespace
{
static AZ::RHI::Size GetTextureSizeFromMaterialAsset(const AZ::RPI::MaterialAsset* materialAsset)
static AZ::RHI::Size GetTextureSizeFromMaterialAsset(AZ::RPI::MaterialAsset* materialAsset)
{
for (const auto& elem : materialAsset->GetPropertyValues())
{
@@ -375,7 +375,7 @@ namespace AZ
}
}
AZStd::optional<AZ::Render::DecalTextureArrayFeatureProcessor::DecalLocation> DecalTextureArrayFeatureProcessor::AddMaterialToTextureArrays(const AZ::RPI::MaterialAsset* materialAsset)
AZStd::optional<AZ::Render::DecalTextureArrayFeatureProcessor::DecalLocation> DecalTextureArrayFeatureProcessor::AddMaterialToTextureArrays(AZ::RPI::MaterialAsset* materialAsset)
{
const RHI::Size textureSize = GetTextureSizeFromMaterialAsset(materialAsset);
@@ -410,7 +410,7 @@ namespace AZ
AZ_PROFILE_SCOPE(AzRender, "DecalTextureArrayFeatureProcessor: OnAssetReady");
const Data::AssetId& assetId = asset->GetId();
const RPI::MaterialAsset* materialAsset = asset.GetAs<AZ::RPI::MaterialAsset>();
RPI::MaterialAsset* materialAsset = asset.GetAs<AZ::RPI::MaterialAsset>();
const bool validDecalMaterial = materialAsset && DecalTextureArray::IsValidDecalMaterial(*materialAsset);
if (validDecalMaterial)
{
@@ -111,7 +111,7 @@ namespace AZ
void CacheShaderIndices();
// This call could fail (returning nullopt) if we run out of texture arrays
AZStd::optional<DecalLocation> AddMaterialToTextureArrays(const AZ::RPI::MaterialAsset* materialAsset);
AZStd::optional<DecalLocation> AddMaterialToTextureArrays(AZ::RPI::MaterialAsset* materialAsset);
int FindTextureArrayWithSize(const RHI::Size& size) const;
void RemoveMaterialFromDecal(const uint16_t decalIndex);
@@ -28,8 +28,7 @@ namespace AZ
serializeContext->Class<MaterialConverterSettings>()
->Version(2)
->Field("Enable", &MaterialConverterSettings::m_enable)
->Field("DefaultMaterial", &MaterialConverterSettings::m_defaultMaterial)
->Field("IncludeMaterialPropertyNames", &MaterialConverterSettings::m_includeMaterialPropertyNames);
->Field("DefaultMaterial", &MaterialConverterSettings::m_defaultMaterial);
}
}
@@ -70,11 +69,6 @@ namespace AZ
return m_settings.m_enable;
}
bool MaterialConverterSystemComponent::ShouldIncludeMaterialPropertyNames() const
{
return m_settings.m_includeMaterialPropertyNames;
}
bool MaterialConverterSystemComponent::ConvertMaterial(
const AZ::SceneAPI::DataTypes::IMaterialData& materialData, RPI::MaterialSourceData& sourceData)
{
@@ -26,11 +26,6 @@ namespace AZ
bool m_enable = true;
AZStd::string m_defaultMaterial;
//! Sets whether to include material property names when generating material assets. If this
//! setting is true, material property name resolution and validation is deferred into load
//! time rather than at build time, allowing to break some dependencies (e.g. fbx files will no
//! longer need to be dependent on materialtype files).
bool m_includeMaterialPropertyNames = true;
};
//! Atom's implementation of converting SceneAPI data into Atom's default material: StandardPBR
@@ -50,7 +45,6 @@ namespace AZ
// MaterialConverterBus overrides ...
bool IsEnabled() const override;
bool ShouldIncludeMaterialPropertyNames() const override;
bool ConvertMaterial(const AZ::SceneAPI::DataTypes::IMaterialData& materialData, RPI::MaterialSourceData& out) override;
AZStd::string GetMaterialTypePath() const override;
AZStd::string GetDefaultMaterialPath() const override;
@@ -435,6 +435,19 @@ namespace AZ
}
}
bool MeshFeatureProcessor::GetRayTracingEnabled(const MeshHandle& meshHandle) const
{
if (meshHandle.IsValid())
{
return meshHandle->m_descriptor.m_isRayTracingEnabled;
}
else
{
AZ_Assert(false, "Invalid mesh handle");
return false;
}
}
void MeshFeatureProcessor::SetVisible(const MeshHandle& meshHandle, bool visible)
{
if (meshHandle.IsValid())
@@ -32,10 +32,6 @@ namespace AZ
virtual bool IsEnabled() const = 0;
//! Returns true if material property names should be included in azmaterials. This allows unlinking of dependencies for some
//! file types to materialtype files (e.g. fbx).
virtual bool ShouldIncludeMaterialPropertyNames() const = 0;
//! Converts data from a IMaterialData object to an Atom MaterialSourceData.
//! Only works when IsEnabled() is true.
//! @return true if the MaterialSourceData output was populated with converted material data.
@@ -33,6 +33,12 @@ namespace AZ
class MaterialAsset;
class MaterialAssetCreator;
enum class MaterialAssetProcessingMode
{
PreBake, //!< all material asset processing is done in the Asset Processor, producing a finalized material asset
DeferredBake //!< some material asset processing is deferred, and the material asset is finalized at runtime after loading
};
//! This is a simple data structure for serializing in/out material source files.
class MaterialSourceData final
{
@@ -72,35 +78,28 @@ namespace AZ
UpdatesApplied
};
//! Checks the material type version and potentially applies a series of property changes (most common are simple property renames)
//! based on the MaterialTypeAsset's version update procedure.
//! @param materialSourceFilePath Indicates the path of the .material file that the MaterialSourceData represents. Used for resolving file-relative paths.
ApplyVersionUpdatesResult ApplyVersionUpdates(AZStd::string_view materialSourceFilePath = "");
//! Creates a MaterialAsset from the MaterialSourceData content.
//! @param assetId ID for the MaterialAsset
//! @param materialSourceFilePath Indicates the path of the .material file that the MaterialSourceData represents. Used for
//! resolving file-relative paths.
//! @param processingMode Indicates whether to finalize the material asset using data from the MaterialTypeAsset.
//! @param elevateWarnings Indicates whether to treat warnings as errors
//! @param includeMaterialPropertyNames Indicates whether to save material property names into the material asset file
Outcome<Data::Asset<MaterialAsset>> CreateMaterialAsset(
Data::AssetId assetId,
AZStd::string_view materialSourceFilePath = "",
bool elevateWarnings = true,
bool includeMaterialPropertyNames = true) const;
AZStd::string_view materialSourceFilePath,
MaterialAssetProcessingMode processingMode,
bool elevateWarnings = true) const;
//! Creates a MaterialAsset from the MaterialSourceData content.
//! @param assetId ID for the MaterialAsset
//! @param materialSourceFilePath Indicates the path of the .material file that the MaterialSourceData represents. Used for
//! resolving file-relative paths.
//! @param elevateWarnings Indicates whether to treat warnings as errors
//! @param includeMaterialPropertyNames Indicates whether to save material property names into the material asset file
//! @param sourceDependencies if not null, will be populated with a set of all of the loaded material and material type paths
Outcome<Data::Asset<MaterialAsset>> CreateMaterialAssetFromSourceData(
Data::AssetId assetId,
AZStd::string_view materialSourceFilePath = "",
bool elevateWarnings = true,
bool includeMaterialPropertyNames = true,
AZStd::unordered_set<AZStd::string>* sourceDependencies = nullptr) const;
private:
@@ -64,6 +64,11 @@ namespace AZ
void CheckForUnrecognizedJsonFields(
const AZStd::string_view* acceptedFieldNames, uint32_t acceptedFieldNameCount,
const rapidjson::Value& object, JsonDeserializerContext& context, JsonSerializationResult::ResultCode& result);
//! Materials assets can either be finalized during asset-processing time or when materials are loaded at runtime.
//! Finalizing during asset processing reduces load times and obfuscates the material data.
//! Waiting to finalize at load time reduces dependencies on the material type data, resulting in fewer asset rebuilds and less time spent processing assets.
bool BuildersShouldFinalizeMaterialAssets();
}
}
}
@@ -28,6 +28,7 @@ namespace AZ
// [GFX TODO] We need to iterate on this concept at some point. We may want to expose it through cvars or something
// like that, or we may not need this at all. For now it's helpful for testing.
void SetElevateWarnings(bool elevated);
bool GetElevateWarnings() const { return m_warningsElevated; }
int GetErrorCount() const { return m_errorCount; }
int GetWarningCount() const { return m_warningCount; }
@@ -34,8 +34,6 @@ namespace AZ
class MaterialAssetHandler;
//! MaterialAsset defines a single material, which can be used to create a Material instance for rendering at runtime.
//! It fetches MaterialTypeSourceData from the MaterialTypeAsset it owned.
//!
//! Use a MaterialAssetCreator to create a MaterialAsset.
class MaterialAsset
: public AZ::Data::AssetData
@@ -46,7 +44,6 @@ namespace AZ
friend class MaterialVersionUpdate;
friend class MaterialAssetCreator;
friend class MaterialAssetHandler;
friend class MaterialAssetCreatorCommon;
friend class UnitTest::MaterialTests;
friend class UnitTest::MaterialAssetTests;
@@ -112,15 +109,29 @@ namespace AZ
//!
//! Note that even though material source data files contain only override values and inherit the rest from
//! their parent material, they all get flattened at build time so every MaterialAsset has the full set of values.
AZStd::array_view<MaterialPropertyValue> GetPropertyValues() const;
//!
//! Calling GetPropertyValues() will automatically finalize the material asset if it isn't finalized already. The
//! MaterialTypeAsset must be loaded and ready.
const AZStd::vector<MaterialPropertyValue>& GetPropertyValues();
//! Returns true if material was created in a finalize state, as opposed to being finalized after loading from disk.
bool WasPreFinalized() const;
//! Returns the list of raw values for all properties in this material, as listed in the source .material file(s), before the material asset was Finalized.
//!
//! The MaterialAsset can be created in a "half-baked" state (see MaterialUtils::BuildersShouldFinalizeMaterialAssets) where
//! minimal processing has been done because it did not yet have access to the MaterialTypeAsset. In that case, the list will
//! be populated with values copied from the source .material file with little or no validation or other processing. It includes
//! all parent .material files, with properties listed in low-to-high priority order.
//! This list will be empty however if the asset was finalized at build-time (i.e. WasPreFinalized() returns true).
const AZStd::vector<AZStd::pair<Name, MaterialPropertyValue>>& GetRawPropertyValues() const;
private:
bool PostLoadInit() override;
//! Realigns property value and name indices with MaterialProperiesLayout by using m_propertyNames. Property names not found in the
//! MaterialPropertiesLayout are discarded, while property names not included in m_propertyNames will use the default value
//! from m_materialTypeAsset.
void RealignPropertyValuesAndNames();
//! If the material asset is not finalized yet, this does the final processing of the raw property values to get the material asset ready to be used.
//! MaterialTypeAsset must be valid before this is called.
void Finalize(AZStd::function<void(const char*)> reportWarning = nullptr, AZStd::function<void(const char*)> reportError = nullptr);
//! Checks the material type version and potentially applies a series of property changes (most common are simple property renames)
//! based on the MaterialTypeAsset's version update procedure.
@@ -145,18 +156,34 @@ namespace AZ
//! Holds values for each material property, used to initialize Material instances.
//! This is indexed by MaterialPropertyIndex and aligns with entries in m_materialPropertiesLayout.
AZStd::vector<MaterialPropertyValue> m_propertyValues;
//! This is used to realign m_propertyValues as well as itself with MaterialPropertiesLayout when not empty.
//! If empty, this implies that m_propertyValues is aligned with the entries in m_materialPropertiesLayout.
AZStd::vector<AZ::Name> m_propertyNames;
mutable AZStd::vector<MaterialPropertyValue> m_propertyValues;
//! The materialTypeVersion this materialAsset was based of. If the versions do not match at runtime when a
//! materialTypeAsset is loaded, an update will be performed on m_propertyNames if populated.
//! The MaterialAsset can be created in a "half-baked" state where minimal processing has been done because it does
//! not yet have access to the MaterialTypeAsset. In that case, this list will be populated with values copied from
//! the source .material file with little or no validation or other processing, and the m_propertyValues list will be empty.
//! Once a MaterialTypeAsset is available, Finalize() must be called to finish processing these values into the
//! final m_propertyValues list.
//! Note that the content of this list will remain after finalizing in order to support hot-reload of the MaterialTypeAsset.
//! The reason we use a vector instead of a map is to ensure inherited property values are applied in the right order;
//! if the material has a parent, and that parent uses an older material type version with renamed properties, then
//! m_rawPropertyValues could be holding two values for the same property under different names. The auto-rename process
//! can't be applied until the MaterialTypeAsset is available, so we have to keep the properties in the same order they
//! were originally encountered.
AZStd::vector<AZStd::pair<Name, MaterialPropertyValue>> m_rawPropertyValues;
//! Tracks whether Finalize() has been called, meaning m_propertyValues is populated with data matching the material type's property layout.
//! (This value is intentionally not serialized, it is set by the Finalize() function)
mutable bool m_isFinalized = false;
//! Tracks whether the MaterialAsset was already in a finalized state when it was loaded.
bool m_wasPreFinalized = false;
//! The materialTypeVersion this materialAsset was based off. If the versions do not match at runtime when a
//! materialTypeAsset is loaded, automatic updates will be attempted at runtime. Note this is not needed to
//! determine which updates to apply, but simply as an optimization to ignore the update procedure when the
//! version numbers match. (We determine which updates to apply by simply checking the property name, and not
//! allowing the same name to ever be used for two different properties, see MaterialTypeAssetCreator::ValidateMaterialVersion)
uint32_t m_materialTypeVersion = 1;
//! A flag to determine if m_propertyValues needs to be aligned with MaterialPropertiesLayout. Set to true whenever
//! m_materialTypeAsset is reinitializing.
bool m_isDirty = true;
};
@@ -9,31 +9,38 @@
#include <Atom/RPI.Reflect/AssetCreator.h>
#include <Atom/RPI.Reflect/Material/MaterialAsset.h>
#include <Atom/RPI.Reflect/Material/MaterialAssetCreatorCommon.h>
#include <Atom/RPI.Reflect/Image/AttachmentImageAssetCreator.h>
#include <Atom/RPI.Reflect/Image/StreamingImageAsset.h>
namespace AZ
{
namespace RPI
{
//! Use a MaterialAssetCreator to create and configure a new MaterialAsset.
//! The MaterialAsset will be based on a MaterialTypeAsset or another MaterialAsset.
//! Either way, the base provides the necessary data to define the layout
//! and behavior of the material. The MaterialAsset only provides property value overrides.
class MaterialAssetCreator
//!
//! There are two options for how to create the MaterialAsset, whether it should be finalized now or deferred.
//! - Finalized now: This requires the MaterialTypeAsset to be fully populated so it can read the property layout.
//! - Deferred finalize: This only requires the MaterialTypeAsset to have a valid AssetId; the data inside will not be used. MaterialAsset::Finalize()
//! will need to be called later when the final MaterialTypeAsset is available, presumably after loading the MaterialAsset at runtime.
class MaterialAssetCreator
: public AssetCreator<MaterialAsset>
, public MaterialAssetCreatorCommon
{
public:
friend class MaterialSourceData;
void Begin(const Data::AssetId& assetId, MaterialAsset& parentMaterial, bool includeMaterialPropertyNames = true);
void Begin(const Data::AssetId& assetId, MaterialTypeAsset& materialType, bool includeMaterialPropertyNames = true);
void Begin(const Data::AssetId& assetId, const Data::Asset<MaterialTypeAsset>& materialType, bool shouldFinalize);
bool End(Data::Asset<MaterialAsset>& result);
private:
void PopulatePropertyNameList();
void SetMaterialTypeVersion(uint32_t version);
void SetPropertyValue(const Name& name, const MaterialPropertyValue& value);
void SetPropertyValue(const Name& name, const Data::Asset<ImageAsset>& imageAsset);
void SetPropertyValue(const Name& name, const Data::Asset<StreamingImageAsset>& imageAsset);
void SetPropertyValue(const Name& name, const Data::Asset<AttachmentImageAsset>& imageAsset);
const MaterialPropertiesLayout* m_materialPropertiesLayout = nullptr;
private:
bool m_shouldFinalize = false;
};
} // namespace RPI
} // namespace AZ
@@ -1,70 +0,0 @@
/*
* 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
*
*/
#pragma once
#include <AzCore/Name/Name.h>
#include <Atom/RPI.Reflect/Image/ImageAsset.h>
#include <Atom/RPI.Reflect/Material/MaterialPropertiesLayout.h>
#include <Atom/RHI.Reflect/ShaderSemantic.h>
#include <Atom/RPI.Reflect/Material/MaterialPropertyValue.h>
// These classes are not directly referenced in this header only because the SetPropertyValue()
// function is templatized. But the API is still specific to these data types so we include them here.
#include <AzCore/Math/Vector2.h>
#include <AzCore/Math/Vector3.h>
#include <AzCore/Math/Vector4.h>
#include <AzCore/Math/Color.h>
namespace AZ
{
namespace RPI
{
class StreamingImageAsset;
class AttachmentImageAsset;
//! Provides common functionality to both MaterialTypeAssetCreator and MaterialAssetCreator.
class MaterialAssetCreatorCommon
{
public:
void SetPropertyValue(const Name& name, const Data::Asset<ImageAsset>& imageAsset);
void SetPropertyValue(const Name& name, const Data::Asset<StreamingImageAsset>& imageAsset);
void SetPropertyValue(const Name& name, const Data::Asset<AttachmentImageAsset>& imageAsset);
//! Sets a property value using data in AZStd::variant-based MaterialPropertyValue. The contained data must match
//! the data type of the property. For type Image, the value must be a Data::Asset<ImageAsset>.
void SetPropertyValue(const Name& name, const MaterialPropertyValue& value);
protected:
MaterialAssetCreatorCommon() = default;
void OnBegin(
const MaterialPropertiesLayout* propertyLayout,
AZStd::vector<MaterialPropertyValue>* propertyValues,
const AZStd::function<void(const char*)>& warningFunc,
const AZStd::function<void(const char*)>& errorFunc);
void OnEnd();
private:
bool PropertyCheck(TypeId typeId, const Name& name);
//! Returns the MaterialPropertyDataType value that corresponds to typeId
MaterialPropertyDataType GetMaterialPropertyDataType(TypeId typeId) const;
//! Checks that the TypeId typeId matches the type expected by materialPropertyDescriptor
bool ValidateDataType(TypeId typeId, const Name& propertyName, const MaterialPropertyDescriptor* materialPropertyDescriptor);
const MaterialPropertiesLayout* m_propertyLayout = nullptr;
//! Points to the m_propertyValues list in a MaterialAsset or MaterialTypeAsset
AZStd::vector<MaterialPropertyValue>* m_propertyValues = nullptr;
AZStd::function<void(const char*)> m_reportWarning = nullptr;
AZStd::function<void(const char*)> m_reportError = nullptr;
};
} // namespace RPI
} // namespace AZ
@@ -17,6 +17,8 @@ namespace AZ
{
namespace RPI
{
class MaterialPropertyDescriptor;
struct MaterialPropertyIndexType {
AZ_TYPE_INFO(MaterialPropertyIndexType, "{cfc09268-f3f1-4474-bd8f-f2c8de27c5f1}");
};
@@ -76,6 +78,9 @@ namespace AZ
const char* ToString(MaterialPropertyDataType materialPropertyDataType);
AZStd::string GetMaterialPropertyDataTypeString(AZ::TypeId typeId);
//! Checks that the TypeId matches the type expected by materialPropertyDescriptor
bool ValidateMaterialPropertyDataType(TypeId typeId, const Name& propertyName, const MaterialPropertyDescriptor* materialPropertyDescriptor, AZStd::function<void(const char*)> onError);
//! A material property is any data input to a material, like a bool, float, Vector, Image, Buffer, etc.
//! This descriptor defines a single input property, including it's name ID, and how it maps
@@ -30,6 +30,10 @@ namespace AZ
{
namespace RPI
{
//! This is a variant data type that represents the value of a material property.
//! For convenience, it supports all the types necessary for *both* the runtime data (MaterialAsset) as well as .material file data (MaterialSourceData).
//! For example, Instance<Image> is exclusive to the runtime data and AZStd::string is primarily for image file paths in .material files. Most other
//! data types are relevant in both contexts.
class MaterialPropertyValue final
{
public:
@@ -54,7 +54,6 @@ namespace AZ
{
friend class MaterialTypeAssetCreator;
friend class MaterialTypeAssetHandler;
friend class MaterialAssetCreatorCommon;
public:
AZ_RTTI(MaterialTypeAsset, "{CD7803AB-9C4C-4A33-9A14-7412F1665464}", AZ::Data::AssetData);
@@ -8,7 +8,6 @@
#pragma once
#include <Atom/RPI.Reflect/AssetCreator.h>
#include <Atom/RPI.Reflect/Material/MaterialAssetCreatorCommon.h>
#include <Atom/RPI.Reflect/Material/MaterialTypeAsset.h>
#include <AtomCore/std/containers/array_view.h>
@@ -27,7 +26,6 @@ namespace AZ
//! which provides the MaterialTypeAsset and default property values.
class MaterialTypeAssetCreator
: public AssetCreator<MaterialTypeAsset>
, public MaterialAssetCreatorCommon
{
public:
//! Begin creating a MaterialTypeAsset
@@ -71,6 +69,14 @@ namespace AZ
//! Finishes creating a material property.
void EndMaterialProperty();
void SetPropertyValue(const Name& name, const Data::Asset<ImageAsset>& imageAsset);
void SetPropertyValue(const Name& name, const Data::Asset<StreamingImageAsset>& imageAsset);
void SetPropertyValue(const Name& name, const Data::Asset<AttachmentImageAsset>& imageAsset);
//! Sets a property value using data in AZStd::variant-based MaterialPropertyValue. The contained data must match
//! the data type of the property. For type Image, the value must be a Data::Asset<ImageAsset>.
void SetPropertyValue(const Name& name, const MaterialPropertyValue& value);
//! Adds a MaterialFunctor.
//! Material functors provide custom logic and calculations to configure shaders, render states, and more.See MaterialFunctor.h for details.
@@ -101,7 +107,9 @@ namespace AZ
private:
void AddMaterialProperty(MaterialPropertyDescriptor&& materialProperty);
bool PropertyCheck(TypeId typeId, const Name& name);
//! The material type holds references to shader assets that contain SRGs that are supposed to be the same across all passes in the material.
//! This function searches for an SRG given a @bindingSlot. If a valid one is found it makes sure it is the same across all shaders
//! and records in srgShaderIndexToUpdate the index of the ShaderAsset in the ShaderCollection where it was found.
@@ -43,17 +43,24 @@ namespace AZ
const char* MaterialBuilder::JobKey = "Atom Material Builder";
AZStd::string GetBuilderSettingsFingerprint()
{
return AZStd::string::format("[BuildersShouldFinalizeMaterialAssets=%d]", MaterialUtils::BuildersShouldFinalizeMaterialAssets());
}
void MaterialBuilder::RegisterBuilder()
{
AssetBuilderSDK::AssetBuilderDesc materialBuilderDescriptor;
materialBuilderDescriptor.m_name = JobKey;
materialBuilderDescriptor.m_version = 110; // Material version auto update feature
materialBuilderDescriptor.m_version = 115; // material dependency improvements updated
materialBuilderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern("*.material", AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard));
materialBuilderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern("*.materialtype", AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard));
materialBuilderDescriptor.m_busId = azrtti_typeid<MaterialBuilder>();
materialBuilderDescriptor.m_createJobFunction = AZStd::bind(&MaterialBuilder::CreateJobs, this, AZStd::placeholders::_1, AZStd::placeholders::_2);
materialBuilderDescriptor.m_processJobFunction = AZStd::bind(&MaterialBuilder::ProcessJob, this, AZStd::placeholders::_1, AZStd::placeholders::_2);
materialBuilderDescriptor.m_analysisFingerprint = GetBuilderSettingsFingerprint();
BusConnect(materialBuilderDescriptor.m_busId);
AssetBuilderSDK::AssetBuilderBus::Broadcast(&AssetBuilderSDK::AssetBuilderBus::Handler::RegisterBuilderInformation, materialBuilderDescriptor);
@@ -63,7 +70,7 @@ namespace AZ
{
BusDisconnect();
}
bool MaterialBuilder::ReportMaterialAssetWarningsAsErrors() const
{
bool warningsAsErrors = false;
@@ -77,15 +84,18 @@ namespace AZ
//! Adds all relevant dependencies for a referenced source file, considering that the path might be relative to the original file location or a full asset path.
//! This will usually include multiple source dependencies and a single job dependency, but will include only source dependencies if the file is not found.
//! Note the AssetBuilderSDK::JobDependency::m_platformIdentifier will not be set by this function. The calling code must set this value before passing back
//! to the AssetBuilderSDK::CreateJobsResponse. If isOrderedOnceForMaterialTypes is true and the dependency is a .materialtype file, the job dependency type
//! will be set to JobDependencyType::OrderOnce.
void AddPossibleDependencies(AZStd::string_view currentFilePath,
AZStd::string_view referencedParentPath,
//! to the AssetBuilderSDK::CreateJobsResponse.
void AddPossibleDependencies(
const AZStd::string& currentFilePath,
const AZStd::string& referencedParentPath,
const char* jobKey,
AZStd::vector<AssetBuilderSDK::JobDependency>& jobDependencies,
bool isOrderedOnceForMaterialTypes = false)
AZStd::vector<AssetBuilderSDK::JobDependency>& jobDependencies)
{
bool dependencyFileFound = false;
const bool currentFileIsMaterial = AzFramework::StringFunc::Path::IsExtension(currentFilePath.c_str(), MaterialSourceData::Extension);
const bool referencedFileIsMaterialType = AzFramework::StringFunc::Path::IsExtension(referencedParentPath.c_str(), MaterialTypeSourceData::Extension);
const bool shouldFinalizeMaterialAssets = MaterialUtils::BuildersShouldFinalizeMaterialAssets();
AZStd::vector<AZStd::string> possibleDependencies = RPI::AssetUtils::GetPossibleDepenencyPaths(currentFilePath, referencedParentPath);
for (auto& file : possibleDependencies)
@@ -103,9 +113,15 @@ namespace AZ
AssetBuilderSDK::JobDependency jobDependency;
jobDependency.m_jobKey = jobKey;
jobDependency.m_sourceFile.m_sourceFileDependencyPath = file;
const bool isMaterialTypeFile = AzFramework::StringFunc::Path::IsExtension(file.c_str(), MaterialTypeSourceData::Extension);
jobDependency.m_type = (isMaterialTypeFile && isOrderedOnceForMaterialTypes) ? AssetBuilderSDK::JobDependencyType::OrderOnce : AssetBuilderSDK::JobDependencyType::Order;
jobDependency.m_type = AssetBuilderSDK::JobDependencyType::Order;
// If we aren't finalizing material assets, then a normal job dependency isn't needed because the MaterialTypeAsset data won't be used.
// However, we do still need at least an OrderOnce dependency to ensure the Asset Processor knows about the material type asset so the builder can get it's AssetId.
// This can significantly reduce AP processing time when a material type or its shaders are edited.
if (currentFileIsMaterial && referencedFileIsMaterialType && !shouldFinalizeMaterialAssets)
{
jobDependency.m_type = AssetBuilderSDK::JobDependencyType::OrderOnce;
}
jobDependencies.push_back(jobDependency);
}
@@ -156,7 +172,8 @@ namespace AZ
// We'll build up this one JobDescriptor and reuse it to register each of the platforms
AssetBuilderSDK::JobDescriptor outputJobDescriptor;
outputJobDescriptor.m_jobKey = JobKey;
outputJobDescriptor.m_additionalFingerprintInfo = GetBuilderSettingsFingerprint();
// Load the file so we can detect and report dependencies.
// If the file is a .materialtype, report dependencies on the .shader files.
// If the file is a .material, report a dependency on the .materialtype and parent .material file
@@ -233,24 +250,12 @@ namespace AZ
parentMaterialPath = materialTypePath;
}
// If includeMaterialPropertyNames is false, then a job dependency is needed so the material builder can validate MaterialAsset properties
// against the MaterialTypeAsset at asset build time.
// If includeMaterialPropertyNames is true, the material properties will be validated at runtime when the material is loaded, so the job dependency
// is needed only for first-time processing to set up the initial MaterialAsset. This speeds up AP processing time when a materialtype file
// is edited (e.g. 10s when editing StandardPBR.materialtype on AtomTest project from 45s).
bool includeMaterialPropertyNames = true;
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
{
settingsRegistry->Get(includeMaterialPropertyNames, "/O3DE/Atom/RPI/MaterialBuilder/IncludeMaterialPropertyNames");
}
// Register dependency on the parent material source file so we can load it and use it's data to build this variant material.
// Note, we don't need a direct dependency on the material type because the parent material will depend on it.
AddPossibleDependencies(request.m_sourceFile,
parentMaterialPath,
JobKey,
outputJobDescriptor.m_jobDependencyList,
includeMaterialPropertyNames);
outputJobDescriptor.m_jobDependencyList);
}
}
@@ -297,12 +302,9 @@ namespace AZ
return {};
}
if (MaterialSourceData::ApplyVersionUpdatesResult::Failed == material.GetValue().ApplyVersionUpdates(materialSourceFilePath))
{
return {};
}
MaterialAssetProcessingMode processingMode = MaterialUtils::BuildersShouldFinalizeMaterialAssets() ? MaterialAssetProcessingMode::PreBake : MaterialAssetProcessingMode::DeferredBake;
auto materialAssetOutcome = material.GetValue().CreateMaterialAsset(Uuid::CreateRandom(), materialSourceFilePath, ReportMaterialAssetWarningsAsErrors());
auto materialAssetOutcome = material.GetValue().CreateMaterialAsset(Uuid::CreateRandom(), materialSourceFilePath, processingMode, ReportMaterialAssetWarningsAsErrors());
if (!materialAssetOutcome.IsSuccess())
{
return {};
@@ -28,6 +28,7 @@
#include <Atom/RPI.Edit/Material/MaterialSourceData.h>
#include <Atom/RPI.Edit/Material/MaterialConverterBus.h>
#include <Atom/RPI.Edit/Material/MaterialUtils.h>
#include <Atom/RPI.Edit/Common/AssetUtils.h>
#include <Atom/RPI.Reflect/Material/MaterialAsset.h>
@@ -44,7 +45,8 @@ namespace AZ
if (auto* serialize = azrtti_cast<SerializeContext*>(context))
{
serialize->Class<MaterialAssetDependenciesComponent, Component>()
->Version(5) // Set materialtype dependency to OrderOnce
->Version(5) // <<<<< If you have made changes to material code and need to force scene files to be reprocessed, this probably is
// NOT the version number you want to bump . What you're looking for is MaterialAssetBuilderComponent::Reflect below.
->Attribute(Edit::Attributes::SystemComponentTags, AZStd::vector<Crc32>({ AssetBuilderSDK::ComponentTags::AssetBuilder }));
}
}
@@ -93,9 +95,11 @@ namespace AZ
// material properties will be validated at runtime when the material is loaded, so the job dependency is needed only for
// first-time processing to set up the initial MaterialAsset. This speeds up AP processing time when a materialtype file is
// edited (e.g. 10s when editing StandardPBR.materialtype on AtomTest project from 45s).
bool includeMaterialPropertyNames = true;
RPI::MaterialConverterBus::BroadcastResult(includeMaterialPropertyNames, &RPI::MaterialConverterBus::Events::ShouldIncludeMaterialPropertyNames);
jobDependency.m_type = includeMaterialPropertyNames ? AssetBuilderSDK::JobDependencyType::OrderOnce : AssetBuilderSDK::JobDependencyType::Order;
// If we aren't finalizing material assets, then a normal job dependency isn't needed because the MaterialTypeAsset data won't be used.
// However, we do still need at least an OrderOnce dependency to ensure the Asset Processor knows about the material type asset so the builder can get it's AssetId.
// This can significantly reduce AP processing time when a material type or its shaders are edited.
jobDependency.m_type = MaterialUtils::BuildersShouldFinalizeMaterialAssets() ? AssetBuilderSDK::JobDependencyType::OrderOnce : AssetBuilderSDK::JobDependencyType::Order;
jobDependencyList.push_back(jobDependency);
}
@@ -108,10 +112,8 @@ namespace AZ
bool conversionEnabled = false;
RPI::MaterialConverterBus::BroadcastResult(conversionEnabled, &RPI::MaterialConverterBus::Events::IsEnabled);
fingerprintInfo.insert(AZStd::string::format("[MaterialConverter enabled=%d]", conversionEnabled));
bool includeMaterialPropertyNames = true;
RPI::MaterialConverterBus::BroadcastResult(includeMaterialPropertyNames, &RPI::MaterialConverterBus::Events::ShouldIncludeMaterialPropertyNames);
fingerprintInfo.insert(AZStd::string::format("[MaterialConverter includeMaterialPropertyNames=%d]", includeMaterialPropertyNames));
fingerprintInfo.insert(AZStd::string::format("[BuildersShouldFinalizeMaterialAssets=%d]", MaterialUtils::BuildersShouldFinalizeMaterialAssets()));
if (!conversionEnabled)
{
@@ -126,7 +128,7 @@ namespace AZ
if (auto* serialize = azrtti_cast<SerializeContext*>(context))
{
serialize->Class<MaterialAssetBuilderComponent, SceneAPI::SceneCore::ExportingComponent>()
->Version(16); // Optional material conversion
->Version(21); // material dependency improvements updated
}
}
@@ -230,9 +232,9 @@ namespace AZ
}
}
}
MaterialAssetProcessingMode processingMode = MaterialUtils::BuildersShouldFinalizeMaterialAssets() ? MaterialAssetProcessingMode::PreBake : MaterialAssetProcessingMode::DeferredBake;
bool includeMaterialPropertyNames = true;
RPI::MaterialConverterBus::BroadcastResult(includeMaterialPropertyNames, &RPI::MaterialConverterBus::Events::ShouldIncludeMaterialPropertyNames);
// Build material assets.
for (auto& itr : materialSourceDataByUid)
{
@@ -240,7 +242,7 @@ namespace AZ
Data::AssetId assetId(sourceSceneUuid, GetMaterialAssetSubId(materialUid));
auto materialSourceData = itr.second;
Outcome<Data::Asset<MaterialAsset>> result = materialSourceData.m_data.CreateMaterialAsset(assetId, "", false, includeMaterialPropertyNames);
Outcome<Data::Asset<MaterialAsset>> result = materialSourceData.m_data.CreateMaterialAsset(assetId, "", processingMode, false);
if (result.IsSuccess())
{
context.m_outputMaterialsByUid[materialUid] = { result.GetValue(), materialSourceData.m_name };

Some files were not shown because too many files have changed in this diff Show More