MassBattle Docsv1.19.20

UK2Node_GetMassFragment

UCLASS

Source/MassAPIUncooked/Public/OperationFragment/K2Node_GetMassFragment.h

概述 Overview

从实体或实体模板读取 fragment 的纯蓝图节点。核心交互:FragmentType 类型选择引脚(由 FMassAPIPinFactory 挂载 SGraphPinMassFragmentType 下拉,带 FMassFragmentStructFilter 过滤)决定读取哪种 fragment,DataSource 连接决定实体/模板模式。支持两种输出模式(详情面板 bGetMember 开关):标准模式输出整个 fragment 引用(OutFragment,值连接可触发类型反推);成员模式隐藏 OutFragment,改为按 StructMemberReference(递归成员路径,支持多选)生成多个成员输出引脚(按内存偏移排序,引脚名用下划线替代路径中的点号)。编译时经 HNCH 展开为 UMassAPIFuncLib::GetFragment_Entity_Unified / GetFragment_Template_Unified,成员模式再串联 UK2Node_GetStructRecursiveMember 拆分节点。详情面板另提供 "Show World Context Pin" 开关(bShowWorldContext,默认关闭),勾选后节点出现可选的 WorldContext 透传输入引脚。

Pure blueprint node that reads a fragment from an entity or entity template. Core interaction: the FragmentType type-selector pin (handled by FMassAPIPinFactory with the SGraphPinMassFragmentType dropdown filtered by FMassFragmentStructFilter) chooses which fragment to read, and the DataSource connection decides entity/template mode. Two output modes (details-panel bGetMember toggle): standard mode outputs the whole fragment reference (OutFragment; linking to it can back-fill the type); member mode hides OutFragment and instead generates one output pin per selected recursive member path in StructMemberReference (multi-select supported; pins ordered by memory offset, pin names replace dots with underscores). At compile time an HNCH handler expands the node into UMassAPIFuncLib::GetFragment_Entity_Unified / GetFragment_Template_Unified, chaining a UK2Node_GetStructRecursiveMember split node in member mode. The details panel also offers a "Show World Context Pin" toggle (bShowWorldContext, off by default); checking it reveals an optional WorldContext pass-through input pin on the node.

继承 Inheritance

UK2Node → UK2Node_GetMassFragment

公开方法 Public Methods

IsNodePure virtual bool

返回 true:纯节点,无执行流引脚。

Returns true: pure node, no exec pins.

Input

无参数。

No parameters.

Output

恒返回 true。

Always returns true.

ShouldShowNodeProperties virtual bool

返回 true:在 Details 面板显示节点属性(bGetMember 开关、成员引用与 "Show World Context Pin" 开关)。

Returns true: node properties are shown in the Details panel (the bGetMember toggle, member reference and the "Show World Context Pin" toggle).

Input

无参数。

No parameters.

Output

恒返回 true。

Always returns true.

GetNodeTitle virtual FText

按 CachedDataSourceType 返回标题:None → "GetMassFragment",EntityHandle → "GetMassFragment-Entity",EntityTemplateData → "GetMassFragment-Template"。

Returns the title from CachedDataSourceType: None → "GetMassFragment", EntityHandle → "GetMassFragment-Entity", EntityTemplateData → "GetMassFragment-Template".

Input
参数 Param类型 Type说明 Description
TitleTypeENodeTitleType::Type标题类型(本实现忽略)。Title type (ignored by this implementation).
Output

返回映射后的标题文本;未知类型返回空字符串。

Returns the mapped title text; unknown types yield an empty string.

GetMenuCategory virtual FText

右键菜单分类路径:常量 "MassAPI|Composition"。

Right-click menu category: the constant "MassAPI|Composition".

Input

无参数。

No parameters.

Output

返回 "MassAPI|Composition"。

Returns "MassAPI|Composition".

GetTooltipText virtual FText

Tooltip 文案:常量 "Get members from a fragment."。

