Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
@@ -0,0 +1,83 @@
/*
* 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 <GraphCanvas/Components/NodePropertyDisplay/AssetIdDataInterface.h>
#include <Editor/GraphCanvas/DataInterfaces/ScriptCanvasDataInterface.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/Slice/SliceAsset.h>
#include <QWidget>
#include <QMenu>
#include <QAction>
namespace ScriptCanvasEditor
{
class ScriptCanvasAssetIdDataInterface
: public ScriptCanvasDataInterface<GraphCanvas::AssetIdDataInterface>
{
public:
AZ_CLASS_ALLOCATOR(ScriptCanvasAssetIdDataInterface, AZ::SystemAllocator, 0);
ScriptCanvasAssetIdDataInterface(const AZ::EntityId& nodeId, const ScriptCanvas::SlotId& slotId)
: ScriptCanvasDataInterface(nodeId, slotId)
{
}
~ScriptCanvasAssetIdDataInterface() = default;
// AssetIdDataInterface
AZ::Data::AssetId GetAssetId() const override
{
const ScriptCanvas::Datum* object = GetSlotObject();
if (object)
{
const AZ::Data::AssetId* retVal = object->GetAs<AZ::Data::AssetId>();
if (retVal)
{
return (*retVal);
}
}
return AZ::Data::AssetId();
}
void SetAssetId(const AZ::Data::AssetId& assetId) override
{
ScriptCanvas::ModifiableDatumView datumView;
ModifySlotObject(datumView);
if (datumView.IsValid())
{
datumView.SetAs(assetId);
PostUndoPoint();
PropertyGridRequestBus::Broadcast(&PropertyGridRequests::RefreshPropertyGrid);
}
}
AZ::Data::AssetType GetAssetType() const override
{
return AZ::AzTypeInfo<AZ::DynamicSliceAsset>::Uuid(); //hardcoded for DynamicSliceAsset until the slot definitions can be queried for this
}
AZStd::string GetStringFilter() const override
{
return AZ::DynamicSliceAsset::GetFileFilter(); //hardcoded for DynamicSliceAsset until the slot definitions can be queried for this
}
////
};
}
@@ -0,0 +1,64 @@
/*
* 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 <GraphCanvas/Components/NodePropertyDisplay/BooleanDataInterface.h>
#include "ScriptCanvasDataInterface.h"
namespace ScriptCanvasEditor
{
class ScriptCanvasBoolDataInterface
: public ScriptCanvasDataInterface<GraphCanvas::BooleanDataInterface>
{
public:
AZ_CLASS_ALLOCATOR(ScriptCanvasBoolDataInterface, AZ::SystemAllocator, 0);
ScriptCanvasBoolDataInterface(const AZ::EntityId& nodeId, const ScriptCanvas::SlotId& slotId)
: ScriptCanvasDataInterface(nodeId, slotId)
{
}
~ScriptCanvasBoolDataInterface() = default;
// BooleanDataInterface
bool GetBool() const override
{
const ScriptCanvas::Datum* object = GetSlotObject();
if (object)
{
const bool* retVal = object->GetAs<bool>();
if (retVal)
{
return (*retVal);
}
}
return false;
}
void SetBool(bool enabled) override
{
ScriptCanvas::ModifiableDatumView datumView;
ModifySlotObject(datumView);
if (datumView.IsValid())
{
datumView.SetAs(enabled);
PostUndoPoint();
PropertyGridRequestBus::Broadcast(&PropertyGridRequests::RefreshPropertyGrid);
}
}
};
}
@@ -0,0 +1,80 @@
/*
* 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 <GraphCanvas/Components/NodePropertyDisplay/StringDataInterface.h>
#include "ScriptCanvasDataInterface.h"
#include <ScriptCanvas/Bus/EditorScriptCanvasBus.h>
namespace ScriptCanvasEditor
{
class ScriptCanvasCRCDataInterface
: public ScriptCanvasDataInterface<GraphCanvas::StringDataInterface>
{
public:
AZ_CLASS_ALLOCATOR(ScriptCanvasCRCDataInterface, AZ::SystemAllocator, 0);
ScriptCanvasCRCDataInterface(const AZ::EntityId& nodeId, const ScriptCanvas::SlotId& slotId)
: ScriptCanvasDataInterface(nodeId, slotId)
{
}
~ScriptCanvasCRCDataInterface() = default;
// StringDataInterface
AZStd::string GetString() const override
{
AZStd::string retVal;
const ScriptCanvas::Datum* object = GetSlotObject();
if (object && object->IS_A<AZ::Crc32>())
{
AZ::Crc32 crcValue = (*object->GetAs<AZ::Crc32>());
EditorGraphRequestBus::EventResult(retVal, GetScriptCanvasId(), &EditorGraphRequests::DecodeCrc, crcValue);
if (retVal.empty() && crcValue != AZ::Crc32())
{
AZ_Warning("ScriptCanvas", false, "Unknown CRC value. Cannot display cached string.");
retVal = AZStd::string::format("0x%X", static_cast<AZ::u32>(crcValue));
}
}
return retVal;
}
void SetString(const AZStd::string& value) override
{
ScriptCanvas::ModifiableDatumView datumView;
ModifySlotObject(datumView);
if (datumView.IsValid())
{
AZ::Crc32 newCrc = AZ::Crc32(value.c_str());
AZ::Crc32 oldCrc = (*datumView.GetAs<AZ::Crc32>());
if (oldCrc != newCrc)
{
EditorGraphRequestBus::Event(GetScriptCanvasId(), &EditorGraphRequests::RemoveCrcCache, oldCrc);
EditorGraphRequestBus::Event(GetScriptCanvasId(), &EditorGraphRequests::AddCrcCache, newCrc, value);
datumView.SetAs<ScriptCanvas::Data::CRCType>(newCrc);
PostUndoPoint();
PropertyGridRequestBus::Broadcast(&PropertyGridRequests::RefreshPropertyGrid);
}
}
}
////
};
}
@@ -0,0 +1,158 @@
/*
* 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 <AzCore/Math/Color.h>
#include <GraphCanvas/Components/NodePropertyDisplay/VectorDataInterface.h>
#include "ScriptCanvasDataInterface.h"
namespace ScriptCanvasEditor
{
class ScriptCanvasColorDataInterface
: public ScriptCanvasDataInterface<GraphCanvas::VectorDataInterface>
{
public:
AZ_CLASS_ALLOCATOR(ScriptCanvasColorDataInterface, AZ::SystemAllocator, 0);
ScriptCanvasColorDataInterface(const AZ::EntityId& nodeId, const ScriptCanvas::SlotId& slotId)
: ScriptCanvasDataInterface(nodeId, slotId)
{
}
~ScriptCanvasColorDataInterface() = default;
int GetElementCount() const override
{
return 4;
}
double GetValue(int index) const override
{
if (index < GetElementCount())
{
const ScriptCanvas::Datum* object = GetSlotObject();
if (object)
{
const AZ::Color* retVal = object->GetAs<AZ::Color>();
if (retVal)
{
float resultValue = 0.0f;
switch (index)
{
case 0:
resultValue = aznumeric_cast<float>(static_cast<int>(static_cast<float>(retVal->GetR()) * GetMaximum(index)));
break;
case 1:
resultValue = aznumeric_cast<float>(static_cast<int>(static_cast<float>(retVal->GetG()) * GetMaximum(index)));
break;
case 2:
resultValue = aznumeric_cast<float>(static_cast<int>(static_cast<float>(retVal->GetB()) * GetMaximum(index)));
break;
case 3:
resultValue = aznumeric_cast<float>(static_cast<int>(static_cast<float>(retVal->GetA()) * GetMaximum(index)));
break;
default:
break;
}
return aznumeric_cast<double>(static_cast<float>(resultValue));
}
}
}
return 0.0;
}
void SetValue(int index, double value) override
{
if (index < GetElementCount())
{
ScriptCanvas::ModifiableDatumView datumView;
ModifySlotObject(datumView);
if (datumView.IsValid())
{
AZ::Color currentColor = (*datumView.GetAs<AZ::Color>());
switch (index)
{
case 0:
currentColor.SetR(aznumeric_cast<float>(value / GetMaximum(index)));
break;
case 1:
currentColor.SetG(aznumeric_cast<float>(value / GetMaximum(index)));
break;
case 2:
currentColor.SetB(aznumeric_cast<float>(value / GetMaximum(index)));
break;
case 3:
currentColor.SetA(aznumeric_cast<float>(value / GetMaximum(index)));
break;
default:
break;
}
datumView.SetAs(currentColor);
PostUndoPoint();
PropertyGridRequestBus::Broadcast(&PropertyGridRequests::RefreshPropertyGrid);
}
}
}
const char* GetLabel(int index) const override
{
switch (index)
{
case 0:
return "R";
case 1:
return "G";
case 2:
return "B";
case 3:
return "A";
default:
return "???";
}
}
AZStd::string GetStyle() const override
{
return "vectorized";
}
virtual AZStd::string GetElementStyle(int index) const
{
return AZStd::string::format("vector_%i", index);
}
int GetDecimalPlaces([[maybe_unused]] int index) const override
{
return 0;
}
double GetMinimum([[maybe_unused]] int index) const override
{
return 0.0;
}
double GetMaximum([[maybe_unused]] int index) const override
{
return 255.0;
}
};
}
@@ -0,0 +1,101 @@
/*
* 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 <GraphCanvas/Components/NodePropertyDisplay/DataInterface.h>
#include "ScriptCanvas/Core/Slot.h"
#include "ScriptCanvas/Core/NodeBus.h"
#include "ScriptCanvas/Core/Datum.h"
#include <Editor/View/Widgets/PropertyGridBus.h>
namespace ScriptCanvasEditor
{
template<class InterfaceType>
class ScriptCanvasDataInterface
: public ScriptCanvas::NodeNotificationsBus::Handler
, public InterfaceType
{
protected:
ScriptCanvasDataInterface(const AZ::EntityId& nodeId, const ScriptCanvas::SlotId& slotId)
: m_nodeId(nodeId)
, m_slotId(slotId)
{
static_assert((AZStd::is_base_of<GraphCanvas::DataInterface, InterfaceType>::value), "ScriptCanvasDataInterface given invalid GraphCanvas::DataInterface to inherit.");
ScriptCanvas::NodeNotificationsBus::Handler::BusConnect(nodeId);
}
using InterfaceType::SignalValueChanged;
public:
virtual ~ScriptCanvasDataInterface() = default;
const ScriptCanvas::ScriptCanvasId GetScriptCanvasId() const
{
ScriptCanvas::ScriptCanvasId scriptCanvasId;
ScriptCanvas::NodeRequestBus::EventResult(scriptCanvasId, GetNodeId(), &ScriptCanvas::NodeRequests::GetOwningScriptCanvasId);
return scriptCanvasId;
}
const GraphCanvas::GraphId GetGraphCanvasGraphId() const
{
GraphCanvas::GraphId graphCanvasGraphId;
GeneralRequestBus::BroadcastResult(graphCanvasGraphId, &GeneralRequests::GetGraphCanvasGraphId, GetScriptCanvasId());
return graphCanvasGraphId;
}
const AZ::EntityId& GetNodeId() const
{
return m_nodeId;
}
const ScriptCanvas::SlotId& GetSlotId() const
{
return m_slotId;
}
const ScriptCanvas::Datum* GetSlotObject() const
{
const ScriptCanvas::Datum* object = nullptr;
ScriptCanvas::NodeRequestBus::EventResult(object, GetNodeId(), &ScriptCanvas::NodeRequests::FindDatum, GetSlotId());
return object;
}
void ModifySlotObject(ScriptCanvas::ModifiableDatumView& datumView)
{
ScriptCanvas::NodeRequestBus::Event(GetNodeId(), &ScriptCanvas::NodeRequests::FindModifiableDatumView, GetSlotId(), datumView);
}
// NodeNotificationsBus
void OnInputChanged(const ScriptCanvas::SlotId& slotId) override
{
if (slotId == m_slotId)
{
SignalValueChanged();
}
}
void PostUndoPoint()
{
GeneralRequestBus::Broadcast(&GeneralRequests::PostUndoPoint, GetScriptCanvasId());
}
////
private:
AZ::EntityId m_nodeId;
ScriptCanvas::SlotId m_slotId;
};
}
@@ -0,0 +1,109 @@
/*
* 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 <GraphCanvas/Components/NodePropertyDisplay/EntityIdDataInterface.h>
#include "ScriptCanvasDataInterface.h"
#include <QWidget>
#include <QMenu>
#include <QAction>
namespace ScriptCanvasEditor
{
class ScriptCanvasEntityIdDataInterface
: public ScriptCanvasDataInterface<GraphCanvas::EntityIdDataInterface>
{
public:
AZ_CLASS_ALLOCATOR(ScriptCanvasEntityIdDataInterface, AZ::SystemAllocator, 0);
ScriptCanvasEntityIdDataInterface(const AZ::EntityId& nodeId, const ScriptCanvas::SlotId& slotId)
: ScriptCanvasDataInterface(nodeId, slotId)
{
}
~ScriptCanvasEntityIdDataInterface() = default;
// EntityIdDataInterface
AZ::EntityId GetEntityId() const override
{
const ScriptCanvas::Datum* object = GetSlotObject();
if (object)
{
const AZ::EntityId* retVal = object->GetAs<AZ::EntityId>();
if (retVal)
{
return (*retVal);
}
}
return AZ::EntityId();
}
const AZStd::string GetNameOverride() const override
{
const ScriptCanvas::Datum* object = GetSlotObject();
if (object && object->IS_A(ScriptCanvas::Data::Type::EntityID()))
{
const AZ::EntityId* entityId = object->GetAs<AZ::EntityId>();
if (entityId && *entityId == ScriptCanvas::GraphOwnerId)
{
return "Self";
}
}
return {};
}
void OnShowContextMenu(QWidget* nodePropertyDisplay, const QPoint& pos) override
{
QPoint globalPos = nodePropertyDisplay->mapToGlobal(pos);
enum EntityMenuAction
{
SetToSelf
};
QMenu entityMenu;
QAction* setToSelf = entityMenu.addAction("Set to Self");
setToSelf->setToolTip("Reset the EntityId to the Entity that owns this graph.");
setToSelf->setData(EntityMenuAction::SetToSelf);
QAction* selectedItem = entityMenu.exec(globalPos);
if (selectedItem)
{
if (selectedItem->data().toInt() == EntityMenuAction::SetToSelf)
{
SetEntityId(ScriptCanvas::GraphOwnerId);
}
}
}
void SetEntityId(const AZ::EntityId& entityId) override
{
ScriptCanvas::ModifiableDatumView datumView;
ModifySlotObject(datumView);
if (datumView.IsValid() && datumView.IsType(ScriptCanvas::Data::Type::EntityID()))
{
datumView.SetAs(entityId);
PostUndoPoint();
PropertyGridRequestBus::Broadcast(&PropertyGridRequests::RefreshPropertyGrid);
}
}
////
};
}
@@ -0,0 +1,100 @@
/*
* 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 <GraphCanvas/Components/NodePropertyDisplay/ComboBoxDataInterface.h>
#include <GraphCanvas/Widgets/ComboBox/ComboBoxItemModels.h>
#include "ScriptCanvasDataInterface.h"
namespace ScriptCanvasEditor
{
// Used for fixed values value input.
class ScriptCanvasEnumDataInterface
: public ScriptCanvasDataInterface<GraphCanvas::ComboBoxDataInterface>
{
public:
AZ_CLASS_ALLOCATOR(ScriptCanvasEnumDataInterface, AZ::SystemAllocator, 0);
ScriptCanvasEnumDataInterface(const AZ::EntityId& nodeId, const ScriptCanvas::SlotId& slotId)
: ScriptCanvasDataInterface(nodeId, slotId)
{
}
~ScriptCanvasEnumDataInterface() = default;
void AddElement(int32_t element, const AZStd::string& displayName)
{
QString qtName = displayName.c_str();
m_comboBoxModel.AddElement(element, qtName);
}
// GraphCanvas::ComboBoxDataInterface
GraphCanvas::ComboBoxItemModelInterface* GetItemInterface() override
{
return &m_comboBoxModel;
}
void AssignIndex(const QModelIndex& index) override
{
ScriptCanvas::ModifiableDatumView datumView;
ModifySlotObject(datumView);
if (datumView.IsValid())
{
int32_t value = m_comboBoxModel.GetValueForIndex(index);
datumView.SetAs(value);
PostUndoPoint();
PropertyGridRequestBus::Broadcast(&PropertyGridRequests::RefreshPropertyGrid);
}
}
QModelIndex GetAssignedIndex() const override
{
const ScriptCanvas::Datum* object = GetSlotObject();
if (object)
{
const int* element = object->GetAs<int>();
if (element)
{
return m_comboBoxModel.GetIndexForValue(*element);
}
}
return m_comboBoxModel.GetDefaultIndex();
}
const QString& GetDisplayString() const override
{
const ScriptCanvas::Datum* object = GetSlotObject();
if (object)
{
const int* element = object->GetAs<int>();
if (element)
{
return m_comboBoxModel.GetNameForValue((*element));
}
}
return GraphCanvas::ComboBoxDataInterface::GetDisplayString();
}
////
private:
GraphCanvas::GraphCanvasListComboBoxModel<int32_t> m_comboBoxModel;
};
}
@@ -0,0 +1,67 @@
/*
* 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 <GraphCanvas/Components/NodePropertyDisplay/ComboBoxDataInterface.h>
#include <GraphCanvas/Components/NodePropertyDisplay/NumericDataInterface.h>
#include "ScriptCanvasDataInterface.h"
namespace ScriptCanvasEditor
{
// Used for general numeric input.
class ScriptCanvasNumericDataInterface
: public ScriptCanvasDataInterface<GraphCanvas::NumericDataInterface>
{
public:
AZ_CLASS_ALLOCATOR(ScriptCanvasNumericDataInterface, AZ::SystemAllocator, 0);
ScriptCanvasNumericDataInterface(const AZ::EntityId& nodeId, const ScriptCanvas::SlotId& slotId)
: ScriptCanvasDataInterface(nodeId, slotId)
{
}
~ScriptCanvasNumericDataInterface() = default;
// NumericDataInterface
double GetNumber() const override
{
const ScriptCanvas::Datum* object = GetSlotObject();
if (object)
{
const double* retVal = object->GetAs<double>();
if (retVal)
{
return (*retVal);
}
}
return 0.0;
}
void SetNumber(double value) override
{
ScriptCanvas::ModifiableDatumView datumView;
ModifySlotObject(datumView);
if (datumView.IsValid())
{
datumView.SetAs(value);
PostUndoPoint();
PropertyGridRequestBus::Broadcast(&PropertyGridRequests::RefreshPropertyGrid);
}
}
////
};
}
@@ -0,0 +1,140 @@
/*
* 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 <AzCore/Math/Transform.h>
#include <AzCore/Math/Quaternion.h>
#include <GraphCanvas/Components/NodePropertyDisplay/VectorDataInterface.h>
#include "ScriptCanvasDataInterface.h"
namespace ScriptCanvasEditor
{
class ScriptCanvasQuaternionDataInterface
: public ScriptCanvasDataInterface<GraphCanvas::VectorDataInterface>
{
public:
AZ_CLASS_ALLOCATOR(ScriptCanvasQuaternionDataInterface, AZ::SystemAllocator, 0);
ScriptCanvasQuaternionDataInterface(const AZ::EntityId& nodeId, const ScriptCanvas::SlotId& slotId)
: ScriptCanvasDataInterface(nodeId, slotId)
{
ConvertToEulerValues();
}
~ScriptCanvasQuaternionDataInterface() = default;
int GetElementCount() const override
{
return 3;
}
double GetValue(int index) const override
{
if (index < GetElementCount())
{
const ScriptCanvas::Datum* object = GetSlotObject();
if (object)
{
const AZ::Quaternion* retVal = object->GetAs<AZ::Quaternion>();
if (retVal)
{
return aznumeric_cast<double>(static_cast<float>(m_eulerAngles.GetElement(index)));
}
}
}
return 0.0;
}
void SetValue(int index, double value) override
{
if (index < GetElementCount())
{
ScriptCanvas::ModifiableDatumView datumView;
ModifySlotObject(datumView);
if (datumView.IsValid())
{
m_eulerAngles.SetElement(index, aznumeric_cast<float>(value));
AZ::Quaternion newValue = AZ::ConvertEulerDegreesToQuaternion(m_eulerAngles);
datumView.SetAs(newValue);
PostUndoPoint();
PropertyGridRequestBus::Broadcast(&PropertyGridRequests::RefreshPropertyGrid);
}
}
}
const char* GetLabel(int index) const override
{
switch (index)
{
case 0:
return "P";
case 1:
return "R";
case 2:
return "Y";
default:
return "???";
}
}
AZStd::string GetStyle() const override
{
return "vectorized";
}
AZStd::string GetElementStyle(int index) const override
{
return AZStd::string::format("quat_%i", index);
}
const char* GetSuffix([[maybe_unused]] int index) const override
{
return " deg";
}
void OnInputChanged(const ScriptCanvas::SlotId& slotId) override
{
if (slotId == GetSlotId())
{
ConvertToEulerValues();
}
ScriptCanvasDataInterface::OnInputChanged(slotId);
}
private:
void ConvertToEulerValues()
{
const ScriptCanvas::Datum* object = GetSlotObject();
if (object)
{
const AZ::Quaternion* quat = object->GetAs<AZ::Quaternion>();
if (quat)
{
m_eulerAngles = AZ::ConvertTransformToEulerDegrees(AZ::Transform::CreateFromQuaternion((*quat)));
}
}
}
AZ::Vector3 m_eulerAngles;
};
}
@@ -0,0 +1,48 @@
/*
* 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 <GraphCanvas/Components/NodePropertyDisplay/ReadOnlyDataInterface.h>
#include "ScriptCanvasDataInterface.h"
namespace ScriptCanvasEditor
{
class ScriptCanvasReadOnlyDataInterface
: public ScriptCanvasDataInterface<GraphCanvas::ReadOnlyDataInterface>
{
public:
AZ_CLASS_ALLOCATOR(ScriptCanvasReadOnlyDataInterface, AZ::SystemAllocator, 0);
ScriptCanvasReadOnlyDataInterface(const AZ::EntityId& nodeId, const ScriptCanvas::SlotId& slotId)
: ScriptCanvasDataInterface(nodeId, slotId)
{
}
~ScriptCanvasReadOnlyDataInterface() = default;
// ReadOnlyDataInterface
AZStd::string GetString() const override
{
AZStd::string retVal;
const ScriptCanvas::Datum* object = GetSlotObject();
if (object)
{
object->ToString(retVal);
}
return retVal;
}
////
};
}
@@ -0,0 +1,64 @@
/*
* 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 <GraphCanvas/Components/NodePropertyDisplay/StringDataInterface.h>
#include "ScriptCanvasDataInterface.h"
namespace ScriptCanvasEditor
{
class ScriptCanvasStringDataInterface
: public ScriptCanvasDataInterface<GraphCanvas::StringDataInterface>
{
public:
AZ_CLASS_ALLOCATOR(ScriptCanvasStringDataInterface, AZ::SystemAllocator, 0);
ScriptCanvasStringDataInterface(const AZ::EntityId& nodeId, const ScriptCanvas::SlotId& slotId)
: ScriptCanvasDataInterface(nodeId, slotId)
{
}
~ScriptCanvasStringDataInterface() = default;
// StringDataInterface
AZStd::string GetString() const override
{
AZStd::string retVal;
const ScriptCanvas::Datum* object = GetSlotObject();
if (object)
{
object->ToString(retVal);
}
return retVal;
}
void SetString(const AZStd::string& value) override
{
ScriptCanvas::ModifiableDatumView datumView;
ModifySlotObject(datumView);
const AZStd::string* string = datumView.GetAs<AZStd::string>();
if (string->compare(value) != 0)
{
datumView.SetAs<AZStd::string>(value);
PostUndoPoint();
PropertyGridRequestBus::Broadcast(&PropertyGridRequests::RefreshPropertyGrid);
}
}
////
};
}
@@ -0,0 +1,550 @@
/*
* 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 <AzCore/PlatformDef.h>
AZ_PUSH_DISABLE_WARNING(4251 4800 4244, "-Wunknown-warning-option")
#include <QString>
AZ_POP_DISABLE_WARNING
#include <GraphCanvas/Components/Connections/ConnectionBus.h>
#include <GraphCanvas/Components/NodePropertyDisplay/ComboBoxDataInterface.h>
#include <GraphCanvas/Components/Nodes/NodeTitleBus.h>
#include <GraphCanvas/Components/Slots/Data/DataSlotBus.h>
#include <GraphCanvas/Widgets/ComboBox/ComboBoxItemModels.h>
#include <GraphCanvas/Utils/QtMimeUtils.h>
#include <Editor/Include/ScriptCanvas/Bus/EditorSceneVariableManagerBus.h>
#include <Editor/Include/ScriptCanvas/Bus/RequestBus.h>
#include <Editor/Include/ScriptCanvas/Components/EditorGraphVariableManagerComponent.h>
#include <Editor/Include/ScriptCanvas/GraphCanvas/NodeDescriptorBus.h>
#include "ScriptCanvasDataInterface.h"
#include <ScriptCanvas/Core/Slot.h>
#include <ScriptCanvas/Core/Node.h>
#include <ScriptCanvas/Variable/VariableBus.h>
#include <ScriptCanvas/Utils/DataUtils.h>
namespace ScriptCanvasEditor
{
class VariableComboBoxDataModel
: public GraphCanvas::GraphCanvasListComboBoxModel<ScriptCanvas::VariableId>
, public ScriptCanvas::GraphVariableManagerNotificationBus::Handler
, public GeneralEditorNotificationBus::Handler
{
public:
AZ_CLASS_ALLOCATOR(VariableComboBoxDataModel, AZ::SystemAllocator, 0);
VariableComboBoxDataModel()
{
}
~VariableComboBoxDataModel() override
{
ScriptCanvas::GraphVariableManagerNotificationBus::Handler::BusDisconnect();
GeneralEditorNotificationBus::Handler::BusDisconnect();
}
void Activate(const ScriptCanvas::ScriptCanvasId& scriptCanvasId)
{
m_scriptCanvasId = scriptCanvasId;
GeneralEditorNotificationBus::Handler::BusConnect(m_scriptCanvasId);
if (!IsInUndo())
{
FinalizeActivation();
}
}
// ScriptCanvas::GraphVariableManagerNotifications
void OnVariableAddedToGraph(const ScriptCanvas::VariableId& variableId, AZStd::string_view variableName) override
{
QString displayName = QString::fromUtf8(variableName.data(), static_cast<int>(variableName.size()));
AddElement(variableId, displayName);
}
void OnVariableRemovedFromGraph(const ScriptCanvas::VariableId& variableId, [[maybe_unused]] AZStd::string_view variableName) override
{
RemoveElement(variableId);
}
void OnVariableNameChangedInGraph(const ScriptCanvas::VariableId& variableId, AZStd::string_view variableName) override
{
RemoveElement(variableId);
OnVariableAddedToGraph(variableId, variableName);
}
////
// GeneralEditorNotifications
void OnUndoRedoBegin()
{
ScriptCanvas::GraphVariableManagerNotificationBus::Handler::BusDisconnect();
}
void OnUndoRedoEnd()
{
FinalizeActivation();
}
////
const ScriptCanvas::GraphVariable* GetGraphVariable(const ScriptCanvas::VariableId& variableId) const
{
const ScriptCanvas::GraphVariable* graphVariable = nullptr;
ScriptCanvas::GraphVariableManagerRequestBus::EventResult(graphVariable, m_scriptCanvasId, &ScriptCanvas::GraphVariableManagerRequests::FindVariableById, variableId);
return graphVariable;
}
const ScriptCanvas::GraphVariable* GetGraphVariableForIndex(const QModelIndex& index) const
{
return GetGraphVariable(GetValueForIndex(index));
}
private:
void FinalizeActivation()
{
ScriptCanvas::GraphVariableManagerNotificationBus::Handler::BusConnect(m_scriptCanvasId);
const ScriptCanvas::GraphVariableMapping* graphVariables = nullptr;
ScriptCanvas::GraphVariableManagerRequestBus::EventResult(graphVariables, m_scriptCanvasId, &ScriptCanvas::GraphVariableManagerRequests::GetVariables);
if (graphVariables)
{
ClearElements();
for (auto variablePair : (*graphVariables))
{
OnVariableAddedToGraph(variablePair.first, variablePair.second.GetVariableName());
}
}
}
bool IsInUndo() const
{
bool isInUndo = false;
GeneralRequestBus::BroadcastResult(isInUndo, &GeneralRequests::IsScriptCanvasInUndoRedo, m_scriptCanvasId);
return isInUndo;
}
ScriptCanvas::ScriptCanvasId m_scriptCanvasId;
};
class VariableTypeComboBoxFilterModel
: public GraphCanvas::GraphCanvasSortFilterComboBoxProxyModel
{
public:
AZ_CLASS_ALLOCATOR(VariableTypeComboBoxFilterModel, AZ::SystemAllocator, 0);
VariableTypeComboBoxFilterModel(const VariableComboBoxDataModel* sourceModel, ScriptCanvas::Slot* slot = nullptr)
: m_sourceModel(sourceModel)
, m_slotFilter(slot)
{
SetModelInterface(const_cast<VariableComboBoxDataModel*>(sourceModel));
}
void SetSlotFilter(ScriptCanvas::Slot* slotFilter)
{
if (m_slotFilter != slotFilter)
{
m_slotFilter = slotFilter;
if (sourceModel())
{
invalidateFilter();
}
}
}
void RefreshFilter()
{
if (sourceModel())
{
invalidateFilter();
}
}
bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const
{
if (m_slotFilter == nullptr)
{
return true;
}
QModelIndex sourceIndex = m_sourceModel->index(sourceRow, VariableComboBoxDataModel::ColumnIndex::Name, sourceParent);
const ScriptCanvas::GraphVariable* variable = m_sourceModel->GetGraphVariableForIndex(sourceIndex);
if (variable)
{
auto dataType = variable->GetDatum()->GetType();
return m_slotFilter->IsTypeMatchFor(dataType).IsSuccess();
}
return false;
}
ScriptCanvas::VariableId GetValueForIndex(const QModelIndex& modelIndex) const
{
return m_sourceModel->GetValueForIndex(RemapToSourceIndex(modelIndex));
}
QModelIndex GetIndexForValue(const ScriptCanvas::VariableId& variableId) const
{
return RemapFromSourceIndex(m_sourceModel->GetIndexForValue(variableId));
}
const QString& GetDisplayName(const ScriptCanvas::VariableId& variableId) const
{
return m_sourceModel->GetNameForValue(variableId);
}
const ScriptCanvas::GraphVariable* GetGraphVariable(const ScriptCanvas::VariableId& variableId) const
{
return m_sourceModel->GetGraphVariable(variableId);
}
private:
const VariableComboBoxDataModel* m_sourceModel;
ScriptCanvas::Slot* m_slotFilter;
};
class ScriptCanvasGraphScopedVariableDataInterface
: public ScriptCanvasDataInterface<GraphCanvas::ComboBoxDataInterface>
, public ScriptCanvas::VariableNotificationBus::Handler
, public AZ::SystemTickBus::Handler
{
public:
AZ_CLASS_ALLOCATOR(ScriptCanvasGraphScopedVariableDataInterface, AZ::SystemAllocator, 0);
ScriptCanvasGraphScopedVariableDataInterface(const VariableComboBoxDataModel* variableDataModel, const AZ::EntityId& scriptCanvasGraphId, const AZ::EntityId& scriptCanvasNodeId, const ScriptCanvas::SlotId& scriptCanvasSlotId)
: ScriptCanvasDataInterface(scriptCanvasNodeId, scriptCanvasSlotId)
, m_scriptCanvasGraphId(scriptCanvasGraphId)
, m_variableTypeModel(variableDataModel)
{
RegisterBus();
}
~ScriptCanvasGraphScopedVariableDataInterface()
{
AZ::SystemTickBus::Handler::BusDisconnect();
ScriptCanvas::VariableNotificationBus::Handler::BusDisconnect();
}
// SystemTickBus
void OnSystemTick()
{
AZ::SystemTickBus::Handler::BusDisconnect();
AssignIndex(m_variableTypeModel.GetDefaultIndex());
SignalValueChanged();
}
////
// VariableNotificationBus
void OnVariableRenamed([[maybe_unused]] AZStd::string_view newName) override
{
SignalValueChanged();
}
void OnVariableRemoved() override
{
// Delay this since its possible the model hasn't updated yet
AZ::SystemTickBus::Handler::BusConnect();
}
////
// ScriptCanvas::NodeNotificationsBus::Handler
void OnInputChanged(const ScriptCanvas::SlotId& slotId)
{
if (slotId == GetSlotId())
{
RegisterBus();
}
ScriptCanvasDataInterface<GraphCanvas::ComboBoxDataInterface>::OnInputChanged(slotId);
}
////
// GraphCanvas::ComboBoxModelInterface
GraphCanvas::ComboBoxItemModelInterface* GetItemInterface() override
{
return &m_variableTypeModel;
}
void AssignIndex(const QModelIndex& index) override
{
if (!index.isValid())
{
return;
}
ScriptCanvas::VariableId variableId = m_variableTypeModel.GetValueForIndex(index);
SetVariableId(variableId);
}
QModelIndex GetAssignedIndex() const override
{
const ScriptCanvas::Datum* datum = GetSlotObject();
const ScriptCanvas::GraphScopedVariableId* variableId = (datum ? datum->GetAs<ScriptCanvas::GraphScopedVariableId>() : nullptr);
if (variableId)
{
return m_variableTypeModel.GetIndexForValue(variableId->m_identifier);
}
return QModelIndex();
}
// Returns the string used to display the currently selected value[Used in the non-editable format]
const QString& GetDisplayString() const override
{
const ScriptCanvas::Datum* datum = GetSlotObject();
const ScriptCanvas::GraphScopedVariableId* variableId = (datum ? datum->GetAs<ScriptCanvas::GraphScopedVariableId>() : nullptr);
if (variableId)
{
return m_variableTypeModel.GetDisplayName(variableId->m_identifier);
}
return ComboBoxDataInterface::GetDisplayString();
}
void SetVariableId(const ScriptCanvas::VariableId& variableId)
{
ScriptCanvas::GraphScopedVariableId scopedVariableId;
scopedVariableId.m_identifier = variableId;
ScriptCanvas::ModifiableDatumView datumView;
ModifySlotObject(datumView);
datumView.SetAs<ScriptCanvas::GraphScopedVariableId>(scopedVariableId);
if (ScriptCanvas::VariableNotificationBus::Handler::BusIsConnected())
{
ScriptCanvas::VariableNotificationBus::Handler::BusDisconnect();
}
scopedVariableId.m_scriptCanvasId = GetScriptCanvasId();
ScriptCanvas::VariableNotificationBus::Handler::BusConnect(scopedVariableId);
PostUndoPoint();
PropertyGridRequestBus::Broadcast(&PropertyGridRequests::RefreshPropertyGrid);
}
// DataInterfaceOverrides
bool EnableDropHandling() const override
{
return true;
}
AZ::Outcome<GraphCanvas::DragDropState> ShouldAcceptMimeData(const QMimeData* mimeData) override
{
if (mimeData->hasFormat(GraphCanvas::k_ReferenceMimeType))
{
return AZ::Success(GraphCanvas::DragDropState::Valid);
}
return AZ::Failure();
}
bool HandleMimeData(const QMimeData* mimeData) override
{
ScriptCanvas::VariableId variableId = GraphCanvas::QtMimeUtils::ExtractTypeFromMimeData<ScriptCanvas::VariableId>(mimeData, GraphCanvas::k_ReferenceMimeType);
SetVariableId(variableId);
return true;
}
//
private:
void RegisterBus()
{
if (ScriptCanvas::VariableNotificationBus::Handler::BusIsConnected())
{
ScriptCanvas::VariableNotificationBus::Handler::BusDisconnect();
}
const ScriptCanvas::Datum* datum = GetSlotObject();
const ScriptCanvas::GraphScopedVariableId* variableId = (datum ? datum->GetAs<ScriptCanvas::GraphScopedVariableId>() : nullptr);
if (variableId)
{
ScriptCanvas::GraphScopedVariableId scopedVariableId = (*variableId);
scopedVariableId.m_scriptCanvasId = GetScriptCanvasId();
ScriptCanvas::VariableNotificationBus::Handler::BusConnect(scopedVariableId);
}
}
VariableTypeComboBoxFilterModel m_variableTypeModel;
AZ::EntityId m_scriptCanvasGraphId;
};
class ScriptCanvasVariableReferenceDataInterface
: public ScriptCanvasDataInterface<GraphCanvas::ComboBoxDataInterface>
, public ScriptCanvas::VariableNotificationBus::Handler
, public ScriptCanvas::EndpointNotificationBus::Handler
{
public:
AZ_CLASS_ALLOCATOR(ScriptCanvasVariableReferenceDataInterface, AZ::SystemAllocator, 0);
ScriptCanvasVariableReferenceDataInterface(const VariableComboBoxDataModel* variableDataModel, const AZ::EntityId& scriptCanvasGraphId, const AZ::EntityId& scriptCanvasNodeId, const ScriptCanvas::SlotId& scriptCanvasSlotId)
: ScriptCanvasDataInterface(scriptCanvasNodeId, scriptCanvasSlotId)
, m_scriptCanvasGraphId(scriptCanvasGraphId)
, m_variableTypeModel(variableDataModel)
{
ScriptCanvas::Slot* slot = GetSlot();
if (slot)
{
m_variableTypeModel.SetSlotFilter(slot);
ScriptCanvas::VariableId variableId = slot->GetVariableReference();
if (variableId.IsValid())
{
ScriptCanvas::VariableNotificationBus::Handler::BusConnect(ScriptCanvas::GraphScopedVariableId(m_scriptCanvasGraphId, variableId));
}
}
ScriptCanvas::EndpointNotificationBus::Handler::BusConnect(ScriptCanvas::Endpoint(scriptCanvasNodeId, scriptCanvasSlotId));
}
~ScriptCanvasVariableReferenceDataInterface()
{
ScriptCanvas::VariableNotificationBus::Handler::BusDisconnect();
ScriptCanvas::EndpointNotificationBus::Handler::BusDisconnect();
}
// NodeNotificationBus
void OnSlotDisplayTypeChanged(const ScriptCanvas::SlotId& slotId, [[maybe_unused]] const ScriptCanvas::Data::Type& slotType)
{
if (slotId == GetSlotId())
{
m_variableTypeModel.RefreshFilter();
}
}
////
// VariableNotificationBus
void OnVariableRenamed([[maybe_unused]] AZStd::string_view newName) override
{
SignalValueChanged();
}
////
// EndpointNotificationBus
void OnEndpointReferenceChanged(const ScriptCanvas::VariableId& variableId)
{
ScriptCanvas::VariableNotificationBus::Handler::BusDisconnect();
ScriptCanvas::VariableNotificationBus::Handler::BusConnect(ScriptCanvas::GraphScopedVariableId(GetScriptCanvasId(), variableId));
SignalValueChanged();
}
void OnSlotRecreated()
{
ScriptCanvas::Slot* slot = GetSlot();
if (slot)
{
m_variableTypeModel.SetSlotFilter(slot);
}
}
////
// GraphCanvas::ComboBoxModelInterface
GraphCanvas::ComboBoxItemModelInterface* GetItemInterface() override
{
return &m_variableTypeModel;
}
void AssignIndex(const QModelIndex& index) override
{
ScriptCanvas::Slot* slot = GetSlot();
if (slot)
{
if (slot->IsVariableReference())
{
// This will trigger an ebus call regarding the modification, which will trigger the value changed.
ScriptCanvas::VariableId variableId = m_variableTypeModel.GetValueForIndex(index);
slot->SetVariableReference(variableId);
PostUndoPoint();
}
}
}
QModelIndex GetAssignedIndex() const override
{
ScriptCanvas::Slot* slot = GetSlot();
if (slot)
{
if (slot->IsVariableReference())
{
return m_variableTypeModel.GetIndexForValue(slot->GetVariableReference());
}
}
return QModelIndex();
}
// Returns the string used to display the currently selected value[Used in the non-editable format]
const QString& GetDisplayString() const override
{
ScriptCanvas::Slot* slot = GetSlot();
if (slot)
{
if (slot->IsVariableReference())
{
const ScriptCanvas::GraphVariable* variable = m_variableTypeModel.GetGraphVariable(slot->GetVariableReference());
if (variable)
{
return m_variableTypeModel.GetDisplayName(variable->GetVariableId());
}
}
}
return ComboBoxDataInterface::GetDisplayString();
}
private:
ScriptCanvas::Slot* GetSlot() const
{
ScriptCanvas::Slot* slot = nullptr;
ScriptCanvas::NodeRequestBus::EventResult(slot, GetNodeId(), &ScriptCanvas::NodeRequests::GetSlot, GetSlotId());
return slot;
}
VariableTypeComboBoxFilterModel m_variableTypeModel;
ScriptCanvas::Data::Type m_displayType = ScriptCanvas::Data::Type::Invalid();
AZ::EntityId m_scriptCanvasGraphId;
};
}
@@ -0,0 +1,120 @@
/*
* 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 <GraphCanvas/Components/NodePropertyDisplay/VectorDataInterface.h>
#include "ScriptCanvasDataInterface.h"
namespace ScriptCanvasEditor
{
template<class Type, int ElementCount>
class ScriptCanvasVectorizedDataInterface
: public ScriptCanvasDataInterface<GraphCanvas::VectorDataInterface>
{
public:
AZ_CLASS_ALLOCATOR(ScriptCanvasVectorizedDataInterface, AZ::SystemAllocator, 0);
ScriptCanvasVectorizedDataInterface(const AZ::EntityId& nodeId, const ScriptCanvas::SlotId& slotId)
: ScriptCanvasDataInterface(nodeId, slotId)
{
}
~ScriptCanvasVectorizedDataInterface() = default;
int GetElementCount() const override
{
return ElementCount;
}
double GetValue(int index) const override
{
if (index < GetElementCount())
{
if (const ScriptCanvas::Datum* object = GetSlotObject())
{
if (const Type* retVal = object->GetAs<Type>())
{
return aznumeric_cast<double>(static_cast<float>(retVal->GetElement(index)));
}
}
}
return 0.0;
}
void SetValue(int index, double value) override
{
if (index < GetElementCount())
{
ScriptCanvas::ModifiableDatumView datumView;
ModifySlotObject(datumView);
if (datumView.IsValid())
{
Type currentValue = (*datumView.GetAs<Type>());
currentValue.SetElement(index, aznumeric_cast<float>(value));
datumView.SetAs<Type>(currentValue);
PostUndoPoint();
PropertyGridRequestBus::Broadcast(&PropertyGridRequests::RefreshPropertyGrid);
}
}
}
};
template<class Type, int ElementCount>
class ScriptCanvasVectorDataInterface
: public ScriptCanvasVectorizedDataInterface<Type, ElementCount>
{
public:
AZ_CLASS_ALLOCATOR(ScriptCanvasVectorDataInterface, AZ::SystemAllocator, 0);
ScriptCanvasVectorDataInterface(const AZ::EntityId& nodeId, const ScriptCanvas::SlotId& slotId)
: ScriptCanvasVectorizedDataInterface<Type, ElementCount>(nodeId, slotId)
{
}
~ScriptCanvasVectorDataInterface() = default;
const char* GetLabel(int index) const override
{
if (index == 0)
{
return "X";
}
else if (index == 1)
{
return "Y";
}
else if (index == 2)
{
return "Z";
}
else if (index == 3)
{
return "W";
}
return "???";
}
AZStd::string GetStyle() const
{
return "vectorized";
}
AZStd::string GetElementStyle(int index) const override
{
return AZStd::string::format("vector_%i", index);
}
};
}