add stubs for non-uniform scale component mode
This commit is contained in:
+13
@@ -16,6 +16,8 @@
|
||||
#include <AzCore/Math/Transform.h>
|
||||
#include <AzCore/Math/ToString.h>
|
||||
|
||||
#include <AzToolsFramework/ComponentModes/BoxComponentMode.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Components
|
||||
@@ -32,6 +34,7 @@ namespace AzToolsFramework
|
||||
serializeContext->Class<EditorNonUniformScaleComponent, EditorComponentBase>()
|
||||
->Version(1)
|
||||
->Field("NonUniformScale", &EditorNonUniformScaleComponent::m_scale)
|
||||
->Field("ComponentMode", &EditorNonUniformScaleComponent::m_componentModeDelegate)
|
||||
;
|
||||
|
||||
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
||||
@@ -50,6 +53,9 @@ namespace AzToolsFramework
|
||||
->Attribute(AZ::Edit::Attributes::Max, AZ::MaxTransformScale)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 0.1f)
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorNonUniformScaleComponent::OnScaleChanged)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &EditorNonUniformScaleComponent::m_componentModeDelegate,
|
||||
"Component Mode", "Non-uniform Scale Component Mode")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -74,10 +80,17 @@ namespace AzToolsFramework
|
||||
void EditorNonUniformScaleComponent::Activate()
|
||||
{
|
||||
AZ::NonUniformScaleRequestBus::Handler::BusConnect(GetEntityId());
|
||||
|
||||
// ComponentMode
|
||||
m_componentModeDelegate.ConnectWithSingleComponentMode<
|
||||
EditorNonUniformScaleComponent, NonUniformScaleComponentMode>(
|
||||
AZ::EntityComponentIdPair(GetEntityId(), GetId()), this);
|
||||
}
|
||||
|
||||
void EditorNonUniformScaleComponent::Deactivate()
|
||||
{
|
||||
m_componentModeDelegate.Disconnect();
|
||||
|
||||
AZ::NonUniformScaleRequestBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
|
||||
+21
@@ -13,6 +13,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorNonUniformScaleComponentMode.h>
|
||||
#include <AzToolsFramework/ComponentMode/ComponentModeDelegate.h>
|
||||
#include <AzToolsFramework/API/ComponentEntitySelectionBus.h>
|
||||
#include <AzCore/Component/NonUniformScaleBus.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
@@ -23,6 +26,9 @@ namespace AzToolsFramework
|
||||
class EditorNonUniformScaleComponent
|
||||
: public AzToolsFramework::Components::EditorComponentBase
|
||||
, public AZ::NonUniformScaleRequestBus::Handler
|
||||
, public AzToolsFramework::EditorComponentSelectionRequestsBus::Handler
|
||||
, public AzToolsFramework::EditorComponentSelectionNotificationsBus::Handler
|
||||
, private NonUniformScaleManipulatorRequestBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_EDITOR_COMPONENT(EditorNonUniformScaleComponent, "{2933FB4F-B3DA-4CD1-8106-F37300730777}", EditorComponentBase);
|
||||
@@ -40,6 +46,18 @@ namespace AzToolsFramework
|
||||
void SetScale(const AZ::Vector3& scale) override;
|
||||
void RegisterScaleChangedEvent(AZ::NonUniformScaleChangedEvent::Handler& handler);
|
||||
|
||||
protected:
|
||||
// EditorComponentSelectionRequestsBus overrides ...
|
||||
AZ::Aabb GetEditorSelectionBoundsViewport(
|
||||
[[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo) override { return AZ::Aabb::CreateNull(); };
|
||||
bool EditorSelectionIntersectRayViewport(
|
||||
[[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo,
|
||||
[[maybe_unused]] const AZ::Vector3& src, [[maybe_unused]] const AZ::Vector3& dir, [[maybe_unused]] float& distance) override { return false; };
|
||||
bool SupportsEditorRayIntersect() override { return true; }
|
||||
|
||||
// EditorComponentSelectionNotificationsBus overrides ...
|
||||
void OnAccentTypeChanged([[maybe_unused]] AzToolsFramework::EntityAccentType accent) override {};
|
||||
|
||||
private:
|
||||
static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
|
||||
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
|
||||
@@ -52,6 +70,9 @@ namespace AzToolsFramework
|
||||
|
||||
AZ::Vector3 m_scale = AZ::Vector3::CreateOne();
|
||||
AZ::NonUniformScaleChangedEvent m_scaleChangedEvent;
|
||||
|
||||
//! Responsible for detecting ComponentMode activation and creating a concrete ComponentMode.
|
||||
AzToolsFramework::ComponentModeFramework::ComponentModeDelegate m_componentModeDelegate;
|
||||
};
|
||||
} // namespace Components
|
||||
} // namespace AzToolsFramework
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzToolsFramework/ToolsComponents/EditorNonUniformScaleComponentMode.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
NonUniformScaleComponentMode::NonUniformScaleComponentMode(const AZ::EntityComponentIdPair& entityComponentIdPair,
|
||||
AZ::Uuid componentType)
|
||||
: EditorBaseComponentMode(entityComponentIdPair, componentType)
|
||||
{
|
||||
}
|
||||
|
||||
NonUniformScaleComponentMode::~NonUniformScaleComponentMode()
|
||||
{
|
||||
}
|
||||
|
||||
void NonUniformScaleComponentMode::Refresh()
|
||||
{
|
||||
}
|
||||
} // namespace Components
|
||||
} // namespace AzToolsFramework
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzToolsFramework/ComponentMode/EditorBaseComponentMode.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
//! Interface for handling non-uniform scale manipulator requests.
|
||||
//! Used by NonUniformScaleComponentMode.
|
||||
class NonUniformScaleManipulatorRequests
|
||||
: public AZ::EntityComponentBus
|
||||
{
|
||||
public:
|
||||
|
||||
protected:
|
||||
~NonUniformScaleManipulatorRequests() = default;
|
||||
};
|
||||
|
||||
//! Type to inherit to implement NonUniformScaleManipulatorRequests
|
||||
using NonUniformScaleManipulatorRequestBus = AZ::EBus<NonUniformScaleManipulatorRequests>;
|
||||
|
||||
class NonUniformScaleComponentMode
|
||||
: public AzToolsFramework::ComponentModeFramework::EditorBaseComponentMode
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(NonUniformScaleComponentMode, AZ::SystemAllocator, 0)
|
||||
|
||||
NonUniformScaleComponentMode(const AZ::EntityComponentIdPair& entityComponentIdPair, AZ::Uuid componentType);
|
||||
NonUniformScaleComponentMode(const NonUniformScaleComponentMode&) = delete;
|
||||
NonUniformScaleComponentMode& operator=(const NonUniformScaleComponentMode&) = delete;
|
||||
NonUniformScaleComponentMode(NonUniformScaleComponentMode&&) = delete;
|
||||
NonUniformScaleComponentMode& operator=(NonUniformScaleComponentMode&&) = delete;
|
||||
~NonUniformScaleComponentMode();
|
||||
|
||||
// EditorBaseComponentMode
|
||||
void Refresh() override;
|
||||
};
|
||||
} // namespace Components
|
||||
} // namespace AzToolsFramework
|
||||
@@ -303,6 +303,8 @@ set(FILES
|
||||
ToolsComponents/AzToolsFrameworkConfigurationSystemComponent.cpp
|
||||
ToolsComponents/EditorNonUniformScaleComponent.h
|
||||
ToolsComponents/EditorNonUniformScaleComponent.cpp
|
||||
ToolsComponents/EditorNonUniformScaleComponentMode.h
|
||||
ToolsComponents/EditorNonUniformScaleComponentMode.cpp
|
||||
ToolsMessaging/EntityHighlightBus.h
|
||||
UI/Docking/DockWidgetUtils.cpp
|
||||
UI/Docking/DockWidgetUtils.h
|
||||
|
||||
Reference in New Issue
Block a user