Tooltip text: the constant "Get members from a fragment.".

Input

无参数。

No parameters.

Output

返回上述 Tooltip 文本。无副作用。

Returns the tooltip text above. No side effects.

GetIconAndTint virtual FSlateIcon

返回结构体拆分图标(GraphEditor.BreakStruct_16x),并把 OutColor 写为绿色 (0.0, 1.0, 0.0)——"读取"语义色。

Returns the break-struct icon (GraphEditor.BreakStruct_16x) and writes OutColor as green (0.0, 1.0, 0.0) — the "read" semantic color.

Input
参数 Param类型 Type说明 Description
OutColorFLinearColor&输出参数,写入节点图标色调。Out parameter; receives the node icon tint.
Output

返回 FSlateIcon;副作用:覆写 OutColor。

Returns an FSlateIcon; side effect: overwrites OutColor.

GetNodeTitleColor virtual FLinearColor

节点标题颜色:None 模式为黑色(未连接),EntityHandle / EntityTemplateData 模式为绿色 (0.0, 1.0, 0.0)。

Node title color: black for None (unconnected), green (0.0, 1.0, 0.0) for EntityHandle / EntityTemplateData modes.

Input

无参数。

No parameters.

Output

返回对应的颜色值。

Returns the corresponding color.

AllocateDefaultPins virtual void

纯节点:输入 DataSource(Wildcard 引用类型)与 FragmentType(UScriptStruct 类型选择,PSC_Self 子类别);输出按 bGetMember 分支——标准模式创建 OutFragment(Wildcard 引用类型),成员模式不创建 OutFragment,随后由 OnMemberReferenceChanged 生成成员输出引脚。勾选 bShowWorldContext 时额外创建可选的 WorldContext 输入引脚(MassAPIWorldContext::CreateOn,UObject,默认值 self;纯节点无 exec 引脚,置于输入侧顶部)。最后初始化 UpdateDataSourceType。

Pure node: inputs DataSource (wildcard by-reference) and FragmentType (UScriptStruct type selector, PSC_Self subcategory); the output branches on bGetMember — standard mode creates OutFragment (wildcard by-reference), member mode creates none and OnMemberReferenceChanged later generates the member output pins. When bShowWorldContext is checked, an optional WorldContext input pin is additionally created (MassAPIWorldContext::CreateOn, UObject, default value self; placed at the top of the input side since a pure node has no exec pin). Finally initializes UpdateDataSourceType.

Input

无参数。

No parameters.

Output

无返回值。副作用:创建引脚并写入 CachedDataSourceType;成员模式还写入 StructMemberReference.StructType。

No return value. Side effect: creates pins and fills CachedDataSourceType; in member mode also writes StructMemberReference.StructType.

ReallocatePinsDuringReconstruction virtual void

蓝图节点重建时恢复引脚状态:① 恢复 DataSource 引脚类型并保持引用标志;② 更新缓存类型;③ 从旧引脚恢复 fragment 类型——优先取 OutFragment 引脚上的结构体类型(split 场景下更可靠),回退到 FragmentType 引脚,写回新 FragmentType 引脚 DefaultObject。

Restores pin state during blueprint node reconstruction: ① restores the DataSource pin type keeping the reference flag; ② updates the cached type; ③ recovers the fragment type from old pins — preferring the struct type on the OutFragment pin (more reliable when split), falling back to the FragmentType pin, and writes it back to the new FragmentType pin's DefaultObject.

Input
参数 Param类型 Type说明 Description
OldPinsTArray<UEdGraphPin*>&重建前的旧引脚列表。The old pin list before reconstruction.
Output

无返回值。副作用:修改引脚类型与 DefaultObject。

No return value. Side effect: mutates pin types and DefaultObject.

PostReconstructNode virtual void

调用父类后刷新 UpdateDataSourceType 与 OnFragmentTypeChanged。

