56904d1799
* 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>
196 lines
6.2 KiB
C++
196 lines
6.2 KiB
C++
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project.
|
|
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
|
|
|
|
// Description : Manager for export geometry
|
|
|
|
|
|
#ifndef CRYINCLUDE_EDITOR_EXPORT_EXPORTMANAGER_H
|
|
#define CRYINCLUDE_EDITOR_EXPORT_EXPORTMANAGER_H
|
|
#pragma once
|
|
|
|
|
|
#include <AzCore/Component/EntityId.h>
|
|
#include <IExportManager.h>
|
|
|
|
class CExportManager;
|
|
class CTrackViewTrack;
|
|
class CTrackViewSequence;
|
|
class CTrackViewAnimNode;
|
|
class CEntityObject;
|
|
|
|
typedef std::vector<IExporter*> TExporters;
|
|
|
|
|
|
namespace Export
|
|
{
|
|
class CMesh
|
|
: public Mesh
|
|
, public CRefCountBase
|
|
{
|
|
public:
|
|
CMesh();
|
|
|
|
int GetFaceCount() const override { return static_cast<int>(m_faces.size()); }
|
|
const Face* GetFaceBuffer() const override { return !m_faces.empty() ? &m_faces[0] : nullptr; }
|
|
|
|
private:
|
|
std::vector<Face> m_faces;
|
|
|
|
friend CExportManager;
|
|
};
|
|
|
|
|
|
class CObject
|
|
: public Object
|
|
, public CRefCountBase
|
|
{
|
|
public:
|
|
CObject(const char* pName);
|
|
|
|
int GetVertexCount() const override { return static_cast<int>(m_vertices.size()); }
|
|
const Vector3D* GetVertexBuffer() const override { return !m_vertices.empty() ? &m_vertices[0] : nullptr; }
|
|
|
|
int GetNormalCount() const override { return static_cast<int>(m_normals.size()); }
|
|
const Vector3D* GetNormalBuffer() const override { return !m_normals.empty() ? &m_normals[0] : nullptr; }
|
|
|
|
int GetTexCoordCount() const override { return static_cast<int>(m_texCoords.size()); }
|
|
const UV* GetTexCoordBuffer() const override { return !m_texCoords.empty() ? &m_texCoords[0] : nullptr; }
|
|
|
|
int GetMeshCount() const override { return static_cast<int>(m_meshes.size()); }
|
|
Mesh* GetMesh(int index) const override { return m_meshes[index]; }
|
|
|
|
size_t MeshHash() const override{return m_MeshHash; }
|
|
|
|
void SetMaterialName(const char* pName);
|
|
int GetEntityAnimationDataCount() const override {return static_cast<int>(m_entityAnimData.size()); }
|
|
const EntityAnimData* GetEntityAnimationData(int index) const override {return &m_entityAnimData[index]; }
|
|
void SetEntityAnimationData(EntityAnimData entityData) override{ m_entityAnimData.push_back(entityData); };
|
|
void SetLastPtr(CBaseObject* pObject){m_pLastObject = pObject; };
|
|
CBaseObject* GetLastObjectPtr(){return m_pLastObject; };
|
|
|
|
private:
|
|
CBaseObject* m_pLastObject;
|
|
std::vector<Vector3D> m_vertices;
|
|
std::vector<Vector3D> m_normals;
|
|
std::vector<UV> m_texCoords;
|
|
std::vector< _smart_ptr<CMesh> > m_meshes;
|
|
std::vector<EntityAnimData> m_entityAnimData;
|
|
|
|
size_t m_MeshHash;
|
|
|
|
friend CExportManager;
|
|
};
|
|
|
|
|
|
class CData
|
|
: public IData
|
|
{
|
|
public:
|
|
virtual ~CData() = default;
|
|
|
|
int GetObjectCount() const override { return static_cast<int>(m_objects.size()); }
|
|
Object* GetObject(int index) const override { return m_objects[index]; }
|
|
Object* AddObject(const char* objectName) override;
|
|
void Clear();
|
|
|
|
private:
|
|
std::vector< _smart_ptr<Export::CObject> > m_objects;
|
|
|
|
friend CExportManager;
|
|
};
|
|
}
|
|
|
|
|
|
typedef std::map<CBaseObject*, int> TObjectMap;
|
|
|
|
class CExportManager
|
|
: public IExportManager
|
|
{
|
|
public:
|
|
|
|
CExportManager();
|
|
virtual ~CExportManager();
|
|
|
|
//! Register exporter
|
|
//! return true if succeed, otherwise false
|
|
bool RegisterExporter(IExporter* pExporter) override;
|
|
|
|
//! Export specified geometry
|
|
//! return true if succeed, otherwise false
|
|
bool Export(const char* defaultName, const char* defaultExt = "", const char* defaultPath = "", bool isSelectedObjects = true,
|
|
bool isSelectedRegionObjects = false, bool isOccluder = false, bool bAnimationExport = false);
|
|
|
|
bool AddSelectedEntityObjects();
|
|
|
|
//! Add to Export Data geometry from objects inside selected region volume
|
|
//! return true if succeed, otherwise false
|
|
bool AddSelectedRegionObjects();
|
|
|
|
//! Export to file collected data, using specified exporter throughout the file extension
|
|
//! return true if succeed, otherwise false
|
|
bool ExportToFile(const char* filename, bool bClearDataAfterExport = true);
|
|
|
|
bool ImportFromFile(const char* filename);
|
|
const Export::CData& GetData() const {return m_data; };
|
|
|
|
void SetBakedKeysSequenceExport(bool bBaked){m_bBakedKeysSequenceExport = bBaked; };
|
|
|
|
void SaveNodeKeysTimeToXML();
|
|
|
|
private:
|
|
bool AddObject(CBaseObject* pBaseObj);
|
|
void SolveHierarchy();
|
|
|
|
void AddEntityAnimationData(AZ::EntityId entityId);
|
|
void ProcessEntityAnimationTrack(AZ::EntityId entityId, Export::CObject* pObj, AnimParamType entityTrackParamType);
|
|
void AddEntityAnimationData(const CTrackViewTrack* pTrack, Export::CObject* pObj, AnimParamType entityTrackParamType);
|
|
|
|
void AddPosRotScale(Export::CObject* pObj, const CBaseObject* pBaseObj);
|
|
void AddEntityData(Export::CObject* pObj, Export::AnimParamType dataType, const float fValue, const float fTime);
|
|
|
|
bool AddObjectsFromSequence(CTrackViewSequence* pSequence, XmlNodeRef seqNode = 0);
|
|
bool IsDuplicateObjectBeingAdded(const QString& newObject);
|
|
void SetFBXExportSettings(bool bLocalCoordsToSelectedObject, bool bExportOnlyPrimaryCamera, const float fps);
|
|
bool ProcessObjectsForExport();
|
|
|
|
bool ShowFBXExportDialog();
|
|
|
|
void FillAnimTimeNode(XmlNodeRef writeNode, CTrackViewAnimNode* pObjectNode, CTrackViewSequence* currentSequence);
|
|
QString CleanXMLText(const QString& text);
|
|
|
|
private:
|
|
|
|
TExporters m_exporters;
|
|
Export::CData m_data;
|
|
bool m_isPrecaching;
|
|
bool m_isOccluder;
|
|
float m_fScale;
|
|
TObjectMap m_objectMap;
|
|
bool m_bAnimationExport;
|
|
|
|
CBaseObject* m_pBaseObj;
|
|
|
|
float m_FBXBakedExportFPS;
|
|
bool m_bExportLocalCoords;
|
|
bool m_bExportOnlyPrimaryCamera;
|
|
int m_numberOfExportFrames;
|
|
CEntityObject* m_pivotEntityObject;
|
|
bool m_bBakedKeysSequenceExport;
|
|
|
|
QString m_animTimeExportPrimarySequenceName;
|
|
float m_animTimeExportPrimarySequenceCurrentTime;
|
|
XmlNodeRef m_animTimeNode;
|
|
|
|
bool m_animKeyTimeExport;
|
|
bool m_soundKeyTimeExport;
|
|
};
|
|
|
|
|
|
#endif // CRYINCLUDE_EDITOR_EXPORT_EXPORTMANAGER_H
|