Files
UnrealEngineUWP/Engine/Source/Editor/AnimGraph/Public/AnimationTransitionSchema.h
phillip kavan 7ef9563646 Don't allow composite nodes to be pasted into Blueprint graphs that aren't schema-compatible.
Change summary:
- Added UEdGraphSchema_K2::DoesSupportCollapsedNodes() as an overridable API for K2-based schema types. Also added overrides for derived schemas that do not currently support collapsed subgraphs as a feature (e.g. AnimBPs).
- Added a UK2Node_Composite::CanCreateUnderSpecifiedSchema() override. This will be called when determining node types that can be created from clipboard content (see FGraphObjectTextFactory in EdGraphUtilities.cpp).
- Modified UK2Node_Composite::PostPasteNode() to exclude nodes that are not schema-compatible from the pasted subgraph. Also updated to reassign the subgraph schema to match the target graph.
- Modified FEdGraphUtilities::MergeChildrenGraphsIn() to emit an error to the message log when a subgraph cannot be merged into a parent graph due to schema incompatibility. This also adds an appropriate error context to the source node(s).
- Modified FKismetCompilerContext::ProcessOneFunctionGraph() to early exit if we fail to merge subgraphs while processing the intermediate function graph. This prevents us from attempting to further compile an intermediate graph that's in an invalid state, which previously would lead to an ensure() and later fail due to a non-specific compile error.

#jira UE-157885
#rb Dan.OConnor, Thomas.Sarkanen
#preflight 6331e2fd10030508069622f2

[CL 22205520 by phillip kavan in ue5-main branch]
2022-09-27 10:17:29 -04:00

39 lines
1.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "EdGraphSchema_K2.h"
#include "AnimationTransitionSchema.generated.h"
class UAnimStateNode;
class UAnimStateTransitionNode;
struct FAnimBlueprintDebugData;
// This class is the schema for transition rule graphs in animation state machines
UCLASS(MinimalAPI)
class UAnimationTransitionSchema : public UEdGraphSchema_K2
{
GENERATED_UCLASS_BODY()
//~ Begin UEdGraphSchema Interface.
virtual void CreateDefaultNodesForGraph(UEdGraph& Graph) const override;
virtual bool CanDuplicateGraph(UEdGraph* InSourceGraph) const override { return false; }
virtual void GetGraphDisplayInformation(const UEdGraph& Graph, /*out*/ FGraphDisplayInfo& DisplayInfo) const override;
virtual bool ShouldAlwaysPurgeOnModification() const override { return true; }
virtual void HandleGraphBeingDeleted(UEdGraph& GraphBeingRemoved) const override;
//~ End UEdGraphSchema Interface.
//~ Begin UEdGraphSchema_K2 Interface.
virtual bool DoesSupportCollapsedNodes() const override { return false; }
virtual bool DoesSupportEventDispatcher() const override { return false; }
//~ End UEdGraphSchema_K2 Interface.
private:
static UAnimStateTransitionNode* GetTransitionNodeFromGraph(const FAnimBlueprintDebugData& DebugData, const UEdGraph* Graph);
static UAnimStateNode* GetStateNodeFromGraph(const FAnimBlueprintDebugData& DebugData, const UEdGraph* Graph);
};