Calls the parent then refreshes UpdateDataSourceType and OnFragmentTypeChanged.

Input

无参数。

No parameters.

Output

无返回值。副作用:更新缓存类型与输出引脚。

No return value. Side effect: updates the cached type and output pins.

PinDefaultValueChanged virtual void

FragmentType 引脚值变化时调用 OnFragmentTypeChanged 重建输出引脚类型。

Calls OnFragmentTypeChanged to rebuild output pin types when the FragmentType pin value changes.

Input
参数 Param类型 Type说明 Description
PinUEdGraphPin*值发生变化的引脚。The pin whose value changed.
Output

无返回值。副作用:可能重建输出引脚。

No return value. Side effect: may rebuild output pins.

IsConnectionDisallowed virtual bool

三类限制:DataSource 只允许 FEntityHandle / FEntityTemplateData;FragmentType 只允许 4 种合法 fragment 类型;OutFragment 在 FragmentType 为 None 时只允许连接 4 种 fragment 类型(拒绝 Wildcard)。均返回 true + OutReason 文案。

Three restriction groups: DataSource accepts only FEntityHandle / FEntityTemplateData; FragmentType accepts only the four valid fragment kinds; OutFragment accepts only the four fragment kinds when FragmentType is None (wildcard rejected). Each returns true with an OutReason message.

Input
参数 Param类型 Type说明 Description
MyPinconst UEdGraphPin*本节点的引脚。This node's pin.
OtherPinconst UEdGraphPin*对方引脚。The other pin.
OutReasonFString&输出参数:拒绝连接时的原因文案。Out parameter: rejection reason text.
Output

返回 true = 禁止连接(并写入 OutReason);否则委托父类判断。

Returns true = connection disallowed (and fills OutReason); otherwise delegates to the parent.

NotifyPinConnectionListChanged virtual void

三个引脚各自处理:DataSource 连接变化 → 同步类型(保持引用)/恢复 Wildcard + 更新缓存;FragmentType 断开连接 → OnFragmentTypeChanged;OutFragment 连接变化 → FragmentType 为 None 时从连接方反推类型并同步到 FragmentType 引脚(触发 PinDefaultValueChanged),否则同步 OutFragment 类型;断开时若类型未定则恢复 Wildcard。

Three pins are handled separately: DataSource connection changes sync the type (keeping reference) / revert to wildcard and update the cache; FragmentType disconnect triggers OnFragmentTypeChanged; OutFragment connection changes back-fill the type from the linked pin into FragmentType when it is None (triggering PinDefaultValueChanged), otherwise sync OutFragment's type; on disconnect it reverts to wildcard when the type is unresolved.

Input
参数 Param类型 Type说明 Description
PinUEdGraphPin*连接列表发生变化的引脚。The pin whose connection list changed.
Output

无返回值。副作用:改写引脚类型、DefaultObject 与缓存。

No return value. Side effect: mutates pin types, DefaultObject and the cache.

UpdateDataSourceType void

从 DataSource 引脚的结构体类型推断 CachedDataSourceType。本节点只有实体/模板两种有效模式。

Infers CachedDataSourceType from the DataSource pin's struct type. Only the entity/template modes are valid for this node.

Input

无参数(读取成员引脚)。

No parameters (reads the member pins).

Output

无返回值。副作用:写入 CachedDataSourceType。

No return value. Side effect: writes CachedDataSourceType.

GetFragmentStruct UScriptStruct*

读取 FragmentType 引脚的 DefaultObject 并转成 UScriptStruct;引脚未连接或未设置时返回 nullptr。

Reads the FragmentType pin's DefaultObject as a UScriptStruct; returns nullptr when the pin is unlinked or unset.

Input

无参数。

No parameters.

Output

返回选中的 fragment 结构体指针;未设置返回 nullptr。

Returns the selected fragment struct, or nullptr when unset.

GetFragmentStructFromOldPins UScriptStruct*

