fix dangling component variables on cleared script, fix EntityIDNode reflection
Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
@@ -30,6 +30,7 @@ namespace ScriptCanvasBuilder
|
|||||||
{
|
{
|
||||||
m_source.Reset();
|
m_source.Reset();
|
||||||
m_variables.clear();
|
m_variables.clear();
|
||||||
|
m_overrides.clear();
|
||||||
m_entityIds.clear();
|
m_entityIds.clear();
|
||||||
m_dependencies.clear();
|
m_dependencies.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -474,6 +474,8 @@ namespace ScriptCanvasEditor
|
|||||||
OnScriptCanvasAssetReady(memoryAsset);
|
OnScriptCanvasAssetReady(memoryAsset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AzToolsFramework::ToolsApplicationNotificationBus::Broadcast(&AzToolsFramework::ToolsApplicationEvents::InvalidatePropertyDisplay, AzToolsFramework::Refresh_EntireTree_NewContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorScriptCanvasComponent::OnStartPlayInEditor()
|
void EditorScriptCanvasComponent::OnStartPlayInEditor()
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ namespace ScriptCanvas
|
|||||||
|
|
||||||
// The DataElementNode is being copied purposefully in this statement to clone the data
|
// The DataElementNode is being copied purposefully in this statement to clone the data
|
||||||
AZ::SerializeContext::DataElementNode baseNodeElement = rootNodeElement.GetSubElement(nodeElementIndex);
|
AZ::SerializeContext::DataElementNode baseNodeElement = rootNodeElement.GetSubElement(nodeElementIndex);
|
||||||
if (!rootNodeElement.Convert(context, azrtti_typeid<EntityIDNodes::IsValidNode>()))
|
if (!rootNodeElement.Convert(context, azrtti_typeid<EntityNodes::IsValidNode>()))
|
||||||
{
|
{
|
||||||
AZ_Error("Script Canvas", false, "Unable to convert old Entity::IsValid function node(%s) to new EntityId::IsValid function node(%s)",
|
AZ_Error("Script Canvas", false, "Unable to convert old Entity::IsValid function node(%s) to new EntityId::IsValid function node(%s)",
|
||||||
rootNodeElement.GetId().ToString<AZStd::string>().data(), azrtti_typeid<EntityIDNodes::IsValidNode>().ToString<AZStd::string>().data());
|
rootNodeElement.GetId().ToString<AZStd::string>().data(), azrtti_typeid<EntityNodes::IsValidNode>().ToString<AZStd::string>().data());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,14 +79,12 @@ namespace ScriptCanvas
|
|||||||
|
|
||||||
void Entity::InitNodeRegistry(NodeRegistry& nodeRegistry)
|
void Entity::InitNodeRegistry(NodeRegistry& nodeRegistry)
|
||||||
{
|
{
|
||||||
EntityIDNodes::Registrar::AddToRegistry<Entity>(nodeRegistry);
|
|
||||||
EntityNodes::Registrar::AddToRegistry<Entity>(nodeRegistry);
|
EntityNodes::Registrar::AddToRegistry<Entity>(nodeRegistry);
|
||||||
}
|
}
|
||||||
|
|
||||||
AZStd::vector<AZ::ComponentDescriptor*> Entity::GetComponentDescriptors()
|
AZStd::vector<AZ::ComponentDescriptor*> Entity::GetComponentDescriptors()
|
||||||
{
|
{
|
||||||
AZStd::vector<AZ::ComponentDescriptor*> descriptors;
|
AZStd::vector<AZ::ComponentDescriptor*> descriptors;
|
||||||
EntityIDNodes::Registrar::AddDescriptors(descriptors);
|
|
||||||
EntityNodes::Registrar::AddDescriptors(descriptors);
|
EntityNodes::Registrar::AddDescriptors(descriptors);
|
||||||
return descriptors;
|
return descriptors;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,5 +12,4 @@
|
|||||||
// shared code
|
// shared code
|
||||||
|
|
||||||
#include "RotateMethod.h"
|
#include "RotateMethod.h"
|
||||||
#include "EntityIDNodes.h"
|
|
||||||
#include "EntityNodes.h"
|
#include "EntityNodes.h"
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
|
||||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <ScriptCanvas/Core/NodeFunctionGeneric.h>
|
|
||||||
#include <AzCore/Component/Entity.h>
|
|
||||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
|
||||||
|
|
||||||
namespace ScriptCanvas
|
|
||||||
{
|
|
||||||
namespace EntityIDNodes
|
|
||||||
{
|
|
||||||
using namespace Data;
|
|
||||||
static const char* k_categoryName = "Entity/Entity";
|
|
||||||
|
|
||||||
AZ_INLINE BooleanType IsValid(const EntityIDType& source)
|
|
||||||
{
|
|
||||||
return source.IsValid();
|
|
||||||
}
|
|
||||||
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(IsValid, k_categoryName, "{0ED8A583-A397-4657-98B1-433673323F21}", "returns true if Source is valid, else false", "Source");
|
|
||||||
|
|
||||||
AZ_INLINE StringType ToString(const EntityIDType& source)
|
|
||||||
{
|
|
||||||
return source.ToString();
|
|
||||||
}
|
|
||||||
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(ToString, k_categoryName, "{B094DCAE-15D5-42A3-8D8C-5BD68FE6E356}", "returns a string representation of Source", "Source");
|
|
||||||
|
|
||||||
AZ_INLINE BooleanType IsActive(const EntityIDType& entityId)
|
|
||||||
{
|
|
||||||
AZ::Entity* entity = nullptr;
|
|
||||||
AZ::ComponentApplicationBus::BroadcastResult(entity, &AZ::ComponentApplicationRequests::FindEntity, entityId);
|
|
||||||
return (entity && entity->GetState() == AZ::Entity::State::Active);
|
|
||||||
}
|
|
||||||
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(IsActive, k_categoryName, "{DF5240FD-6510-4C24-8382-9515C4B0C7B4}", "returns true if entity with the provided Id is valid and active.", "Entity Id");
|
|
||||||
|
|
||||||
using Registrar = RegistrarGeneric<
|
|
||||||
IsValidNode,
|
|
||||||
ToStringNode,
|
|
||||||
IsActiveNode
|
|
||||||
>;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ namespace ScriptCanvas
|
|||||||
namespace EntityNodes
|
namespace EntityNodes
|
||||||
{
|
{
|
||||||
using namespace Data;
|
using namespace Data;
|
||||||
static const char* k_categoryName = "Entity/Transform";
|
static const char* k_categoryName = "Entity/Entity";
|
||||||
|
|
||||||
template<int t_Index>
|
template<int t_Index>
|
||||||
AZ_INLINE void DefaultScale(Node& node) { SetDefaultValuesByIndex<t_Index>::_(node, Data::One()); }
|
AZ_INLINE void DefaultScale(Node& node) { SetDefaultValuesByIndex<t_Index>::_(node, Data::One()); }
|
||||||
@@ -59,10 +59,33 @@ namespace ScriptCanvas
|
|||||||
}
|
}
|
||||||
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(GetEntityUp, DefaultScale<1>, k_categoryName, "{96B86F3F-F022-4611-9AEA-175EA952C562}", "returns the up direction vector from the specified entity's world transform, scaled by a given value (Lumberyard uses Z up, right handed)", "EntityId", "Scale");
|
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(GetEntityUp, DefaultScale<1>, k_categoryName, "{96B86F3F-F022-4611-9AEA-175EA952C562}", "returns the up direction vector from the specified entity's world transform, scaled by a given value (Lumberyard uses Z up, right handed)", "EntityId", "Scale");
|
||||||
|
|
||||||
|
AZ_INLINE BooleanType IsActive(const EntityIDType& entityId)
|
||||||
|
{
|
||||||
|
AZ::Entity* entity = nullptr;
|
||||||
|
AZ::ComponentApplicationBus::BroadcastResult(entity, &AZ::ComponentApplicationRequests::FindEntity, entityId);
|
||||||
|
return (entity && entity->GetState() == AZ::Entity::State::Active);
|
||||||
|
}
|
||||||
|
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(IsActive, k_categoryName, "{DF5240FD-6510-4C24-8382-9515C4B0C7B4}", "returns true if entity with the provided Id is valid and active.", "Entity Id");
|
||||||
|
|
||||||
|
AZ_INLINE BooleanType IsValid(const EntityIDType& source)
|
||||||
|
{
|
||||||
|
return source.IsValid();
|
||||||
|
}
|
||||||
|
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(IsValid, k_categoryName, "{0ED8A583-A397-4657-98B1-433673323F21}", "returns true if Source is valid, else false", "Source");
|
||||||
|
|
||||||
|
AZ_INLINE StringType ToString(const EntityIDType& source)
|
||||||
|
{
|
||||||
|
return source.ToString();
|
||||||
|
}
|
||||||
|
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(ToString, k_categoryName, "{B094DCAE-15D5-42A3-8D8C-5BD68FE6E356}", "returns a string representation of Source", "Source");
|
||||||
|
|
||||||
using Registrar = RegistrarGeneric<
|
using Registrar = RegistrarGeneric<
|
||||||
GetEntityRightNode,
|
GetEntityRightNode,
|
||||||
GetEntityForwardNode,
|
GetEntityForwardNode,
|
||||||
GetEntityUpNode
|
GetEntityUpNode,
|
||||||
|
IsActiveNode,
|
||||||
|
IsValidNode,
|
||||||
|
ToStringNode
|
||||||
>;
|
>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -297,7 +297,6 @@ set(FILES
|
|||||||
Include/ScriptCanvas/Libraries/Core/UnaryOperator.h
|
Include/ScriptCanvas/Libraries/Core/UnaryOperator.h
|
||||||
Include/ScriptCanvas/Libraries/Entity/Entity.cpp
|
Include/ScriptCanvas/Libraries/Entity/Entity.cpp
|
||||||
Include/ScriptCanvas/Libraries/Entity/Entity.h
|
Include/ScriptCanvas/Libraries/Entity/Entity.h
|
||||||
Include/ScriptCanvas/Libraries/Entity/EntityIDNodes.h
|
|
||||||
Include/ScriptCanvas/Libraries/Entity/EntityNodes.h
|
Include/ScriptCanvas/Libraries/Entity/EntityNodes.h
|
||||||
Include/ScriptCanvas/Libraries/Entity/RotateMethod.cpp
|
Include/ScriptCanvas/Libraries/Entity/RotateMethod.cpp
|
||||||
Include/ScriptCanvas/Libraries/Entity/RotateMethod.h
|
Include/ScriptCanvas/Libraries/Entity/RotateMethod.h
|
||||||
|
|||||||
Reference in New Issue
Block a user