2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
2014-05-29 16:42:22 -04:00
|
|
|
#include "K2Node_StructMemberSet.h"
|
2014-09-02 19:08:09 -04:00
|
|
|
#include "EdGraph/EdGraphNodeUtils.h" // for FNodeTextCache
|
2014-03-14 14:13:41 -04:00
|
|
|
#include "K2Node_MakeStruct.generated.h"
|
|
|
|
|
|
|
|
|
|
// Pure kismet node that creates a struct with specified values for each member
|
|
|
|
|
UCLASS(MinimalAPI)
|
|
|
|
|
class UK2Node_MakeStruct : public UK2Node_StructMemberSet
|
|
|
|
|
{
|
2015-03-17 06:17:32 -04:00
|
|
|
GENERATED_UCLASS_BODY()
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2015-04-16 14:02:15 -04:00
|
|
|
/**
|
|
|
|
|
* Returns false if:
|
|
|
|
|
* 1. The Struct has a 'native make' method
|
|
|
|
|
* Returns true if:
|
|
|
|
|
* 1. The Struct is tagged as BlueprintType
|
|
|
|
|
* or
|
|
|
|
|
* 2. The Struct has any property that is tagged as CPF_BlueprintVisible and is not CPF_BlueprintReadOnly
|
|
|
|
|
* or
|
|
|
|
|
* 3. The Struct has any property that is tagged as CPF_Edit and is not CPF_BlueprintReadOnly and bIncludeEditAnywhere is true
|
|
|
|
|
*
|
|
|
|
|
* When constructing the context menu we do not allow the presence of the EditAnywhere flag to result in
|
|
|
|
|
* a creation of a break node, although we could do so in the future. There are legacy break nodes that
|
|
|
|
|
* rely on expansion of structs that neither have BlueprintVisible properties nor are tagged as BlueprintType
|
|
|
|
|
*/
|
2015-06-24 11:23:23 -04:00
|
|
|
BLUEPRINTGRAPH_API static bool CanBeMade(const UScriptStruct* Struct, bool bIncludeEditAnywhere = true, bool bMustHaveValidProperties = false);
|
2015-04-16 14:02:15 -04:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
// Begin UEdGraphNode interface
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void AllocateDefaultPins() override;
|
|
|
|
|
virtual FText GetNodeTitle(ENodeTitleType::Type TitleType) const override;
|
|
|
|
|
virtual FLinearColor GetNodeTitleColor() const override;
|
2014-09-03 18:14:09 -04:00
|
|
|
virtual FText GetTooltipText() const override;
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void ValidateNodeDuringCompilation(class FCompilerResultsLog& MessageLog) const override;
|
|
|
|
|
virtual FName GetPaletteIcon(FLinearColor& OutColor) const override{ return TEXT("GraphEditor.MakeStruct_16x"); }
|
2014-03-14 14:13:41 -04:00
|
|
|
// End UEdGraphNode interface
|
|
|
|
|
|
|
|
|
|
// Begin K2Node interface
|
2014-12-03 08:46:46 -05:00
|
|
|
virtual bool NodeCausesStructuralBlueprintChange() const override { return false; }
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual bool IsNodePure() const override { return true; }
|
|
|
|
|
virtual bool DrawNodeAsVariable() const override { return false; }
|
|
|
|
|
virtual class FNodeHandlingFunctor* CreateNodeHandler(class FKismetCompilerContext& CompilerContext) const override;
|
|
|
|
|
virtual ERedirectType DoPinsMatchForReconstruction(const UEdGraphPin* NewPin, int32 NewPinIndex, const UEdGraphPin* OldPin, int32 OldPinIndex) const override;
|
2014-08-23 20:16:29 -04:00
|
|
|
virtual void GetMenuActions(FBlueprintActionDatabaseRegistrar& ActionRegistrar) const override;
|
2014-07-14 12:39:28 -04:00
|
|
|
virtual FText GetMenuCategory() const override;
|
2014-03-14 14:13:41 -04:00
|
|
|
// End K2Node interface
|
2014-04-23 20:18:55 -04:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
struct FMakeStructPinManager : public FStructOperationOptionalPinManager
|
|
|
|
|
{
|
|
|
|
|
const uint8* const SampleStructMemory;
|
|
|
|
|
public:
|
|
|
|
|
FMakeStructPinManager(const uint8* InSampleStructMemory);
|
|
|
|
|
protected:
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void CustomizePinData(UEdGraphPin* Pin, FName SourcePropertyName, int32 ArrayIndex, UProperty* Property) const override;
|
|
|
|
|
virtual bool CanTreatPropertyAsOptional(UProperty* TestProperty) const override;
|
2014-04-23 20:18:55 -04:00
|
|
|
};
|
2014-09-02 19:08:09 -04:00
|
|
|
|
|
|
|
|
private:
|
2014-09-03 18:17:44 -04:00
|
|
|
/** Constructing FText strings can be costly, so we cache the node's title/tooltip */
|
|
|
|
|
FNodeTextCache CachedTooltip;
|
2014-09-02 19:08:09 -04:00
|
|
|
FNodeTextCache CachedNodeTitle;
|
2014-03-14 14:13:41 -04:00
|
|
|
};
|