重建辅助:从旧引脚列表中找 FragmentType 引脚并读取其 DefaultObject;未找到或未设置返回 nullptr。

Reconstruction helper: finds the FragmentType pin in the old pin list and reads its DefaultObject; returns nullptr when absent or unset.

Input
参数 Param类型 Type说明 Description
OldPinsconst TArray<UEdGraphPin*>&旧引脚列表。The old pin list.
Output

返回旧 FragmentType 选中的结构体;无则 nullptr。

Returns the old FragmentType selection, or nullptr.

OnFragmentTypeChanged virtual void

fragment 类型变化回调,分两分支:成员模式(bGetMember)——同步 StructMemberReference.StructType、按新结构体验证并裁剪失效的 MemberPaths(结构体为 None 时清空)、调用 OnMemberReferenceChanged 重建成员引脚、隐藏 OutFragment;标准模式——FragmentType 为 None 时断开/隐藏 OutFragment 并恢复 Wildcard,否则显示并更新 OutFragment 类型(用户已 split 的引脚保持隐藏;连接类型不一致时才断开)。变化后通知图表并标记蓝图结构修改。

Fragment-type change callback with two branches: member mode (bGetMember) — syncs StructMemberReference.StructType, validates and prunes invalid MemberPaths against the new struct (clears them when the struct is None), calls OnMemberReferenceChanged to rebuild member pins, and hides OutFragment; standard mode — with FragmentType None, breaks/hides OutFragment and reverts it to wildcard; otherwise shows it and updates its type (user-split pins stay hidden; links break only on type mismatch). On change, notifies the graph and marks the blueprint structurally modified.

Input

无参数。

No parameters.

Output

无返回值。副作用:改写 StructMemberReference、增删/隐藏/改类型输出引脚。

No return value. Side effect: mutates StructMemberReference, adds/removes/hides/retargets output pins.

IsValidFragmentStruct virtual bool

校验结构体是否为 4 种允许的 Mass fragment 类型之一:FMassFragment / FMassChunkFragment / FMassSharedFragment / FMassConstSharedFragment 的子类;空指针返回 false。

Validates that the struct is one of the four allowed Mass fragment kinds — a child of FMassFragment / FMassChunkFragment / FMassSharedFragment / FMassConstSharedFragment; false for null.

Input
参数 Param类型 Type说明 Description
Structconst UScriptStruct*待校验的结构体。The struct to validate.
Output

4 种 fragment 之一返回 true,否则 false。

true for one of the four fragment kinds, otherwise false.

OnMemberReferenceChanged virtual void

成员模式专用:非成员模式直接返回。流程:① 同步 StructMemberReference.StructType 到当前 fragment;② 保存现有输出引脚的连接;③ 移除全部输出引脚;④ 若成员引用有效且有 fragment,按 StructMemberHelper::GetMemberOffsetIndices 偏移深度优先排序 MemberPaths,逐路径用 ConvertPropertyToPinType 创建输出引脚(值类型,PinFriendlyName = 成员路径,引脚名 = OutputPinName 转换),并恢复旧连接;⑤ 通知图表刷新并标记蓝图结构修改。

Member-mode only; returns immediately otherwise. Flow: ① syncs StructMemberReference.StructType to the current fragment; ② saves existing output-pin connections; ③ removes all output pins; ④ when the member reference is valid and a fragment exists, sorts MemberPaths depth-first by StructMemberHelper::GetMemberOffsetIndices offsets and creates one output pin per path via ConvertPropertyToPinType (by value, PinFriendlyName = member path, pin name from OutputPinName), restoring old connections; ⑤ notifies the graph and marks the blueprint structurally modified.

Input

无参数。

No parameters.

Output

无返回值。副作用:重建全部输出引脚并恢复连接。

No return value. Side effect: rebuilds all output pins and restores connections.

OutputPinName static FName

把成员路径转成引脚名:路径中的点号(.)替换为下划线(_),避免引脚名称冲突。

