Merge remote-tracking branch 'upstream/main' into DisableAtomShim

This commit is contained in:
rgba16f
2021-04-20 19:08:48 -05:00
242 changed files with 2808 additions and 5669 deletions
-142
View File
@@ -1,142 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#include "EditorDefs.h"
#include "AlignTool.h"
// Editor
#include "Objects/BaseObject.h"
#include "Objects/SelectionGroup.h"
//////////////////////////////////////////////////////////////////////////
bool CAlignPickCallback::m_bActive = false;
//////////////////////////////////////////////////////////////////////////
//! Called when object picked.
void CAlignPickCallback::OnPick(CBaseObject* picked)
{
Matrix34 pickedTM(picked->GetWorldTM());
AABB pickedAABB;
picked->GetBoundBox(pickedAABB);
pickedAABB.Move(-pickedTM.GetTranslation());
Vec3 pickedPivot = pickedAABB.GetCenter();
AABB pickedLocalAABB;
picked->GetLocalBounds(pickedLocalAABB);
const Quat& pickedRot = picked->GetRotation();
const Vec3& pickedScale = picked->GetScale();
const Vec3& pickedPos = picked->GetPos();
bool bKeepScale = CheckVirtualKey(Qt::Key_Shift);
bool bKeepRotation = CheckVirtualKey(Qt::Key_Alt);
bool bAlignToBoundBox = CheckVirtualKey(Qt::Key_Control);
bool bApplyTransform = !bKeepScale && !bKeepRotation && !bAlignToBoundBox;
{
bool bUndo = !CUndo::IsRecording();
if (bUndo)
{
GetIEditor()->BeginUndo();
}
CSelectionGroup* selGroup = GetIEditor()->GetSelection();
selGroup->FilterParents();
for (int i = 0; i < selGroup->GetFilteredCount(); i++)
{
CBaseObject* pMovedObj = selGroup->GetFilteredObject(i);
if (bKeepScale || bKeepRotation || bApplyTransform)
{
if (bKeepScale && bKeepRotation) // Keep scale and rotation of a moved object
{
pMovedObj->SetWorldTM(Matrix34::Create(pMovedObj->GetScale(), pMovedObj->GetRotation(), pickedPos), eObjectUpdateFlags_UserInput);
}
else if (bKeepScale) // Keep only scale of a moved object
{
pMovedObj->SetWorldTM(Matrix34::Create(pMovedObj->GetScale(), pickedRot, pickedPos), eObjectUpdateFlags_UserInput);
}
else if (bKeepRotation) // Keep only rotation of a moved object
{
pMovedObj->SetWorldTM(Matrix34::Create(pickedScale, pMovedObj->GetRotation(), pickedPos), eObjectUpdateFlags_UserInput);
}
else // Scale, Rotation and Position of a picked object are applied to a moved object.
{
pMovedObj->SetWorldTM(pickedTM, eObjectUpdateFlags_UserInput);
}
}
else if (bAlignToBoundBox) // align to the bounding box.
{
if (pickedLocalAABB.GetVolume() == 0.0f)
{
continue;
}
AABB movedLocalAABB;
pMovedObj->GetLocalBounds(movedLocalAABB);
if (fabs(movedLocalAABB.max.x - movedLocalAABB.min.x) < VEC_EPSILON &&
fabs(movedLocalAABB.max.y - movedLocalAABB.min.y) < VEC_EPSILON &&
fabs(movedLocalAABB.max.z - movedLocalAABB.min.z) < VEC_EPSILON)
{
continue;
}
const Vec3& movedScale(pMovedObj->GetScale());
Matrix34 movedScaleTM = Matrix34::CreateScale(movedScale);
AABB movedLocalScaledAABB;
movedLocalScaledAABB.min = movedScaleTM.TransformVector(movedLocalAABB.min);
movedLocalScaledAABB.max = movedScaleTM.TransformVector(movedLocalAABB.max);
float fMovedWidth = movedLocalScaledAABB.max.x - movedLocalScaledAABB.min.x;
float fMovedHeight = movedLocalScaledAABB.max.z - movedLocalScaledAABB.min.z;
float fMovedLength = movedLocalScaledAABB.max.y - movedLocalScaledAABB.min.y;
Matrix34 pickedScaleTM = Matrix34::CreateScale(picked->GetScale());
AABB pickedLocalScaledAABB;
pickedLocalScaledAABB.min = pickedScaleTM.TransformVector(pickedLocalAABB.min);
pickedLocalScaledAABB.max = pickedScaleTM.TransformVector(pickedLocalAABB.max);
float fScaledPickedtWidth = pickedLocalScaledAABB.max.x - pickedLocalScaledAABB.min.x;
float fScaledPickedHeight = pickedLocalScaledAABB.max.z - pickedLocalScaledAABB.min.z;
float fScaledPickedLength = pickedLocalScaledAABB.max.y - pickedLocalScaledAABB.min.y;
Vec3 scale((fScaledPickedtWidth / fMovedWidth) * movedScale.x, (fScaledPickedLength / fMovedLength) * movedScale.y, (fScaledPickedHeight / fMovedHeight) * movedScale.z);
Matrix34 scaleRotTM = Matrix34::Create(scale, pickedRot, Vec3(0, 0, 0));
Vec3 movedPivot = scaleRotTM.TransformVector(movedLocalAABB.GetCenter());
pMovedObj->SetWorldTM(Matrix34::Create(scale, pickedRot, Vec3(pickedPos + (pickedPivot - movedPivot))), eObjectUpdateFlags_UserInput);
}
}
m_bActive = false;
if (bUndo)
{
GetIEditor()->AcceptUndo("Align To Object");
}
}
delete this;
}
//! Called when pick mode cancelled.
void CAlignPickCallback::OnCancelPick()
{
m_bActive = false;
delete this;
}
//! Return true if specified object is pickable.
bool CAlignPickCallback::OnPickFilter([[maybe_unused]] CBaseObject* filterObject)
{
return true;
};
-40
View File
@@ -1,40 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#ifndef CRYINCLUDE_EDITOR_ALIGNTOOL_H
#define CRYINCLUDE_EDITOR_ALIGNTOOL_H
#pragma once
//////////////////////////////////////////////////////////////////////////
class CAlignPickCallback
: public IPickObjectCallback
{
public:
CAlignPickCallback() { m_bActive = true; };
//! Called when object picked.
virtual void OnPick(CBaseObject* picked);
//! Called when pick mode cancelled.
virtual void OnCancelPick();
//! Return true if specified object is pickable.
virtual bool OnPickFilter(CBaseObject* filterObject);
static bool IsActive() { return m_bActive; }
virtual bool IsNeedSpecificBehaviorForSpaceAcce() { return true; }
private:
static bool m_bActive;
};
#endif // CRYINCLUDE_EDITOR_ALIGNTOOL_H
@@ -580,7 +580,6 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe
auto alignMenu = modifyMenu.AddMenu(tr("Align"));
alignMenu.AddAction(ID_OBJECTMODIFY_ALIGNTOGRID);
alignMenu.AddAction(ID_OBJECTMODIFY_ALIGN);
alignMenu.AddAction(ID_MODIFY_ALIGNOBJTOSURF);
auto constrainMenu = modifyMenu.AddMenu(tr("Constrain"));
-76
View File
@@ -95,8 +95,6 @@ AZ_POP_DISABLE_WARNING
#include "Core/QtEditorApplication.h"
#include "StringDlg.h"
#include "LinkTool.h"
#include "AlignTool.h"
#include "VoxelAligningTool.h"
#include "NewLevelDialog.h"
#include "GridSettingsDialog.h"
@@ -126,7 +124,6 @@ AZ_POP_DISABLE_WARNING
#include "EditorPreferencesDialog.h"
#include "GraphicsSettingsDialog.h"
#include "FeedbackDialog/FeedbackDialog.h"
#include "MatEditMainDlg.h"
#include "AnimationContext.h"
#include "GotoPositionDlg.h"
@@ -401,8 +398,6 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_EDITMODE_MOVE, OnEditmodeMove)
ON_COMMAND(ID_EDITMODE_ROTATE, OnEditmodeRotate)
ON_COMMAND(ID_EDITMODE_SCALE, OnEditmodeScale)
ON_COMMAND(ID_EDITTOOL_LINK, OnEditToolLink)
ON_COMMAND(ID_EDITTOOL_UNLINK, OnEditToolUnlink)
ON_COMMAND(ID_EDITMODE_SELECT, OnEditmodeSelect)
ON_COMMAND(ID_EDIT_ESCAPE, OnEditEscape)
ON_COMMAND(ID_OBJECTMODIFY_SETAREA, OnObjectSetArea)
@@ -422,7 +417,6 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_SELECTION_SAVE, OnSelectionSave)
ON_COMMAND(ID_IMPORT_ASSET, OnOpenAssetImporter)
ON_COMMAND(ID_SELECTION_LOAD, OnSelectionLoad)
ON_COMMAND(ID_OBJECTMODIFY_ALIGN, OnAlignObject)
ON_COMMAND(ID_MODIFY_ALIGNOBJTOSURF, OnAlignToVoxel)
ON_COMMAND(ID_OBJECTMODIFY_ALIGNTOGRID, OnAlignToGrid)
ON_COMMAND(ID_LOCK_SELECTION, OnLockSelection)
@@ -1898,14 +1892,6 @@ BOOL CCryEditApp::InitInstance()
CWipFeatureManager::Init();
#endif
if (GetIEditor()->IsInMatEditMode())
{
m_pMatEditDlg = new CMatEditMainDlg(QStringLiteral("Material Editor"));
m_pEditor->InitFinished();
m_pMatEditDlg->show();
return true;
}
if (!m_bConsoleMode && !m_bPreviewMode)
{
GetIEditor()->UpdateViews();
@@ -2905,51 +2891,6 @@ void CCryEditApp::OnEditmodeScale()
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditToolLink()
{
// TODO: Add your command handler code here
if (qobject_cast<CLinkTool*>(GetIEditor()->GetEditTool()))
{
GetIEditor()->SetEditTool(0);
}
else
{
GetIEditor()->SetEditTool(new CLinkTool());
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateEditToolLink(QAction* action)
{
if (!GetIEditor()->GetDocument())
{
action->setEnabled(false);
return;
}
action->setEnabled(GetIEditor()->GetDocument()->IsDocumentReady());
CEditTool* pEditTool = GetIEditor()->GetEditTool();
action->setChecked(qobject_cast<CLinkTool*>(pEditTool) != nullptr);
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditToolUnlink()
{
CUndo undo("Unlink Object(s)");
CSelectionGroup* pSelection = GetIEditor()->GetObjectManager()->GetSelection();
for (int i = 0; i < pSelection->GetCount(); i++)
{
CBaseObject* pBaseObj = pSelection->GetObject(i);
pBaseObj->DetachThis();
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateEditToolUnlink(QAction* action)
{
action->setEnabled(false);
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditmodeSelect()
{
@@ -3519,14 +3460,6 @@ void CCryEditApp::OnUpdateSelected(QAction* action)
action->setEnabled(!GetIEditor()->GetSelection()->IsEmpty());
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnAlignObject()
{
// Align pick callback will release itself.
CAlignPickCallback* alignCallback = new CAlignPickCallback;
GetIEditor()->PickObject(alignCallback, 0, "Align to Object");
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnAlignToGrid()
{
@@ -3547,15 +3480,6 @@ void CCryEditApp::OnAlignToGrid()
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateAlignObject(QAction* action)
{
Q_ASSERT(action->isCheckable());
action->setChecked(CAlignPickCallback::IsActive());
action->setEnabled(!GetIEditor()->GetSelection()->IsEmpty());
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnAlignToVoxel()
{
-8
View File
@@ -28,7 +28,6 @@
class CCryDocManager;
class CQuickAccessBar;
class CMatEditMainDlg;
class CCryEditDoc;
class CEditCommandLineInfo;
class CMainFrame;
@@ -225,10 +224,6 @@ public:
void OnEditmodeMove();
void OnEditmodeRotate();
void OnEditmodeScale();
void OnEditToolLink();
void OnUpdateEditToolLink(QAction* action);
void OnEditToolUnlink();
void OnUpdateEditToolUnlink(QAction* action);
void OnEditmodeSelect();
void OnEditEscape();
void OnObjectSetArea();
@@ -257,10 +252,8 @@ public:
void OnOpenAssetImporter();
void OnSelectionLoad();
void OnUpdateSelected(QAction* action);
void OnAlignObject();
void OnAlignToVoxel();
void OnAlignToGrid();
void OnUpdateAlignObject(QAction* action);
void OnUpdateAlignToVoxel(QAction* action);
void OnLockSelection();
void OnEditLevelData();
@@ -367,7 +360,6 @@ private:
//! Autotest mode: Special mode meant for automated testing, things like blocking dialogs or error report windows won't appear
bool m_bAutotestMode = false;
CMatEditMainDlg* m_pMatEditDlg = nullptr;
CConsoleDialog* m_pConsoleDialog = nullptr;
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
+9 -10
View File
@@ -276,9 +276,6 @@ void EditorViewportWidget::paintEvent([[maybe_unused]] QPaintEvent* event)
if ((ge && ge->IsLevelLoaded()) || (GetType() != ET_ViewportCamera))
{
setRenderOverlayVisible(true);
m_isOnPaint = true;
Update();
m_isOnPaint = false;
}
else
{
@@ -809,6 +806,10 @@ void EditorViewportWidget::OnBeginPrepareRender()
return;
}
m_isOnPaint = true;
Update();
m_isOnPaint = false;
float fNearZ = GetIEditor()->GetConsoleVar("cl_DefaultNearPlane");
float fFarZ = m_Camera.GetFarPlane();
@@ -883,6 +884,11 @@ void EditorViewportWidget::OnBeginPrepareRender()
GetIEditor()->GetSystem()->SetViewCamera(m_Camera);
if (GetIEditor()->IsInGameMode())
{
return;
}
PreWidgetRendering();
RenderAll();
@@ -908,13 +914,6 @@ void EditorViewportWidget::OnBeginPrepareRender()
m_debugDisplay->DepthTestOn();
PostWidgetRendering();
#if 0 // ATOMSHIM FIXUP
if (!m_renderer->IsStereoEnabled())
#endif
{
GetIEditor()->GetSystem()->RenderStatistics();
}
}
//////////////////////////////////////////////////////////////////////////
-29
View File
@@ -391,21 +391,6 @@ enum EModifiedModule
eModifiedAll = -1
};
//! Callback class passed to PickObject.
struct IPickObjectCallback
{
virtual ~IPickObjectCallback() = default;
//! Called when object picked.
virtual void OnPick(CBaseObject* picked) = 0;
//! Called when pick mode cancelled.
virtual void OnCancelPick() = 0;
//! Return true if specified object is pickable.
virtual bool OnPickFilter([[maybe_unused]] CBaseObject* filterObject) { return true; };
//! If need a specific behavior when holding space, return true or if not, return false.
virtual bool IsNeedSpecificBehaviorForSpaceAcce() { return false; }
};
//! Class provided by editor for various registration functions.
struct CRegistrationContext
{
@@ -570,20 +555,6 @@ struct IEditor
//! Get access to object manager.
virtual struct IObjectManager* GetObjectManager() = 0;
virtual CSettingsManager* GetSettingsManager() = 0;
//! Set pick object mode.
//! When object picked callback will be called, with OnPick
//! If pick operation is canceled Cancel will be called
//! @param targetClass specifies objects of which class are supposed to be picked
//! @param bMultipick if true pick tool will pick multiple object
virtual void PickObject(
IPickObjectCallback* callback,
const QMetaObject* targetClass = 0,
const char* statusText = 0,
bool bMultipick = false) = 0;
//! Cancel current pick operation
virtual void CancelPick() = 0;
//! Return true if editor now in object picking mode
virtual bool IsPicking() = 0;
//! Get DB manager that own items of specified type.
virtual IDataBaseManager* GetDBItemManager(EDataBaseItemType itemType) = 0;
//! Get Manager of Materials.
-35
View File
@@ -65,7 +65,6 @@ AZ_POP_DISABLE_WARNING
#include "UIEnumsDatabase.h"
#include "Util/Ruler.h"
#include "RenderHelpers/AxisHelper.h"
#include "PickObjectTool.h"
#include "Settings.h"
#include "Include/IObjectManager.h"
#include "Include/ISourceControl.h"
@@ -170,7 +169,6 @@ CEditorImpl::CEditorImpl()
, m_pShaderEnum(nullptr)
, m_pIconManager(nullptr)
, m_bSelectionLocked(true)
, m_pPickTool(nullptr)
, m_pAxisGizmo(nullptr)
, m_pGameEngine(nullptr)
, m_pAnimationContext(nullptr)
@@ -794,11 +792,6 @@ void CEditorImpl::SetEditTool(CEditTool* tool, bool bStopCurrentTool)
m_pEditTool->BeginEditParams(this, 0);
}
// Make sure pick is aborted.
if (tool != m_pPickTool)
{
m_pPickTool = nullptr;
}
Notify(eNotify_OnEditToolChange);
}
@@ -1069,34 +1062,6 @@ bool CEditorImpl::IsSelectionLocked()
return m_bSelectionLocked;
}
void CEditorImpl::PickObject(IPickObjectCallback* callback, const QMetaObject* targetClass, const char* statusText, bool bMultipick)
{
m_pPickTool = new CPickObjectTool(callback, targetClass);
static_cast<CPickObjectTool*>(m_pPickTool.get())->SetMultiplePicks(bMultipick);
if (statusText)
{
m_pPickTool.get()->SetStatusText(statusText);
}
SetEditTool(m_pPickTool);
}
void CEditorImpl::CancelPick()
{
SetEditTool(0);
m_pPickTool = 0;
}
bool CEditorImpl::IsPicking()
{
if (GetEditTool() == m_pPickTool && m_pPickTool != 0)
{
return true;
}
return false;
}
CViewManager* CEditorImpl::GetViewManager()
{
return m_pViewManager;
-4
View File
@@ -181,10 +181,7 @@ public:
void SelectObject(CBaseObject* obj);
void LockSelection(bool bLock);
bool IsSelectionLocked();
void PickObject(IPickObjectCallback* callback, const QMetaObject* targetClass = 0, const char* statusText = 0, bool bMultipick = false);
void CancelPick();
bool IsPicking();
IDataBaseManager* GetDBItemManager(EDataBaseItemType itemType);
CMaterialManager* GetMaterialManager() { return m_pMaterialManager; }
CMusicManager* GetMusicManager() { return m_pMusicManager; };
@@ -409,7 +406,6 @@ protected:
QString m_primaryCDFolder;
QString m_userFolder;
bool m_bSelectionLocked;
_smart_ptr<CEditTool> m_pPickTool;
class CAxisGizmo* m_pAxisGizmo;
CGameEngine* m_pGameEngine;
CAnimationContext* m_pAnimationContext;
+4 -1
View File
@@ -418,8 +418,11 @@ void CLayoutWnd::CreateLayout(EViewLayout layout, bool bBindViewports, EViewport
QRect rcView = rect();
rcView.setBottom(rcView.bottom() - m_infoBar->height());
// Ensure we delete our old view immediately so it can relinquish its backing ViewportContext
if (m_maximizedView)
m_maximizedView->deleteLater();
{
delete m_maximizedView;
}
m_maximizedView = new CLayoutViewPane(this);
m_maximizedView->SetId(0);
@@ -90,9 +90,6 @@ public:
MOCK_METHOD0(IsSelectionLocked, bool());
MOCK_METHOD0(GetObjectManager, struct IObjectManager* ());
MOCK_METHOD0(GetSettingsManager, CSettingsManager* ());
MOCK_METHOD4(PickObject, void(IPickObjectCallback*,const QMetaObject*,const char* ,bool bMultipick));
MOCK_METHOD0(CancelPick, void());
MOCK_METHOD0(IsPicking, bool());
MOCK_METHOD1(GetDBItemManager, IDataBaseManager* (EDataBaseItemType));
MOCK_METHOD0(GetMaterialManager, CMaterialManager* ());
MOCK_METHOD0(GetMaterialManagerLibrary, IBaseLibraryManager* ());
-286
View File
@@ -1,286 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#include "EditorDefs.h"
#include "LinkTool.h"
// Editor
#include "Viewport.h"
#include "Objects/EntityObject.h"
#include "Objects/SelectionGroup.h"
#include <Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.h>
// AzCore
#include <AzCore/Component/Entity.h>
#ifdef LoadCursor
#undef LoadCursor
#endif
namespace
{
const float kGeomCacheNodePivotSizeScale = 0.0025f;
}
//////////////////////////////////////////////////////////////////////////
CLinkTool::CLinkTool()
: m_nodeName(nullptr)
, m_pGeomCacheRenderNode(nullptr)
{
m_pChild = NULL;
SetStatusText("Click on object and drag a link to a new parent");
m_hLinkCursor = CMFCUtils::LoadCursor(IDC_POINTER_LINK);
m_hLinkNowCursor = CMFCUtils::LoadCursor(IDC_POINTER_LINKNOW);
m_hCurrCursor = &m_hLinkCursor;
AZ::EntitySystemBus::Handler::BusConnect();
}
//////////////////////////////////////////////////////////////////////////
CLinkTool::~CLinkTool()
{
AZ::EntitySystemBus::Handler::BusDisconnect();
}
//////////////////////////////////////////////////////////////////////////
void CLinkTool::LinkObject(CBaseObject* pChild, CBaseObject* pParent)
{
if (pChild == NULL)
{
return;
}
if (ChildIsValid(pParent, pChild))
{
CUndo undo("Link Object");
if (qobject_cast<CEntityObject*>(pChild))
{
static_cast<CEntityObject*>(pChild)->SetAttachTarget("");
static_cast<CEntityObject*>(pChild)->SetAttachType(CEntityObject::eAT_Pivot);
}
pParent->AttachChild(pChild, true);
QString str;
str = tr("%1 attached to %2").arg(pChild->GetName(), pParent->GetName());
SetStatusText(str);
}
else
{
SetStatusText("Error: Cyclic linking or already linked.");
}
}
//////////////////////////////////////////////////////////////////////////
void CLinkTool::LinkSelectedToParent(CBaseObject* pParent)
{
if (pParent)
{
if (IsRelevant(pParent))
{
CSelectionGroup* pSel = GetIEditor()->GetSelection();
if (!pSel->GetCount())
{
return;
}
CUndo undo("Link Object(s)");
for (int i = 0; i < pSel->GetCount(); i++)
{
CBaseObject* pChild = pSel->GetObject(i);
if (pChild == pParent)
{
continue;
}
LinkObject(pChild, pParent);
}
}
}
}
//////////////////////////////////////////////////////////////////////////
bool CLinkTool::MouseCallback(CViewport* view, EMouseEvent event, QPoint& point, [[maybe_unused]] int flags)
{
view->SetCursorString("");
m_hCurrCursor = &m_hLinkCursor;
if (event == eMouseLDown)
{
HitContext hitInfo;
view->HitTest(point, hitInfo);
CBaseObject* obj = hitInfo.object;
if (obj)
{
if (IsRelevant(obj))
{
m_StartDrag = obj->GetWorldPos();
m_pChild = obj;
}
}
}
else if (event == eMouseLUp)
{
HitContext hitInfo;
view->HitTest(point, hitInfo);
CBaseObject* obj = hitInfo.object;
if (obj)
{
if (IsRelevant(obj))
{
CSelectionGroup* pSelectionGroup = GetIEditor()->GetSelection();
int nGroupCount = pSelectionGroup->GetCount();
if (pSelectionGroup && nGroupCount > 1)
{
LinkSelectedToParent(obj);
}
if (!pSelectionGroup || nGroupCount <= 1 || !pSelectionGroup->IsContainObject(m_pChild))
{
LinkObject(m_pChild, obj);
}
}
}
m_pChild = NULL;
}
else if (event == eMouseMove)
{
m_EndDrag = view->ViewToWorld(point);
m_nodeName = nullptr;
m_pGeomCacheRenderNode = nullptr;
HitContext hitInfo;
if (view->HitTest(point, hitInfo))
{
m_EndDrag = hitInfo.raySrc + hitInfo.rayDir * hitInfo.dist;
}
CBaseObject* obj = hitInfo.object;
if (obj)
{
if (IsRelevant(obj))
{
QString name = obj->GetName();
if (hitInfo.name)
{
name += QString("\n ") + hitInfo.name;
}
// Set Cursors.
view->SetCursorString(name);
if (m_pChild)
{
if (ChildIsValid(obj, m_pChild))
{
m_hCurrCursor = &m_hLinkNowCursor;
}
}
}
}
}
return true;
}
//////////////////////////////////////////////////////////////////////////
bool CLinkTool::OnKeyDown([[maybe_unused]] CViewport* view, uint32 nChar, [[maybe_unused]] uint32 nRepCnt, [[maybe_unused]] uint32 nFlags)
{
if (nChar == VK_ESCAPE)
{
// Cancel selection.
GetIEditor()->SetEditTool(nullptr);
}
return false;
}
//////////////////////////////////////////////////////////////////////////
void CLinkTool::Display(DisplayContext& dc)
{
if (m_pChild && m_EndDrag != Vec3(ZERO))
{
ColorF lineColor = (m_hCurrCursor == &m_hLinkNowCursor) ? ColorF(0, 1, 0) : ColorF(1, 0, 0);
dc.DrawLine(m_StartDrag, m_EndDrag, lineColor, lineColor);
}
}
//////////////////////////////////////////////////////////////////////////
void CLinkTool::OnEntityDestruction(const AZ::EntityId& entityId)
{
if (m_pChild && (m_pChild->GetType() == OBJTYPE_AZENTITY))
{
CComponentEntityObject* childComponentEntity = static_cast<CComponentEntityObject*>(m_pChild);
AZ::EntityId childEntityId = childComponentEntity->GetAssociatedEntityId();
if(entityId == childEntityId)
{
GetIEditor()->SetEditTool(nullptr);
}
}
}
//////////////////////////////////////////////////////////////////////////
bool CLinkTool::ChildIsValid(CBaseObject* pParent, CBaseObject* pChild, int nDir)
{
if (!pParent)
{
return false;
}
if (!pChild)
{
return false;
}
if (pParent == pChild)
{
return false;
}
// Legacy entities and AZ entities shouldn't be linked.
if ((pParent->GetType() == OBJTYPE_AZENTITY) != (pChild->GetType() == OBJTYPE_AZENTITY))
{
return false;
}
CBaseObject* pObj;
if (nDir & 1)
{
pObj = pChild->GetParent();
if (pObj)
{
if (!ChildIsValid(pParent, pObj, 1))
{
return false;
}
}
}
if (nDir & 2)
{
for (int i = 0; i < pChild->GetChildCount(); i++)
{
pObj = pChild->GetChild(i);
if (pObj)
{
if (!ChildIsValid(pParent, pObj, 2))
{
return false;
}
}
}
}
return true;
}
//////////////////////////////////////////////////////////////////////////
bool CLinkTool::OnSetCursor(CViewport* vp)
{
vp->SetCursor(*m_hCurrCursor);
return true;
}
#include <moc_LinkTool.cpp>
-85
View File
@@ -1,85 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of CLinkTool, tool used to link objects.
#ifndef CRYINCLUDE_EDITOR_LINKTOOL_H
#define CRYINCLUDE_EDITOR_LINKTOOL_H
#pragma once
#if !defined(Q_MOC_RUN)
#include <AzCore/Component/EntityBus.h>
#include "EditTool.h"
#include "Include/IObjectManager.h"
#endif
class CEntityObject;
//////////////////////////////////////////////////////////////////////////
class CLinkTool
: public CEditTool
, public IObjectSelectCallback
, private AZ::EntitySystemBus::Handler
{
Q_OBJECT
public:
Q_INVOKABLE CLinkTool(); // IPickObjectCallback *callback,CRuntimeClass *targetClass=NULL );
// Ovverides from CEditTool
bool MouseCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags);
virtual void BeginEditParams([[maybe_unused]] IEditor* ie, [[maybe_unused]] int flags) {};
virtual void EndEditParams() {};
virtual void Display(DisplayContext& dc);
virtual bool OnKeyDown(CViewport* view, uint32 nChar, uint32 nRepCnt, uint32 nFlags);
virtual bool OnKeyUp([[maybe_unused]] CViewport* view, [[maybe_unused]] uint32 nChar, [[maybe_unused]] uint32 nRepCnt, [[maybe_unused]] uint32 nFlags) { return false; };
virtual bool OnSelectObject([[maybe_unused]] CBaseObject* obj) {return false; }
virtual bool CanSelectObject([[maybe_unused]] CBaseObject* obj) { return true; };
virtual bool OnSetCursor(CViewport* vp);
void LinkSelectedToParent(CBaseObject* pParent);
protected:
virtual ~CLinkTool();
// Delete itself.
void DeleteThis() { delete this; };
private:
bool IsRelevant([[maybe_unused]] CBaseObject* obj) { return true; }
bool ChildIsValid(CBaseObject* pParent, CBaseObject* pChild, int nDir = 3);
void LinkObject(CBaseObject* pChild, CBaseObject* pParent);
void LinkToNode(CEntityObject* pChild, CEntityObject* pParent, const char* nodeName);
// AZ::EntitySystemBus::Handler
void OnEntityDestruction(const AZ::EntityId& entityId) override;
CBaseObject* m_pChild;
Vec3 m_StartDrag;
Vec3 m_EndDrag;
QCursor m_hLinkCursor;
QCursor m_hLinkNowCursor;
QCursor* m_hCurrCursor;
const char* m_nodeName;
IGeomCacheRenderNode* m_pGeomCacheRenderNode;
};
#endif // CRYINCLUDE_EDITOR_LINKTOOL_H
-20
View File
@@ -92,7 +92,6 @@ AZ_POP_DISABLE_WARNING
#include "TrackView/TrackViewDialog.h"
#include "ErrorReportDialog.h"
#include "Material/MaterialDialog.h"
#include "LensFlareEditor/LensFlareEditor.h"
#include "TimeOfDayDialog.h"
@@ -1105,15 +1104,6 @@ void MainWindow::InitActions()
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateSelected)
.SetIcon(Style::icon("Align_to_grid"))
.SetApplyHoverEffect();
am->AddAction(ID_OBJECTMODIFY_ALIGN, tr("Align to object")).SetCheckable(true)
#if AZ_TRAIT_OS_PLATFORM_APPLE
.SetStatusTip(tr(u8"\u2318: Align an object to a bounding box, \u2325 : Keep Rotation of the moved object, Shift : Keep Scale of the moved object"))
#else
.SetStatusTip(tr("Ctrl: Align an object to a bounding box, Alt : Keep Rotation of the moved object, Shift : Keep Scale of the moved object"))
#endif
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateAlignObject)
.SetIcon(Style::icon("Align_to_Object"))
.SetApplyHoverEffect();
am->AddAction(ID_MODIFY_ALIGNOBJTOSURF, tr("Align object to surface (Hold CTRL)")).SetCheckable(true)
.SetToolTip(tr("Align object to surface (Hold CTRL)"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateAlignToVoxel)
@@ -1450,15 +1440,6 @@ void MainWindow::InitActions()
.SetApplyHoverEffect();
// Edit Mode Toolbar Actions
am->AddAction(ID_EDITTOOL_LINK, tr("Link an object to parent"))
.SetIcon(Style::icon("add_link"))
.SetApplyHoverEffect()
.SetCheckable(true)
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditToolLink);
am->AddAction(ID_EDITTOOL_UNLINK, tr("Unlink all selected objects"))
.SetIcon(Style::icon("remove_link"))
.SetApplyHoverEffect()
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditToolUnlink);
am->AddAction(IDC_SELECTION_MASK, tr("Selected Object Types"));
am->AddAction(ID_REF_COORDS_SYS, tr("Reference coordinate system"))
.SetShortcut(tr("Ctrl+W"))
@@ -1974,7 +1955,6 @@ void MainWindow::RegisterStdViewClasses()
if (!AZ::Interface<AzFramework::AtomActiveInterface>::Get())
{
CMaterialDialog::RegisterViewClass();
CLensFlareEditor::RegisterViewClass();
CTimeOfDayDialog::RegisterViewClass();
}
-110
View File
@@ -1,110 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : implementation file
#include "EditorDefs.h"
#include "MatEditMainDlg.h"
// Qt
#include <QVBoxLayout>
#include <QAbstractEventDispatcher>
// Editor
#include "Material/MaterialDialog.h"
#include "Material/MaterialManager.h"
#include "MaterialSender.h"
CMatEditMainDlg::CMatEditMainDlg(const QString& title, QWidget* pParent /*=NULL*/)
: QWidget(pParent)
{
resize(1000, 600);
setWindowTitle(title);
QTimer* t = new QTimer(this);
connect(t, &QTimer::timeout, this, &CMatEditMainDlg::OnKickIdle);
t->start(250);
m_materialDialog = new CMaterialDialog(); // must be created after the timer
auto layout = new QVBoxLayout(this);
layout->addWidget(m_materialDialog);
#ifdef Q_OS_WIN
if (auto aed = QAbstractEventDispatcher::instance())
{
aed->installNativeEventFilter(this);
}
#endif
}
CMatEditMainDlg::~CMatEditMainDlg()
{
#ifdef Q_OS_WIN
if (auto aed = QAbstractEventDispatcher::instance())
{
aed->removeNativeEventFilter(this);
}
#endif
}
/////////////////////////////////////////////////////////////////////////////
// CMatEditMainDlg message handlers
void CMatEditMainDlg::showEvent(QShowEvent*)
{
if (QWindow *win = window()->windowHandle())
{
// Make sure our top-level window decorator wrapper set this exact title
// 3ds Max Exporter will use ::FindWindow with this name
win->setTitle("Material Editor");
}
}
bool CMatEditMainDlg::nativeEventFilter(const QByteArray&, void* message, long*)
{
#ifdef Q_OS_WIN
// WM_MATEDITSEND is Windows only. Used by 3ds Max exporter.
MSG* msg = static_cast<MSG*>(message);
if (msg->message == WM_MATEDITSEND)
{
OnMatEditSend(msg->wParam);
return true;
}
#endif
return false;
}
void CMatEditMainDlg::closeEvent(QCloseEvent* event)
{
QWidget::closeEvent(event);
qApp->quit();
}
void CMatEditMainDlg::OnKickIdle()
{
GetIEditor()->Notify(eNotify_OnIdleUpdate);
}
void CMatEditMainDlg::OnMatEditSend(int param)
{
if (param != eMSM_Init)
{
GetIEditor()->GetMaterialManager()->SyncMaterialEditor();
}
}
#include <moc_MatEditMainDlg.cpp>
-48
View File
@@ -1,48 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#ifndef CRYINCLUDE_EDITOR_MATEDITMAINDLG_H
#define CRYINCLUDE_EDITOR_MATEDITMAINDLG_H
#pragma once
#if !defined(Q_MOC_RUN)
#include <QWidget>
#include <QString>
#include <QAbstractNativeEventFilter>
#endif
class CMaterialDialog;
class CMatEditMainDlg
: public QWidget
, public QAbstractNativeEventFilter
{
Q_OBJECT
public:
explicit CMatEditMainDlg(const QString& title = QString(), QWidget* parent = nullptr);
~CMatEditMainDlg();
bool nativeEventFilter(const QByteArray& eventType, void* message, long* result) override;
protected:
void closeEvent(QCloseEvent* event) override;
void showEvent(QShowEvent* event) override;
private:
void OnKickIdle();
void OnMatEditSend(int param);
CMaterialDialog* m_materialDialog = nullptr;
};
#endif // CRYINCLUDE_EDITOR_MATEDITMAINDLG_H
File diff suppressed because it is too large Load Diff
@@ -1,176 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#pragma once
#if !defined(Q_MOC_RUN)
#include "MaterialBrowser.h"
#include <QMainWindow>
#include <QPointer>
#include <QScopedPointer>
#endif
static const char* MATERIAL_EDITOR_NAME = "Material Editor";
static const char* MATERIAL_EDITOR_VER = "1.00";
class QComboBox;
class QLabel;
class CMaterial;
class CMaterialManager;
class CMatEditPreviewDlg;
class CMaterialSender;
class CMaterialImageListCtrl;
class QMaterialImageListModel;
class TwoColumnPropertyControl;
/** Dialog which hosts entity prototype library.
*/
struct SMaterialExcludedVars
{
CMaterial* pMaterial;
CVarBlock vars;
SMaterialExcludedVars()
: pMaterial(nullptr)
{
}
};
class CMaterialDialog
: public QMainWindow
, public IMaterialBrowserListener
, public IDataBaseManagerListener
, public IEditorNotifyListener
{
Q_OBJECT
public:
CMaterialDialog(QWidget* parent = 0);
~CMaterialDialog();
static void RegisterViewClass();
static const GUID& GetClassID();
public slots:
void OnAssignMaterialToSelection();
void OnResetMaterialOnSelection();
void OnGetMaterialFromSelection();
protected:
BOOL OnInitDialog();
void closeEvent(QCloseEvent *ev) override;
protected slots:
void OnAddItem();
void OnDeleteItem();
void OnSaveItem();
void OnPickMtl();
void OnCopy();
void OnPaste();
void OnMaterialPreview();
void OnSelectAssignedObjects();
void OnChangedBrowserListType(int);
void OnResetMaterialViewport();
void UpdateActions();
protected:
//////////////////////////////////////////////////////////////////////////
// Some functions can be overriden to modify standart functionality.
//////////////////////////////////////////////////////////////////////////
virtual void InitToolbar(UINT nToolbarResID);
virtual void SelectItem(CBaseLibraryItem* item, bool bForceReload = false);
virtual void DeleteItem(CBaseLibraryItem* pItem);
virtual bool SetItemName(CBaseLibraryItem* item, const QString& groupName, const QString& itemName);
virtual void ReloadItems();
//////////////////////////////////////////////////////////////////////////
// IMaterialBrowserListener implementation.
//////////////////////////////////////////////////////////////////////////
virtual void OnBrowserSelectItem(IDataBaseItem* pItem, bool bForce);
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// IDataBaseManagerListener implementation.
//////////////////////////////////////////////////////////////////////////
virtual void OnDataBaseItemEvent(IDataBaseItem* pItem, EDataBaseItemEvent event);
//////////////////////////////////////////////////////////////////////////
// IEditorNotifyListener implementation.
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
//////////////////////////////////////////////////////////////////////////
CMaterial* GetSelectedMaterial();
void OnUpdateProperties(IVariable* var);
void OnUndo(IVariable* pVar);
void UpdateShaderParamsUI(CMaterial* pMtl);
void UpdatePreview();
//void SetTextureVars( CVariableArray *texVar,CMaterial *mtl,int id,const CString &name );
void SetMaterialVars(CMaterial* mtl);
MaterialBrowserWidget* m_wndMtlBrowser;
QStatusBar* m_statusBar;
//CXTCaption m_wndCaption;
TwoColumnPropertyControl* m_propsCtrl;
bool m_bForceReloadPropsCtrl;
QLabel* m_placeHolderLabel;
CBaseLibraryItem* m_pPrevSelectedItem;
// Material manager.
CMaterialManager* m_pMatManager;
CVarBlockPtr m_vars;
CVarBlockPtr m_publicVars;
// collection of excluded vars from m_publicVars for remembering values
// when updating shader params
SMaterialExcludedVars m_excludedPublicVars;
CVarBlockPtr m_shaderGenParamsVars;
CVarBlockPtr m_textureSlots;
class CMaterialUI* m_pMaterialUI;
QPointer<CMatEditPreviewDlg> m_pPreviewDlg;
QScopedPointer<CMaterialImageListCtrl> m_pMaterialImageListCtrl;
QScopedPointer<QMaterialImageListModel> m_pMaterialImageListModel;
QToolBar* m_toolbar;
QComboBox* m_filterTypeSelection;
QAction* m_addAction;
QAction* m_assignToSelectionAction;
QAction* m_copyAction;
QAction* m_getFromSelectionAction;
QAction* m_pasteAction;
QAction* m_pickAction;
QAction* m_previewAction;
QAction* m_removeAction;
QAction* m_resetAction;
QAction* m_saveAction;
QAction* m_resetViewporAction;
};
@@ -1,39 +1,4 @@
<RCC>
<qresource prefix="/MaterialDialog/ToolBar">
<file>images/materialdialog_add_disabled.png</file>
<file>images/materialdialog_copy_disabled.png</file>
<file>images/materialdialog_paste_disabled.png</file>
<file>images/materialdialog_preview_disabled.png</file>
<file>images/materialdialog_remove_disabled.png</file>
<file>images/materialdialog_save_disabled.png</file>
<file>images/materialdialog_assignselection_disabled.png</file>
<file>images/materialdialog_getfromselection_disabled.png</file>
<file>images/materialdialog_pick_disabled.png</file>
<file>images/materialdialog_reset_disabled.png</file>
<file>images/materialdialog_assignselection_active.png</file>
<file>images/materialdialog_assignselection_normal.png</file>
<file>images/materialdialog_add_active.png</file>
<file>images/materialdialog_add_normal.png</file>
<file>images/materialdialog_copy_active.png</file>
<file>images/materialdialog_copy_normal.png</file>
<file>images/materialdialog_getfromselection_active.png</file>
<file>images/materialdialog_getfromselection_normal.png</file>
<file>images/materialdialog_paste_active.png</file>
<file>images/materialdialog_paste_normal.png</file>
<file>images/materialdialog_pick_active.png</file>
<file>images/materialdialog_pick_normal.png</file>
<file>images/materialdialog_preview_active.png</file>
<file>images/materialdialog_preview_normal.png</file>
<file>images/materialdialog_remove_active.png</file>
<file>images/materialdialog_remove_normal.png</file>
<file>images/materialdialog_reset_active.png</file>
<file>images/materialdialog_reset_normal.png</file>
<file>images/materialdialog_save_active.png</file>
<file>images/materialdialog_save_normal.png</file>
<file>images/materialdialog_reset_viewport_active.png</file>
<file>images/materialdialog_reset_viewport_disabled.png</file>
<file>images/materialdialog_reset_viewport_normal.png</file>
</qresource>
<qresource prefix="/MaterialBrowser">
<file>images/material_browser_00.png</file>
<file>images/material_browser_01.png</file>
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:703f6875258486629bc1db68ce80fe1653f0d2876cd1252d03f72f6eae04dd84
size 392
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3f3c05f8425956e9c1e380fde9a65df8f0d341868900a3589d9f629f34a0ddf6
size 251
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:25554e93a4f0d9b904a2a3628c315ee55c0ad8831bb5891a9d7e27e5cb9a5416
size 261
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b2ee886c6e487a6490361609fdd44c64438e40c7e5a4c40fda866ec399ec4727
size 256
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:943ff19774cbe8d47c1e8001a48e6d137fdac2c0af63c9092911c37be0d6d6a8
size 471
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:400d669d7a658968549f6ee776ee415b871b207c444d8797a404b76d536131b1
size 325
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:02bdc8aad92bb75b118c4a703a3e5b1369376620b3836a125faedc7f6b42b49b
size 330
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:38097d3041defeec0179390a73bb463e54e7f4c1f0b1a20e77ab3f69ea9cf13c
size 332
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e1d9fe8e97655bf776b20e242d66900980721ba2f3ee93c02cd4062a8b872eed
size 433
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:468b68c44d8ef183b292c1bc6ca4dc583357f693db9ea2cd198fb2af22537be1
size 249
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b27a1346f2edebe34ee06d7892a467bfc67952d0f8e4458e09a74a6dbf62fe98
size 336
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c3f40524a96689b8c8549bc662415df654494baeeda6eed47e66b455ac902eeb
size 254
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cebe97de0d879d239fcd61595fd28b73760aa6452dcf4dabc54bfe034e2e33c1
size 476
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:699ee40aeedfc50b7766e94ef66e645762eb183ddd6ce134b4bdab01c3957ab9
size 327
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5f1fd8a7cecb22901c6d73f2e6129f3bada0f94cf73d9a8fd2676a972faa5719
size 348
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d432de9e921d23fbbf3c1b805f644b9554aa206011a87c063d167c30c7c4579e
size 335
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c006e70efd8bdb1dd5aac867db9d97de587e8d518ba0693d19c319e34a74c7d0
size 501
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:00c291361664d357502f5267fccd0a6fff0c3f2e906c0402d57ad9fa5ca7f023
size 255
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d68fc8604a23eb3bcc0cac9bb6e83dd4dc4cdab70b0bdaec3c456559727c6b5b
size 354
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4055c7f029d7711e5c32f3f74901bf1dcc1540fd2c0f3f30dc74743d7f2cc042
size 355
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:99e2c0378137bef94eb6f281e0168852540bf1ca823b9bcd4365ef2849db9956
size 420
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:34075016c93f1914fe4d12ead7c5ee322a18466f08a476eff7c127e4e1429224
size 290
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dc289621f8a9d3e714cd985651d7d6f20495fb7be46e1f60c283d8920c730d0b
size 307
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7e9d5c878acf9fee4252cb854f192690d3f50d46dc4e5f5b1b5812b79fc2cdf7
size 296
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e2e912c40f07ca3d2a9b2aa1c5caf3acc181436b6a1b560fc021450701331b4c
size 403
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:00663e473803ba6c2798c494676b0a65fd62d7484f6d7b51d9fc8955ad586477
size 273
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:34b7d5520cfc8f00ff580558db4f0ec4297458d310321471204daa8678db5fc1
size 298
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7bca1a8811739949aa2e87486f8697dfae5bc5238894dd1b95ae80aa6f80d517
size 279
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:db86d857b651a2fec80418f8b251447bb3fcf4c0cf64bdee12c3b656adbde29a
size 422
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fef72444f077879d5c0186c9583f67aa45aafc23214d9e7de90a7c595609270f
size 258
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d2117fda3ed6a28032ae8f03ed7f9a7a0960f4691e49903c63b2150027dfe1ea
size 302
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:06b384ecc11ed2547a9bf466f585889d647c29a4883840070e444a382e80c41c
size 266
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4b9ee01e7fe2f19b0e736efe09c2b81d3243e369375b4f26346e6abd499e54a6
size 476
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:935a041332be1fe11ed01c09a3cd367fb9ede7e7eb04909614943f80e741d35f
size 334
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2b343233ab25a73fcdb4fff5509011497814fc4cb591065bdb3043a0f1092577
size 342
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1cc0183d7f57f15c4efeffb32795921f2f4e9c7965955fd0a392f826d5f6b6c8
size 337
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9a8467c1dcc343f637e0f7f5071a20b8881a43d567fb32fd96f5383f7b69bbb6
size 430
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0fd5ec79fc2c679f99ac5eb63d725f2cc815b09286bd0f3b5d2921eeb2e1e8cc
size 406
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3e19713b6586581d2336e833d8ecbd78b4b8f15b1c49a29d80acbf05e8aae3df
size 418
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4de0f4a102e5c4990d5d23e22b5cdd16532192f3a125758b608cd8c731278898
size 355
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d0b6f7c69112d124eac1123ffa840268c16148fef9ded3a67f84d3ad8d73eb96
size 212
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0b795fb88a6f301d7ecc9ce75141bdcf9e6dca25043730661aa4d1f09b055d6f
size 222
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:88fbce753cdd9381a814e3b2ec5d16df7cc26f2a37ad30b7010be71ae9183510
size 214
-173
View File
@@ -1,173 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#include "EditorDefs.h"
#include "PickObjectTool.h"
// Editor
#include "Viewport.h"
#include "Include/HitContext.h"
#include "Objects/BaseObject.h"
//////////////////////////////////////////////////////////////////////////
CPickObjectTool::CPickObjectTool(IPickObjectCallback* callback, const QMetaObject* targetClass)
{
assert(callback != 0);
m_callback = callback;
m_targetClass = targetClass;
m_bMultiPick = false;
}
//////////////////////////////////////////////////////////////////////////
CPickObjectTool::~CPickObjectTool()
{
GetIEditor()->GetObjectManager()->SetSelectCallback(0);
//m_prevSelectCallback = 0;
if (m_callback)
{
m_callback->OnCancelPick();
}
}
//////////////////////////////////////////////////////////////////////////
void CPickObjectTool::BeginEditParams([[maybe_unused]] IEditor* ie, [[maybe_unused]] int flags)
{
QString str = "Pick object";
if (m_targetClass)
{
str = tr("Pick %1 object").arg(m_targetClass->className());
}
SetStatusText(str);
//m_prevSelectCallback =
GetIEditor()->GetObjectManager()->SetSelectCallback(this);
}
//////////////////////////////////////////////////////////////////////////
bool CPickObjectTool::MouseCallback(CViewport* view, EMouseEvent event, QPoint& point, [[maybe_unused]] int flags)
{
if (event == eMouseLDown)
{
HitContext hitInfo;
view->HitTest(point, hitInfo);
CBaseObject* obj = hitInfo.object;
if (obj)
{
if (IsRelevant(obj))
{
if (m_callback)
{
// Can pick this one.
m_callback->OnPick(obj);
}
if (!m_bMultiPick)
{
m_callback = 0;
GetIEditor()->SetEditTool(0);
}
}
}
}
else if (event == eMouseMove)
{
HitContext hitInfo;
view->HitTest(point, hitInfo);
CBaseObject* obj = hitInfo.object;
if (obj)
{
if (IsRelevant(obj))
{
// Set Cursors.
view->SetCurrentCursor(STD_CURSOR_HIT, obj->GetName());
}
}
}
return true;
}
//////////////////////////////////////////////////////////////////////////
bool CPickObjectTool::OnSelectObject(CBaseObject* obj)
{
if (IsRelevant(obj))
{
// Can pick this one.
if (m_callback)
{
m_callback->OnPick(obj);
m_callback = 0;
}
if (!m_bMultiPick)
{
GetIEditor()->SetEditTool(0);
}
}
return false;
}
//////////////////////////////////////////////////////////////////////////
bool CPickObjectTool::CanSelectObject(CBaseObject* obj)
{
return IsRelevant(obj);
}
//////////////////////////////////////////////////////////////////////////
bool CPickObjectTool::OnKeyDown([[maybe_unused]] CViewport* view, uint32 nChar, [[maybe_unused]] uint32 nRepCnt, [[maybe_unused]] uint32 nFlags)
{
if (nChar == VK_ESCAPE)
{
// Cancel selection.
GetIEditor()->SetEditTool(0);
}
return false;
}
//////////////////////////////////////////////////////////////////////////
bool CPickObjectTool::IsRelevant(CBaseObject* obj)
{
assert(obj != 0);
if (obj == NULL)
{
return false;
}
if (!m_callback)
{
return false;
}
if (!m_targetClass)
{
return m_callback->OnPickFilter(obj);
}
else
{
if (obj->metaObject() == m_targetClass || m_targetClass->cast(obj))
{
return m_callback->OnPickFilter(obj);
}
}
return false;
}
//////////////////////////////////////////////////////////////////////////
bool CPickObjectTool::IsNeedSpecificBehaviorForSpaceAcce()
{
if (m_callback && m_callback->IsNeedSpecificBehaviorForSpaceAcce())
{
return true;
}
return false;
}
#include <moc_PickObjectTool.cpp>
-76
View File
@@ -1,76 +0,0 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of PickObjectTool, tool used to pick objects.
#ifndef CRYINCLUDE_EDITOR_PICKOBJECTTOOL_H
#define CRYINCLUDE_EDITOR_PICKOBJECTTOOL_H
#if !defined(Q_MOC_RUN)
#include "EditTool.h"
#include "IObjectManager.h"
#endif
#pragma once
//////////////////////////////////////////////////////////////////////////
class CPickObjectTool
: public CEditTool
, public IObjectSelectCallback
{
Q_OBJECT
public:
CPickObjectTool(IPickObjectCallback* callback, const QMetaObject* targetClass = NULL);
//! If set to true, pick tool will not stop picking after first pick.
void SetMultiplePicks(bool bEnable) { m_bMultiPick = bEnable; };
// Ovverides from CEditTool
bool MouseCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags);
virtual void BeginEditParams(IEditor* ie, int flags);
virtual void EndEditParams() {};
virtual void Display([[maybe_unused]] DisplayContext& dc) {};
virtual bool OnKeyDown(CViewport* view, uint32 nChar, uint32 nRepCnt, uint32 nFlags);
virtual bool OnKeyUp([[maybe_unused]] CViewport* view, [[maybe_unused]] uint32 nChar, [[maybe_unused]] uint32 nRepCnt, [[maybe_unused]] uint32 nFlags) { return false; };
//////////////////////////////////////////////////////////////////////////
// IObjectSelectCallback
//////////////////////////////////////////////////////////////////////////
virtual bool OnSelectObject(CBaseObject* obj);
virtual bool CanSelectObject(CBaseObject* obj);
//////////////////////////////////////////////////////////////////////////
virtual bool IsNeedSpecificBehaviorForSpaceAcce();
protected:
virtual ~CPickObjectTool();
// Delete itself.
void DeleteThis() { delete this; };
private:
bool IsRelevant(CBaseObject* obj);
//! Object that requested pick.
IPickObjectCallback* m_callback;
//! If target class specified, will pick only objects that belongs to that runtime class.
const QMetaObject* m_targetClass;
bool m_bMultiPick;
};
#endif // CRYINCLUDE_EDITOR_PICKOBJECTTOOL_H
+18 -2
View File
@@ -36,6 +36,8 @@
#include <algorithm>
#include <QScopedValueRollback>
#include <AzFramework/API/ApplicationAPI.h>
#include <AzAssetBrowser/AzAssetBrowserWindow.h>
#include <AzToolsFramework/UI/UICore/WidgetHelpers.h>
#include <AzQtComponents/Utilities/AutoSettingsGroup.h>
@@ -983,6 +985,11 @@ bool QtViewPaneManager::ClosePanesWithRollback(const QVector<QString>& panesToKe
*/
void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings)
{
// Get whether the prefab system is enabled
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(
isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
if (resetSettings)
{
// We're going to do something destructive (removing all of the viewpane settings). Better confirm with the user
@@ -1022,7 +1029,11 @@ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings)
state.viewPanes.push_back(LyViewPane::EntityInspector);
state.viewPanes.push_back(LyViewPane::AssetBrowser);
state.viewPanes.push_back(LyViewPane::Console);
state.viewPanes.push_back(LyViewPane::LevelInspector);
if (!isPrefabSystemEnabled)
{
state.viewPanes.push_back(LyViewPane::LevelInspector);
}
state.mainWindowState = m_defaultMainWindowState;
@@ -1047,7 +1058,12 @@ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings)
const QtViewPane* assetBrowserViewPane = OpenPane(LyViewPane::AssetBrowser, QtViewPane::OpenMode::UseDefaultState);
const QtViewPane* entityInspectorViewPane = OpenPane(LyViewPane::EntityInspector, QtViewPane::OpenMode::UseDefaultState);
const QtViewPane* consoleViewPane = OpenPane(LyViewPane::Console, QtViewPane::OpenMode::UseDefaultState);
const QtViewPane* levelInspectorPane = OpenPane(LyViewPane::LevelInspector, QtViewPane::OpenMode::UseDefaultState);
const QtViewPane* levelInspectorPane = nullptr;
if (!isPrefabSystemEnabled)
{
levelInspectorPane = OpenPane(LyViewPane::LevelInspector, QtViewPane::OpenMode::UseDefaultState);
}
// This class does all kinds of behind the scenes magic to make docking / restore work, especially with groups
// so instead of doing our special default layout attach / docking right now, we want to make it happen
-3
View File
@@ -181,8 +181,6 @@
#define ID_TV_STOP 33568
#define ID_TV_PAUSE 33569
#define ID_ADDNODE 33570
#define ID_EDITTOOL_LINK 33571
#define ID_EDITTOOL_UNLINK 33572
#define ID_ADDSCENETRACK 33573
#define ID_FIND 33574
#define ID_SNAP_TO_GRID 33575
@@ -214,7 +212,6 @@
#define ID_TV_JUMPSTART 33601
#define ID_TV_PREVKEY 33602
#define ID_TV_NEXTKEY 33603
#define ID_OBJECTMODIFY_ALIGN 33604
#define ID_PLAY_LOOP 33607
#define ID_TERRAIN 33611
#define ID_OBJECTMODIFY_ALIGNTOGRID 33619
-8
View File
@@ -585,13 +585,6 @@ AmazonToolbar ToolbarManager::GetEditModeToolbar() const
t.AddAction(ID_TOOLBAR_WIDGET_UNDO, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_TOOLBAR_WIDGET_REDO, ORIGINAL_TOOLBAR_VERSION);
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
{
t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_EDITTOOL_LINK, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_EDITTOOL_UNLINK, ORIGINAL_TOOLBAR_VERSION);
}
t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION);
if (!GetIEditor()->IsNewViewportInteractionModelEnabled())
@@ -630,7 +623,6 @@ AmazonToolbar ToolbarManager::GetObjectToolbar() const
AmazonToolbar t = AmazonToolbar("Object", QObject::tr("Object Toolbar"));
t.SetMainToolbar(true);
t.AddAction(ID_GOTO_SELECTED, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_OBJECTMODIFY_ALIGN, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_OBJECTMODIFY_ALIGNTOGRID, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_OBJECTMODIFY_SETHEIGHT, ORIGINAL_TOOLBAR_VERSION);
t.AddAction(ID_MODIFY_ALIGNOBJTOSURF, ORIGINAL_TOOLBAR_VERSION);
@@ -95,6 +95,11 @@ bool ViewportManipulatorControllerInstance::HandleInputChannelEvent(const AzFram
AZStd::optional<MouseButton> overrideButton;
AZStd::optional<MouseEvent> eventType;
// Because we receive events multiple times at separate priorities for manipulator events and
// viewport interaction events, we want to avoid updating our "last tick state" until we're on our last event,
// which currently is the low priority Interaction processor.
const bool finishedProcessingEvents = event.m_priority == InteractionPriority;
if (IsMouseMove(event.m_inputChannel))
{
// Cache the ray trace results when doing manipulator interaction checks, no need to recalculate after
@@ -120,10 +125,11 @@ bool ViewportManipulatorControllerInstance::HandleInputChannelEvent(const AzFram
}
else if (auto mouseButton = GetMouseButton(event.m_inputChannel); mouseButton != MouseButton::None)
{
const AZ::u32 mouseButtonValue = static_cast<AZ::u32>(mouseButton);
overrideButton = mouseButton;
if (event.m_inputChannel.GetState() == InputChannel::State::Began)
{
m_state.m_mouseButtons.m_mouseButtons |= static_cast<AZ::u32>(mouseButton);
m_state.m_mouseButtons.m_mouseButtons |= mouseButtonValue;
if (IsDoubleClick(mouseButton))
{
// Only remove the double click flag once we're done processing both Manipulator and Interaction events
@@ -135,8 +141,8 @@ bool ViewportManipulatorControllerInstance::HandleInputChannelEvent(const AzFram
}
else
{
// Only insert the double click timing once we're done processing both Manipulator and Interaction events, to avoid a false IsDoubleClick positive
if (event.m_priority == InteractionPriority)
// Only insert the double click timing once we're done processing events, to avoid a false IsDoubleClick positive
if (finishedProcessingEvents)
{
m_pendingDoubleClicks[mouseButton] = m_curTime;
}
@@ -145,8 +151,18 @@ bool ViewportManipulatorControllerInstance::HandleInputChannelEvent(const AzFram
}
else if (event.m_inputChannel.GetState() == InputChannel::State::Ended)
{
m_state.m_mouseButtons.m_mouseButtons &= ~static_cast<AZ::u32>(mouseButton);
eventType = MouseEvent::Up;
// If we've actually logged a mouse down event, forward a mouse up event.
// This prevents corner cases like the context menu thinking it should be opened even though no one clicked in this viewport,
// due to RenderViewportWidget ensuring all controllers get InputChannel::State::Ended events.
if (m_state.m_mouseButtons.m_mouseButtons & mouseButtonValue)
{
// Erase the button from our state if we're done processing events.
if (event.m_priority == InteractionPriority)
{
m_state.m_mouseButtons.m_mouseButtons &= ~mouseButtonValue;
}
eventType = MouseEvent::Up;
}
}
}
else if (auto keyboardModifier = GetKeyboardModifier(event.m_inputChannel); keyboardModifier != KeyboardModifier::None)
@@ -316,8 +316,6 @@ set(FILES
Material/MaterialHelpers.cpp
Material/MaterialHelpers.h
Material/MaterialDialog.qrc
Material/MaterialDialog.cpp
Material/MaterialDialog.h
Material/MaterialPreviewModelView.cpp
Material/MaterialPreviewModelView.h
Material/PreviewModelView.cpp
@@ -535,8 +533,6 @@ set(FILES
Dialogs/PythonScriptsDialog.ui
Dialogs/Generic/UserOptions.cpp
Dialogs/Generic/UserOptions.h
AlignTool.cpp
AlignTool.h
ObjectCloneTool.cpp
ObjectCloneTool.h
EditMode/SubObjectSelectionReferenceFrameCalculator.cpp
@@ -547,10 +543,6 @@ set(FILES
RotateTool.h
EditTool.cpp
EditTool.h
LinkTool.cpp
LinkTool.h
PickObjectTool.cpp
PickObjectTool.h
VoxelAligningTool.cpp
VoxelAligningTool.h
Export/ExportManager.cpp
@@ -632,8 +624,6 @@ set(FILES
LensFlareEditor/LensFlareView.h
LogFileImpl.cpp
LogFileImpl.h
MatEditMainDlg.cpp
MatEditMainDlg.h
MatEditPreviewDlg.cpp
MatEditPreviewDlg.h
Material/MaterialBrowser.cpp