Merge branch 'development' into Prism/RemoveTabFocus
This commit is contained in:
@@ -952,7 +952,8 @@ void Q2DViewport::DrawViewerMarker(DisplayContext& dc)
|
||||
dc.SetColor(QColor(0, 0, 255)); // blue
|
||||
dc.DrawWireBox(-dim * noScale, dim * noScale);
|
||||
|
||||
float fov = GetIEditor()->GetSystem()->GetViewCamera().GetFov();
|
||||
constexpr float DefaultFov = 60.f;
|
||||
float fov = DefaultFov;
|
||||
|
||||
Vec3 q[4];
|
||||
float dist = 30;
|
||||
|
||||
@@ -25,7 +25,7 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#include <ui_AboutDialog.h>
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
CAboutDialog::CAboutDialog(QString versionText, QString richTextCopyrightNotice, QWidget* pParent /*=NULL*/)
|
||||
CAboutDialog::CAboutDialog(QString versionText, QString richTextCopyrightNotice, QWidget* pParent /*=nullptr*/)
|
||||
: QDialog(pParent)
|
||||
, m_ui(new Ui::CAboutDialog)
|
||||
{
|
||||
|
||||
@@ -1,149 +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 "SkeletonHierarchy.h"
|
||||
|
||||
using namespace Skeleton;
|
||||
|
||||
/*
|
||||
|
||||
CHierarchy
|
||||
|
||||
*/
|
||||
|
||||
CHierarchy::CHierarchy()
|
||||
{
|
||||
}
|
||||
|
||||
CHierarchy::~CHierarchy()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
uint32 CHierarchy::AddNode(const char* name, const QuatT& pose, int32 parent)
|
||||
{
|
||||
int32 index = FindNodeIndexByName(name);
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
m_nodes.push_back(SNode());
|
||||
index = int32(m_nodes.size() - 1);
|
||||
}
|
||||
|
||||
m_nodes[index].name = name;
|
||||
m_nodes[index].pose = pose;
|
||||
m_nodes[index].parent = parent;
|
||||
return uint32(index);
|
||||
}
|
||||
|
||||
int32 CHierarchy::FindNodeIndexByName(const char* name) const
|
||||
{
|
||||
uint32 count = uint32(m_nodes.size());
|
||||
for (uint32 i = 0; i < count; ++i)
|
||||
{
|
||||
if (::_stricmp(m_nodes[i].name, name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
const CHierarchy::SNode* CHierarchy::FindNode(const char* name) const
|
||||
{
|
||||
int32 index = FindNodeIndexByName(name);
|
||||
return index < 0 ? NULL : &m_nodes[index];
|
||||
}
|
||||
|
||||
void CHierarchy::CreateFrom(IDefaultSkeleton* pIDefaultSkeleton)
|
||||
{
|
||||
const uint32 jointCount = pIDefaultSkeleton->GetJointCount();
|
||||
|
||||
m_nodes.clear();
|
||||
m_nodes.reserve(jointCount);
|
||||
for (uint32 i = 0; i < jointCount; ++i)
|
||||
{
|
||||
m_nodes.push_back(SNode());
|
||||
|
||||
m_nodes.back().name = pIDefaultSkeleton->GetJointNameByID(int32(i));
|
||||
m_nodes.back().pose = pIDefaultSkeleton->GetDefaultAbsJointByID(int32(i));
|
||||
|
||||
m_nodes.back().parent = pIDefaultSkeleton->GetJointParentIDByID(int32(i));
|
||||
}
|
||||
|
||||
ValidateReferences();
|
||||
}
|
||||
|
||||
void CHierarchy::ValidateReferences()
|
||||
{
|
||||
uint32 nodeCount = m_nodes.size();
|
||||
if (!nodeCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < nodeCount; ++i)
|
||||
{
|
||||
if (m_nodes[i].parent < nodeCount)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
m_nodes[i].parent = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void CHierarchy::AbsoluteToRelative(const QuatT* pSource, QuatT* pDestination)
|
||||
{
|
||||
uint32 count = uint32(m_nodes.size());
|
||||
std::vector<QuatT> absolutes(count);
|
||||
for (uint32 i = 0; i < count; ++i)
|
||||
{
|
||||
absolutes[i] = pSource[i];
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < count; ++i)
|
||||
{
|
||||
int32 parent = m_nodes[i].parent;
|
||||
if (parent < 0)
|
||||
{
|
||||
pDestination[i] = absolutes[i];
|
||||
continue;
|
||||
}
|
||||
|
||||
pDestination[i].t = (absolutes[i].t - absolutes[parent].t) * absolutes[parent].q;
|
||||
pDestination[i].q = absolutes[parent].q.GetInverted() * absolutes[i].q;
|
||||
}
|
||||
}
|
||||
|
||||
bool CHierarchy::SerializeTo(XmlNodeRef& node)
|
||||
{
|
||||
XmlNodeRef hierarchy = node->newChild("Hierarchy");
|
||||
|
||||
uint32 nodeCount = uint32(m_nodes.size());
|
||||
std::vector<IXmlNode*> nodes(nodeCount);
|
||||
for (uint32 i = 0; i < nodeCount; ++i)
|
||||
{
|
||||
XmlNodeRef parent = hierarchy;
|
||||
if (m_nodes[i].parent > -1)
|
||||
{
|
||||
parent = nodes[m_nodes[i].parent];
|
||||
}
|
||||
|
||||
nodes[i] = parent->newChild("Node");
|
||||
nodes[i]->setAttr("name", m_nodes[i].name);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,57 +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_ANIMATION_SKELETONHIERARCHY_H
|
||||
#define CRYINCLUDE_EDITOR_ANIMATION_SKELETONHIERARCHY_H
|
||||
#pragma once
|
||||
|
||||
namespace Skeleton {
|
||||
class CHierarchy
|
||||
: public _reference_target_t
|
||||
{
|
||||
public:
|
||||
struct SNode
|
||||
{
|
||||
string name;
|
||||
QuatT pose;
|
||||
|
||||
int32 parent;
|
||||
|
||||
/* TODO: Implement
|
||||
uint32 childrenIndex;
|
||||
uint32 childrenCount;
|
||||
*/
|
||||
};
|
||||
|
||||
public:
|
||||
CHierarchy();
|
||||
~CHierarchy();
|
||||
|
||||
public:
|
||||
uint32 AddNode(const char* name, const QuatT& pose, int32 parent = -1);
|
||||
uint32 GetNodeCount() const { return uint32(m_nodes.size()); }
|
||||
SNode* GetNode(uint32 index) { return &m_nodes[index]; }
|
||||
const SNode* GetNode(uint32 index) const { return &m_nodes[index]; }
|
||||
int32 FindNodeIndexByName(const char* name) const;
|
||||
const SNode* FindNode(const char* name) const;
|
||||
void ClearNodes() { m_nodes.clear(); }
|
||||
|
||||
void CreateFrom(IDefaultSkeleton* rIDefaultSkeleton);
|
||||
void ValidateReferences();
|
||||
|
||||
void AbsoluteToRelative(const QuatT* pSource, QuatT* pDestination);
|
||||
|
||||
bool SerializeTo(XmlNodeRef& node);
|
||||
|
||||
private:
|
||||
std::vector<SNode> m_nodes;
|
||||
};
|
||||
} // namespace Skeleton
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_ANIMATION_SKELETONHIERARCHY_H
|
||||
@@ -1,368 +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 "SkeletonMapper.h"
|
||||
|
||||
using namespace Skeleton;
|
||||
|
||||
/*
|
||||
|
||||
CMapper
|
||||
|
||||
*/
|
||||
|
||||
CMapper::CMapper()
|
||||
{
|
||||
}
|
||||
|
||||
CMapper::~CMapper()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
void CMapper::CreateFromHierarchy()
|
||||
{
|
||||
m_nodes.clear();
|
||||
|
||||
uint32 nodeCount = m_hierarchy.GetNodeCount();
|
||||
m_nodes.resize(nodeCount);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
uint32 CMapper::CreateLocation(const char* name)
|
||||
{
|
||||
int32 index = FindLocation(name);
|
||||
if (index < 1)
|
||||
{
|
||||
CMapperLocation* pLocation = new CMapperLocation();
|
||||
pLocation->SetName(name);
|
||||
m_locations.push_back(pLocation);
|
||||
}
|
||||
return uint32(m_locations.size() - 1);
|
||||
}
|
||||
|
||||
void CMapper::ClearLocations()
|
||||
{
|
||||
uint32 count = uint32(m_nodes.size());
|
||||
for (uint32 i = 0; i < count; ++i)
|
||||
{
|
||||
m_nodes[i].position = NULL;
|
||||
m_nodes[i].orientation = NULL;
|
||||
}
|
||||
|
||||
m_locations.clear();
|
||||
}
|
||||
|
||||
int32 CMapper::FindLocation(const char* name) const
|
||||
{
|
||||
uint32 count = uint32(m_locations.size());
|
||||
for (uint32 i = 0; i < count; ++i)
|
||||
{
|
||||
if (::_stricmp(m_locations[i]->GetName(), name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return int32(i);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CMapper::SetLocation(CMapperLocation& location)
|
||||
{
|
||||
int32 index = FindLocation(location.GetName());
|
||||
if (index < 0)
|
||||
{
|
||||
m_locations.push_back(&location);
|
||||
return;
|
||||
}
|
||||
|
||||
m_locations[index] = &location;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
bool CMapper::CreateLocationsHierarchy(uint32 index, CHierarchy& hierarchy, int32 hierarchyParent)
|
||||
{
|
||||
if (NodeHasLocation(index))
|
||||
{
|
||||
const CHierarchy::SNode* pNode = m_hierarchy.GetNode(index);
|
||||
uint32 nodeIndex = hierarchy.AddNode(pNode->name, pNode->pose, hierarchyParent);
|
||||
hierarchyParent = uint32(nodeIndex);
|
||||
}
|
||||
|
||||
std::vector<uint32> children;
|
||||
GetChildrenIndices(index, children);
|
||||
uint32 childCount = uint32(children.size());
|
||||
for (uint32 i = 0; i < childCount; ++i)
|
||||
{
|
||||
CreateLocationsHierarchy(children[i], hierarchy, hierarchyParent);
|
||||
}
|
||||
|
||||
return hierarchy.GetNodeCount() != 0;
|
||||
}
|
||||
|
||||
bool CMapper::CreateLocationsHierarchy(CHierarchy& hierarchy)
|
||||
{
|
||||
hierarchy.ClearNodes();
|
||||
if (!CreateLocationsHierarchy(0, hierarchy, -1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
hierarchy.ValidateReferences();
|
||||
return true;
|
||||
}
|
||||
|
||||
void CMapper::Map(QuatT* pResult)
|
||||
{
|
||||
uint32 outputCount = m_hierarchy.GetNodeCount();
|
||||
std::vector<Quat> absolutes(outputCount);
|
||||
for (uint32 i = 0; i < outputCount; ++i)
|
||||
{
|
||||
pResult[i].SetIdentity();
|
||||
absolutes[i].SetIdentity();
|
||||
|
||||
CHierarchy::SNode* pNode = m_hierarchy.GetNode(i);
|
||||
if (!pNode)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
CHierarchy::SNode* pParent = pNode->parent < 0 ?
|
||||
NULL : m_hierarchy.GetNode(pNode->parent);
|
||||
if (pParent)
|
||||
{
|
||||
pResult[i].t =
|
||||
(pNode->pose.t - pParent->pose.t) * pParent->pose.q;
|
||||
}
|
||||
|
||||
if (m_nodes[i].position)
|
||||
{
|
||||
pResult[i].t = m_nodes[i].position->Compute().t;
|
||||
}
|
||||
|
||||
if (m_nodes[i].orientation)
|
||||
{
|
||||
absolutes[i] = m_nodes[i].orientation->Compute().q;
|
||||
}
|
||||
else if (pParent)
|
||||
{
|
||||
Quat relative = pParent->pose.q.GetInverted() * pNode->pose.q;
|
||||
absolutes[i] = absolutes[pNode->parent] * relative;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < outputCount; ++i)
|
||||
{
|
||||
CHierarchy::SNode* pNode = m_hierarchy.GetNode(i);
|
||||
if (!pNode)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
CHierarchy::SNode* pParent = pNode->parent < 0 ?
|
||||
NULL : m_hierarchy.GetNode(pNode->parent);
|
||||
if (!pParent)
|
||||
{
|
||||
pResult[i].q = absolutes[i];
|
||||
continue;
|
||||
}
|
||||
|
||||
pResult[i].q = absolutes[i];
|
||||
if (!m_nodes[i].position)
|
||||
{
|
||||
pResult[i].t = pResult[pNode->parent].t +
|
||||
pResult[i].t * absolutes[pNode->parent].GetInverted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
bool CMapper::NodeHasLocation(uint32 index)
|
||||
{
|
||||
if (CMapperOperator* pOperator = m_nodes[index].position)
|
||||
{
|
||||
if (pOperator->IsOfClass("Location"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (pOperator->HasLinksOfClass("Location"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (CMapperOperator* pOperator = m_nodes[index].orientation)
|
||||
{
|
||||
if (pOperator->IsOfClass("Location"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (pOperator->HasLinksOfClass("Location"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CMapper::GetChildrenIndices(uint32 parent, std::vector<uint32>& children)
|
||||
{
|
||||
uint32 nodeCount = m_hierarchy.GetNodeCount();
|
||||
for (uint32 i = 0; i < nodeCount; ++i)
|
||||
{
|
||||
if (m_hierarchy.GetNode(i)->parent != parent)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
children.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
bool CMapper::ChildrenHaveLocation(uint32 index)
|
||||
{
|
||||
std::vector<uint32> children;
|
||||
GetChildrenIndices(index, children);
|
||||
|
||||
uint32 childrenCount = uint32(children.size());
|
||||
for (uint32 i = 0; i < childrenCount; ++i)
|
||||
{
|
||||
if (ChildrenHaveLocation(children[i]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMapper::NodeOrChildrenHaveLocation(uint32 index)
|
||||
{
|
||||
if (NodeHasLocation(index))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<uint32> children;
|
||||
GetChildrenIndices(index, children);
|
||||
|
||||
uint32 childrenCount = uint32(children.size());
|
||||
for (uint32 i = 0; i < childrenCount; ++i)
|
||||
{
|
||||
if (NodeOrChildrenHaveLocation(children[i]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMapper::SerializeTo(XmlNodeRef& node)
|
||||
{
|
||||
XmlNodeRef hierarchy = node->newChild("Hierarchy");
|
||||
|
||||
uint32 nodeCount = GetNodeCount();
|
||||
std::vector<IXmlNode*> nodes(nodeCount);
|
||||
for (uint32 i = 0; i < nodeCount; ++i)
|
||||
{
|
||||
if (!NodeOrChildrenHaveLocation(i))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
CHierarchy::SNode* pNode = m_hierarchy.GetNode(i);
|
||||
if (!pNode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
XmlNodeRef xmlParent = hierarchy;
|
||||
int32 parent = pNode->parent;
|
||||
if (parent > -1)
|
||||
{
|
||||
xmlParent = nodes[parent];
|
||||
}
|
||||
|
||||
nodes[i] = xmlParent->newChild("Node");
|
||||
nodes[i]->setAttr("name", pNode->name);
|
||||
|
||||
if (CMapperOperator* pOperator = m_nodes[i].position)
|
||||
{
|
||||
XmlNodeRef position = nodes[i]->newChild("Position");
|
||||
XmlNodeRef child = position->newChild("Operator");
|
||||
if (!pOperator->SerializeWithLinksTo(child))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (CMapperOperator* pOperator = m_nodes[i].orientation)
|
||||
{
|
||||
XmlNodeRef orientation = nodes[i]->newChild("Orientation");
|
||||
XmlNodeRef child = orientation->newChild("Operator");
|
||||
if (!pOperator->SerializeWithLinksTo(child))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CMapper::SerializeFrom(XmlNodeRef& node, int32 parent)
|
||||
{
|
||||
int childCount = uint32(node->getChildCount());
|
||||
for (int i = 0; i < childCount; ++i)
|
||||
{
|
||||
XmlNodeRef child = node->getChild(i);
|
||||
if (::_stricmp(child->getTag(), "Node"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 index = m_hierarchy.AddNode(child->getAttr("name"), QuatT(IDENTITY), parent);
|
||||
if (!SerializeFrom(child, int32(index)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CMapper::SerializeFrom(XmlNodeRef& node)
|
||||
{
|
||||
XmlNodeRef hierarchy = node->findChild("Hierarchy");
|
||||
if (!hierarchy)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_hierarchy.ClearNodes();
|
||||
|
||||
if (!SerializeFrom(hierarchy, -1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_nodes.resize(m_hierarchy.GetNodeCount());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,76 +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_ANIMATION_SKELETONMAPPER_H
|
||||
#define CRYINCLUDE_EDITOR_ANIMATION_SKELETONMAPPER_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "SkeletonHierarchy.h"
|
||||
#include "SkeletonMapperOperator.h"
|
||||
|
||||
namespace Skeleton {
|
||||
class CMapper
|
||||
{
|
||||
public:
|
||||
struct SNode
|
||||
{
|
||||
_smart_ptr<CMapperOperator> position;
|
||||
_smart_ptr<CMapperOperator> orientation;
|
||||
};
|
||||
|
||||
public:
|
||||
CMapper();
|
||||
~CMapper();
|
||||
|
||||
public:
|
||||
CHierarchy& GetHierarchy() { return m_hierarchy; }
|
||||
void CreateFromHierarchy();
|
||||
|
||||
uint32 GetNodeCount() const { return uint32(m_nodes.size()); }
|
||||
SNode* GetNode(uint32 index) { return &m_nodes[index]; }
|
||||
const SNode* GetNode(uint32 index) const { return &m_nodes[index]; }
|
||||
|
||||
uint32 CreateLocation(const char* name);
|
||||
void ClearLocations();
|
||||
int32 FindLocation(const char* name) const;
|
||||
|
||||
uint32 GetLocationCount() const { return uint32(m_locations.size()); }
|
||||
void SetLocation(CMapperLocation& location);
|
||||
CMapperLocation* GetLocation(uint32 index) { return m_locations[index]; }
|
||||
const CMapperLocation* GetLocation(uint32 index) const { return m_locations[index]; }
|
||||
|
||||
bool CreateLocationsHierarchy(CHierarchy& hierarchy);
|
||||
|
||||
void Map(QuatT* pResult);
|
||||
|
||||
bool SerializeTo(XmlNodeRef& node);
|
||||
bool SerializeFrom(XmlNodeRef& node);
|
||||
|
||||
private:
|
||||
bool NodeHasLocation(uint32 index);
|
||||
bool ChildrenHaveLocation(uint32 index);
|
||||
bool NodeOrChildrenHaveLocation(uint32 index);
|
||||
|
||||
bool SerializeFrom(XmlNodeRef& node, int32 parent);
|
||||
|
||||
bool CreateLocationsHierarchy(uint32 index, CHierarchy& hierarchy, int32 hierarchyParent = -1);
|
||||
|
||||
// TEMP
|
||||
void GetChildrenIndices(uint32 parent, std::vector<uint32>& children);
|
||||
|
||||
private:
|
||||
CHierarchy m_hierarchy;
|
||||
std::vector<_smart_ptr<CMapperLocation> > m_locations;
|
||||
|
||||
std::vector<SNode> m_nodes;
|
||||
};
|
||||
} // namespace Skeleton
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_ANIMATION_SKELETONMAPPER_H
|
||||
@@ -1,284 +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 "SkeletonMapperOperator.h"
|
||||
|
||||
using namespace Skeleton;
|
||||
|
||||
/*
|
||||
|
||||
CMapperOperatorDesc
|
||||
|
||||
*/
|
||||
|
||||
std::vector<CMapperOperatorDesc*> CMapperOperatorDesc::s_descs;
|
||||
|
||||
//
|
||||
|
||||
CMapperOperatorDesc::CMapperOperatorDesc(const char* name)
|
||||
{
|
||||
s_descs.push_back(this);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
CMapperOperator
|
||||
|
||||
*/
|
||||
|
||||
CMapperOperator::CMapperOperator(const char* className, uint32 positionCount, uint32 orientationCount)
|
||||
{
|
||||
m_className = className;
|
||||
m_position.resize(positionCount, NULL);
|
||||
m_orientation.resize(orientationCount, NULL);
|
||||
}
|
||||
|
||||
CMapperOperator::~CMapperOperator()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
bool CMapperOperator::IsOfClass(const char* className)
|
||||
{
|
||||
if (::_stricmp(m_className, className))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 CMapperOperator::HasLinksOfClass(const char* className)
|
||||
{
|
||||
uint32 count = 0;
|
||||
|
||||
uint32 positionCount = m_position.size();
|
||||
for (uint32 i = 0; i < positionCount; ++i)
|
||||
{
|
||||
CMapperOperator* pOperator = m_position[i];
|
||||
if (!pOperator)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pOperator->IsOfClass(className))
|
||||
{
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 orientationCount = m_orientation.size();
|
||||
for (uint32 i = 0; i < orientationCount; ++i)
|
||||
{
|
||||
CMapperOperator* pOperator = m_orientation[i];
|
||||
if (!pOperator)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pOperator->IsOfClass(className))
|
||||
{
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
bool CMapperOperator::SerializeTo(XmlNodeRef& node)
|
||||
{
|
||||
node->setAttr("class", m_className);
|
||||
|
||||
uint32 parameterCount = uint32(m_parameters.size());
|
||||
for (uint32 i = 0; i < parameterCount; ++i)
|
||||
{
|
||||
m_parameters[i]->Serialize(node, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CMapperOperator::SerializeFrom(XmlNodeRef& node)
|
||||
{
|
||||
uint32 parameterCount = uint32(m_parameters.size());
|
||||
for (uint32 i = 0; i < parameterCount; ++i)
|
||||
{
|
||||
m_parameters[i]->Serialize(node, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CMapperOperator::SerializeWithLinksTo(XmlNodeRef& node)
|
||||
{
|
||||
if (!SerializeTo(node))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 positionCount = uint32(m_position.size());
|
||||
for (uint32 i = 0; i < positionCount; ++i)
|
||||
{
|
||||
CMapperOperator* pOperator = m_position[i];
|
||||
if (!pOperator)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
XmlNodeRef position = node->newChild("Position");
|
||||
position->setAttr("index", i);
|
||||
|
||||
XmlNodeRef child = position->newChild("Operator");
|
||||
if (!pOperator->SerializeWithLinksTo(child))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 orientationCount = uint32(m_orientation.size());
|
||||
for (uint32 i = 0; i < orientationCount; ++i)
|
||||
{
|
||||
CMapperOperator* pOperator = m_orientation[i];
|
||||
if (!pOperator)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
XmlNodeRef orientation = node->newChild("Orientation");
|
||||
orientation->setAttr("index", i);
|
||||
|
||||
XmlNodeRef child = orientation->newChild("Operator");
|
||||
if (!pOperator->SerializeWithLinksTo(child))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CMapperOperator::SerializeWithLinksFrom(XmlNodeRef& node)
|
||||
{
|
||||
if (!SerializeFrom(node))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
|
||||
CMapperOperator_Transform
|
||||
|
||||
*/
|
||||
|
||||
class CMapperOperator_Transform
|
||||
: public CMapperOperator
|
||||
{
|
||||
public:
|
||||
CMapperOperator_Transform()
|
||||
: CMapperOperator("Transform", 1, 1)
|
||||
{
|
||||
m_pAngles = new CVariable<Vec3>();
|
||||
m_pAngles->SetName("rotation");
|
||||
m_pAngles->Set(Vec3(0.0f, 0.0f, 0.0f));
|
||||
m_pAngles->SetLimits(-180.0f, 180.0f);
|
||||
AddParameter(*m_pAngles);
|
||||
|
||||
m_pVector = new CVariable<Vec3>();
|
||||
m_pVector->SetName("vector");
|
||||
m_pVector->Set(Vec3(0.0f, 0.0f, 0.0f));
|
||||
AddParameter(*m_pVector);
|
||||
|
||||
m_pScale = new CVariable<Vec3>();
|
||||
m_pScale->SetName("scale");
|
||||
m_pScale->Set(Vec3(1.0f, 1.0f, 1.0f));
|
||||
AddParameter(*m_pScale);
|
||||
}
|
||||
|
||||
// CMapperOperator
|
||||
public:
|
||||
virtual QuatT CMapperOperator_Transform::Compute()
|
||||
{
|
||||
QuatT result(IDENTITY);
|
||||
m_pVector->Get(result.t);
|
||||
|
||||
Vec3 scale;
|
||||
m_pScale->Get(scale);
|
||||
|
||||
Vec3 angles;
|
||||
m_pAngles->Get(angles);
|
||||
|
||||
result.q = Quat::CreateRotationXYZ(
|
||||
Ang3(DEG2RAD(angles.x), DEG2RAD(angles.y), DEG2RAD(angles.z)));
|
||||
|
||||
if (CMapperOperator* pOperator = GetPosition(0))
|
||||
{
|
||||
result.t = pOperator->Compute().t.CompMul(scale) + result.t;
|
||||
}
|
||||
if (CMapperOperator* pOperator = GetOrientation(0))
|
||||
{
|
||||
result.q = pOperator->Compute().q * result.q;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
CVariable<Vec3>* m_pVector;
|
||||
CVariable<Vec3>* m_pAngles;
|
||||
CVariable<Vec3>* m_pScale;
|
||||
};
|
||||
|
||||
SkeletonMapperOperatorRegister(Transform, CMapperOperator_Transform)
|
||||
|
||||
class CMapperOperator_PositionsToOrientation
|
||||
: public CMapperOperator
|
||||
{
|
||||
public:
|
||||
CMapperOperator_PositionsToOrientation()
|
||||
: CMapperOperator("PositionsToOrientation", 3, 0)
|
||||
{
|
||||
}
|
||||
|
||||
// CMapperOperator
|
||||
public:
|
||||
virtual QuatT Compute()
|
||||
{
|
||||
CMapperOperator* pOperator0 = GetPosition(0);
|
||||
CMapperOperator* pOperator1 = GetPosition(1);
|
||||
CMapperOperator* pOperator2 = GetPosition(2);
|
||||
if (!pOperator0 || !pOperator1 || !pOperator2)
|
||||
{
|
||||
return QuatT(IDENTITY);
|
||||
}
|
||||
|
||||
Vec3 p0 = pOperator0->Compute().t;
|
||||
Vec3 p1 = pOperator1->Compute().t;
|
||||
Vec3 p2 = pOperator2->Compute().t;
|
||||
|
||||
Vec3 m = (p1 + p2) * 0.5f;
|
||||
Vec3 y = (m - p0).GetNormalized();
|
||||
Vec3 z = (p1 - p2).GetNormalized();
|
||||
Vec3 x = y % z;
|
||||
z = x % y;
|
||||
|
||||
Matrix33 m33;
|
||||
m33.SetFromVectors(x, y, z);
|
||||
QuatT result(IDENTITY);
|
||||
result.q = Quat(m33);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
SkeletonMapperOperatorRegister(PositionsToOrientation, CMapperOperator_PositionsToOrientation)
|
||||
@@ -1,164 +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_ANIMATION_SKELETONMAPPEROPERATOR_H
|
||||
#define CRYINCLUDE_EDITOR_ANIMATION_SKELETONMAPPEROPERATOR_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "../Util/Variable.h"
|
||||
|
||||
#undef GetClassName
|
||||
|
||||
#define SkeletonMapperOperatorRegister(name, className) \
|
||||
class CMapperOperatorDesc_##name \
|
||||
: public CMapperOperatorDesc \
|
||||
{ \
|
||||
public: \
|
||||
CMapperOperatorDesc_##name() \
|
||||
: CMapperOperatorDesc(#name) { } \
|
||||
protected: \
|
||||
virtual const char* GetName() { return #name; } \
|
||||
virtual CMapperOperator* Create() { return new className(); } \
|
||||
} mapperOperatorDesc__##name;
|
||||
|
||||
namespace Skeleton {
|
||||
class CMapperOperator;
|
||||
|
||||
class CMapperOperatorDesc
|
||||
{
|
||||
public:
|
||||
static uint32 GetCount() { return uint32(s_descs.size()); }
|
||||
static const char* GetName(uint32 index) { return s_descs[index]->GetName(); }
|
||||
static CMapperOperator* Create(uint32 index) { return s_descs[index]->Create(); }
|
||||
|
||||
private:
|
||||
static std::vector<CMapperOperatorDesc*> s_descs;
|
||||
|
||||
public:
|
||||
CMapperOperatorDesc(const char* name);
|
||||
|
||||
protected:
|
||||
virtual const char* GetName() = 0;
|
||||
virtual CMapperOperator* Create() = 0;
|
||||
};
|
||||
|
||||
class CMapperOperator
|
||||
: public _reference_target_t
|
||||
{
|
||||
protected:
|
||||
CMapperOperator(const char* className, uint32 positionCount, uint32 orientationCount);
|
||||
~CMapperOperator();
|
||||
|
||||
public:
|
||||
const char* GetClassName() { return m_className; }
|
||||
|
||||
uint32 GetPositionCount() const { return uint32(m_position.size()); }
|
||||
void SetPosition(uint32 index, CMapperOperator* pOperator) { m_position[index] = pOperator; }
|
||||
CMapperOperator* GetPosition(uint32 index) { return m_position[index]; }
|
||||
|
||||
uint32 GetOrientationCount() const { return uint32(m_orientation.size()); }
|
||||
void SetOrientation(uint32 index, CMapperOperator* pOperator) { m_orientation[index] = pOperator; }
|
||||
CMapperOperator* GetOrientation(uint32 index) { return m_orientation[index]; }
|
||||
|
||||
uint32 GetParameterCount() { return uint32(m_parameters.size()); }
|
||||
IVariable* GetParameter(uint32 index) { return m_parameters[index]; }
|
||||
|
||||
bool IsOfClass(const char* className);
|
||||
uint32 HasLinksOfClass(const char* className);
|
||||
|
||||
bool SerializeTo(XmlNodeRef& node);
|
||||
bool SerializeFrom(XmlNodeRef& node);
|
||||
|
||||
bool SerializeWithLinksTo(XmlNodeRef& node);
|
||||
bool SerializeWithLinksFrom(XmlNodeRef& node);
|
||||
|
||||
protected:
|
||||
void AddParameter(IVariable& variable) { m_parameters.push_back(&variable); }
|
||||
|
||||
public:
|
||||
virtual QuatT Compute() = 0;
|
||||
|
||||
private:
|
||||
const char* m_className;
|
||||
std::vector<_smart_ptr<CMapperOperator> > m_position;
|
||||
std::vector<_smart_ptr<CMapperOperator> > m_orientation;
|
||||
|
||||
std::vector<IVariablePtr> m_parameters;
|
||||
};
|
||||
|
||||
class CMapperLocation
|
||||
: public CMapperOperator
|
||||
{
|
||||
public:
|
||||
CMapperLocation()
|
||||
: CMapperOperator("Location", 0, 0)
|
||||
{
|
||||
m_pName = new CVariable<CString>();
|
||||
m_pName->SetName("name");
|
||||
m_pName->SetFlags(m_pName->GetFlags() | IVariable::UI_INVISIBLE);
|
||||
AddParameter(*m_pName);
|
||||
|
||||
m_pAxis = new CVariable<Vec3>();
|
||||
m_pAxis->SetName("axis");
|
||||
m_pAxis->SetLimits(-3.0f, +3.0f);
|
||||
m_pAxis->Set(Vec3(1.0f, 2.0f, 3.0f));
|
||||
AddParameter(*m_pAxis);
|
||||
|
||||
m_location = QuatT(IDENTITY);
|
||||
}
|
||||
|
||||
public:
|
||||
void SetName(const char* name) { m_pName->Set(name); }
|
||||
CString GetName() const { CString s; m_pName->Get(s); return s; }
|
||||
|
||||
void SetLocation(const QuatT& location) { m_location = location; }
|
||||
const QuatT& GetLocation() const { return m_location; }
|
||||
|
||||
// CMapperOperator
|
||||
public:
|
||||
virtual QuatT Compute()
|
||||
{
|
||||
Vec3 axis;
|
||||
m_pAxis->Get(axis);
|
||||
|
||||
uint32 x = fabs_tpl(axis.x);
|
||||
uint32 y = fabs_tpl(axis.y);
|
||||
uint32 z = fabs_tpl(axis.z);
|
||||
if (x < 1 || y < 1 || z < 1 ||
|
||||
x > 3 || y > 3 || y > 3 ||
|
||||
x == y || x == z || y == z)
|
||||
{
|
||||
return QuatT(IDENTITY);
|
||||
}
|
||||
|
||||
Matrix33 matrix;
|
||||
matrix.SetFromVectors(
|
||||
m_location.q.GetColumn(x - 1) * f32(::sgn(axis.x)),
|
||||
m_location.q.GetColumn(y - 1) * f32(::sgn(axis.y)),
|
||||
m_location.q.GetColumn(z - 1) * f32(::sgn(axis.z)));
|
||||
if (!matrix.IsOrthonormalRH(0.01f))
|
||||
{
|
||||
return QuatT(IDENTITY);
|
||||
}
|
||||
|
||||
QuatT result = m_location;
|
||||
result.q = Quat(matrix);
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
CVariable<CString>* m_pName;
|
||||
CVariable<Vec3>* m_pAxis;
|
||||
|
||||
QuatT m_location;
|
||||
};
|
||||
} // namespace Skeleton
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_ANIMATION_SKELETONMAPPEROPERATOR_H
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
// Editor
|
||||
#include "TrackView/TrackViewDialog.h"
|
||||
#include "RenderViewport.h"
|
||||
#include "ViewManager.h"
|
||||
#include "Objects/SelectionGroup.h"
|
||||
#include "Include/IObjectManager.h"
|
||||
@@ -29,7 +28,7 @@ class CMovieCallback
|
||||
: public IMovieCallback
|
||||
{
|
||||
protected:
|
||||
virtual void OnMovieCallback(ECallbackReason reason, [[maybe_unused]] IAnimNode* pNode)
|
||||
void OnMovieCallback(ECallbackReason reason, [[maybe_unused]] IAnimNode* pNode) override
|
||||
{
|
||||
switch (reason)
|
||||
{
|
||||
@@ -49,7 +48,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
void OnSetCamera(const SCameraParams& Params)
|
||||
void OnSetCamera(const SCameraParams& Params) override
|
||||
{
|
||||
// Only switch camera when in Play mode.
|
||||
GUID camObjId = GUID_NULL;
|
||||
@@ -61,15 +60,6 @@ protected:
|
||||
{
|
||||
camObjId = pEditorEntity->GetId();
|
||||
}
|
||||
|
||||
CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
|
||||
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(pViewport))
|
||||
{
|
||||
if (!rvp->IsSequenceCamera())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Switch camera in active rendering view.
|
||||
@@ -79,14 +69,14 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
bool IsSequenceCamUsed() const
|
||||
bool IsSequenceCamUsed() const override
|
||||
{
|
||||
if (gEnv->IsEditorGameMode() == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (GetIEditor()->GetViewManager() == NULL)
|
||||
if (GetIEditor()->GetViewManager() == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -113,7 +103,7 @@ public:
|
||||
CAnimationContextPostRender(CAnimationContext* pAC)
|
||||
: m_pAC(pAC){}
|
||||
|
||||
void OnPostRender() const { assert(m_pAC); m_pAC->OnPostRender(); }
|
||||
void OnPostRender() const override { assert(m_pAC); m_pAC->OnPostRender(); }
|
||||
|
||||
protected:
|
||||
CAnimationContext* m_pAC;
|
||||
@@ -231,7 +221,7 @@ void CAnimationContext::SetSequence(CTrackViewSequence* sequence, bool force, bo
|
||||
m_pSequence->UnBindFromEditorObjects();
|
||||
}
|
||||
m_pSequence = sequence;
|
||||
|
||||
|
||||
// Notify a new sequence was just selected.
|
||||
Maestro::EditorSequenceNotificationBus::Broadcast(&Maestro::EditorSequenceNotificationBus::Events::OnSequenceSelected, m_pSequence ? m_pSequence->GetSequenceComponentEntityId() : AZ::EntityId());
|
||||
|
||||
@@ -347,7 +337,7 @@ void CAnimationContext::OnSequenceActivated(AZ::EntityId entityId)
|
||||
{
|
||||
// Hang onto this because SetSequence() will reset it.
|
||||
float lastTime = m_mostRecentSequenceTime;
|
||||
|
||||
|
||||
SetSequence(sequence, false, false);
|
||||
|
||||
// Restore the current time.
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- Editor/AnimationContext.cpp
|
||||
+++ Editor/AnimationContext.cpp
|
||||
@@ -612,7 +612,7 @@ void CAnimationContext::UpdateAnimatedLights()
|
||||
return;
|
||||
|
||||
std::vector<CBaseObject*> entityObjects;
|
||||
- GetIEditor()->GetObjectManager()->FindObjectsOfType<CEntityObject*>(entityObjects);
|
||||
+ GetIEditor()->GetObjectManager()->FindObjectsOfType(&CEntityObject::staticMetaObject, entityObjects);
|
||||
std::for_each(std::begin(entityObjects), std::end(entityObjects),
|
||||
[this](CBaseObject *pBaseObject)
|
||||
{
|
||||
@@ -260,9 +260,7 @@ void AzAssetBrowserRequestHandler::AddContextMenuActions(QWidget* caller, QMenu*
|
||||
return;
|
||||
}
|
||||
|
||||
AZStd::string fullFileDirectory;
|
||||
AZStd::string fullFilePath;
|
||||
AZStd::string fileName;
|
||||
AZStd::string extension;
|
||||
|
||||
switch (entry->GetEntryType())
|
||||
@@ -281,8 +279,6 @@ void AzAssetBrowserRequestHandler::AddContextMenuActions(QWidget* caller, QMenu*
|
||||
{
|
||||
AZ::Uuid sourceID = azrtti_cast<SourceAssetBrowserEntry*>(entry)->GetSourceUuid();
|
||||
fullFilePath = entry->GetFullPath();
|
||||
fullFileDirectory = fullFilePath.substr(0, fullFilePath.find_last_of(AZ_CORRECT_DATABASE_SEPARATOR));
|
||||
fileName = entry->GetName();
|
||||
AzFramework::StringFunc::Path::GetExtension(fullFilePath.c_str(), extension);
|
||||
|
||||
// Add the "Open" menu item.
|
||||
@@ -369,19 +365,19 @@ void AzAssetBrowserRequestHandler::AddContextMenuActions(QWidget* caller, QMenu*
|
||||
{
|
||||
if (entry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Source)
|
||||
{
|
||||
CFileUtil::PopulateQMenu(caller, menu, fileName.c_str(), fullFileDirectory.c_str());
|
||||
CFileUtil::PopulateQMenu(caller, menu, fullFilePath);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
CFileUtil::PopulateQMenu(caller, menu, fileName.c_str(), fullFileDirectory.c_str());
|
||||
CFileUtil::PopulateQMenu(caller, menu, fullFilePath);
|
||||
}
|
||||
break;
|
||||
case AssetBrowserEntry::AssetEntryType::Folder:
|
||||
{
|
||||
fullFileDirectory = entry->GetFullPath();
|
||||
// we are sending an empty filename to indicate that it is a folder and not a file
|
||||
CFileUtil::PopulateQMenu(caller, menu, fileName.c_str(), fullFileDirectory.c_str());
|
||||
fullFilePath = entry->GetFullPath();
|
||||
|
||||
CFileUtil::PopulateQMenu(caller, menu, fullFilePath);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
~ListenerForShowAssetEditorEvent()
|
||||
~ListenerForShowAssetEditorEvent() override
|
||||
{
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
|
||||
}
|
||||
@@ -82,6 +82,7 @@ AzAssetBrowserWindow::AzAssetBrowserWindow(QWidget* parent)
|
||||
|
||||
m_ui->m_assetBrowserTableViewWidget->setVisible(false);
|
||||
m_ui->m_toggleDisplayViewBtn->setVisible(false);
|
||||
m_ui->m_searchWidget->SetFilterInputInterval(AZStd::chrono::milliseconds(250));
|
||||
if (ed_useNewAssetBrowserTableView)
|
||||
{
|
||||
m_ui->m_toggleDisplayViewBtn->setVisible(true);
|
||||
|
||||
+12
-13
@@ -24,10 +24,10 @@ class CUndoBaseLibrary
|
||||
: public IUndoObject
|
||||
{
|
||||
public:
|
||||
CUndoBaseLibrary(CBaseLibrary* pLib, const QString& description, const QString& selectedItem = 0)
|
||||
CUndoBaseLibrary(CBaseLibrary* pLib, const QString& description, const QString& selectedItem = QString())
|
||||
: m_pLib(pLib)
|
||||
, m_description(description)
|
||||
, m_redo(0)
|
||||
, m_redo(nullptr)
|
||||
, m_selectedItem(selectedItem)
|
||||
{
|
||||
assert(m_pLib);
|
||||
@@ -36,16 +36,16 @@ public:
|
||||
m_pLib->Serialize(m_undo, false);
|
||||
}
|
||||
|
||||
virtual QString GetEditorObjectName()
|
||||
QString GetEditorObjectName() override
|
||||
{
|
||||
return m_selectedItem;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual int GetSize() { return sizeof(CUndoBaseLibrary); }
|
||||
virtual QString GetDescription() { return m_description; };
|
||||
int GetSize() override { return sizeof(CUndoBaseLibrary); }
|
||||
QString GetDescription() override { return m_description; };
|
||||
|
||||
virtual void Undo(bool bUndo)
|
||||
void Undo(bool bUndo) override
|
||||
{
|
||||
if (bUndo)
|
||||
{
|
||||
@@ -57,7 +57,7 @@ protected:
|
||||
GetIEditor()->Notify(eNotify_OnDataBaseUpdate);
|
||||
}
|
||||
|
||||
virtual void Redo()
|
||||
void Redo() override
|
||||
{
|
||||
m_pLib->Serialize(m_redo, true);
|
||||
m_pLib->SetModified();
|
||||
@@ -107,7 +107,7 @@ void CBaseLibrary::RemoveAllItems()
|
||||
// Unregister item in case it was registered. It is ok if it wasn't. This is still safe to call.
|
||||
m_pManager->UnregisterItem(m_items[i]);
|
||||
// Clear library item.
|
||||
m_items[i]->m_library = NULL;
|
||||
m_items[i]->m_library = nullptr;
|
||||
}
|
||||
m_items.clear();
|
||||
Release();
|
||||
@@ -216,7 +216,7 @@ IDataBaseItem* CBaseLibrary::FindItem(const QString& name)
|
||||
return m_items[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CBaseLibrary::AddLibraryToSourceControl(const QString& fullPathName) const
|
||||
@@ -233,8 +233,8 @@ bool CBaseLibrary::AddLibraryToSourceControl(const QString& fullPathName) const
|
||||
|
||||
bool CBaseLibrary::SaveLibrary(const char* name, bool saveEmptyLibrary)
|
||||
{
|
||||
assert(name != NULL);
|
||||
if (name == NULL)
|
||||
assert(name != nullptr);
|
||||
if (name == nullptr)
|
||||
{
|
||||
CryFatalError("The library you are attempting to save has no name specified.");
|
||||
return false;
|
||||
@@ -258,9 +258,8 @@ bool CBaseLibrary::SaveLibrary(const char* name, bool saveEmptyLibrary)
|
||||
}
|
||||
if (!bRes)
|
||||
{
|
||||
string strMessage;
|
||||
QByteArray filenameUtf8 = fileName.toUtf8();
|
||||
strMessage.Format("The file %s is read-only and the save of the library couldn't be performed. Try to remove the \"read-only\" flag or check-out the file and then try again.", filenameUtf8.data());
|
||||
AZStd::string strMessage = AZStd::string::format("The file %s is read-only and the save of the library couldn't be performed. Try to remove the \"read-only\" flag or check-out the file and then try again.", filenameUtf8.data());
|
||||
CryMessageBox(strMessage.c_str(), "Saving Error", MB_OK | MB_ICONWARNING);
|
||||
}
|
||||
return bRes;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
|
||||
//undo object for multi-changes inside library item. such as set all variables to default values.
|
||||
//undo object for multi-changes inside library item. such as set all variables to default values.
|
||||
//For example: change particle emitter shape will lead to multiple variable changes
|
||||
class CUndoBaseLibraryItem
|
||||
: public IUndoObject
|
||||
@@ -54,24 +54,24 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual int GetSize()
|
||||
{
|
||||
int GetSize() override
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
QString GetDescription() override
|
||||
{
|
||||
return m_description;
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
|
||||
virtual void Undo(bool bUndo)
|
||||
void Undo(bool bUndo) override
|
||||
{
|
||||
//find the libItem
|
||||
IDataBaseItem *libItem = m_libMgr->FindItemByName(m_itemPath);
|
||||
if (libItem == nullptr)
|
||||
{
|
||||
//the undo stack is not reliable any more..
|
||||
assert(false);
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ protected:
|
||||
libItem->Serialize(m_undoCtx);
|
||||
}
|
||||
|
||||
virtual void Redo()
|
||||
void Redo() override
|
||||
{
|
||||
//find the libItem
|
||||
IDataBaseItem *libItem = m_libMgr->FindItemByName(m_itemPath);
|
||||
@@ -124,7 +124,7 @@ private:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CBaseLibraryItem::CBaseLibraryItem()
|
||||
{
|
||||
m_library = 0;
|
||||
m_library = nullptr;
|
||||
GenerateId();
|
||||
m_bModified = false;
|
||||
}
|
||||
@@ -266,7 +266,7 @@ void CBaseLibraryItem::SetLibrary(CBaseLibrary* pLibrary)
|
||||
void CBaseLibraryItem::SetModified(bool bModified)
|
||||
{
|
||||
m_bModified = bModified;
|
||||
if (m_bModified && m_library != NULL)
|
||||
if (m_bModified && m_library != nullptr)
|
||||
{
|
||||
m_library->SetModified(bModified);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class CUndoBaseLibraryManager
|
||||
: public IUndoObject
|
||||
{
|
||||
public:
|
||||
CUndoBaseLibraryManager(CBaseLibraryManager* pMngr, const QString& description, const QString& modifiedManager = 0)
|
||||
CUndoBaseLibraryManager(CBaseLibraryManager* pMngr, const QString& description, const QString& modifiedManager = nullptr)
|
||||
: m_pMngr(pMngr)
|
||||
, m_description(description)
|
||||
, m_editorObject(modifiedManager)
|
||||
@@ -35,16 +35,16 @@ public:
|
||||
SerializeTo(m_undos);
|
||||
}
|
||||
|
||||
virtual QString GetEditorObjectName()
|
||||
QString GetEditorObjectName() override
|
||||
{
|
||||
return m_editorObject;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual int GetSize() { return sizeof(CUndoBaseLibraryManager); }
|
||||
virtual QString GetDescription() { return m_description; };
|
||||
int GetSize() override { return sizeof(CUndoBaseLibraryManager); }
|
||||
QString GetDescription() override { return m_description; };
|
||||
|
||||
virtual void Undo(bool bUndo)
|
||||
void Undo(bool bUndo) override
|
||||
{
|
||||
if (bUndo)
|
||||
{
|
||||
@@ -55,7 +55,7 @@ protected:
|
||||
GetIEditor()->Notify(eNotify_OnDataBaseUpdate);
|
||||
}
|
||||
|
||||
virtual void Redo()
|
||||
void Redo() override
|
||||
{
|
||||
m_pMngr->ClearAll();
|
||||
UnserializeFrom(m_redos);
|
||||
@@ -84,7 +84,7 @@ private:
|
||||
for (int i = 0; i < m_pMngr->GetLibraryCount(); i++)
|
||||
{
|
||||
IDataBaseLibrary* library = m_pMngr->GetLibrary(i);
|
||||
|
||||
|
||||
const char* tag = library->IsLevelLibrary() ? LEVEL_LIBRARY_TAG : LIBRARY_TAG;
|
||||
XmlNodeRef node = GetIEditor()->GetSystem()->CreateXmlNode(tag);
|
||||
QString file = library->GetFilename().isEmpty() ? library->GetFilename() : library->GetName();
|
||||
@@ -203,7 +203,7 @@ int CBaseLibraryManager::FindLibraryIndex(const QString& library)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseItem* CBaseLibraryManager::FindItem(REFGUID guid) const
|
||||
{
|
||||
CBaseLibraryItem* pMtl = stl::find_in_map(m_itemsGuidMap, guid, (CBaseLibraryItem*)0);
|
||||
CBaseLibraryItem* pMtl = stl::find_in_map(m_itemsGuidMap, guid, nullptr);
|
||||
return pMtl;
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ void CBaseLibraryManager::SplitFullItemName(const QString& fullItemName, QString
|
||||
IDataBaseItem* CBaseLibraryManager::FindItemByName(const QString& fullItemName)
|
||||
{
|
||||
AZStd::lock_guard<AZStd::mutex> lock(m_itemsNameMapMutex);
|
||||
return stl::find_in_map(m_itemsNameMap, fullItemName, 0);
|
||||
return stl::find_in_map(m_itemsNameMap, fullItemName, nullptr);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -398,7 +398,7 @@ void CBaseLibraryManager::DeleteLibrary(const QString& library, bool forceDelete
|
||||
UnregisterItem((CBaseLibraryItem*)pLibrary->GetItem(j));
|
||||
}
|
||||
pLibrary->RemoveAllItems();
|
||||
|
||||
|
||||
if (pLibrary->IsLevelLibrary())
|
||||
{
|
||||
m_pLevelLibrary = nullptr;
|
||||
@@ -420,7 +420,7 @@ IDataBaseLibrary* CBaseLibraryManager::GetLibrary(int index) const
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IDataBaseLibrary* CBaseLibraryManager::GetLevelLibrary() const
|
||||
{
|
||||
IDataBaseLibrary* pLevelLib = NULL;
|
||||
IDataBaseLibrary* pLevelLib = nullptr;
|
||||
|
||||
for (int i = 0; i < GetLibraryCount(); i++)
|
||||
{
|
||||
@@ -526,14 +526,14 @@ void CBaseLibraryManager::Serialize(XmlNodeRef& node, bool bLoading)
|
||||
QString CBaseLibraryManager::MakeUniqueItemName(const QString& srcName, const QString& libName)
|
||||
{
|
||||
// unlikely we'll ever encounter more than 16
|
||||
std::vector<string> possibleDuplicates;
|
||||
std::vector<AZStd::string> possibleDuplicates;
|
||||
possibleDuplicates.reserve(16);
|
||||
|
||||
// search for strings in the database that might have a similar name (ignore case)
|
||||
IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
|
||||
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != NULL; pItem = pEnum->GetNext())
|
||||
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
|
||||
{
|
||||
//Check if the item is in the target library first.
|
||||
//Check if the item is in the target library first.
|
||||
IDataBaseLibrary* itemLibrary = pItem->GetLibrary();
|
||||
QString itemLibraryName;
|
||||
if (itemLibrary)
|
||||
@@ -550,7 +550,7 @@ QString CBaseLibraryManager::MakeUniqueItemName(const QString& srcName, const QS
|
||||
const QString& name = pItem->GetName();
|
||||
if (name.startsWith(srcName, Qt::CaseInsensitive))
|
||||
{
|
||||
possibleDuplicates.push_back(string(name.toUtf8().data()));
|
||||
possibleDuplicates.push_back(AZStd::string(name.toUtf8().data()));
|
||||
}
|
||||
}
|
||||
pEnum->Release();
|
||||
@@ -560,7 +560,7 @@ QString CBaseLibraryManager::MakeUniqueItemName(const QString& srcName, const QS
|
||||
return srcName;
|
||||
}
|
||||
|
||||
std::sort(possibleDuplicates.begin(), possibleDuplicates.end(), [](const string& strOne, const string& strTwo)
|
||||
std::sort(possibleDuplicates.begin(), possibleDuplicates.end(), [](const AZStd::string& strOne, const AZStd::string& strTwo)
|
||||
{
|
||||
// I can assume size sorting since if the length is different, either one of the two strings doesn't
|
||||
// closely match the string we are trying to duplicate, or it's a bigger number (X1 vs X10)
|
||||
@@ -590,7 +590,7 @@ QString CBaseLibraryManager::MakeUniqueItemName(const QString& srcName, const QS
|
||||
void CBaseLibraryManager::Validate()
|
||||
{
|
||||
IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
|
||||
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != NULL; pItem = pEnum->GetNext())
|
||||
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
|
||||
{
|
||||
pItem->Validate();
|
||||
}
|
||||
@@ -617,7 +617,7 @@ void CBaseLibraryManager::RegisterItem(CBaseLibraryItem* pItem, REFGUID newGuid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, newGuid, (CBaseLibraryItem*)0);
|
||||
CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, newGuid, nullptr);
|
||||
if (!pOldItem)
|
||||
{
|
||||
pItem->m_guid = newGuid;
|
||||
@@ -677,7 +677,7 @@ void CBaseLibraryManager::RegisterItem(CBaseLibraryItem* pItem)
|
||||
{
|
||||
return;
|
||||
}
|
||||
CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, pItem->GetGUID(), (CBaseLibraryItem*)0);
|
||||
CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, pItem->GetGUID(), nullptr);
|
||||
if (!pOldItem)
|
||||
{
|
||||
m_itemsGuidMap[pItem->GetGUID()] = pItem;
|
||||
@@ -789,7 +789,7 @@ QString CBaseLibraryManager::MakeFullItemName(IDataBaseLibrary* pLibrary, const
|
||||
void CBaseLibraryManager::GatherUsedResources(CUsedResources& resources)
|
||||
{
|
||||
IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
|
||||
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != NULL; pItem = pEnum->GetNext())
|
||||
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
|
||||
{
|
||||
pItem->GatherUsedResources(resources);
|
||||
}
|
||||
@@ -815,15 +815,15 @@ void CBaseLibraryManager::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
switch (event)
|
||||
{
|
||||
case eNotify_OnBeginNewScene:
|
||||
SetSelectedItem(0);
|
||||
SetSelectedItem(nullptr);
|
||||
ClearAll();
|
||||
break;
|
||||
case eNotify_OnBeginSceneOpen:
|
||||
SetSelectedItem(0);
|
||||
SetSelectedItem(nullptr);
|
||||
ClearAll();
|
||||
break;
|
||||
case eNotify_OnCloseScene:
|
||||
SetSelectedItem(0);
|
||||
SetSelectedItem(nullptr);
|
||||
ClearAll();
|
||||
break;
|
||||
}
|
||||
@@ -913,7 +913,7 @@ void CBaseLibraryManager::ChangeLibraryOrder(IDataBaseLibrary* lib, unsigned int
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < m_libs.size(); i++)
|
||||
{
|
||||
if (lib == m_libs[i])
|
||||
|
||||
@@ -238,9 +238,13 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
3rdParty::Qt::Core
|
||||
3rdParty::Qt::Gui
|
||||
3rdParty::Qt::Widgets
|
||||
3rdParty::Qt::Test
|
||||
Legacy::CryCommon
|
||||
AZ::AzToolsFramework
|
||||
AZ::AzToolsFramework.Tests
|
||||
AZ::AzToolsFrameworkTestCommon
|
||||
Legacy::EditorLib
|
||||
Gem::AtomToolsFramework.Static
|
||||
RUNTIME_DEPENDENCIES
|
||||
Gem::LmbrCentral
|
||||
)
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
CANCEL = QDialog::Rejected
|
||||
};
|
||||
|
||||
CCheckOutDialog(const QString& file, QWidget* pParent = NULL); // standard constructor
|
||||
CCheckOutDialog(const QString& file, QWidget* pParent = nullptr); // standard constructor
|
||||
virtual ~CCheckOutDialog();
|
||||
|
||||
// Dialog Data
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
// AzToolsFramework
|
||||
#include <AzToolsFramework/PythonTerminal/ScriptTermDialog.h>
|
||||
|
||||
CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pFirst = 0;
|
||||
CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pLast = 0;
|
||||
CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pFirst = nullptr;
|
||||
CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pLast = nullptr;
|
||||
|
||||
CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::GetFirst()
|
||||
{
|
||||
@@ -31,7 +31,7 @@ CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::GetFirst()
|
||||
CAutoRegisterCommandHelper::CAutoRegisterCommandHelper(void(*registerFunc)(CEditorCommandManager &))
|
||||
{
|
||||
m_registerFunc = registerFunc;
|
||||
m_pNext = 0;
|
||||
m_pNext = nullptr;
|
||||
|
||||
if (!s_pLast)
|
||||
{
|
||||
@@ -79,9 +79,9 @@ CEditorCommandManager::~CEditorCommandManager()
|
||||
m_uiCommands.clear();
|
||||
}
|
||||
|
||||
string CEditorCommandManager::GetFullCommandName(const string& module, const string& name)
|
||||
AZStd::string CEditorCommandManager::GetFullCommandName(const AZStd::string& module, const AZStd::string& name)
|
||||
{
|
||||
string fullName = module;
|
||||
AZStd::string fullName = module;
|
||||
fullName += ".";
|
||||
fullName += name;
|
||||
return fullName;
|
||||
@@ -91,10 +91,10 @@ bool CEditorCommandManager::AddCommand(CCommand* pCommand, TPfnDeleter deleter)
|
||||
{
|
||||
assert(pCommand);
|
||||
|
||||
string module = pCommand->GetModule();
|
||||
string name = pCommand->GetName();
|
||||
AZStd::string module = pCommand->GetModule();
|
||||
AZStd::string name = pCommand->GetName();
|
||||
|
||||
if (IsRegistered(module, name) && m_bWarnDuplicate)
|
||||
if (IsRegistered(module.c_str(), name.c_str()) && m_bWarnDuplicate)
|
||||
{
|
||||
QString errMsg;
|
||||
|
||||
@@ -118,7 +118,7 @@ bool CEditorCommandManager::AddCommand(CCommand* pCommand, TPfnDeleter deleter)
|
||||
|
||||
bool CEditorCommandManager::UnregisterCommand(const char* module, const char* name)
|
||||
{
|
||||
string fullName = GetFullCommandName(module, name);
|
||||
AZStd::string fullName = GetFullCommandName(module, name);
|
||||
CommandTable::iterator itr = m_commands.find(fullName);
|
||||
|
||||
if (itr != m_commands.end())
|
||||
@@ -154,7 +154,7 @@ bool CEditorCommandManager::RegisterUICommand(
|
||||
return false;
|
||||
}
|
||||
|
||||
return AttachUIInfo(GetFullCommandName(module, name), uiInfo);
|
||||
return AttachUIInfo(GetFullCommandName(module, name).c_str(), uiInfo);
|
||||
}
|
||||
|
||||
bool CEditorCommandManager::AttachUIInfo(const char* fullCmdName, const CCommand0::SUIInfo& uiInfo)
|
||||
@@ -190,14 +190,14 @@ bool CEditorCommandManager::AttachUIInfo(const char* fullCmdName, const CCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEditorCommandManager::GetUIInfo(const string& module, const string& name, CCommand0::SUIInfo& uiInfo) const
|
||||
bool CEditorCommandManager::GetUIInfo(const AZStd::string& module, const AZStd::string& name, CCommand0::SUIInfo& uiInfo) const
|
||||
{
|
||||
string fullName = GetFullCommandName(module, name);
|
||||
AZStd::string fullName = GetFullCommandName(module, name);
|
||||
|
||||
return GetUIInfo(fullName, uiInfo);
|
||||
}
|
||||
|
||||
bool CEditorCommandManager::GetUIInfo(const string& fullCmdName, CCommand0::SUIInfo& uiInfo) const
|
||||
bool CEditorCommandManager::GetUIInfo(const AZStd::string& fullCmdName, CCommand0::SUIInfo& uiInfo) const
|
||||
{
|
||||
CommandTable::const_iterator iter = m_commands.find(fullCmdName);
|
||||
|
||||
@@ -223,9 +223,9 @@ int CEditorCommandManager::GenNewCommandId()
|
||||
return uniqueId++;
|
||||
}
|
||||
|
||||
QString CEditorCommandManager::Execute(const string& module, const string& name, const CCommand::CArgs& args)
|
||||
QString CEditorCommandManager::Execute(const AZStd::string& module, const AZStd::string& name, const CCommand::CArgs& args)
|
||||
{
|
||||
string fullName = GetFullCommandName(module, name);
|
||||
AZStd::string fullName = GetFullCommandName(module, name);
|
||||
CommandTable::iterator iter = m_commands.find(fullName);
|
||||
|
||||
if (iter != m_commands.end())
|
||||
@@ -245,18 +245,18 @@ QString CEditorCommandManager::Execute(const string& module, const string& name,
|
||||
return "";
|
||||
}
|
||||
|
||||
QString CEditorCommandManager::Execute(const string& cmdLine)
|
||||
QString CEditorCommandManager::Execute(const AZStd::string& cmdLine)
|
||||
{
|
||||
string cmdTxt, argsTxt;
|
||||
AZStd::string cmdTxt, argsTxt;
|
||||
size_t argStart = cmdLine.find_first_of(' ');
|
||||
|
||||
cmdTxt = cmdLine.substr(0, argStart);
|
||||
argsTxt = "";
|
||||
|
||||
if (argStart != string::npos)
|
||||
if (argStart != AZStd::string::npos)
|
||||
{
|
||||
argsTxt = cmdLine.substr(argStart + 1);
|
||||
argsTxt.Trim();
|
||||
AZ::StringFunc::TrimWhiteSpace(argsTxt, true, true);
|
||||
}
|
||||
|
||||
CommandTable::iterator itr = m_commands.find(cmdTxt);
|
||||
@@ -301,7 +301,7 @@ void CEditorCommandManager::Execute(int commandId)
|
||||
}
|
||||
}
|
||||
|
||||
void CEditorCommandManager::GetCommandList(std::vector<string>& cmds) const
|
||||
void CEditorCommandManager::GetCommandList(std::vector<AZStd::string>& cmds) const
|
||||
{
|
||||
cmds.clear();
|
||||
cmds.reserve(m_commands.size());
|
||||
@@ -315,9 +315,9 @@ void CEditorCommandManager::GetCommandList(std::vector<string>& cmds) const
|
||||
std::sort(cmds.begin(), cmds.end());
|
||||
}
|
||||
|
||||
string CEditorCommandManager::AutoComplete(const string& substr) const
|
||||
AZStd::string CEditorCommandManager::AutoComplete(const AZStd::string& substr) const
|
||||
{
|
||||
std::vector<string> cmds;
|
||||
std::vector<AZStd::string> cmds;
|
||||
GetCommandList(cmds);
|
||||
|
||||
// If substring is empty return first command.
|
||||
@@ -358,7 +358,7 @@ string CEditorCommandManager::AutoComplete(const string& substr) const
|
||||
|
||||
bool CEditorCommandManager::IsRegistered(const char* module, const char* name) const
|
||||
{
|
||||
string fullName = GetFullCommandName(module, name);
|
||||
AZStd::string fullName = GetFullCommandName(module, name);
|
||||
CommandTable::const_iterator iter = m_commands.find(fullName);
|
||||
|
||||
if (iter != m_commands.end())
|
||||
@@ -373,7 +373,7 @@ bool CEditorCommandManager::IsRegistered(const char* module, const char* name) c
|
||||
|
||||
bool CEditorCommandManager::IsRegistered(const char* cmdLine_) const
|
||||
{
|
||||
string cmdTxt, argsTxt, cmdLine(cmdLine_);
|
||||
AZStd::string cmdTxt, argsTxt, cmdLine(cmdLine_);
|
||||
size_t argStart = cmdLine.find_first_of(' ');
|
||||
cmdTxt = cmdLine.substr(0, argStart);
|
||||
CommandTable::const_iterator iter = m_commands.find(cmdTxt);
|
||||
@@ -402,9 +402,9 @@ bool CEditorCommandManager::IsRegistered(int commandId) const
|
||||
return false;
|
||||
}
|
||||
|
||||
void CEditorCommandManager::SetCommandAvailableInScripting(const string& module, const string& name)
|
||||
void CEditorCommandManager::SetCommandAvailableInScripting(const AZStd::string& module, const AZStd::string& name)
|
||||
{
|
||||
string fullName = GetFullCommandName(module, name);
|
||||
AZStd::string fullName = GetFullCommandName(module, name);
|
||||
CommandTable::iterator iter = m_commands.find(fullName);
|
||||
|
||||
if (iter != m_commands.end())
|
||||
@@ -413,7 +413,7 @@ void CEditorCommandManager::SetCommandAvailableInScripting(const string& module,
|
||||
}
|
||||
}
|
||||
|
||||
bool CEditorCommandManager::IsCommandAvailableInScripting(const string& fullCmdName) const
|
||||
bool CEditorCommandManager::IsCommandAvailableInScripting(const AZStd::string& fullCmdName) const
|
||||
{
|
||||
CommandTable::const_iterator iter = m_commands.find(fullCmdName);
|
||||
|
||||
@@ -425,16 +425,16 @@ bool CEditorCommandManager::IsCommandAvailableInScripting(const string& fullCmdN
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CEditorCommandManager::IsCommandAvailableInScripting(const string& module, const string& name) const
|
||||
bool CEditorCommandManager::IsCommandAvailableInScripting(const AZStd::string& module, const AZStd::string& name) const
|
||||
{
|
||||
string fullName = GetFullCommandName(module, name);
|
||||
AZStd::string fullName = GetFullCommandName(module, name);
|
||||
|
||||
return IsCommandAvailableInScripting(fullName);
|
||||
}
|
||||
|
||||
void CEditorCommandManager::LogCommand(const string& fullCmdName, const CCommand::CArgs& args) const
|
||||
void CEditorCommandManager::LogCommand(const AZStd::string& fullCmdName, const CCommand::CArgs& args) const
|
||||
{
|
||||
string cmdLine = fullCmdName;
|
||||
AZStd::string cmdLine = fullCmdName;
|
||||
|
||||
for (int i = 0; i < args.GetArgCount(); ++i)
|
||||
{
|
||||
@@ -509,7 +509,7 @@ void CEditorCommandManager::LogCommand(const string& fullCmdName, const CCommand
|
||||
|
||||
if (pScriptTermDialog)
|
||||
{
|
||||
string text = "> ";
|
||||
AZStd::string text = "> ";
|
||||
text += cmdLine;
|
||||
text += "\r\n";
|
||||
pScriptTermDialog->AppendText(text.c_str());
|
||||
@@ -526,14 +526,14 @@ QString CEditorCommandManager::ExecuteAndLogReturn(CCommand* pCommand, const CCo
|
||||
return result;
|
||||
}
|
||||
|
||||
void CEditorCommandManager::GetArgsFromString(const string& argsTxt, CCommand::CArgs& argList)
|
||||
void CEditorCommandManager::GetArgsFromString(const AZStd::string& argsTxt, CCommand::CArgs& argList)
|
||||
{
|
||||
const char quoteSymbol = '\'';
|
||||
int curPos = 0;
|
||||
int prevPos = 0;
|
||||
string arg = argsTxt.Tokenize(" ", curPos);
|
||||
|
||||
while (!arg.empty())
|
||||
AZStd::vector<AZStd::string> tokens;
|
||||
AZ::StringFunc::Tokenize(argsTxt, tokens, ' ');
|
||||
for(AZStd::string& arg : tokens)
|
||||
{
|
||||
if (arg[0] == quoteSymbol) // A special consideration for a quoted string
|
||||
{
|
||||
@@ -542,11 +542,11 @@ void CEditorCommandManager::GetArgsFromString(const string& argsTxt, CCommand::C
|
||||
size_t openingQuotePos = argsTxt.find(quoteSymbol, prevPos);
|
||||
size_t closingQuotePos = argsTxt.find(quoteSymbol, curPos);
|
||||
|
||||
if (closingQuotePos != string::npos)
|
||||
if (closingQuotePos != AZStd::string::npos)
|
||||
{
|
||||
arg = argsTxt.substr(openingQuotePos + 1, closingQuotePos - openingQuotePos - 1);
|
||||
size_t nextArgPos = argsTxt.find(' ', closingQuotePos + 1);
|
||||
curPos = nextArgPos != string::npos ? nextArgPos + 1 : argsTxt.length();
|
||||
curPos = nextArgPos != AZStd::string::npos ? nextArgPos + 1 : argsTxt.length();
|
||||
|
||||
for (; curPos < argsTxt.length(); ++curPos) // Skip spaces.
|
||||
{
|
||||
@@ -565,6 +565,5 @@ void CEditorCommandManager::GetArgsFromString(const string& argsTxt, CCommand::C
|
||||
|
||||
argList.Add(arg.c_str());
|
||||
prevPos = curPos;
|
||||
arg = argsTxt.Tokenize(" ", curPos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
|
||||
void RegisterAutoCommands();
|
||||
|
||||
bool AddCommand(CCommand* pCommand, TPfnDeleter deleter = NULL);
|
||||
bool AddCommand(CCommand* pCommand, TPfnDeleter deleter = nullptr);
|
||||
bool UnregisterCommand(const char* module, const char* name);
|
||||
bool RegisterUICommand(
|
||||
const char* module,
|
||||
@@ -48,20 +48,20 @@ public:
|
||||
const AZStd::function<void()>& functor,
|
||||
const CCommand0::SUIInfo& uiInfo);
|
||||
bool AttachUIInfo(const char* fullCmdName, const CCommand0::SUIInfo& uiInfo);
|
||||
bool GetUIInfo(const string& module, const string& name, CCommand0::SUIInfo& uiInfo) const;
|
||||
bool GetUIInfo(const string& fullCmdName, CCommand0::SUIInfo& uiInfo) const;
|
||||
QString Execute(const string& cmdLine);
|
||||
QString Execute(const string& module, const string& name, const CCommand::CArgs& args);
|
||||
bool GetUIInfo(const AZStd::string& module, const AZStd::string& name, CCommand0::SUIInfo& uiInfo) const;
|
||||
bool GetUIInfo(const AZStd::string& fullCmdName, CCommand0::SUIInfo& uiInfo) const;
|
||||
QString Execute(const AZStd::string& cmdLine);
|
||||
QString Execute(const AZStd::string& module, const AZStd::string& name, const CCommand::CArgs& args);
|
||||
void Execute(int commandId);
|
||||
void GetCommandList(std::vector<string>& cmds) const;
|
||||
void GetCommandList(std::vector<AZStd::string>& cmds) const;
|
||||
//! Used in the console dialog
|
||||
string AutoComplete(const string& substr) const;
|
||||
AZStd::string AutoComplete(const AZStd::string& substr) const;
|
||||
bool IsRegistered(const char* module, const char* name) const;
|
||||
bool IsRegistered(const char* cmdLine) const;
|
||||
bool IsRegistered(int commandId) const;
|
||||
void SetCommandAvailableInScripting(const string& module, const string& name);
|
||||
bool IsCommandAvailableInScripting(const string& module, const string& name) const;
|
||||
bool IsCommandAvailableInScripting(const string& fullCmdName) const;
|
||||
void SetCommandAvailableInScripting(const AZStd::string& module, const AZStd::string& name);
|
||||
bool IsCommandAvailableInScripting(const AZStd::string& module, const AZStd::string& name) const;
|
||||
bool IsCommandAvailableInScripting(const AZStd::string& fullCmdName) const;
|
||||
//! Turning off the warning is needed for reloading the ribbon bar.
|
||||
void TurnDuplicateWarningOn() { m_bWarnDuplicate = true; }
|
||||
void TurnDuplicateWarningOff() { m_bWarnDuplicate = false; }
|
||||
@@ -74,7 +74,7 @@ protected:
|
||||
};
|
||||
|
||||
//! A full command name to an actual command mapping
|
||||
typedef std::map<string, SCommandTableEntry> CommandTable;
|
||||
typedef std::map<AZStd::string, SCommandTableEntry> CommandTable;
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
CommandTable m_commands;
|
||||
|
||||
@@ -86,9 +86,9 @@ protected:
|
||||
bool m_bWarnDuplicate;
|
||||
|
||||
static int GenNewCommandId();
|
||||
static string GetFullCommandName(const string& module, const string& name);
|
||||
static void GetArgsFromString(const string& argsTxt, CCommand::CArgs& argList);
|
||||
void LogCommand(const string& fullCmdName, const CCommand::CArgs& args) const;
|
||||
static AZStd::string GetFullCommandName(const AZStd::string& module, const AZStd::string& name);
|
||||
static void GetArgsFromString(const AZStd::string& argsTxt, CCommand::CArgs& argList);
|
||||
void LogCommand(const AZStd::string& fullCmdName, const CCommand::CArgs& args) const;
|
||||
QString ExecuteAndLogReturn(CCommand* pCommand, const CCommand::CArgs& args);
|
||||
};
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Config
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const IConfigVar* CConfigGroup::GetVar(const char* szName) const
|
||||
@@ -63,7 +63,7 @@ namespace Config
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IConfigVar* CConfigGroup::GetVar(uint index)
|
||||
@@ -73,7 +73,7 @@ namespace Config
|
||||
return m_vars[index];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const IConfigVar* CConfigGroup::GetVar(uint index) const
|
||||
@@ -83,7 +83,7 @@ namespace Config
|
||||
return m_vars[index];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CConfigGroup::SaveToXML(XmlNodeRef node)
|
||||
@@ -127,9 +127,9 @@ namespace Config
|
||||
|
||||
case IConfigVar::eType_STRING:
|
||||
{
|
||||
string currentValue = 0;
|
||||
AZStd::string currentValue;
|
||||
var->Get(¤tValue);
|
||||
node->setAttr(szName, currentValue);
|
||||
node->setAttr(szName, currentValue.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ namespace Config
|
||||
|
||||
case IConfigVar::eType_STRING:
|
||||
{
|
||||
string currentValue = 0;
|
||||
AZStd::string currentValue;
|
||||
var->GetDefault(¤tValue);
|
||||
QString readValue(currentValue.c_str());
|
||||
if (node->getAttr(szName, readValue))
|
||||
|
||||
@@ -37,22 +37,22 @@ namespace Config
|
||||
, m_description(szDescription)
|
||||
, m_type(varType)
|
||||
, m_flags(flags)
|
||||
, m_ptr(NULL)
|
||||
, m_ptr(nullptr)
|
||||
{};
|
||||
|
||||
virtual ~IConfigVar() = default;
|
||||
|
||||
|
||||
ILINE EType GetType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
ILINE const string& GetName() const
|
||||
ILINE const AZStd::string& GetName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
ILINE const string& GetDescription() const
|
||||
ILINE const AZStd::string& GetDescription() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
@@ -71,13 +71,13 @@ namespace Config
|
||||
static EType TranslateType(const bool&) { return eType_BOOL; }
|
||||
static EType TranslateType(const int&) { return eType_INT; }
|
||||
static EType TranslateType(const float&) { return eType_FLOAT; }
|
||||
static EType TranslateType(const string&) { return eType_STRING; }
|
||||
static EType TranslateType(const AZStd::string&) { return eType_STRING; }
|
||||
|
||||
protected:
|
||||
EType m_type;
|
||||
uint8 m_flags;
|
||||
string m_name;
|
||||
string m_description;
|
||||
AZStd::string m_name;
|
||||
AZStd::string m_description;
|
||||
void* m_ptr;
|
||||
ICVar* m_pCVar;
|
||||
};
|
||||
|
||||
@@ -1,135 +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 "ControlMRU.h"
|
||||
|
||||
IMPLEMENT_XTP_CONTROL(CControlMRU, CXTPControlRecentFileList)
|
||||
|
||||
bool CControlMRU::DoesFileExist(CString& sFileName)
|
||||
{
|
||||
return (_access(sFileName.GetBuffer(), 0) == 0);
|
||||
}
|
||||
|
||||
void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
|
||||
{
|
||||
CRecentFileList* pRecentFileList = GetRecentFileList();
|
||||
|
||||
if (!pRecentFileList)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CString* pArrNames = pRecentFileList->m_arrNames;
|
||||
|
||||
assert(pArrNames != NULL);
|
||||
if (!pArrNames)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
while (m_nIndex + 1 < m_pControls->GetCount())
|
||||
{
|
||||
CXTPControl* pControl = m_pControls->GetAt(m_nIndex + 1);
|
||||
assert(pControl);
|
||||
if (pControl->GetID() >= GetFirstMruID()
|
||||
&& pControl->GetID() <= GetFirstMruID() + pRecentFileList->m_nSize)
|
||||
{
|
||||
m_pControls->Remove(pControl);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_pParent->IsCustomizeMode())
|
||||
{
|
||||
m_dwHideFlags = 0;
|
||||
SetEnabled(TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pArrNames[0].IsEmpty())
|
||||
{
|
||||
SetCaption(CString(MAKEINTRESOURCE(IDS_NORECENTFILE_CAPTION)));
|
||||
SetDescription("No recently opened files");
|
||||
m_dwHideFlags = 0;
|
||||
SetEnabled(FALSE);
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCaption(CString(MAKEINTRESOURCE(IDS_RECENTFILE_CAPTION)));
|
||||
SetDescription("Open this document");
|
||||
}
|
||||
|
||||
m_dwHideFlags |= xtpHideGeneric;
|
||||
|
||||
CString sCurDir = (Path::GetEditingGameDataFolder() + "\\").c_str();
|
||||
int nCurDir = sCurDir.GetLength();
|
||||
|
||||
CString strName;
|
||||
CString strTemp;
|
||||
int iLastValidMRU = 0;
|
||||
|
||||
for (int iMRU = 0; iMRU < pRecentFileList->m_nSize; iMRU++)
|
||||
{
|
||||
if (!pRecentFileList->GetDisplayName(strName, iMRU, sCurDir.GetBuffer(), nCurDir))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (DoesFileExist(pArrNames[iMRU]))
|
||||
{
|
||||
CString sCurEntryDir = pArrNames[iMRU].Left(nCurDir);
|
||||
|
||||
if (sCurEntryDir.CompareNoCase(sCurDir) != 0)
|
||||
{
|
||||
//unavailable entry (wrong directory)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//invalid entry (not existing)
|
||||
continue;
|
||||
}
|
||||
|
||||
int nId = iMRU + GetFirstMruID();
|
||||
|
||||
CXTPControl* pControl = m_pControls->Add(xtpControlButton, nId, _T(""), m_nIndex + iLastValidMRU + 1, TRUE);
|
||||
assert(pControl);
|
||||
|
||||
pControl->SetCaption(CXTPControlWindowList::ConstructCaption(strName, iLastValidMRU + 1));
|
||||
pControl->SetFlags(xtpFlagManualUpdate);
|
||||
pControl->SetBeginGroup(iLastValidMRU == 0 && m_nIndex != 0);
|
||||
pControl->SetParameter(pArrNames[iMRU]);
|
||||
|
||||
CString sDescription = "Open file: " + pArrNames[iMRU];
|
||||
pControl->SetDescription(sDescription);
|
||||
|
||||
if ((GetFlags() & xtpFlagWrapRow) && iMRU == 0)
|
||||
{
|
||||
pControl->SetFlags(pControl->GetFlags() | xtpFlagWrapRow);
|
||||
}
|
||||
|
||||
++iLastValidMRU;
|
||||
}
|
||||
|
||||
//if no entry was valid, treat as none would exist
|
||||
if (iLastValidMRU == 0)
|
||||
{
|
||||
SetCaption(CString(MAKEINTRESOURCE(IDS_NORECENTFILE_CAPTION)));
|
||||
SetDescription("No recently opened files");
|
||||
m_dwHideFlags = 0;
|
||||
SetEnabled(FALSE);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
#ifndef CRYINCLUDE_EDITOR_CONTROLMRU_H
|
||||
#define CRYINCLUDE_EDITOR_CONTROLMRU_H
|
||||
|
||||
class CControlMRU
|
||||
: public CXTPControlRecentFileList
|
||||
{
|
||||
protected:
|
||||
virtual void OnCalcDynamicSize(DWORD dwMode);
|
||||
|
||||
private:
|
||||
DECLARE_XTP_CONTROL(CControlMRU)
|
||||
bool DoesFileExist(CString& sFileName);
|
||||
};
|
||||
#endif // CRYINCLUDE_EDITOR_CONTROLMRU_H
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
CBitmapToolTip(QWidget* parent = nullptr);
|
||||
virtual ~CBitmapToolTip();
|
||||
|
||||
BOOL Create(const RECT& rect);
|
||||
bool Create(const RECT& rect);
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
@@ -29,7 +29,7 @@ CColorGradientCtrl::CColorGradientCtrl(QWidget* parent)
|
||||
m_nHitKeyIndex = -1;
|
||||
m_nKeyDrawRadius = 3;
|
||||
m_bTracking = false;
|
||||
m_pSpline = 0;
|
||||
m_pSpline = nullptr;
|
||||
m_fMinTime = -1;
|
||||
m_fMaxTime = 1;
|
||||
m_fMinValue = -1;
|
||||
@@ -474,7 +474,7 @@ void CColorGradientCtrl::SetActiveKey(int nIndex)
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CColorGradientCtrl::SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw)
|
||||
void CColorGradientCtrl::SetSpline(ISplineInterpolator* pSpline, bool bRedraw)
|
||||
{
|
||||
if (pSpline != m_pSpline)
|
||||
{
|
||||
@@ -501,7 +501,7 @@ ISplineInterpolator* CColorGradientCtrl::GetSpline()
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CColorGradientCtrl::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
BOOL bProcessed = false;
|
||||
bool bProcessed = false;
|
||||
|
||||
if (m_nActiveKey != -1 && m_pSpline)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
// Lock value of first and last key to be the same.
|
||||
void LockFirstAndLastKeys(bool bLock) { m_bLockFirstLastKey = bLock; }
|
||||
|
||||
void SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw = FALSE);
|
||||
void SetSpline(ISplineInterpolator* pSpline, bool bRedraw = false);
|
||||
ISplineInterpolator* GetSpline();
|
||||
|
||||
void SetTimeMarker(float fTime);
|
||||
|
||||
@@ -62,14 +62,14 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void highlightBlock(const QString &text)
|
||||
void highlightBlock(const QString &text) override
|
||||
{
|
||||
auto pos = -1;
|
||||
QTextCharFormat myClassFormat;
|
||||
myClassFormat.setFontWeight(QFont::Bold);
|
||||
myClassFormat.setBackground(Qt::yellow);
|
||||
|
||||
while (1)
|
||||
while (true)
|
||||
{
|
||||
pos = text.indexOf(m_searchTerm, pos+1, Qt::CaseInsensitive);
|
||||
|
||||
@@ -180,7 +180,7 @@ bool ConsoleLineEdit::event(QEvent* ev)
|
||||
|
||||
if (newStr.isEmpty())
|
||||
{
|
||||
newStr = GetIEditor()->GetCommandManager()->AutoComplete(cstring.toUtf8().data());
|
||||
newStr = GetIEditor()->GetCommandManager()->AutoComplete(cstring.toUtf8().data()).c_str();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ void ConsoleLineEdit::keyPressEvent(QKeyEvent* ev)
|
||||
{
|
||||
if (commandManager->IsRegistered(str.toUtf8().data()))
|
||||
{
|
||||
commandManager->Execute(QtUtil::ToString(str));
|
||||
commandManager->Execute(str.toUtf8().data());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -338,6 +338,8 @@ CConsoleSCB::CConsoleSCB(QWidget* parent)
|
||||
connect(findPreviousAction, &QAction::triggered, this, &CConsoleSCB::findPrevious);
|
||||
ui->findPrevButton->addAction(findPreviousAction);
|
||||
|
||||
GetIEditor()->RegisterNotifyListener(this);
|
||||
|
||||
connect(ui->button, &QPushButton::clicked, this, &CConsoleSCB::showVariableEditor);
|
||||
connect(ui->findButton, &QPushButton::clicked, this, &CConsoleSCB::toggleConsoleSearch);
|
||||
connect(ui->textEdit, &ConsoleTextEdit::searchBarRequested, this, [this]
|
||||
@@ -376,6 +378,8 @@ CConsoleSCB::~CConsoleSCB()
|
||||
{
|
||||
AzToolsFramework::EditorPreferencesNotificationBus::Handler::BusDisconnect();
|
||||
|
||||
GetIEditor()->UnregisterNotifyListener(this);
|
||||
|
||||
s_consoleSCB = nullptr;
|
||||
CLogFile::AttachEditBox(nullptr);
|
||||
}
|
||||
@@ -562,15 +566,15 @@ static void OnVariableUpdated([[maybe_unused]] int row, ICVar* pCVar)
|
||||
static CVarBlock* VarBlockFromConsoleVars()
|
||||
{
|
||||
IConsole* console = GetIEditor()->GetSystem()->GetIConsole();
|
||||
std::vector<const char*> cmds;
|
||||
AZStd::vector<AZStd::string_view> cmds;
|
||||
cmds.resize(console->GetNumVars());
|
||||
size_t cmdCount = console->GetSortedVars(&cmds[0], cmds.size());
|
||||
size_t cmdCount = console->GetSortedVars(cmds);
|
||||
|
||||
CVarBlock* vb = new CVarBlock;
|
||||
IVariable* pVariable = 0;
|
||||
IVariable* pVariable = nullptr;
|
||||
for (int i = 0; i < cmdCount; i++)
|
||||
{
|
||||
ICVar* pCVar = console->GetCVar(cmds[i]);
|
||||
ICVar* pCVar = console->GetCVar(cmds[i].data());
|
||||
if (!pCVar)
|
||||
{
|
||||
continue;
|
||||
@@ -602,7 +606,7 @@ static CVarBlock* VarBlockFromConsoleVars()
|
||||
pCVar->AddOnChangeFunctor(onChange);
|
||||
|
||||
pVariable->SetDescription(pCVar->GetHelp());
|
||||
pVariable->SetName(cmds[i]);
|
||||
pVariable->SetName(cmds[i].data());
|
||||
|
||||
// Transfer the custom limits have they have been set for this variable
|
||||
if (pCVar->HasCustomLimits())
|
||||
@@ -1352,4 +1356,19 @@ CConsoleSCB* CConsoleSCB::GetCreatedInstance()
|
||||
return s_consoleSCB;
|
||||
}
|
||||
|
||||
void CConsoleSCB::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case eNotify_OnBeginGameMode:
|
||||
if (gSettings.clearConsoleOnGameModeStart)
|
||||
{
|
||||
ui->textEdit->clear();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Controls/moc_ConsoleSCB.cpp>
|
||||
|
||||
@@ -159,6 +159,7 @@ private:
|
||||
class CConsoleSCB
|
||||
: public QWidget
|
||||
, private AzToolsFramework::EditorPreferencesNotificationBus::Handler
|
||||
, public IEditorNotifyListener
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -187,6 +188,8 @@ private Q_SLOTS:
|
||||
void findNext();
|
||||
|
||||
private:
|
||||
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
|
||||
|
||||
QScopedPointer<Ui::Console> ui;
|
||||
int m_richEditTextLength;
|
||||
|
||||
|
||||
@@ -1,543 +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 "ConsoleSCBMFC.h"
|
||||
#include "PropertiesDialog.h"
|
||||
#include "QtViewPaneManager.h"
|
||||
#include "Core/QtEditorApplication.h"
|
||||
|
||||
#include <Controls/ui_ConsoleSCBMFC.h>
|
||||
|
||||
#include <QtUtil.h>
|
||||
#include <QtUtilWin.h>
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QScopedPointer>
|
||||
#include <QtCore/QPoint>
|
||||
#include <QtGui/QCursor>
|
||||
#include <QtGui/QMouseEvent>
|
||||
#include <QtWidgets/QStyle>
|
||||
#include <QtWidgets/QStyleFactory>
|
||||
#include <QtWidgets/QMenu>
|
||||
#include <QtWidgets/QScrollBar>
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
namespace MFC
|
||||
{
|
||||
|
||||
static CPropertiesDialog* gPropertiesDlg = nullptr;
|
||||
static CString mfc_popup_helper(HWND hwnd, int x, int y);
|
||||
static CConsoleSCB* s_consoleSCB = nullptr;
|
||||
|
||||
static QString RemoveColorCode(const QString& text, int& iColorCode)
|
||||
{
|
||||
QString cleanString;
|
||||
cleanString.reserve(text.size());
|
||||
|
||||
const int textSize = text.size();
|
||||
for (int i = 0; i < textSize; ++i)
|
||||
{
|
||||
QChar c = text.at(i);
|
||||
bool isLast = i == textSize - 1;
|
||||
if (c == '$' && !isLast && text.at(i + 1).isDigit())
|
||||
{
|
||||
if (iColorCode == 0)
|
||||
{
|
||||
iColorCode = text.at(i + 1).digitValue();
|
||||
}
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '\r' || c == '\n')
|
||||
{
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
cleanString.append(c);
|
||||
}
|
||||
|
||||
return cleanString;
|
||||
}
|
||||
|
||||
ConsoleLineEdit::ConsoleLineEdit(QWidget* parent)
|
||||
: QLineEdit(parent)
|
||||
, m_historyIndex(0)
|
||||
, m_bReusedHistory(false)
|
||||
{
|
||||
}
|
||||
|
||||
void ConsoleLineEdit::mousePressEvent(QMouseEvent* ev)
|
||||
{
|
||||
if (ev->type() == QEvent::MouseButtonPress && ev->button() & Qt::RightButton)
|
||||
{
|
||||
Q_EMIT variableEditorRequested();
|
||||
}
|
||||
|
||||
QLineEdit::mousePressEvent(ev);
|
||||
}
|
||||
|
||||
void ConsoleLineEdit::mouseDoubleClickEvent(QMouseEvent* ev)
|
||||
{
|
||||
Q_EMIT variableEditorRequested();
|
||||
}
|
||||
|
||||
bool ConsoleLineEdit::event(QEvent* ev)
|
||||
{
|
||||
// Tab key doesn't go to keyPressEvent(), must be processed here
|
||||
|
||||
if (ev->type() != QEvent::KeyPress)
|
||||
{
|
||||
return QLineEdit::event(ev);
|
||||
}
|
||||
|
||||
QKeyEvent* ke = static_cast<QKeyEvent*>(ev);
|
||||
if (ke->key() != Qt::Key_Tab)
|
||||
{
|
||||
return QLineEdit::event(ev);
|
||||
}
|
||||
|
||||
QString inputStr = text();
|
||||
QString newStr;
|
||||
|
||||
QStringList tokens = inputStr.split(" ");
|
||||
inputStr = tokens.isEmpty() ? QString() : tokens.first();
|
||||
IConsole* console = GetIEditor()->GetSystem()->GetIConsole();
|
||||
|
||||
const bool ctrlPressed = ke->modifiers() & Qt::ControlModifier;
|
||||
CString cstring = QtUtil::ToCString(inputStr); // TODO: Use QString once the backend stops using QString
|
||||
if (ctrlPressed)
|
||||
{
|
||||
newStr = QtUtil::ToString(console->AutoCompletePrev(cstring));
|
||||
}
|
||||
else
|
||||
{
|
||||
newStr = QtUtil::ToString(console->ProcessCompletion(cstring));
|
||||
newStr = QtUtil::ToString(console->AutoComplete(cstring));
|
||||
|
||||
if (newStr.isEmpty())
|
||||
{
|
||||
newStr = QtUtil::ToQString(GetIEditor()->GetCommandManager()->AutoComplete(QtUtil::ToString(newStr)));
|
||||
}
|
||||
}
|
||||
|
||||
if (!newStr.isEmpty())
|
||||
{
|
||||
newStr += " ";
|
||||
setText(newStr);
|
||||
}
|
||||
|
||||
deselect();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConsoleLineEdit::keyPressEvent(QKeyEvent* ev)
|
||||
{
|
||||
IConsole* console = GetIEditor()->GetSystem()->GetIConsole();
|
||||
auto commandManager = GetIEditor()->GetCommandManager();
|
||||
|
||||
console->ResetAutoCompletion();
|
||||
|
||||
switch (ev->key())
|
||||
{
|
||||
case Qt::Key_Enter:
|
||||
case Qt::Key_Return:
|
||||
{
|
||||
QString str = text().trimmed();
|
||||
if (!str.isEmpty())
|
||||
{
|
||||
if (commandManager->IsRegistered(QtUtil::ToCString(str)))
|
||||
{
|
||||
commandManager->Execute(QtUtil::ToString(str));
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogFile::WriteLine(QtUtil::ToCString(str));
|
||||
GetIEditor()->GetSystem()->GetIConsole()->ExecuteString(QtUtil::ToCString(str));
|
||||
}
|
||||
|
||||
// If a history command was reused directly via up arrow enter, do not reset history index
|
||||
if (m_history.size() > 0 && m_historyIndex < m_history.size() && m_history[m_historyIndex] == str)
|
||||
{
|
||||
m_bReusedHistory = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_historyIndex = m_history.size();
|
||||
}
|
||||
|
||||
// Do not add the same string if it is the top of the stack, but allow duplicate entries otherwise
|
||||
if (m_history.isEmpty() || m_history.back() != str)
|
||||
{
|
||||
m_history.push_back(str);
|
||||
if (!m_bReusedHistory)
|
||||
{
|
||||
m_historyIndex = m_history.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_historyIndex = m_history.size();
|
||||
}
|
||||
|
||||
setText(QString());
|
||||
break;
|
||||
}
|
||||
case Qt::Key_AsciiTilde: // ~
|
||||
case Qt::Key_Agrave: // `
|
||||
// disable log.
|
||||
GetIEditor()->ShowConsole(false);
|
||||
setText(QString());
|
||||
m_historyIndex = m_history.size();
|
||||
break;
|
||||
case Qt::Key_Escape:
|
||||
setText(QString());
|
||||
m_historyIndex = m_history.size();
|
||||
break;
|
||||
case Qt::Key_Up:
|
||||
DisplayHistory(false /*bForward*/);
|
||||
break;
|
||||
case Qt::Key_Down:
|
||||
DisplayHistory(true /*bForward*/);
|
||||
break;
|
||||
default:
|
||||
QLineEdit::keyPressEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleLineEdit::DisplayHistory(bool bForward)
|
||||
{
|
||||
if (m_history.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Immediately after reusing a history entry, ensure up arrow re-displays command just used
|
||||
if (!m_bReusedHistory || bForward)
|
||||
{
|
||||
m_historyIndex = static_cast<unsigned int>(clamp_tpl(static_cast<int>(m_historyIndex) + (bForward ? 1 : -1), 0, m_history.size() - 1));
|
||||
}
|
||||
m_bReusedHistory = false;
|
||||
|
||||
setText(m_history[m_historyIndex]);
|
||||
}
|
||||
|
||||
ConsoleTextEdit::ConsoleTextEdit(QWidget* parent)
|
||||
: QTextEdit(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Lines CConsoleSCB::s_pendingLines;
|
||||
|
||||
CConsoleSCB::CConsoleSCB(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::ConsoleMFC())
|
||||
, m_richEditTextLength(0)
|
||||
, m_backgroundTheme(gSettings.consoleBackgroundColorTheme)
|
||||
{
|
||||
m_lines = s_pendingLines;
|
||||
s_pendingLines.clear();
|
||||
s_consoleSCB = this;
|
||||
ui->setupUi(this);
|
||||
setMinimumHeight(120);
|
||||
|
||||
// Setup the color table for the default (light) theme
|
||||
m_colorTable << QColor(0, 0, 0)
|
||||
<< QColor(0, 0, 0)
|
||||
<< QColor(0, 0, 200) // blue
|
||||
<< QColor(0, 200, 0) // green
|
||||
<< QColor(200, 0, 0) // red
|
||||
<< QColor(0, 200, 200) // cyan
|
||||
<< QColor(128, 112, 0) // yellow
|
||||
<< QColor(200, 0, 200) // red+blue
|
||||
<< QColor(0x000080ff)
|
||||
<< QColor(0x008f8f8f);
|
||||
OnStyleSettingsChanged();
|
||||
|
||||
connect(ui->button, &QPushButton::clicked, this, &CConsoleSCB::showVariableEditor);
|
||||
connect(ui->lineEdit, &MFC::ConsoleLineEdit::variableEditorRequested, this, &MFC::CConsoleSCB::showVariableEditor);
|
||||
connect(Editor::EditorQtApplication::instance(), &Editor::EditorQtApplication::skinChanged, this, &MFC::CConsoleSCB::OnStyleSettingsChanged);
|
||||
|
||||
if (GetIEditor()->IsInConsolewMode())
|
||||
{
|
||||
// Attach / register edit box
|
||||
//CLogFile::AttachEditBox(m_edit.GetSafeHwnd()); // FIXME
|
||||
}
|
||||
}
|
||||
|
||||
CConsoleSCB::~CConsoleSCB()
|
||||
{
|
||||
s_consoleSCB = nullptr;
|
||||
delete gPropertiesDlg;
|
||||
gPropertiesDlg = nullptr;
|
||||
CLogFile::AttachEditBox(nullptr);
|
||||
}
|
||||
|
||||
void CConsoleSCB::RegisterViewClass()
|
||||
{
|
||||
QtViewOptions opts;
|
||||
opts.preferedDockingArea = Qt::BottomDockWidgetArea;
|
||||
opts.isDeletable = false;
|
||||
opts.isStandard = true;
|
||||
opts.showInMenu = true;
|
||||
opts.builtInActionId = ID_VIEW_CONSOLEWINDOW;
|
||||
opts.sendViewPaneNameBackToAmazonAnalyticsServers = true;
|
||||
RegisterQtViewPane<CConsoleSCB>(GetIEditor(), LyViewPane::Console, LyViewPane::CategoryTools, opts);
|
||||
}
|
||||
|
||||
void CConsoleSCB::OnStyleSettingsChanged()
|
||||
{
|
||||
ui->button->setIcon(QIcon(QString(":/controls/img/cvar_dark.bmp")));
|
||||
|
||||
// Set the debug/warning text colors appropriately for the background theme
|
||||
// (e.g. not have black text on black background)
|
||||
QColor textColor = Qt::black;
|
||||
m_backgroundTheme = gSettings.consoleBackgroundColorTheme;
|
||||
if (m_backgroundTheme == SEditorSettings::ConsoleColorTheme::Dark)
|
||||
{
|
||||
textColor = Qt::white;
|
||||
}
|
||||
m_colorTable[0] = textColor;
|
||||
m_colorTable[1] = textColor;
|
||||
|
||||
QColor bgColor;
|
||||
if (!GetIEditor()->IsInConsolewMode() && CConsoleSCB::GetCreatedInstance() && m_backgroundTheme == SEditorSettings::ConsoleColorTheme::Dark)
|
||||
{
|
||||
bgColor = Qt::black;
|
||||
}
|
||||
else
|
||||
{
|
||||
bgColor = Qt::white;
|
||||
}
|
||||
|
||||
ui->textEdit->setStyleSheet(QString("QTextEdit{ background: %1 }").arg(bgColor.name(QColor::HexRgb)));
|
||||
|
||||
// Clear out the console text when we change our background color since
|
||||
// some of the previous text colors may not be appropriate for the
|
||||
// new background color
|
||||
ui->textEdit->clear();
|
||||
}
|
||||
|
||||
void CConsoleSCB::showVariableEditor()
|
||||
{
|
||||
const QPoint cursorPos = QCursor::pos();
|
||||
CString str = mfc_popup_helper(0, cursorPos.x(), cursorPos.y());
|
||||
if (!str.IsEmpty())
|
||||
{
|
||||
ui->lineEdit->setText(QtUtil::ToQString(str));
|
||||
}
|
||||
}
|
||||
|
||||
void CConsoleSCB::SetInputFocus()
|
||||
{
|
||||
ui->lineEdit->setFocus();
|
||||
ui->lineEdit->setText(QString());
|
||||
}
|
||||
|
||||
void CConsoleSCB::AddToConsole(const QString& text, bool bNewLine)
|
||||
{
|
||||
m_lines.push_back({ text, bNewLine });
|
||||
FlushText();
|
||||
}
|
||||
|
||||
void CConsoleSCB::FlushText()
|
||||
{
|
||||
if (m_lines.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Store our current cursor in case we need to restore it, and check if
|
||||
// the user has scrolled the text edit away from the bottom
|
||||
const QTextCursor oldCursor = ui->textEdit->textCursor();
|
||||
QScrollBar* scrollBar = ui->textEdit->verticalScrollBar();
|
||||
const int oldScrollValue = scrollBar->value();
|
||||
bool scrolledOffBottom = oldScrollValue != scrollBar->maximum();
|
||||
|
||||
ui->textEdit->moveCursor(QTextCursor::End);
|
||||
QTextCursor textCursor = ui->textEdit->textCursor();
|
||||
|
||||
while (!m_lines.empty())
|
||||
{
|
||||
ConsoleLine line = m_lines.front();
|
||||
m_lines.pop_front();
|
||||
|
||||
int iColor = 0;
|
||||
QString text = MFC::RemoveColorCode(line.text, iColor);
|
||||
if (iColor < 0 || iColor >= m_colorTable.size())
|
||||
{
|
||||
iColor = 0;
|
||||
}
|
||||
|
||||
if (line.newLine)
|
||||
{
|
||||
text = QtUtil::trimRight(text);
|
||||
text = "\r\n" + text;
|
||||
}
|
||||
|
||||
QTextCharFormat format;
|
||||
const QColor color(m_colorTable[iColor]);
|
||||
format.setForeground(color);
|
||||
|
||||
if (iColor != 0)
|
||||
{
|
||||
format.setFontWeight(QFont::Bold);
|
||||
}
|
||||
|
||||
textCursor.setCharFormat(format);
|
||||
textCursor.insertText(text);
|
||||
}
|
||||
|
||||
// If the user has selected some text in the text edit area or has scrolled
|
||||
// away from the bottom, then restore the previous cursor and keep the scroll
|
||||
// bar in the same location
|
||||
if (oldCursor.hasSelection() || scrolledOffBottom)
|
||||
{
|
||||
ui->textEdit->setTextCursor(oldCursor);
|
||||
scrollBar->setValue(oldScrollValue);
|
||||
}
|
||||
// Otherwise scroll to the bottom so the latest text can be seen
|
||||
else
|
||||
{
|
||||
scrollBar->setValue(scrollBar->maximum());
|
||||
}
|
||||
}
|
||||
|
||||
QSize CConsoleSCB::minimumSizeHint() const
|
||||
{
|
||||
return QSize(-1, -1);
|
||||
}
|
||||
|
||||
QSize CConsoleSCB::sizeHint() const
|
||||
{
|
||||
return QSize(100, 100);
|
||||
}
|
||||
|
||||
/** static */
|
||||
void CConsoleSCB::AddToPendingLines(const QString& text, bool bNewLine)
|
||||
{
|
||||
s_pendingLines.push_back({ text, bNewLine });
|
||||
}
|
||||
|
||||
static CVarBlock* VarBlockFromConsoleVars()
|
||||
{
|
||||
IConsole* console = GetIEditor()->GetSystem()->GetIConsole();
|
||||
std::vector<const char*> cmds;
|
||||
cmds.resize(console->GetNumVars());
|
||||
size_t cmdCount = console->GetSortedVars(&cmds[0], cmds.size());
|
||||
|
||||
CVarBlock* vb = new CVarBlock;
|
||||
IVariable* pVariable = 0;
|
||||
for (int i = 0; i < cmdCount; i++)
|
||||
{
|
||||
ICVar* pCVar = console->GetCVar(cmds[i]);
|
||||
if (!pCVar)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
int varType = pCVar->GetType();
|
||||
|
||||
switch (varType)
|
||||
{
|
||||
case CVAR_INT:
|
||||
pVariable = new CVariable<int>();
|
||||
pVariable->Set(pCVar->GetIVal());
|
||||
break;
|
||||
case CVAR_FLOAT:
|
||||
pVariable = new CVariable<float>();
|
||||
pVariable->Set(pCVar->GetFVal());
|
||||
break;
|
||||
case CVAR_STRING:
|
||||
pVariable = new CVariable<CString>();
|
||||
pVariable->Set(pCVar->GetString());
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
pVariable->SetDescription(pCVar->GetHelp());
|
||||
pVariable->SetName(cmds[i]);
|
||||
|
||||
if (pVariable)
|
||||
{
|
||||
vb->AddVariable(pVariable);
|
||||
}
|
||||
}
|
||||
return vb;
|
||||
}
|
||||
|
||||
static void OnConsoleVariableUpdated(IVariable* pVar)
|
||||
{
|
||||
if (!pVar)
|
||||
{
|
||||
return;
|
||||
}
|
||||
CString varName = pVar->GetName();
|
||||
ICVar* pCVar = GetIEditor()->GetSystem()->GetIConsole()->GetCVar(varName);
|
||||
if (!pCVar)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (pVar->GetType() == IVariable::INT)
|
||||
{
|
||||
int val;
|
||||
pVar->Get(val);
|
||||
pCVar->Set(val);
|
||||
}
|
||||
else if (pVar->GetType() == IVariable::FLOAT)
|
||||
{
|
||||
float val;
|
||||
pVar->Get(val);
|
||||
pCVar->Set(val);
|
||||
}
|
||||
else if (pVar->GetType() == IVariable::STRING)
|
||||
{
|
||||
CString val;
|
||||
pVar->Get(val);
|
||||
pCVar->Set(val);
|
||||
}
|
||||
}
|
||||
|
||||
static CString mfc_popup_helper(HWND hwnd, int x, int y)
|
||||
{
|
||||
IConsole* console = GetIEditor()->GetSystem()->GetIConsole();
|
||||
|
||||
TSmartPtr<CVarBlock> vb = VarBlockFromConsoleVars();
|
||||
XmlNodeRef node;
|
||||
if (!gPropertiesDlg)
|
||||
{
|
||||
gPropertiesDlg = new CPropertiesDialog("Console Variables", node, AfxGetMainWnd(), true);
|
||||
}
|
||||
if (!gPropertiesDlg->m_hWnd)
|
||||
{
|
||||
gPropertiesDlg->Create(CPropertiesDialog::IDD, AfxGetMainWnd());
|
||||
gPropertiesDlg->SetUpdateCallback(AZStd::bind(OnConsoleVariableUpdated, AZStd::placeholders::_1));
|
||||
}
|
||||
gPropertiesDlg->ShowWindow(SW_SHOW);
|
||||
gPropertiesDlg->BringWindowToTop();
|
||||
gPropertiesDlg->GetPropertyCtrl()->AddVarBlock(vb);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
CConsoleSCB* CConsoleSCB::GetCreatedInstance()
|
||||
{
|
||||
return s_consoleSCB;
|
||||
}
|
||||
|
||||
} // namespace MFC
|
||||
|
||||
#include <Controls/moc_ConsoleSCBMFC.cpp>
|
||||
@@ -400,7 +400,7 @@ void CFolderTreeCtrl::RemoveEmptyFolderItems(const QString& folder)
|
||||
|
||||
void CFolderTreeCtrl::Edit(const QString& path)
|
||||
{
|
||||
CFileUtil::EditTextFile(QtUtil::ToString(path), 0, IFileUtil::FILE_TYPE_SCRIPT);
|
||||
CFileUtil::EditTextFile(path.toUtf8().data(), 0, IFileUtil::FILE_TYPE_SCRIPT);
|
||||
}
|
||||
|
||||
void CFolderTreeCtrl::ShowInExplorer(const QString& path)
|
||||
|
||||
@@ -19,22 +19,22 @@ CHotTrackingTreeCtrl::CHotTrackingTreeCtrl(QWidget* parent)
|
||||
: QTreeWidget(parent)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
m_hHoverItem = NULL;
|
||||
m_hHoverItem = nullptr;
|
||||
}
|
||||
|
||||
void CHotTrackingTreeCtrl::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
QTreeWidgetItem* hItem = itemAt(event->pos());
|
||||
|
||||
if (m_hHoverItem != NULL)
|
||||
if (m_hHoverItem != nullptr)
|
||||
{
|
||||
QFont font = m_hHoverItem->font(0);
|
||||
font.setBold(false);
|
||||
m_hHoverItem->setFont(0, font);
|
||||
m_hHoverItem = NULL;
|
||||
m_hHoverItem = nullptr;
|
||||
}
|
||||
|
||||
if (hItem != NULL)
|
||||
if (hItem != nullptr)
|
||||
{
|
||||
QFont font = hItem->font(0);
|
||||
font.setBold(true);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
// Editor
|
||||
#include "PropertyCtrl.h"
|
||||
#include "PropertyAnimationCtrl.h"
|
||||
#include "PropertyResourceCtrl.h"
|
||||
#include "PropertyGenericCtrl.h"
|
||||
#include "PropertyMiscCtrl.h"
|
||||
@@ -22,9 +21,7 @@ void RegisterReflectedVarHandlers()
|
||||
if (!registered)
|
||||
{
|
||||
registered = true;
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew AnimationPropertyWidgetHandler());
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew FileResourceSelectorWidgetHandler());
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew ReverbPresetPropertyHandler());
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew SequencePropertyHandler());
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew SequenceIdPropertyHandler());
|
||||
EBUS_EVENT(AzToolsFramework::PropertyTypeRegistrationMessages::Bus, RegisterPropertyType, aznew LocalStringPropertyHandler());
|
||||
|
||||
@@ -73,16 +73,6 @@ void GenericPopupPropertyEditor::SetPropertyType(PropertyType type)
|
||||
m_propertyType = type;
|
||||
}
|
||||
|
||||
void ReverbPresetPropertyEditor::onEditClicked()
|
||||
{
|
||||
CSelectEAXPresetDlg PresetDlg(this);
|
||||
PresetDlg.SetCurrPreset(GetValue());
|
||||
if (PresetDlg.exec() == QDialog::Accepted)
|
||||
{
|
||||
SetValue(PresetDlg.GetCurrPreset());
|
||||
}
|
||||
}
|
||||
|
||||
void SequencePropertyEditor::onEditClicked()
|
||||
{
|
||||
CSelectSequenceDialog gtDlg(this);
|
||||
@@ -132,7 +122,9 @@ void LocalStringPropertyEditor::onEditClicked()
|
||||
if (pMgr->GetLocalizedInfoByIndex(i, sInfo))
|
||||
{
|
||||
item.desc = tr("English Text:\r\n");
|
||||
item.desc += QString::fromWCharArray(Unicode::Convert<wstring>(sInfo.sUtf8TranslatedText).c_str());
|
||||
AZStd::wstring utf8TranslatedTextW;
|
||||
AZStd::to_wstring(utf8TranslatedTextW, sInfo.sUtf8TranslatedText);
|
||||
item.desc += QString::fromWCharArray(utf8TranslatedTextW.c_str());
|
||||
item.name = sInfo.sKey;
|
||||
items.push_back(item);
|
||||
}
|
||||
|
||||
@@ -96,15 +96,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class ReverbPresetPropertyEditor
|
||||
: public GenericPopupPropertyEditor
|
||||
{
|
||||
public:
|
||||
ReverbPresetPropertyEditor(QWidget* pParent = nullptr)
|
||||
: GenericPopupPropertyEditor(pParent){}
|
||||
void onEditClicked() override;
|
||||
};
|
||||
|
||||
class MissionObjPropertyEditor
|
||||
: public GenericPopupPropertyEditor
|
||||
{
|
||||
@@ -155,7 +146,6 @@ public:
|
||||
// So we use our own
|
||||
#define CONST_AZ_CRC(name, value) AZ::u32(value)
|
||||
|
||||
using ReverbPresetPropertyHandler = GenericPopupWidgetHandler<ReverbPresetPropertyEditor, CONST_AZ_CRC("ePropertyReverbPreset", 0x51469f38)>;
|
||||
using MissionObjPropertyHandler = GenericPopupWidgetHandler<MissionObjPropertyEditor, CONST_AZ_CRC("ePropertyMissionObj", 0x4a2d0dc8)>;
|
||||
using SequencePropertyHandler = GenericPopupWidgetHandler<SequencePropertyEditor, CONST_AZ_CRC("ePropertySequence", 0xdd1c7d44)>;
|
||||
using SequenceIdPropertyHandler = GenericPopupWidgetHandler<SequenceIdPropertyEditor, CONST_AZ_CRC("ePropertySequenceId", 0x05983dcc)>;
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
// AzToolsFramework
|
||||
#include <AzToolsFramework/AssetBrowser/AssetSelectionModel.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
#include <AzToolsFramework/UI/PropertyEditor/PropertyAudioCtrl.h>
|
||||
|
||||
// Editor
|
||||
#include "IResourceSelectorHost.h"
|
||||
#include "Controls/QToolTipWidget.h"
|
||||
#include "Controls/BitmapToolTip.h"
|
||||
|
||||
@@ -35,8 +35,8 @@ BrowseButton::BrowseButton(PropertyType type, QWidget* parent /*= nullptr*/)
|
||||
|
||||
void BrowseButton::SetPathAndEmit(const QString& path)
|
||||
{
|
||||
//only emit if path changes, except for ePropertyGeomCache. Old property control
|
||||
if (path != m_path || m_propertyType == ePropertyGeomCache)
|
||||
//only emit if path changes. Old property control
|
||||
if (path != m_path)
|
||||
{
|
||||
m_path = path;
|
||||
emit PathChanged(m_path);
|
||||
@@ -78,21 +78,6 @@ private:
|
||||
// Filters for texture.
|
||||
selection = AssetSelectionModel::AssetGroupSelection("Texture");
|
||||
}
|
||||
else if (m_propertyType == ePropertyModel)
|
||||
{
|
||||
// Filters for models.
|
||||
selection = AssetSelectionModel::AssetGroupSelection("Geometry");
|
||||
}
|
||||
else if (m_propertyType == ePropertyGeomCache)
|
||||
{
|
||||
// Filters for geom caches.
|
||||
selection = AssetSelectionModel::AssetTypeSelection("Geom Cache");
|
||||
}
|
||||
else if (m_propertyType == ePropertyFile)
|
||||
{
|
||||
// Filters for files.
|
||||
selection = AssetSelectionModel::AssetTypeSelection("File");
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
@@ -106,14 +91,7 @@ private:
|
||||
switch (m_propertyType)
|
||||
{
|
||||
case ePropertyTexture:
|
||||
case ePropertyModel:
|
||||
newPath.replace("\\\\", "/");
|
||||
}
|
||||
switch (m_propertyType)
|
||||
{
|
||||
case ePropertyTexture:
|
||||
case ePropertyModel:
|
||||
case ePropertyFile:
|
||||
if (newPath.size() > MAX_PATH)
|
||||
{
|
||||
newPath.resize(MAX_PATH);
|
||||
@@ -125,26 +103,51 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
class ResourceSelectorButton
|
||||
class AudioControlSelectorButton
|
||||
: public BrowseButton
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(ResourceSelectorButton, AZ::SystemAllocator, 0);
|
||||
AZ_CLASS_ALLOCATOR(AudioControlSelectorButton, AZ::SystemAllocator, 0);
|
||||
|
||||
ResourceSelectorButton(PropertyType type, QWidget* pParent = nullptr)
|
||||
AudioControlSelectorButton(PropertyType type, QWidget* pParent = nullptr)
|
||||
: BrowseButton(type, pParent)
|
||||
{
|
||||
setToolTip(tr("Select resource"));
|
||||
setToolTip(tr("Select Audio Control"));
|
||||
}
|
||||
|
||||
private:
|
||||
void OnClicked() override
|
||||
{
|
||||
SResourceSelectorContext x;
|
||||
x.parentWidget = this;
|
||||
x.typeName = Prop::GetPropertyTypeToResourceType(m_propertyType);
|
||||
QString newPath = GetIEditor()->GetResourceSelectorHost()->SelectResource(x, m_path);
|
||||
SetPathAndEmit(newPath);
|
||||
AZStd::string resourceResult;
|
||||
auto ConvertLegacyAudioPropertyType = [](const PropertyType type) -> AzToolsFramework::AudioPropertyType
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ePropertyAudioTrigger:
|
||||
return AzToolsFramework::AudioPropertyType::Trigger;
|
||||
case ePropertyAudioRTPC:
|
||||
return AzToolsFramework::AudioPropertyType::Rtpc;
|
||||
case ePropertyAudioSwitch:
|
||||
return AzToolsFramework::AudioPropertyType::Switch;
|
||||
case ePropertyAudioSwitchState:
|
||||
return AzToolsFramework::AudioPropertyType::SwitchState;
|
||||
case ePropertyAudioEnvironment:
|
||||
return AzToolsFramework::AudioPropertyType::Environment;
|
||||
case ePropertyAudioPreloadRequest:
|
||||
return AzToolsFramework::AudioPropertyType::Preload;
|
||||
default:
|
||||
return AzToolsFramework::AudioPropertyType::NumTypes;
|
||||
}
|
||||
};
|
||||
|
||||
auto propType = ConvertLegacyAudioPropertyType(m_propertyType);
|
||||
if (propType != AzToolsFramework::AudioPropertyType::NumTypes)
|
||||
{
|
||||
AzToolsFramework::AudioControlSelectorRequestBus::EventResult(
|
||||
resourceResult, propType, &AzToolsFramework::AudioControlSelectorRequestBus::Events::SelectResource,
|
||||
AZStd::string_view{ m_path.toUtf8().constData() });
|
||||
SetPathAndEmit(QString{ resourceResult.c_str() });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -235,18 +238,13 @@ void FileResourceSelectorWidget::SetPropertyType(PropertyType type)
|
||||
AddButton(new TextureEditButton);
|
||||
m_previewToolTip.reset(new CBitmapToolTip);
|
||||
break;
|
||||
case ePropertyModel:
|
||||
case ePropertyGeomCache:
|
||||
case ePropertyAudioTrigger:
|
||||
case ePropertyAudioSwitch:
|
||||
case ePropertyAudioSwitchState:
|
||||
case ePropertyAudioRTPC:
|
||||
case ePropertyAudioEnvironment:
|
||||
case ePropertyAudioPreloadRequest:
|
||||
AddButton(new ResourceSelectorButton(type));
|
||||
break;
|
||||
case ePropertyFile:
|
||||
AddButton(new FileBrowseButton(type));
|
||||
AddButton(new AudioControlSelectorButton(type));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -1,93 +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 : implementation file
|
||||
|
||||
#include "EditorDefs.h"
|
||||
|
||||
#include "ReflectedPropertiesPanel.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ReflectedPropertiesPanel dialog
|
||||
|
||||
|
||||
ReflectedPropertiesPanel::ReflectedPropertiesPanel(QWidget* pParent)
|
||||
: ReflectedPropertyControl(pParent)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void ReflectedPropertiesPanel::DeleteVars()
|
||||
{
|
||||
ClearVarBlock();
|
||||
m_updateCallbacks.clear();
|
||||
m_varBlock = 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void ReflectedPropertiesPanel::SetVarBlock(class CVarBlock* vb, ReflectedPropertyControl::UpdateVarCallback* updCallback, const char* category)
|
||||
{
|
||||
assert(vb);
|
||||
|
||||
m_varBlock = vb;
|
||||
|
||||
RemoveAllItems();
|
||||
m_varBlock = vb;
|
||||
AddVarBlock(m_varBlock, category);
|
||||
|
||||
SetUpdateCallback(AZStd::bind(&ReflectedPropertiesPanel::OnPropertyChanged, this, AZStd::placeholders::_1));
|
||||
|
||||
// When new object set all previous callbacks freed.
|
||||
m_updateCallbacks.clear();
|
||||
if (updCallback)
|
||||
{
|
||||
stl::push_back_unique(m_updateCallbacks, updCallback);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void ReflectedPropertiesPanel::AddVars(CVarBlock* vb, ReflectedPropertyControl::UpdateVarCallback* updCallback, const char* category)
|
||||
{
|
||||
assert(vb);
|
||||
|
||||
bool bNewBlock = false;
|
||||
// Make a clone of properties.
|
||||
if (!m_varBlock)
|
||||
{
|
||||
RemoveAllItems();
|
||||
m_varBlock = vb->Clone(true);
|
||||
AddVarBlock(m_varBlock, category);
|
||||
bNewBlock = true;
|
||||
}
|
||||
m_varBlock->Wire(vb);
|
||||
|
||||
if (bNewBlock)
|
||||
{
|
||||
SetUpdateCallback(AZStd::bind(&ReflectedPropertiesPanel::OnPropertyChanged, this, AZStd::placeholders::_1));
|
||||
|
||||
// When new object set all previous callbacks freed.
|
||||
m_updateCallbacks.clear();
|
||||
}
|
||||
|
||||
if (updCallback)
|
||||
{
|
||||
stl::push_back_unique(m_updateCallbacks, updCallback);
|
||||
}
|
||||
}
|
||||
|
||||
void ReflectedPropertiesPanel::OnPropertyChanged(IVariable* pVar)
|
||||
{
|
||||
std::list<ReflectedPropertyControl::UpdateVarCallback*>::iterator iter;
|
||||
for (iter = m_updateCallbacks.begin(); iter != m_updateCallbacks.end(); ++iter)
|
||||
{
|
||||
(*iter)->operator()(pVar);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,46 +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_REFLECTEDPROPERTIESPANEL_H
|
||||
#define CRYINCLUDE_EDITOR_REFLECTEDPROPERTIESPANEL_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Controls/ReflectedPropertyControl/ReflectedPropertyCtrl.h"
|
||||
#include "Util/Variable.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// ReflectedPropertiesPanel dialog
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
//This class is a port of ReflectedPropertiesPanel to use the ReflectedPropertyControl
|
||||
class SANDBOX_API ReflectedPropertiesPanel
|
||||
: public ReflectedPropertyControl
|
||||
{
|
||||
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
public:
|
||||
ReflectedPropertiesPanel(QWidget* pParent = nullptr); // standard constructor
|
||||
|
||||
void DeleteVars();
|
||||
void AddVars(class CVarBlock* vb, ReflectedPropertyControl::UpdateVarCallback* func = nullptr, const char* category = nullptr);
|
||||
|
||||
void SetVarBlock(class CVarBlock* vb, ReflectedPropertyControl::UpdateVarCallback* func = nullptr, const char* category = nullptr);
|
||||
|
||||
protected:
|
||||
void OnPropertyChanged(IVariable* pVar);
|
||||
|
||||
protected:
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
TSmartPtr<CVarBlock> m_varBlock;
|
||||
|
||||
std::list<ReflectedPropertyControl::UpdateVarCallback*> m_updateCallbacks;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
|
||||
#endif // CRYINCLUDE_EDITOR_REFLECTEDPROPERTIESPANEL_H
|
||||
@@ -198,7 +198,7 @@ void ReflectedPropertyControl::CreateItems(XmlNodeRef node)
|
||||
|
||||
void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlockPtr, IVariable::OnSetCallback* func, bool splitCamelCaseIntoWords)
|
||||
{
|
||||
SelectItem(0);
|
||||
SelectItem(nullptr);
|
||||
|
||||
outBlockPtr = new CVarBlock;
|
||||
for (size_t i = 0, iGroupCount(node->getChildCount()); i < iGroupCount; ++i)
|
||||
@@ -505,7 +505,7 @@ void ReflectedPropertyControl::RemoveAllItems()
|
||||
void ReflectedPropertyControl::ClearVarBlock()
|
||||
{
|
||||
RemoveAllItems();
|
||||
m_pVarBlock = 0;
|
||||
m_pVarBlock = nullptr;
|
||||
}
|
||||
|
||||
void ReflectedPropertyControl::RecreateAllItems()
|
||||
@@ -688,11 +688,11 @@ void ReflectedPropertyControl::OnItemChange(ReflectedPropertyItem *item, bool de
|
||||
// callback until after the current event queue is processed, so that we aren't changing other widgets
|
||||
// as a ton of them are still being created.
|
||||
Qt::ConnectionType connectionType = deferCallbacks ? Qt::QueuedConnection : Qt::DirectConnection;
|
||||
if (m_updateVarFunc != 0 && m_bEnableCallback)
|
||||
if (m_updateVarFunc && m_bEnableCallback)
|
||||
{
|
||||
QMetaObject::invokeMethod(this, "DoUpdateCallback", connectionType, Q_ARG(IVariable*, item->GetVariable()));
|
||||
}
|
||||
if (m_updateObjectFunc != 0 && m_bEnableCallback)
|
||||
if (m_updateObjectFunc && m_bEnableCallback)
|
||||
{
|
||||
// KDAB: This callback has same signature as DoUpdateCallback. I think the only reason there are 2 is because some
|
||||
// EntityObject registers callback and some derived objects want to register their own callback. the normal UpdateCallback
|
||||
@@ -709,7 +709,7 @@ void ReflectedPropertyControl::DoUpdateCallback(IVariable *var)
|
||||
const bool variableStillExists = FindVariable(var);
|
||||
AZ_Assert(variableStillExists, "This variable and the item containing it were destroyed during a deferred callback. Change to non-deferred callback.");
|
||||
|
||||
if (m_updateVarFunc == 0 || !variableStillExists)
|
||||
if (!m_updateVarFunc || !variableStillExists)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -724,7 +724,7 @@ void ReflectedPropertyControl::DoUpdateObjectCallback(IVariable *var)
|
||||
const bool variableStillExists = FindVariable(var);
|
||||
AZ_Assert(variableStillExists, "This variable and the item containing it were destroyed during a deferred callback. Change to non-deferred callback.");
|
||||
|
||||
if (m_updateVarFunc == 0 || !variableStillExists)
|
||||
if ( !m_updateVarFunc || !variableStillExists)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -904,7 +904,7 @@ void ReflectedPropertyControl::SetUndoCallback(UndoCallback &callback)
|
||||
|
||||
void ReflectedPropertyControl::ClearUndoCallback()
|
||||
{
|
||||
m_undoFunc = 0;
|
||||
m_undoFunc = nullptr;
|
||||
}
|
||||
|
||||
bool ReflectedPropertyControl::FindVariable(IVariable *categoryItem) const
|
||||
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
}
|
||||
|
||||
//helps implement ReflectedPropertyControl::ReplaceVarBlock
|
||||
void ReplaceVarBlock(CVarBlock *varBlock)
|
||||
void ReplaceVarBlock(CVarBlock *varBlock) override
|
||||
{
|
||||
m_containerVar->Clear();
|
||||
UpdateCommon(m_item->GetVariable(), varBlock);
|
||||
@@ -207,7 +207,7 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
|
||||
ReleaseVariable();
|
||||
|
||||
m_pVariable = pInputVar;
|
||||
assert(m_pVariable != NULL);
|
||||
assert(m_pVariable != nullptr);
|
||||
|
||||
m_pVariable->AddOnSetCallback(&m_onSetCallback);
|
||||
m_pVariable->AddOnSetEnumCallback(&m_onSetEnumCallback);
|
||||
@@ -255,9 +255,6 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
|
||||
case ePropertySelection:
|
||||
m_reflectedVarAdapter = new ReflectedVarEnumAdapter;
|
||||
break;
|
||||
case ePropertyAnimation:
|
||||
m_reflectedVarAdapter = new ReflectedVarAnimationAdapter;
|
||||
break;
|
||||
case ePropertyColor:
|
||||
m_reflectedVarAdapter = new ReflectedVarColorAdapter;
|
||||
break;
|
||||
@@ -265,7 +262,6 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
|
||||
m_reflectedVarAdapter = new ReflectedVarUserAdapter;
|
||||
break;
|
||||
case ePropertyEquip:
|
||||
case ePropertyReverbPreset:
|
||||
case ePropertyGameToken:
|
||||
case ePropertyMissionObj:
|
||||
case ePropertySequence:
|
||||
@@ -276,15 +272,12 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
|
||||
m_reflectedVarAdapter = new ReflectedVarGenericPropertyAdapter(desc.m_type);
|
||||
break;
|
||||
case ePropertyTexture:
|
||||
case ePropertyModel:
|
||||
case ePropertyGeomCache:
|
||||
case ePropertyAudioTrigger:
|
||||
case ePropertyAudioSwitch:
|
||||
case ePropertyAudioSwitchState:
|
||||
case ePropertyAudioRTPC:
|
||||
case ePropertyAudioEnvironment:
|
||||
case ePropertyAudioPreloadRequest:
|
||||
case ePropertyFile:
|
||||
m_reflectedVarAdapter = new ReflectedVarResourceAdapter;
|
||||
break;
|
||||
case ePropertyFloatCurve:
|
||||
@@ -332,7 +325,7 @@ void ReflectedPropertyItem::RemoveAllChildren()
|
||||
{
|
||||
for (int i = 0; i < m_childs.size(); i++)
|
||||
{
|
||||
m_childs[i]->m_parent = 0;
|
||||
m_childs[i]->m_parent = nullptr;
|
||||
}
|
||||
|
||||
m_childs.clear();
|
||||
@@ -473,7 +466,7 @@ void ReflectedPropertyItem::ReleaseVariable()
|
||||
m_pVariable->RemoveOnSetCallback(&m_onSetCallback);
|
||||
m_pVariable->RemoveOnSetEnumCallback(&m_onSetEnumCallback);
|
||||
}
|
||||
m_pVariable = 0;
|
||||
m_pVariable = nullptr;
|
||||
delete m_reflectedVarAdapter;
|
||||
m_reflectedVarAdapter = nullptr;
|
||||
}
|
||||
@@ -569,7 +562,6 @@ void ReflectedPropertyItem::SetValue(const QString& sValue, bool bRecordUndo, bo
|
||||
break;
|
||||
|
||||
case ePropertyTexture:
|
||||
case ePropertyModel:
|
||||
value.replace('\\', '/');
|
||||
break;
|
||||
}
|
||||
@@ -578,8 +570,6 @@ void ReflectedPropertyItem::SetValue(const QString& sValue, bool bRecordUndo, bo
|
||||
switch (m_type)
|
||||
{
|
||||
case ePropertyTexture:
|
||||
case ePropertyModel:
|
||||
case ePropertyFile:
|
||||
if (value.length() >= MAX_PATH)
|
||||
{
|
||||
value = value.left(MAX_PATH);
|
||||
|
||||
@@ -122,7 +122,7 @@ protected:
|
||||
|
||||
public:
|
||||
//! Get number of child nodes.
|
||||
int GetChildCount() const { return m_childs.size(); };
|
||||
int GetChildCount() const { return static_cast<int>(m_childs.size()); };
|
||||
//! Get Child by id.
|
||||
ReflectedPropertyItem* GetChild(int index) const { return m_childs[index]; }
|
||||
PropertyType GetType() const { return m_type; }
|
||||
|
||||
@@ -31,12 +31,6 @@ void ReflectedVarInit::setupReflection(AZ::SerializeContext* serializeContext)
|
||||
->Field("description", &CReflectedVar::m_description)
|
||||
->Field("varName", &CReflectedVar::m_varName);
|
||||
|
||||
serializeContext->Class <CReflectedVarAnimation, CReflectedVar >()
|
||||
->Version(1)
|
||||
->Field("animation", &CReflectedVarAnimation::m_animation)
|
||||
->Field("entityID", &CReflectedVarAnimation::m_entityID)
|
||||
;
|
||||
|
||||
serializeContext->Class <CReflectedVarResource, CReflectedVar >()
|
||||
->Version(1)
|
||||
->Field("path", &CReflectedVarResource::m_path)
|
||||
@@ -76,12 +70,6 @@ void ReflectedVarInit::setupReflection(AZ::SerializeContext* serializeContext)
|
||||
AZ::EditContext* ec = serializeContext->GetEditContext();
|
||||
if (ec)
|
||||
{
|
||||
ec->Class< CReflectedVarAnimation >("VarAnimation", "Animation")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::NameLabelOverride, &CReflectedVarAnimation::varName)
|
||||
->Attribute(AZ::Edit::Attributes::DescriptionTextOverride, &CReflectedVarAnimation::description)
|
||||
;
|
||||
|
||||
ec->Class< CReflectedVarResource >("VarResource", "Resource")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::NameLabelOverride, &CReflectedVarResource::varName)
|
||||
@@ -284,8 +272,6 @@ AZ::u32 CReflectedVarGenericProperty::handler()
|
||||
return AZ_CRC("ePropertyShader", 0xc40932f1);
|
||||
case ePropertyEquip:
|
||||
return AZ_CRC("ePropertyEquip", 0x66ffd290);
|
||||
case ePropertyReverbPreset:
|
||||
return AZ_CRC("ePropertyReverbPreset", 0x51469f38);
|
||||
case ePropertyDeprecated0:
|
||||
return AZ_CRC("ePropertyCustomAction", 0x4ffa5ba5);
|
||||
case ePropertyGameToken:
|
||||
|
||||
@@ -265,32 +265,8 @@ public:
|
||||
AZ::Vector3 m_color;
|
||||
};
|
||||
|
||||
//Class to hold ePropertyAnimation (IVariable::DT_ANIMATION )
|
||||
class CReflectedVarAnimation
|
||||
: public CReflectedVar
|
||||
{
|
||||
public:
|
||||
AZ_RTTI(CReflectedVarAnimation, "{635D982E-23EC-463F-8F33-4FC2C19D5673}", CReflectedVar)
|
||||
|
||||
CReflectedVarAnimation(const AZStd::string& name)
|
||||
: CReflectedVar(name)
|
||||
, m_entityID(0)
|
||||
{}
|
||||
CReflectedVarAnimation()
|
||||
: m_entityID(0){}
|
||||
|
||||
AZStd::string varName() const { return m_varName; }
|
||||
AZStd::string description() const { return m_description; }
|
||||
|
||||
AZStd::string m_animation;
|
||||
AZ::EntityId m_entityID;
|
||||
};
|
||||
|
||||
//Class to hold:
|
||||
// ePropertyTexture (IVariable::DT_TEXTURE)
|
||||
// ePropertyMaterial (IVariable::DT_MATERIAL)
|
||||
// ePropertyModel (IVariable::DT_OBJECT)
|
||||
// ePropertyGeomCache (IVariable::DT_GEOM_CACHE)
|
||||
// ePropertyAudioTrigger (IVariable::DT_AUDIO_TRIGGER)
|
||||
// ePropertyAudioSwitch (IVariable::DT_AUDIO_SWITCH )
|
||||
// ePropertyAudioSwitchState (IVariable::DT_AUDIO_SWITCH_STATE)
|
||||
@@ -344,7 +320,6 @@ public:
|
||||
AZStd::vector<AZStd::string> m_itemDescriptions;
|
||||
};
|
||||
|
||||
//Class to hold ePropertyAnimation (IVariable::DT_ANIMATION )
|
||||
class CReflectedVarSpline
|
||||
: public CReflectedVar
|
||||
{
|
||||
|
||||
@@ -392,25 +392,6 @@ void ReflectedVarColorAdapter::SyncIVarToReflectedVar(IVariable *pVariable)
|
||||
|
||||
|
||||
|
||||
void ReflectedVarAnimationAdapter::SetVariable(IVariable *pVariable)
|
||||
{
|
||||
m_reflectedVar.reset(new CReflectedVarAnimation(pVariable->GetHumanName().toUtf8().data()));
|
||||
m_reflectedVar->m_description = pVariable->GetDescription().toUtf8().data();
|
||||
}
|
||||
|
||||
void ReflectedVarAnimationAdapter::SyncReflectedVarToIVar(IVariable *pVariable)
|
||||
{
|
||||
m_reflectedVar->m_entityID = static_cast<AZ::EntityId>(pVariable->GetUserData().value<AZ::u64>());
|
||||
m_reflectedVar->m_animation = pVariable->GetDisplayValue().toUtf8().data();
|
||||
}
|
||||
|
||||
void ReflectedVarAnimationAdapter::SyncIVarToReflectedVar(IVariable *pVariable)
|
||||
{
|
||||
pVariable->SetUserData(static_cast<AZ::u64>(m_reflectedVar->m_entityID));
|
||||
pVariable->SetDisplayValue(m_reflectedVar->m_animation.c_str());
|
||||
|
||||
}
|
||||
|
||||
void ReflectedVarResourceAdapter::SetVariable(IVariable *pVariable)
|
||||
{
|
||||
m_reflectedVar.reset(new CReflectedVarResource(pVariable->GetHumanName().toUtf8().data()));
|
||||
@@ -429,7 +410,7 @@ void ReflectedVarResourceAdapter::SyncReflectedVarToIVar(IVariable *pVariable)
|
||||
|
||||
void ReflectedVarResourceAdapter::SyncIVarToReflectedVar(IVariable *pVariable)
|
||||
{
|
||||
const bool bForceModified = (m_reflectedVar->m_propertyType == ePropertyGeomCache);
|
||||
const bool bForceModified = false;
|
||||
pVariable->SetForceModified(bForceModified);
|
||||
pVariable->SetDisplayValue(m_reflectedVar->m_path.c_str());
|
||||
|
||||
@@ -473,7 +454,7 @@ void ReflectedVarUserAdapter::SyncReflectedVarToIVar(IVariable *pVariable)
|
||||
|
||||
//extract the list of custom items from the IVariable user data
|
||||
IVariable::IGetCustomItems* pGetCustomItems = static_cast<IVariable::IGetCustomItems*> (pVariable->GetUserData().value<void *>());
|
||||
if (pGetCustomItems != 0)
|
||||
if (pGetCustomItems != nullptr)
|
||||
{
|
||||
std::vector<IVariable::IGetCustomItems::SItem> items;
|
||||
QString dlgTitle;
|
||||
|
||||
@@ -218,20 +218,6 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
class EDITOR_CORE_API ReflectedVarAnimationAdapter
|
||||
: public ReflectedVarAdapter
|
||||
{
|
||||
public:
|
||||
void SetVariable(IVariable* pVariable) override;
|
||||
void SyncReflectedVarToIVar(IVariable* pVariable) override;
|
||||
void SyncIVarToReflectedVar(IVariable* pVariable) override;
|
||||
CReflectedVar* GetReflectedVar() override { return m_reflectedVar.data(); }
|
||||
private:
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
QScopedPointer<CReflectedVarAnimation > m_reflectedVar;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
class EDITOR_CORE_API ReflectedVarResourceAdapter
|
||||
: public ReflectedVarAdapter
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ CSplineCtrl::CSplineCtrl(QWidget* parent)
|
||||
m_nHitKeyIndex = -1;
|
||||
m_nKeyDrawRadius = 3;
|
||||
m_bTracking = false;
|
||||
m_pSpline = 0;
|
||||
m_pSpline = nullptr;
|
||||
m_gridX = 10;
|
||||
m_gridY = 10;
|
||||
m_fMinTime = -1;
|
||||
@@ -40,7 +40,7 @@ CSplineCtrl::CSplineCtrl(QWidget* parent)
|
||||
m_fTooltipScaleX = 1;
|
||||
m_fTooltipScaleY = 1;
|
||||
m_bLockFirstLastKey = false;
|
||||
m_pTimelineCtrl = 0;
|
||||
m_pTimelineCtrl = nullptr;
|
||||
|
||||
m_bSelectedKeys.reserve(0);
|
||||
|
||||
@@ -417,7 +417,7 @@ void CSplineCtrl::SetActiveKey(int nIndex)
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CSplineCtrl::SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw)
|
||||
void CSplineCtrl::SetSpline(ISplineInterpolator* pSpline, bool bRedraw)
|
||||
{
|
||||
if (pSpline != m_pSpline)
|
||||
{
|
||||
@@ -596,7 +596,7 @@ CSplineCtrl::EHitCode CSplineCtrl::HitTest(const QPoint& point)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void CSplineCtrl::StartTracking()
|
||||
{
|
||||
m_bTracking = TRUE;
|
||||
m_bTracking = true;
|
||||
|
||||
GetIEditor()->BeginUndo();
|
||||
|
||||
@@ -674,7 +674,7 @@ void CSplineCtrl::StopTracking()
|
||||
|
||||
GetIEditor()->AcceptUndo("Spline Move");
|
||||
|
||||
m_bTracking = FALSE;
|
||||
m_bTracking = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
// Lock value of first and last key to be the same.
|
||||
void LockFirstAndLastKeys(bool bLock) { m_bLockFirstLastKey = bLock; }
|
||||
|
||||
void SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw = FALSE);
|
||||
void SetSpline(ISplineInterpolator* pSpline, bool bRedraw = false);
|
||||
ISplineInterpolator* GetSpline();
|
||||
|
||||
void SetTimeMarker(float fTime);
|
||||
|
||||
@@ -69,8 +69,8 @@ protected:
|
||||
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
|
||||
m_splineEntries.resize(m_splineEntries.size() + 1);
|
||||
SplineEntry& entry = m_splineEntries.back();
|
||||
ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : 0);
|
||||
entry.id = (pSplineSet ? pSplineSet->GetIDFromSpline(pSpline) : 0);
|
||||
ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : nullptr);
|
||||
entry.id = (pSplineSet ? pSplineSet->GetIDFromSpline(pSpline) : nullptr);
|
||||
entry.pSpline = pSpline;
|
||||
|
||||
const int numKeys = pSpline->GetKeyCount();
|
||||
@@ -81,10 +81,10 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual int GetSize() { return sizeof(*this); }
|
||||
virtual QString GetDescription() { return "UndoSplineCtrlEx"; };
|
||||
int GetSize() override { return sizeof(*this); }
|
||||
QString GetDescription() override { return "UndoSplineCtrlEx"; };
|
||||
|
||||
virtual void Undo(bool bUndo)
|
||||
void Undo(bool bUndo) override
|
||||
{
|
||||
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
|
||||
if (pCtrl)
|
||||
@@ -104,7 +104,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Redo()
|
||||
void Redo() override
|
||||
{
|
||||
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
|
||||
if (pCtrl)
|
||||
@@ -127,14 +127,14 @@ private:
|
||||
std::vector<int> keySelectionFlags;
|
||||
_smart_ptr<ISplineBackup> undo;
|
||||
_smart_ptr<ISplineBackup> redo;
|
||||
string id;
|
||||
AZStd::string id;
|
||||
ISplineInterpolator* pSpline;
|
||||
};
|
||||
|
||||
void SerializeSplines(_smart_ptr<ISplineBackup> SplineEntry::* backup, bool bLoading)
|
||||
{
|
||||
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
|
||||
ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : 0);
|
||||
ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : nullptr);
|
||||
for (auto it = m_splineEntries.begin(); it != m_splineEntries.end(); ++it)
|
||||
{
|
||||
SplineEntry& entry = *it;
|
||||
@@ -157,19 +157,19 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
typedef std::list<AbstractSplineWidget*> CSplineCtrls;
|
||||
using CSplineCtrls = std::list<AbstractSplineWidget *>;
|
||||
|
||||
static AbstractSplineWidget* FindControl(AbstractSplineWidget* pCtrl)
|
||||
{
|
||||
if (!pCtrl)
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto iter = std::find(s_activeCtrls.begin(), s_activeCtrls.end(), pCtrl);
|
||||
if (iter == s_activeCtrls.end())
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return *iter;
|
||||
@@ -193,10 +193,10 @@ public:
|
||||
|
||||
static CSplineCtrls s_activeCtrls;
|
||||
|
||||
virtual bool IsSelectionChanged() const
|
||||
bool IsSelectionChanged() const override
|
||||
{
|
||||
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
|
||||
ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : 0);
|
||||
ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : nullptr);
|
||||
|
||||
for (auto it = m_splineEntries.begin(); it != m_splineEntries.end(); ++it)
|
||||
{
|
||||
@@ -256,11 +256,11 @@ SplineWidget::~SplineWidget()
|
||||
AbstractSplineWidget::AbstractSplineWidget()
|
||||
: m_defaultKeyTangentType(SPLINE_KEY_TANGENT_NONE)
|
||||
{
|
||||
m_pTimelineCtrl = 0;
|
||||
m_pTimelineCtrl = nullptr;
|
||||
|
||||
m_totalSplineCount = 0;
|
||||
m_pHitSpline = 0;
|
||||
m_pHitDetailSpline = 0;
|
||||
m_pHitSpline = nullptr;
|
||||
m_pHitDetailSpline = nullptr;
|
||||
m_nHitKeyIndex = -1;
|
||||
m_nHitDimension = -1;
|
||||
m_bHitIncomingHandle = true;
|
||||
@@ -301,7 +301,7 @@ AbstractSplineWidget::AbstractSplineWidget()
|
||||
|
||||
m_boLeftMouseButtonDown = false;
|
||||
|
||||
m_pSplineSet = 0;
|
||||
m_pSplineSet = nullptr;
|
||||
|
||||
m_controlAmplitude = false;
|
||||
|
||||
@@ -1633,7 +1633,7 @@ void SplineWidget::wheelEvent(QWheelEvent* event)
|
||||
|
||||
void SplineWidget::keyPressEvent(QKeyEvent* e)
|
||||
{
|
||||
BOOL bProcessed = false;
|
||||
bool bProcessed = false;
|
||||
|
||||
switch (e->key())
|
||||
{
|
||||
@@ -1780,7 +1780,7 @@ void AbstractSplineWidget::SetHorizontalExtent([[maybe_unused]] int min, [[maybe
|
||||
//si.nPage = max(0,m_rcClient.Width() - m_leftOffset*2);
|
||||
//si.nPage = 1;
|
||||
//si.nPage = 1;
|
||||
SetScrollInfo( SB_HORZ,&si,TRUE );
|
||||
SetScrollInfo( SB_HORZ,&si,true );
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -1792,7 +1792,7 @@ ISplineInterpolator* AbstractSplineWidget::HitSpline(const QPoint& point)
|
||||
return m_pHitSpline;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1806,8 +1806,8 @@ AbstractSplineWidget::EHitCode AbstractSplineWidget::HitTest(const QPoint& point
|
||||
PointToTimeValue(point, time, val);
|
||||
|
||||
m_hitCode = HIT_NOTHING;
|
||||
m_pHitSpline = NULL;
|
||||
m_pHitDetailSpline = NULL;
|
||||
m_pHitSpline = nullptr;
|
||||
m_pHitDetailSpline = nullptr;
|
||||
m_nHitKeyIndex = -1;
|
||||
m_nHitDimension = -1;
|
||||
m_bHitIncomingHandle = true;
|
||||
@@ -1968,8 +1968,8 @@ void AbstractSplineWidget::StopTracking()
|
||||
void AbstractSplineWidget::ScaleAmplitudeKeys(float time, float startValue, float offset)
|
||||
{
|
||||
//TODO: Test it in the facial animation pane and fix it...
|
||||
m_pHitSpline = 0;
|
||||
m_pHitDetailSpline = 0;
|
||||
m_pHitSpline = nullptr;
|
||||
m_pHitDetailSpline = nullptr;
|
||||
m_nHitKeyIndex = -1;
|
||||
m_nHitDimension = -1;
|
||||
|
||||
@@ -2071,8 +2071,8 @@ void AbstractSplineWidget::TimeScaleKeys(float time, float startTime, float endT
|
||||
float timeScaleC = endTime - startTime * timeScaleM;
|
||||
|
||||
// Loop through all keys that are selected.
|
||||
m_pHitSpline = 0;
|
||||
m_pHitDetailSpline = 0;
|
||||
m_pHitSpline = nullptr;
|
||||
m_pHitDetailSpline = nullptr;
|
||||
m_nHitKeyIndex = -1;
|
||||
|
||||
float affectedRangeMin = FLT_MAX;
|
||||
@@ -2179,8 +2179,8 @@ void AbstractSplineWidget::ValueScaleKeys(float startValue, float endValue)
|
||||
}
|
||||
|
||||
// Loop through all keys that are selected.
|
||||
m_pHitSpline = 0;
|
||||
m_pHitDetailSpline = 0;
|
||||
m_pHitSpline = nullptr;
|
||||
m_pHitDetailSpline = nullptr;
|
||||
m_nHitKeyIndex = -1;
|
||||
m_nHitDimension = -1;
|
||||
|
||||
@@ -2212,8 +2212,8 @@ void AbstractSplineWidget::ValueScaleKeys(float startValue, float endValue)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void AbstractSplineWidget::MoveSelectedKeys(Vec2 offset, bool copyKeys)
|
||||
{
|
||||
m_pHitSpline = 0;
|
||||
m_pHitDetailSpline = 0;
|
||||
m_pHitSpline = nullptr;
|
||||
m_pHitDetailSpline = nullptr;
|
||||
m_nHitKeyIndex = -1;
|
||||
m_nHitDimension = -1;
|
||||
|
||||
@@ -2275,8 +2275,8 @@ void AbstractSplineWidget::RemoveKey(ISplineInterpolator* pSpline, int nKey)
|
||||
|
||||
SendNotifyEvent(SPLN_BEFORE_CHANGE);
|
||||
|
||||
m_pHitSpline = 0;
|
||||
m_pHitDetailSpline = 0;
|
||||
m_pHitSpline = nullptr;
|
||||
m_pHitDetailSpline = nullptr;
|
||||
m_nHitKeyIndex = -1;
|
||||
if (nKey != -1)
|
||||
{
|
||||
@@ -2294,8 +2294,8 @@ void AbstractSplineWidget::RemoveSelectedKeys()
|
||||
|
||||
SendNotifyEvent(SPLN_BEFORE_CHANGE);
|
||||
|
||||
m_pHitSpline = 0;
|
||||
m_pHitDetailSpline = 0;
|
||||
m_pHitSpline = nullptr;
|
||||
m_pHitDetailSpline = nullptr;
|
||||
m_nHitKeyIndex = -1;
|
||||
|
||||
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
|
||||
@@ -2558,11 +2558,11 @@ public:
|
||||
};
|
||||
void AbstractSplineWidget::DuplicateSelectedKeys()
|
||||
{
|
||||
m_pHitSpline = 0;
|
||||
m_pHitDetailSpline = 0;
|
||||
m_pHitSpline = nullptr;
|
||||
m_pHitDetailSpline = nullptr;
|
||||
m_nHitKeyIndex = -1;
|
||||
|
||||
typedef std::vector<CKeyCopyInfo> KeysToAddContainer;
|
||||
using KeysToAddContainer = std::vector<CKeyCopyInfo>;
|
||||
KeysToAddContainer keysToInsert;
|
||||
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
|
||||
{
|
||||
@@ -2600,7 +2600,7 @@ void AbstractSplineWidget::ZeroAll()
|
||||
{
|
||||
GetIEditor()->BeginUndo();
|
||||
|
||||
typedef std::vector<ISplineInterpolator*> SplineContainer;
|
||||
using SplineContainer = std::vector<ISplineInterpolator *>;
|
||||
SplineContainer splines;
|
||||
for (int splineIndex = 0; splineIndex < int(m_splines.size()); ++splineIndex)
|
||||
{
|
||||
@@ -2632,7 +2632,7 @@ void AbstractSplineWidget::KeyAll()
|
||||
{
|
||||
GetIEditor()->BeginUndo();
|
||||
|
||||
typedef std::vector<ISplineInterpolator*> SplineContainer;
|
||||
using SplineContainer = std::vector<ISplineInterpolator *>;
|
||||
SplineContainer splines;
|
||||
for (int splineIndex = 0; splineIndex < int(m_splines.size()); ++splineIndex)
|
||||
{
|
||||
|
||||
@@ -53,8 +53,8 @@ class QRubberBand;
|
||||
class ISplineSet
|
||||
{
|
||||
public:
|
||||
virtual ISplineInterpolator* GetSplineFromID(const string& id) = 0;
|
||||
virtual string GetIDFromSpline(ISplineInterpolator* pSpline) = 0;
|
||||
virtual ISplineInterpolator* GetSplineFromID(const AZStd::string& id) = 0;
|
||||
virtual AZStd::string GetIDFromSpline(ISplineInterpolator* pSpline) = 0;
|
||||
virtual int GetSplineCount() const = 0;
|
||||
virtual int GetKeyCountAtTime(float time, float threshold) const = 0;
|
||||
};
|
||||
|
||||
@@ -58,7 +58,7 @@ TimelineWidget::TimelineWidget(QWidget* parent /* = nullptr */)
|
||||
|
||||
m_bIgnoreSetTime = false;
|
||||
|
||||
m_pKeyTimeSet = 0;
|
||||
m_pKeyTimeSet = nullptr;
|
||||
|
||||
m_markerStyle = MARKER_STYLE_SECONDS;
|
||||
m_fps = 30.0f;
|
||||
|
||||
@@ -80,12 +80,12 @@ namespace
|
||||
, m_trigger(trigger)
|
||||
{}
|
||||
|
||||
virtual ~EditorListener()
|
||||
~EditorListener() override
|
||||
{
|
||||
GetIEditor()->UnregisterNotifyListener(this);
|
||||
}
|
||||
|
||||
void OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
void OnEditorNotifyEvent(EEditorNotifyEvent event) override
|
||||
{
|
||||
m_trigger(event);
|
||||
}
|
||||
@@ -544,12 +544,12 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe
|
||||
|
||||
auto snapMenu = modifyMenu.AddMenu(tr("Snap"));
|
||||
|
||||
snapMenu.AddAction(ID_SNAPANGLE);
|
||||
snapMenu.AddAction(AzToolsFramework::SnapAngle);
|
||||
|
||||
auto transformModeMenu = modifyMenu.AddMenu(tr("Transform Mode"));
|
||||
transformModeMenu.AddAction(ID_EDITMODE_MOVE);
|
||||
transformModeMenu.AddAction(ID_EDITMODE_ROTATE);
|
||||
transformModeMenu.AddAction(ID_EDITMODE_SCALE);
|
||||
transformModeMenu.AddAction(AzToolsFramework::EditModeMove);
|
||||
transformModeMenu.AddAction(AzToolsFramework::EditModeRotate);
|
||||
transformModeMenu.AddAction(AzToolsFramework::EditModeScale);
|
||||
|
||||
editMenu.AddSeparator();
|
||||
|
||||
|
||||
@@ -206,11 +206,8 @@ namespace
|
||||
|
||||
static void LogToDebug([[maybe_unused]] QtMsgType Type, [[maybe_unused]] const QMessageLogContext& Context, const QString& message)
|
||||
{
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
OutputDebugStringW(L"Qt: ");
|
||||
OutputDebugStringW(reinterpret_cast<const wchar_t*>(message.utf16()));
|
||||
OutputDebugStringW(L"\n");
|
||||
#endif
|
||||
AZ::Debug::Platform::OutputToDebugger("Qt", message.toUtf8().data());
|
||||
AZ::Debug::Platform::OutputToDebugger(nullptr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,7 +420,7 @@ namespace Editor
|
||||
{
|
||||
UINT rawInputSize;
|
||||
const UINT rawInputHeaderSize = sizeof(RAWINPUTHEADER);
|
||||
GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, NULL, &rawInputSize, rawInputHeaderSize);
|
||||
GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, nullptr, &rawInputSize, rawInputHeaderSize);
|
||||
|
||||
AZStd::array<BYTE, sizeof(RAWINPUT)> rawInputBytesArray;
|
||||
LPBYTE rawInputBytes = rawInputBytesArray.data();
|
||||
|
||||
@@ -26,7 +26,7 @@ class EditorCoreTestEnvironment
|
||||
public:
|
||||
AZ_TEST_CLASS_ALLOCATOR(EditorCoreTestEnvironment);
|
||||
|
||||
virtual ~EditorCoreTestEnvironment()
|
||||
~EditorCoreTestEnvironment() override
|
||||
{
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
AZ::AllocatorScope<AZ::OSAllocator, AZ::SystemAllocator, AZ::LegacyAllocator, CryStringAllocator> m_allocatorScope;
|
||||
AZ::AllocatorScope<AZ::OSAllocator, AZ::SystemAllocator, AZ::LegacyAllocator> m_allocatorScope;
|
||||
SSystemGlobalEnvironment m_stubEnv;
|
||||
AZ::IO::LocalFileIO m_fileIO;
|
||||
NiceMock<CryPakMock>* m_cryPak;
|
||||
|
||||
@@ -62,7 +62,7 @@ int crtAllocHook(int nAllocType, void* pvData,
|
||||
{
|
||||
if (nBlockUse == _CRT_BLOCK)
|
||||
{
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int total_cnt = 0;
|
||||
|
||||
+55
-219
@@ -127,7 +127,6 @@ AZ_POP_DISABLE_WARNING
|
||||
|
||||
#include "Util/AutoDirectoryRestoreFileDialog.h"
|
||||
#include "Util/EditorAutoLevelLoadTest.h"
|
||||
#include "Util/IndexedFiles.h"
|
||||
#include "AboutDialog.h"
|
||||
#include <AzToolsFramework/PythonTerminal/ScriptHelpDialog.h>
|
||||
|
||||
@@ -267,13 +266,13 @@ CCrySingleDocTemplate* CCryDocManager::SetDefaultTemplate(CCrySingleDocTemplate*
|
||||
// Copied from MFC to get rid of the silly ugly unoverridable doc-type pick dialog
|
||||
void CCryDocManager::OnFileNew()
|
||||
{
|
||||
assert(m_pDefTemplate != NULL);
|
||||
assert(m_pDefTemplate != nullptr);
|
||||
|
||||
m_pDefTemplate->OpenDocumentFile(NULL);
|
||||
m_pDefTemplate->OpenDocumentFile(nullptr);
|
||||
// if returns NULL, the user has already been alerted
|
||||
}
|
||||
BOOL CCryDocManager::DoPromptFileName(QString& fileName, [[maybe_unused]] UINT nIDSTitle,
|
||||
[[maybe_unused]] DWORD lFlags, BOOL bOpenFileDialog, [[maybe_unused]] CDocTemplate* pTemplate)
|
||||
bool CCryDocManager::DoPromptFileName(QString& fileName, [[maybe_unused]] UINT nIDSTitle,
|
||||
[[maybe_unused]] DWORD lFlags, bool bOpenFileDialog, [[maybe_unused]] CDocTemplate* pTemplate)
|
||||
{
|
||||
CLevelFileDialog levelFileDialog(bOpenFileDialog);
|
||||
levelFileDialog.show();
|
||||
@@ -287,15 +286,15 @@ BOOL CCryDocManager::DoPromptFileName(QString& fileName, [[maybe_unused]] UINT n
|
||||
|
||||
return false;
|
||||
}
|
||||
CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToMRU)
|
||||
CCryEditDoc* CCryDocManager::OpenDocumentFile(const char* lpszFileName, bool bAddToMRU)
|
||||
{
|
||||
assert(lpszFileName != NULL);
|
||||
assert(lpszFileName != nullptr);
|
||||
|
||||
// find the highest confidence
|
||||
auto pos = m_templateList.begin();
|
||||
CCrySingleDocTemplate::Confidence bestMatch = CCrySingleDocTemplate::noAttempt;
|
||||
CCrySingleDocTemplate* pBestTemplate = NULL;
|
||||
CCryEditDoc* pOpenDocument = NULL;
|
||||
CCrySingleDocTemplate* pBestTemplate = nullptr;
|
||||
CCryEditDoc* pOpenDocument = nullptr;
|
||||
|
||||
if (lpszFileName[0] == '\"')
|
||||
{
|
||||
@@ -312,7 +311,7 @@ CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToM
|
||||
auto pTemplate = *(pos++);
|
||||
|
||||
CCrySingleDocTemplate::Confidence match;
|
||||
assert(pOpenDocument == NULL);
|
||||
assert(pOpenDocument == nullptr);
|
||||
match = pTemplate->MatchDocType(szPath.toUtf8().data(), pOpenDocument);
|
||||
if (match > bestMatch)
|
||||
{
|
||||
@@ -325,18 +324,18 @@ CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToM
|
||||
}
|
||||
}
|
||||
|
||||
if (pOpenDocument != NULL)
|
||||
if (pOpenDocument != nullptr)
|
||||
{
|
||||
return pOpenDocument;
|
||||
}
|
||||
|
||||
if (pBestTemplate == NULL)
|
||||
if (pBestTemplate == nullptr)
|
||||
{
|
||||
QMessageBox::critical(AzToolsFramework::GetActiveWindow(), QString(), QObject::tr("Failed to open document."));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return pBestTemplate->OpenDocumentFile(szPath.toUtf8().data(), bAddToMRU, FALSE);
|
||||
return pBestTemplate->OpenDocumentFile(szPath.toUtf8().data(), bAddToMRU, false);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -375,9 +374,6 @@ void CCryEditApp::RegisterActionHandlers()
|
||||
});
|
||||
ON_COMMAND(ID_MOVE_OBJECT, OnMoveObject)
|
||||
ON_COMMAND(ID_RENAME_OBJ, OnRenameObj)
|
||||
ON_COMMAND(ID_EDITMODE_MOVE, OnEditmodeMove)
|
||||
ON_COMMAND(ID_EDITMODE_ROTATE, OnEditmodeRotate)
|
||||
ON_COMMAND(ID_EDITMODE_SCALE, OnEditmodeScale)
|
||||
ON_COMMAND(ID_UNDO, OnUndo)
|
||||
ON_COMMAND(ID_TOOLBAR_WIDGET_REDO, OnUndo) // Can't use the same ID, because for the menu we can't have a QWidgetAction, while for the toolbar we want one
|
||||
ON_COMMAND(ID_IMPORT_ASSET, OnOpenAssetImporter)
|
||||
@@ -464,7 +460,7 @@ void CCryEditApp::RegisterActionHandlers()
|
||||
ON_COMMAND(ID_FILE_SAVE_LEVEL, OnFileSave)
|
||||
ON_COMMAND(ID_FILE_EXPORTOCCLUSIONMESH, OnFileExportOcclusionMesh)
|
||||
|
||||
// Project Manager
|
||||
// Project Manager
|
||||
ON_COMMAND(ID_FILE_PROJECT_MANAGER_SETTINGS, OnOpenProjectManagerSettings)
|
||||
ON_COMMAND(ID_FILE_PROJECT_MANAGER_NEW, OnOpenProjectManagerNew)
|
||||
ON_COMMAND(ID_FILE_PROJECT_MANAGER_OPEN, OnOpenProjectManager)
|
||||
@@ -657,7 +653,7 @@ struct SharedData
|
||||
//
|
||||
// This function uses a technique similar to that described in KB
|
||||
// article Q141752 to locate the previous instance of the application. .
|
||||
BOOL CCryEditApp::FirstInstance(bool bForceNewInstance)
|
||||
bool CCryEditApp::FirstInstance(bool bForceNewInstance)
|
||||
{
|
||||
QSystemSemaphore sem(QString(O3DEApplicationName) + "_sem", 1);
|
||||
sem.acquire();
|
||||
@@ -805,12 +801,12 @@ void CCryEditApp::InitDirectory()
|
||||
// Needed to work with custom memory manager.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible /*= true*/)
|
||||
CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(const char* lpszPathName, bool bMakeVisible /*= true*/)
|
||||
{
|
||||
return OpenDocumentFile(lpszPathName, true, bMakeVisible);
|
||||
}
|
||||
|
||||
CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bAddToMRU, [[maybe_unused]] BOOL bMakeVisible)
|
||||
CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(const char* lpszPathName, bool bAddToMRU, [[maybe_unused]] bool bMakeVisible)
|
||||
{
|
||||
CCryEditDoc* pCurDoc = GetIEditor()->GetDocument();
|
||||
|
||||
@@ -849,10 +845,10 @@ CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL
|
||||
return pCurDoc;
|
||||
}
|
||||
|
||||
CCrySingleDocTemplate::Confidence CCrySingleDocTemplate::MatchDocType(LPCTSTR lpszPathName, CCryEditDoc*& rpDocMatch)
|
||||
CCrySingleDocTemplate::Confidence CCrySingleDocTemplate::MatchDocType(const char* lpszPathName, CCryEditDoc*& rpDocMatch)
|
||||
{
|
||||
assert(lpszPathName != NULL);
|
||||
rpDocMatch = NULL;
|
||||
assert(lpszPathName != nullptr);
|
||||
rpDocMatch = nullptr;
|
||||
|
||||
// go through all documents
|
||||
CCryEditDoc* pDoc = GetIEditor()->GetDocument();
|
||||
@@ -895,8 +891,7 @@ CCrySingleDocTemplate::Confidence CCrySingleDocTemplate::MatchDocType(LPCTSTR lp
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
namespace
|
||||
{
|
||||
CryMutex g_splashScreenStateLock;
|
||||
CryConditionVariable g_splashScreenStateChange;
|
||||
AZStd::mutex g_splashScreenStateLock;
|
||||
enum ESplashScreenState
|
||||
{
|
||||
eSplashScreenState_Init, eSplashScreenState_Started, eSplashScreenState_Destroy
|
||||
@@ -927,7 +922,7 @@ QString FormatRichTextCopyrightNotice()
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::ShowSplashScreen(CCryEditApp* app)
|
||||
{
|
||||
g_splashScreenStateLock.Lock();
|
||||
g_splashScreenStateLock.lock();
|
||||
|
||||
CStartupLogoDialog* splashScreen = new CStartupLogoDialog(FormatVersion(app->m_pEditor->GetFileVersion()), FormatRichTextCopyrightNotice());
|
||||
|
||||
@@ -935,8 +930,7 @@ void CCryEditApp::ShowSplashScreen(CCryEditApp* app)
|
||||
g_splashScreen = splashScreen;
|
||||
g_splashScreenState = eSplashScreenState_Started;
|
||||
|
||||
g_splashScreenStateLock.Unlock();
|
||||
g_splashScreenStateChange.Notify();
|
||||
g_splashScreenStateLock.unlock();
|
||||
|
||||
splashScreen->show();
|
||||
// Make sure the initial paint of the splash screen occurs so we dont get stuck with a blank window
|
||||
@@ -944,10 +938,9 @@ void CCryEditApp::ShowSplashScreen(CCryEditApp* app)
|
||||
|
||||
QObject::connect(splashScreen, &QObject::destroyed, splashScreen, [=]
|
||||
{
|
||||
g_splashScreenStateLock.Lock();
|
||||
AZStd::scoped_lock lock(g_splashScreenStateLock);
|
||||
g_pInitializeUIInfo = nullptr;
|
||||
g_splashScreen = nullptr;
|
||||
g_splashScreenStateLock.Unlock();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -977,9 +970,9 @@ void CCryEditApp::CloseSplashScreen()
|
||||
if (CStartupLogoDialog::instance())
|
||||
{
|
||||
delete CStartupLogoDialog::instance();
|
||||
g_splashScreenStateLock.Lock();
|
||||
g_splashScreenStateLock.lock();
|
||||
g_splashScreenState = eSplashScreenState_Destroy;
|
||||
g_splashScreenStateLock.Unlock();
|
||||
g_splashScreenStateLock.unlock();
|
||||
}
|
||||
|
||||
GetIEditor()->Notify(eNotify_OnSplashScreenDestroyed);
|
||||
@@ -988,12 +981,12 @@ void CCryEditApp::CloseSplashScreen()
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OutputStartupMessage(QString str)
|
||||
{
|
||||
g_splashScreenStateLock.Lock();
|
||||
g_splashScreenStateLock.lock();
|
||||
if (g_pInitializeUIInfo)
|
||||
{
|
||||
g_pInitializeUIInfo->SetInfoText(str.toUtf8().data());
|
||||
}
|
||||
g_splashScreenStateLock.Unlock();
|
||||
g_splashScreenStateLock.unlock();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -1059,7 +1052,7 @@ AZ::Outcome<void, AZStd::string> CCryEditApp::InitGameSystem(HWND hwndForInputSy
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
BOOL CCryEditApp::CheckIfAlreadyRunning()
|
||||
bool CCryEditApp::CheckIfAlreadyRunning()
|
||||
{
|
||||
bool bForceNewInstance = false;
|
||||
|
||||
@@ -1303,7 +1296,7 @@ void CCryEditApp::InitLevel(const CEditCommandLineInfo& cmdInfo)
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
BOOL CCryEditApp::InitConsole()
|
||||
bool CCryEditApp::InitConsole()
|
||||
{
|
||||
// Execute command from cmdline -exec_line if applicable
|
||||
if (!m_execLineCmd.isEmpty())
|
||||
@@ -1435,7 +1428,7 @@ struct CCryEditApp::PythonOutputHandler
|
||||
AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
virtual ~PythonOutputHandler()
|
||||
~PythonOutputHandler() override
|
||||
{
|
||||
AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusDisconnect();
|
||||
}
|
||||
@@ -1467,7 +1460,7 @@ struct PythonTestOutputHandler final
|
||||
: public CCryEditApp::PythonOutputHandler
|
||||
{
|
||||
PythonTestOutputHandler() = default;
|
||||
virtual ~PythonTestOutputHandler() = default;
|
||||
~PythonTestOutputHandler() override = default;
|
||||
|
||||
void OnTraceMessage(AZStd::string_view message) override
|
||||
{
|
||||
@@ -1593,7 +1586,7 @@ void CCryEditApp::RunInitPythonScript(CEditCommandLineInfo& cmdInfo)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCryEditApp initialization
|
||||
BOOL CCryEditApp::InitInstance()
|
||||
bool CCryEditApp::InitInstance()
|
||||
{
|
||||
QElapsedTimer startupTimer;
|
||||
startupTimer.start();
|
||||
@@ -1620,7 +1613,7 @@ BOOL CCryEditApp::InitInstance()
|
||||
{
|
||||
CAboutDialog aboutDlg(FormatVersion(m_pEditor->GetFileVersion()), FormatRichTextCopyrightNotice());
|
||||
aboutDlg.exec();
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reflect property control classes to the serialize context...
|
||||
@@ -1630,9 +1623,6 @@ BOOL CCryEditApp::InitInstance()
|
||||
ReflectedVarInit::setupReflection(serializeContext);
|
||||
RegisterReflectedVarHandlers();
|
||||
|
||||
|
||||
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
|
||||
|
||||
CreateSplashScreen();
|
||||
|
||||
// Register the application's document templates. Document templates
|
||||
@@ -1718,18 +1708,6 @@ BOOL CCryEditApp::InitInstance()
|
||||
|
||||
if (IsInRegularEditorMode())
|
||||
{
|
||||
CIndexedFiles::Create();
|
||||
|
||||
if (gEnv->pConsole->GetCVar("ed_indexfiles")->GetIVal())
|
||||
{
|
||||
Log("Started game resource files indexing...");
|
||||
CIndexedFiles::StartFileIndexing();
|
||||
}
|
||||
else
|
||||
{
|
||||
Log("Game resource files indexing is disabled.");
|
||||
}
|
||||
|
||||
// QuickAccessBar creation should be before m_pMainWnd->SetFocus(),
|
||||
// since it receives the focus at creation time. It brakes MainFrame key accelerators.
|
||||
m_pQuickAccessBar = new CQuickAccessBar;
|
||||
@@ -1775,7 +1753,7 @@ BOOL CCryEditApp::InitInstance()
|
||||
}
|
||||
}
|
||||
|
||||
SetEditorWindowTitle(0, AZ::Utils::GetProjectName().c_str(), 0);
|
||||
SetEditorWindowTitle(nullptr, AZ::Utils::GetProjectName().c_str(), nullptr);
|
||||
if (!GetIEditor()->IsInMatEditMode())
|
||||
{
|
||||
m_pEditor->InitFinished();
|
||||
@@ -1860,8 +1838,8 @@ void CCryEditApp::RegisterEventLoopHook(IEventLoopHook* pHook)
|
||||
|
||||
void CCryEditApp::UnregisterEventLoopHook(IEventLoopHook* pHookToRemove)
|
||||
{
|
||||
IEventLoopHook* pPrevious = 0;
|
||||
for (IEventLoopHook* pHook = m_pEventLoopHook; pHook != 0; pHook = pHook->pNextHook)
|
||||
IEventLoopHook* pPrevious = nullptr;
|
||||
for (IEventLoopHook* pHook = m_pEventLoopHook; pHook != nullptr; pHook = pHook->pNextHook)
|
||||
{
|
||||
if (pHook == pHookToRemove)
|
||||
{
|
||||
@@ -1874,7 +1852,7 @@ void CCryEditApp::UnregisterEventLoopHook(IEventLoopHook* pHookToRemove)
|
||||
m_pEventLoopHook = pHookToRemove->pNextHook;
|
||||
}
|
||||
|
||||
pHookToRemove->pNextHook = 0;
|
||||
pHookToRemove->pNextHook = nullptr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1883,11 +1861,6 @@ void CCryEditApp::UnregisterEventLoopHook(IEventLoopHook* pHookToRemove)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::LoadFile(QString fileName)
|
||||
{
|
||||
//CEditCommandLineInfo cmdLine;
|
||||
//ProcessCommandLine(cmdinfo);
|
||||
|
||||
//bool bBuilding = false;
|
||||
//CString file = cmdLine.SpanExcluding()
|
||||
if (GetIEditor()->GetViewManager()->GetViewCount() == 0)
|
||||
{
|
||||
return;
|
||||
@@ -1897,7 +1870,7 @@ void CCryEditApp::LoadFile(QString fileName)
|
||||
|
||||
if (MainWindow::instance() || m_pConsoleDialog)
|
||||
{
|
||||
SetEditorWindowTitle(0, AZ::Utils::GetProjectName().c_str(), GetIEditor()->GetGameEngine()->GetLevelName());
|
||||
SetEditorWindowTitle(nullptr, AZ::Utils::GetProjectName().c_str(), GetIEditor()->GetGameEngine()->GetLevelName());
|
||||
}
|
||||
|
||||
GetIEditor()->SetModifiedFlag(false);
|
||||
@@ -1938,7 +1911,7 @@ void CCryEditApp::EnableAccelerator([[maybe_unused]] bool bEnable)
|
||||
CMainFrame *mainFrame = (CMainFrame*)m_pMainWnd;
|
||||
if (mainFrame->m_hAccelTable)
|
||||
DestroyAcceleratorTable( mainFrame->m_hAccelTable );
|
||||
mainFrame->m_hAccelTable = NULL;
|
||||
mainFrame->m_hAccelTable = nullptr;
|
||||
mainFrame->LoadAccelTable( MAKEINTRESOURCE(IDR_GAMEACCELERATOR) );
|
||||
CLogFile::WriteLine( "Disable Accelerators" );
|
||||
}
|
||||
@@ -2166,12 +2139,6 @@ int CCryEditApp::ExitInstance(int exitCode)
|
||||
}
|
||||
}
|
||||
|
||||
if (IsInRegularEditorMode())
|
||||
{
|
||||
CIndexedFiles::AbortFileIndexing();
|
||||
CIndexedFiles::Destroy();
|
||||
}
|
||||
|
||||
if (GetIEditor() && !GetIEditor()->IsInMatEditMode())
|
||||
{
|
||||
//Nobody seems to know in what case that kind of exit can happen so instrumented to see if it happens at all
|
||||
@@ -2281,7 +2248,7 @@ void CCryEditApp::EnableIdleProcessing()
|
||||
AZ_Assert(m_disableIdleProcessingCounter >= 0, "m_disableIdleProcessingCounter must be nonnegative");
|
||||
}
|
||||
|
||||
BOOL CCryEditApp::OnIdle([[maybe_unused]] LONG lCount)
|
||||
bool CCryEditApp::OnIdle([[maybe_unused]] LONG lCount)
|
||||
{
|
||||
if (0 == m_disableIdleProcessingCounter)
|
||||
{
|
||||
@@ -2289,7 +2256,7 @@ BOOL CCryEditApp::OnIdle([[maybe_unused]] LONG lCount)
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2579,75 +2546,6 @@ void CCryEditApp::OnRenameObj()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnEditmodeMove()
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
EditorTransformComponentSelectionRequestBus::Event(
|
||||
GetEntityContextId(),
|
||||
&EditorTransformComponentSelectionRequests::SetTransformMode,
|
||||
EditorTransformComponentSelectionRequests::Mode::Translation);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnEditmodeRotate()
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
EditorTransformComponentSelectionRequestBus::Event(
|
||||
GetEntityContextId(),
|
||||
&EditorTransformComponentSelectionRequests::SetTransformMode,
|
||||
EditorTransformComponentSelectionRequests::Mode::Rotation);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnEditmodeScale()
|
||||
{
|
||||
using namespace AzToolsFramework;
|
||||
EditorTransformComponentSelectionRequestBus::Event(
|
||||
GetEntityContextId(),
|
||||
&EditorTransformComponentSelectionRequests::SetTransformMode,
|
||||
EditorTransformComponentSelectionRequests::Mode::Scale);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnUpdateEditmodeMove(QAction* action)
|
||||
{
|
||||
Q_ASSERT(action->isCheckable());
|
||||
|
||||
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
|
||||
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
|
||||
mode, AzToolsFramework::GetEntityContextId(),
|
||||
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
|
||||
|
||||
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Translation);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnUpdateEditmodeRotate(QAction* action)
|
||||
{
|
||||
Q_ASSERT(action->isCheckable());
|
||||
|
||||
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
|
||||
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
|
||||
mode, AzToolsFramework::GetEntityContextId(),
|
||||
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
|
||||
|
||||
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Rotation);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnUpdateEditmodeScale(QAction* action)
|
||||
{
|
||||
Q_ASSERT(action->isCheckable());
|
||||
|
||||
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
|
||||
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
|
||||
mode, AzToolsFramework::GetEntityContextId(),
|
||||
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
|
||||
|
||||
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Scale);
|
||||
}
|
||||
|
||||
void CCryEditApp::OnViewSwitchToGame()
|
||||
{
|
||||
if (IsInPreviewMode())
|
||||
@@ -3233,7 +3131,7 @@ void CCryEditApp::OnCreateLevel()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
|
||||
{
|
||||
BOOL bIsDocModified = GetIEditor()->GetDocument()->IsModified();
|
||||
bool bIsDocModified = GetIEditor()->GetDocument()->IsModified();
|
||||
if (GetIEditor()->GetDocument()->IsDocumentReady() && bIsDocModified)
|
||||
{
|
||||
QString str = QObject::tr("Level %1 has been changed. Save Level?").arg(GetIEditor()->GetGameEngine()->GetLevelName());
|
||||
@@ -3287,7 +3185,7 @@ bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
|
||||
GetIEditor()->GetDocument()->DeleteTemporaryLevel();
|
||||
}
|
||||
|
||||
if (levelName.length() == 0 || !CryStringUtils::IsValidFileName(levelName.toUtf8().data()))
|
||||
if (levelName.length() == 0 || !AZ::StringFunc::Path::IsValid(levelName.toUtf8().data()))
|
||||
{
|
||||
QMessageBox::critical(AzToolsFramework::GetActiveWindow(), QString(), QObject::tr("Level name is invalid, please choose another name."));
|
||||
return false;
|
||||
@@ -3320,13 +3218,16 @@ bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
|
||||
DWORD dw = GetLastError();
|
||||
|
||||
#ifdef WIN32
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,
|
||||
wchar_t windowsErrorMessageW[ERROR_LEN];
|
||||
windowsErrorMessageW[0] = L'\0';
|
||||
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
nullptr,
|
||||
dw,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
windowsErrorMessage.data(),
|
||||
windowsErrorMessage.length(), NULL);
|
||||
windowsErrorMessageW,
|
||||
ERROR_LEN, nullptr);
|
||||
_getcwd(cwd.data(), cwd.length());
|
||||
AZStd::to_string(windowsErrorMessage.data(), ERROR_LEN, windowsErrorMessageW);
|
||||
#else
|
||||
windowsErrorMessage = strerror(dw);
|
||||
cwd = QDir::currentPath().toUtf8();
|
||||
@@ -3400,7 +3301,7 @@ void CCryEditApp::OnOpenSlice()
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CCryEditDoc* CCryEditApp::OpenDocumentFile(LPCTSTR lpszFileName)
|
||||
CCryEditDoc* CCryEditApp::OpenDocumentFile(const char* lpszFileName)
|
||||
{
|
||||
if (m_openingLevel)
|
||||
{
|
||||
@@ -3735,24 +3636,12 @@ void CCryEditApp::OnToolsPreferences()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnSwitchToDefaultCamera()
|
||||
{
|
||||
CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
|
||||
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
|
||||
{
|
||||
rvp->SetDefaultCamera();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnUpdateSwitchToDefaultCamera(QAction* action)
|
||||
{
|
||||
Q_ASSERT(action->isCheckable());
|
||||
CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
|
||||
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(pViewport))
|
||||
{
|
||||
action->setEnabled(true);
|
||||
action->setChecked(rvp->IsDefaultCamera());
|
||||
}
|
||||
else
|
||||
{
|
||||
action->setEnabled(false);
|
||||
}
|
||||
@@ -3761,39 +3650,12 @@ void CCryEditApp::OnUpdateSwitchToDefaultCamera(QAction* action)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnSwitchToSequenceCamera()
|
||||
{
|
||||
CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
|
||||
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
|
||||
{
|
||||
rvp->SetSequenceCamera();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnUpdateSwitchToSequenceCamera(QAction* action)
|
||||
{
|
||||
Q_ASSERT(action->isCheckable());
|
||||
|
||||
CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
|
||||
|
||||
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(pViewport))
|
||||
{
|
||||
bool enableAction = false;
|
||||
|
||||
// only enable if we're editing a sequence in Track View and have cameras in the level
|
||||
if (GetIEditor()->GetAnimation()->GetSequence())
|
||||
{
|
||||
|
||||
AZ::EBusAggregateResults<AZ::EntityId> componentCameras;
|
||||
Camera::CameraBus::BroadcastResult(componentCameras, &Camera::CameraRequests::GetCameras);
|
||||
|
||||
const int numCameras = componentCameras.values.size();
|
||||
enableAction = (numCameras > 0);
|
||||
}
|
||||
|
||||
action->setEnabled(enableAction);
|
||||
action->setChecked(rvp->IsSequenceCamera());
|
||||
}
|
||||
else
|
||||
{
|
||||
action->setEnabled(false);
|
||||
}
|
||||
@@ -3802,31 +3664,12 @@ void CCryEditApp::OnUpdateSwitchToSequenceCamera(QAction* action)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnSwitchToSelectedcamera()
|
||||
{
|
||||
CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
|
||||
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
|
||||
{
|
||||
rvp->SetSelectedCamera();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnUpdateSwitchToSelectedCamera(QAction* action)
|
||||
{
|
||||
Q_ASSERT(action->isCheckable());
|
||||
AzToolsFramework::EntityIdList selectedEntityList;
|
||||
AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
|
||||
AZ::EBusAggregateResults<AZ::EntityId> cameras;
|
||||
Camera::CameraBus::BroadcastResult(cameras, &Camera::CameraRequests::GetCameras);
|
||||
bool isCameraComponentSelected = selectedEntityList.size() > 0 ? AZStd::find(cameras.values.begin(), cameras.values.end(), *selectedEntityList.begin()) != cameras.values.end() : false;
|
||||
|
||||
CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
|
||||
CRenderViewport* rvp = viewport_cast<CRenderViewport*>(pViewport);
|
||||
if (isCameraComponentSelected && rvp)
|
||||
{
|
||||
action->setEnabled(true);
|
||||
action->setChecked(rvp->IsSelectedCamera());
|
||||
}
|
||||
else
|
||||
{
|
||||
action->setEnabled(false);
|
||||
}
|
||||
@@ -3835,11 +3678,7 @@ void CCryEditApp::OnUpdateSwitchToSelectedCamera(QAction* action)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CCryEditApp::OnSwitchcameraNext()
|
||||
{
|
||||
CViewport* vp = GetIEditor()->GetActiveView();
|
||||
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
|
||||
{
|
||||
rvp->CycleCamera();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -3912,7 +3751,7 @@ bool CCryEditApp::IsInRegularEditorMode()
|
||||
|
||||
void CCryEditApp::OnOpenQuickAccessBar()
|
||||
{
|
||||
if (m_pQuickAccessBar == NULL)
|
||||
if (m_pQuickAccessBar == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -4157,15 +3996,12 @@ struct CryAllocatorsRAII
|
||||
CryAllocatorsRAII()
|
||||
{
|
||||
AZ_Assert(!AZ::AllocatorInstance<AZ::LegacyAllocator>::IsReady(), "Expected allocator to not be initialized, hunt down the static that is initializing it");
|
||||
AZ_Assert(!AZ::AllocatorInstance<CryStringAllocator>::IsReady(), "Expected allocator to not be initialized, hunt down the static that is initializing it");
|
||||
|
||||
AZ::AllocatorInstance<AZ::LegacyAllocator>::Create();
|
||||
AZ::AllocatorInstance<CryStringAllocator>::Create();
|
||||
}
|
||||
|
||||
~CryAllocatorsRAII()
|
||||
{
|
||||
AZ::AllocatorInstance<CryStringAllocator>::Destroy();
|
||||
AZ::AllocatorInstance<AZ::LegacyAllocator>::Destroy();
|
||||
}
|
||||
};
|
||||
@@ -4260,7 +4096,7 @@ extern "C" int AZ_DLL_EXPORT CryEditMain(int argc, char* argv[])
|
||||
|
||||
int exitCode = 0;
|
||||
|
||||
BOOL didCryEditStart = CCryEditApp::instance()->InitInstance();
|
||||
bool didCryEditStart = CCryEditApp::instance()->InitInstance();
|
||||
AZ_Error("Editor", didCryEditStart, "O3DE Editor did not initialize correctly, and will close."
|
||||
"\nThis could be because of incorrectly configured components, or missing required gems."
|
||||
"\nSee other errors for more details.");
|
||||
|
||||
+14
-20
@@ -135,16 +135,16 @@ public:
|
||||
virtual void AddToRecentFileList(const QString& lpszPathName);
|
||||
ECreateLevelResult CreateLevel(const QString& levelName, QString& fullyQualifiedLevelName);
|
||||
static void InitDirectory();
|
||||
BOOL FirstInstance(bool bForceNewInstance = false);
|
||||
bool FirstInstance(bool bForceNewInstance = false);
|
||||
void InitFromCommandLine(CEditCommandLineInfo& cmdInfo);
|
||||
BOOL CheckIfAlreadyRunning();
|
||||
bool CheckIfAlreadyRunning();
|
||||
//! @return successful outcome if initialization succeeded. or failed outcome with error message.
|
||||
AZ::Outcome<void, AZStd::string> InitGameSystem(HWND hwndForInputSystem);
|
||||
void CreateSplashScreen();
|
||||
void InitPlugins();
|
||||
bool InitGame();
|
||||
|
||||
BOOL InitConsole();
|
||||
bool InitConsole();
|
||||
int IdleProcessing(bool bBackground);
|
||||
bool IsWindowInForeground();
|
||||
void RunInitPythonScript(CEditCommandLineInfo& cmdInfo);
|
||||
@@ -171,10 +171,10 @@ public:
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
virtual bool InitInstance();
|
||||
virtual int ExitInstance(int exitCode = 0);
|
||||
virtual BOOL OnIdle(LONG lCount);
|
||||
virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszFileName);
|
||||
virtual bool OnIdle(LONG lCount);
|
||||
virtual CCryEditDoc* OpenDocumentFile(const char* lpszFileName);
|
||||
|
||||
CCryDocManager* GetDocManager() { return m_pDocManager; }
|
||||
|
||||
@@ -208,12 +208,6 @@ public:
|
||||
void DeleteSelectedEntities(bool includeDescendants);
|
||||
void OnMoveObject();
|
||||
void OnRenameObj();
|
||||
void OnEditmodeMove();
|
||||
void OnEditmodeRotate();
|
||||
void OnEditmodeScale();
|
||||
void OnUpdateEditmodeMove(QAction* action);
|
||||
void OnUpdateEditmodeRotate(QAction* action);
|
||||
void OnUpdateEditmodeScale(QAction* action);
|
||||
void OnUndo();
|
||||
void OnOpenAssetImporter();
|
||||
void OnUpdateSelected(QAction* action);
|
||||
@@ -353,7 +347,7 @@ private:
|
||||
// Disable warning for dll export since this member won't be used outside this class
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AZ::IO::FileDescriptorRedirector m_stdoutRedirection = AZ::IO::FileDescriptorRedirector(1); // < 1 for STDOUT
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
private:
|
||||
static inline constexpr const char* DefaultLevelTemplateName = "Prefabs/Default_Level.prefab";
|
||||
@@ -426,7 +420,7 @@ public:
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class CCrySingleDocTemplate
|
||||
class CCrySingleDocTemplate
|
||||
: public QObject
|
||||
{
|
||||
private:
|
||||
@@ -454,9 +448,9 @@ public:
|
||||
~CCrySingleDocTemplate() {};
|
||||
// avoid creating another CMainFrame
|
||||
// close other type docs before opening any things
|
||||
virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszPathName, BOOL bAddToMRU, BOOL bMakeVisible);
|
||||
virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible = TRUE);
|
||||
virtual Confidence MatchDocType(LPCTSTR lpszPathName, CCryEditDoc*& rpDocMatch);
|
||||
virtual CCryEditDoc* OpenDocumentFile(const char* lpszPathName, bool bAddToMRU, bool bMakeVisible);
|
||||
virtual CCryEditDoc* OpenDocumentFile(const char* lpszPathName, bool bMakeVisible = TRUE);
|
||||
virtual Confidence MatchDocType(const char* lpszPathName, CCryEditDoc*& rpDocMatch);
|
||||
|
||||
private:
|
||||
const QMetaObject* m_documentClass = nullptr;
|
||||
@@ -471,9 +465,9 @@ public:
|
||||
CCrySingleDocTemplate* SetDefaultTemplate(CCrySingleDocTemplate* pNew);
|
||||
// Copied from MFC to get rid of the silly ugly unoverridable doc-type pick dialog
|
||||
virtual void OnFileNew();
|
||||
virtual BOOL DoPromptFileName(QString& fileName, UINT nIDSTitle,
|
||||
DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate);
|
||||
virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToMRU);
|
||||
virtual bool DoPromptFileName(QString& fileName, UINT nIDSTitle,
|
||||
DWORD lFlags, bool bOpenFileDialog, CDocTemplate* pTemplate);
|
||||
virtual CCryEditDoc* OpenDocumentFile(const char* lpszFileName, bool bAddToMRU);
|
||||
|
||||
QVector<CCrySingleDocTemplate*> m_templateList;
|
||||
};
|
||||
|
||||
+106
-161
@@ -19,6 +19,7 @@
|
||||
#include <AzCore/Asset/AssetManager.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <MathConversion.h>
|
||||
|
||||
// AzFramework
|
||||
#include <AzFramework/Archive/IArchive.h>
|
||||
@@ -31,9 +32,6 @@
|
||||
#include <AzToolsFramework/API/EditorLevelNotificationBus.h>
|
||||
#include <AzToolsFramework/Entity/PrefabEditorEntityOwnershipInterface.h>
|
||||
|
||||
// CryCommon
|
||||
#include <CryCommon/IAudioSystem.h>
|
||||
|
||||
// Editor
|
||||
#include "Settings.h"
|
||||
|
||||
@@ -53,11 +51,13 @@
|
||||
#include "MainWindow.h"
|
||||
#include "LevelFileDialog.h"
|
||||
#include "StatObjBus.h"
|
||||
#include "Undo/Undo.h"
|
||||
|
||||
#include <Atom/RPI.Public/ViewportContext.h>
|
||||
#include <Atom/RPI.Public/ViewportContextBus.h>
|
||||
|
||||
// LmbrCentral
|
||||
#include <LmbrCentral/Audio/AudioSystemComponentBus.h>
|
||||
#include <LmbrCentral/Rendering/EditorLightComponentBus.h> // for LmbrCentral::EditorLightComponentRequestBus
|
||||
|
||||
//#define PROFILE_LOADING_WITH_VTUNE
|
||||
@@ -95,7 +95,7 @@ namespace Internal
|
||||
{
|
||||
bool SaveLevel()
|
||||
{
|
||||
if (!GetIEditor()->GetDocument()->DoSave(GetIEditor()->GetDocument()->GetActivePathName(), TRUE))
|
||||
if (!GetIEditor()->GetDocument()->DoSave(GetIEditor()->GetDocument()->GetActivePathName(), true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -108,21 +108,12 @@ namespace Internal
|
||||
// CCryEditDoc construction/destruction
|
||||
|
||||
CCryEditDoc::CCryEditDoc()
|
||||
: doc_validate_surface_types(0)
|
||||
: doc_validate_surface_types(nullptr)
|
||||
, m_modifiedModuleFlags(eModifiedNothing)
|
||||
// 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.
|
||||
, m_boLevelExported(true)
|
||||
, m_modified(false)
|
||||
, m_envProbeHeight(200.0f)
|
||||
, m_envProbeSliceRelativePath("EngineAssets/Slices/DefaultLevelSetup.slice")
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Set member variables to initial values
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
m_bLoadFailed = false;
|
||||
m_waterColor = QColor(0, 0, 255);
|
||||
|
||||
m_fogTemplate = GetIEditor()->FindTemplate("Fog");
|
||||
m_environmentTemplate = GetIEditor()->FindTemplate("Environment");
|
||||
@@ -136,7 +127,6 @@ CCryEditDoc::CCryEditDoc()
|
||||
m_environmentTemplate = XmlHelpers::CreateXmlNode("Environment");
|
||||
}
|
||||
|
||||
m_bDocumentReady = false;
|
||||
GetIEditor()->SetDocument(this);
|
||||
CLogFile::WriteLine("Document created");
|
||||
RegisterConsoleVariables();
|
||||
@@ -195,7 +185,7 @@ CCryEditDoc::DocumentEditingMode CCryEditDoc::GetEditMode() const
|
||||
|
||||
QString CCryEditDoc::GetActivePathName() const
|
||||
{
|
||||
return DocumentEditingMode() == CCryEditDoc::DocumentEditingMode::SliceEdit ? GetSlicePathName() : GetLevelPathName();
|
||||
return GetEditMode() == CCryEditDoc::DocumentEditingMode::SliceEdit ? GetSlicePathName() : GetLevelPathName();
|
||||
}
|
||||
|
||||
QString CCryEditDoc::GetTitle() const
|
||||
@@ -260,9 +250,9 @@ void CCryEditDoc::DeleteContents()
|
||||
GetIEditor()->FlushUndo();
|
||||
|
||||
// Notify listeners.
|
||||
for (std::list<IDocListener*>::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
|
||||
for (IDocListener* listener : m_listeners)
|
||||
{
|
||||
(*it)->OnCloseDocument();
|
||||
listener->OnCloseDocument();
|
||||
}
|
||||
|
||||
GetIEditor()->ResetViews();
|
||||
@@ -271,26 +261,13 @@ void CCryEditDoc::DeleteContents()
|
||||
GetIEditor()->GetObjectManager()->DeleteAllObjects();
|
||||
|
||||
// Load scripts data
|
||||
SetModifiedFlag(FALSE);
|
||||
SetModifiedFlag(false);
|
||||
SetModifiedModules(eModifiedNothing);
|
||||
// Clear error reports if open.
|
||||
CErrorReportDialog::Clear();
|
||||
|
||||
// Unload level specific audio binary data.
|
||||
Audio::SAudioManagerRequestData<Audio::eAMRT_UNLOAD_AFCM_DATA_BY_SCOPE> oAMData(Audio::eADS_LEVEL_SPECIFIC);
|
||||
Audio::SAudioRequest oAudioRequestData;
|
||||
oAudioRequestData.nFlags = (Audio::eARF_PRIORITY_HIGH | Audio::eARF_EXECUTE_BLOCKING);
|
||||
oAudioRequestData.pData = &oAMData;
|
||||
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequestBlocking, oAudioRequestData);
|
||||
|
||||
// Now unload level specific audio config data.
|
||||
Audio::SAudioManagerRequestData<Audio::eAMRT_CLEAR_CONTROLS_DATA> oAMData2(Audio::eADS_LEVEL_SPECIFIC);
|
||||
oAudioRequestData.pData = &oAMData2;
|
||||
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequestBlocking, oAudioRequestData);
|
||||
|
||||
Audio::SAudioManagerRequestData<Audio::eAMRT_CLEAR_PRELOADS_DATA> oAMData3(Audio::eADS_LEVEL_SPECIFIC);
|
||||
oAudioRequestData.pData = &oAMData3;
|
||||
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequestBlocking, oAudioRequestData);
|
||||
LmbrCentral::AudioSystemComponentRequestBus::Broadcast(&LmbrCentral::AudioSystemComponentRequestBus::Events::LevelUnloadAudio);
|
||||
|
||||
GetIEditor()->Notify(eNotify_OnSceneClosed);
|
||||
CrySystemEventBus::Broadcast(&CrySystemEventBus::Events::OnCryEditorSceneClosed);
|
||||
@@ -313,7 +290,7 @@ void CCryEditDoc::Save(TDocMultiArchive& arrXmlAr)
|
||||
{
|
||||
CAutoDocNotReady autoDocNotReady;
|
||||
|
||||
if (arrXmlAr[DMAS_GENERAL] != NULL)
|
||||
if (arrXmlAr[DMAS_GENERAL] != nullptr)
|
||||
{
|
||||
(*arrXmlAr[DMAS_GENERAL]).root = XmlHelpers::CreateXmlNode("Level");
|
||||
(*arrXmlAr[DMAS_GENERAL]).root->setAttr("WaterColor", m_waterColor);
|
||||
@@ -421,32 +398,11 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
|
||||
#ifdef PROFILE_LOADING_WITH_VTUNE
|
||||
VTResume();
|
||||
#endif
|
||||
// Parse level specific config data.
|
||||
const char* controlsPath = nullptr;
|
||||
Audio::AudioSystemRequestBus::BroadcastResult(controlsPath, &Audio::AudioSystemRequestBus::Events::GetControlsPath);
|
||||
QString sAudioLevelPath(controlsPath);
|
||||
sAudioLevelPath += "levels/";
|
||||
string const sLevelNameOnly = PathUtil::GetFileName(fileName.toUtf8().data());
|
||||
sAudioLevelPath += sLevelNameOnly;
|
||||
QByteArray path = sAudioLevelPath.toUtf8();
|
||||
Audio::SAudioManagerRequestData<Audio::eAMRT_PARSE_CONTROLS_DATA> oAMData(path, Audio::eADS_LEVEL_SPECIFIC);
|
||||
Audio::SAudioRequest oAudioRequestData;
|
||||
oAudioRequestData.nFlags = (Audio::eARF_PRIORITY_HIGH | Audio::eARF_EXECUTE_BLOCKING); // Needs to be blocking so data is available for next preloading request!
|
||||
oAudioRequestData.pData = &oAMData;
|
||||
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequestBlocking, oAudioRequestData);
|
||||
|
||||
Audio::SAudioManagerRequestData<Audio::eAMRT_PARSE_PRELOADS_DATA> oAMData2(path, Audio::eADS_LEVEL_SPECIFIC);
|
||||
oAudioRequestData.pData = &oAMData2;
|
||||
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequestBlocking, oAudioRequestData);
|
||||
|
||||
Audio::TAudioPreloadRequestID nPreloadRequestID = INVALID_AUDIO_PRELOAD_REQUEST_ID;
|
||||
Audio::AudioSystemRequestBus::BroadcastResult(nPreloadRequestID, &Audio::AudioSystemRequestBus::Events::GetAudioPreloadRequestID, sLevelNameOnly.c_str());
|
||||
if (nPreloadRequestID != INVALID_AUDIO_PRELOAD_REQUEST_ID)
|
||||
{
|
||||
Audio::SAudioManagerRequestData<Audio::eAMRT_PRELOAD_SINGLE_REQUEST> oAMData3(nPreloadRequestID);
|
||||
oAudioRequestData.pData = &oAMData3;
|
||||
Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequestBlocking, oAudioRequestData);
|
||||
}
|
||||
// Load level-specific audio data.
|
||||
AZStd::string levelFileName{ fileName.toUtf8().constData() };
|
||||
AZStd::to_lower(levelFileName.begin(), levelFileName.end());
|
||||
LmbrCentral::AudioSystemComponentRequestBus::Broadcast(
|
||||
&LmbrCentral::AudioSystemComponentRequestBus::Events::LevelLoadAudio, AZStd::string_view{ levelFileName });
|
||||
|
||||
{
|
||||
CAutoLogTime logtime("Game Engine level load");
|
||||
@@ -458,7 +414,7 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Load water color.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
(*arrXmlAr[DMAS_GENERAL]).root->getAttr("WaterColor", m_waterColor);
|
||||
(*arrXmlAr[DMAS_GENERAL]).root->getAttr("WaterColor", m_waterColor);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Load View Settings
|
||||
@@ -491,7 +447,7 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
|
||||
|
||||
if (!pObj)
|
||||
{
|
||||
pObj = GetIEditor()->GetObjectManager()->NewObject("SequenceObject", 0, fullname);
|
||||
pObj = GetIEditor()->GetObjectManager()->NewObject("SequenceObject", nullptr, fullname);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -507,9 +463,9 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
|
||||
CAutoLogTime logtime("Post Load");
|
||||
|
||||
// Notify listeners.
|
||||
for (std::list<IDocListener*>::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
|
||||
for (IDocListener* listener : m_listeners)
|
||||
{
|
||||
(*it)->OnLoadDocument();
|
||||
listener->OnLoadDocument();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -675,7 +631,7 @@ int CCryEditDoc::GetModifiedModule()
|
||||
return m_modifiedModuleFlags;
|
||||
}
|
||||
|
||||
BOOL CCryEditDoc::CanCloseFrame()
|
||||
bool CCryEditDoc::CanCloseFrame()
|
||||
{
|
||||
// Ask the base class to ask for saving, which also includes the save
|
||||
// status of the plugins. Additionaly we query if all the plugins can exit
|
||||
@@ -684,21 +640,21 @@ BOOL CCryEditDoc::CanCloseFrame()
|
||||
// are not serialized in the project file
|
||||
if (!SaveModified())
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!GetIEditor()->GetPluginManager()->CanAllPluginsExitNow())
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// If there is an export in process, exiting will corrupt it
|
||||
if (CGameExporter::GetCurrentExporter() != nullptr)
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CCryEditDoc::SaveModified()
|
||||
@@ -708,7 +664,8 @@ bool CCryEditDoc::SaveModified()
|
||||
return true;
|
||||
}
|
||||
|
||||
auto button = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
auto button = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
switch (button)
|
||||
{
|
||||
case QMessageBox::Cancel:
|
||||
@@ -742,7 +699,7 @@ bool CCryEditDoc::OnOpenDocument(const QString& lpszPathName)
|
||||
TOpenDocContext context;
|
||||
if (!BeforeOpenDocument(lpszPathName, context))
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
return DoOpenDocument(context);
|
||||
}
|
||||
@@ -785,7 +742,7 @@ bool CCryEditDoc::BeforeOpenDocument(const QString& lpszPathName, TOpenDocContex
|
||||
context.absoluteLevelPath = absolutePath;
|
||||
context.absoluteSlicePath = "";
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
|
||||
@@ -822,7 +779,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
|
||||
if (!LoadXmlArchiveArray(arrXmlAr, levelFilePath, levelFolderAbsolutePath))
|
||||
{
|
||||
m_bLoadFailed = true;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!LoadLevel(arrXmlAr, context.absoluteLevelPath))
|
||||
@@ -834,7 +791,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
|
||||
|
||||
if (m_bLoadFailed)
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load AZ entities for the editor.
|
||||
@@ -855,7 +812,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
|
||||
|
||||
if (m_bLoadFailed)
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
StartStreamingLoad();
|
||||
@@ -872,7 +829,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
|
||||
// level.
|
||||
SetLevelExported(true);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CCryEditDoc::OnNewDocument()
|
||||
@@ -933,8 +890,7 @@ bool CCryEditDoc::OnSaveDocument(const QString& lpszPathName)
|
||||
}
|
||||
|
||||
TSaveDocContext context;
|
||||
if (shouldSaveLevel &&
|
||||
BeforeSaveDocument(lpszPathName, context))
|
||||
if (shouldSaveLevel && BeforeSaveDocument(lpszPathName, context))
|
||||
{
|
||||
DoSaveDocument(lpszPathName, context);
|
||||
saveSuccess = AfterSaveDocument(lpszPathName, context);
|
||||
@@ -969,10 +925,10 @@ bool CCryEditDoc::BeforeSaveDocument(const QString& lpszPathName, TSaveDocContex
|
||||
bool bSaved(true);
|
||||
|
||||
context.bSaved = bSaved;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CCryEditDoc::HasLayerNameConflicts()
|
||||
bool CCryEditDoc::HasLayerNameConflicts() const
|
||||
{
|
||||
AZStd::vector<AZ::Entity*> editorEntities;
|
||||
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
|
||||
@@ -1004,43 +960,42 @@ bool CCryEditDoc::HasLayerNameConflicts()
|
||||
bool CCryEditDoc::DoSaveDocument(const QString& filename, TSaveDocContext& context)
|
||||
{
|
||||
bool& bSaved = context.bSaved;
|
||||
if (bSaved)
|
||||
if (!bSaved)
|
||||
{
|
||||
// Paranoia - we shouldn't get this far into the save routine without a level loaded (empty levelPath)
|
||||
// If nothing is loaded, we don't need to save anything
|
||||
if (filename.isEmpty())
|
||||
{
|
||||
bSaved = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save Tag Point locations to file if auto save of tag points disabled
|
||||
if (!gSettings.bAutoSaveTagPoints)
|
||||
{
|
||||
CCryEditApp::instance()->SaveTagLocations();
|
||||
}
|
||||
|
||||
QString normalizedPath = Path::ToUnixPath(filename);
|
||||
if (IsSliceFile(normalizedPath))
|
||||
{
|
||||
bSaved = SaveSlice(normalizedPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
bSaved = SaveLevel(normalizedPath);
|
||||
}
|
||||
|
||||
// Changes filename for this document.
|
||||
SetPathName(normalizedPath);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Paranoia - we shouldn't get this far into the save routine without a level loaded (empty levelPath)
|
||||
// If nothing is loaded, we don't need to save anything
|
||||
if (filename.isEmpty())
|
||||
{
|
||||
bSaved = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save Tag Point locations to file if auto save of tag points disabled
|
||||
if (!gSettings.bAutoSaveTagPoints)
|
||||
{
|
||||
CCryEditApp::instance()->SaveTagLocations();
|
||||
}
|
||||
|
||||
QString normalizedPath = Path::ToUnixPath(filename);
|
||||
if (IsSliceFile(normalizedPath))
|
||||
{
|
||||
bSaved = SaveSlice(normalizedPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
bSaved = SaveLevel(normalizedPath);
|
||||
}
|
||||
|
||||
// Changes filename for this document.
|
||||
SetPathName(normalizedPath);
|
||||
return bSaved;
|
||||
}
|
||||
|
||||
bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName, TSaveDocContext& context, bool bShowPrompt)
|
||||
{
|
||||
bool& bSaved = context.bSaved;
|
||||
bool bSaved = context.bSaved;
|
||||
|
||||
GetIEditor()->Notify(eNotify_OnEndSceneSave);
|
||||
|
||||
@@ -1055,7 +1010,7 @@ bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName
|
||||
else
|
||||
{
|
||||
CLogFile::WriteLine("$3Document successfully saved");
|
||||
SetModifiedFlag(FALSE);
|
||||
SetModifiedFlag(false);
|
||||
SetModifiedModules(eModifiedNothing);
|
||||
MainWindow::instance()->ResetAutoSaveTimers();
|
||||
}
|
||||
@@ -1067,8 +1022,7 @@ bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName
|
||||
static void GetUserSettingsFile(const QString& levelFolder, QString& userSettings)
|
||||
{
|
||||
const char* pUserName = GetISystem()->GetUserName();
|
||||
QString fileName;
|
||||
fileName = QStringLiteral("%1_usersettings.editor_xml").arg(pUserName);
|
||||
QString fileName = QStringLiteral("%1_usersettings.editor_xml").arg(pUserName);
|
||||
userSettings = Path::Make(levelFolder, fileName);
|
||||
}
|
||||
|
||||
@@ -1182,9 +1136,9 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
|
||||
}
|
||||
|
||||
QString oldFilePath = QDir(oldLevelFolder).absoluteFilePath(sourceName);
|
||||
QString newFilePath = QDir(newLevelFolder).absoluteFilePath(sourceName);
|
||||
QString newFilePath = QDir(newLevelFolder).absoluteFilePath(destName);
|
||||
CFileUtil::CopyFile(oldFilePath, newFilePath);
|
||||
} while (findHandle = pIPak->FindNext(findHandle));
|
||||
} while ((findHandle = pIPak->FindNext(findHandle)));
|
||||
pIPak->FindClose(findHandle);
|
||||
}
|
||||
|
||||
@@ -1506,7 +1460,7 @@ bool CCryEditDoc::LoadEntitiesFromLevel(const QString& levelPakFile)
|
||||
{
|
||||
AZStd::vector<char> fileBuffer;
|
||||
fileBuffer.resize(entitiesFile.GetLength());
|
||||
if (fileBuffer.size() > 0)
|
||||
if (!fileBuffer.empty())
|
||||
{
|
||||
if (fileBuffer.size() == entitiesFile.ReadRaw(fileBuffer.begin(), fileBuffer.size()))
|
||||
{
|
||||
@@ -1608,7 +1562,7 @@ bool CCryEditDoc::LoadLevel(TDocMultiArchive& arrXmlAr, const QString& absoluteC
|
||||
// Set level path directly *after* DeleteContents(), since that will unload the previous level and clear the level path.
|
||||
GetIEditor()->GetGameEngine()->SetLevelPath(folderPath);
|
||||
|
||||
SetModifiedFlag(TRUE); // dirty during de-serialize
|
||||
SetModifiedFlag(true); // dirty during de-serialize
|
||||
SetModifiedModules(eModifiedAll);
|
||||
Load(arrXmlAr, absoluteCryFilePath);
|
||||
|
||||
@@ -1618,7 +1572,7 @@ bool CCryEditDoc::LoadLevel(TDocMultiArchive& arrXmlAr, const QString& absoluteC
|
||||
{
|
||||
pIPak->GetResourceList(AZ::IO::IArchive::RFOM_NextLevel)->Clear();
|
||||
}
|
||||
SetModifiedFlag(FALSE); // start off with unmodified
|
||||
SetModifiedFlag(false); // start off with unmodified
|
||||
SetModifiedModules(eModifiedNothing);
|
||||
SetDocumentReady(true);
|
||||
GetIEditor()->Notify(eNotify_OnEndLoad);
|
||||
@@ -1910,7 +1864,7 @@ void CCryEditDoc::UnregisterListener(IDocListener* listener)
|
||||
m_listeners.remove(listener);
|
||||
}
|
||||
|
||||
void CCryEditDoc::LogLoadTime(int time)
|
||||
void CCryEditDoc::LogLoadTime(int time) const
|
||||
{
|
||||
QString appFilePath = QDir::toNativeSeparators(QCoreApplication::applicationFilePath());
|
||||
QString exePath = Path::GetPath(appFilePath);
|
||||
@@ -1919,24 +1873,21 @@ void CCryEditDoc::LogLoadTime(int time)
|
||||
|
||||
CLogFile::FormatLine("[LevelLoadTime] Level %s loaded in %d seconds", level.toUtf8().data(), time / 1000);
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
SetFileAttributes(filename.toUtf8().data(), FILE_ATTRIBUTE_ARCHIVE);
|
||||
SetFileAttributesW(filename.toStdWString().c_str(), FILE_ATTRIBUTE_ARCHIVE);
|
||||
#endif
|
||||
|
||||
FILE* file = nullptr;
|
||||
azfopen(&file, filename.toUtf8().data(), "at");
|
||||
|
||||
if (file)
|
||||
QFile file(filename);
|
||||
if (!file.open(QFile::Append | QFile::Text))
|
||||
{
|
||||
char version[50];
|
||||
GetIEditor()->GetFileVersion().ToShortString(version, AZ_ARRAY_SIZE(version));
|
||||
|
||||
QString text;
|
||||
|
||||
time = time / 1000;
|
||||
text = QStringLiteral("\n[%1] Level %2 loaded in %3 seconds").arg(version, level).arg(time);
|
||||
fwrite(text.toUtf8().data(), text.toUtf8().length(), 1, file);
|
||||
fclose(file);
|
||||
return;
|
||||
}
|
||||
|
||||
char version[50];
|
||||
GetIEditor()->GetFileVersion().ToShortString(version, AZ_ARRAY_SIZE(version));
|
||||
|
||||
time = time / 1000;
|
||||
QString text = QStringLiteral("\n[%1] Level %2 loaded in %3 seconds").arg(version, level).arg(time);
|
||||
file.write(text.toUtf8());
|
||||
}
|
||||
|
||||
void CCryEditDoc::SetDocumentReady(bool bReady)
|
||||
@@ -1944,7 +1895,7 @@ void CCryEditDoc::SetDocumentReady(bool bReady)
|
||||
m_bDocumentReady = bReady;
|
||||
}
|
||||
|
||||
void CCryEditDoc::GetMemoryUsage(ICrySizer* pSizer)
|
||||
void CCryEditDoc::GetMemoryUsage(ICrySizer* pSizer) const
|
||||
{
|
||||
{
|
||||
SIZER_COMPONENT_NAME(pSizer, "UndoManager(estimate)");
|
||||
@@ -1997,7 +1948,7 @@ void CCryEditDoc::OnStartLevelResourceList()
|
||||
gEnv->pCryPak->GetResourceList(AZ::IO::IArchive::RFOM_Level)->Clear();
|
||||
}
|
||||
|
||||
BOOL CCryEditDoc::DoFileSave()
|
||||
bool CCryEditDoc::DoFileSave()
|
||||
{
|
||||
if (GetEditMode() == CCryEditDoc::DocumentEditingMode::LevelEdit)
|
||||
{
|
||||
@@ -2015,15 +1966,15 @@ BOOL CCryEditDoc::DoFileSave()
|
||||
QString newLevelPath = filename.left(filename.lastIndexOf('/') + 1);
|
||||
GetIEditor()->GetDocument()->SetPathName(filename);
|
||||
GetIEditor()->GetGameEngine()->SetLevelPath(newLevelPath);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!IsDocumentReady())
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return Internal::SaveLevel();
|
||||
@@ -2068,12 +2019,9 @@ void CCryEditDoc::InitEmptyLevel(int /*resolution*/, int /*unitSize*/, bool /*bU
|
||||
{
|
||||
// Notify listeners.
|
||||
std::list<IDocListener*> listeners = m_listeners;
|
||||
std::list<IDocListener*>::iterator it, next;
|
||||
for (it = listeners.begin(); it != listeners.end(); it = next)
|
||||
for (IDocListener* listener : listeners)
|
||||
{
|
||||
next = it;
|
||||
next++;
|
||||
(*it)->OnNewDocument();
|
||||
listener->OnNewDocument();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2081,7 +2029,7 @@ void CCryEditDoc::InitEmptyLevel(int /*resolution*/, int /*unitSize*/, bool /*bU
|
||||
GetISystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_LOAD_END, 0, 0);
|
||||
|
||||
GetIEditor()->Notify(eNotify_OnEndNewScene);
|
||||
SetModifiedFlag(FALSE);
|
||||
SetModifiedFlag(false);
|
||||
SetLevelExported(false);
|
||||
SetModifiedModules(eModifiedNothing);
|
||||
|
||||
@@ -2095,13 +2043,13 @@ void CCryEditDoc::CreateDefaultLevelAssets([[maybe_unused]] int resolution, [[ma
|
||||
|
||||
void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
|
||||
{
|
||||
if (pVar == NULL)
|
||||
if (pVar == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
XmlNodeRef node = GetEnvironmentTemplate();
|
||||
if (node == NULL)
|
||||
if (node == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -2119,7 +2067,7 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
|
||||
|
||||
XmlNodeRef groupNode = node->getChild(nGroup);
|
||||
|
||||
if (groupNode == NULL)
|
||||
if (groupNode == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -2130,36 +2078,34 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
|
||||
}
|
||||
|
||||
XmlNodeRef childNode = groupNode->getChild(nChild);
|
||||
if (childNode == NULL)
|
||||
if (childNode == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
QString childValue;
|
||||
|
||||
if (pVar->GetDataType() == IVariable::DT_COLOR)
|
||||
{
|
||||
Vec3 value;
|
||||
pVar->Get(value);
|
||||
QString buff;
|
||||
QColor gammaColor = ColorLinearToGamma(ColorF(value.x, value.y, value.z));
|
||||
buff = QStringLiteral("%1,%2,%3").arg(gammaColor.red()).arg(gammaColor.green()).arg(gammaColor.blue());
|
||||
childNode->setAttr("value", buff.toUtf8().data());
|
||||
childValue = QStringLiteral("%1,%2,%3").arg(gammaColor.red()).arg(gammaColor.green()).arg(gammaColor.blue());
|
||||
}
|
||||
else
|
||||
{
|
||||
QString value;
|
||||
pVar->Get(value);
|
||||
childNode->setAttr("value", value.toUtf8().data());
|
||||
pVar->Get(childValue);
|
||||
}
|
||||
childNode->setAttr("value", childValue.toUtf8().data());
|
||||
}
|
||||
|
||||
QString CCryEditDoc::GetCryIndexPath(const LPCTSTR levelFilePath)
|
||||
QString CCryEditDoc::GetCryIndexPath(const char* levelFilePath) const
|
||||
{
|
||||
QString levelPath = Path::GetPath(levelFilePath);
|
||||
QString levelName = Path::GetFileName(levelFilePath);
|
||||
return Path::AddPathSlash(levelPath + levelName + "_editor");
|
||||
}
|
||||
|
||||
BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath)
|
||||
bool CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath)
|
||||
{
|
||||
auto pIPak = GetIEditor()->GetSystem()->GetIPak();
|
||||
|
||||
@@ -2168,7 +2114,7 @@ BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString&
|
||||
CXmlArchive* pXmlAr = new CXmlArchive();
|
||||
if (!pXmlAr)
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
CXmlArchive& xmlAr = *pXmlAr;
|
||||
@@ -2179,22 +2125,21 @@ BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString&
|
||||
bool openLevelPakFileSuccess = pIPak->OpenPack(levelPath.toUtf8().data(), absoluteLevelPath.toUtf8().data());
|
||||
if (!openLevelPakFileSuccess)
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
CPakFile pakFile;
|
||||
bool loadFromPakSuccess;
|
||||
loadFromPakSuccess = xmlAr.LoadFromPak(levelPath, pakFile);
|
||||
bool loadFromPakSuccess = xmlAr.LoadFromPak(levelPath, pakFile);
|
||||
pIPak->ClosePack(absoluteLevelPath.toUtf8().data());
|
||||
if (!loadFromPakSuccess)
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
FillXmlArArray(arrXmlAr, &xmlAr);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCryEditDoc::ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr)
|
||||
|
||||
+21
-19
@@ -26,7 +26,7 @@ struct ICVar;
|
||||
|
||||
// Filename of the temporary file used for the hold / fetch operation
|
||||
// conform to the "$tmp[0-9]_" naming convention
|
||||
#define HOLD_FETCH_FILE "$tmp_hold"
|
||||
#define HOLD_FETCH_FILE "$tmp_hold"
|
||||
|
||||
class CCryEditDoc
|
||||
: public QObject
|
||||
@@ -36,7 +36,7 @@ class CCryEditDoc
|
||||
Q_PROPERTY(bool modified READ IsModified WRITE SetModifiedFlag);
|
||||
Q_PROPERTY(QString pathName READ GetLevelPathName WRITE SetPathName);
|
||||
Q_PROPERTY(QString title READ GetTitle WRITE SetTitle);
|
||||
|
||||
|
||||
public: // Create from serialization only
|
||||
enum DocumentEditingMode
|
||||
{
|
||||
@@ -82,7 +82,7 @@ public: // Create from serialization only
|
||||
|
||||
bool DoSave(const QString& pathName, bool replace);
|
||||
SANDBOX_API bool Save();
|
||||
virtual BOOL DoFileSave();
|
||||
virtual bool DoFileSave();
|
||||
bool SaveModified();
|
||||
|
||||
virtual bool BackupBeforeSave(bool bForce = false);
|
||||
@@ -91,7 +91,7 @@ public: // Create from serialization only
|
||||
// ClassWizard generated virtual function overrides
|
||||
virtual bool OnOpenDocument(const QString& lpszPathName);
|
||||
|
||||
const bool IsLevelLoadFailed() const { return m_bLoadFailed; }
|
||||
bool IsLevelLoadFailed() const { return m_bLoadFailed; }
|
||||
|
||||
//! Marks this document as having errors.
|
||||
void SetHasErrors() { m_hasErrors = true; }
|
||||
@@ -102,7 +102,7 @@ public: // Create from serialization only
|
||||
bool IsLevelExported() const;
|
||||
void SetLevelExported(bool boExported = true);
|
||||
|
||||
BOOL CanCloseFrame();
|
||||
bool CanCloseFrame();
|
||||
|
||||
enum class FetchPolicy
|
||||
{
|
||||
@@ -121,7 +121,7 @@ public: // Create from serialization only
|
||||
|
||||
CClouds* GetClouds() { return m_pClouds; }
|
||||
void SetWaterColor(const QColor& col) { m_waterColor = col; }
|
||||
QColor GetWaterColor() { return m_waterColor; }
|
||||
QColor GetWaterColor() const { return m_waterColor; }
|
||||
XmlNodeRef& GetFogTemplate() { return m_fogTemplate; }
|
||||
XmlNodeRef& GetEnvironmentTemplate() { return m_environmentTemplate; }
|
||||
void OnEnvironmentPropertyChanged(IVariable* pVar);
|
||||
@@ -129,7 +129,7 @@ public: // Create from serialization only
|
||||
void RegisterListener(IDocListener* listener);
|
||||
void UnregisterListener(IDocListener* listener);
|
||||
|
||||
void GetMemoryUsage(ICrySizer* pSizer);
|
||||
void GetMemoryUsage(ICrySizer* pSizer) const;
|
||||
|
||||
static bool IsBackupOrTempLevelSubdirectory(const QString& folderName);
|
||||
protected:
|
||||
@@ -144,7 +144,7 @@ protected:
|
||||
};
|
||||
bool BeforeOpenDocument(const QString& lpszPathName, TOpenDocContext& context);
|
||||
bool DoOpenDocument(TOpenDocContext& context);
|
||||
virtual BOOL LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath);
|
||||
virtual bool LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath);
|
||||
virtual void ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr);
|
||||
|
||||
virtual void Load(TDocMultiArchive& arrXmlAr, const QString& szFilename);
|
||||
@@ -161,14 +161,14 @@ protected:
|
||||
void SerializeFogSettings(CXmlArchive& xmlAr);
|
||||
virtual void SerializeViewSettings(CXmlArchive& xmlAr);
|
||||
void SerializeNameSelection(CXmlArchive& xmlAr);
|
||||
void LogLoadTime(int time);
|
||||
void LogLoadTime(int time) const;
|
||||
|
||||
struct TSaveDocContext
|
||||
{
|
||||
bool bSaved;
|
||||
};
|
||||
bool BeforeSaveDocument(const QString& lpszPathName, TSaveDocContext& context);
|
||||
bool HasLayerNameConflicts();
|
||||
bool HasLayerNameConflicts() const;
|
||||
bool DoSaveDocument(const QString& lpszPathName, TSaveDocContext& context);
|
||||
bool AfterSaveDocument(const QString& lpszPathName, TSaveDocContext& context, bool bShowPrompt = true);
|
||||
|
||||
@@ -180,7 +180,7 @@ protected:
|
||||
void OnStartLevelResourceList();
|
||||
static void OnValidateSurfaceTypesChanged(ICVar*);
|
||||
|
||||
QString GetCryIndexPath(const LPCTSTR levelFilePath);
|
||||
QString GetCryIndexPath(const char* levelFilePath) const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SliceEditorEntityOwnershipServiceNotificationBus::Handler
|
||||
@@ -188,24 +188,26 @@ protected:
|
||||
void OnSliceInstantiationFailed(const AZ::Data::AssetId& sliceAssetId, const AzFramework::SliceInstantiationTicket& /*ticket*/) override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool m_bLoadFailed;
|
||||
QColor m_waterColor;
|
||||
bool m_bLoadFailed = false;
|
||||
QColor m_waterColor = QColor(0, 0, 255);
|
||||
XmlNodeRef m_fogTemplate;
|
||||
XmlNodeRef m_environmentTemplate;
|
||||
CClouds* m_pClouds;
|
||||
std::list<IDocListener*> m_listeners;
|
||||
bool m_bDocumentReady;
|
||||
ICVar* doc_validate_surface_types;
|
||||
bool m_bDocumentReady = false;
|
||||
ICVar* doc_validate_surface_types = nullptr;
|
||||
int m_modifiedModuleFlags;
|
||||
bool m_boLevelExported;
|
||||
bool m_modified;
|
||||
// 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.
|
||||
bool m_boLevelExported = true;
|
||||
bool m_modified = false;
|
||||
QString m_pathName;
|
||||
QString m_slicePathName;
|
||||
QString m_title;
|
||||
AZ::Data::AssetId m_envProbeSliceAssetId;
|
||||
float m_terrainSize;
|
||||
const char* m_envProbeSliceRelativePath;
|
||||
const float m_envProbeHeight;
|
||||
const char* m_envProbeSliceRelativePath = "EngineAssets/Slices/DefaultLevelSetup.slice";
|
||||
const float m_envProbeHeight = 200.0f;
|
||||
bool m_hasErrors = false; ///< This is used to warn the user that they may lose work when they go to save.
|
||||
};
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace
|
||||
const char* PyGetCurrentLevelName()
|
||||
{
|
||||
// Using static member to capture temporary data
|
||||
static string tempLevelName;
|
||||
static AZ::IO::FixedMaxPathString tempLevelName;
|
||||
tempLevelName = GetIEditor()->GetGameEngine()->GetLevelName().toUtf8().data();
|
||||
return tempLevelName.c_str();
|
||||
}
|
||||
@@ -218,7 +218,7 @@ namespace
|
||||
const char* PyGetCurrentLevelPath()
|
||||
{
|
||||
// Using static member to capture temporary data
|
||||
static string tempLevelPath;
|
||||
static AZ::IO::FixedMaxPathString tempLevelPath;
|
||||
tempLevelPath = GetIEditor()->GetGameEngine()->GetLevelPath().toUtf8().data();
|
||||
return tempLevelPath.c_str();
|
||||
}
|
||||
@@ -359,7 +359,7 @@ namespace
|
||||
{
|
||||
AZ::TickBus::Handler::BusConnect();
|
||||
}
|
||||
~Ticker()
|
||||
~Ticker() override
|
||||
{
|
||||
AZ::TickBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#define MIN_ASPECT 1
|
||||
#define MAX_ASPECT 16384
|
||||
|
||||
CCustomAspectRatioDlg::CCustomAspectRatioDlg(int x, int y, QWidget* pParent /*=NULL*/)
|
||||
CCustomAspectRatioDlg::CCustomAspectRatioDlg(int x, int y, QWidget* pParent /*=nullptr*/)
|
||||
: QDialog(pParent)
|
||||
, m_xDefault(x)
|
||||
, m_yDefault(y)
|
||||
|
||||
@@ -25,7 +25,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
#define MIN_RES 64
|
||||
#define MAX_RES 8192
|
||||
|
||||
CCustomResolutionDlg::CCustomResolutionDlg(int w, int h, QWidget* pParent /*=NULL*/)
|
||||
CCustomResolutionDlg::CCustomResolutionDlg(int w, int h, QWidget* pParent /*=nullptr*/)
|
||||
: QDialog(pParent)
|
||||
, m_wDefault(w)
|
||||
, m_hDefault(h)
|
||||
@@ -50,12 +50,12 @@ void CCustomResolutionDlg::OnInitDialog()
|
||||
m_ui->m_height->setValue(m_hDefault);
|
||||
|
||||
QString maxDimensionString;
|
||||
QTextStream(&maxDimensionString)
|
||||
<< "Maximum Dimension: " << MAX_RES << Qt::endl
|
||||
QTextStream(&maxDimensionString)
|
||||
<< "Maximum Dimension: " << MAX_RES << Qt::endl
|
||||
<< Qt::endl
|
||||
<< "Note: Dimensions over 8K may be" << Qt::endl
|
||||
<< "unstable depending on hardware.";
|
||||
|
||||
|
||||
m_ui->m_maxDimension->setText(maxDimensionString);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
}
|
||||
virtual ~MenuActionsModel() {}
|
||||
~MenuActionsModel() override {}
|
||||
|
||||
int rowCount([[maybe_unused]] const QModelIndex& parent = QModelIndex()) const override
|
||||
{
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
, m_action(nullptr)
|
||||
{
|
||||
}
|
||||
virtual ~ActionShortcutsModel() {}
|
||||
~ActionShortcutsModel() override {}
|
||||
|
||||
int rowCount([[maybe_unused]] const QModelIndex& parent = QModelIndex()) const override
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
|
||||
CErrorsDlg::CErrorsDlg(QWidget* pParent /*=NULL*/)
|
||||
CErrorsDlg::CErrorsDlg(QWidget* pParent /*=nullptr*/)
|
||||
: QDialog(pParent)
|
||||
, ui(new Ui::CErrorsDlg)
|
||||
{
|
||||
|
||||
@@ -159,7 +159,7 @@ void CPythonScriptsDialog::OnExecute()
|
||||
QList<QStandardItem*> selectedItems = ui->treeView->GetSelectedItems();
|
||||
QStandardItem* selectedItem = selectedItems.empty() ? nullptr : selectedItems.first();
|
||||
|
||||
if (selectedItem == NULL)
|
||||
if (selectedItem == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#pragma warning (disable : 4786) // identifier was truncated to 'number' characters in the debug information.
|
||||
#pragma warning (disable : 4244) // conversion from 'long' to 'float', possible loss of data
|
||||
#pragma warning (disable : 4018) // signed/unsigned mismatch
|
||||
#pragma warning (disable : 4800) // BOOL bool conversion
|
||||
|
||||
// Disable warning when a function returns a value inside an __asm block
|
||||
#pragma warning (disable : 4035)
|
||||
@@ -85,17 +84,17 @@
|
||||
#endif
|
||||
|
||||
#ifndef SAFE_DELETE
|
||||
#define SAFE_DELETE(p) { if (p) { delete (p); (p) = NULL; } \
|
||||
#define SAFE_DELETE(p) { if (p) { delete (p); (p) = nullptr; } \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef SAFE_DELETE_ARRAY
|
||||
#define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p) = NULL; } \
|
||||
#define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p) = nullptr; } \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef SAFE_RELEASE
|
||||
#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = NULL; } \
|
||||
#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = nullptr; } \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -55,10 +55,10 @@ bool CEditorFileMonitor::RegisterListener(IFileChangeListener* pListener, const
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static string CanonicalizePath(const char* path)
|
||||
static AZStd::string CanonicalizePath(const char* path)
|
||||
{
|
||||
auto canon = QFileInfo(path).canonicalFilePath();
|
||||
return canon.isEmpty() ? string(path) : string(canon.toUtf8());
|
||||
return canon.isEmpty() ? AZStd::string(path) : AZStd::string(canon.toUtf8());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -66,8 +66,8 @@ bool CEditorFileMonitor::RegisterListener(IFileChangeListener* pListener, const
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
string gameFolder = Path::GetEditingGameDataFolder().c_str();
|
||||
string naivePath;
|
||||
AZStd::string gameFolder = Path::GetEditingGameDataFolder().c_str();
|
||||
AZStd::string naivePath;
|
||||
CFileChangeMonitor* fileChangeMonitor = CFileChangeMonitor::Instance();
|
||||
AZ_Assert(fileChangeMonitor, "CFileChangeMonitor singleton missing.");
|
||||
|
||||
@@ -75,12 +75,12 @@ bool CEditorFileMonitor::RegisterListener(IFileChangeListener* pListener, const
|
||||
// Append slash in preparation for appending the second part.
|
||||
naivePath = PathUtil::AddSlash(naivePath);
|
||||
naivePath += sFolderRelativeToGame;
|
||||
naivePath.replace('/', '\\');
|
||||
AZ::StringFunc::Replace(naivePath, '/', '\\');
|
||||
|
||||
// Remove the final slash if the given item is a folder so the file change monitor correctly picks up on it.
|
||||
naivePath = PathUtil::RemoveSlash(naivePath);
|
||||
|
||||
string canonicalizedPath = CanonicalizePath(naivePath.c_str());
|
||||
AZStd::string canonicalizedPath = CanonicalizePath(naivePath.c_str());
|
||||
|
||||
if (fileChangeMonitor->IsDirectory(canonicalizedPath.c_str()) || fileChangeMonitor->IsFile(canonicalizedPath.c_str()))
|
||||
{
|
||||
@@ -162,7 +162,7 @@ QString RemoveGameName(const QString &filename)
|
||||
void CEditorFileMonitor::OnFileMonitorChange(const SFileChangeInfo& rChange)
|
||||
{
|
||||
CCryEditApp* app = CCryEditApp::instance();
|
||||
if (app == NULL || app->IsExiting())
|
||||
if (app == nullptr || app->IsExiting())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ private:
|
||||
QString extension;
|
||||
|
||||
SFileChangeCallback()
|
||||
: pListener(NULL)
|
||||
: pListener(nullptr)
|
||||
{}
|
||||
|
||||
SFileChangeCallback(IFileChangeListener* pListener, const char* item, const char* extension)
|
||||
|
||||
@@ -49,7 +49,7 @@ class CEditorPanelUtils_Impl
|
||||
{
|
||||
#pragma region Drag & Drop
|
||||
public:
|
||||
virtual void SetViewportDragOperation(void(* dropCallback)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) override
|
||||
void SetViewportDragOperation(void(* dropCallback)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) override
|
||||
{
|
||||
for (int i = 0; i < GetIEditor()->GetViewManager()->GetViewCount(); i++)
|
||||
{
|
||||
@@ -60,13 +60,13 @@ public:
|
||||
#pragma region Preview Window
|
||||
public:
|
||||
|
||||
virtual int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings)
|
||||
int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings) override
|
||||
{
|
||||
CRY_ASSERT(settings);
|
||||
return settings->GetDebugFlags();
|
||||
}
|
||||
|
||||
virtual void PreviewWindow_SetDisplaySettingsDebugFlags(CDisplaySettings* settings, int flags)
|
||||
void PreviewWindow_SetDisplaySettingsDebugFlags(CDisplaySettings* settings, int flags) override
|
||||
{
|
||||
CRY_ASSERT(settings);
|
||||
settings->SetDebugFlags(flags);
|
||||
@@ -79,7 +79,7 @@ protected:
|
||||
bool m_hotkeysAreEnabled;
|
||||
public:
|
||||
|
||||
virtual bool HotKey_Import() override
|
||||
bool HotKey_Import() override
|
||||
{
|
||||
QVector<QPair<QString, QString> > keys;
|
||||
QString filepath = QFileDialog::getOpenFileName(nullptr, "Select shortcut configuration to load",
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
HotKey_BuildDefaults();
|
||||
for (QPair<QString, QString> key : keys)
|
||||
{
|
||||
for (unsigned int j = 0; j < hotkeys.count(); j++)
|
||||
for (int j = 0; j < hotkeys.count(); j++)
|
||||
{
|
||||
if (hotkeys[j].path.compare(key.first, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
@@ -143,7 +143,7 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual void HotKey_Export() override
|
||||
void HotKey_Export() override
|
||||
{
|
||||
auto settingDir = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Editor" / "Plugins" / "ParticleEditorPlugin" / "settings";
|
||||
QString filepath = QFileDialog::getSaveFileName(nullptr, "Select shortcut configuration to load", settingDir.c_str(), "HotKey Config Files (*.hkxml)");
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
file.close();
|
||||
}
|
||||
|
||||
virtual QKeySequence HotKey_GetShortcut(const char* path) override
|
||||
QKeySequence HotKey_GetShortcut(const char* path) override
|
||||
{
|
||||
for (HotKey combo : hotkeys)
|
||||
{
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
return QKeySequence();
|
||||
}
|
||||
|
||||
virtual bool HotKey_IsPressed(const QKeyEvent* event, const char* path) override
|
||||
bool HotKey_IsPressed(const QKeyEvent* event, const char* path) override
|
||||
{
|
||||
if (!m_hotkeysAreEnabled)
|
||||
{
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool HotKey_IsPressed(const QShortcutEvent* event, const char* path) override
|
||||
bool HotKey_IsPressed(const QShortcutEvent* event, const char* path) override
|
||||
{
|
||||
if (!m_hotkeysAreEnabled)
|
||||
{
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool HotKey_LoadExisting() override
|
||||
bool HotKey_LoadExisting() override
|
||||
{
|
||||
QSettings settings("O3DE", "O3DE");
|
||||
QString group = "Hotkeys/";
|
||||
@@ -256,7 +256,7 @@ public:
|
||||
hotkey.second = settings.value("keySequence").toString();
|
||||
if (!hotkey.first.isEmpty())
|
||||
{
|
||||
for (unsigned int j = 0; j < hotkeys.count(); j++)
|
||||
for (int j = 0; j < hotkeys.count(); j++)
|
||||
{
|
||||
if (hotkeys[j].path.compare(hotkey.first, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
@@ -275,7 +275,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void HotKey_SaveCurrent() override
|
||||
void HotKey_SaveCurrent() override
|
||||
{
|
||||
QSettings settings("O3DE", "O3DE");
|
||||
QString group = "Hotkeys/";
|
||||
@@ -296,7 +296,7 @@ public:
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
virtual void HotKey_BuildDefaults() override
|
||||
void HotKey_BuildDefaults() override
|
||||
{
|
||||
m_hotkeysAreEnabled = true;
|
||||
QVector<QPair<QString, QString> > keys;
|
||||
@@ -356,17 +356,17 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void HotKey_SetKeys(QVector<HotKey> keys) override
|
||||
void HotKey_SetKeys(QVector<HotKey> keys) override
|
||||
{
|
||||
hotkeys = keys;
|
||||
}
|
||||
|
||||
virtual QVector<HotKey> HotKey_GetKeys() override
|
||||
QVector<HotKey> HotKey_GetKeys() override
|
||||
{
|
||||
return hotkeys;
|
||||
}
|
||||
|
||||
virtual QString HotKey_GetPressedHotkey(const QKeyEvent* event) override
|
||||
QString HotKey_GetPressedHotkey(const QKeyEvent* event) override
|
||||
{
|
||||
if (!m_hotkeysAreEnabled)
|
||||
{
|
||||
@@ -381,7 +381,7 @@ public:
|
||||
}
|
||||
return "";
|
||||
}
|
||||
virtual QString HotKey_GetPressedHotkey(const QShortcutEvent* event) override
|
||||
QString HotKey_GetPressedHotkey(const QShortcutEvent* event) override
|
||||
{
|
||||
if (!m_hotkeysAreEnabled)
|
||||
{
|
||||
@@ -398,12 +398,12 @@ public:
|
||||
}
|
||||
//building the default hotkey list re-enables hotkeys
|
||||
//do not use this when rebuilding the default list is a possibility.
|
||||
virtual void HotKey_SetEnabled(bool val) override
|
||||
void HotKey_SetEnabled(bool val) override
|
||||
{
|
||||
m_hotkeysAreEnabled = val;
|
||||
}
|
||||
|
||||
virtual bool HotKey_IsEnabled() const override
|
||||
bool HotKey_IsEnabled() const override
|
||||
{
|
||||
return m_hotkeysAreEnabled;
|
||||
}
|
||||
@@ -457,13 +457,13 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void ToolTip_LoadConfigXML(QString filepath) override
|
||||
void ToolTip_LoadConfigXML(QString filepath) override
|
||||
{
|
||||
XmlNodeRef node = GetIEditor()->GetSystem()->LoadXmlFromFile(filepath.toStdString().c_str());
|
||||
ToolTip_ParseNode(node);
|
||||
}
|
||||
|
||||
virtual void ToolTip_BuildFromConfig(IQToolTip* tooltip, QString path, QString option, QString optionalData = "", bool isEnabled = true)
|
||||
void ToolTip_BuildFromConfig(IQToolTip* tooltip, QString path, QString option, QString optionalData = "", bool isEnabled = true) override
|
||||
{
|
||||
AZ_Assert(tooltip, "tooltip cannot be null");
|
||||
|
||||
@@ -488,7 +488,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual QString ToolTip_GetTitle(QString path, QString option) override
|
||||
QString ToolTip_GetTitle(QString path, QString option) override
|
||||
{
|
||||
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
|
||||
{
|
||||
@@ -501,7 +501,7 @@ public:
|
||||
return GetToolTip(path).title;
|
||||
}
|
||||
|
||||
virtual QString ToolTip_GetContent(QString path, QString option) override
|
||||
QString ToolTip_GetContent(QString path, QString option) override
|
||||
{
|
||||
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
|
||||
{
|
||||
@@ -514,7 +514,7 @@ public:
|
||||
return GetToolTip(path).content;
|
||||
}
|
||||
|
||||
virtual QString ToolTip_GetSpecialContentType(QString path, QString option) override
|
||||
QString ToolTip_GetSpecialContentType(QString path, QString option) override
|
||||
{
|
||||
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
|
||||
{
|
||||
@@ -527,7 +527,7 @@ public:
|
||||
return GetToolTip(path).specialContent;
|
||||
}
|
||||
|
||||
virtual QString ToolTip_GetDisabledContent(QString path, QString option) override
|
||||
QString ToolTip_GetDisabledContent(QString path, QString option) override
|
||||
{
|
||||
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
|
||||
{
|
||||
|
||||
@@ -282,7 +282,7 @@ void EditorPreferencesDialog::CreatePages()
|
||||
{
|
||||
auto pUnknown = classes[i];
|
||||
|
||||
IPreferencesPageCreator* pPageCreator = 0;
|
||||
IPreferencesPageCreator* pPageCreator = nullptr;
|
||||
if (FAILED(pUnknown->QueryInterface(&pPageCreator)))
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -43,11 +43,16 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
|
||||
->Field("MaxCount", &AutoBackup::m_maxCount)
|
||||
->Field("RemindTime", &AutoBackup::m_remindTime);
|
||||
|
||||
serialize.Class<AssetBrowserSearch>()
|
||||
->Version(1)
|
||||
->Field("Max number of items displayed", &AssetBrowserSearch::m_maxNumberOfItemsShownInSearch);
|
||||
|
||||
serialize.Class<CEditorPreferencesPage_Files>()
|
||||
->Version(1)
|
||||
->Field("Files", &CEditorPreferencesPage_Files::m_files)
|
||||
->Field("Editors", &CEditorPreferencesPage_Files::m_editors)
|
||||
->Field("AutoBackup", &CEditorPreferencesPage_Files::m_autoBackup);
|
||||
->Field("AutoBackup", &CEditorPreferencesPage_Files::m_autoBackup)
|
||||
->Field("AssetBrowserSearch", &CEditorPreferencesPage_Files::m_assetBrowserSearch);
|
||||
|
||||
|
||||
AZ::EditContext* editContext = serialize.GetEditContext();
|
||||
@@ -80,12 +85,19 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 100)
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AutoBackup::m_remindTime, "Remind Time", "Auto Remind Every (Minutes)");
|
||||
|
||||
editContext->Class<AssetBrowserSearch>("Asset Browser Search View", "Asset Browser Search View")
|
||||
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AssetBrowserSearch::m_maxNumberOfItemsShownInSearch, "Maximum number of displayed items",
|
||||
"Maximum number of displayed items displayed in the Search View")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 50)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 5000);
|
||||
|
||||
editContext->Class<CEditorPreferencesPage_Files>("File Preferences", "Class for handling File Preferences")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20))
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_files, "Files", "File Preferences")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_editors, "External Editors", "External Editors")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_autoBackup, "Auto Backup", "Auto Backup");
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_autoBackup, "Auto Backup", "Auto Backup")
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_assetBrowserSearch, "Asset Browser Search", "Asset Browser Search");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +136,8 @@ void CEditorPreferencesPage_Files::OnApply()
|
||||
gSettings.autoBackupTime = m_autoBackup.m_timeInterval;
|
||||
gSettings.autoBackupMaxCount = m_autoBackup.m_maxCount;
|
||||
gSettings.autoRemindTime = m_autoBackup.m_remindTime;
|
||||
|
||||
gSettings.maxNumberOfItemsShownInSearch = m_assetBrowserSearch.m_maxNumberOfItemsShownInSearch;
|
||||
}
|
||||
|
||||
void CEditorPreferencesPage_Files::InitializeSettings()
|
||||
@@ -148,4 +162,6 @@ void CEditorPreferencesPage_Files::InitializeSettings()
|
||||
m_autoBackup.m_timeInterval = gSettings.autoBackupTime;
|
||||
m_autoBackup.m_maxCount = gSettings.autoBackupMaxCount;
|
||||
m_autoBackup.m_remindTime = gSettings.autoRemindTime;
|
||||
|
||||
m_assetBrowserSearch.m_maxNumberOfItemsShownInSearch = gSettings.maxNumberOfItemsShownInSearch;
|
||||
}
|
||||
|
||||
@@ -69,10 +69,17 @@ private:
|
||||
int m_remindTime;
|
||||
};
|
||||
|
||||
struct AssetBrowserSearch
|
||||
{
|
||||
AZ_TYPE_INFO(AssetBrowserSearch, "{9FBFCD24-9452-49DF-99F4-2711443CEAAE}")
|
||||
|
||||
int m_maxNumberOfItemsShownInSearch;
|
||||
};
|
||||
|
||||
Files m_files;
|
||||
ExternalEditors m_editors;
|
||||
AutoBackup m_autoBackup;
|
||||
AssetBrowserSearch m_assetBrowserSearch;
|
||||
QIcon m_icon;
|
||||
};
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
|
||||
->Field("PreviewPanel", &GeneralSettings::m_previewPanel)
|
||||
->Field("ApplyConfigSpec", &GeneralSettings::m_applyConfigSpec)
|
||||
->Field("EnableSourceControl", &GeneralSettings::m_enableSourceControl)
|
||||
->Field("ClearConsole", &GeneralSettings::m_clearConsoleOnGameModeStart)
|
||||
->Field("ConsoleBackgroundColorTheme", &GeneralSettings::m_consoleBackgroundColorTheme)
|
||||
->Field("AutoloadLastLevel", &GeneralSettings::m_autoLoadLastLevel)
|
||||
->Field("ShowTimeInConsole", &GeneralSettings::m_bShowTimeInConsole)
|
||||
@@ -77,6 +78,8 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_previewPanel, "Show Geometry Preview Panel", "Show Geometry Preview Panel")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_applyConfigSpec, "Hide objects by config spec", "Hide objects by config spec")
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_enableSourceControl, "Enable Source Control", "Enable Source Control")
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_clearConsoleOnGameModeStart, "Clear Console at game startup", "Clear Console when game mode starts")
|
||||
->DataElement(AZ::Edit::UIHandlers::ComboBox, &GeneralSettings::m_consoleBackgroundColorTheme, "Console Background", "Console Background")
|
||||
->EnumAttribute(AzToolsFramework::ConsoleColorTheme::Light, "Light")
|
||||
->EnumAttribute(AzToolsFramework::ConsoleColorTheme::Dark, "Dark")
|
||||
@@ -142,6 +145,7 @@ void CEditorPreferencesPage_General::OnApply()
|
||||
gSettings.bPreviewGeometryWindow = m_generalSettings.m_previewPanel;
|
||||
gSettings.bApplyConfigSpecInEditor = m_generalSettings.m_applyConfigSpec;
|
||||
gSettings.enableSourceControl = m_generalSettings.m_enableSourceControl;
|
||||
gSettings.clearConsoleOnGameModeStart = m_generalSettings.m_clearConsoleOnGameModeStart;
|
||||
gSettings.consoleBackgroundColorTheme = m_generalSettings.m_consoleBackgroundColorTheme;
|
||||
gSettings.bShowTimeInConsole = m_generalSettings.m_bShowTimeInConsole;
|
||||
gSettings.bShowDashboardAtStartup = m_messaging.m_showDashboard;
|
||||
@@ -176,6 +180,7 @@ void CEditorPreferencesPage_General::InitializeSettings()
|
||||
m_generalSettings.m_previewPanel = gSettings.bPreviewGeometryWindow;
|
||||
m_generalSettings.m_applyConfigSpec = gSettings.bApplyConfigSpecInEditor;
|
||||
m_generalSettings.m_enableSourceControl = gSettings.enableSourceControl;
|
||||
m_generalSettings.m_clearConsoleOnGameModeStart = gSettings.clearConsoleOnGameModeStart;
|
||||
m_generalSettings.m_consoleBackgroundColorTheme = gSettings.consoleBackgroundColorTheme;
|
||||
m_generalSettings.m_bShowTimeInConsole = gSettings.bShowTimeInConsole;
|
||||
m_generalSettings.m_autoLoadLastLevel = gSettings.bAutoloadLastLevelAtStartup;
|
||||
|
||||
@@ -46,6 +46,7 @@ private:
|
||||
bool m_previewPanel;
|
||||
bool m_applyConfigSpec;
|
||||
bool m_enableSourceControl;
|
||||
bool m_clearConsoleOnGameModeStart;
|
||||
AzToolsFramework::ConsoleColorTheme m_consoleBackgroundColorTheme;
|
||||
bool m_autoLoadLastLevel;
|
||||
bool m_bShowTimeInConsole;
|
||||
|
||||
@@ -68,45 +68,21 @@ QIcon& CEditorPreferencesPage_ViewportMovement::GetIcon()
|
||||
|
||||
void CEditorPreferencesPage_ViewportMovement::OnApply()
|
||||
{
|
||||
if (SandboxEditor::UsingNewCameraSystem())
|
||||
{
|
||||
SandboxEditor::SetCameraTranslateSpeed(m_cameraMovementSettings.m_moveSpeed);
|
||||
SandboxEditor::SetCameraRotateSpeed(m_cameraMovementSettings.m_rotateSpeed);
|
||||
SandboxEditor::SetCameraBoostMultiplier(m_cameraMovementSettings.m_fastMoveSpeed);
|
||||
SandboxEditor::SetCameraScrollSpeed(m_cameraMovementSettings.m_wheelZoomSpeed);
|
||||
SandboxEditor::SetCameraOrbitYawRotationInverted(m_cameraMovementSettings.m_invertYRotation);
|
||||
SandboxEditor::SetCameraPanInvertedX(m_cameraMovementSettings.m_invertPan);
|
||||
SandboxEditor::SetCameraPanInvertedY(m_cameraMovementSettings.m_invertPan);
|
||||
}
|
||||
else
|
||||
{
|
||||
gSettings.cameraMoveSpeed = m_cameraMovementSettings.m_moveSpeed;
|
||||
gSettings.cameraRotateSpeed = m_cameraMovementSettings.m_rotateSpeed;
|
||||
gSettings.cameraFastMoveSpeed = m_cameraMovementSettings.m_fastMoveSpeed;
|
||||
gSettings.wheelZoomSpeed = m_cameraMovementSettings.m_wheelZoomSpeed;
|
||||
gSettings.invertYRotation = m_cameraMovementSettings.m_invertYRotation;
|
||||
gSettings.invertPan = m_cameraMovementSettings.m_invertPan;
|
||||
}
|
||||
SandboxEditor::SetCameraTranslateSpeed(m_cameraMovementSettings.m_moveSpeed);
|
||||
SandboxEditor::SetCameraRotateSpeed(m_cameraMovementSettings.m_rotateSpeed);
|
||||
SandboxEditor::SetCameraBoostMultiplier(m_cameraMovementSettings.m_fastMoveSpeed);
|
||||
SandboxEditor::SetCameraScrollSpeed(m_cameraMovementSettings.m_wheelZoomSpeed);
|
||||
SandboxEditor::SetCameraOrbitYawRotationInverted(m_cameraMovementSettings.m_invertYRotation);
|
||||
SandboxEditor::SetCameraPanInvertedX(m_cameraMovementSettings.m_invertPan);
|
||||
SandboxEditor::SetCameraPanInvertedY(m_cameraMovementSettings.m_invertPan);
|
||||
}
|
||||
|
||||
void CEditorPreferencesPage_ViewportMovement::InitializeSettings()
|
||||
{
|
||||
if (SandboxEditor::UsingNewCameraSystem())
|
||||
{
|
||||
m_cameraMovementSettings.m_moveSpeed = SandboxEditor::CameraTranslateSpeed();
|
||||
m_cameraMovementSettings.m_rotateSpeed = SandboxEditor::CameraRotateSpeed();
|
||||
m_cameraMovementSettings.m_fastMoveSpeed = SandboxEditor::CameraBoostMultiplier();
|
||||
m_cameraMovementSettings.m_wheelZoomSpeed = SandboxEditor::CameraScrollSpeed();
|
||||
m_cameraMovementSettings.m_invertYRotation = SandboxEditor::CameraOrbitYawRotationInverted();
|
||||
m_cameraMovementSettings.m_invertPan = SandboxEditor::CameraPanInvertedX() && SandboxEditor::CameraPanInvertedY();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cameraMovementSettings.m_moveSpeed = gSettings.cameraMoveSpeed;
|
||||
m_cameraMovementSettings.m_rotateSpeed = gSettings.cameraRotateSpeed;
|
||||
m_cameraMovementSettings.m_fastMoveSpeed = gSettings.cameraFastMoveSpeed;
|
||||
m_cameraMovementSettings.m_wheelZoomSpeed = gSettings.wheelZoomSpeed;
|
||||
m_cameraMovementSettings.m_invertYRotation = gSettings.invertYRotation;
|
||||
m_cameraMovementSettings.m_invertPan = gSettings.invertPan;
|
||||
}
|
||||
m_cameraMovementSettings.m_moveSpeed = SandboxEditor::CameraTranslateSpeed();
|
||||
m_cameraMovementSettings.m_rotateSpeed = SandboxEditor::CameraRotateSpeed();
|
||||
m_cameraMovementSettings.m_fastMoveSpeed = SandboxEditor::CameraBoostMultiplier();
|
||||
m_cameraMovementSettings.m_wheelZoomSpeed = SandboxEditor::CameraScrollSpeed();
|
||||
m_cameraMovementSettings.m_invertYRotation = SandboxEditor::CameraOrbitYawRotationInverted();
|
||||
m_cameraMovementSettings.m_invertPan = SandboxEditor::CameraPanInvertedX() && SandboxEditor::CameraPanInvertedY();
|
||||
}
|
||||
|
||||
@@ -118,8 +118,4 @@ namespace SandboxEditor
|
||||
|
||||
SANDBOX_API AzFramework::InputChannelId CameraOrbitPanChannelId();
|
||||
SANDBOX_API void SetCameraOrbitPanChannelId(AZStd::string_view cameraOrbitPanId);
|
||||
|
||||
//! Return if the new editor camera system is enabled or not.
|
||||
//! @note This is implemented in EditorViewportWidget.cpp
|
||||
SANDBOX_API bool UsingNewCameraSystem();
|
||||
} // namespace SandboxEditor
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+201
-404
@@ -8,8 +8,6 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
// RenderViewport.h : header file
|
||||
//
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <Cry_Camera.h>
|
||||
@@ -34,6 +32,7 @@
|
||||
#include <MathConversion.h>
|
||||
#include <Atom/RPI.Public/ViewportContext.h>
|
||||
#include <Atom/RPI.Public/SceneBus.h>
|
||||
#include <AzFramework/Components/CameraBus.h>
|
||||
#endif
|
||||
|
||||
#include <AzFramework/Windowing/WindowBus.h>
|
||||
@@ -65,130 +64,120 @@ namespace AzToolsFramework
|
||||
// EditorViewportWidget window
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
class SANDBOX_API EditorViewportWidget
|
||||
class SANDBOX_API EditorViewportWidget final
|
||||
: public QtViewport
|
||||
, public IEditorNotifyListener
|
||||
, public IUndoManagerListener
|
||||
, public Camera::EditorCameraRequestBus::Handler
|
||||
, public AzFramework::InputSystemCursorConstraintRequestBus::Handler
|
||||
, public AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler
|
||||
, public AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler
|
||||
, public AzFramework::AssetCatalogEventBus::Handler
|
||||
, public AZ::RPI::SceneNotificationBus::Handler
|
||||
, private IEditorNotifyListener
|
||||
, private IUndoManagerListener
|
||||
, private Camera::EditorCameraRequestBus::Handler
|
||||
, private Camera::CameraNotificationBus::Handler
|
||||
, private AzFramework::InputSystemCursorConstraintRequestBus::Handler
|
||||
, private AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler
|
||||
, private AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler
|
||||
, private AzFramework::AssetCatalogEventBus::Handler
|
||||
, private AZ::RPI::SceneNotificationBus::Handler
|
||||
{
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
|
||||
Q_OBJECT
|
||||
public:
|
||||
struct SResolution
|
||||
{
|
||||
SResolution()
|
||||
: width(0)
|
||||
, height(0)
|
||||
{
|
||||
}
|
||||
|
||||
SResolution(int w, int h)
|
||||
: width(w)
|
||||
, height(h)
|
||||
{
|
||||
}
|
||||
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
public:
|
||||
EditorViewportWidget(const QString& name, QWidget* parent = nullptr);
|
||||
~EditorViewportWidget() override;
|
||||
|
||||
static const GUID& GetClassID()
|
||||
{
|
||||
return QtViewport::GetClassID<EditorViewportWidget>();
|
||||
}
|
||||
|
||||
/** Get type of this viewport.
|
||||
*/
|
||||
virtual EViewportType GetType() const { return ET_ViewportCamera; }
|
||||
virtual void SetType([[maybe_unused]] EViewportType type) { assert(type == ET_ViewportCamera); };
|
||||
static EditorViewportWidget* GetPrimaryViewport();
|
||||
|
||||
virtual ~EditorViewportWidget();
|
||||
// Used by ViewPan in some circumstances
|
||||
void ConnectViewportInteractionRequestBus();
|
||||
void DisconnectViewportInteractionRequestBus();
|
||||
|
||||
Q_INVOKABLE void InjectFakeMouseMove(int deltaX, int deltaY, Qt::MouseButtons buttons);
|
||||
// QtViewport/IDisplayViewport/CViewport
|
||||
// These methods are made public in the derived class because they are called with an object whose static type is known to be this class type.
|
||||
void SetFOV(float fov) override;
|
||||
float GetFOV() const override;
|
||||
|
||||
// Replacement for still used CRenderer methods
|
||||
void UnProjectFromScreen(float sx, float sy, float sz, float* px, float* py, float* pz) const;
|
||||
void ProjectToScreen(float ptx, float pty, float ptz, float* sx, float* sy, float* sz) const;
|
||||
private:
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Private types ...
|
||||
|
||||
public:
|
||||
virtual void Update();
|
||||
|
||||
virtual void ResetContent();
|
||||
virtual void UpdateContent(int flags);
|
||||
|
||||
void OnTitleMenu(QMenu* menu) override;
|
||||
|
||||
void SetCamera(const CCamera& camera);
|
||||
const CCamera& GetCamera() const { return m_Camera; };
|
||||
virtual void SetViewTM(const Matrix34& tm)
|
||||
enum class ViewSourceType
|
||||
{
|
||||
if (m_viewSourceType == ViewSourceType::None)
|
||||
{
|
||||
m_defaultViewTM = tm;
|
||||
}
|
||||
SetViewTM(tm, false);
|
||||
}
|
||||
None,
|
||||
CameraComponent,
|
||||
ViewSourceTypesCount,
|
||||
};
|
||||
enum class PlayInEditorState
|
||||
{
|
||||
Editor, Starting, Started
|
||||
};
|
||||
enum class KeyPressedState
|
||||
{
|
||||
AllUp,
|
||||
PressedThisFrame,
|
||||
PressedInPreviousFrame,
|
||||
};
|
||||
|
||||
//! Map world space position to viewport position.
|
||||
virtual QPoint WorldToView(const Vec3& wp) const;
|
||||
virtual QPoint WorldToViewParticleEditor(const Vec3& wp, int width, int height) const;
|
||||
virtual Vec3 WorldToView3D(const Vec3& wp, int nFlags = 0) const;
|
||||
|
||||
//! Map viewport position to world space position.
|
||||
virtual Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
|
||||
virtual void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override;
|
||||
virtual Vec3 ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh = false) override;
|
||||
virtual float GetScreenScaleFactor(const Vec3& worldPoint) const;
|
||||
virtual float GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position);
|
||||
virtual float GetAspectRatio() const;
|
||||
virtual bool HitTest(const QPoint& point, HitContext& hitInfo);
|
||||
virtual bool IsBoundsVisible(const AABB& box) const;
|
||||
virtual void CenterOnSelection();
|
||||
virtual void CenterOnAABB(const AABB& aabb);
|
||||
void CenterOnSliceInstance() override;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Method overrides ...
|
||||
|
||||
// QWidget
|
||||
void focusOutEvent(QFocusEvent* event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
bool event(QEvent* event) override;
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
|
||||
void SetFOV(float fov);
|
||||
float GetFOV() const;
|
||||
// QtViewport/IDisplayViewport/CViewport
|
||||
EViewportType GetType() const override { return ET_ViewportCamera; }
|
||||
void SetType([[maybe_unused]] EViewportType type) override { assert(type == ET_ViewportCamera); };
|
||||
AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
|
||||
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point) override;
|
||||
void SetViewportId(int id) override;
|
||||
QPoint WorldToView(const Vec3& wp) const override;
|
||||
QPoint WorldToViewParticleEditor(const Vec3& wp, int width, int height) const override;
|
||||
Vec3 WorldToView3D(const Vec3& wp, int nFlags = 0) const override;
|
||||
Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
|
||||
void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override;
|
||||
Vec3 ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh = false) override;
|
||||
float GetScreenScaleFactor(const Vec3& worldPoint) const override;
|
||||
float GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position) override;
|
||||
float GetAspectRatio() const override;
|
||||
bool HitTest(const QPoint& point, HitContext& hitInfo) override;
|
||||
bool IsBoundsVisible(const AABB& box) const override;
|
||||
void CenterOnSelection() override;
|
||||
void CenterOnAABB(const AABB& aabb) override;
|
||||
void CenterOnSliceInstance() override;
|
||||
void OnTitleMenu(QMenu* menu) override;
|
||||
void SetViewTM(const Matrix34& tm) override;
|
||||
const Matrix34& GetViewTM() const override;
|
||||
void Update() override;
|
||||
void UpdateContent(int flags) override;
|
||||
|
||||
void SetDefaultCamera();
|
||||
bool IsDefaultCamera() const;
|
||||
void SetSequenceCamera();
|
||||
bool IsSequenceCamera() const { return m_viewSourceType == ViewSourceType::SequenceCamera; }
|
||||
void SetSelectedCamera();
|
||||
bool IsSelectedCamera() const;
|
||||
void SetComponentCamera(const AZ::EntityId& entityId);
|
||||
void SetEntityAsCamera(const AZ::EntityId& entityId, bool lockCameraMovement = false);
|
||||
void SetFirstComponentCamera();
|
||||
void SetViewEntity(const AZ::EntityId& cameraEntityId, bool lockCameraMovement = false);
|
||||
void PostCameraSet();
|
||||
// This switches the active camera to the next one in the list of (default, all custom cams).
|
||||
void CycleCamera();
|
||||
// SceneNotificationBus
|
||||
void OnBeginPrepareRender() override;
|
||||
|
||||
// Camera::EditorCameraRequestBus
|
||||
void SetViewFromEntityPerspective(const AZ::EntityId& entityId) override;
|
||||
void SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement) override;
|
||||
AZ::EntityId GetCurrentViewEntityId() override { return m_viewEntityId; }
|
||||
bool GetActiveCameraPosition(AZ::Vector3& cameraPos) override;
|
||||
bool GetActiveCameraState(AzFramework::CameraState& cameraState) override;
|
||||
// Camera::CameraNotificationBus
|
||||
void OnActiveViewChanged(const AZ::EntityId&) override;
|
||||
|
||||
// IEditorEventListener
|
||||
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
|
||||
|
||||
// AzToolsFramework::EditorEntityContextNotificationBus (handler moved to cpp to resolve link issues in unity builds)
|
||||
virtual void OnStartPlayInEditor();
|
||||
virtual void OnStopPlayInEditor();
|
||||
void OnStartPlayInEditor();
|
||||
void OnStopPlayInEditor();
|
||||
void OnStartPlayInEditorBegin();
|
||||
|
||||
AzFramework::CameraState GetCameraState();
|
||||
AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition);
|
||||
// IUndoManagerListener
|
||||
void BeginUndoTransaction() override;
|
||||
void EndUndoTransaction() override;
|
||||
|
||||
// AzFramework::InputSystemCursorConstraintRequestBus
|
||||
void* GetSystemCursorConstraintWindow() const override;
|
||||
|
||||
// AzToolsFramework::ViewportFreezeRequestBus
|
||||
bool IsViewportInputFrozen() override;
|
||||
@@ -204,142 +193,19 @@ public:
|
||||
void BeginWidgetContext() override;
|
||||
void EndWidgetContext() override;
|
||||
|
||||
// CViewport...
|
||||
void SetViewportId(int id) override;
|
||||
|
||||
void ConnectViewportInteractionRequestBus();
|
||||
void DisconnectViewportInteractionRequestBus();
|
||||
|
||||
void LockCameraMovement(bool bLock) { m_bLockCameraMovement = bLock; }
|
||||
bool IsCameraMovementLocked() const { return m_bLockCameraMovement; }
|
||||
|
||||
void EnableCameraObjectMove(bool bMove) { m_bMoveCameraObject = bMove; }
|
||||
bool IsCameraObjectMove() const { return m_bMoveCameraObject; }
|
||||
|
||||
void SetPlayerControl(uint32 i) { m_PlayerControl = i; };
|
||||
uint32 GetPlayerControl() { return m_PlayerControl; };
|
||||
|
||||
const DisplayContext& GetDisplayContext() const { return m_displayContext; }
|
||||
CBaseObject* GetCameraObject() const;
|
||||
|
||||
QPoint WidgetToViewport(const QPoint& point) const;
|
||||
QPoint ViewportToWidget(const QPoint& point) const;
|
||||
QSize WidgetToViewport(const QSize& size) const;
|
||||
|
||||
AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
|
||||
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point) override;
|
||||
|
||||
void SetPlayerPos()
|
||||
{
|
||||
Matrix34 m = GetViewTM();
|
||||
m.SetTranslation(m.GetTranslation() - m_PhysicalLocation.t);
|
||||
SetViewTM(m);
|
||||
|
||||
m_AverageFrameTime = 0.14f;
|
||||
|
||||
m_PhysicalLocation.SetIdentity();
|
||||
|
||||
m_LocalEntityMat.SetIdentity();
|
||||
m_PrevLocalEntityMat.SetIdentity();
|
||||
|
||||
m_absCameraHigh = 2.0f;
|
||||
m_absCameraPos = Vec3(0, 3, 2);
|
||||
m_absCameraPosVP = Vec3(0, -3, 1.5);
|
||||
|
||||
m_absCurrentSlope = 0.0f;
|
||||
|
||||
m_absLookDirectionXY = Vec2(0, 1);
|
||||
|
||||
m_LookAt = Vec3(ZERO);
|
||||
m_LookAtRate = Vec3(ZERO);
|
||||
m_vCamPos = Vec3(ZERO);
|
||||
m_vCamPosRate = Vec3(ZERO);
|
||||
|
||||
m_relCameraRotX = 0;
|
||||
m_relCameraRotZ = 0;
|
||||
|
||||
uint32 numSample6 = m_arrAnimatedCharacterPath.size();
|
||||
for (uint32 i = 0; i < numSample6; i++)
|
||||
{
|
||||
m_arrAnimatedCharacterPath[i] = Vec3(ZERO);
|
||||
}
|
||||
|
||||
numSample6 = m_arrSmoothEntityPath.size();
|
||||
for (uint32 i = 0; i < numSample6; i++)
|
||||
{
|
||||
m_arrSmoothEntityPath[i] = Vec3(ZERO);
|
||||
}
|
||||
|
||||
uint32 numSample7 = m_arrRunStrafeSmoothing.size();
|
||||
for (uint32 i = 0; i < numSample7; i++)
|
||||
{
|
||||
m_arrRunStrafeSmoothing[i] = 0;
|
||||
}
|
||||
|
||||
m_vWorldDesiredBodyDirection = Vec2(0, 1);
|
||||
m_vWorldDesiredBodyDirectionSmooth = Vec2(0, 1);
|
||||
m_vWorldDesiredBodyDirectionSmoothRate = Vec2(0, 1);
|
||||
|
||||
m_vWorldDesiredBodyDirection2 = Vec2(0, 1);
|
||||
|
||||
m_vWorldDesiredMoveDirection = Vec2(0, 1);
|
||||
m_vWorldDesiredMoveDirectionSmooth = Vec2(0, 1);
|
||||
m_vWorldDesiredMoveDirectionSmoothRate = Vec2(0, 1);
|
||||
m_vLocalDesiredMoveDirection = Vec2(0, 1);
|
||||
m_vLocalDesiredMoveDirectionSmooth = Vec2(0, 1);
|
||||
m_vLocalDesiredMoveDirectionSmoothRate = Vec2(0, 1);
|
||||
|
||||
m_vWorldAimBodyDirection = Vec2(0, 1);
|
||||
|
||||
m_MoveSpeedMSec = 5.0f;
|
||||
m_key_W = 0;
|
||||
m_keyrcr_W = 0;
|
||||
m_key_S = 0;
|
||||
m_keyrcr_S = 0;
|
||||
m_key_A = 0;
|
||||
m_keyrcr_A = 0;
|
||||
m_key_D = 0;
|
||||
m_keyrcr_D = 0;
|
||||
m_key_SPACE = 0;
|
||||
m_keyrcr_SPACE = 0;
|
||||
m_ControllMode = 0;
|
||||
|
||||
m_State = -1;
|
||||
m_Stance = 1; //combat
|
||||
|
||||
m_udGround = 0.0f;
|
||||
m_lrGround = 0.0f;
|
||||
AABB aabb = AABB(Vec3(-40.0f, -40.0f, -0.25f), Vec3(+40.0f, +40.0f, +0.0f));
|
||||
m_GroundOBB = OBB::CreateOBBfromAABB(Matrix33(IDENTITY), aabb);
|
||||
m_GroundOBBPos = Vec3(0, 0, -0.01f);
|
||||
};
|
||||
|
||||
static EditorViewportWidget* GetPrimaryViewport();
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
CCamera m_Camera;
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
protected:
|
||||
struct SScopedCurrentContext;
|
||||
// Camera::EditorCameraRequestBus
|
||||
void SetViewFromEntityPerspective(const AZ::EntityId& entityId) override;
|
||||
void SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement) override;
|
||||
AZ::EntityId GetCurrentViewEntityId() override;
|
||||
bool GetActiveCameraPosition(AZ::Vector3& cameraPos) override;
|
||||
bool GetActiveCameraState(AzFramework::CameraState& cameraState) override;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Private helpers...
|
||||
void SetViewTM(const Matrix34& tm, bool bMoveOnly);
|
||||
|
||||
// Called to render stuff.
|
||||
virtual void OnRender();
|
||||
|
||||
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
|
||||
|
||||
//! Get currently active camera object.
|
||||
void ToggleCameraObject();
|
||||
|
||||
void RenderConstructionPlane();
|
||||
void RenderSnapMarker();
|
||||
|
||||
void RenderAll();
|
||||
|
||||
void OnBeginPrepareRender() override;
|
||||
|
||||
// Update the safe frame, safe action, safe title, and borders rectangles based on
|
||||
// viewport size and target aspect ratio.
|
||||
void UpdateSafeFrame();
|
||||
@@ -353,193 +219,41 @@ protected:
|
||||
// Draw a selected region if it has been selected
|
||||
void RenderSelectedRegion();
|
||||
|
||||
virtual bool CreateRenderContext();
|
||||
virtual void DestroyRenderContext();
|
||||
|
||||
void OnMenuCommandChangeAspectRatio(unsigned int commandId);
|
||||
|
||||
bool AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal, Vec3& outPos) const;
|
||||
bool RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const;
|
||||
|
||||
bool AddCameraMenuItems(QMenu* menu);
|
||||
void ResizeView(int width, int height);
|
||||
|
||||
void OnCameraFOVVariableChanged(IVariable* var);
|
||||
|
||||
void HideCursor();
|
||||
void ShowCursor();
|
||||
|
||||
bool IsKeyDown(Qt::Key key) const;
|
||||
|
||||
enum class ViewSourceType
|
||||
{
|
||||
None,
|
||||
SequenceCamera,
|
||||
LegacyCamera,
|
||||
CameraComponent,
|
||||
AZ_Entity,
|
||||
ViewSourceTypesCount,
|
||||
};
|
||||
void ResetToViewSourceType(const ViewSourceType& viewSourType);
|
||||
double WidgetToViewportFactor() const;
|
||||
|
||||
bool ShouldPreviewFullscreen() const;
|
||||
void StartFullscreenPreview();
|
||||
void StopFullscreenPreview();
|
||||
|
||||
bool m_inFullscreenPreview = false;
|
||||
bool m_bRenderContextCreated = false;
|
||||
bool m_bInRotateMode = false;
|
||||
bool m_bInMoveMode = false;
|
||||
bool m_bInOrbitMode = false;
|
||||
bool m_bInZoomMode = false;
|
||||
|
||||
QPoint m_mousePos = QPoint(0, 0);
|
||||
QPoint m_prevMousePos = QPoint(0, 0); // for tablets, you can't use SetCursorPos and need to remember the prior point and delta with that.
|
||||
|
||||
|
||||
float m_moveSpeed = 1;
|
||||
|
||||
float m_orbitDistance = 10.0f;
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
Vec3 m_orbitTarget;
|
||||
|
||||
//-------------------------------------------
|
||||
//--- player-control in CharEdit ---
|
||||
//-------------------------------------------
|
||||
f32 m_MoveSpeedMSec;
|
||||
|
||||
uint32 m_key_W, m_keyrcr_W;
|
||||
uint32 m_key_S, m_keyrcr_S;
|
||||
uint32 m_key_A, m_keyrcr_A;
|
||||
uint32 m_key_D, m_keyrcr_D;
|
||||
|
||||
uint32 m_key_SPACE, m_keyrcr_SPACE;
|
||||
uint32 m_ControllMode;
|
||||
|
||||
int32 m_Stance;
|
||||
int32 m_State;
|
||||
f32 m_AverageFrameTime;
|
||||
|
||||
uint32 m_PlayerControl = 0;
|
||||
|
||||
f32 m_absCameraHigh;
|
||||
Vec3 m_absCameraPos;
|
||||
Vec3 m_absCameraPosVP;
|
||||
|
||||
f32 m_absCurrentSlope; //in radiants
|
||||
|
||||
Vec2 m_absLookDirectionXY;
|
||||
|
||||
Vec3 m_LookAt;
|
||||
Vec3 m_LookAtRate;
|
||||
Vec3 m_vCamPos;
|
||||
Vec3 m_vCamPosRate;
|
||||
float m_camFOV;
|
||||
|
||||
f32 m_relCameraRotX;
|
||||
f32 m_relCameraRotZ;
|
||||
|
||||
QuatTS m_PhysicalLocation;
|
||||
|
||||
Matrix34 m_AnimatedCharacterMat;
|
||||
|
||||
Matrix34 m_LocalEntityMat; //this is used for data-driven animations where the character is running on the spot
|
||||
Matrix34 m_PrevLocalEntityMat;
|
||||
|
||||
std::vector<Vec3> m_arrVerticesHF;
|
||||
std::vector<vtx_idx> m_arrIndicesHF;
|
||||
|
||||
std::vector<Vec3> m_arrAnimatedCharacterPath;
|
||||
std::vector<Vec3> m_arrSmoothEntityPath;
|
||||
std::vector<f32> m_arrRunStrafeSmoothing;
|
||||
|
||||
Vec2 m_vWorldDesiredBodyDirection;
|
||||
Vec2 m_vWorldDesiredBodyDirectionSmooth;
|
||||
Vec2 m_vWorldDesiredBodyDirectionSmoothRate;
|
||||
|
||||
Vec2 m_vWorldDesiredBodyDirection2;
|
||||
|
||||
|
||||
Vec2 m_vWorldDesiredMoveDirection;
|
||||
Vec2 m_vWorldDesiredMoveDirectionSmooth;
|
||||
Vec2 m_vWorldDesiredMoveDirectionSmoothRate;
|
||||
Vec2 m_vLocalDesiredMoveDirection;
|
||||
Vec2 m_vLocalDesiredMoveDirectionSmooth;
|
||||
Vec2 m_vLocalDesiredMoveDirectionSmoothRate;
|
||||
Vec2 m_vWorldAimBodyDirection;
|
||||
|
||||
f32 m_udGround;
|
||||
f32 m_lrGround;
|
||||
OBB m_GroundOBB;
|
||||
Vec3 m_GroundOBBPos;
|
||||
|
||||
// Index of camera objects.
|
||||
mutable GUID m_cameraObjectId;
|
||||
mutable AZ::EntityId m_viewEntityId;
|
||||
mutable ViewSourceType m_viewSourceType = ViewSourceType::None;
|
||||
AZ::EntityId m_viewEntityIdCachedForEditMode;
|
||||
Matrix34 m_preGameModeViewTM;
|
||||
uint m_disableRenderingCount = 0;
|
||||
bool m_bLockCameraMovement;
|
||||
bool m_bUpdateViewport = false;
|
||||
bool m_bMoveCameraObject = true;
|
||||
|
||||
enum class KeyPressedState
|
||||
{
|
||||
AllUp,
|
||||
PressedThisFrame,
|
||||
PressedInPreviousFrame,
|
||||
};
|
||||
KeyPressedState m_pressedKeyState = KeyPressedState::AllUp;
|
||||
|
||||
Matrix34 m_defaultViewTM;
|
||||
const QString m_defaultViewName;
|
||||
|
||||
DisplayContext m_displayContext;
|
||||
|
||||
|
||||
bool m_isOnPaint = false;
|
||||
static EditorViewportWidget* m_pPrimaryViewport;
|
||||
|
||||
QRect m_safeFrame;
|
||||
QRect m_safeAction;
|
||||
QRect m_safeTitle;
|
||||
|
||||
CPredefinedAspectRatios m_predefinedAspectRatios;
|
||||
|
||||
bool m_bCursorHidden = false;
|
||||
|
||||
void OnMenuResolutionCustom();
|
||||
void OnMenuCreateCameraEntityFromCurrentView();
|
||||
void OnMenuSelectCurrentCamera();
|
||||
|
||||
int OnCreate();
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
|
||||
// From a series of input primitives, compose a complete mouse interaction.
|
||||
AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteractionInternal(
|
||||
AzToolsFramework::ViewportInteraction::MouseButtons buttons,
|
||||
AzToolsFramework::ViewportInteraction::KeyboardModifiers modifiers,
|
||||
const AzToolsFramework::ViewportInteraction::MousePick& mousePick) const;
|
||||
|
||||
// Given a point in the viewport, return the pick ray into the scene.
|
||||
// note: The argument passed to parameter **point**, originating
|
||||
// from a Qt event, must first be passed to WidgetToViewport before being
|
||||
// passed to BuildMousePick.
|
||||
AzToolsFramework::ViewportInteraction::MousePick BuildMousePick(const QPoint& point);
|
||||
|
||||
bool event(QEvent* event) override;
|
||||
void OnDestroy();
|
||||
|
||||
bool CheckRespondToInput() const;
|
||||
|
||||
// AzFramework::InputSystemCursorConstraintRequestBus
|
||||
void* GetSystemCursorConstraintWindow() const override;
|
||||
|
||||
void BuildDragDropContext(AzQtComponents::ViewportDragContext& context, const QPoint& pt) override;
|
||||
|
||||
private:
|
||||
void SetAsActiveViewport();
|
||||
void PushDisableRendering();
|
||||
void PopDisableRendering();
|
||||
@@ -547,48 +261,131 @@ private:
|
||||
AzToolsFramework::ViewportInteraction::MousePick BuildMousePickInternal(const QPoint& point) const;
|
||||
|
||||
void RestoreViewportAfterGameMode();
|
||||
void UpdateCameraFromViewportContext();
|
||||
|
||||
double WidgetToViewportFactor() const
|
||||
{
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
// Needed for high DPI mode on windows
|
||||
return devicePixelRatioF();
|
||||
#else
|
||||
return 1.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void BeginUndoTransaction() override;
|
||||
void EndUndoTransaction() override;
|
||||
|
||||
void UpdateCurrentMousePos(const QPoint& newPosition);
|
||||
void UpdateScene();
|
||||
|
||||
void SetDefaultCamera();
|
||||
void SetSelectedCamera();
|
||||
bool IsSelectedCamera() const;
|
||||
void SetComponentCamera(const AZ::EntityId& entityId);
|
||||
void SetEntityAsCamera(const AZ::EntityId& entityId, bool lockCameraMovement = false);
|
||||
void SetFirstComponentCamera();
|
||||
void PostCameraSet();
|
||||
// This switches the active camera to the next one in the list of (default, all custom cams).
|
||||
void CycleCamera();
|
||||
|
||||
AzFramework::CameraState GetCameraState();
|
||||
AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition);
|
||||
|
||||
QPoint WidgetToViewport(const QPoint& point) const;
|
||||
QPoint ViewportToWidget(const QPoint& point) const;
|
||||
QSize WidgetToViewport(const QSize& size) const;
|
||||
|
||||
const DisplayContext& GetDisplayContext() const { return m_displayContext; }
|
||||
CBaseObject* GetCameraObject() const;
|
||||
|
||||
void UnProjectFromScreen(float sx, float sy, float sz, float* px, float* py, float* pz) const;
|
||||
void ProjectToScreen(float ptx, float pty, float ptz, float* sx, float* sy, float* sz) const;
|
||||
|
||||
AZ::RPI::ViewPtr GetCurrentAtomView() const;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Members ...
|
||||
friend class AZ::ViewportHelpers::EditorEntityNotifications;
|
||||
|
||||
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
// Singleton for the primary viewport
|
||||
static EditorViewportWidget* m_pPrimaryViewport;
|
||||
|
||||
// The simulation (play-game in editor) state
|
||||
PlayInEditorState m_playInEditorState = PlayInEditorState::Editor;
|
||||
|
||||
// Whether we are doing a full screen game preview (play-game in editor) or a regular one
|
||||
bool m_inFullscreenPreview = false;
|
||||
|
||||
// The entity ID of the current camera for this viewport, or invalid if the default editor camera
|
||||
AZ::EntityId m_viewEntityId;
|
||||
|
||||
// Determines also if the current camera for this viewport is default editor camera
|
||||
ViewSourceType m_viewSourceType = ViewSourceType::None;
|
||||
|
||||
// During play game in editor, holds the editor entity ID of the last
|
||||
AZ::EntityId m_viewEntityIdCachedForEditMode;
|
||||
|
||||
// The editor camera TM before switching to game mode
|
||||
Matrix34 m_preGameModeViewTM;
|
||||
|
||||
// Disables rendering during some periods of time, e.g. undo/redo, resize events
|
||||
uint m_disableRenderingCount = 0;
|
||||
|
||||
// Determines if the viewport needs updating (false when out of focus for example)
|
||||
bool m_bUpdateViewport = false;
|
||||
|
||||
// Avoid re-entering PostCameraSet->OnActiveViewChanged->PostCameraSet
|
||||
bool m_sendingOnActiveChanged = false;
|
||||
|
||||
// Legacy...
|
||||
KeyPressedState m_pressedKeyState = KeyPressedState::AllUp;
|
||||
|
||||
// The last camera matrix of the default editor camera, used when switching back to editor camera to restore the right TM
|
||||
Matrix34 m_defaultViewTM;
|
||||
|
||||
// The name to use for the default editor camera
|
||||
const QString m_defaultViewName;
|
||||
|
||||
// Note that any attempts to draw anything with this object will crash. Exists here for legacy "reasons"
|
||||
DisplayContext m_displayContext;
|
||||
|
||||
// Re-entrency guard for on paint events
|
||||
bool m_isOnPaint = false;
|
||||
|
||||
// Shapes of various safe frame helpers which can be displayed in the editor
|
||||
QRect m_safeFrame;
|
||||
QRect m_safeAction;
|
||||
QRect m_safeTitle;
|
||||
|
||||
// Aspect ratios available in the title bar
|
||||
CPredefinedAspectRatios m_predefinedAspectRatios;
|
||||
|
||||
// Is the cursor hidden or displayed?
|
||||
bool m_bCursorHidden = false;
|
||||
|
||||
// Shim for QtViewport, which used to be responsible for visibility queries in the editor,
|
||||
// these are now forwarded to EntityVisibilityQuery
|
||||
AzFramework::EntityVisibilityQuery m_entityVisibilityQuery;
|
||||
|
||||
// Handlers for grid snapping/editor event callbacks
|
||||
SandboxEditor::GridSnappingChangedEvent::Handler m_gridSnappingHandler;
|
||||
AZStd::unique_ptr<SandboxEditor::EditorViewportSettingsCallbacks> m_editorViewportSettingsCallbacks;
|
||||
|
||||
// Used for some legacy logic which lets the widget release a grabbed keyboard at the right times
|
||||
// Unclear if it's still necessary.
|
||||
QSet<int> m_keyDown;
|
||||
|
||||
// State for ViewportFreezeRequestBus, currently does nothing
|
||||
bool m_freezeViewportInput = false;
|
||||
|
||||
// This widget holds a reference to the manipulator manage because its responsible for drawing manipulators
|
||||
AZStd::shared_ptr<AzToolsFramework::ManipulatorManager> m_manipulatorManager;
|
||||
|
||||
// Used to prevent circular set camera events
|
||||
bool m_ignoreSetViewFromEntityPerspective = false;
|
||||
bool m_windowResizedEvent = false;
|
||||
|
||||
// Helper for getting EditorEntityNotificationBus events
|
||||
AZStd::unique_ptr<AZ::ViewportHelpers::EditorEntityNotifications> m_editorEntityNotifications;
|
||||
|
||||
// The widget to which Atom will actually render
|
||||
AtomToolsFramework::RenderViewportWidget* m_renderViewport = nullptr;
|
||||
|
||||
bool m_updateCameraPositionNextTick = false;
|
||||
AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraViewMatrixChangeHandler;
|
||||
AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraProjectionMatrixChangeHandler;
|
||||
// Atom debug display
|
||||
AzFramework::DebugDisplayRequests* m_debugDisplay = nullptr;
|
||||
|
||||
// The default view created for the viewport context, which is used as the "Editor Camera"
|
||||
AZ::RPI::ViewPtr m_defaultView;
|
||||
|
||||
// The name to set on the viewport context when this viewport widget is set as the active one
|
||||
AZ::Name m_defaultViewportContextName;
|
||||
|
||||
// DO NOT USE THIS! It exists only to satisfy the signature of the base class method GetViewTm
|
||||
mutable Matrix34 m_viewTmStorage;
|
||||
|
||||
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
};
|
||||
|
||||
@@ -136,11 +136,11 @@ void CErrorReport::ReportError(CErrorRecord& err)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (err.pObject == NULL && m_pObject != NULL)
|
||||
if (err.pObject == nullptr && m_pObject != nullptr)
|
||||
{
|
||||
err.pObject = m_pObject;
|
||||
}
|
||||
else if (err.pItem == NULL && m_pItem != NULL)
|
||||
else if (err.pItem == nullptr && m_pItem != nullptr)
|
||||
{
|
||||
err.pItem = m_pItem;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
bool IsEmpty() const;
|
||||
|
||||
//! Get number of contained error records.
|
||||
int GetErrorCount() const { return m_errors.size(); };
|
||||
int GetErrorCount() const { return static_cast<int>(m_errors.size()); };
|
||||
//! Get access to indexed error record.
|
||||
CErrorRecord& GetError(int i);
|
||||
//! Clear all error records.
|
||||
|
||||
@@ -39,7 +39,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CErrorReportDialog* CErrorReportDialog::m_instance = 0;
|
||||
CErrorReportDialog* CErrorReportDialog::m_instance = nullptr;
|
||||
|
||||
// CErrorReportDialog dialog
|
||||
|
||||
@@ -88,12 +88,12 @@ CErrorReportDialog::CErrorReportDialog(QWidget* parent)
|
||||
m_instance = this;
|
||||
//CErrorReport *report,
|
||||
//m_pErrorReport = report;
|
||||
m_pErrorReport = 0;
|
||||
m_pErrorReport = nullptr;
|
||||
}
|
||||
|
||||
CErrorReportDialog::~CErrorReportDialog()
|
||||
{
|
||||
m_instance = 0;
|
||||
m_instance = nullptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -141,7 +141,7 @@ void CErrorReportDialog::Clear()
|
||||
{
|
||||
if (m_instance)
|
||||
{
|
||||
m_instance->SetReport(0);
|
||||
m_instance->SetReport(nullptr);
|
||||
m_instance->UpdateErrors();
|
||||
}
|
||||
}
|
||||
@@ -500,7 +500,7 @@ void CErrorReportDialog::OnReportItemDblClick(const QModelIndex& index)
|
||||
{
|
||||
bool bDone = false;
|
||||
const CErrorRecord* pError = index.data(Qt::UserRole).value<const CErrorRecord*>();
|
||||
if (pError && pError->pObject != NULL)
|
||||
if (pError && pError->pObject != nullptr)
|
||||
{
|
||||
CUndo undo("Select Object(s)");
|
||||
// Clear other selection.
|
||||
@@ -563,7 +563,7 @@ void CErrorReportDialog::OnReportHyperlink(const QModelIndex& index)
|
||||
{
|
||||
const CErrorRecord* pError = index.data(Qt::UserRole).value<const CErrorRecord*>();
|
||||
bool bDone = false;
|
||||
if (pError && pError->pObject != NULL)
|
||||
if (pError && pError->pObject != nullptr)
|
||||
{
|
||||
CUndo undo("Select Object(s)");
|
||||
// Clear other selection.
|
||||
@@ -593,8 +593,8 @@ void CErrorReportDialog::OnShowFieldChooser()
|
||||
CMainFrm* pMainFrm = (CMainFrame*)AfxGetMainWnd();
|
||||
if (pMainFrm)
|
||||
{
|
||||
BOOL bShow = !pMainFrm->m_wndFieldChooser.IsVisible();
|
||||
pMainFrm->ShowControlBar(&pMainFrm->m_wndFieldChooser, bShow, FALSE);
|
||||
bool bShow = !pMainFrm->m_wndFieldChooser.IsVisible();
|
||||
pMainFrm->ShowControlBar(&pMainFrm->m_wndFieldChooser, bShow, false);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -105,7 +105,7 @@ void CErrorReportTableModel::setErrorReport(CErrorReport* report)
|
||||
{
|
||||
m_errorRecords.clear();
|
||||
}
|
||||
if (report != 0)
|
||||
if (report != nullptr)
|
||||
{
|
||||
const int count = report->GetErrorCount();
|
||||
m_errorRecords.reserve(count);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "OBJExporter.h"
|
||||
#include "OCMExporter.h"
|
||||
#include "FBXExporterDialog.h"
|
||||
#include "RenderViewport.h"
|
||||
#include "TrackViewExportKeyTimeDlg.h"
|
||||
#include "AnimationContext.h"
|
||||
#include "TrackView/DirectorNodeAnimator.h"
|
||||
@@ -46,7 +45,7 @@ namespace
|
||||
SEfResTexture* pTex = pRes->GetTextureResource(nSlot);
|
||||
if (pTex)
|
||||
{
|
||||
cry_strcat(outName, Path::GamePathToFullPath(pTex->m_Name.c_str()).toUtf8().data());
|
||||
azstrcat(outName, AZ_ARRAY_SIZE(outName), Path::GamePathToFullPath(pTex->m_Name.c_str()).toUtf8().data());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +87,7 @@ Export::CObject::CObject(const char* pName)
|
||||
|
||||
nParent = -1;
|
||||
|
||||
cry_strcpy(name, pName);
|
||||
azstrcpy(name, AZ_ARRAY_SIZE(name), pName);
|
||||
|
||||
materialName[0] = '\0';
|
||||
|
||||
@@ -96,13 +95,13 @@ Export::CObject::CObject(const char* pName)
|
||||
|
||||
cameraTargetNodeName[0] = '\0';
|
||||
|
||||
m_pLastObject = 0;
|
||||
m_pLastObject = nullptr;
|
||||
}
|
||||
|
||||
|
||||
void Export::CObject::SetMaterialName(const char* pName)
|
||||
{
|
||||
cry_strcpy(materialName, pName);
|
||||
azstrcpy(materialName, AZ_ARRAY_SIZE(materialName), pName);
|
||||
}
|
||||
|
||||
|
||||
@@ -116,14 +115,14 @@ void Export::CData::Clear()
|
||||
// CExportManager
|
||||
CExportManager::CExportManager()
|
||||
: m_isPrecaching(false)
|
||||
, m_pBaseObj(0)
|
||||
, m_pBaseObj(nullptr)
|
||||
, m_FBXBakedExportFPS(0.0f)
|
||||
, m_fScale(100.0f)
|
||||
, // this scale is used by CryEngine RC
|
||||
m_bAnimationExport(false)
|
||||
, m_bExportLocalCoords(false)
|
||||
, m_numberOfExportFrames(0)
|
||||
, m_pivotEntityObject(0)
|
||||
, m_pivotEntityObject(nullptr)
|
||||
, m_bBakedKeysSequenceExport(true)
|
||||
, m_animTimeExportPrimarySequenceCurrentTime(0.0f)
|
||||
, m_animKeyTimeExport(true)
|
||||
@@ -290,7 +289,7 @@ void CExportManager::ProcessEntityAnimationTrack(
|
||||
const AZ::EntityId entityId, Export::CObject* pObj, AnimParamType entityTrackParamType)
|
||||
{
|
||||
CTrackViewAnimNode* pEntityNode = GetIEditor()->GetSequenceManager()->GetActiveAnimNode(entityId);
|
||||
CTrackViewTrack* pEntityTrack = (pEntityNode ? pEntityNode->GetTrackForParameter(entityTrackParamType) : 0);
|
||||
CTrackViewTrack* pEntityTrack = (pEntityNode ? pEntityNode->GetTrackForParameter(entityTrackParamType) : nullptr);
|
||||
|
||||
if (!pEntityTrack)
|
||||
{
|
||||
@@ -397,7 +396,7 @@ void CExportManager::AddMesh(Export::CObject* pObj, const IIndexedMesh* pIndMesh
|
||||
else
|
||||
{
|
||||
Export::CMesh* pMesh = new Export::CMesh();
|
||||
if (meshDesc.m_nFaceCount == 0 && meshDesc.m_nIndexCount != 0 && meshDesc.m_pIndices != 0)
|
||||
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;
|
||||
@@ -431,7 +430,7 @@ void CExportManager::AddMesh(Export::CObject* pObj, const IIndexedMesh* pIndMesh
|
||||
|
||||
bool CExportManager::AddStatObj(Export::CObject* pObj, IStatObj* pStatObj, Matrix34A* pTm)
|
||||
{
|
||||
IIndexedMesh* pIndMesh = 0;
|
||||
IIndexedMesh* pIndMesh = nullptr;
|
||||
|
||||
if (pStatObj->GetSubObjectCount())
|
||||
{
|
||||
@@ -440,7 +439,7 @@ bool CExportManager::AddStatObj(Export::CObject* pObj, IStatObj* pStatObj, Matri
|
||||
IStatObj::SSubObject* pSubObj = pStatObj->GetSubObject(i);
|
||||
if (pSubObj && pSubObj->nType == STATIC_SUB_OBJECT_MESH && pSubObj->pStatObj)
|
||||
{
|
||||
pIndMesh = 0;
|
||||
pIndMesh = nullptr;
|
||||
if (m_isOccluder)
|
||||
{
|
||||
if (pSubObj->pStatObj->GetLodObject(2))
|
||||
@@ -542,7 +541,7 @@ bool CExportManager::AddObject(CBaseObject* pBaseObj)
|
||||
|
||||
if (m_isPrecaching)
|
||||
{
|
||||
AddMeshes(0);
|
||||
AddMeshes(nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -554,7 +553,7 @@ bool CExportManager::AddObject(CBaseObject* pBaseObj)
|
||||
m_objectMap[pBaseObj] = int(m_data.m_objects.size() - 1);
|
||||
|
||||
AddMeshes(pObj);
|
||||
m_pBaseObj = 0;
|
||||
m_pBaseObj = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -662,12 +661,6 @@ bool CExportManager::ProcessObjectsForExport()
|
||||
GetIEditor()->GetAnimation()->SetRecording(false);
|
||||
GetIEditor()->GetAnimation()->SetPlaying(false);
|
||||
|
||||
CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
|
||||
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
|
||||
{
|
||||
rvp->SetSequenceCamera();
|
||||
}
|
||||
|
||||
int startFrame = 0;
|
||||
timeValue = startFrame * fpsTimeInterval;
|
||||
|
||||
@@ -678,7 +671,7 @@ bool CExportManager::ProcessObjectsForExport()
|
||||
for (size_t objectID = 0; objectID < m_data.m_objects.size(); ++objectID)
|
||||
{
|
||||
Export::CObject* pObj2 = m_data.m_objects[objectID];
|
||||
CBaseObject* pObject = 0;
|
||||
CBaseObject* pObject = nullptr;
|
||||
|
||||
if (QString::compare(pObj2->name, kPrimaryCameraName) == 0)
|
||||
{
|
||||
@@ -983,7 +976,7 @@ bool CExportManager::AddObjectsFromSequence(CTrackViewSequence* pSequence, XmlNo
|
||||
{
|
||||
if (pSubSequence && !pSubSequence->IsDisabled())
|
||||
{
|
||||
XmlNodeRef subSeqNode = 0;
|
||||
XmlNodeRef subSeqNode = nullptr;
|
||||
|
||||
if (!seqNode)
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ bool COBJExporter::ExportToFile(const char* filename, const Export::IData* pExpo
|
||||
while (nParent >= 0 && nParent < pExportData->GetObjectCount())
|
||||
{
|
||||
const Export::Object* pParentObj = pExportData->GetObject(nParent);
|
||||
assert(NULL != pParentObj);
|
||||
assert(nullptr != pParentObj);
|
||||
|
||||
Vec3 pos2(pParentObj->pos.x, pParentObj->pos.y, pParentObj->pos.z);
|
||||
Quat rot2(pParentObj->rot.w, pParentObj->rot.v.x, pParentObj->rot.v.y, pParentObj->rot.v.z);
|
||||
|
||||
+17
-26
@@ -57,12 +57,12 @@ struct SSystemUserCallback
|
||||
: public ISystemUserCallback
|
||||
{
|
||||
SSystemUserCallback(IInitializeUIInfo* logo) : m_threadErrorHandler(this) { m_pLogo = logo; };
|
||||
virtual void OnSystemConnect(ISystem* pSystem)
|
||||
void OnSystemConnect(ISystem* pSystem) override
|
||||
{
|
||||
ModuleInitISystem(pSystem, "Editor");
|
||||
}
|
||||
|
||||
virtual bool OnError(const char* szErrorString)
|
||||
bool OnError(const char* szErrorString) override
|
||||
{
|
||||
// since we show a message box, we have to use the GUI thread
|
||||
if (QThread::currentThread() != qApp->thread())
|
||||
@@ -95,7 +95,7 @@ struct SSystemUserCallback
|
||||
|
||||
int res = IDNO;
|
||||
|
||||
ICVar* pCVar = gEnv->pConsole ? gEnv->pConsole->GetCVar("sys_no_crash_dialog") : NULL;
|
||||
ICVar* pCVar = gEnv->pConsole ? gEnv->pConsole->GetCVar("sys_no_crash_dialog") : nullptr;
|
||||
|
||||
if (!pCVar || pCVar->GetIVal() == 0)
|
||||
{
|
||||
@@ -116,7 +116,7 @@ struct SSystemUserCallback
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool OnSaveDocument()
|
||||
bool OnSaveDocument() override
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
@@ -133,7 +133,7 @@ struct SSystemUserCallback
|
||||
return success;
|
||||
}
|
||||
|
||||
virtual bool OnBackupDocument()
|
||||
bool OnBackupDocument() override
|
||||
{
|
||||
CCryEditDoc* level = GetIEditor() ? GetIEditor()->GetDocument() : nullptr;
|
||||
if (level)
|
||||
@@ -144,7 +144,7 @@ struct SSystemUserCallback
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void OnProcessSwitch()
|
||||
void OnProcessSwitch() override
|
||||
{
|
||||
if (GetIEditor()->IsInGameMode())
|
||||
{
|
||||
@@ -152,7 +152,7 @@ struct SSystemUserCallback
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnInitProgress(const char* sProgressMsg)
|
||||
void OnInitProgress(const char* sProgressMsg) override
|
||||
{
|
||||
if (m_pLogo)
|
||||
{
|
||||
@@ -160,7 +160,7 @@ struct SSystemUserCallback
|
||||
}
|
||||
}
|
||||
|
||||
virtual int ShowMessage(const char* text, const char* caption, unsigned int uType)
|
||||
int ShowMessage(const char* text, const char* caption, unsigned int uType) override
|
||||
{
|
||||
if (CCryEditApp::instance()->IsInAutotestMode())
|
||||
{
|
||||
@@ -176,7 +176,7 @@ struct SSystemUserCallback
|
||||
return CryMessageBox(text, caption, uType);
|
||||
}
|
||||
|
||||
virtual void GetMemoryUsage(ICrySizer* pSizer)
|
||||
void GetMemoryUsage(ICrySizer* pSizer) override
|
||||
{
|
||||
GetIEditor()->GetMemoryUsage(pSizer);
|
||||
}
|
||||
@@ -215,7 +215,7 @@ public:
|
||||
{
|
||||
AzFramework::AssetSystemConnectionNotificationsBus::Handler::BusConnect();
|
||||
};
|
||||
~AssetProcessConnectionStatus()
|
||||
~AssetProcessConnectionStatus() override
|
||||
{
|
||||
AzFramework::AssetSystemConnectionNotificationsBus::Handler::BusDisconnect();
|
||||
}
|
||||
@@ -247,18 +247,18 @@ private:
|
||||
|
||||
AZ_PUSH_DISABLE_WARNING(4273, "-Wunknown-warning-option")
|
||||
CGameEngine::CGameEngine()
|
||||
: m_gameDll(0)
|
||||
: m_gameDll(nullptr)
|
||||
, m_bIgnoreUpdates(false)
|
||||
, m_ePendingGameMode(ePGM_NotPending)
|
||||
, m_modalWindowDismisser(nullptr)
|
||||
AZ_POP_DISABLE_WARNING
|
||||
{
|
||||
m_pISystem = NULL;
|
||||
m_pISystem = nullptr;
|
||||
m_bLevelLoaded = false;
|
||||
m_bInGameMode = false;
|
||||
m_bSimulationMode = false;
|
||||
m_bSyncPlayerPosition = true;
|
||||
m_hSystemHandle = 0;
|
||||
m_hSystemHandle = nullptr;
|
||||
m_bJustCreated = false;
|
||||
m_levelName = "Untitled";
|
||||
m_levelExtension = EditorUtils::LevelFile::GetDefaultFileExtension();
|
||||
@@ -271,7 +271,7 @@ CGameEngine::~CGameEngine()
|
||||
{
|
||||
AZ_POP_DISABLE_WARNING
|
||||
GetIEditor()->UnregisterNotifyListener(this);
|
||||
m_pISystem->GetIMovieSystem()->SetCallback(NULL);
|
||||
m_pISystem->GetIMovieSystem()->SetCallback(nullptr);
|
||||
|
||||
if (m_gameDll)
|
||||
{
|
||||
@@ -279,7 +279,7 @@ AZ_POP_DISABLE_WARNING
|
||||
}
|
||||
|
||||
delete m_pISystem;
|
||||
m_pISystem = NULL;
|
||||
m_pISystem = nullptr;
|
||||
|
||||
if (m_hSystemHandle)
|
||||
{
|
||||
@@ -566,14 +566,12 @@ void CGameEngine::SwitchToInGame()
|
||||
streamer->QueueRequest(flush);
|
||||
wait.acquire();
|
||||
}
|
||||
|
||||
|
||||
GetIEditor()->Notify(eNotify_OnBeginGameMode);
|
||||
|
||||
m_pISystem->GetIMovieSystem()->EnablePhysicsEvents(true);
|
||||
m_bInGameMode = true;
|
||||
|
||||
gEnv->pSystem->GetViewCamera().SetMatrix(m_playerViewTM);
|
||||
|
||||
// Disable accelerators.
|
||||
GetIEditor()->EnableAcceleratos(false);
|
||||
//! Send event to switch into game.
|
||||
@@ -627,13 +625,6 @@ void CGameEngine::SwitchToInEditor()
|
||||
|
||||
m_bInGameMode = false;
|
||||
|
||||
// save the current gameView matrix for editor
|
||||
if (pGameViewport)
|
||||
{
|
||||
Matrix34 gameView = gEnv->pSystem->GetViewCamera().GetMatrix();
|
||||
pGameViewport->SetGameTM(gameView);
|
||||
}
|
||||
|
||||
// Out of game in Editor mode.
|
||||
if (pGameViewport)
|
||||
{
|
||||
@@ -875,7 +866,7 @@ void CGameEngine::OnEditorNotifyEvent(EEditorNotifyEvent event)
|
||||
{
|
||||
case eNotify_OnSplashScreenDestroyed:
|
||||
{
|
||||
if (m_pSystemUserCallback != NULL)
|
||||
if (m_pSystemUserCallback != nullptr)
|
||||
{
|
||||
m_pSystemUserCallback->OnSplashScreenDone();
|
||||
}
|
||||
|
||||
@@ -116,11 +116,11 @@ public:
|
||||
|
||||
//! mutex used by other threads to lock up the PAK modification,
|
||||
//! so only one thread can modify the PAK at once
|
||||
static CryMutex& GetPakModifyMutex()
|
||||
static AZStd::recursive_mutex& GetPakModifyMutex()
|
||||
{
|
||||
//! mutex used to halt copy process while the export to game
|
||||
//! or other pak operation is done in the main thread
|
||||
static CryMutex s_pakModifyMutex;
|
||||
static AZStd::recursive_mutex s_pakModifyMutex;
|
||||
return s_pakModifyMutex;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ void SGameExporterSettings::SetHiQuality()
|
||||
nApplySS = 1;
|
||||
}
|
||||
|
||||
CGameExporter* CGameExporter::m_pCurrentExporter = NULL;
|
||||
CGameExporter* CGameExporter::m_pCurrentExporter = nullptr;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// CGameExporter
|
||||
@@ -76,7 +76,7 @@ CGameExporter::CGameExporter()
|
||||
|
||||
CGameExporter::~CGameExporter()
|
||||
{
|
||||
m_pCurrentExporter = NULL;
|
||||
m_pCurrentExporter = nullptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -136,7 +136,7 @@ bool CGameExporter::Export(unsigned int flags, [[maybe_unused]] EEndian eExportE
|
||||
m_settings.SetHiQuality();
|
||||
}
|
||||
|
||||
CryAutoLock<CryMutex> autoLock(CGameEngine::GetPakModifyMutex());
|
||||
AZStd::scoped_lock autoLock(CGameEngine::GetPakModifyMutex());
|
||||
|
||||
// Close this pak file.
|
||||
if (!CloseLevelPack(m_levelPak, true))
|
||||
@@ -378,14 +378,14 @@ void CGameExporter::ExportFileList(const QString& path, const QString& levelName
|
||||
{
|
||||
// process the folder of the specified map name, producing a filelist.xml file
|
||||
// that can later be used for map downloads
|
||||
string newpath;
|
||||
AZStd::string newpath;
|
||||
|
||||
QString filename = levelName;
|
||||
string mapname = (filename + ".dds").toUtf8().data();
|
||||
string metaname = (filename + ".xml").toUtf8().data();
|
||||
AZStd::string filename = levelName.toUtf8().data();
|
||||
AZStd::string mapname = (filename + ".dds");
|
||||
AZStd::string metaname = (filename + ".xml");
|
||||
|
||||
XmlNodeRef rootNode = gEnv->pSystem->CreateXmlNode("download");
|
||||
rootNode->setAttr("name", filename.toUtf8().data());
|
||||
rootNode->setAttr("name", filename.c_str());
|
||||
rootNode->setAttr("type", "Map");
|
||||
XmlNodeRef indexNode = rootNode->newChild("index");
|
||||
if (indexNode)
|
||||
@@ -434,9 +434,9 @@ void CGameExporter::ExportFileList(const QString& path, const QString& levelName
|
||||
newFileNode->setAttr("size", handle.m_fileDesc.nSize);
|
||||
|
||||
unsigned char md5[16];
|
||||
string filenameToHash = GetIEditor()->GetGameEngine()->GetLevelPath().toUtf8().data();
|
||||
AZStd::string filenameToHash = GetIEditor()->GetGameEngine()->GetLevelPath().toUtf8().data();
|
||||
filenameToHash += "/";
|
||||
filenameToHash += string{ handle.m_filename.data(), handle.m_filename.size() };
|
||||
filenameToHash += AZStd::string{ handle.m_filename.data(), handle.m_filename.size() };
|
||||
if (gEnv->pCryPak->ComputeMD5(filenameToHash.data(), md5))
|
||||
{
|
||||
char md5string[33];
|
||||
|
||||
@@ -17,7 +17,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
|
||||
|
||||
// CGenericSelectItemDialog dialog
|
||||
|
||||
CGenericSelectItemDialog::CGenericSelectItemDialog(QWidget* pParent /*=NULL*/)
|
||||
CGenericSelectItemDialog::CGenericSelectItemDialog(QWidget* pParent /*=nullptr*/)
|
||||
: QDialog(pParent)
|
||||
, ui(new Ui::CGenericSelectItemDialog)
|
||||
, m_initialized(false)
|
||||
@@ -91,20 +91,6 @@ void CGenericSelectItemDialog::ReloadTree()
|
||||
|
||||
QTreeWidgetItem* hSelected = nullptr;
|
||||
|
||||
/*
|
||||
std::vector<CString>::const_iterator iter = m_items.begin();
|
||||
while (iter != m_items.end())
|
||||
{
|
||||
const CString& itemName = *iter;
|
||||
HTREEITEM hItem = m_tree.InsertItem(itemName, 0, 0, TVI_ROOT, TVI_SORT);
|
||||
if (!m_preselect.IsEmpty() && m_preselect.CompareNoCase(itemName) == 0)
|
||||
{
|
||||
hSelected = hItem;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
*/
|
||||
|
||||
std::map<QString, QTreeWidgetItem*, less_qstring_icmp> items;
|
||||
|
||||
QRegularExpression sep(QStringLiteral("[\\/.") + m_treeSeparator + QStringLiteral("]+"));
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
CTriMesh::CTriMesh()
|
||||
{
|
||||
pFaces = NULL;
|
||||
pVertices = NULL;
|
||||
pWSVertices = NULL;
|
||||
pUV = NULL;
|
||||
pColors = NULL;
|
||||
pEdges = NULL;
|
||||
pWeights = NULL;
|
||||
pFaces = nullptr;
|
||||
pVertices = nullptr;
|
||||
pWSVertices = nullptr;
|
||||
pUV = nullptr;
|
||||
pColors = nullptr;
|
||||
pEdges = nullptr;
|
||||
pWeights = nullptr;
|
||||
|
||||
nFacesCount = 0;
|
||||
nVertCount = 0;
|
||||
@@ -67,7 +67,7 @@ void CTriMesh::ReallocStream(int stream, int nNewCount)
|
||||
{
|
||||
return; // Stream already have required size.
|
||||
}
|
||||
void* pStream = 0;
|
||||
void* pStream = nullptr;
|
||||
int nElementSize = 0;
|
||||
GetStreamInfo(stream, pStream, nElementSize);
|
||||
pStream = ReAllocElements(pStream, nNewCount, nElementSize);
|
||||
@@ -256,7 +256,7 @@ void CTriMesh::SharePositions()
|
||||
std::vector<int> arrHashTable[256];
|
||||
|
||||
CTriVertex* pNewVerts = new CTriVertex[GetVertexCount()];
|
||||
SMeshColor* pNewColors = 0;
|
||||
SMeshColor* pNewColors = nullptr;
|
||||
if (pColors)
|
||||
{
|
||||
pNewColors = new SMeshColor[GetVertexCount()];
|
||||
@@ -433,8 +433,8 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CTriMesh::CopyStream(CTriMesh& fromMesh, int stream)
|
||||
{
|
||||
void* pTrgStream = 0;
|
||||
void* pSrcStream = 0;
|
||||
void* pTrgStream = nullptr;
|
||||
void* pSrcStream = nullptr;
|
||||
int nElemSize = 0;
|
||||
fromMesh.GetStreamInfo(stream, pSrcStream, nElemSize);
|
||||
if (pSrcStream)
|
||||
|
||||
@@ -108,24 +108,12 @@ void GotoPositionDialog::OnUpdateNumbers()
|
||||
|
||||
void GotoPositionDialog::accept()
|
||||
{
|
||||
if (SandboxEditor::UsingNewCameraSystem())
|
||||
{
|
||||
SandboxEditor::InterpolateDefaultViewportCameraToTransform(
|
||||
AZ::Vector3(
|
||||
aznumeric_cast<float>(m_ui->m_dymX->value()), aznumeric_cast<float>(m_ui->m_dymY->value()),
|
||||
aznumeric_cast<float>(m_ui->m_dymZ->value())),
|
||||
AZ::DegToRad(aznumeric_cast<float>(m_ui->m_dymAnglePitch->value())),
|
||||
AZ::DegToRad(aznumeric_cast<float>(m_ui->m_dymAngleYaw->value())));
|
||||
}
|
||||
else
|
||||
{
|
||||
SandboxEditor::SetDefaultViewportCameraPosition(AZ::Vector3(
|
||||
SandboxEditor::InterpolateDefaultViewportCameraToTransform(
|
||||
AZ::Vector3(
|
||||
aznumeric_cast<float>(m_ui->m_dymX->value()), aznumeric_cast<float>(m_ui->m_dymY->value()),
|
||||
aznumeric_cast<float>(m_ui->m_dymZ->value())));
|
||||
SandboxEditor::SetDefaultViewportCameraRotation(
|
||||
AZ::DegToRad(aznumeric_cast<float>(m_ui->m_dymAnglePitch->value())),
|
||||
AZ::DegToRad(aznumeric_cast<float>(m_ui->m_dymAngleYaw->value())));
|
||||
}
|
||||
aznumeric_cast<float>(m_ui->m_dymZ->value())),
|
||||
AZ::DegToRad(aznumeric_cast<float>(m_ui->m_dymAnglePitch->value())),
|
||||
AZ::DegToRad(aznumeric_cast<float>(m_ui->m_dymAngleYaw->value())));
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
@@ -68,7 +68,6 @@ class CDisplaySettings;
|
||||
struct SGizmoParameters;
|
||||
class CLevelIndependentFileMan;
|
||||
class CSelectionTreeManager;
|
||||
struct IResourceSelectorHost;
|
||||
struct SEditorSettings;
|
||||
class CGameExporter;
|
||||
class IAWSResourceManager;
|
||||
@@ -570,7 +569,7 @@ struct IEditor
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
virtual class CLevelIndependentFileMan* GetLevelIndependentFileMan() = 0;
|
||||
//! Notify all views that data is changed.
|
||||
virtual void UpdateViews(int flags = 0xFFFFFFFF, const AABB* updateRegion = NULL) = 0;
|
||||
virtual void UpdateViews(int flags = 0xFFFFFFFF, const AABB* updateRegion = nullptr) = 0;
|
||||
virtual void ResetViews() = 0;
|
||||
//! Update information in track view dialog.
|
||||
virtual void ReloadTrackView() = 0;
|
||||
@@ -589,7 +588,7 @@ struct IEditor
|
||||
//! if bShow is true also returns a valid ITransformManipulator pointer.
|
||||
virtual ITransformManipulator* ShowTransformManipulator(bool bShow) = 0;
|
||||
//! Return a pointer to a ITransformManipulator pointer if shown.
|
||||
//! NULL is manipulator is not shown.
|
||||
//! nullptr if manipulator is not shown.
|
||||
virtual ITransformManipulator* GetTransformManipulator() = 0;
|
||||
//! Set constrain on specified axis for objects construction and modifications.
|
||||
//! @param axis one of AxisConstrains enumerations.
|
||||
@@ -714,7 +713,6 @@ struct IEditor
|
||||
virtual ESystemConfigSpec GetEditorConfigSpec() const = 0;
|
||||
virtual ESystemConfigPlatform GetEditorConfigPlatform() const = 0;
|
||||
virtual void ReloadTemplates() = 0;
|
||||
virtual IResourceSelectorHost* GetResourceSelectorHost() = 0;
|
||||
virtual void ShowStatusText(bool bEnable) = 0;
|
||||
|
||||
// Provides a way to extend the context menu of an object. The function gets called every time the menu is opened.
|
||||
|
||||
+35
-34
@@ -26,6 +26,7 @@ AZ_POP_DISABLE_WARNING
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/JSON/document.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
|
||||
// AzFramework
|
||||
#include <AzFramework/Terrain/TerrainDataRequestBus.h>
|
||||
@@ -66,7 +67,6 @@ AZ_POP_DISABLE_WARNING
|
||||
#include "EditorFileMonitor.h"
|
||||
#include "MainStatusBar.h"
|
||||
|
||||
#include "ResourceSelectorHost.h"
|
||||
#include "Util/FileUtil_impl.h"
|
||||
#include "Util/ImageUtil_impl.h"
|
||||
#include "LogFileImpl.h"
|
||||
@@ -186,7 +186,6 @@ CEditorImpl::CEditorImpl()
|
||||
m_pAnimationContext = new CAnimationContext;
|
||||
|
||||
m_pImageUtil = new CImageUtil_impl();
|
||||
m_pResourceSelectorHost.reset(CreateResourceSelectorHost());
|
||||
m_selectedRegion.min = Vec3(0, 0, 0);
|
||||
m_selectedRegion.max = Vec3(0, 0, 0);
|
||||
DetectVersion();
|
||||
@@ -251,7 +250,7 @@ void CEditorImpl::Uninitialize()
|
||||
|
||||
void CEditorImpl::UnloadPlugins()
|
||||
{
|
||||
CryAutoLock<CryMutex> lock(m_pluginMutex);
|
||||
AZStd::scoped_lock lock(m_pluginMutex);
|
||||
|
||||
// Flush core buses. We're about to unload DLLs and need to ensure we don't have module-owned functions left behind.
|
||||
AZ::Data::AssetBus::ExecuteQueuedEvents();
|
||||
@@ -272,7 +271,7 @@ void CEditorImpl::UnloadPlugins()
|
||||
|
||||
void CEditorImpl::LoadPlugins()
|
||||
{
|
||||
CryAutoLock<CryMutex> lock(m_pluginMutex);
|
||||
AZStd::scoped_lock lock(m_pluginMutex);
|
||||
|
||||
static const QString editor_plugins_folder("EditorPlugins");
|
||||
|
||||
@@ -415,7 +414,7 @@ void CEditorImpl::Update()
|
||||
}
|
||||
if (IsInPreviewMode())
|
||||
{
|
||||
SetModifiedFlag(FALSE);
|
||||
SetModifiedFlag(false);
|
||||
SetModifiedModule(eModifiedNothing);
|
||||
}
|
||||
|
||||
@@ -550,7 +549,7 @@ QString CEditorImpl::GetResolvedUserFolder()
|
||||
|
||||
void CEditorImpl::SetDataModified()
|
||||
{
|
||||
GetDocument()->SetModifiedFlag(TRUE);
|
||||
GetDocument()->SetModifiedFlag(true);
|
||||
}
|
||||
|
||||
void CEditorImpl::SetStatusText(const QString& pszString)
|
||||
@@ -597,9 +596,9 @@ ITransformManipulator* CEditorImpl::ShowTransformManipulator(bool bShow)
|
||||
GetObjectManager()->GetGizmoManager()->RemoveGizmo(m_pAxisGizmo);
|
||||
m_pAxisGizmo->Release();
|
||||
}
|
||||
m_pAxisGizmo = 0;
|
||||
m_pAxisGizmo = nullptr;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ITransformManipulator* CEditorImpl::GetTransformManipulator()
|
||||
@@ -614,7 +613,7 @@ void CEditorImpl::SetAxisConstraints(AxisConstrains axisFlags)
|
||||
SetTerrainAxisIgnoreObjects(false);
|
||||
|
||||
// Update all views.
|
||||
UpdateViews(eUpdateObjects, NULL);
|
||||
UpdateViews(eUpdateObjects, nullptr);
|
||||
}
|
||||
|
||||
AxisConstrains CEditorImpl::GetAxisConstrains()
|
||||
@@ -637,15 +636,15 @@ void CEditorImpl::SetReferenceCoordSys(RefCoordSys refCoords)
|
||||
m_refCoordsSys = refCoords;
|
||||
|
||||
// Update all views.
|
||||
UpdateViews(eUpdateObjects, NULL);
|
||||
UpdateViews(eUpdateObjects, nullptr);
|
||||
|
||||
// Update the construction plane infos.
|
||||
CViewport* pViewport = GetActiveView();
|
||||
if (pViewport)
|
||||
{
|
||||
//Pre and Post widget rendering calls are made here to make sure that the proper camera state is set.
|
||||
//MakeConstructionPlane will make a call to ViewToWorldRay which needs the correct camera state
|
||||
//in the CRenderViewport to be set.
|
||||
//MakeConstructionPlane will make a call to ViewToWorldRay which needs the correct camera state
|
||||
//in the CRenderViewport to be set.
|
||||
pViewport->PreWidgetRendering();
|
||||
|
||||
pViewport->MakeConstructionPlane(GetIEditor()->GetAxisConstrains());
|
||||
@@ -671,7 +670,7 @@ CBaseObject* CEditorImpl::NewObject(const char* typeName, const char* fileName,
|
||||
editor->SetModifiedFlag();
|
||||
editor->SetModifiedModule(eModifiedBrushes);
|
||||
}
|
||||
CBaseObject* object = editor->GetObjectManager()->NewObject(typeName, 0, fileName, name);
|
||||
CBaseObject* object = editor->GetObjectManager()->NewObject(typeName, nullptr, fileName, name);
|
||||
if (!object)
|
||||
{
|
||||
return nullptr;
|
||||
@@ -932,7 +931,7 @@ void CEditorImpl::CloseView(const GUID& classId)
|
||||
|
||||
IDataBaseManager* CEditorImpl::GetDBItemManager([[maybe_unused]] EDataBaseItemType itemType)
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CEditorImpl::SelectColor(QColor& color, QWidget* parent)
|
||||
@@ -1107,16 +1106,18 @@ void CEditorImpl::DetectVersion()
|
||||
DWORD dwHandle;
|
||||
UINT len;
|
||||
|
||||
char ver[1024 * 8];
|
||||
wchar_t ver[1024 * 8];
|
||||
|
||||
GetModuleFileName(NULL, exe, _MAX_PATH);
|
||||
AZ::Utils::GetExecutablePath(exe, _MAX_PATH);
|
||||
AZStd::wstring exeW;
|
||||
AZStd::to_wstring(exeW, exe);
|
||||
|
||||
int verSize = GetFileVersionInfoSize(exe, &dwHandle);
|
||||
int verSize = GetFileVersionInfoSizeW(exeW.c_str(), &dwHandle);
|
||||
if (verSize > 0)
|
||||
{
|
||||
GetFileVersionInfo(exe, dwHandle, 1024 * 8, ver);
|
||||
GetFileVersionInfoW(exeW.c_str(), dwHandle, 1024 * 8, ver);
|
||||
VS_FIXEDFILEINFO* vinfo;
|
||||
VerQueryValue(ver, "\\", (void**)&vinfo, &len);
|
||||
VerQueryValueW(ver, L"\\", (void**)&vinfo, &len);
|
||||
|
||||
m_fileVersion.v[0] = vinfo->dwFileVersionLS & 0xFFFF;
|
||||
m_fileVersion.v[1] = vinfo->dwFileVersionLS >> 16;
|
||||
@@ -1431,7 +1432,7 @@ void CEditorImpl::NotifyExcept(EEditorNotifyEvent event, IEditorNotifyListener*
|
||||
{
|
||||
m_pAxisGizmo->Release();
|
||||
}
|
||||
m_pAxisGizmo = 0;
|
||||
m_pAxisGizmo = nullptr;
|
||||
}
|
||||
|
||||
if (event == eNotify_OnInit)
|
||||
@@ -1457,7 +1458,7 @@ void CEditorImpl::UnregisterNotifyListener(IEditorNotifyListener* listener)
|
||||
|
||||
ISourceControl* CEditorImpl::GetSourceControl()
|
||||
{
|
||||
CryAutoLock<CryMutex> lock(m_pluginMutex);
|
||||
AZStd::scoped_lock lock(m_pluginMutex);
|
||||
|
||||
if (m_pSourceControl)
|
||||
{
|
||||
@@ -1472,7 +1473,7 @@ ISourceControl* CEditorImpl::GetSourceControl()
|
||||
for (int i = 0; i < classes.size(); i++)
|
||||
{
|
||||
IClassDesc* pClass = classes[i];
|
||||
ISourceControl* pSCM = NULL;
|
||||
ISourceControl* pSCM = nullptr;
|
||||
HRESULT hRes = pClass->QueryInterface(__uuidof(ISourceControl), (void**)&pSCM);
|
||||
if (!FAILED(hRes) && pSCM)
|
||||
{
|
||||
@@ -1482,7 +1483,7 @@ ISourceControl* CEditorImpl::GetSourceControl()
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CEditorImpl::IsSourceControlAvailable()
|
||||
@@ -1557,31 +1558,31 @@ IExportManager* CEditorImpl::GetExportManager()
|
||||
void CEditorImpl::AddUIEnums()
|
||||
{
|
||||
// Spec settings for shadow casting lights
|
||||
string SpecString[4];
|
||||
AZStd::string SpecString[4];
|
||||
QStringList types;
|
||||
types.push_back("Never=0");
|
||||
SpecString[0].Format("VeryHigh Spec=%d", CONFIG_VERYHIGH_SPEC);
|
||||
SpecString[0] = AZStd::string::format("VeryHigh Spec=%d", CONFIG_VERYHIGH_SPEC);
|
||||
types.push_back(SpecString[0].c_str());
|
||||
SpecString[1].Format("High Spec=%d", CONFIG_HIGH_SPEC);
|
||||
SpecString[1] = AZStd::string::format("High Spec=%d", CONFIG_HIGH_SPEC);
|
||||
types.push_back(SpecString[1].c_str());
|
||||
SpecString[2].Format("Medium Spec=%d", CONFIG_MEDIUM_SPEC);
|
||||
SpecString[2] = AZStd::string::format("Medium Spec=%d", CONFIG_MEDIUM_SPEC);
|
||||
types.push_back(SpecString[2].c_str());
|
||||
SpecString[3].Format("Low Spec=%d", CONFIG_LOW_SPEC);
|
||||
SpecString[3] = AZStd::string::format("Low Spec=%d", CONFIG_LOW_SPEC);
|
||||
types.push_back(SpecString[3].c_str());
|
||||
m_pUIEnumsDatabase->SetEnumStrings("CastShadows", types);
|
||||
|
||||
// Power-of-two percentages
|
||||
string percentStringPOT[5];
|
||||
AZStd::string percentStringPOT[5];
|
||||
types.clear();
|
||||
percentStringPOT[0].Format("Default=%d", 0);
|
||||
percentStringPOT[0] = AZStd::string::format("Default=%d", 0);
|
||||
types.push_back(percentStringPOT[0].c_str());
|
||||
percentStringPOT[1].Format("12.5=%d", 1);
|
||||
percentStringPOT[1] = AZStd::string::format("12.5=%d", 1);
|
||||
types.push_back(percentStringPOT[1].c_str());
|
||||
percentStringPOT[2].Format("25=%d", 2);
|
||||
percentStringPOT[2] = AZStd::string::format("25=%d", 2);
|
||||
types.push_back(percentStringPOT[2].c_str());
|
||||
percentStringPOT[3].Format("50=%d", 3);
|
||||
percentStringPOT[3] = AZStd::string::format("50=%d", 3);
|
||||
types.push_back(percentStringPOT[3].c_str());
|
||||
percentStringPOT[4].Format("100=%d", 4);
|
||||
percentStringPOT[4] = AZStd::string::format("100=%d", 4);
|
||||
types.push_back(percentStringPOT[4].c_str());
|
||||
m_pUIEnumsDatabase->SetEnumStrings("ShadowMinResPercent", types);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <AzToolsFramework/Thumbnails/ThumbnailerBus.h>
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
#include "Commands/CommandManager.h"
|
||||
#include "Commands/CommandManager.h"
|
||||
|
||||
#include "Include/IErrorReport.h"
|
||||
#include "ErrorReport.h"
|
||||
@@ -63,7 +63,7 @@ namespace AssetDatabase
|
||||
class AssetDatabaseLocationListener;
|
||||
}
|
||||
|
||||
class CEditorImpl
|
||||
class CEditorImpl
|
||||
: public IEditor
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(CEditorImpl)
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
{
|
||||
return m_pSystem->GetIMovieSystem();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
CPluginManager* GetPluginManager() { return m_pPluginManager; }
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
RefCoordSys GetReferenceCoordSys();
|
||||
XmlNodeRef FindTemplate(const QString& templateName);
|
||||
void AddTemplate(const QString& templateName, XmlNodeRef& tmpl);
|
||||
|
||||
|
||||
const QtViewPane* OpenView(QString sViewClassName, bool reuseOpened = true) override;
|
||||
|
||||
/**
|
||||
@@ -290,7 +290,6 @@ public:
|
||||
ESystemConfigPlatform GetEditorConfigPlatform() const;
|
||||
void ReloadTemplates();
|
||||
void AddErrorMessage(const QString& text, const QString& caption);
|
||||
IResourceSelectorHost* GetResourceSelectorHost() { return m_pResourceSelectorHost.get(); }
|
||||
virtual void ShowStatusText(bool bEnable);
|
||||
|
||||
void OnObjectContextMenuOpened(QMenu* pMenu, const CBaseObject* pObject);
|
||||
@@ -374,7 +373,6 @@ protected:
|
||||
//! Export manager for exporting objects and a terrain from the game to DCC tools
|
||||
CExportManager* m_pExportManager;
|
||||
std::unique_ptr<CEditorFileMonitor> m_pEditorFileMonitor;
|
||||
std::unique_ptr<IResourceSelectorHost> m_pResourceSelectorHost;
|
||||
QString m_selectFileBuffer;
|
||||
QString m_levelNameBuffer;
|
||||
|
||||
@@ -401,7 +399,7 @@ protected:
|
||||
IImageUtil* m_pImageUtil; // Vladimir@conffx
|
||||
ILogFile* m_pLogFile; // Vladimir@conffx
|
||||
|
||||
CryMutex m_pluginMutex; // protect any pointers that come from plugins, such as the source control cached pointer.
|
||||
AZStd::mutex m_pluginMutex; // protect any pointers that come from plugins, such as the source control cached pointer.
|
||||
static const char* m_crashLogFileName;
|
||||
};
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ struct HotKey
|
||||
int size = (m_catSize < o_catSize) ? m_catSize : o_catSize;
|
||||
|
||||
//sort categories to keep them together
|
||||
for (unsigned int i = 0; i < size; i++)
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
if (m_categories[i] < o_categories[i])
|
||||
{
|
||||
|
||||
@@ -81,7 +81,7 @@ void CIconManager::Reset()
|
||||
{
|
||||
m_objects[i]->Release();
|
||||
}
|
||||
m_objects[i] = 0;
|
||||
m_objects[i] = nullptr;
|
||||
}
|
||||
for (i = 0; i < eIcon_COUNT; i++)
|
||||
{
|
||||
@@ -135,7 +135,7 @@ IStatObj* CIconManager::GetObject(EStatObject)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
QImage* CIconManager::GetIconBitmap(const char* filename, bool& bHaveAlpha, uint32 effects /*=0*/)
|
||||
{
|
||||
QImage* pBitmap = 0;
|
||||
QImage* pBitmap = nullptr;
|
||||
|
||||
QString iconFilename = filename;
|
||||
|
||||
@@ -160,11 +160,11 @@ QImage* CIconManager::GetIconBitmap(const char* filename, bool& bHaveAlpha, uint
|
||||
return pBitmap;
|
||||
}
|
||||
|
||||
BOOL bAlphaBitmap = FALSE;
|
||||
bool bAlphaBitmap = false;
|
||||
QPixmap pm(iconFilename);
|
||||
bAlphaBitmap = pm.hasAlpha();
|
||||
|
||||
bHaveAlpha = (bAlphaBitmap == TRUE);
|
||||
bHaveAlpha = (bAlphaBitmap == true);
|
||||
if (!pm.isNull())
|
||||
{
|
||||
pBitmap = new QImage;
|
||||
@@ -252,5 +252,5 @@ QImage* CIconManager::GetIconBitmap(const char* filename, bool& bHaveAlpha, uint
|
||||
|
||||
return pBitmap;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "Util/EditorUtils.h"
|
||||
|
||||
inline string ToString(const QString& s)
|
||||
inline AZStd::string ToString(const QString& s)
|
||||
{
|
||||
return s.toUtf8().data();
|
||||
}
|
||||
@@ -27,10 +27,10 @@ class CCommand
|
||||
{
|
||||
public:
|
||||
CCommand(
|
||||
const string& module,
|
||||
const string& name,
|
||||
const string& description,
|
||||
const string& example)
|
||||
const AZStd::string& module,
|
||||
const AZStd::string& name,
|
||||
const AZStd::string& description,
|
||||
const AZStd::string& example)
|
||||
: m_module(module)
|
||||
, m_name(name)
|
||||
, m_description(description)
|
||||
@@ -79,20 +79,20 @@ public:
|
||||
}
|
||||
int GetArgCount() const
|
||||
{ return m_args.size(); }
|
||||
const string& GetArg(int i) const
|
||||
const AZStd::string& GetArg(int i) const
|
||||
{
|
||||
assert(0 <= i && i < GetArgCount());
|
||||
return m_args[i];
|
||||
}
|
||||
private:
|
||||
DynArray<string> m_args;
|
||||
DynArray<AZStd::string> m_args;
|
||||
unsigned char m_stringFlags; // This is needed to quote string parameters when logging a command.
|
||||
};
|
||||
|
||||
const string& GetName() const { return m_name; }
|
||||
const string& GetModule() const { return m_module; }
|
||||
const string& GetDescription() const { return m_description; }
|
||||
const string& GetExample() const { return m_example; }
|
||||
const AZStd::string& GetName() const { return m_name; }
|
||||
const AZStd::string& GetModule() const { return m_module; }
|
||||
const AZStd::string& GetDescription() const { return m_description; }
|
||||
const AZStd::string& GetExample() const { return m_example; }
|
||||
|
||||
void SetAvailableInScripting() { m_bAlsoAvailableInScripting = true; };
|
||||
bool IsAvailableInScripting() const { return m_bAlsoAvailableInScripting; }
|
||||
@@ -104,15 +104,15 @@ public:
|
||||
|
||||
protected:
|
||||
friend class CEditorCommandManager;
|
||||
string m_module;
|
||||
string m_name;
|
||||
string m_description;
|
||||
string m_example;
|
||||
AZStd::string m_module;
|
||||
AZStd::string m_name;
|
||||
AZStd::string m_description;
|
||||
AZStd::string m_example;
|
||||
bool m_bAlsoAvailableInScripting;
|
||||
|
||||
template <typename T>
|
||||
static string ToString_(T t) { return ::ToString(t); }
|
||||
static inline string ToString_(const char* val)
|
||||
static AZStd::string ToString_(T t) { return ::ToString(t); }
|
||||
static inline AZStd::string ToString_(const char* val)
|
||||
{ return val; }
|
||||
template <typename T>
|
||||
static bool FromString_(T& t, const char* s) { return ::FromString(t, s); }
|
||||
@@ -137,8 +137,8 @@ class CCommand0
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand0(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand0(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<void()>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor) {}
|
||||
@@ -146,10 +146,10 @@ public:
|
||||
// UI metadata for this command, if any
|
||||
struct SUIInfo
|
||||
{
|
||||
string caption;
|
||||
string tooltip;
|
||||
string description;
|
||||
string iconFilename;
|
||||
AZStd::string caption;
|
||||
AZStd::string tooltip;
|
||||
AZStd::string description;
|
||||
AZStd::string iconFilename;
|
||||
int iconIndex;
|
||||
int commandId; // Windows command id
|
||||
|
||||
@@ -179,8 +179,8 @@ class CCommand0wRet
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand0wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand0wRet(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<RT()>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
@@ -195,8 +195,8 @@ class CCommand1
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand1(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand1(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<void(LIST(1, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
@@ -211,8 +211,8 @@ class CCommand1wRet
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand1wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand1wRet(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<RT(LIST(1, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
@@ -227,8 +227,8 @@ class CCommand2
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand2(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand2(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<void(LIST(2, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
@@ -243,8 +243,8 @@ class CCommand2wRet
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand2wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand2wRet(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<RT(LIST(2, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
@@ -259,8 +259,8 @@ class CCommand3
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand3(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand3(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<void(LIST(3, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
@@ -275,8 +275,8 @@ class CCommand3wRet
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand3wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand3wRet(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<RT(LIST(3, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
@@ -291,8 +291,8 @@ class CCommand4
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand4(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand4(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<void(LIST(4, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
@@ -307,8 +307,8 @@ class CCommand4wRet
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand4wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand4wRet(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<RT(LIST(4, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
@@ -323,8 +323,8 @@ class CCommand5
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand5(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand5(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<void(LIST(5, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
@@ -339,8 +339,8 @@ class CCommand6
|
||||
: public CCommand
|
||||
{
|
||||
public:
|
||||
CCommand6(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand6(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<void(LIST(6, P))>& functor);
|
||||
|
||||
QString Execute(const CArgs& args);
|
||||
@@ -353,8 +353,8 @@ protected:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <typename RT>
|
||||
CCommand0wRet<RT>::CCommand0wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand0wRet<RT>::CCommand0wRet(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<RT()>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
@@ -373,8 +373,8 @@ QString CCommand0wRet<RT>::Execute(const CCommand::CArgs& args)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(1, typename P)>
|
||||
CCommand1<LIST(1, P)>::CCommand1(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand1<LIST(1, P)>::CCommand1(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<void(LIST(1, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
@@ -410,8 +410,8 @@ QString CCommand1<LIST(1, P)>::Execute(const CCommand::CArgs& args)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(1, typename P), typename RT>
|
||||
CCommand1wRet<LIST(1, P), RT>::CCommand1wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand1wRet<LIST(1, P), RT>::CCommand1wRet(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<RT(LIST(1, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
@@ -448,8 +448,8 @@ QString CCommand1wRet<LIST(1, P), RT>::Execute(const CCommand::CArgs& args)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(2, typename P)>
|
||||
CCommand2<LIST(2, P)>::CCommand2(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand2<LIST(2, P)>::CCommand2(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<void(LIST(2, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
@@ -487,8 +487,8 @@ QString CCommand2<LIST(2, P)>::Execute(const CCommand::CArgs& args)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(2, typename P), typename RT>
|
||||
CCommand2wRet<LIST(2, P), RT>::CCommand2wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand2wRet<LIST(2, P), RT>::CCommand2wRet(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<RT(LIST(2, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
@@ -527,8 +527,8 @@ QString CCommand2wRet<LIST(2, P), RT>::Execute(const CCommand::CArgs& args)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(3, typename P)>
|
||||
CCommand3<LIST(3, P)>::CCommand3(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand3<LIST(3, P)>::CCommand3(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<void(LIST(3, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
@@ -568,8 +568,8 @@ QString CCommand3<LIST(3, P)>::Execute(const CCommand::CArgs& args)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(3, typename P), typename RT>
|
||||
CCommand3wRet<LIST(3, P), RT>::CCommand3wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand3wRet<LIST(3, P), RT>::CCommand3wRet(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<RT(LIST(3, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
@@ -610,8 +610,8 @@ QString CCommand3wRet<LIST(3, P), RT>::Execute(const CCommand::CArgs& args)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(4, typename P)>
|
||||
CCommand4<LIST(4, P)>::CCommand4(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand4<LIST(4, P)>::CCommand4(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<void(LIST(4, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
@@ -654,8 +654,8 @@ QString CCommand4<LIST(4, P)>::Execute(const CCommand::CArgs& args)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(4, typename P), typename RT>
|
||||
CCommand4wRet<LIST(4, P), RT>::CCommand4wRet(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand4wRet<LIST(4, P), RT>::CCommand4wRet(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<RT(LIST(4, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
@@ -699,8 +699,8 @@ QString CCommand4wRet<LIST(4, P), RT>::Execute(const CCommand::CArgs& args)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(5, typename P)>
|
||||
CCommand5<LIST(5, P)>::CCommand5(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand5<LIST(5, P)>::CCommand5(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<void(LIST(5, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
@@ -745,8 +745,8 @@ QString CCommand5<LIST(5, P)>::Execute(const CCommand::CArgs& args)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <LIST(6, typename P)>
|
||||
CCommand6<LIST(6, P)>::CCommand6(const string& module, const string& name,
|
||||
const string& description, const string& example,
|
||||
CCommand6<LIST(6, P)>::CCommand6(const AZStd::string& module, const AZStd::string& name,
|
||||
const AZStd::string& description, const AZStd::string& example,
|
||||
const AZStd::function<void(LIST(6, P))>& functor)
|
||||
: CCommand(module, name, description, example)
|
||||
, m_functor(functor)
|
||||
|
||||
@@ -334,12 +334,12 @@ struct IAssetItem
|
||||
virtual void OnEndPreview() = 0;
|
||||
// Description:
|
||||
// If the asset has a special preview panel with utility controls, to be placed at the top of the Preview window, it can return an child dialog window
|
||||
// otherwise it can return NULL, if no panel is available
|
||||
// otherwise it can return nullptr, if no panel is available
|
||||
// Arguments:
|
||||
// pParentWnd - a valid CDialog*, or NULL
|
||||
// pParentWnd - a valid CDialog*, or nullptr
|
||||
// Return Value:
|
||||
// A valid child dialog window handle, if this asset wants to have a custom panel in the top side of the Asset Preview window,
|
||||
// otherwise it can return NULL, if no panel is available
|
||||
// otherwise it can return nullptr, if no panel is available
|
||||
// See Also:
|
||||
// OnBeginPreview(), OnEndPreview()
|
||||
virtual QWidget* GetCustomPreviewPanelHeader(QWidget* pParentWnd) = 0;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "StringUtils.h"
|
||||
#include "../Include/SandboxAPI.h"
|
||||
#include <set>
|
||||
|
||||
class QWidget;
|
||||
|
||||
@@ -186,8 +186,15 @@ struct IFileUtil
|
||||
virtual ECopyTreeResult CopyTree(const QString& strSourceDirectory, const QString& strTargetDirectory, bool boRecurse = true, bool boConfirmOverwrite = false) = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// @param LPPROGRESS_ROUTINE pfnProgress - called by the system to notify of file copy progress
|
||||
// @param LPBOOL pbCancel - when the contents of this BOOL are set to TRUE, the system cancels the copy operation
|
||||
/**
|
||||
* @brief CopyFile
|
||||
* @param strSourceFile
|
||||
* @param strTargetFile
|
||||
* @param boConfirmOverwrite
|
||||
* @param pfnProgress - called by the system to notify of file copy progress
|
||||
* @param pbCancel - when the contents of this bool are set to true, the system cancels the copy operation
|
||||
* @return
|
||||
*/
|
||||
virtual ECopyTreeResult CopyFile(const QString& strSourceFile, const QString& strTargetFile, bool boConfirmOverwrite = false, ProgressRoutine pfnProgress = nullptr, bool* pbCancel = nullptr) = 0;
|
||||
|
||||
// As we don't have a FileUtil interface here, we have to duplicate some code :-( in order to keep
|
||||
|
||||
@@ -12,8 +12,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <AzCore/Math/Guid.h>
|
||||
#include <CryCommon/platform.h>
|
||||
#include <CryCommon/Cry_Geo.h>
|
||||
#include <set>
|
||||
|
||||
// forward declarations.
|
||||
class CEntityObject;
|
||||
|
||||
@@ -1,135 +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
|
||||
// The aim of IResourceSelectorHost is to unify resource selection dialogs in a one
|
||||
// API that can be reused with plugins. It also makes possible to register new
|
||||
// resource selectors dynamically, e.g. inside plugins.
|
||||
//
|
||||
// Here is how new selectors are created. In your implementation file you add handler function:
|
||||
//
|
||||
// #include "IResourceSelectorHost.h"
|
||||
//
|
||||
// QString SoundFileSelector(const SResourceSelectorContext& x, const QString& previousValue)
|
||||
// {
|
||||
// CMyModalDialog dialog(CWnd::FromHandle(x.parentWindow));
|
||||
// ...
|
||||
// return previousValue;
|
||||
// }
|
||||
// REGISTER_RESOURCE_SELECTOR("Sound", SoundFileSelector, "Icons/sound_16x16.png")
|
||||
//
|
||||
// Here is how it can be invoked directly:
|
||||
//
|
||||
// SResourceSelectorContext x;
|
||||
// x.parentWindow = parent.GetSafeHwnd();
|
||||
// x.typeName = "Sound";
|
||||
// string newValue = GetIEditor()->GetResourceSelector()->SelectResource(x, previousValue).c_str();
|
||||
//
|
||||
// If you have your own resource selectors in the plugin you will need to run
|
||||
//
|
||||
// RegisterModuleResourceSelectors(GetIEditor()->GetResourceSelector())
|
||||
//
|
||||
// during plugin initialization.
|
||||
//
|
||||
// If you want to be able to pass some custom context to the selector (e.g. source of the information for the
|
||||
// list of items or something similar) then you can add a poitner argument to your selector function, i.e.:
|
||||
//
|
||||
// QString SoundFileSelector(const SResourceSelectorContext& x, const QString& previousValue,
|
||||
// SoundFileList* list) // your context argument
|
||||
|
||||
#include <QString>
|
||||
|
||||
class QWidget;
|
||||
|
||||
struct SResourceSelectorContext
|
||||
{
|
||||
const char* typeName;
|
||||
|
||||
// use either parentWidget or parentWindow (not both) until everything porting to QWidget.
|
||||
QWidget* parentWidget;
|
||||
|
||||
unsigned int entityId;
|
||||
void* contextObject;
|
||||
|
||||
SResourceSelectorContext()
|
||||
: parentWidget(0)
|
||||
, typeName(0)
|
||||
, entityId(0)
|
||||
, contextObject()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// TResourceSelecitonFunction is used to declare handlers for specific types.
|
||||
//
|
||||
// For canceled dialogs previousValue should be returned.
|
||||
typedef QString (* TResourceSelectionFunction)(const SResourceSelectorContext& selectorContext, const QString& previousValue);
|
||||
typedef QString (* TResourceSelectionFunctionWithContext)(const SResourceSelectorContext& selectorContext, const QString& previousValue, void* contextObject);
|
||||
|
||||
struct SStaticResourceSelectorEntry;
|
||||
|
||||
// See note at the beginning of the file.
|
||||
struct IResourceSelectorHost
|
||||
{
|
||||
virtual ~IResourceSelectorHost() = default;
|
||||
virtual QString SelectResource(const SResourceSelectorContext& context, const QString& previousValue) = 0;
|
||||
virtual const char* ResourceIconPath(const char* typeName) const = 0;
|
||||
|
||||
virtual void RegisterResourceSelector(const SStaticResourceSelectorEntry* entry) = 0;
|
||||
|
||||
// secondary responsibility of this class is to store global selections
|
||||
virtual void SetGlobalSelection(const char* resourceType, const char* value) = 0;
|
||||
virtual const char* GetGlobalSelection(const char* resourceType) const = 0;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
#define INTERNAL_RSH_COMBINE_UTIL(A, B) A##B
|
||||
#define INTERNAL_RSH_COMBINE(A, B) INTERNAL_RSH_COMBINE_UTIL(A, B)
|
||||
#define REGISTER_RESOURCE_SELECTOR(name, function, icon) \
|
||||
static SStaticResourceSelectorEntry INTERNAL_RSH_COMBINE(selector_##function, __LINE__)((name), (function), (icon));
|
||||
|
||||
struct SStaticResourceSelectorEntry
|
||||
{
|
||||
const char* typeName;
|
||||
TResourceSelectionFunction function;
|
||||
TResourceSelectionFunctionWithContext functionWithContext;
|
||||
const char* iconPath;
|
||||
|
||||
static SStaticResourceSelectorEntry*& GetFirst() { static SStaticResourceSelectorEntry* first; return first; }
|
||||
SStaticResourceSelectorEntry* next;
|
||||
|
||||
SStaticResourceSelectorEntry(const char* typeName, TResourceSelectionFunction function, const char* icon)
|
||||
: typeName(typeName)
|
||||
, function(function)
|
||||
, functionWithContext()
|
||||
, iconPath(icon)
|
||||
{
|
||||
next = GetFirst();
|
||||
GetFirst() = this;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
SStaticResourceSelectorEntry(const char* typeName, QString (*function)(const SResourceSelectorContext&, const QString& previousValue, T * context), const char* icon)
|
||||
: typeName(typeName)
|
||||
, function()
|
||||
, functionWithContext(TResourceSelectionFunctionWithContext(function))
|
||||
, iconPath(icon)
|
||||
{
|
||||
next = GetFirst();
|
||||
GetFirst() = this;
|
||||
}
|
||||
};
|
||||
|
||||
inline void RegisterModuleResourceSelectors(IResourceSelectorHost* editorResourceSelector)
|
||||
{
|
||||
for (SStaticResourceSelectorEntry* current = SStaticResourceSelectorEntry::GetFirst(); current != 0; current = current->next)
|
||||
{
|
||||
editorResourceSelector->RegisterResourceSelector(current);
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ QVariant LayoutConfigModel::data(const QModelIndex& index, int role) const
|
||||
|
||||
// CLayoutConfigDialog dialog
|
||||
|
||||
CLayoutConfigDialog::CLayoutConfigDialog(QWidget* pParent /*=NULL*/)
|
||||
CLayoutConfigDialog::CLayoutConfigDialog(QWidget* pParent /*=nullptr*/)
|
||||
: QDialog(pParent)
|
||||
, m_model(new LayoutConfigModel(this))
|
||||
, ui(new Ui::CLayoutConfigDialog)
|
||||
|
||||
@@ -98,7 +98,7 @@ CLayoutWnd::CLayoutWnd(QSettings* settings, QWidget* parent)
|
||||
, m_settings(settings)
|
||||
{
|
||||
m_bMaximized = false;
|
||||
m_maximizedView = 0;
|
||||
m_maximizedView = nullptr;
|
||||
m_layout = (EViewLayout) - 1;
|
||||
|
||||
m_maximizedViewId = 0;
|
||||
@@ -729,7 +729,7 @@ void CLayoutWnd::OnDestroy()
|
||||
if (m_maximizedView)
|
||||
{
|
||||
delete m_maximizedView;
|
||||
m_maximizedView = 0;
|
||||
m_maximizedView = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user