Converts a member path into a pin name: dots (.) in the path are replaced with underscores (_) to avoid pin-name collisions.

Input
参数 Param类型 Type说明 Description
MemberPathconst FString&递归成员路径,如 "A.B.C"。Recursive member path, e.g. "A.B.C".
Output

返回替换后的引脚名(如 "A_B_C")。

Returns the converted pin name (e.g. "A_B_C").

PostEditChangeProperty virtual void

详情面板属性编辑回调:bGetMember 变化 → ReconstructNode 重建节点;StructMemberReference(或其子属性)变化 → 立即调用 OnMemberReferenceChanged 更新成员引脚;bShowWorldContext 变化 → 按新值外科手术式增删 WorldContext 引脚(MassAPIWorldContext::SyncPinOn:勾选创建、取消勾选断开连接并移除,不走整节点重建)并通知图表刷新。

Details-panel property edit callback: a change to bGetMember triggers ReconstructNode; a change to StructMemberReference (or a sub-property) immediately calls OnMemberReferenceChanged to update member pins; a change to bShowWorldContext surgically adds/removes the WorldContext pin to match (MassAPIWorldContext::SyncPinOn: create on check, break links and remove on uncheck — no full node reconstruction) and notifies the graph.

Input
参数 Param类型 Type说明 Description
PropertyChangedEventFPropertyChangedEvent&属性变化事件。The property change event.
Output

无返回值。副作用:可能重建节点或成员引脚;可能增删 WorldContext 引脚并触发图表刷新。

No return value. Side effect: may reconstruct the node or rebuild member pins; may add/remove the WorldContext pin and trigger a graph refresh.

GetMenuActions virtual void

向蓝图右键菜单注册本类节点:当 ActionRegistrar 允许时创建 UBlueprintNodeSpawner 并注册到 MassAPI|Composition 分类。

Registers this node class to the blueprint right-click menu: when the registrar is open for this class, creates a UBlueprintNodeSpawner and registers it under MassAPI|Composition.

Input
参数 Param类型 Type说明 Description
ActionRegistrarFBlueprintActionDatabaseRegistrar&蓝图动作注册器。Blueprint action registrar.
Output

无返回值。副作用:注册节点 spawner 到动作数据库。

No return value. Side effect: registers a node spawner into the action database.

ExpandNode virtual void

经 HNCH 宏生成编译器 handler,在 Compile() 中:① 刷新 UpdateDataSourceType,None 时报错;② 校验 FragmentType 已指定,否则报错 "FragmentType must be specified...";③ 生成 GetFragment_Entity_Unified / GetFragment_Template_Unified 调用,连接 DataSource 与 FragmentType(→ FragmentType 参数);④ 按 bGetMember 分派:成员模式——校验 StructMemberReference 有效,生成 UK2Node_GetStructRecursiveMember 节点(带相同成员引用),把 Getter 的 OutFragment 连到其 Struct,再把各成员输出连回代理引脚;标准模式——把 Getter 的 OutFragment 直接连到 OutFragment 代理引脚。勾选 bShowWorldContext 时,节点的 WorldContext 代理引脚经 MASSAPI_LINK_WC 连到 Getter 调用的 WorldContext 输入。

Generates a compiler handler via the HNCH macros. In Compile(): ① re-runs UpdateDataSourceType, erroring on None; ② validates FragmentType is set, otherwise errors "FragmentType must be specified..."; ③ spawns a GetFragment_Entity_Unified / GetFragment_Template_Unified call, linking DataSource and FragmentType (→ the FragmentType parameter); ④ dispatches on bGetMember: member mode — validates StructMemberReference, spawns a UK2Node_GetStructRecursiveMember node (same member reference), links the Getter's OutFragment to its Struct, then links each member output back to the proxy pins; standard mode — links the Getter's OutFragment directly to the OutFragment proxy pin. When bShowWorldContext is checked, the node's WorldContext proxy pin is linked to the Getter call's WorldContext input via MASSAPI_LINK_WC.

