You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
UE-183502 - BP autoconversion adds extraneous conversion nodes (resubmit)
(Resubmit: added check for "multiple self" connections. Even though the types mismatch, we permit these connections.) The previous attempt to add automatic conversion nodes (24029327) had a flawed design: checking pin connections during rewiring might have an incomplete view of the types of the linked pins. For example, suppose we have two native, BlueprintCallable functions. One returns a float, and the other accepts a single float. In a Blueprint, we have the output of one linked to the input of the other. Later, we update both functions to use ints. During rewiring of the function with the return value, it might see that its connection is a float (because that node hasn't been rewired yet). As a result, it'll insert a cast node. Subsequently, when we later rewire the function with the input, it'll see that it's connected to a float, because of the recently inserted cast node. This will add yet another cast node. Since both pin types are the same, there shouldn't be any cast nodes to begin with. The only safe way to insert cast nodes is after node construction has finished. Instead of handling this during rewiring, we can defer the type checking to early validation. Overall, this simplifies the autoconversion since we just need to iterate over pairs of pins, check for type mismatches, and insert cast nodes where appropriate. This change effectively reverts CLs 24174262, 24029327, 24218437, and 25444139, and moves the type checking logic to EarlyValidation. #jira UE-183502 #rb phillip.kavan [CL 25834276 by dave jones2 in ue5-main branch]
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
class AActor;
|
||||
class FArchive;
|
||||
class FBlueprintActionDatabaseRegistrar;
|
||||
class FCompilerResultsLog;
|
||||
class FKismetCompilerContext;
|
||||
class FProperty;
|
||||
class UActorComponent;
|
||||
@@ -223,7 +224,7 @@ public:
|
||||
BLUEPRINTGRAPH_API virtual bool CanSplitPin(const UEdGraphPin* Pin) const override;
|
||||
BLUEPRINTGRAPH_API virtual UEdGraphPin* GetPassThroughPin(const UEdGraphPin* FromPin) const override;
|
||||
BLUEPRINTGRAPH_API virtual bool IsInDevelopmentMode() const override;
|
||||
BLUEPRINTGRAPH_API virtual void ValidateNodeDuringCompilation(class FCompilerResultsLog& MessageLog) const override;
|
||||
BLUEPRINTGRAPH_API virtual void ValidateNodeDuringCompilation(FCompilerResultsLog& MessageLog) const override;
|
||||
BLUEPRINTGRAPH_API virtual FString GetPinMetaData(FName InPinName, FName InKey) override;
|
||||
// End of UEdGraphNode interface
|
||||
|
||||
@@ -372,10 +373,10 @@ public:
|
||||
BLUEPRINTGRAPH_API virtual bool IsConnectionDisallowed(const UEdGraphPin* MyPin, const UEdGraphPin* OtherPin, FString& OutReason) const { return false; }
|
||||
|
||||
/** This function if used for nodes that needs CDO for validation (Called before expansion)*/
|
||||
BLUEPRINTGRAPH_API virtual void EarlyValidation(class FCompilerResultsLog& MessageLog) const;
|
||||
BLUEPRINTGRAPH_API virtual void EarlyValidation(FCompilerResultsLog& MessageLog) const;
|
||||
|
||||
/** This function returns an arbitrary number of attributes that describe this node for analytics events */
|
||||
BLUEPRINTGRAPH_API virtual void GetNodeAttributes( TArray<TKeyValuePair<FString, FString>>& OutNodeAttributes ) const;
|
||||
BLUEPRINTGRAPH_API virtual void GetNodeAttributes(TArray<TKeyValuePair<FString, FString>>& OutNodeAttributes) const;
|
||||
|
||||
/** Called before compilation begins, giving a blueprint time to force the linker to load data */
|
||||
BLUEPRINTGRAPH_API virtual void PreloadRequiredAssets() { }
|
||||
@@ -447,19 +448,14 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
enum ERedirectType : uint8
|
||||
enum ERedirectType
|
||||
{
|
||||
/* The pins do not match */
|
||||
ERedirectType_None = 0,
|
||||
|
||||
ERedirectType_None,
|
||||
/* The pins match by name or redirect and have the same type (or we're ok with the mismatched type) */
|
||||
ERedirectType_Name = (1 << 0),
|
||||
|
||||
ERedirectType_Name,
|
||||
/* The pins match via a redirect and the value needs to also be redirected */
|
||||
ERedirectType_Value = (1 << 1),
|
||||
|
||||
/* The pin types don't match, but can be connected via a cast node */
|
||||
ERedirectType_Type = (1 << 2),
|
||||
ERedirectType_Value
|
||||
};
|
||||
|
||||
// Handles the actual reconstruction (copying data, links, name, etc...) from two pins that have already been matched together
|
||||
@@ -498,7 +494,7 @@ protected:
|
||||
* Should use this for node actions that happen during compilation!
|
||||
*/
|
||||
template<typename... ArgTypes>
|
||||
void Message_Note(const FString& Message, ArgTypes... Args)
|
||||
void Message_Note(const FString& Message, ArgTypes... Args) const
|
||||
{
|
||||
UBlueprint* OwningBP = GetBlueprint();
|
||||
if (OwningBP)
|
||||
@@ -512,7 +508,7 @@ protected:
|
||||
}
|
||||
|
||||
template<typename... ArgTypes>
|
||||
void Message_Warn(const FString& Message, ArgTypes... Args)
|
||||
void Message_Warn(const FString& Message, ArgTypes... Args) const
|
||||
{
|
||||
UBlueprint* OwningBP = GetBlueprint();
|
||||
if (OwningBP)
|
||||
@@ -526,7 +522,7 @@ protected:
|
||||
}
|
||||
|
||||
template<typename... ArgTypes>
|
||||
void Message_Error(const FString& Message, ArgTypes... Args)
|
||||
void Message_Error(const FString& Message, ArgTypes... Args) const
|
||||
{
|
||||
UBlueprint* OwningBP = GetBlueprint();
|
||||
if (OwningBP)
|
||||
@@ -564,7 +560,15 @@ private:
|
||||
* Utility function to write messages about orphan nodes in to the compiler log.
|
||||
* bStore indicates whether to write immediately to the log, or to store as a potential message to be committed once node pruning has completed
|
||||
*/
|
||||
void ValidateOrphanPins(class FCompilerResultsLog& MessageLog, bool bStore) const;
|
||||
void ValidateOrphanPins(FCompilerResultsLog& MessageLog, bool bStore) const;
|
||||
void ValidateOrphanPin(UEdGraphPin* Pin, FCompilerResultsLog& MessageLog, bool bStore) const;
|
||||
|
||||
/**
|
||||
* Checks that pins are type compatible with their links.
|
||||
* If there's a type mismatch (eg: due to a underlying type change), then we'll automatically
|
||||
* insert a conversion node into the graph if one exists between the two types.
|
||||
*/
|
||||
void ValidateLinkedPinTypes(UEdGraphPin* OutputPin, FCompilerResultsLog& MessageLog) const;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ public:
|
||||
// End of UEdGraphNode interface
|
||||
|
||||
// UK2Node interface
|
||||
virtual ERedirectType DoPinsMatchForReconstruction(const UEdGraphPin* NewPin, int32 NewPinIndex, const UEdGraphPin* OldPin, int32 OldPinIndex) const override;
|
||||
virtual void ReallocatePinsDuringReconstruction(TArray<UEdGraphPin*>& OldPins) override;
|
||||
virtual bool IsNodePure() const override { return bIsPureFunc; }
|
||||
virtual void PostReconstructNode() override;
|
||||
|
||||
Reference in New Issue
Block a user