Cry Legacy: the Lessening (#5961)
* Generic Cleanup Removals: * Unused cvars,member variables and defines * Windows media center edition support routines * CSystem - removed debug_GetCallStackRaw/GetRootWindowMessageHandler/ UnloadDLL/ShutdownModuleLibraries Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Fix CryMessageBox return values in Windows build Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove named selection group and a few smaller unused functionalities Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove ObjectManager export functionality + 2 deprecated functions Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove object legacy freeze/hide support from ObjectManager Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove ObjectManager duplicate name dection, as well as object renaming Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove ObjectManager serialization and selection callbacks Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * ObjectManager - remove MoveObjects/HitTestObject/EndEditParams and related members/functions Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove a bunch of unused clone related functionality + misc Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * ObjectManager - misc removals Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * ObjectManager - more removals Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove unused object selection/retrieval in ObjectManager and LoadObjects in ObjectLoader Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * CBaseObject - remove unused material layers mask support Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * More CBaseObject cleanups. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * CBaseObject - remove SubObj functions and IMouseCreateCallback Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove unused procedural floor management, helper scale and tags. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * CBaseObject - remove more unused methods. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Removals in multiple places. CBaseObject - unused `OBJTYPE_DUMMY` flag removed, member `IsSameClass` CObjectArchive removed unused methods/members CObjectManager removed unused `Update` method Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * More removals IDisplayViewport - HitTestLine/GetGridStep/setHitcontext/ GetConstructionPlane Unused Cry_Matrix44 template specializations. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * O3DE.exe Project-Centric "Open Editor" fix (#5852) * The O3DE.exe Open Editor button now attempts to open the Editor in the build directory of the project being opened. If their is no Editor within the build directory of the Project, it uses the Editor.exe in the current O3DE.exe executable directory if it exists Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Engine .gitignore now ignores the build directory if placed in the AutomatedTesting project Previously it was just ignoring a `[Bb]uild` directory if it was directly within the engine root. This change matches the behavior of the project templates. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Renamed the ProjectUtils GetEditorDirectory function to GetEditorExecutablePath Added a platform specific implementation for retrieving the path to the Editor executable in the GetEditorExectuablePath function. It first attempts to locate the Editor via checking the project build directory for an Editor executable before falling back to checking the binary directory of the currently running O3DE executable. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Correct the MacOS GetEditorExecutablePath to return the Editor path Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Adding missing C++20 std::erase implementations (#5735) There were already implementations for std::erase_if. This adds the counterpart AZStd::erase versions resolves #5734 Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * More removals and refactors `ShowMessage` and `CryMessageBox` return void now Simplify code in `CSystem::WarningV` Remove unused `CryGetTicksPerSec` Remove unused WinBase functionality Replace `nanosleep` call in WinBase with `std::this_thread::sleep_for` Remove unused Win32Wrapper routines Remove unused IFunctorBase.h and IEntityObjectListener.h Fix VectorAndArray.cpp compilation Use QMessageBox instead of CryMessageBox in the editor. Remove empty ArchiveVars platform specific files Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Fix test code. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove an unused function Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * CBaseObject and undo description removals. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * A bunch of removals * Remove IRenderNode * Remove editor's KDTree * Remove StatObjBus, InstanceStatObjEventBus::ReleaseData is redundant ( same functionality in the only available handler is triggered by `OnCryEditorCloseScene`) * Remove CExportManager::AddStatObj/AddMeshes/AddMesh, IExportManager::ExportSingleStatObj * Remove CIconManager/IIconManager::GetObject * Remove CBaseObject::IntersectRayMesh * Remove IIndexedMesh and related structs. * Unused IUndoObject::GetDescription and all derived implementations. * Unused CUndoBaseLibrary/CUndoBaseLibraryManager * Unused Matrix34_tpl typedefs * Legacy Xml classes cleanup Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove unused `Vec3ToVector3D` helper Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * fix - remove unused static variable Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
@@ -35,20 +35,8 @@
|
||||
#include "Resource.h"
|
||||
#include "Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.h"
|
||||
|
||||
#include <IEntityRenderState.h>
|
||||
#include <IStatObj.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
inline Export::Vector3D Vec3ToVector3D(const Vec3& vec)
|
||||
{
|
||||
Export::Vector3D ret;
|
||||
ret.x = vec.x;
|
||||
ret.y = vec.y;
|
||||
ret.z = vec.z;
|
||||
return ret;
|
||||
}
|
||||
|
||||
const float kTangentDelta = 0.01f;
|
||||
const float kAspectRatio = 1.777778f;
|
||||
const int kReserveCount = 7; // x,y,z,rot_x,rot_y,rot_z,fov
|
||||
@@ -106,22 +94,22 @@ void Export::CData::Clear()
|
||||
// CExportManager
|
||||
CExportManager::CExportManager()
|
||||
: m_isPrecaching(false)
|
||||
, m_pBaseObj(nullptr)
|
||||
, m_FBXBakedExportFPS(0.0f)
|
||||
, m_fScale(100.0f)
|
||||
, m_bAnimationExport(false)
|
||||
, m_pBaseObj(nullptr)
|
||||
, // this scale is used by CryEngine RC
|
||||
m_bAnimationExport(false)
|
||||
m_FBXBakedExportFPS(0.0f)
|
||||
, m_bExportLocalCoords(false)
|
||||
, m_bExportOnlyPrimaryCamera(false)
|
||||
, m_numberOfExportFrames(0)
|
||||
, m_pivotEntityObject(nullptr)
|
||||
, m_bBakedKeysSequenceExport(true)
|
||||
, m_animTimeExportPrimarySequenceCurrentTime(0.0f)
|
||||
, m_animKeyTimeExport(true)
|
||||
, m_soundKeyTimeExport(true)
|
||||
, m_bExportOnlyPrimaryCamera(false)
|
||||
{
|
||||
RegisterExporter(new COBJExporter());
|
||||
RegisterExporter(new COCMExporter());
|
||||
CExportManager::RegisterExporter(new COBJExporter());
|
||||
CExportManager::RegisterExporter(new COCMExporter());
|
||||
}
|
||||
|
||||
|
||||
@@ -313,203 +301,6 @@ void CExportManager::AddEntityAnimationData(AZ::EntityId entityId)
|
||||
ProcessEntityAnimationTrack(entityId, pObj, AnimParamType::Rotation);
|
||||
}
|
||||
|
||||
|
||||
void CExportManager::AddMesh(Export::CObject* pObj, const IIndexedMesh* pIndMesh, Matrix34A* pTm)
|
||||
{
|
||||
if (m_isPrecaching || !pObj)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pObj->m_MeshHash = reinterpret_cast<size_t>(pIndMesh);
|
||||
IIndexedMesh::SMeshDescription meshDesc;
|
||||
pIndMesh->GetMeshDescription(meshDesc);
|
||||
|
||||
// if we have subset of meshes we need to duplicate vertices,
|
||||
// keep transformation of submesh,
|
||||
// and store new offset for indices
|
||||
int newOffsetIndex = pObj->GetVertexCount();
|
||||
|
||||
if (meshDesc.m_nVertCount)
|
||||
{
|
||||
pObj->m_vertices.reserve(meshDesc.m_nVertCount + newOffsetIndex);
|
||||
pObj->m_normals.reserve(meshDesc.m_nVertCount + newOffsetIndex);
|
||||
}
|
||||
|
||||
for (int v = 0; v < meshDesc.m_nVertCount; ++v)
|
||||
{
|
||||
Vec3 n = meshDesc.m_pNorms[v].GetN();
|
||||
Vec3 tmp = (meshDesc.m_pVerts ? meshDesc.m_pVerts[v] : meshDesc.m_pVertsF16[v].ToVec3());
|
||||
if (pTm)
|
||||
{
|
||||
tmp = pTm->TransformPoint(tmp);
|
||||
}
|
||||
|
||||
pObj->m_vertices.push_back(Vec3ToVector3D(tmp * m_fScale));
|
||||
pObj->m_normals.push_back(Vec3ToVector3D(n));
|
||||
}
|
||||
|
||||
if (meshDesc.m_nCoorCount)
|
||||
{
|
||||
pObj->m_texCoords.reserve(meshDesc.m_nCoorCount + newOffsetIndex);
|
||||
}
|
||||
|
||||
for (int v = 0; v < meshDesc.m_nCoorCount; ++v)
|
||||
{
|
||||
Vec2 uv = meshDesc.m_pTexCoord[v].GetUV();
|
||||
uv.y = 1.0f - uv.y;
|
||||
pObj->m_texCoords.push_back({uv.x,uv.y});
|
||||
}
|
||||
|
||||
if (pIndMesh->GetSubSetCount() && !(pIndMesh->GetSubSetCount() == 1 && pIndMesh->GetSubSet(0).nNumIndices == 0))
|
||||
{
|
||||
for (int i = 0; i < pIndMesh->GetSubSetCount(); ++i)
|
||||
{
|
||||
Export::CMesh* pMesh = new Export::CMesh();
|
||||
|
||||
const SMeshSubset& sms = pIndMesh->GetSubSet(i);
|
||||
const vtx_idx* pIndices = &meshDesc.m_pIndices[sms.nFirstIndexId];
|
||||
int nTris = sms.nNumIndices / 3;
|
||||
pMesh->m_faces.reserve(nTris);
|
||||
for (int f = 0; f < nTris; ++f)
|
||||
{
|
||||
Export::Face face;
|
||||
face.idx[0] = *(pIndices++) + newOffsetIndex;
|
||||
face.idx[1] = *(pIndices++) + newOffsetIndex;
|
||||
face.idx[2] = *(pIndices++) + newOffsetIndex;
|
||||
pMesh->m_faces.push_back(face);
|
||||
}
|
||||
|
||||
pObj->m_meshes.push_back(pMesh);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Export::CMesh* pMesh = new Export::CMesh();
|
||||
if (meshDesc.m_nFaceCount == 0 && meshDesc.m_nIndexCount != 0 && meshDesc.m_pIndices != nullptr)
|
||||
{
|
||||
const vtx_idx* pIndices = &meshDesc.m_pIndices[0];
|
||||
int nTris = meshDesc.m_nIndexCount / 3;
|
||||
pMesh->m_faces.reserve(nTris);
|
||||
for (int f = 0; f < nTris; ++f)
|
||||
{
|
||||
Export::Face face;
|
||||
face.idx[0] = *(pIndices++) + newOffsetIndex;
|
||||
face.idx[1] = *(pIndices++) + newOffsetIndex;
|
||||
face.idx[2] = *(pIndices++) + newOffsetIndex;
|
||||
pMesh->m_faces.push_back(face);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pMesh->m_faces.reserve(meshDesc.m_nFaceCount);
|
||||
for (int f = 0; f < meshDesc.m_nFaceCount; ++f)
|
||||
{
|
||||
Export::Face face;
|
||||
face.idx[0] = meshDesc.m_pFaces[f].v[0];
|
||||
face.idx[1] = meshDesc.m_pFaces[f].v[1];
|
||||
face.idx[2] = meshDesc.m_pFaces[f].v[2];
|
||||
pMesh->m_faces.push_back(face);
|
||||
}
|
||||
}
|
||||
|
||||
pObj->m_meshes.push_back(pMesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CExportManager::AddStatObj(Export::CObject* pObj, IStatObj* pStatObj, Matrix34A* pTm)
|
||||
{
|
||||
IIndexedMesh* pIndMesh = nullptr;
|
||||
|
||||
if (pStatObj->GetSubObjectCount())
|
||||
{
|
||||
for (int i = 0; i < pStatObj->GetSubObjectCount(); i++)
|
||||
{
|
||||
IStatObj::SSubObject* pSubObj = pStatObj->GetSubObject(i);
|
||||
if (pSubObj && pSubObj->nType == STATIC_SUB_OBJECT_MESH && pSubObj->pStatObj)
|
||||
{
|
||||
pIndMesh = nullptr;
|
||||
if (m_isOccluder)
|
||||
{
|
||||
if (pSubObj->pStatObj->GetLodObject(2))
|
||||
{
|
||||
pIndMesh = pSubObj->pStatObj->GetLodObject(2)->GetIndexedMesh(true);
|
||||
}
|
||||
if (!pIndMesh && pSubObj->pStatObj->GetLodObject(1))
|
||||
{
|
||||
pIndMesh = pSubObj->pStatObj->GetLodObject(1)->GetIndexedMesh(true);
|
||||
}
|
||||
}
|
||||
if (!pIndMesh)
|
||||
{
|
||||
pIndMesh = pSubObj->pStatObj->GetIndexedMesh(true);
|
||||
}
|
||||
if (pIndMesh)
|
||||
{
|
||||
AddMesh(pObj, pIndMesh, pTm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!pIndMesh)
|
||||
{
|
||||
if (m_isOccluder)
|
||||
{
|
||||
if (pStatObj->GetLodObject(2))
|
||||
{
|
||||
pIndMesh = pStatObj->GetLodObject(2)->GetIndexedMesh(true);
|
||||
}
|
||||
if (!pIndMesh && pStatObj->GetLodObject(1))
|
||||
{
|
||||
pIndMesh = pStatObj->GetLodObject(1)->GetIndexedMesh(true);
|
||||
}
|
||||
}
|
||||
if (!pIndMesh)
|
||||
{
|
||||
pIndMesh = pStatObj->GetIndexedMesh(true);
|
||||
}
|
||||
if (pIndMesh)
|
||||
{
|
||||
AddMesh(pObj, pIndMesh, pTm);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CExportManager::AddMeshes(Export::CObject* pObj)
|
||||
{
|
||||
if (m_pBaseObj->GetType() == OBJTYPE_AZENTITY)
|
||||
{
|
||||
CEntityObject* pEntityObject = (CEntityObject*)m_pBaseObj;
|
||||
IRenderNode* pEngineNode = pEntityObject->GetEngineNode();
|
||||
|
||||
if (pEngineNode)
|
||||
{
|
||||
if (!m_isPrecaching)
|
||||
{
|
||||
for (int i = 0; i < pEngineNode->GetSlotCount(); ++i)
|
||||
{
|
||||
Matrix34A tm;
|
||||
IStatObj* pStatObj = pEngineNode->GetEntityStatObj(i, 0, &tm);
|
||||
if (pStatObj)
|
||||
{
|
||||
Matrix34A objTM = m_pBaseObj->GetWorldTM();
|
||||
objTM.Invert();
|
||||
tm = objTM * tm;
|
||||
AddStatObj(pObj, pStatObj, &tm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CExportManager::AddObject(CBaseObject* pBaseObj)
|
||||
{
|
||||
if (m_isOccluder)
|
||||
@@ -531,7 +322,6 @@ bool CExportManager::AddObject(CBaseObject* pBaseObj)
|
||||
|
||||
if (m_isPrecaching)
|
||||
{
|
||||
AddMeshes(nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -542,7 +332,6 @@ bool CExportManager::AddObject(CBaseObject* pBaseObj)
|
||||
|
||||
m_objectMap[pBaseObj] = int(m_data.m_objects.size() - 1);
|
||||
|
||||
AddMeshes(pObj);
|
||||
m_pBaseObj = nullptr;
|
||||
|
||||
return true;
|
||||
@@ -1227,15 +1016,6 @@ bool CExportManager::ImportFromFile(const char* filename)
|
||||
return bRet;
|
||||
}
|
||||
|
||||
bool CExportManager::ExportSingleStatObj(IStatObj* pStatObj, const char* filename)
|
||||
{
|
||||
Export::CObject* pObj = new Export::CObject(Path::GetFileName(filename).toUtf8().data());
|
||||
AddStatObj(pObj, pStatObj);
|
||||
m_data.m_objects.push_back(pObj);
|
||||
ExportToFile(filename, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CExportManager::SaveNodeKeysTimeToXML()
|
||||
{
|
||||
CTrackViewSequence* pSequence = GetIEditor()->GetAnimation()->GetSequence();
|
||||
|
||||
Reference in New Issue
Block a user