Skip to content

Commit acfe1f5

Browse files
Extending Allow/Deny to include AddOns (#244)
* Flow AddOns Introduced FlowAddOns ~ Major rework of the Flow Editor to support AddOns ~ Also added ExecuteComponent flow node, which allows a component of the owning actor (if it implements a specific interface) to be executed via a proxy node in the Flow Graph. We use this to wrap some legacy systems in flow graph nodes. * Fix Linux compile errors and regressions on UFUNCTIONS * Fix bug with ExecuteInput for AddOns Nodes and AddOns could execute for pins they did not expect, if the AddOns introduced pins that the Node (or other AddOns) were not aware of. Also, removed some deprecation warnings because they were generating compile warnings, which could cause some projects problems with automated builds. I changed the deprecation message to a human-readable message only. * Slight adjustment to IsSupportedInputPinName() early return if the array is empty * AddOns Optimized and changed how Input/Outputs are added from AddOns * Quality of life improvements Revised the ForEachAddOn() signature, since it only ever needs to be used when iterating over all AddOns (recursively), as you can use a normal for loop over AddOns for just the AddOns of this object alone. Also moved some access functions from FlowNode to FlowNodeBase and exposed them to Blueprint, based on a question I saw on the Discord about Get Actor Owner access. * Extracted Component injection code into Flow base also updated ExecuteComponent to use it * Transferring flags from Template component to instance + Transient * Singular InjectComponent signature * Small revisions to Execute Component flownode * Fix uniqueness problem with component lookup * fixed GC-related compilation warning in AddReferencedObjects() * cosmetic pass on AddOns refactor - Adding Category to a few functions which fixes build machine compilation in the plugin mode. - Partially restoring class layout to its original shape, taking in account new sections, and improve it a little bit. - Reversing some changes on making symbols editor-only which might break non-editor tools working with Flow Graph. - Static analysis fixes. * Flow Diff improvements * Added AActor::GetActorClassDefaultComponents() alternative for UE < 5.3 * Folded IFlowNativeExecutableInterface into UFlowNodeBase * Fix compile error * Fix for Undo buffer for SetConfigText * Deleted file * deleted files * Flow Data Pins (initial version) Initial version for Flow Data Pins feature. * Removed Class/Object enum values (until we finish the feature) * Restored commented-out code (and unexpanded the macro) * Reverted last change. need to work on the macros more. * Fixed compilation problem with Enum macro * Fixed details customization for flow data pin input properties * Fixed problem detecting property to pin binding changes. It was only checking the sizes, not doing a deep comparison of the two maps. * Fix problem with data pins incorrectly breaking the wrong pin's connections * Fix erroneous return value where it could find suppliers, but reported that it couldn't * Reworked DataPins to use the authored property name for the lookup map Was using DisplayName, but UE doesn't provide a convenient lookup for the property DisplayName in non-editor builds, making for keeping the property name and the pin name in sync more cumbersome than I'd prefer. Using the Authored name instead allows us to use the GET_MEMBER_PROPERTY_NAME_CHECKED macro to keep the name in sync with the property w/static assert. * Added details customization for named data pin output property * Added InstancedStruct support for Flow Data Pins * Added FlowDataPinPropertyProviderInterface for the AI Flow plugin to use to integrate with data pins. * Status String support for AddOns and ForEachAddOn improvements AddOns can now include line(s) in the StatusString of their node ForEachAddOn functions can break early with 'success' or 'failure' * Added Flow Data Pins support for Rotator, Object, Class * Refined how Data Pins are auto-generated, graph and node updates in the editor * Disallow Reroute nodes for non-exec flow pin connections At least until we develop some data-pin-friendly solution, disabling the reroute node generation for flow data pin wires. * Wire colors match their pin color * Small refinements * Small bugfixes missing header includes calling Super:: Log an Timer support for assets that haven't been resaved with data pins to still source their data correctly. * Code review changes and crash fix crash fix for copy/pasting a flow node with addons. This crash would only happen in this PR (not the current flow mainline version) * Bugfix - Pasting & Drag/Dropping AddOns onto nodes now respects allowed child addon filtering * Updated signature of UFlowNodeAddOn::AcceptFlowNodeAddOnParent() to include additional proposed children This signature now affords the AddOn->Parent question the same information as the Parent->AddOn question gained in the previous change * Fix for BP compile errors for the default array reference for the new AdditionalAddOnsToAssumeAreChildren parameter * Fix crash when pasting nodes with addons into another graph The addons array is not fully-formed when called from some mid-paste functions. * Tag-based Node Display Style conversion hierarchical tag-indexed NodeDisplayStyle. - project extensible node styles - hierarchical node style definitions in INI * UE 5.5 compilation error fixes * Some fixes for Custom NodeDisplayStyle and 5.4 compilation defines * Latest updates post-merge with mainline * removed duplicate line * Restored blank line * Removed stray comment * Bugfix for modifying every flow asset that is opened in the editor. We were unilaterally modifying all flow nodes by reconstructing their nodes when starting editing a flow asset, which is not what we want or need to do. * Extending Allow/Deny to include AddOns - also adding capability to opt back-in to being allowed as a subclass of a denied node --------- Co-authored-by: FoolsTheoryDev <[email protected]>
1 parent d1ce64f commit acfe1f5

File tree

2 files changed

+40
-19
lines changed

2 files changed

+40
-19
lines changed

Source/Flow/Private/FlowAsset.cpp

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ UFlowAsset::UFlowAsset(const FObjectInitializer& ObjectInitializer)
3434
#if WITH_EDITOR
3535
, FlowGraph(nullptr)
3636
#endif
37-
, AllowedNodeClasses({UFlowNode::StaticClass()})
37+
, AllowedNodeClasses({UFlowNodeBase::StaticClass()})
3838
, AllowedInSubgraphNodeClasses({UFlowNode_SubGraph::StaticClass()})
3939
, bStartNodePlacedAsGhostNode(false)
4040
, TemplateAsset(nullptr)
@@ -208,37 +208,55 @@ bool UFlowAsset::CanFlowNodeClassBeUsedByFlowAsset(const UClass& FlowNodeClass)
208208

209209
bool UFlowAsset::CanFlowAssetUseFlowNodeClass(const UClass& FlowNodeClass) const
210210
{
211-
const bool bIsFlowNode = FlowNodeClass.IsChildOf<UFlowNode>();
212-
if (!bIsFlowNode)
211+
// UFlowAsset class can limit which UFlowNodeBase classes can be used
212+
if (IsFlowNodeClassInDeniedClasses(FlowNodeClass))
213213
{
214-
check(FlowNodeClass.IsChildOf<UFlowNodeAddOn>());
215-
216-
// AddOns don't have the AllowedAssetClasses/DeniedAssetClasses
217-
// (yet? maybe we move it up to the base?)
214+
return false;
215+
}
218216

219-
return true;
217+
if (!IsFlowNodeClassInAllowedClasses(FlowNodeClass))
218+
{
219+
return false;
220220
}
221221

222-
// UFlowAsset class can limit which UFlowNode classes can be used
223-
for (const UClass* DeniedNodeClass : DeniedNodeClasses)
222+
return true;
223+
}
224+
225+
bool UFlowAsset::IsFlowNodeClassInDeniedClasses(const UClass& FlowNodeClass) const
226+
{
227+
for (const TSubclassOf<UFlowNodeBase> DeniedNodeClass : DeniedNodeClasses)
224228
{
225229
if (DeniedNodeClass && FlowNodeClass.IsChildOf(DeniedNodeClass))
226230
{
227-
return false;
231+
// Subclasses of a DeniedNodeClass can opt back in to being allowed
232+
if (!IsFlowNodeClassInAllowedClasses(FlowNodeClass, DeniedNodeClass))
233+
{
234+
return true;
235+
}
228236
}
229237
}
230238

231-
if (bIsFlowNode && AllowedNodeClasses.Num() > 0)
239+
return false;
240+
}
241+
242+
bool UFlowAsset::IsFlowNodeClassInAllowedClasses(const UClass& FlowNodeClass, const TSubclassOf<UFlowNodeBase> RequiredAncestor) const
243+
{
244+
if (AllowedNodeClasses.Num() > 0)
232245
{
233246
bool bAllowedInAsset = false;
234-
for (const UClass* AllowedNodeClass : AllowedNodeClasses)
247+
for (const TSubclassOf<UFlowNodeBase> AllowedNodeClass : AllowedNodeClasses)
235248
{
236-
if (AllowedNodeClass && FlowNodeClass.IsChildOf(AllowedNodeClass))
249+
// If a RequiredAncestor is provided, the AllowedNodeClass must be a subclass of the RequiredAncestor
250+
if (AllowedNodeClass &&
251+
FlowNodeClass.IsChildOf(AllowedNodeClass) &&
252+
(!RequiredAncestor || AllowedNodeClass->IsChildOf(RequiredAncestor)))
237253
{
238254
bAllowedInAsset = true;
255+
239256
break;
240257
}
241258
}
259+
242260
if (!bAllowedInAsset)
243261
{
244262
return false;
@@ -1008,7 +1026,7 @@ TArray<UFlowNode*> UFlowAsset::GetNodesInExecutionOrder(UFlowNode* FirstIterated
10081026
}
10091027
}
10101028
FoundNodes.Shrink();
1011-
1029+
10121030
return FoundNodes;
10131031
}
10141032

Source/Flow/Public/FlowAsset.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ class FLOW_API UFlowAsset : public UObject
124124
bool CanFlowNodeClassBeUsedByFlowAsset(const UClass& FlowNodeClass) const;
125125
bool CanFlowAssetUseFlowNodeClass(const UClass& FlowNodeClass) const;
126126
bool CanFlowAssetReferenceFlowNode(const UClass& FlowNodeClass, FText* OutOptionalFailureReason = nullptr) const;
127+
128+
bool IsFlowNodeClassInAllowedClasses(const UClass& FlowNodeClass, const TSubclassOf<UFlowNodeBase> RequiredAncestor = nullptr) const;
129+
bool IsFlowNodeClassInDeniedClasses(const UClass& FlowNodeClass) const;
127130
#endif
128131

129132
// IFlowGraphInterface
@@ -149,11 +152,11 @@ class FLOW_API UFlowAsset : public UObject
149152
// Nodes
150153

151154
protected:
152-
TArray<TSubclassOf<UFlowNode>> AllowedNodeClasses;
153-
TArray<TSubclassOf<UFlowNode>> DeniedNodeClasses;
155+
TArray<TSubclassOf<UFlowNodeBase>> AllowedNodeClasses;
156+
TArray<TSubclassOf<UFlowNodeBase>> DeniedNodeClasses;
154157

155-
TArray<TSubclassOf<UFlowNode>> AllowedInSubgraphNodeClasses;
156-
TArray<TSubclassOf<UFlowNode>> DeniedInSubgraphNodeClasses;
158+
TArray<TSubclassOf<UFlowNodeBase>> AllowedInSubgraphNodeClasses;
159+
TArray<TSubclassOf<UFlowNodeBase>> DeniedInSubgraphNodeClasses;
157160

158161
bool bStartNodePlacedAsGhostNode;
159162

0 commit comments

Comments
 (0)