Input
参数 Param类型 Type说明 Description
CompilerContextFKismetCompilerContext&Kismet 编译上下文。Kismet compiler context.
SourceGraphUEdGraph*源图表。The source graph.
Output

无返回值。副作用:向编译消息日志报错(参数缺失时)、生成中间调用/拆分节点并接线。

No return value. Side effect: emits compile errors (when arguments are missing), spawns intermediate call/split nodes and wires them.

引脚名称常量 Pin Name Constants

静态函数 Static返回名称 Return说明 Description
DataSourcePinName()"DataSource"数据源通配符引脚名。Data source wildcard pin name.
FragmentTypePinName()"FragmentType"fragment 类型选择引脚名。Fragment type selector pin name.
FragmentOutPinName()"OutFragment"整个 fragment 输出引脚名(标准模式)。Whole-fragment output pin name (standard mode).
OutputPinName(MemberPath)路径转义名成员输出引脚名:路径点号替换为下划线。Member output pin name: path dots replaced with underscores.

成员变量 Members

名称 Name类型 Type默认值说明 Description
CachedDataSourceTypeEMassFragmentSourceDataTypeNone缓存的 DataSource 类型,由 UpdateDataSourceType 推断,驱动标题/颜色。枚举定义于 MassAPI/Public/MassAPIEnums.h。Cached DataSource type inferred by UpdateDataSourceType, driving the title/colors. Enum defined in MassAPI/Public/MassAPIEnums.h.
bShowWorldContextbool (UPROPERTY)falseDetails 面板 "Show World Context Pin" 开关(默认关闭)。勾选后节点出现可选的 WorldContext 输入引脚(UObject,默认值 self),编译时透传到内部调用的 WorldContext 输入;未勾选时内部调用保持 DefaultToSelf 自动填充行为——默认关闭零行为变化。引脚助手定义于 MassAPIWorldContextPin.h。"Show World Context Pin" toggle in the Details panel (off by default). When checked, the node gains an optional WorldContext input pin (UObject, default value self) wired through to the internal calls' WorldContext input at compile time; when unchecked, the internal calls keep their DefaultToSelf auto-fill behavior — default-off is a zero-behavior change. Pin helpers are defined in MassAPIWorldContextPin.h.
bGetMemberbool (UPROPERTY)false是否获取结构体成员:为 true 时显示成员选择(Details 面板)而非 OutFragment 引脚。Whether to get struct members: when true, shows member selection (Details panel) instead of the OutFragment pin.
StructMemberReferenceFStructRecursiveMemberReference (UPROPERTY, EditCondition=bGetMember)—递归结构体成员引用(支持嵌套与多选),bGetMember=true 时使用。Recursive struct member reference (nested and multi-select supported), used when bGetMember=true.

管线角色 Pipeline Role

纯编辑器节点,无运行时管线位置。编译期由 ExpandNode(HNCH handler)展开为 UMassAPIFuncLib::GetFragment_Entity_Unified / GetFragment_Template_Unified 函数调用,成员模式串联 UK2Node_GetStructRecursiveMember 拆分。编辑器集成:FragmentType 引脚由 FMassAPIPinFactory(注册于模块 StartupModule)挂载 SGraphPinMassFragmentType 下拉(过滤 FMassFragmentStructFilter,只显示 4 种 fragment 类型)。

Pure editor node with no runtime pipeline position. At compile time ExpandNode (HNCH handler) expands it into UMassAPIFuncLib::GetFragment_Entity_Unified / GetFragment_Template_Unified calls, chaining a UK2Node_GetStructRecursiveMember split in member mode. Editor integration: the FragmentType pin is handled by FMassAPIPinFactory (registered in the module StartupModule), attaching the SGraphPinMassFragmentType dropdown (filtered by FMassFragmentStructFilter, showing only the four fragment kinds).